blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
2
247
content_id
stringlengths
40
40
detected_licenses
listlengths
0
57
license_type
stringclasses
2 values
repo_name
stringlengths
4
111
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
58
visit_date
timestamp[ns]date
2015-07-25 18:16:41
2023-09-06 10:45:08
revision_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
committer_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
github_id
int64
3.89k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
25 values
gha_event_created_at
timestamp[ns]date
2012-06-07 00:51:45
2023-09-14 21:58:52
gha_created_at
timestamp[ns]date
2008-03-27 23:40:48
2023-08-24 19:49:39
gha_language
stringclasses
159 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
10.5M
extension
stringclasses
111 values
filename
stringlengths
1
195
text
stringlengths
7
10.5M
1c20a1b5007df649f6b3de62c8892d2122f581cc
c45ed46065d8b78dac0dd7df1c95b944f34d1033
/TC-SRM-571-div1-500/Remilia.cpp
e8f0215dde33d6136d739b5115232dc3a1fd76ef
[]
no_license
yzq986/cntt2016-hw1
ed65a6b7ad3dfe86a4ff01df05b8fc4b7329685e
12e799467888a0b3c99ae117cce84e8842d92337
refs/heads/master
2021-01-17T11:27:32.270012
2017-01-26T03:23:22
2017-01-26T03:23:22
84,036,200
0
0
null
2017-03-06T06:04:12
2017-03-06T06:04:12
null
UTF-8
C++
false
false
1,682
cpp
Remilia.cpp
#include <bits/stdc++.h> #define rep(x,a,b) for (int x=a;x<=(int)b;x++) #define drp(x,a,b) for (int x=a;x>=(int)b;x--) #define cross(x,a) for (int x=hd[a];~x;x=nx[x]) #define ll long long #define inf (1<<29) #define PII pair<int,int> #define PDD pair<double,double> #define mk(a,b) make_pair(a,b) #define fs first #define sc second #define pb push_back #define VI vector<int> #define VS vector<string> using namespace std; /* 搜 每条不存在的边都是一个限制,初始化答案为全集,然后决策每条不存在的边 一个状态有两分支当且仅当两个端点都在答案中,复杂度即为O(2^(n/3)n^2) */ const int maxn=55; ll mp[maxn]; const int dd=262143; int n32,d[maxn],ans=-1,n,val[maxn],sum,no[270000]; void dfs(int nw,int rem,int sum,ll ava){ if (nw==-1) return void(ans=sum); if ((ava>>nw)&1) dfs(nw-1,rem-1,sum,ava&mp[nw]),ava^=(1ll<<nw); int cnt=no[ava&dd]+no[ava>>18&dd]+no[ava>>36&dd]; if (rem>cnt) return; sum-=val[nw]; if (sum<ans) return; dfs(nw-1,rem,sum,ava); } bool cmp(const int &a,const int &b){return d[a]<n32?d[b]<n32?val[a]<val[b]:0:d[b]<n32?1:val[a]<val[b];} int idx[maxn]; int lowbit(int x){return x&-x;} struct MagicMolecule{ int maxMagicPower(VI pw,VS mpp){ n=pw.size(); rep(i,0,n-1) val[i]=pw[i],idx[i]=i; rep(i,0,n-1) rep(j,0,n-1) if (mpp[i][j]=='Y') d[i]++; rep(i,0,n-1) d[i]++; n32=(n*2+2)/3,sort(idx,idx+n,cmp); rep(i,0,n-1) val[i]=pw[idx[i]]; while (n>0&&d[idx[n-1]]<n32) n--; if (n<n32) return -1; rep(i,1,dd) no[i]=no[i-lowbit(i)]+1; rep(i,0,n-1) sum+=pw[idx[i]]; rep(i,0,n-1) rep(j,0,n-1) if (mpp[idx[i]][idx[j]]=='Y') mp[i]|=1ll<<j; dfs(n-1,n32,sum,(1ll<<n)-1); return ans; } };
beec0cbb3afc6b5ab6792a363e69cf0f4b7cccf9
19064bfde841ffc82d655d169ecdf643762b7ac2
/src/curse_api.h
b2e64162b229b65c034e08b4e7a1d21edd784063
[ "MIT" ]
permissive
modeco80/cursedl
d606566b95a7df44cfe50aac442e8132ea0ca155
b985bbde818f5fc9d5e8fd453afa542222f3a047
refs/heads/master
2020-08-07T02:35:57.195853
2019-10-08T13:33:35
2019-10-08T13:33:35
213,263,479
2
0
null
2019-10-07T21:09:13
2019-10-07T00:08:24
JavaScript
UTF-8
C++
false
false
660
h
curse_api.h
#pragma once #include "common.h" #include <nlohmann/json.hpp> namespace cursedl { namespace api { // generic error struct Error: public std::exception { std::string what_; Error(std::string what) : what_(what) {} const char* what() throw() { return what_.c_str(); } }; // document later nlohmann::json GetCurseFileInfo(const std::string& CurseProjectID); // gets ALL the files, // not just what latestFiles contains nlohmann::json GetCurseFiles(const std::string& CurseProjectID); std::tuple<bool, std::string> DownloadCurseFile(const nlohmann::json& CurseFileInfo); } }
d261331dc32dcfb3e41d0c800d33fb45fdb6575c
1b8ae41e4e43429ba6c21b49fdfa7312ddee23b3
/dp_labs_and_solutions/dp_labs_and_solutions/dp_cpp_labs_and_solutions/command/memento_solution/report_position_command.cpp
131d573ec8d52dbaf605f57b6124a3ddbbbdf076
[]
no_license
Technipire/Cpp
9f8476a944497b82ce425a3d9191acb74337a129
78d4c89385216865b9a9f475055fca1ff600d2a4
refs/heads/master
2021-05-01T16:31:45.977554
2017-04-03T00:02:01
2017-04-03T00:02:01
32,282,437
1
0
null
null
null
null
UTF-8
C++
false
false
351
cpp
report_position_command.cpp
// report_position_command.cpp #include "driver.h" #include "report_position_command.h" report_position_command::report_position_command(driver * a_driver) : simple_driver_command(a_driver) { } void report_position_command::execute() { get_driver()->report_position(); } void report_position_command::undo() { get_driver()->report_position(); }
d2e852d209d3b512858d6ecd4f9663575928c728
c17184eaeffe1427a9c05f57fb3fb48f6821e1cd
/functions/dlg/dialog.hpp
3812f7d01b0e5a3cda57cd10c34db0c4439e39b4
[]
no_license
FryCodar/Operation_Final_Strike.Tanoa
423605d495c78dae86f060ce5c023219bad4b0c7
a70ab876a601426a14946b3dd4cd8bb7ba1c48b5
refs/heads/master
2020-03-23T08:24:34.416443
2018-11-07T21:11:25
2018-11-07T21:11:25
141,325,108
0
0
null
null
null
null
UTF-8
C++
false
false
12,589
hpp
dialog.hpp
#include "define.hpp" class MSOT_Tactic_Table { idd = 36642; movingEnable = 0; enableSimulation = true; onLoad = "uiNamespace setVariable ['msot_dlg',[36642]];[] spawn MSOT_dlg_fnc_setDlgCtrl;"; onUnload = "uiNamespace setVariable ['msot_dlg',[]];"; class controls { class DIARSC(Tactic_Tab,Picture): DIARSC(normal,RscPicture) { idc = 10013;//9800 text = "functions\dlg\TacticTab.paa"; x = X_CENTERED(0.85); y = Y_CENTERED(0.73); w = W_SIZE(0.85); h = H_SIZE(0.73); }; class DIARSC(Pic_Use,show): DIARSC(alpha,RscPicture) { idc = 10014;//1200 text = "pics\MSOT.paa"; x = X_CENTERED(0.46);//0.438151 * safezoneW + safezoneX; y = Y_CENTERED(0.5);//0.33496 * safezoneH + safezoneY; w = W_SIZE(0.46); h = H_SIZE(0.5); }; class DIARSC(Back_All,Btn): DIARSC(normal,RscPicButton) { idc = 10015; colorText[] = {0,0,0,0}; colorFocused[] = {0,0,0,0}; // border color for focused state colorDisabled[] = {0,0,0,0}; // text color for disabled state colorBackground[] = {0,0,0,0}; colorBackgroundDisabled[] = {0,0,0,0}; // background color for disabled state colorBackgroundActive[] = {0,0,0,0}; colorShadow[] = {0,0,0,0}; colorBorder[] = {0,0,0,0}; x = X_CENTERED(0.07); y = Y_CALC(0.797);//0.797 * safezoneH + safezoneY; w = W_SIZE(0.07); h = H_SIZE(0.043); text = ""; toolTip = "Close Tablet"; action = "closeDialog ((uiNamespace getVariable ['msot_dlg',[0]]) select 0);"; }; class DIARSC(Artillery_1st,Btn): DIARSC(normal,RscPicButton) { idc = 10016; colorFocused[] = {0,0,0,0}; // border color for focused state colorDisabled[] = {0,0,0,0}; // text color for disabled state colorBackground[] = {0,0,0,0}; colorBackgroundDisabled[] = {0,0,0,0}; colorShadow[] = {0,0,0,0}; colorBorder[] = {0,0,0,0}; x = X_LEFT_SIDED(0.17,0.08); y = Y_UP_SIDED(0.2,0.08); w = W_SIZE(0.17); h = H_SIZE(0.2); text = "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\artillery_ca.paa"; toolTip = "Call Artillery Strike"; action = "createDialog 'MSOT_ARTILLERY_TABLE';"; }; class DIARSC(Airsupply_2nd,Btn): DIARSC(normal,RscPicButton) { idc = 10017; colorFocused[] = {0,0,0,0}; // border color for focused state colorDisabled[] = {0,0,0,0}; // text color for disabled state colorBackground[] = {0,0,0,0}; colorBackgroundDisabled[] = {0,0,0,0}; colorShadow[] = {0,0,0,0}; colorBorder[] = {0,0,0,0}; x = X_RIGHT_SIDED(0,0.08); y = Y_UP_SIDED(0.2,0.08); w = W_SIZE(0.17); h = H_SIZE(0.2); text = "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\supplydrop_ca.paa"; toolTip = "Call Air Supplies"; action = "hint 'Airsupply';"; }; class DIARSC(Aircas_3rd,Btn): DIARSC(normal,RscPicButton) { idc = 10018; colorFocused[] = {0,0,0,0}; // border color for focused state colorDisabled[] = {0,0,0,0}; // text color for disabled state colorBackground[] = {0,0,0,0}; colorBackgroundDisabled[] = {0,0,0,0}; colorShadow[] = {0,0,0,0}; colorBorder[] = {0,0,0,0}; x = X_LEFT_SIDED(0.17,0.08); y = Y_DOWN_SIDED(0,0.08); w = W_SIZE(0.17); h = H_SIZE(0.2); text = "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\cas_ca.paa"; toolTip = "Call Close Air Support (CAS)"; action = "hint 'C A S';"; }; class DIARSC(Satview_4th,Btn): DIARSC(normal,RscPicButton) { idc = 10019; colorFocused[] = {0,0,0,0}; // border color for focused state colorDisabled[] = {0,0,0,0}; // text color for disabled state colorBackground[] = {0,0,0,0}; colorBackgroundDisabled[] = {0,0,0,0}; colorShadow[] = {0,0,0,0}; colorBorder[] = {0,0,0,0}; x = X_RIGHT_SIDED(0,0.08); y = Y_DOWN_SIDED(0,0.08); w = W_SIZE(0.17); h = H_SIZE(0.2); text = "\a3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\gps_ca.paa"; toolTip = "Open SatView System"; action = "hint 'SatView';"; }; }; }; class MSOT_ARTILLERY_TABLE { idd = 36643; movingEnable = 0; enableSimulation = true; onLoad = "uiNamespace setVariable ['msot_dlg',[36643]];[0] spawn MSOT_dlg_fnc_wowArtillery;"; onUnload = "[2] spawn MSOT_dlg_fnc_setArtilleryMarker;"; class controls { class DIARSC(Backround_Artillery,Picture): DIARSC(normal,RscPicture) { idc = 10020;//9800 text = "functions\dlg\TacticTab.paa"; x = X_CENTERED(0.85); y = Y_CENTERED(0.73); w = W_SIZE(0.85); h = H_SIZE(0.73); }; class DIARSC(Back_Artillery,Btn): DIARSC(normal,RscPicButton) { idc = 10021; colorText[] = {0,0,0,0}; colorFocused[] = {0,0,0,0}; // border color for focused state colorDisabled[] = {0,0,0,0}; // text color for disabled state colorBackground[] = {0,0,0,0}; colorBackgroundDisabled[] = {0,0,0,0}; // background color for disabled state colorBackgroundActive[] = {0,0,0,0}; colorShadow[] = {0,0,0,0}; colorBorder[] = {0,0,0,0}; x = X_CENTERED(0.07); y = Y_CALC(0.797);//0.797 * safezoneH + safezoneY; w = W_SIZE(0.07); h = H_SIZE(0.043); text = ""; toolTip = "Go Back"; action = "closeDialog ((uiNamespace getVariable ['msot_dlg',[0]]) select 0);"; }; class DIARSC(Map_Artillery,Screen): DIARSC(normal,Map) { idc = 10022; x = X_CALC(0.28); y = Y_CENTERED(0.55); w = W_SIZE(0.45); h = H_SIZE(0.55); onMouseButtonClick = "[1,(_this select 0),(_this select 2),(_this select 3)] spawn MSOT_dlg_fnc_setArtilleryMarker;"; }; class DIARSC(Frame1_Artillery,Infoframe): DIARSC(normal,RscFrame) { idc = 10023; sizeEx = 0.04; text = "Available Artillery: "; //--- ToDo: Localize; x = X_RIGHT_SIDED(0.071,0); y = Y_CALC(0.215); w = W_SIZE(0.32); h = H_SIZE(0.12); }; class DIARSC(List1_Artillery,ListBox): DIARSC(normal,ListBox) { idc = 10024; style = "32 + 16"; colorBackground[] = {0,0,0,0.6}; x = X_RIGHT_SIDED(0.072,0); y = Y_CALC(0.240); w = W_SIZE(0.316); h = H_SIZE(0.09); onLBSelChanged = "[1,(_this select 1)] spawn MSOT_dlg_fnc_wowArtillery;"; }; class DIARSC(AddBtn_Artillery,ListBtn): DIARSC(normal,RscButton) { idc = 10025; colorShadow[] = {0,0,0,0}; colorBorder[] = {0,0,0,0.5}; colorBackground[] = {0.1, 0.8, 0.3, 0.8}; period = 0; x = X_RIGHT_SIDED(0.228,0); y = Y_CALC(0.34);//0.797 * safezoneH + safezoneY; w = W_SIZE(0.14); h = H_SIZE(0.03); text = "Add"; toolTip = "Add Vehicle"; action = "[2] spawn MSOT_dlg_fnc_wowArtillery;"; }; class DIARSC(RemBtn_Artillery,ListBtn): DIARSC(normal,RscButton) { idc = 10026; colorShadow[] = {0,0,0,0}; colorBorder[] = {0,0,0,0.5}; colorBackground[] = {1, 0,0, 0.8}; period = 0; x = X_RIGHT_SIDED(0.08,0); y = Y_CALC(0.34);//0.797 * safezoneH + safezoneY; w = W_SIZE(0.14); h = H_SIZE(0.03); text = "Remove"; toolTip = "Remove Vehicle"; action = "[4] spawn MSOT_dlg_fnc_wowArtillery;"; }; class DIARSC(Frame2_Artillery,Infoframe): DIARSC(normal,RscFrame) { idc = 10027; sizeEx = 0.04; text = "Selected Artillery: "; //--- ToDo: Localize; x = X_RIGHT_SIDED(0.071,0); y = Y_CALC(0.374); w = W_SIZE(0.32); h = H_SIZE(0.118); }; class DIARSC(List2_Artillery,ListBox): DIARSC(normal,ListBox) { idc = 10028; style = "32 + 16"; colorBackground[] = {0,0,0,0.6}; x = X_RIGHT_SIDED(0.072,0); y = Y_CALC(0.397); w = W_SIZE(0.316); h = H_SIZE(0.09); onLBSelChanged = "[3,(_this select 1)] spawn MSOT_dlg_fnc_wowArtillery;"; }; class DIARSC(Text1_Artillery,InfoText): DIARSC(normal,RscText) { idc = 10029;//9800 text = ""; colorBackground[] = {0.5, 0.2, 0.1, 0.8}; x = X_RIGHT_SIDED(0.070,0); y = Y_CALC(0.492); w = W_SIZE(0.32); h = H_SIZE(0.03); }; class DIARSC(Frame3_Artillery,Infoframe): DIARSC(normal,RscFrame) { idc = 10030; sizeEx = 0.04; text = "Artillery Ammo: "; //--- ToDo: Localize; x = X_RIGHT_SIDED(0.071,0); y = Y_CALC(0.52); w = W_SIZE(0.16); h = H_SIZE(0.1); }; class DIARSC(List3_Artillery,ListBox): DIARSC(normal,ListBox) { idc = 10031; colorBackground[] = {0,0,0,0.6}; x = X_RIGHT_SIDED(0.072,0); y = Y_CALC(0.542); w = W_SIZE(0.155); h = H_SIZE(0.075); onLBSelChanged = "[5,(_this select 1)] spawn MSOT_dlg_fnc_wowArtillery;"; }; class DIARSC(RelBtn_Artillery,ListBtn): DIARSC(normal,RscButton) { idc = 10032; colorShadow[] = {0,0,0,0}; colorBorder[] = {0,0,0,0.5}; colorBackground[] = {0.1,0.3,0.4, 0.8}; period = 0; x = X_RIGHT_SIDED(0.236,0); y = Y_CALC(0.542);//0.797 * safezoneH + safezoneY; w = W_SIZE(0.15); h = H_SIZE(0.075); text = "Reload"; toolTip = "Reload Vehicle"; action = "[6] spawn MSOT_dlg_fnc_wowArtillery;"; }; class DIARSC(Frame4_Artillery,Infoframe): DIARSC(normal,RscFrame) { idc = 10033; sizeEx = 0.04; text = "Rounds per Unit: "; //--- ToDo: Localize; x = X_RIGHT_SIDED(0.099,0); y = Y_CALC(0.62); w = W_SIZE(0.1); h = H_SIZE(0.06); }; class DIARSC(Edit_Artillery,InputEdit): DIARSC(normal,Edit) { idc = 10034; type = 2; style = 1; // multi line + no border maxChars = 2; x = X_RIGHT_SIDED(0.135,0); y = Y_CALC(0.642); w = W_SIZE(0.03); h = H_SIZE(0.032); text = "0"; }; class DIARSC(Text2_Artillery,InfoText): DIARSC(normal,RscText) { idc = 10035;//9800 text = "Total Rounds:"; colorBackground[] = {0.5, 0.2, 0.1, 0.8}; x = X_RIGHT_SIDED(0.236,0); y = Y_CALC(0.632); w = W_SIZE(0.07); h = H_SIZE(0.02); }; class DIARSC(TRoundNum_Artillery,InfoText): DIARSC(normal,RscText) { idc = 10036;//9800 style = 1; text = "0"; colorBackground[] = {0.5, 0.2, 0.1, 0.8}; x = X_RIGHT_SIDED(0.356,0); y = Y_CALC(0.632); w = W_SIZE(0.03); h = H_SIZE(0.02); }; class DIARSC(Text3_Artillery,InfoText): DIARSC(normal,RscText) { idc = 10037;//9800 style = 2; text = "ETA(sec):"; colorBackground[] = {0.5, 0.2, 0.1, 0.8}; x = X_RIGHT_SIDED(0.236,0); y = Y_CALC(0.655); w = W_SIZE(0.07); h = H_SIZE(0.02); }; class DIARSC(ETANum_Artillery,InfoText): DIARSC(normal,RscText) { idc = 10038;//9800 style = 1; text = "0"; colorBackground[] = {0.5, 0.2, 0.1, 0.8}; x = X_RIGHT_SIDED(0.356,0); y = Y_CALC(0.655); w = W_SIZE(0.03); h = H_SIZE(0.02); }; class DIARSC(Frame5_Artillery,Infoframe): DIARSC(normal,RscFrame) { idc = 10033; sizeEx = 0.04; text = "Safety Switch: "; //--- ToDo: Localize; x = X_RIGHT_SIDED(0.099,0); y = Y_CALC(0.688); w = W_SIZE(0.1); h = H_SIZE(0.07); }; class DIARSC(ChkBox1_Artillery,CheckBox): DIARSC(normal,Checkboxes) { idc = 10039; x = X_RIGHT_SIDED(0.115,0); y = Y_CALC(0.71); w = W_SIZE(0.07); h = H_SIZE(0.044); onCheckBoxesSelChanged = "[7,_this] spawn MSOT_dlg_fnc_wowArtillery;"; }; class DIARSC(FireBtn_Artillery,ActBtn): DIARSC(normal,RscButton) { idc = 10040; colorShadow[] = {0,0,0,0}; colorBorder[] = {0,0,0,0.5}; colorBackground[] = {1,0.4,0, 1}; period = 0; x = X_RIGHT_SIDED(0.236,0); y = Y_CALC(0.69);//0.797 * safezoneH + safezoneY; w = W_SIZE(0.15); h = H_SIZE(0.075); text = "FIRE"; toolTip = ""; action = "[8] spawn MSOT_dlg_fnc_wowArtillery;"; }; }; };
57c6b7f3753bc5b43fbb2be7ed101b5767ee6874
f2d5026f828f24e09ad91954599252295133ee14
/src/test.cpp
8bb4f34c2b7a5afc7277dfaa7fdf6eca71cba46f
[ "BSD-3-Clause" ]
permissive
nilsbore/roswasm
391ae71f6f6895c8533127762baac32906c416ea
fe3d9e370dd4eae7b71717f9d0df2f0e84040b57
refs/heads/master
2021-04-18T09:43:34.285226
2020-06-06T11:30:47
2020-06-06T11:30:47
249,531,217
0
0
null
2020-03-23T20:40:20
2020-03-23T19:59:42
C++
UTF-8
C++
false
false
1,557
cpp
test.cpp
#include <stdio.h> #include <emscripten.h> #include <iostream> #include <roswasm/roswasm.h> #include <std_msgs/String.h> #include <sensor_msgs/NavSatFix.h> #include <rosapi/TopicType.h> roswasm::NodeHandle* nh; roswasm::Subscriber* string_sub; roswasm::Subscriber* gps_sub; roswasm::Publisher* string_pub; roswasm::ServiceClient* service; roswasm::Timer* timer; void string_callback(const std_msgs::String& msg) { printf("Got string message in callback: %s\n", msg.data.c_str()); } void gps_callback(const sensor_msgs::NavSatFix& msg) { printf("Got string message in callback: %s\n", msg.header.frame_id.c_str()); } void service_callback(const rosapi::TopicType::Response& res, bool result) { printf("Got service response with value: %s\n", res.type.c_str()); } void timer_callback(const ros::TimerEvent& ev) { printf("Got timer callback!\n"); } void loop() { std_msgs::String msg; msg.data = "LOOPING"; string_pub->publish(msg); } extern "C" int main(int argc, char** argv) { nh = new roswasm::NodeHandle(); string_sub = nh->subscribe<std_msgs::String>("test", string_callback); gps_sub = nh->subscribe<sensor_msgs::NavSatFix>("test2", gps_callback); string_pub = nh->advertise<std_msgs::String>("test"); service = nh->serviceClient<rosapi::TopicType>("/rosapi/topic_type", service_callback); rosapi::TopicType::Request req; req.topic = "/connected_clients"; service->call<rosapi::TopicType>(req); timer = nh->createTimer(5., timer_callback); emscripten_set_main_loop(loop, 1, 1); return 0; }
91539a6850ec44dec76f15a0bf7f730987d097b1
1ab20e81e7252268ccb0ed61efa1b502c96b739e
/Source/DirectX/DirectInput.h
8a0d56548a79794c8f00f6fa0a5cf4a41a354366
[]
no_license
BayaSea0907/MyShootingGame
44af0907d4650f7aed81bc5e0bce049c78dcef4e
e288385b48ed443c1d43fd9bbce5c6eed2ad32d5
refs/heads/master
2020-12-06T05:41:17.165750
2020-01-09T14:29:23
2020-01-09T14:29:23
232,361,791
0
0
null
2020-01-09T14:29:24
2020-01-07T16:02:44
C++
SHIFT_JIS
C++
false
false
1,904
h
DirectInput.h
//********************************************************** // ファイル名 :DirectInput.h //********************************************************** #pragma once #pragma warning(disable:4996) #define DIRECTINPUT_VERSION 0x0800 #define INPUT_QUANTITY_RATE 150 #define DI_KEYBOARD_BUFFER_SIZE 256 #define DI_JOYSTICK1_BUTTON_SIZE 32 #define DI_JOYSTICK2_BUTTON_SIZE 128 #define DI_MOUSE1_BUTTON_SIZE 4 #define DI_MOUSE2_BUTTON_SIZE 8 #include <dInput.h> #include "../Temp/stdafx.h" #include "../Engine/Input/InputEngine.h" #include "../Engine/Input/MyInputCodeList.h" #include "../Engine/Input/Input.h" #pragma comment(lib,"dxguid") #pragma comment(lib,"dInput8") class CDirectInput : public CInputEngine { public: CDirectInput(); ~CDirectInput(); void Initialize(); void Release(); void Update(); // 任意のデバイスを作成 void CreateKeyboard(HWND hWnd_); void CreateMouse(HWND hWnd_); void CreateJoystick(HWND hWnd_); // 任意のデバイスを解放 void ReleaseKeyboard(); void ReleaseMouse(); void ReleaseJoystick(); private: // デバイスのポインタ LPDIRECTINPUT8 m_lpDI; LPDIRECTINPUTDEVICE8 m_lpKeyboard; LPDIRECTINPUTDEVICE8 m_lpMouse; LPDIRECTINPUTDEVICE8 m_lpJoystick; // 現在の入力情報 DIMOUSESTATE m_mouseCurrentState; DIJOYSTATE m_joystickCurrentState; byte m_keyboardCurrentState[DI_KEYBOARD_BUFFER_SIZE]; // 前フレームの座標 DIMOUSESTATE m_mousePrevState; // 任意のデバイスを更新 void UpdateKeyboard(); void UpdateMouse(); void UpdateJoystick(); // デバイスが接続されているかチェック bool IsKeyboardConected()const; bool IsMouseConected()const; bool IsJoystickConected()const; bool CheckInputDeviceConectted()const; // スティックの軸調整用 float AdjustValue(const LONG n); // 入力情報更新用 void UpdateInputFlag(bool isInput_, InputFlag& flag_); };
619893bbf067030154ace690894cb612c0085db5
48988ece950f9fc9b1d94e707b816f867e706983
/Data/data.cpp
2994cf21c7ed16b5211c7b51513333ddf8ed7fd1
[]
no_license
wallaceviniciusdev/Roteiro-1
4c5b4648f904c2b2157503fe897095ffae790cce
ec020fa14aba441fb0356bb525829b3c3ce9300a
refs/heads/master
2020-04-11T04:39:22.361345
2019-02-20T18:50:19
2019-02-20T18:50:19
161,520,451
0
0
null
null
null
null
UTF-8
C++
false
false
1,503
cpp
data.cpp
#include <iostream> #include "data.h" Data::Data(){ this->dia = 0; this->mes = 0; this->ano = 0; } void Data::setDia(int dia){ if(this->dia <= 31){ this->dia = dia; }else{ cout << "Dia invalido" << endl; } } void Data::setMes(int mes){ if(this->mes <= 12 && this>mes >= 1){ this->mes = mes; }else{ cout << "Mês invalido" << endl; } } void Data::setAno(int ano){ if(this->ano < 0){ this->ano = ano; } } void Data::avancarData(){ if(this->mes==4 || this->mes==6 || this->mes==9 || this->mes==11){ if(this->dia != 30){ cout << this->dia+1 <<" / "<< this->mes << " / " <<this->ano << endl; }else if(this->dia >= 31){ cout<<"Data Inexistente!\n"; }else{ this->dia = 1; cout<< this->dia << "/ " << this->mes+1 << " / " << this->ano << endl; } }else if(this->mes==2){ if(this->dia!=28 && this->dia !=29){ cout<<this->dia+1<<" / " << this->mes << " / " <<this->ano<<" \n"; }else{ if(this->mes==2 && this->ano%4==0){ if(this->dia==29){ this->dia = 1; cout<<"01 / " << this->mes+1 << " / "<<this->ano<< endl; }else{ cout<< this->dia+1 << "/" << this->mes << "/" << this->ano << endl; } } } }else if(this->mes==12 && this->dia==31){ this->dia = 1; this->mes = 1; cout << this->dia << "/" << this->mes << "/" <<this->ano+1<< endl; }else{ cout<<dia+1 <<" / "<<mes<<" / "<<ano<< endl; } } int Data::getDia(){ return this->dia; } int Data::getMes(){ return this->mes; } int Data::getAno(){ return this->ano; }
603f79de829909e2bdf55945233ef2ed8230f7f1
f6d089cbcd7d419db79e44e071741dde273d9949
/src/vm/vm.cpp
c1b39fb132b591f2fe2693b709e90068738b0fcd
[ "MIT" ]
permissive
BastianBlokland/novus
19df4ef6c59ebb337dfe9a6632b092596e047d46
f08f068a0aad5c3c18fcef3941ceb20e91cc7975
refs/heads/master
2022-07-27T17:06:54.608974
2022-07-08T12:55:36
2022-07-08T12:55:36
211,661,903
18
1
MIT
2022-07-08T12:55:37
2019-09-29T12:46:35
C++
UTF-8
C++
false
false
4,790
cpp
vm.cpp
#include "vm/vm.hpp" #include "internal/executor.hpp" #include "internal/executor_registry.hpp" #include "internal/interupt.hpp" #include "internal/os_include.hpp" #include "internal/platform_utilities.hpp" #include "internal/ref_allocator.hpp" #include "vm/platform_interface.hpp" #include <csignal> namespace vm { #if defined(_WIN32) static auto setupWinsock(internal::Settings* settings) noexcept { if (settings->socketsEnabled) { const auto reqWsaVersion = MAKEWORD(2, 2); WSADATA wsaData; if (::WSAStartup(reqWsaVersion, &wsaData) != 0) { settings->socketsEnabled = false; } // Verify that WSA 2.2 is supported. if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2) { ::WSACleanup(); settings->socketsEnabled = false; } } } static auto setupInputConsole(internal::Settings* settings, PlatformInterface* iface) noexcept { if (!::GetConsoleMode(iface->getStdIn(), &settings->win32OriginalInputConsoleMode)) { return false; } DWORD newInputConsoleMode = settings->win32OriginalInputConsoleMode; newInputConsoleMode |= 0x0001; // ENABLE_PROCESSED_INPUT 0x0001 newInputConsoleMode |= 0x0200; // ENABLE_VIRTUAL_TERMINAL_INPUT 0x0200 if (!::SetConsoleMode(iface->getStdIn(), newInputConsoleMode)) { return false; } if (!::SetConsoleCP(CP_UTF8)) { return false; } return true; } static auto setupOutputConsole(internal::Settings* settings, PlatformInterface* iface) noexcept { // Save the original console mode. if (!::GetConsoleMode(iface->getStdOut(), &settings->win32OriginalOutputConsoleMode)) { return false; } DWORD newOutputConsoleMode = settings->win32OriginalOutputConsoleMode; newOutputConsoleMode |= 0x0004; // ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 if (!::SetConsoleMode(iface->getStdOut(), newOutputConsoleMode)) { return false; } if (!::SetConsoleOutputCP(CP_UTF8)) { return false; } return true; } static auto restoreInputConsole(const internal::Settings* settings, PlatformInterface* iface) noexcept { return ::SetConsoleMode(iface->getStdIn(), settings->win32OriginalInputConsoleMode) == 0; } static auto restoreOutputConsole(const internal::Settings* settings, PlatformInterface* iface) noexcept { return ::SetConsoleMode(iface->getStdOut(), settings->win32OriginalOutputConsoleMode) == 0; } static auto setup(internal::Settings* settings, PlatformInterface* iface) noexcept { setupWinsock(settings); setupInputConsole(settings, iface); setupOutputConsole(settings, iface); internal::setupPlatformUtilities(); if (settings->interceptInterupt) { settings->interceptInterupt = internal::interruptSetupHandler(); } } static auto teardown(const internal::Settings* settings, PlatformInterface* iface) noexcept { if (settings->socketsEnabled) { ::WSACleanup(); } restoreInputConsole(settings, iface); restoreOutputConsole(settings, iface); internal::teardownPlatformUtilities(); } #else // !_WIN32 static auto setup(internal::Settings* settings, PlatformInterface* /*unused*/) noexcept { // Ignore sig-pipe (we want to handle it on a per call basis instead of globally). signal(SIGPIPE, SIG_IGN); internal::setupPlatformUtilities(); if (settings->interceptInterupt) { settings->interceptInterupt = internal::interruptSetupHandler(); } } static auto teardown(const internal::Settings* /*unused*/, PlatformInterface* /*unused*/) noexcept { } #endif // !_WIN32 auto run(const novasm::Executable* executable, PlatformInterface* iface) noexcept -> ExecState { auto execRegistry = internal::ExecutorRegistry{}; auto memAlloc = internal::MemoryAllocator{}; auto refAlloc = internal::RefAllocator{&memAlloc}; auto gc = internal::GarbageCollector{&refAlloc, &execRegistry}; if (unlikely(gc.startCollector() == internal::GarbageCollector::CollectorStartResult::Failure)) { return ExecState::VmInitFailed; } auto settings = internal::Settings{}; settings.socketsEnabled = true; // TODO: Make configurable. settings.interceptInterupt = true; // TODO: Make configurable. setup(&settings, iface); auto resultState = execute( &settings, executable, iface, &execRegistry, &refAlloc, &gc, executable->getEntrypoint(), 0, nullptr, nullptr); // Terminate the garbage-collector (finishes any ongoing collections). gc.terminateCollector(); // Abort all executors that are still running. // NOTE: First terminate the garbage collector as that might attempt to pause / resume executors // while we are trying to abort them. execRegistry.abortExecutors(); assert(execRegistry.isAborted()); teardown(&settings, iface); return resultState; } } // namespace vm
8e893b97b27c5727612fdf483e34387cfc7ce14b
dad1f4d9d571fdb3dd72b501ce0ba65c8c428363
/Leetcode/adhoc/280. Wiggle Sort.cpp
60892e2fe7270d19be29ae7c27b9bb16e188d363
[]
no_license
quangh33/Coding-Interview-Practice
bb1e9260976c0c06808e61c879aae02116b86303
675460410770239c8618528e65865a4bfc76748d
refs/heads/master
2021-07-13T10:27:28.940082
2020-09-29T05:08:37
2020-09-29T05:08:37
201,436,213
1
0
null
null
null
null
UTF-8
C++
false
false
476
cpp
280. Wiggle Sort.cpp
// // Created by Hoang, Quang on 2019-12-15. // class Solution { public: void wiggleSort(vector<int> &nums) { bool less = true; if (nums.size() == 0) return; for (int i = 0; i < nums.size() - 1; i++) { if (less) { if (nums[i] > nums[i + 1]) swap(nums[i], nums[i + 1]); } else { if (nums[i] < nums[i + 1]) swap(nums[i], nums[i + 1]); } less = !less; } } };
a63d70ebad297dd799e2f1bfa850196e10f05c62
4b591de69213e0194e9d6018d0158e98bf26e2bc
/Saber-Plus/spdiagnosticsissuefactory.cpp
77b0136614556b69751f6129aafa7dcf0cbd8839
[ "MIT" ]
permissive
sratix/Saber-Plus
dd28a265a3cd3e7b86b0b0f9b3ff1d6bb0c42220
1c81a3e667a81e9bb937b2af96047a5cb776cb71
refs/heads/master
2020-05-18T20:39:56.689711
2019-04-17T05:51:08
2019-04-17T05:51:08
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,812
cpp
spdiagnosticsissuefactory.cpp
#include "spdiagnosticsissuefactory.h" #include <string> #include <iostream> #include "spdiagnosticissuedataunusedclass.h" #include <QRegularExpression> SPDiagnosticsIssueFactory::SPDiagnosticsIssueFactory() { } shared_ptr<SPDiagnosticIssue> SPDiagnosticsIssueFactory::issue(shared_ptr<string>diagnosticIssueMessage, shared_ptr<string>filePath) { auto issue = make_shared<SPDiagnosticIssue>(diagnosticIssueMessage, filePath, SPDiagnosticIssueTypeGeneric); { // incomplete type auto regexp = QRegularExpression("error: invalid use of incomplete type .*class ([a-zA-Z]*)"); auto matchIterator = regexp.globalMatch(QString(diagnosticIssueMessage->c_str())); while (matchIterator.hasNext()) { auto match = matchIterator.next(); auto unusedClassName = make_shared<string>(match.captured(1).toUtf8()); auto unusedClassData = make_shared<SPDiagnosticIssueDataUndefinedClass>(); unusedClassData->unusedClassName = unusedClassName; issue->data = unusedClassData; issue->type = SPDiagnosticIssueTypeUndefinedClass; cout << unusedClassName->c_str() << endl; return issue; } } { // not declared auto regexp = QRegularExpression("error: ‘([a-zA-Z]*)’ has not been declare"); auto matchIterator = regexp.globalMatch(QString(diagnosticIssueMessage->c_str())); while (matchIterator.hasNext()) { auto match = matchIterator.next(); auto unusedClassName = make_shared<string>(match.captured(1).toUtf8()); auto unusedClassData = make_shared<SPDiagnosticIssueDataUndefinedClass>(); unusedClassData->unusedClassName = unusedClassName; issue->data = unusedClassData; issue->type = SPDiagnosticIssueTypeUndefinedClass; cout << unusedClassName->c_str() << endl; return issue; } } { // not declared auto regexp = QRegularExpression("error: ‘([a-zA-Z]*)’ was not declared in this scope"); auto matchIterator = regexp.globalMatch(QString(diagnosticIssueMessage->c_str())); while (matchIterator.hasNext()) { auto match = matchIterator.next(); auto unusedClassName = make_shared<string>(match.captured(1).toUtf8()); auto unusedClassData = make_shared<SPDiagnosticIssueDataUndefinedClass>(); unusedClassData->unusedClassName = unusedClassName; issue->data = unusedClassData; issue->type = SPDiagnosticIssueTypeUndefinedClass; cout << unusedClassName->c_str() << endl; return issue; } } cout << diagnosticIssueMessage->c_str() << endl; return issue; }
98a559922beeb825ec799275ab4371c92fc3f783
68b7091739c6e572691026bfbd23997795767b37
/src/xtion.cpp
25624e4a0bfaba566adfaa7527cd649a36a3efca
[ "MIT" ]
permissive
caomw/RovinaSemanticSegmentation
19a96706a432c98cd69b6595fa0e3d84ada7ab43
7fb430d65954c8dfbe22eb827183b97c9d736414
refs/heads/master
2020-12-25T23:36:06.768877
2016-08-24T16:29:29
2016-08-24T16:29:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,014
cpp
xtion.cpp
// local includes #include "xtion.h" // Ros includes #include <cv_bridge/cv_bridge.h> #include <ros/ros.h> #include <algorithm> Xtion::Xtion(std::string name): _name(name){ _has_depth = false; _has_color = false; _has_calibration = false; _last_id = 0; _frame_id_aquired = false; } std::string Xtion::getName(){ return _name; } std::string Xtion::getFrameId(){ if(_frame_id_aquired){ return _frame_id; }else{ throw std::runtime_error("Camera " + _name + " did not receive any messages yet, so a frame id could not be determined."); } } void Xtion::addTopic(std::string topic){ //Check if this is rgb (or color) / depth. if(topic.find("rgb") != std::string::npos || topic.find("color") != std::string::npos){ if(!_has_color){ _color_topic = topic; _has_color = true; }else{ throw std::runtime_error("Camera " + _name + " already has the color topic: " + _color_topic + " but :" + topic + " should be added!"); } }else if(topic.find("depth") != std::string::npos){ if(!_has_depth){ _depth_topic = topic; _has_depth = true; }else{ throw std::runtime_error("Camera " + _name + " already has the color topic: " + _depth_topic + " but :" + topic + " should be added!"); } }else{ throw std::runtime_error("Missformed topic name: " + topic + " found"); } } void Xtion::setCalibration(Calibration c){ _calibration = c; _has_calibration= true; } Calibration& Xtion::getCalibration(){ if( !_has_calibration){ throw std::runtime_error("Camera " + _name + " has no calibration yet."); }else{ return _calibration; } } bool Xtion::isComplete(){ return _has_color && _has_depth; } void Xtion::color_callback(const sensor_msgs::Image::ConstPtr &image){ cv_bridge::CvImageConstPtr cv_ptr; try { cv_ptr = cv_bridge::toCvShare(image); } catch (const cv_bridge::Exception& e) { ROS_ERROR("cv_bridge exception: %s", e.what()); return; } cv::Mat temp(cv_ptr->image); _color_maps.push_back(std::pair<int, cv::Mat>(image->header.seq, temp.clone())); if(_frame_id_aquired == false){ _frame_id = image->header.frame_id; _frame_id_aquired = true; } } void Xtion::depth_callback(const sensor_msgs::Image::ConstPtr &image){ cv_bridge::CvImageConstPtr cv_ptr; try { cv_ptr = cv_bridge::toCvShare(image); } catch (const cv_bridge::Exception& e) { ROS_ERROR("cv_bridge exception: %s", e.what()); return; } cv::Mat temp(cv_ptr->image); _depth_maps.push_back(std::pair<int, cv::Mat>(image->header.seq, temp.clone())); } void Xtion::subscribeCamera(image_transport::ImageTransport& _it){ if(isComplete()){ _subscriber_color = _it.subscribe(_color_topic, 100, &Xtion::color_callback, this); _subscriber_depth = _it.subscribe(_depth_topic, 100, &Xtion::depth_callback, this); }else{ throw std::runtime_error("Camera " + _name + " did not have both color and depth topic, so subscribing failed!"); } } bool Xtion::getUpToId(int id, std::vector<std::pair< int, cv::Mat > >& color, std::vector<std::pair< int, cv::Mat > >& depth){ if(id < _color_maps.front().first){ //We no longer have (or never had) this id. return false; } if(id > std::min(_color_maps.back().first, _depth_maps.back().first)){ throw std::runtime_error("Requested id is not even available yet!"); }else{ // Okay, we can work with this int available_id; //As some messages might be dropped, the lists don't need to align. We need to get the depth and color separately :( available_id = _color_maps.front().first; while (available_id <= id){ color.push_back(_color_maps.front()); _color_maps.pop_front(); available_id = _color_maps.front().first; } available_id = _depth_maps.front().first; while (available_id <= id){ depth.push_back(_depth_maps.front()); _depth_maps.pop_front(); available_id = _depth_maps.front().first; } return true; } } bool Xtion::getIdAndClear(int id, std::pair< int, cv::Mat >& color, std::pair< int, cv::Mat >& depth){ // Check if the requested id is that of an old image. if(id < _last_id){ _last_id = std::max(_last_id, id); return false; } if(id > std::min(_color_maps.back().first, _depth_maps.back().first)){ throw std::runtime_error("Requested id is not even available yet!"); }else{ // Okay, we can work with this int available_id; //As some messages might be dropped, the lists don't need to align. We need to get the depth and color separately :( available_id = _color_maps.front().first; while (available_id < id){ _color_maps.pop_front(); available_id = _color_maps.front().first; } color = _color_maps.front(); _color_maps.pop_front(); available_id = _depth_maps.front().first; while (available_id < id){ _depth_maps.pop_front(); available_id = _depth_maps.front().first; } depth = _depth_maps.front(); _depth_maps.pop_front(); _last_id = std::max(_last_id, id); return true; } } std::string Xtion::parseNameFromTopics(std::string topic){ size_t pos = topic.find("/", 1); //skip the first, as it is a slash, then go find the second. std::string id = topic.substr(1, pos-1); //This is a bit dirty. Now some topics start with /ban/camera.... //so the first part of the topic cannot be used as the unique identifier. //We assume that the second occurance of the string should be fine. if (pos < 8){ //This does not contain camera pos = topic.find("/", pos+1); } return topic.substr(1, pos-1); }
056b11ee853416ee261c7a506ebd22ad32aab182
e6ff3e907305b22a5dfe553a3a85a752aa651f0d
/PDF++/pdfException.h
06ca214fb6f04efa60b6a5b74f2fcb6ddd0f7196
[ "MIT" ]
permissive
GlenUnderwood/PdfCPP
02a4020a56693e93cb748147698568eba80fe5d9
4a762a19145ef836aa8472907c5c74df559825e2
refs/heads/master
2021-01-11T22:16:04.123039
2017-03-07T20:02:54
2017-03-07T20:02:54
78,941,766
0
0
null
null
null
null
UTF-8
C++
false
false
6,481
h
pdfException.h
#pragma once #include <string> #include <exception> #include "Serializable.h" #include "ExportDef.h" #ifdef _DEBUG #include <iostream> #endif namespace Pdf { namespace Exception { // //typedef std::string PDF_API CMyString; // //class PDF_API CMyStrClass : public std::string //{ //public: //}; /////////////////////////////////////////////////////////////////////// class PDF_API pdfException : public std::exception, public CSerializable { public: pdfException(void); #ifdef _MSC_VER explicit pdfException(const char * const & psz ) : std::exception(psz) { m_err = -1;} ; pdfException(const char * const & psz, int i) : std::exception(psz, i) {m_err = i;} ; pdfException(const pdfException& ex) : std::exception(ex.what()) {m_err = ex.m_err ;} ; pdfException(const std::exception& ex) : std::exception(ex.what()) {m_err = -1;} ; #else explicit pdfException(const char * const & psz ) { m_err = -1; m_what = psz; } ; pdfException(const char * const & psz, int i) {m_err = i; m_what = psz; } ; pdfException(const pdfException& ex) {m_err = ex.m_err ; m_what = ex.m_what; } ; pdfException(const std::exception& ex) {m_err = -1; m_what = ex.what();} ; #endif virtual ~pdfException(void); // CSerializable void Serialize( std::ostream& stm ); inline int err() const throw() { return m_err; }; inline const char* explanation() const throw() { return m_explanation.c_str(); }; #ifdef __GNUC__ virtual const char* what() const _GLIBCXX_USE_NOEXCEPT { return m_what.c_str(); }; #endif protected: #ifdef __GNUC__ std::string m_what; #endif std::string m_explanation; int m_err; }; /////////////////////////////////////////////////////////////////////// class PDF_API pdfNotImplException : public pdfException { public: pdfNotImplException() : pdfException("Not implemented", -2) { }; }; /////////////////////////////////////////////////////////////////////// class PDF_API pdfTypeMismatchException : public pdfException { public: pdfTypeMismatchException() : pdfException("Type mismatch.", -3) { #ifdef _DEBUG std::clog << *this << std::endl; #endif }; }; class PDF_API pdfBadIndexException : public pdfException { public: pdfBadIndexException() : pdfException("Key or Index out of range.", -4) { }; }; /////////////////////////////////////////////////////////////////////// class PDF_API pdfDocUndefinedException : public pdfException { public: pdfDocUndefinedException() : pdfException("Atoms require a valid document.", -5) { }; }; /////////////////////////////////////////////////////////////////////// class PDF_API pdfAlreadyChildException : public pdfException { public: pdfAlreadyChildException() : pdfException("Atom is already a child of another collection.", -6) { }; }; /////////////////////////////////////////////////////////////////////// class PDF_API pdfBadRelationshipException : public pdfException { public: pdfBadRelationshipException() : pdfException("Cannot set an Atom object to refer to itself.", -7) { }; }; /////////////////////////////////////////////////////////////////////// class PDF_API pdfBlankKeyException : public pdfException { public: pdfBlankKeyException() : pdfException("Cannot have a blank key for a dictionary member.", -8) { }; }; /////////////////////////////////////////////////////////////////////// class PDF_API pdfBlankNameException : public pdfException { public: pdfBlankNameException() : pdfException("A name object cannot be blank.", -9 ) { }; }; /////////////////////////////////////////////////////////////////////// class PDF_API pdfObjectUninitializedEx : public pdfException { public: pdfObjectUninitializedEx() : pdfException("Object requires a valid document and/or atom.", -10) { }; }; /////////////////////////////////////////////////////////////////////// class PDF_API pdfObjectInvalidEx : public pdfException { public: pdfObjectInvalidEx() : pdfException("Object is not of the right type. ", -11) { // m_explanation = "Either a pdfObject has not been assigned a dictionary or array pdf object OR the pdf object's type attribute doesn't match the functionality of the pdfObject being used on it. pdfPage, for example, looks for '/Type(Page)' in the dictionary."; m_explanation = "A pdfObject has not been assigned a dictionary or array pdf object whose type attribute doesn't match the functionality of the kind pdfObject being used on it. pdfPage, for example, looks for '/Type /Page' in its dictionary."; }; }; /////////////////////////////////////////////////////////////////////// class PDF_API pdfUnhandledSecurityEx : public pdfException { public: pdfUnhandledSecurityEx(const std::string& szMsg) : pdfException(szMsg.c_str(), -12) { }; pdfUnhandledSecurityEx(const char* szMsg) : pdfException(szMsg, -12) { }; //pdfUnhandledSecurityEx() : pdfException("Object is not of the right type. ", -12) //{ //}; }; /////////////////////////////////////////////////////////////////////// class PDF_API pdfUnauthorizedEx : public pdfException { public: pdfUnauthorizedEx(const std::string& szMsg) : pdfException(szMsg.c_str(), -13) { }; pdfUnauthorizedEx(const char* szMsg) : pdfException(szMsg, -13) { }; pdfUnauthorizedEx() : pdfException("Unauthorized.", -13) { }; }; /////////////////////////////////////////////////////////////////////// class PDF_API pdfNeedUserPwdEx : public pdfException { public: pdfNeedUserPwdEx(const std::string& szMsg) : pdfException(szMsg.c_str(), -14) { }; pdfNeedUserPwdEx(const char* szMsg) : pdfException(szMsg, -14) { }; pdfNeedUserPwdEx() : pdfException("A user password is required to open.", -14) { }; }; /////////////////////////////////////////////////////////////////////// class PDF_API pdfDocClosedException : public pdfException { public: pdfDocClosedException() : pdfException("Document has not been opened/initialized.", -15) { }; }; /////////////////////////////////////////////////////////////////////// class PDF_API pdfUnhandledColorSpaceEx : public pdfException { public: pdfUnhandledColorSpaceEx() : pdfException("Unhandled ColorSpace.", -16) { }; }; /////////////////////////////////////////////////////////////////////// class PDF_API pdfUnrecognizedItemTypeEx : public pdfException { public: pdfUnrecognizedItemTypeEx() : pdfException( "Unrecognized item type.", -17 ) { }; }; };// namespace Exception };// namespace Pdf //PDF_API std::ostream& operator<<( std::ostream& stm, const Pdf::Exception::pdfException& atm );
fc6c37da618f7964fe77c2cf8fccd2946b0d99ab
cc13bdb0f445b8acf6bec24946fcfb5e854989b6
/Pods/gRPC-Core/src/core/ext/transport/chttp2/transport/hpack_encoder.cc
16a46953cfc967a6a9673ab858c781136ba1aaba
[ "MIT", "Apache-2.0" ]
permissive
devMEremenko/XcodeBenchmark
59eaf0f7d6cdaead6338511431489d9d2bf0bbb5
3aaaa6aa4400a20513dd4b6fdb372c48b8c9e772
refs/heads/master
2023-09-04T08:37:51.014081
2023-07-25T23:37:37
2023-07-25T23:37:37
288,524,849
2,335
346
MIT
2023-09-08T16:52:16
2020-08-18T17:47:47
Swift
UTF-8
C++
false
false
34,543
cc
hpack_encoder.cc
/* * * Copyright 2015 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #include <grpc/support/port_platform.h> #include "src/core/ext/transport/chttp2/transport/hpack_encoder.h" #include <assert.h> #include <string.h> /* This is here for grpc_is_binary_header * TODO(murgatroid99): Remove this */ #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include "src/core/ext/transport/chttp2/transport/bin_encoder.h" #include "src/core/ext/transport/chttp2/transport/hpack_table.h" #include "src/core/ext/transport/chttp2/transport/varint.h" #include "src/core/lib/debug/stats.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/slice/slice_string_helpers.h" #include "src/core/lib/surface/validate_metadata.h" #include "src/core/lib/transport/metadata.h" #include "src/core/lib/transport/static_metadata.h" #include "src/core/lib/transport/timeout_encoding.h" namespace { /* (Maybe-cuckoo) hpack encoder hash table implementation. This hashtable implementation is a subset of a proper cuckoo hash; while we have fallback cells that a value can be hashed to if the first cell is full, we do not attempt to iteratively rearrange entries into backup cells to get things to fit. Instead, if both a cell and the backup cell for a value are occupied, the older existing entry is evicted. Note that we can disable backup-cell picking by setting GRPC_HPACK_ENCODER_USE_CUCKOO_HASH to 0. In that case, we simply evict an existing entry rather than try to use a backup. Hence, "maybe-cuckoo." TODO(arjunroy): Add unit tests for hashtable implementation. */ #define GRPC_HPACK_ENCODER_USE_CUCKOO_HASH 1 #define HASH_FRAGMENT_MASK (GRPC_CHTTP2_HPACKC_NUM_VALUES - 1) #define HASH_FRAGMENT_1(x) ((x)&HASH_FRAGMENT_MASK) #define HASH_FRAGMENT_2(x) \ (((x) >> GRPC_CHTTP2_HPACKC_NUM_VALUES_BITS) & HASH_FRAGMENT_MASK) #define HASH_FRAGMENT_3(x) \ (((x) >> (GRPC_CHTTP2_HPACKC_NUM_VALUES_BITS * 2)) & HASH_FRAGMENT_MASK) #define HASH_FRAGMENT_4(x) \ (((x) >> (GRPC_CHTTP2_HPACKC_NUM_VALUES_BITS * 3)) & HASH_FRAGMENT_MASK) /* don't consider adding anything bigger than this to the hpack table */ constexpr size_t kMaxDecoderSpaceUsage = 512; constexpr size_t kDataFrameHeaderSize = 9; constexpr uint8_t kMaxFilterValue = 255; /* if the probability of this item being seen again is < 1/x then don't add it to the table */ #define ONE_ON_ADD_PROBABILITY (GRPC_CHTTP2_HPACKC_NUM_VALUES >> 1) /* The hpack index we encode over the wire. Meaningful to the hpack encoder and parser on the remote end as well as HTTP2. *Not* the same as HpackEncoderSlotHash, which is only meaningful to the hpack encoder implementation (HpackEncoderSlotHash is used for the hashtable implementation when mapping from metadata to HpackEncoderIndex. */ typedef uint32_t HpackEncoderIndex; /* Internal-table bookkeeping (*not* the hpack index). */ typedef uint32_t HpackEncoderSlotHash; struct SliceRefComparator { typedef grpc_slice_refcount* Type; static grpc_slice_refcount* Null() { return nullptr; } static bool IsNull(const grpc_slice_refcount* sref) { return sref == nullptr; } static bool Equals(const grpc_slice_refcount* s1, const grpc_slice_refcount* s2) { return s1 == s2; } static void Ref(grpc_slice_refcount* sref) { GPR_DEBUG_ASSERT(sref != nullptr); sref->Ref(); } static void Unref(grpc_slice_refcount* sref) { GPR_DEBUG_ASSERT(sref != nullptr); sref->Unref(); } }; struct MetadataComparator { typedef grpc_mdelem Type; static const grpc_mdelem Null() { return {0}; } static bool IsNull(const grpc_mdelem md) { return md.payload == 0; } static bool Equals(const grpc_mdelem md1, const grpc_mdelem md2) { return md1.payload == md2.payload; } static void Ref(grpc_mdelem md) { GPR_DEBUG_ASSERT(md.payload != 0); GRPC_MDELEM_REF(md); } static void Unref(grpc_mdelem md) { GPR_DEBUG_ASSERT(md.payload != 0); GRPC_MDELEM_UNREF(md); } }; /* Index table management */ template <typename Hashtable> static HpackEncoderIndex HpackIndex(const Hashtable* hashtable, HpackEncoderSlotHash hash_index) { return hashtable[hash_index].index; } template <typename ValueType, typename Hashtable> static const ValueType& GetEntry(const Hashtable* hashtable, HpackEncoderSlotHash hash_index) { return hashtable[hash_index].value; } template <typename Cmp, typename Hashtable> static bool TableEmptyAt(const Hashtable* hashtable, HpackEncoderSlotHash hash_index) { return Cmp::Equals(hashtable[hash_index].value, Cmp::Null()); } template <typename Cmp, typename Hashtable, typename ValueType> static bool Matches(const Hashtable* hashtable, const ValueType& value, HpackEncoderSlotHash hash_index) { return Cmp::Equals(value, hashtable[hash_index].value); } template <typename Hashtable> static void UpdateIndex(Hashtable* hashtable, HpackEncoderSlotHash hash_index, HpackEncoderIndex hpack_index) { hashtable[hash_index].index = hpack_index; } template <typename Hashtable, typename ValueType> static void SetIndex(Hashtable* hashtable, HpackEncoderSlotHash hash_index, const ValueType& value, HpackEncoderIndex hpack_index) { hashtable[hash_index].value = value; UpdateIndex(hashtable, hash_index, hpack_index); } template <typename Cmp, typename Hashtable, typename ValueType> static bool GetMatchingIndex(Hashtable* hashtable, const ValueType& value, uint32_t value_hash, HpackEncoderIndex* index) { const HpackEncoderSlotHash cuckoo_first = HASH_FRAGMENT_2(value_hash); if (Matches<Cmp>(hashtable, value, cuckoo_first)) { *index = HpackIndex(hashtable, cuckoo_first); return true; } #if GRPC_HPACK_ENCODER_USE_CUCKOO_HASH const HpackEncoderSlotHash cuckoo_second = HASH_FRAGMENT_3(value_hash); if (Matches<Cmp>(hashtable, value, cuckoo_second)) { *index = HpackIndex(hashtable, cuckoo_second); return true; } #endif return false; } template <typename Cmp, typename Hashtable, typename ValueType> static ValueType ReplaceOlderIndex(Hashtable* hashtable, const ValueType& value, HpackEncoderSlotHash hash_index_a, HpackEncoderSlotHash hash_index_b, HpackEncoderIndex new_index) { const HpackEncoderIndex hpack_idx_a = hashtable[hash_index_a].index; const HpackEncoderIndex hpack_idx_b = hashtable[hash_index_b].index; const HpackEncoderSlotHash id = hpack_idx_a < hpack_idx_b ? hash_index_a : hash_index_b; ValueType old = GetEntry<typename Cmp::Type>(hashtable, id); SetIndex(hashtable, id, value, new_index); return old; } template <typename Cmp, typename Hashtable, typename ValueType> static void UpdateAddOrEvict(Hashtable hashtable, const ValueType& value, uint32_t value_hash, HpackEncoderIndex new_index) { const HpackEncoderSlotHash cuckoo_first = HASH_FRAGMENT_2(value_hash); if (Matches<Cmp>(hashtable, value, cuckoo_first)) { UpdateIndex(hashtable, cuckoo_first, new_index); return; } if (TableEmptyAt<Cmp>(hashtable, cuckoo_first)) { Cmp::Ref(value); SetIndex(hashtable, cuckoo_first, value, new_index); return; } #if GRPC_HPACK_ENCODER_USE_CUCKOO_HASH const HpackEncoderSlotHash cuckoo_second = HASH_FRAGMENT_3(value_hash); if (Matches<Cmp>(hashtable, value, cuckoo_second)) { UpdateIndex(hashtable, cuckoo_second, new_index); return; } Cmp::Ref(value); if (TableEmptyAt<Cmp>(hashtable, cuckoo_second)) { SetIndex(hashtable, cuckoo_second, value, new_index); return; } Cmp::Unref(ReplaceOlderIndex<Cmp>(hashtable, value, cuckoo_first, cuckoo_second, new_index)); #else ValueType old = GetEntry<typename Cmp::Type>(hashtable, cuckoo_first); SetIndex(hashtable, cuckoo_first, value, new_index); Cmp::Unref(old); #endif } /* halve all counts because an element reached max */ static void HalveFilter(uint8_t /*idx*/, uint32_t* sum, uint8_t* elems) { *sum = 0; for (int i = 0; i < GRPC_CHTTP2_HPACKC_NUM_VALUES; i++) { elems[i] /= 2; (*sum) += elems[i]; } } /* increment a filter count, halve all counts if one element reaches max */ static void IncrementFilter(uint8_t idx, uint32_t* sum, uint8_t* elems) { elems[idx]++; if (GPR_LIKELY(elems[idx] < kMaxFilterValue)) { (*sum)++; } else { HalveFilter(idx, sum, elems); } } static uint32_t UpdateHashtablePopularity( grpc_chttp2_hpack_compressor* hpack_compressor, uint32_t elem_hash) { const uint32_t popularity_hash = HASH_FRAGMENT_1(elem_hash); IncrementFilter(popularity_hash, &hpack_compressor->filter_elems_sum, hpack_compressor->filter_elems); return popularity_hash; } static bool CanAddToHashtable(grpc_chttp2_hpack_compressor* hpack_compressor, uint32_t popularity_hash) { const bool can_add = hpack_compressor->filter_elems[popularity_hash] >= hpack_compressor->filter_elems_sum / ONE_ON_ADD_PROBABILITY; return can_add; } } /* namespace */ typedef struct { int is_first_frame; /* number of bytes in 'output' when we started the frame - used to calculate frame length */ size_t output_length_at_start_of_frame; /* index (in output) of the header for the current frame */ size_t header_idx; #ifndef NDEBUG /* have we seen a regular (non-colon-prefixed) header yet? */ uint8_t seen_regular_header; #endif /* output stream id */ uint32_t stream_id; grpc_slice_buffer* output; grpc_transport_one_way_stats* stats; /* maximum size of a frame */ size_t max_frame_size; bool use_true_binary_metadata; } framer_state; /* fills p (which is expected to be kDataFrameHeaderSize bytes long) * with a data frame header */ static void fill_header(uint8_t* p, uint8_t type, uint32_t id, size_t len, uint8_t flags) { /* len is the current frame size (i.e. for the frame we're finishing). We finish a frame if: 1) We called ensure_space(), (i.e. add_tiny_header_data()) and adding 'need_bytes' to the frame would cause us to exceed st->max_frame_size. 2) We called add_header_data, and adding the slice would cause us to exceed st->max_frame_size. 3) We're done encoding the header. Thus, len is always <= st->max_frame_size. st->max_frame_size is derived from GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE, which has a max allowable value of 16777215 (see chttp_transport.cc). Thus, the following assert can be a debug assert. */ GPR_DEBUG_ASSERT(len < 16777316); *p++ = static_cast<uint8_t>(len >> 16); *p++ = static_cast<uint8_t>(len >> 8); *p++ = static_cast<uint8_t>(len); *p++ = type; *p++ = flags; *p++ = static_cast<uint8_t>(id >> 24); *p++ = static_cast<uint8_t>(id >> 16); *p++ = static_cast<uint8_t>(id >> 8); *p++ = static_cast<uint8_t>(id); } static size_t current_frame_size(framer_state* st) { const size_t frame_size = st->output->length - st->output_length_at_start_of_frame; GPR_DEBUG_ASSERT(frame_size <= st->max_frame_size); return frame_size; } /* finish a frame - fill in the previously reserved header */ static void finish_frame(framer_state* st, int is_header_boundary, int is_last_in_stream) { uint8_t type = 0xff; type = st->is_first_frame ? GRPC_CHTTP2_FRAME_HEADER : GRPC_CHTTP2_FRAME_CONTINUATION; fill_header( GRPC_SLICE_START_PTR(st->output->slices[st->header_idx]), type, st->stream_id, current_frame_size(st), static_cast<uint8_t>( (is_last_in_stream ? GRPC_CHTTP2_DATA_FLAG_END_STREAM : 0) | (is_header_boundary ? GRPC_CHTTP2_DATA_FLAG_END_HEADERS : 0))); st->stats->framing_bytes += kDataFrameHeaderSize; st->is_first_frame = 0; } /* begin a new frame: reserve off header space, remember how many bytes we'd output before beginning */ static void begin_frame(framer_state* st) { grpc_slice reserved; reserved.refcount = nullptr; reserved.data.inlined.length = kDataFrameHeaderSize; st->header_idx = grpc_slice_buffer_add_indexed(st->output, reserved); st->output_length_at_start_of_frame = st->output->length; } /* make sure that the current frame is of the type desired, and has sufficient space to add at least about_to_add bytes -- finishes the current frame if needed */ static void ensure_space(framer_state* st, size_t need_bytes) { if (GPR_LIKELY(current_frame_size(st) + need_bytes <= st->max_frame_size)) { return; } finish_frame(st, 0, 0); begin_frame(st); } static void add_header_data(framer_state* st, grpc_slice slice) { size_t len = GRPC_SLICE_LENGTH(slice); size_t remaining; if (len == 0) return; remaining = st->max_frame_size - current_frame_size(st); if (len <= remaining) { st->stats->header_bytes += len; grpc_slice_buffer_add(st->output, slice); } else { st->stats->header_bytes += remaining; grpc_slice_buffer_add(st->output, grpc_slice_split_head(&slice, remaining)); finish_frame(st, 0, 0); begin_frame(st); add_header_data(st, slice); } } static uint8_t* add_tiny_header_data(framer_state* st, size_t len) { ensure_space(st, len); st->stats->header_bytes += len; return grpc_slice_buffer_tiny_add(st->output, len); } static void evict_entry(grpc_chttp2_hpack_compressor* c) { c->tail_remote_index++; GPR_ASSERT(c->tail_remote_index > 0); GPR_ASSERT(c->table_size >= c->table_elem_size[c->tail_remote_index % c->cap_table_elems]); GPR_ASSERT(c->table_elems > 0); c->table_size = static_cast<uint16_t>( c->table_size - c->table_elem_size[c->tail_remote_index % c->cap_table_elems]); c->table_elems--; } // Reserve space in table for the new element, evict entries if needed. // Return the new index of the element. Return 0 to indicate not adding to // table. static uint32_t prepare_space_for_new_elem(grpc_chttp2_hpack_compressor* c, size_t elem_size) { uint32_t new_index = c->tail_remote_index + c->table_elems + 1; GPR_DEBUG_ASSERT(elem_size < 65536); // TODO(arjunroy): Re-examine semantics if (elem_size > c->max_table_size) { while (c->table_size > 0) { evict_entry(c); } return 0; } /* Reserve space for this element in the remote table: if this overflows the current table, drop elements until it fits, matching the decompressor algorithm */ while (c->table_size + elem_size > c->max_table_size) { evict_entry(c); } GPR_ASSERT(c->table_elems < c->max_table_size); c->table_elem_size[new_index % c->cap_table_elems] = static_cast<uint16_t>(elem_size); c->table_size = static_cast<uint16_t>(c->table_size + elem_size); c->table_elems++; return new_index; } // Add a key to the dynamic table. Both key and value will be added to table at // the decoder. static void AddKeyWithIndex(grpc_chttp2_hpack_compressor* c, grpc_slice_refcount* key_ref, uint32_t new_index, uint32_t key_hash) { UpdateAddOrEvict<SliceRefComparator>(c->key_table.entries, key_ref, key_hash, new_index); } /* add an element to the decoder table */ static void AddElemWithIndex(grpc_chttp2_hpack_compressor* c, grpc_mdelem elem, uint32_t new_index, uint32_t elem_hash, uint32_t key_hash) { GPR_DEBUG_ASSERT(GRPC_MDELEM_IS_INTERNED(elem)); UpdateAddOrEvict<MetadataComparator>(c->elem_table.entries, elem, elem_hash, new_index); AddKeyWithIndex(c, GRPC_MDKEY(elem).refcount, new_index, key_hash); } static void add_elem(grpc_chttp2_hpack_compressor* c, grpc_mdelem elem, size_t elem_size, uint32_t elem_hash, uint32_t key_hash) { uint32_t new_index = prepare_space_for_new_elem(c, elem_size); if (new_index != 0) { AddElemWithIndex(c, elem, new_index, elem_hash, key_hash); } } static void add_key(grpc_chttp2_hpack_compressor* c, grpc_mdelem elem, size_t elem_size, uint32_t key_hash) { uint32_t new_index = prepare_space_for_new_elem(c, elem_size); if (new_index != 0) { AddKeyWithIndex(c, GRPC_MDKEY(elem).refcount, new_index, key_hash); } } static void emit_indexed(grpc_chttp2_hpack_compressor* /*c*/, uint32_t elem_index, framer_state* st) { GRPC_STATS_INC_HPACK_SEND_INDEXED(); uint32_t len = GRPC_CHTTP2_VARINT_LENGTH(elem_index, 1); GRPC_CHTTP2_WRITE_VARINT(elem_index, 1, 0x80, add_tiny_header_data(st, len), len); } struct wire_value { wire_value(uint8_t huffman_prefix, bool insert_null_before_wire_value, const grpc_slice& slice) : data(slice), huffman_prefix(huffman_prefix), insert_null_before_wire_value(insert_null_before_wire_value), length(GRPC_SLICE_LENGTH(slice) + (insert_null_before_wire_value ? 1 : 0)) {} // While wire_value is const from the POV of hpack encoder code, actually // adding it to a slice buffer will possibly split the slice. const grpc_slice data; const uint8_t huffman_prefix; const bool insert_null_before_wire_value; const size_t length; }; template <bool mdkey_definitely_interned> static wire_value get_wire_value(grpc_mdelem elem, bool true_binary_enabled) { const bool is_bin_hdr = mdkey_definitely_interned ? grpc_is_refcounted_slice_binary_header(GRPC_MDKEY(elem)) : grpc_is_binary_header_internal(GRPC_MDKEY(elem)); const grpc_slice& value = GRPC_MDVALUE(elem); if (is_bin_hdr) { if (true_binary_enabled) { GRPC_STATS_INC_HPACK_SEND_BINARY(); return wire_value(0x00, true, grpc_slice_ref_internal(value)); } else { GRPC_STATS_INC_HPACK_SEND_BINARY_BASE64(); return wire_value(0x80, false, grpc_chttp2_base64_encode_and_huffman_compress(value)); } } else { /* TODO(ctiller): opportunistically compress non-binary headers */ GRPC_STATS_INC_HPACK_SEND_UNCOMPRESSED(); return wire_value(0x00, false, grpc_slice_ref_internal(value)); } } static uint32_t wire_value_length(const wire_value& v) { GPR_DEBUG_ASSERT(v.length <= UINT32_MAX); return static_cast<uint32_t>(v.length); } namespace { enum class EmitLitHdrType { INC_IDX, NO_IDX }; enum class EmitLitHdrVType { INC_IDX_V, NO_IDX_V }; } // namespace template <EmitLitHdrType type> static void emit_lithdr(grpc_chttp2_hpack_compressor* /*c*/, uint32_t key_index, grpc_mdelem elem, framer_state* st) { switch (type) { case EmitLitHdrType::INC_IDX: GRPC_STATS_INC_HPACK_SEND_LITHDR_INCIDX(); break; case EmitLitHdrType::NO_IDX: GRPC_STATS_INC_HPACK_SEND_LITHDR_NOTIDX(); break; } const uint32_t len_pfx = type == EmitLitHdrType::INC_IDX ? GRPC_CHTTP2_VARINT_LENGTH(key_index, 2) : GRPC_CHTTP2_VARINT_LENGTH(key_index, 4); const wire_value value = get_wire_value<true>(elem, st->use_true_binary_metadata); const uint32_t len_val = wire_value_length(value); const uint32_t len_val_len = GRPC_CHTTP2_VARINT_LENGTH(len_val, 1); GPR_DEBUG_ASSERT(len_pfx + len_val_len < GRPC_SLICE_INLINED_SIZE); uint8_t* data = add_tiny_header_data( st, len_pfx + len_val_len + (value.insert_null_before_wire_value ? 1 : 0)); switch (type) { case EmitLitHdrType::INC_IDX: GRPC_CHTTP2_WRITE_VARINT(key_index, 2, 0x40, data, len_pfx); break; case EmitLitHdrType::NO_IDX: GRPC_CHTTP2_WRITE_VARINT(key_index, 4, 0x00, data, len_pfx); break; } GRPC_CHTTP2_WRITE_VARINT(len_val, 1, value.huffman_prefix, &data[len_pfx], len_val_len); if (value.insert_null_before_wire_value) { data[len_pfx + len_val_len] = 0; } add_header_data(st, value.data); } template <EmitLitHdrVType type> static void emit_lithdr_v(grpc_chttp2_hpack_compressor* /*c*/, grpc_mdelem elem, framer_state* st) { switch (type) { case EmitLitHdrVType::INC_IDX_V: GRPC_STATS_INC_HPACK_SEND_LITHDR_INCIDX_V(); break; case EmitLitHdrVType::NO_IDX_V: GRPC_STATS_INC_HPACK_SEND_LITHDR_NOTIDX_V(); break; } GRPC_STATS_INC_HPACK_SEND_UNCOMPRESSED(); const uint32_t len_key = static_cast<uint32_t>(GRPC_SLICE_LENGTH(GRPC_MDKEY(elem))); const wire_value value = type == EmitLitHdrVType::INC_IDX_V ? get_wire_value<true>(elem, st->use_true_binary_metadata) : get_wire_value<false>(elem, st->use_true_binary_metadata); const uint32_t len_val = wire_value_length(value); const uint32_t len_key_len = GRPC_CHTTP2_VARINT_LENGTH(len_key, 1); const uint32_t len_val_len = GRPC_CHTTP2_VARINT_LENGTH(len_val, 1); GPR_DEBUG_ASSERT(len_key <= UINT32_MAX); GPR_DEBUG_ASSERT(1 + len_key_len < GRPC_SLICE_INLINED_SIZE); uint8_t* key_buf = add_tiny_header_data(st, 1 + len_key_len); key_buf[0] = type == EmitLitHdrVType::INC_IDX_V ? 0x40 : 0x00; GRPC_CHTTP2_WRITE_VARINT(len_key, 1, 0x00, &key_buf[1], len_key_len); add_header_data(st, grpc_slice_ref_internal(GRPC_MDKEY(elem))); uint8_t* value_buf = add_tiny_header_data( st, len_val_len + (value.insert_null_before_wire_value ? 1 : 0)); GRPC_CHTTP2_WRITE_VARINT(len_val, 1, value.huffman_prefix, value_buf, len_val_len); if (value.insert_null_before_wire_value) { value_buf[len_val_len] = 0; } add_header_data(st, value.data); } static void emit_advertise_table_size_change(grpc_chttp2_hpack_compressor* c, framer_state* st) { uint32_t len = GRPC_CHTTP2_VARINT_LENGTH(c->max_table_size, 3); GRPC_CHTTP2_WRITE_VARINT(c->max_table_size, 3, 0x20, add_tiny_header_data(st, len), len); c->advertise_table_size_change = 0; } static void GPR_ATTRIBUTE_NOINLINE hpack_enc_log(grpc_mdelem elem) { char* k = grpc_slice_to_c_string(GRPC_MDKEY(elem)); char* v = nullptr; if (grpc_is_binary_header_internal(GRPC_MDKEY(elem))) { v = grpc_dump_slice(GRPC_MDVALUE(elem), GPR_DUMP_HEX); } else { v = grpc_slice_to_c_string(GRPC_MDVALUE(elem)); } gpr_log( GPR_INFO, "Encode: '%s: %s', elem_interned=%d [%d], k_interned=%d, v_interned=%d", k, v, GRPC_MDELEM_IS_INTERNED(elem), GRPC_MDELEM_STORAGE(elem), grpc_slice_is_interned(GRPC_MDKEY(elem)), grpc_slice_is_interned(GRPC_MDVALUE(elem))); gpr_free(k); gpr_free(v); } static uint32_t dynidx(grpc_chttp2_hpack_compressor* c, uint32_t elem_index) { return 1 + GRPC_CHTTP2_LAST_STATIC_ENTRY + c->tail_remote_index + c->table_elems - elem_index; } struct EmitIndexedStatus { EmitIndexedStatus() = default; EmitIndexedStatus(uint32_t elem_hash, bool emitted, bool can_add) : elem_hash(elem_hash), emitted(emitted), can_add(can_add) {} const uint32_t elem_hash = 0; const bool emitted = false; const bool can_add = false; }; static EmitIndexedStatus maybe_emit_indexed(grpc_chttp2_hpack_compressor* c, grpc_mdelem elem, framer_state* st) { const uint32_t elem_hash = GRPC_MDELEM_STORAGE(elem) == GRPC_MDELEM_STORAGE_INTERNED ? reinterpret_cast<grpc_core::InternedMetadata*>( GRPC_MDELEM_DATA(elem)) ->hash() : reinterpret_cast<grpc_core::StaticMetadata*>(GRPC_MDELEM_DATA(elem)) ->hash(); /* Update filter to see if we can perhaps add this elem. */ const uint32_t popularity_hash = UpdateHashtablePopularity(c, elem_hash); /* is this elem currently in the decoders table? */ HpackEncoderIndex indices_key; if (GetMatchingIndex<MetadataComparator>(c->elem_table.entries, elem, elem_hash, &indices_key) && indices_key > c->tail_remote_index) { emit_indexed(c, dynidx(c, indices_key), st); return EmitIndexedStatus(elem_hash, true, false); } /* Didn't hit either cuckoo index, so no emit. */ return EmitIndexedStatus(elem_hash, false, CanAddToHashtable(c, popularity_hash)); } static void emit_maybe_add(grpc_chttp2_hpack_compressor* c, grpc_mdelem elem, framer_state* st, uint32_t indices_key, bool should_add_elem, size_t decoder_space_usage, uint32_t elem_hash, uint32_t key_hash) { if (should_add_elem) { emit_lithdr<EmitLitHdrType::INC_IDX>(c, dynidx(c, indices_key), elem, st); add_elem(c, elem, decoder_space_usage, elem_hash, key_hash); } else { emit_lithdr<EmitLitHdrType::NO_IDX>(c, dynidx(c, indices_key), elem, st); } } /* encode an mdelem */ static void hpack_enc(grpc_chttp2_hpack_compressor* c, grpc_mdelem elem, framer_state* st) { const grpc_slice& elem_key = GRPC_MDKEY(elem); /* User-provided key len validated in grpc_validate_header_key_is_legal(). */ GPR_DEBUG_ASSERT(GRPC_SLICE_LENGTH(elem_key) > 0); /* Header ordering: all reserved headers (prefixed with ':') must precede * regular headers. This can be a debug assert, since: * 1) User cannot give us ':' headers (grpc_validate_header_key_is_legal()). * 2) grpc filters/core should be checked during debug builds. */ #ifndef NDEBUG if (GRPC_SLICE_START_PTR(elem_key)[0] != ':') { /* regular header */ st->seen_regular_header = 1; } else { GPR_DEBUG_ASSERT( st->seen_regular_header == 0 && "Reserved header (colon-prefixed) happening after regular ones."); } #endif if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) { hpack_enc_log(elem); } const bool elem_interned = GRPC_MDELEM_IS_INTERNED(elem); const bool key_interned = elem_interned || grpc_slice_is_interned(elem_key); /* Key is not interned, emit literals. */ if (!key_interned) { emit_lithdr_v<EmitLitHdrVType::NO_IDX_V>(c, elem, st); return; } /* Interned metadata => maybe already indexed. */ const EmitIndexedStatus ret = elem_interned ? maybe_emit_indexed(c, elem, st) : EmitIndexedStatus(); if (ret.emitted) { return; } /* should this elem be in the table? */ const size_t decoder_space_usage = grpc_chttp2_get_size_in_hpack_table(elem, st->use_true_binary_metadata); const bool decoder_space_available = decoder_space_usage < kMaxDecoderSpaceUsage; const bool should_add_elem = elem_interned && decoder_space_available && ret.can_add; const uint32_t elem_hash = ret.elem_hash; /* no hits for the elem... maybe there's a key? */ const uint32_t key_hash = elem_key.refcount->Hash(elem_key); HpackEncoderIndex indices_key; if (GetMatchingIndex<SliceRefComparator>( c->key_table.entries, elem_key.refcount, key_hash, &indices_key) && indices_key > c->tail_remote_index) { emit_maybe_add(c, elem, st, indices_key, should_add_elem, decoder_space_usage, elem_hash, key_hash); return; } /* no elem, key in the table... fall back to literal emission */ const bool should_add_key = !elem_interned && decoder_space_available; if (should_add_elem || should_add_key) { emit_lithdr_v<EmitLitHdrVType::INC_IDX_V>(c, elem, st); } else { emit_lithdr_v<EmitLitHdrVType::NO_IDX_V>(c, elem, st); } if (should_add_elem) { add_elem(c, elem, decoder_space_usage, elem_hash, key_hash); } else if (should_add_key) { add_key(c, elem, decoder_space_usage, key_hash); } } #define STRLEN_LIT(x) (sizeof(x) - 1) #define TIMEOUT_KEY "grpc-timeout" static void deadline_enc(grpc_chttp2_hpack_compressor* c, grpc_millis deadline, framer_state* st) { char timeout_str[GRPC_HTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE]; grpc_mdelem mdelem; grpc_http2_encode_timeout(deadline - grpc_core::ExecCtx::Get()->Now(), timeout_str); mdelem = grpc_mdelem_from_slices( GRPC_MDSTR_GRPC_TIMEOUT, grpc_core::UnmanagedMemorySlice(timeout_str)); hpack_enc(c, mdelem, st); GRPC_MDELEM_UNREF(mdelem); } static uint32_t elems_for_bytes(uint32_t bytes) { return (bytes + 31) / 32; } void grpc_chttp2_hpack_compressor_init(grpc_chttp2_hpack_compressor* c) { memset(c, 0, sizeof(*c)); c->max_table_size = GRPC_CHTTP2_HPACKC_INITIAL_TABLE_SIZE; c->cap_table_elems = elems_for_bytes(c->max_table_size); c->max_table_elems = c->cap_table_elems; c->max_usable_size = GRPC_CHTTP2_HPACKC_INITIAL_TABLE_SIZE; const size_t alloc_size = sizeof(*c->table_elem_size) * c->cap_table_elems; c->table_elem_size = static_cast<uint16_t*>(gpr_malloc(alloc_size)); memset(c->table_elem_size, 0, alloc_size); } void grpc_chttp2_hpack_compressor_destroy(grpc_chttp2_hpack_compressor* c) { for (int i = 0; i < GRPC_CHTTP2_HPACKC_NUM_VALUES; i++) { auto* const key = GetEntry<grpc_slice_refcount*>(c->key_table.entries, i); if (key != nullptr) { key->Unref(); } GRPC_MDELEM_UNREF(GetEntry<grpc_mdelem>(c->elem_table.entries, i)); } gpr_free(c->table_elem_size); } void grpc_chttp2_hpack_compressor_set_max_usable_size( grpc_chttp2_hpack_compressor* c, uint32_t max_table_size) { c->max_usable_size = max_table_size; grpc_chttp2_hpack_compressor_set_max_table_size( c, GPR_MIN(c->max_table_size, max_table_size)); } static void rebuild_elems(grpc_chttp2_hpack_compressor* c, uint32_t new_cap) { uint16_t* table_elem_size = static_cast<uint16_t*>(gpr_malloc(sizeof(*table_elem_size) * new_cap)); uint32_t i; memset(table_elem_size, 0, sizeof(*table_elem_size) * new_cap); GPR_ASSERT(c->table_elems <= new_cap); for (i = 0; i < c->table_elems; i++) { uint32_t ofs = c->tail_remote_index + i + 1; table_elem_size[ofs % new_cap] = c->table_elem_size[ofs % c->cap_table_elems]; } c->cap_table_elems = new_cap; gpr_free(c->table_elem_size); c->table_elem_size = table_elem_size; } void grpc_chttp2_hpack_compressor_set_max_table_size( grpc_chttp2_hpack_compressor* c, uint32_t max_table_size) { max_table_size = GPR_MIN(max_table_size, c->max_usable_size); if (max_table_size == c->max_table_size) { return; } while (c->table_size > 0 && c->table_size > max_table_size) { evict_entry(c); } c->max_table_size = max_table_size; c->max_table_elems = elems_for_bytes(max_table_size); if (c->max_table_elems > c->cap_table_elems) { rebuild_elems(c, GPR_MAX(c->max_table_elems, 2 * c->cap_table_elems)); } else if (c->max_table_elems < c->cap_table_elems / 3) { uint32_t new_cap = GPR_MAX(c->max_table_elems, 16); if (new_cap != c->cap_table_elems) { rebuild_elems(c, new_cap); } } c->advertise_table_size_change = 1; if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) { gpr_log(GPR_INFO, "set max table size from encoder to %d", max_table_size); } } void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor* c, grpc_mdelem** extra_headers, size_t extra_headers_size, grpc_metadata_batch* metadata, const grpc_encode_header_options* options, grpc_slice_buffer* outbuf) { /* grpc_chttp2_encode_header is called by FlushInitial/TrailingMetadata in writing.cc. Specifically, on streams returned by NextStream(), which returns streams from the list GRPC_CHTTP2_LIST_WRITABLE. The only way to be added to the list is via grpc_chttp2_list_add_writable_stream(), which validates that stream_id is not 0. So, this can be a debug assert. */ GPR_DEBUG_ASSERT(options->stream_id != 0); framer_state st; #ifndef NDEBUG st.seen_regular_header = 0; #endif st.stream_id = options->stream_id; st.output = outbuf; st.is_first_frame = 1; st.stats = options->stats; st.max_frame_size = options->max_frame_size; st.use_true_binary_metadata = options->use_true_binary_metadata; /* Encode a metadata batch; store the returned values, representing a metadata element that needs to be unreffed back into the metadata slot. THIS MAY NOT BE THE SAME ELEMENT (if a decoder table slot got updated). After this loop, we'll do a batch unref of elements. */ begin_frame(&st); if (c->advertise_table_size_change != 0) { emit_advertise_table_size_change(c, &st); } for (size_t i = 0; i < extra_headers_size; ++i) { grpc_mdelem md = *extra_headers[i]; const bool is_static = GRPC_MDELEM_STORAGE(md) == GRPC_MDELEM_STORAGE_STATIC; uintptr_t static_index; if (is_static && (static_index = reinterpret_cast<grpc_core::StaticMetadata*>(GRPC_MDELEM_DATA(md)) ->StaticIndex()) < GRPC_CHTTP2_LAST_STATIC_ENTRY) { emit_indexed(c, static_cast<uint32_t>(static_index + 1), &st); } else { hpack_enc(c, md, &st); } } grpc_metadata_batch_assert_ok(metadata); for (grpc_linked_mdelem* l = metadata->list.head; l; l = l->next) { const bool is_static = GRPC_MDELEM_STORAGE(l->md) == GRPC_MDELEM_STORAGE_STATIC; uintptr_t static_index; if (is_static && (static_index = reinterpret_cast<grpc_core::StaticMetadata*>( GRPC_MDELEM_DATA(l->md)) ->StaticIndex()) < GRPC_CHTTP2_LAST_STATIC_ENTRY) { emit_indexed(c, static_cast<uint32_t>(static_index + 1), &st); } else { hpack_enc(c, l->md, &st); } } grpc_millis deadline = metadata->deadline; if (deadline != GRPC_MILLIS_INF_FUTURE) { deadline_enc(c, deadline, &st); } finish_frame(&st, 1, options->is_eof); }
e5ed893aedd2e099001d76529dbf3af844f19c32
f8ef8b1633eeffc387f981b84d8ce2c52851fc55
/source files/Game.cpp
54ab4b84d4a34786c9201b81c197e205d68ef690
[]
no_license
0x55aa/PixelSandbox
ced514cbe42f077762cac6faf924f48934b32aba
52592884a477101d7fa25050ee9561b743e8534a
refs/heads/master
2021-09-18T14:32:28.411268
2018-07-15T22:53:44
2018-07-15T22:53:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,533
cpp
Game.cpp
#include "Game.h" enum states { MAIN_MENU, SINGLE_PLAYER, MULTIPLAYER, FREE_MODE, OPTIONS }; void Game::initmenu() { state = FREE_MODE; F_menufont.loadFromFile("arial.ttf"); T_singleplayer.setFont(F_menufont); T_freemode.setFont(F_menufont); T_multiplayer.setFont(F_menufont); T_options.setFont(F_menufont); T_singleplayer.setString(sf::String("Alchemy Mode")); T_freemode.setString(sf::String("Sandbox")); T_multiplayer.setString(sf::String("Multi Player")); T_options.setString(sf::String("Options")); /* T_singleplayer.setOrigin(T_singleplayer.getLocalBounds().width / 2, T_singleplayer.getLocalBounds().height / 2); T_freemode.setOrigin(T_freemode.getLocalBounds().width / 2, T_freemode.getLocalBounds().height / 2); T_multiplayer.setOrigin(T_multiplayer.getLocalBounds().width / 2, T_multiplayer.getLocalBounds().height / 2); T_options.setOrigin(T_options.getLocalBounds().width / 2, T_options.getLocalBounds().height / 2); T_singleplayer.setPosition(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 - 100); T_freemode.setPosition(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2); T_multiplayer.setPosition(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 + 100); T_options.setPosition(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 + 200); */ } Game::Game(KeyValue &settings) :mWindow(sf::VideoMode(settings.GetInt("Width"), settings.GetInt("Height")), "Sandbox Game", sf::Style::Close | sf::Style::Titlebar) , freemodebox(settings, mWindow, true) { SCREEN_WIDTH = settings.GetInt("Width"); SCREEN_HEIGHT = settings.GetInt("Height"); initmenu(); FPStext.setFont(F_menufont); FPStext.setPosition(sf::Vector2f(0, 50)); mWindow.setVerticalSyncEnabled(false); mWindow.setFramerateLimit(settings.GetInt("Framelimit")); } void Game::display_main_menu() { T_singleplayer.setFillColor(sf::Color(128, 128, 128, 255)); T_freemode.setFillColor(sf::Color(128, 128, 128, 255)); T_multiplayer.setFillColor(sf::Color(128, 128, 128, 255)); T_options.setFillColor(sf::Color(128, 128, 128, 255)); if (menu_choice == 0) T_singleplayer.setFillColor(sf::Color(255, 255, 255, 255)); if (menu_choice == 1) T_freemode.setFillColor(sf::Color(255, 255, 255, 255)); if (menu_choice == 2) T_multiplayer.setFillColor(sf::Color(255, 255, 255, 255)); if (menu_choice == 3) T_options.setFillColor(sf::Color(255, 255, 255, 255)); mWindow.draw(T_singleplayer); mWindow.draw(T_freemode); mWindow.draw(T_multiplayer); mWindow.draw(T_options); } void Game::display_sandbox() { freemodebox.draw(mWindow); } void Game::process_events() { sf::Event event; while (mWindow.pollEvent(event)) { //No matter what, we should always be able to close the window. if (event.type == sf::Event::Closed) mWindow.close(); switch (state) { case MAIN_MENU: if (event.type == sf::Event::KeyPressed) { if (event.key.code == sf::Keyboard::Up) menu_choice--; if (menu_choice < 0) menu_choice = 3; if (event.key.code == sf::Keyboard::Down) menu_choice++; if (menu_choice > 3) menu_choice = 0; if (event.key.code == sf::Keyboard::Return) launch_option(); if (event.key.code == sf::Keyboard::Escape) mWindow.close(); if (event.key.code == sf::Keyboard::F) mWindow.create(sf::VideoMode(SCREEN_WIDTH, SCREEN_HEIGHT), "Sandbox Game", sf::Style::Fullscreen); } break; case FREE_MODE: freemodebox.handle_event(event); if (event.type == sf::Event::KeyPressed) { if (event.key.code == sf::Keyboard::Escape) state = MAIN_MENU; } break; default: break; } } switch (state) { case FREE_MODE: freemodebox.check_events(mWindow); break; default: break; } } void Game::update() { switch (state) { case MAIN_MENU: //Do stuff here. break; case FREE_MODE: freemodebox.processgrid(); break; default: break; } } void Game::render() { //Clear the window at start, draw everything all over, and show it again. mWindow.clear(); //Here I choose what to draw. switch (state) { case MAIN_MENU: display_main_menu(); break; case FREE_MODE: display_sandbox(); break; default: break; } //This is the debug framecounter. FPStext.setString(std::to_string(framecounter.getFPS())); mWindow.draw(FPStext); //No matter what, we draw the main window. mWindow.display(); } void Game::launch_option() { switch (menu_choice) { case 1: state = FREE_MODE; break; default: break; } } void Game::run() { while (mWindow.isOpen()) { process_events(); update(); framecounter.update(); render(); } }
a3694185919d57d4acb1e562977203830ccb33e4
9d7d3046ef29ed0d2f8402da3f28b483f8eb7d9f
/Codeforces/CF1454/D.cpp
39280176628f52dccd9a949c7649d78aa6bdb622
[]
no_license
misaka18931/program-learning
1ca03e0f475c87733ec3b84600001092e2962150
cdef0ce82746d250587827274d21fb2ab3854277
refs/heads/master
2023-03-31T16:07:46.468699
2021-04-02T12:58:36
2021-04-02T12:58:36
300,297,483
0
0
null
null
null
null
UTF-8
C++
false
false
767
cpp
D.cpp
// CodeForces/CF1454/D.cpp // https://codeforces.com/contest/1454/problem/D // Created by learntocode1024 on 11/24/20. // AC #include <cstdio> #include <iostream> using std::cin; using std::cout; using std::endl; void solve() { long long n; cin >> n; long long out = n, ans = 1, tmp, prime = n; for (long long kI = 2; kI * kI <= n; ++kI) { if (n % kI == 0) { tmp = 0; while (n % kI == 0) { n /= kI; ++tmp; } if (tmp > ans) { ans = tmp; prime = kI; } } } cout << ans << '\n'; for (int kI = 1; kI < ans; ++kI) { cout << prime << ' '; out /= prime; } cout << out << '\n'; } int main() { int T; cin >> T; while (T--) { solve(); } cout << endl; return 0; }
dcffe22e70717d054573dc3f661b9e317a26130c
2a091186db9e767ff224ec44fdf2ab006dfe07eb
/ExtratorDecaracteristicas/ColorExtractor.hpp
7ceeb9bcc6abd45b11e8d451deb5786f58284cf4
[]
no_license
joaofelipesus/trabalho_simpsons
607b5946204de7b5cf4166ee02298aa7b1b34529
f08732dd7752ce92c7347255e8d0901812a3739c
refs/heads/master
2021-06-03T14:58:22.849883
2016-06-16T23:13:40
2016-06-16T23:13:40
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,096
hpp
ColorExtractor.hpp
// // ColorExtractor.hpp // ExtratorDeCaracteristicas // // Created by joao lopes on 08/06/16. // // #ifndef ColorExtractor_hpp #define ColorExtractor_hpp #include <stdio.h> #include "itkImage.h" #include "itkImageFileReader.h" #include "itkImageFileWriter.h" #include "itkRGBToLuminanceImageFilter.h" using namespace std; using namespace itk; const int DIMENSIONS = 2; typedef Image<unsigned char , DIMENSIONS> GrayscaleImageType; typedef RGBPixel<unsigned char> RGBPixelType; typedef Image<RGBPixelType , DIMENSIONS> RGBImageType; typedef ImageFileReader<RGBImageType> RGBReaderType; typedef RGBToLuminanceImageFilter<RGBImageType, GrayscaleImageType> GrayscaleFilterType; class ColorExtractor{ private: RGBImageType::Pointer image; int bartShirt; int bartShortsAndShoes; int homerBeard; int homerPants; int lisaDressAndMaggiePacifierAndMargeItems; int maggiePijamas; int margeHair; int margeDress; void GetData(); public: ColorExtractor(RGBImageType::Pointer image); void GetValues(int* vetResults); }; #endif /* ColorExtractor_hpp */
36ce4fd93f982e7de4a8e32133baa89865520116
0746881cb1b994ac31470b5d468c9add2fed4d0b
/example16.7/works.cpp
ba3d06f9b5d29962a398fce66b5907ff7edebd86
[]
no_license
solemnrex/MyExercises
1f1a6ae05ec85291b0b675d11ad8a8b89ff06d67
17856bd1bd954b78b7f1219091407a098e1bc77b
refs/heads/master
2020-03-31T22:01:25.697607
2018-12-30T16:44:52
2018-12-30T16:44:52
152,591,773
0
0
null
null
null
null
UTF-8
C++
false
false
1,886
cpp
works.cpp
#include "works.h" #include <string> #include <iostream> #include <algorithm> using namespace std; void work1() { cout << "---------This is work1.-----------"<<endl; cout << "Input a string. " << endl; cout << ">"; string str_input; getline(cin, str_input); cout << "Input string is: " << str_input << endl; //reverse operation string str2reverse(str_input); reverse(str2reverse.begin(), str2reverse.end()); if (str_input == str2reverse) cout << "Input string is a huiwen." << endl << endl; else cout << "Input string is not a huiwen." << endl << endl; } void work2() { cout << "---------This is work2.-----------" << endl; cout << "Input a string. " << endl; cout << ">"; string str_input; getline(cin, str_input); cout << "Input string is: " << str_input << endl; string str_yy("aeiou"); size_t counter = 0; for (int i = 0; i < str_yy.length(); ++i) { char char_to_search = str_yy[i]; string::const_iterator char_pos_i = str_input.begin(); while (char_pos_i!=str_input.end()) { if (*char_pos_i == char_to_search) ++counter; ++char_pos_i; } } cout << "The number of yy is: " << counter << endl; } void work3() { cout << "---------This is work3.-----------" << endl; cout << "Input a string. " << endl; cout << ">"; string str_input; getline(cin, str_input); cout << "Input string is: " << str_input << endl; int char_index = 0; bool flag = true; while (char_index != str_input.length()) { if (flag) str_input[char_index]=toupper(str_input[char_index]); flag = not(flag); ++char_index; } cout << "Output is: " << str_input << endl << endl; } void work4() { string str1("I"); string str2("Love"); string str3("STL"); string str4("String"); str1.append(" "); str2.append(" "); str3.append(" "); str4.append(" "); str1.append(str2); str1.append(str3); str1.append(str4); cout << str1 << endl; }
4c12d756dc4c398211701fab7ac340a81f8a2d79
ef40a21ae939eb81318646acf71e97efae217879
/src/hooks.cpp
a976bc839775089d0524ddb31396f83d3015aa17
[ "ISC" ]
permissive
SuperMarcus/QuestParticleTuner
3abbe7fa57d36202def1b06a130c37e01ee7269a
efba2782ed4167b144669969b1ed193a3a4820fc
refs/heads/master
2023-09-03T12:26:55.887373
2021-11-18T05:55:18
2021-11-18T05:55:18
309,035,709
11
9
null
2021-11-18T05:55:19
2020-11-01T06:16:44
C++
UTF-8
C++
false
false
6,957
cpp
hooks.cpp
#include <algorithm> #include <random> #include "utils/logging.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils.hpp" #include "beatsaber-hook/shared/utils/typedefs.h" #include "beatsaber-hook/shared/utils/utils.h" #include "beatsaber-hook/shared/utils/hooking.hpp" #include "UnityEngine/Vector3.hpp" #include "UnityEngine/ParticleSystem.hpp" #include "UnityEngine/ParticleSystem_MainModule.hpp" #include "UnityEngine/ParticleSystem_MinMaxGradient.hpp" #include "UnityEngine/Gradient.hpp" #include "UnityEngine/Color.hpp" #include "UnityEngine/Color32.hpp" #include "UnityEngine/SceneManagement/Scene.hpp" #include "UnityEngine/SceneManagement/SceneManager.hpp" #include "System/Collections/IEnumerator.hpp" #include "GlobalNamespace/SharedCoroutineStarter.hpp" #include "GlobalNamespace/NoteCutParticlesEffect.hpp" #include "GlobalNamespace/SaberClashEffect.hpp" #include "UnityEngine/Random.hpp" #include "particletune.hpp" #include "particletune_private.hpp" #include "PTScenePSController.hpp" #include "Config.hpp" #include "UnityInternalCalls.hpp" using namespace ParticleTuner; MAKE_HOOK_MATCH(NoteCutParticlesEffect_SpawnParticles, &GlobalNamespace::NoteCutParticlesEffect::SpawnParticles, void, GlobalNamespace::NoteCutParticlesEffect *self, UnityEngine::Vector3 cutPoint, UnityEngine::Vector3 cutNormal, UnityEngine::Vector3 saberDir, float saberSpeed, UnityEngine::Vector3 noteMovementVec, UnityEngine::Color32 color, int sparkleParticlesCount, int explosionParticlesCount, float lifetimeMultiplier) { auto &currentConfig = getConfig(); int newSparkleCount = static_cast<int>(static_cast<float>(sparkleParticlesCount) * currentConfig.sparkleMultiplier); int newExplosionCount = static_cast<int>(static_cast<float>(explosionParticlesCount) * currentConfig.explosionMultiplier); float newLifetimeMultiplier = lifetimeMultiplier * currentConfig.lifetimeMultiplier; auto sparklesPS = self->sparklesPS; auto explosionPS = self->explosionPS; auto corePS = self->explosionCorePS; auto sparklesMain = sparklesPS->get_main(); auto explosionMain = explosionPS->get_main(); auto coreMain = corePS->get_main(); sparklesMain.set_maxParticles(INT_MAX); explosionMain.set_maxParticles(INT_MAX); icall_functions::ParticleSystem_MainModule::set_startLifetimeMultiplier_Injected( &explosionMain, currentConfig.lifetimeMultiplier); icall_functions::ParticleSystem_ColorBySpeedModule::set_enabled_Injected(&sparklesMain, currentConfig.rainbowParticles); icall_functions::ParticleSystem_ColorOverLifetimeModule::set_enabled_Injected(&sparklesMain, currentConfig.rainbowParticles); if (currentConfig.reduceCoreParticles) { icall_functions::ParticleSystem_MainModule::set_startLifetimeMultiplier_Injected( &coreMain, 0.0f); coreMain.set_maxParticles(0); } // getLogger().debug("Original color R,G,B,A: %d, %d, %d, %d", color.r, color.g, color.b, color.a); if (currentConfig.rainbowParticles) { const int color_value = 127; // color value of the HSV color code. 127 equals to 0.5f int rgb_variable = rand(); int color_hue = rgb_variable % 256; rgb_variable >>= 8; int rgb_zero = rgb_variable & 1; rgb_variable >>= 1; rgb_variable %= 3; rgb_zero = (rgb_variable + 1 + rgb_zero) % 3; int rgb_fixed = 3 - rgb_variable - rgb_zero; switch (rgb_variable) { case 0: color.r = color_hue; break; case 1: color.g = color_hue; break; case 2: color.b = color_hue; break; } switch (rgb_zero) { case 0: color.r = 0; break; case 1: color.g = 0; break; case 2: color.b = 0; break; } switch (rgb_fixed) { case 0: color.r = color_value; break; case 1: color.g = color_value; break; case 2: color.b = color_value; break; } } // Set alpha channel color.a = static_cast<uint8_t>(std::clamp(currentConfig.particleOpacity * 255.0f, 0.0f, 255.0f)); getLogger().debug("Processed color R,G,B,A: %d, %d, %d, %d", color.r, color.g, color.b, color.a); // auto updatedColor = toColor(color); // auto newGradient = new UnityEngine::ParticleSystem::MinMaxGradient(updatedColor); // icall_functions::ParticleSystem_ColorOverLifetimeModule::set_color_Injected(&sparklesMain, newGradient); // NoteCutParticlesEffect_SpawnParticles( self, cutPoint, cutNormal, saberDir, saberSpeed, noteMovementVec, color, newSparkleCount, newExplosionCount, newLifetimeMultiplier); } MAKE_HOOK_MATCH(SaberClashEffect_LateUpdate, &GlobalNamespace::SaberClashEffect::LateUpdate, void, GlobalNamespace::SaberClashEffect *self) { auto &currentConfig = getConfig(); auto glowPS = self->glowParticleSystem; auto sparklePS = self->sparkleParticleSystem; glowPS->get_main().set_maxParticles(currentConfig.reduceClashParticles ? 0 : INT_MAX); sparklePS->get_main().set_maxParticles(currentConfig.reduceClashParticles ? 0 : INT_MAX); SaberClashEffect_LateUpdate(self); } MAKE_HOOK_MATCH(SceneManager_Internal_ActiveSceneChanged, &UnityEngine::SceneManagement::SceneManager::Internal_ActiveSceneChanged, void, UnityEngine::SceneManagement::Scene oldScene, UnityEngine::SceneManagement::Scene newScene) { static std::vector<std::string> sensitiveScenes = { "Init", "MenuViewControllers", "GameCore", "Credits"}; SceneManager_Internal_ActiveSceneChanged(oldScene, newScene); auto sceneNameCs = newScene.get_name(); if (sceneNameCs) { auto sceneName = to_utf8(csstrtostr(newScene.get_name())); // getLogger().info("Transitioning to scene: %s", sceneName.data()); if (std::find(sensitiveScenes.begin(), sensitiveScenes.end(), sceneName) != sensitiveScenes.end()) { getLogger().info("Starting PTScenePSDiscoveryAgent..."); auto discoveryAgent = THROW_UNLESS(il2cpp_utils::New<PTScenePSDiscoveryAgent *>()); GlobalNamespace::SharedCoroutineStarter::get_instance() ->StartCoroutine(reinterpret_cast<System::Collections::IEnumerator *>(discoveryAgent)); } } } void PTInstallHooks() { auto &logger = getLogger(); logger.info("Adding hooks..."); INSTALL_HOOK(logger, NoteCutParticlesEffect_SpawnParticles); INSTALL_HOOK(logger, SaberClashEffect_LateUpdate); INSTALL_HOOK(logger, SceneManager_Internal_ActiveSceneChanged); srand(std::chrono::system_clock::now().time_since_epoch().count()); }
d0d28b005dd6286c747765c1840dc6e1c16ce7f9
dab230a1674e4c77acf17846ef5823be909fe170
/src/Levels/Endscreen.hpp
b7f124a4a4dc9ad6b5d6a02d5ceffa115d87f420
[]
no_license
schlenkibus/TheUnmagicalWand
6fdb6c43e1e2be7a9b067e9a60f8205be5a89648
df3467359058bf2f7636861ea2cf90f474fac26e
refs/heads/master
2021-01-21T13:21:08.768160
2020-03-15T15:47:22
2020-03-15T15:47:22
50,537,390
1
0
null
null
null
null
UTF-8
C++
false
false
1,087
hpp
Endscreen.hpp
#pragma once #include <iostream> #include <SFML/Graphics.hpp> class Endscreen { public: Endscreen() { tex.loadFromFile("art/misc/final_screen.png"); sprite.setPosition(0, 0); sprite.setTexture(tex); shouldBeActive = true; } void update() { if(sizeTimer.getElapsedTime().asSeconds() <= 0.75f) pressAny.setScale(1.1f, 1.1f); else if(sizeTimer.getElapsedTime().asSeconds() >= 0.75f) pressAny.setScale(0.9f, 0.9f); if(sizeTimer.getElapsedTime().asSeconds() >= 1.5f) timer.restart(); if(timer.getElapsedTime().asSeconds() <= 2) //Allow cont after 2 sec return; bool isp = false; for (int i = sf::Keyboard::A; i <= sf::Keyboard::Z; ++i ) { if(sf::Keyboard::isKeyPressed(static_cast<sf::Keyboard::Key>(i))) { isp = true; break; } } if(isp == true) shouldBeActive = false; } void draw(sf::RenderWindow& window) { window.draw(sprite); } private: bool shouldBeActive; sf::Clock sizeTimer, timer; sf::Texture tex; sf::Sprite sprite, pressAny; };
ad2fc78c635ff2a3f6fe647e81cf5eabdb332b33
3863c8ea84280f8cb6f3baecb0587ce7df4989d7
/ArduFarmBot_Light/Sensors_Test/Sensors_Test.ino
042966cd9670a9a55977cabdf8a571281d27b95e
[]
no_license
kumar-tushar/Smart-Agro-System-Arduino-IoT
314edd1a61f6a001cbc56d6b6bdfdb9b0b717cc2
ca74d18bf9dbd65be3694b61e8795a5a5e89e618
refs/heads/main
2023-05-13T18:37:37.751792
2023-05-06T11:09:42
2023-05-06T11:09:42
355,857,143
6
0
null
null
null
null
UTF-8
C++
false
false
1,880
ino
Sensors_Test.ino
/***************************************************** *ArduFarmBot Light *Sensors Test * * DHT (2-wire Air Temperature/Humidity digital sensor) ==> Pin D11 * DS18B20 (1-Wire Temperature digital Sensor) ==> Pin D05 * LDR (Light Dependent Resistor - Analog Sensor) ==> Pin A1 * LM394/YL70 (Soil Humidity Analog Sensor) ==> Pin A0 * * MJRoBot.org 16_Dec_17 *****************************************************/ // DS18B20 #include <OneWire.h> #include <DallasTemperature.h> #define ONE_WIRE_BUS 5 // DS18B20 on pin D5 OneWire oneWire(ONE_WIRE_BUS); DallasTemperature DS18B20(&oneWire); int soilTemp = 0; //DHT #include "DHT.h" #include <stdlib.h> int pinoDHT = 11; int tipoDHT = DHT22; DHT dht(pinoDHT, tipoDHT); int airTemp = 0; int airHum = 0; // LDR (Light) #define ldrPIN 1 int light = 0; // Soil humidity #define soilHumPIN 0 int soilHum = 0; void setup() { Serial.begin(9600); DS18B20.begin(); dht.begin(); } void loop() { readSensors(); displaySensors(); delay (10000); } /********* Read Sensors value *************/ void readSensors(void) { airTemp = dht.readTemperature(); airHum = dht.readHumidity(); DS18B20.requestTemperatures(); soilTemp = DS18B20.getTempCByIndex(0); // Sensor 0 will capture Soil Temp in Celcius soilHum = map(analogRead(soilHumPIN), 1023, 0, 0, 100); light = map(analogRead(ldrPIN), 1023, 0, 0, 100); //LDRDark:0 ==> light 100% } /********* Display Sensors value *************/ void displaySensors(void) { Serial.print ("airTemp (oC): "); Serial.println (airTemp); Serial.print ("airHum (%): "); Serial.println (airHum); Serial.print ("soilTemp (oC): "); Serial.println (soilTemp); Serial.print ("soilHum (%): "); Serial.println (soilHum); Serial.print ("light (%): "); Serial.println (light); Serial.println (""); }
1bfb3a14c17205979d2b5bd7c2f97278ccd48ceb
633dd48e552887962086c53e3ca94052c2e815db
/src/main.cpp
828a8df3a12d9cd2bdf54b775318abeecd2c1931
[]
no_license
kiryam/avr-divecomputer
5548c3d7321bebe3267318917692077ac49761b7
960ceaf6237459de5433fd9291d65290bac05a2f
refs/heads/master
2020-05-21T10:10:09.299374
2015-08-01T17:56:32
2015-08-01T17:56:32
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,885
cpp
main.cpp
// // This file is part of the GNU ARM Eclipse distribution. // Copyright (c) 2014 Liviu Ionescu. // // ---------------------------------------------------------------------------- #include <stm32f4xx_hal.h> #include "stm32f4xx_hal_gpio.h" #include <assert.h> #include <stdio.h> #include <string.h> #include <time.h> #include <array> #include "pressureSensor.h" #include "rtc.h" #include "sdcard.h" #include "screen.h" #include <time.h> #include "timer.h" #include "types.h" #include "pins.h" #include "buhlmannModel.h" #include "systemClock.h" #include "waterSensor.h" #include "fileUtility.h" #include <diag/Trace.h> static inline void enable_peripherals() { __GPIOA_CLK_ENABLE(); __GPIOB_CLK_ENABLE(); __GPIOC_CLK_ENABLE(); __GPIOD_CLK_ENABLE(); __GPIOE_CLK_ENABLE(); __DMA1_CLK_ENABLE(); __DMA1_CLK_SLEEP_ENABLE(); } int main(void) { char buf1[16], buf2[32]; #ifdef DEBUG HAL_EnableDBGSleepMode(); #endif enable_peripherals(); rtc.init(); SysTick_Config(SystemCoreClock / 8 / 1000); __HAL_CORTEX_SYSTICKCLK_CONFIG(SYSTICK_CLKSOURCE_HCLK_DIV8); NVIC_SetPriority(SysTick_IRQn, 0); DepthSampling sampling = DepthSampling::OSR_4096; trace_printf("System clock: %uHz\n", SystemCoreClock); screen.enable(); pressureSensor.enable(); // assert(pressureSensor.wait()); // pressureSensor.sample(sampling); trace_printf("Depth sensor ready to go.\n"); float temperature, pressure; systemClock.setDate(1, 5, 15); systemClock.setTime(18, 16, 0); // systemClock.getTime(); // systemClock.getDate(); time_t start = systemClock.getUnixTimestamp(); //trace_printf("time %lu\n", (long) systemClock.getUnixTimestamp()); HAL_Delay(5000); // systemClock.getTime(); // systemClock.getDate(); //trace_printf("time %lu\n", (long) systemClock.getUnixTimestamp()); time_t end = systemClock.getUnixTimestamp(); trace_printf("Tu t'es absente pendant %f secondes.", difftime(end, start)); FileUtility fileUtility(""); for (;;) { //if clicked a button, start to calculate pressure pressureSensor.capture_data(); float current_pressure = pressureSensor.get_pressure_bar(); snprintf(buf1, sizeof (buf1), "%.2f mbar\n", pressure * 1000.); snprintf(buf1, sizeof (buf1), "%.2f mbar", pressure * 1000.); time_t tm = rtc.now(); ctime_r(&tm, buf2); u8g_FirstPage(&screen.u8g); do { u8g_SetColorIndex(&screen.u8g, 1); u8g_DrawHLine(&screen.u8g, 0, 0, 128); u8g_DrawHLine(&screen.u8g, 0, 63, 128); u8g_DrawVLine(&screen.u8g, 0, 0, 64); u8g_DrawVLine(&screen.u8g, 127, 0, 64); u8g_SetColorIndex(&screen.u8g, 3); u8g_SetFont(&screen.u8g, u8g_font_ncenR12); u8g_DrawStr(&screen.u8g, 10, 27, buf1); u8g_SetColorIndex(&screen.u8g, 2); u8g_SetFont(&screen.u8g, u8g_font_helvR08); u8g_DrawStr(&screen.u8g, 4, 46, buf2); } while (u8g_NextPage(&screen.u8g)); //dive start when diver have started to descend to min 100 centimeter if (waterSensor.is_wet() && current_pressure - pressureSensor.get_atm_pressure() > 0.1) { trace_printf("diving start\n"); pressureSensor.capture_data(); pressure = pressureSensor.get_pressure_bar(); temperature = pressureSensor.get_temperature_celcius(); HAL_Delay(1000); } else { // should check if the pressure is around the atm pressureSensor.capture_data(); pressure = pressureSensor.get_pressure_bar(); trace_printf("diving end\n"); HAL_Delay(10000); } //if desaturation is finish we can return in sleep mode __WFI(); } }
54602388a8b106be19553405a1a1e3cde9fa5083
5b69f73a79c25a5f1dfd392ad9799b258d655b19
/ril/libril/sap_service.cpp
962d564db5806041cda3a89c7d4a03d516907864
[ "Apache-2.0" ]
permissive
LineageOS/android_hardware_samsung
60863a35d4094c9921a77ceda78070cf55209bdc
0e6c373ef1114d0d4a899bf98a643acf2d817ff8
refs/heads/lineage-19.1
2023-08-28T13:29:07.457446
2023-08-15T15:26:44
2023-08-15T15:26:44
75,639,523
65
696
null
2022-10-02T20:16:17
2016-12-05T15:38:40
C
UTF-8
C++
false
false
38,030
cpp
sap_service.cpp
/* * Copyright (c) 2016 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. */ #define LOG_TAG "RIL_SAP" #include <android/hardware/radio/1.0/ISap.h> #include <hwbinder/IPCThreadState.h> #include <hwbinder/ProcessState.h> #include <sap_service.h> #include "pb_decode.h" #include "pb_encode.h" using namespace android::hardware::radio::V1_0; using ::android::hardware::Return; using ::android::hardware::hidl_vec; using ::android::hardware::hidl_array; using ::android::hardware::Void; using android::CommandInfo; using android::RequestInfo; using android::requestToString; using android::sp; struct SapImpl; #if (SIM_COUNT >= 2) sp<SapImpl> sapService[SIM_COUNT]; #else sp<SapImpl> sapService[1]; #endif struct SapImpl : public ISap { int32_t slotId; sp<ISapCallback> sapCallback; RIL_SOCKET_ID rilSocketId; Return<void> setCallback(const ::android::sp<ISapCallback>& sapCallbackParam); Return<void> connectReq(int32_t token, int32_t maxMsgSize); Return<void> disconnectReq(int32_t token); Return<void> apduReq(int32_t token, SapApduType type, const hidl_vec<uint8_t>& command); Return<void> transferAtrReq(int32_t token); Return<void> powerReq(int32_t token, bool state); Return<void> resetSimReq(int32_t token); Return<void> transferCardReaderStatusReq(int32_t token); Return<void> setTransferProtocolReq(int32_t token, SapTransferProtocol transferProtocol); MsgHeader* createMsgHeader(MsgId msgId, int32_t token); Return<void> addPayloadAndDispatchRequest(MsgHeader *msg, uint16_t reqLen, uint8_t *reqPtr); void sendFailedResponse(MsgId msgId, int32_t token, int numPointers, ...); void checkReturnStatus(Return<void>& ret); }; void SapImpl::checkReturnStatus(Return<void>& ret) { if (ret.isOk() == false) { RLOGE("checkReturnStatus: unable to call response/indication callback: %s", ret.description().c_str()); // Remote process (SapRilReceiver.java) hosting the callback must be dead. Reset the // callback object; there's no other recovery to be done here. When the client process is // back up, it will call setCallback() sapCallback = NULL; } } Return<void> SapImpl::setCallback(const ::android::sp<ISapCallback>& sapCallbackParam) { RLOGD("SapImpl::setCallback for slotId %d", slotId); sapCallback = sapCallbackParam; return Void(); } MsgHeader* SapImpl::createMsgHeader(MsgId msgId, int32_t token) { // Memory for msg will be freed by RilSapSocket::onRequestComplete() MsgHeader *msg = (MsgHeader *)calloc(1, sizeof(MsgHeader)); if (msg == NULL) { return NULL; } msg->token = token; msg->type = MsgType_REQUEST; msg->id = msgId; msg->error = Error_RIL_E_SUCCESS; return msg; } Return<void> SapImpl::addPayloadAndDispatchRequest(MsgHeader *msg, uint16_t reqLen, uint8_t *reqPtr) { pb_bytes_array_t *payload = (pb_bytes_array_t *) malloc(sizeof(pb_bytes_array_t) - 1 + reqLen); if (payload == NULL) { sendFailedResponse(msg->id, msg->token, 2, reqPtr, msg); return Void(); } msg->payload = payload; msg->payload->size = reqLen; memcpy(msg->payload->bytes, reqPtr, reqLen); RilSapSocket *sapSocket = RilSapSocket::getSocketById(rilSocketId); if (sapSocket) { RLOGD("SapImpl::addPayloadAndDispatchRequest: calling dispatchRequest"); sapSocket->dispatchRequest(msg); } else { RLOGE("SapImpl::addPayloadAndDispatchRequest: sapSocket is null"); sendFailedResponse(msg->id, msg->token, 3, payload, reqPtr, msg); return Void(); } free(msg->payload); free(reqPtr); return Void(); } void SapImpl::sendFailedResponse(MsgId msgId, int32_t token, int numPointers, ...) { va_list ap; va_start(ap, numPointers); for (int i = 0; i < numPointers; i++) { void *ptr = va_arg(ap, void *); if (ptr) free(ptr); } va_end(ap); Return<void> retStatus; switch(msgId) { case MsgId_RIL_SIM_SAP_CONNECT: retStatus = sapCallback->connectResponse(token, SapConnectRsp::CONNECT_FAILURE, 0); break; case MsgId_RIL_SIM_SAP_DISCONNECT: retStatus = sapCallback->disconnectResponse(token); break; case MsgId_RIL_SIM_SAP_APDU: { hidl_vec<uint8_t> apduRsp; retStatus = sapCallback->apduResponse(token, SapResultCode::GENERIC_FAILURE, apduRsp); break; } case MsgId_RIL_SIM_SAP_TRANSFER_ATR: { hidl_vec<uint8_t> atr; retStatus = sapCallback->transferAtrResponse(token, SapResultCode::GENERIC_FAILURE, atr); break; } case MsgId_RIL_SIM_SAP_POWER: retStatus = sapCallback->powerResponse(token, SapResultCode::GENERIC_FAILURE); break; case MsgId_RIL_SIM_SAP_RESET_SIM: retStatus = sapCallback->resetSimResponse(token, SapResultCode::GENERIC_FAILURE); break; case MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS: retStatus = sapCallback->transferCardReaderStatusResponse(token, SapResultCode::GENERIC_FAILURE, 0); break; case MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL: retStatus = sapCallback->transferProtocolResponse(token, SapResultCode::NOT_SUPPORTED); break; default: return; } sapService[slotId]->checkReturnStatus(retStatus); } Return<void> SapImpl::connectReq(int32_t token, int32_t maxMsgSize) { RLOGD("SapImpl::connectReq"); MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_CONNECT, token); if (msg == NULL) { RLOGE("SapImpl::connectReq: Error allocating memory for msg"); sendFailedResponse(MsgId_RIL_SIM_SAP_CONNECT, token, 0); return Void(); } /***** Encode RIL_SIM_SAP_CONNECT_REQ *****/ RIL_SIM_SAP_CONNECT_REQ req; memset(&req, 0, sizeof(RIL_SIM_SAP_CONNECT_REQ)); req.max_message_size = maxMsgSize; size_t encodedSize = 0; if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_CONNECT_REQ_fields, &req)) { RLOGE("SapImpl::connectReq: Error getting encoded size for RIL_SIM_SAP_CONNECT_REQ"); sendFailedResponse(MsgId_RIL_SIM_SAP_CONNECT, token, 1, msg); return Void(); } uint8_t *buffer = (uint8_t *)calloc(1, encodedSize); if (buffer == NULL) { RLOGE("SapImpl::connectReq: Error allocating memory for buffer"); sendFailedResponse(MsgId_RIL_SIM_SAP_CONNECT, token, 1, msg); return Void(); } pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize); RLOGD("SapImpl::connectReq calling pb_encode"); if (!pb_encode(&stream, RIL_SIM_SAP_CONNECT_REQ_fields, &req)) { RLOGE("SapImpl::connectReq: Error encoding RIL_SIM_SAP_CONNECT_REQ"); sendFailedResponse(MsgId_RIL_SIM_SAP_CONNECT, token, 2, buffer, msg); return Void(); } /***** Encode RIL_SIM_SAP_CONNECT_REQ done *****/ /* encoded req is payload */ return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer); } Return<void> SapImpl::disconnectReq(int32_t token) { RLOGD("SapImpl::disconnectReq"); MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_DISCONNECT, token); if (msg == NULL) { RLOGE("SapImpl::disconnectReq: Error allocating memory for msg"); sendFailedResponse(MsgId_RIL_SIM_SAP_DISCONNECT, token, 0); return Void(); } /***** Encode RIL_SIM_SAP_DISCONNECT_REQ *****/ RIL_SIM_SAP_DISCONNECT_REQ req; memset(&req, 0, sizeof(RIL_SIM_SAP_DISCONNECT_REQ)); size_t encodedSize = 0; if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_DISCONNECT_REQ_fields, &req)) { RLOGE("SapImpl::disconnectReq: Error getting encoded size for RIL_SIM_SAP_DISCONNECT_REQ"); sendFailedResponse(MsgId_RIL_SIM_SAP_DISCONNECT, token, 1, msg); return Void(); } uint8_t *buffer = (uint8_t *)calloc(1, encodedSize); if (buffer == NULL) { RLOGE("SapImpl::disconnectReq: Error allocating memory for buffer"); sendFailedResponse(MsgId_RIL_SIM_SAP_DISCONNECT, token, 1, msg); return Void(); } pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize); RLOGD("SapImpl::disconnectReq calling pb_encode"); if (!pb_encode(&stream, RIL_SIM_SAP_DISCONNECT_REQ_fields, &req)) { RLOGE("SapImpl::disconnectReq: Error encoding RIL_SIM_SAP_DISCONNECT_REQ"); sendFailedResponse(MsgId_RIL_SIM_SAP_DISCONNECT, token, 2, buffer, msg); return Void(); } /***** Encode RIL_SIM_SAP_DISCONNECT_REQ done *****/ /* encoded req is payload */ return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer); } Return<void> SapImpl::apduReq(int32_t token, SapApduType type, const hidl_vec<uint8_t>& command) { RLOGD("SapImpl::apduReq"); MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_APDU, token); if (msg == NULL) { RLOGE("SapImpl::apduReq: Error allocating memory for msg"); sendFailedResponse(MsgId_RIL_SIM_SAP_APDU, token, 0); return Void(); } /***** Encode RIL_SIM_SAP_APDU_REQ *****/ RIL_SIM_SAP_APDU_REQ req; memset(&req, 0, sizeof(RIL_SIM_SAP_APDU_REQ)); req.type = (RIL_SIM_SAP_APDU_REQ_Type)type; if (command.size() > 0) { req.command = (pb_bytes_array_t *)malloc(sizeof(pb_bytes_array_t) - 1 + command.size()); if (req.command == NULL) { RLOGE("SapImpl::apduReq: Error allocating memory for req.command"); sendFailedResponse(MsgId_RIL_SIM_SAP_APDU, token, 1, msg); return Void(); } req.command->size = command.size(); memcpy(req.command->bytes, command.data(), command.size()); } size_t encodedSize = 0; if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_APDU_REQ_fields, &req)) { RLOGE("SapImpl::apduReq: Error getting encoded size for RIL_SIM_SAP_APDU_REQ"); sendFailedResponse(MsgId_RIL_SIM_SAP_APDU, token, 2, req.command, msg); return Void(); } uint8_t *buffer = (uint8_t *)calloc(1, encodedSize); if (buffer == NULL) { RLOGE("SapImpl::apduReq: Error allocating memory for buffer"); sendFailedResponse(MsgId_RIL_SIM_SAP_APDU, token, 2, req.command, msg); return Void(); } pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize); RLOGD("SapImpl::apduReq calling pb_encode"); if (!pb_encode(&stream, RIL_SIM_SAP_APDU_REQ_fields, &req)) { RLOGE("SapImpl::apduReq: Error encoding RIL_SIM_SAP_APDU_REQ"); sendFailedResponse(MsgId_RIL_SIM_SAP_APDU, token, 3, req.command, buffer, msg); return Void(); } /***** Encode RIL_SIM_SAP_APDU_REQ done *****/ /* encoded req is payload */ return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer); } Return<void> SapImpl::transferAtrReq(int32_t token) { RLOGD("SapImpl::transferAtrReq"); MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_TRANSFER_ATR, token); if (msg == NULL) { RLOGE("SapImpl::transferAtrReq: Error allocating memory for msg"); sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_ATR, token, 0); return Void(); } /***** Encode RIL_SIM_SAP_TRANSFER_ATR_REQ *****/ RIL_SIM_SAP_TRANSFER_ATR_REQ req; memset(&req, 0, sizeof(RIL_SIM_SAP_TRANSFER_ATR_REQ)); size_t encodedSize = 0; if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_TRANSFER_ATR_REQ_fields, &req)) { RLOGE("SapImpl::transferAtrReq: Error getting encoded size for " "RIL_SIM_SAP_TRANSFER_ATR_REQ"); sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_ATR, token, 1, msg); return Void(); } uint8_t *buffer = (uint8_t *)calloc(1, encodedSize); if (buffer == NULL) { RLOGE("SapImpl::transferAtrReq: Error allocating memory for buffer"); sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_ATR, token, 1, msg); return Void(); } pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize); RLOGD("SapImpl::transferAtrReq calling pb_encode"); if (!pb_encode(&stream, RIL_SIM_SAP_TRANSFER_ATR_REQ_fields, &req)) { RLOGE("SapImpl::transferAtrReq: Error encoding RIL_SIM_SAP_TRANSFER_ATR_REQ"); sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_ATR, token, 2, buffer, msg); return Void(); } /***** Encode RIL_SIM_SAP_TRANSFER_ATR_REQ done *****/ /* encoded req is payload */ return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer); } Return<void> SapImpl::powerReq(int32_t token, bool state) { RLOGD("SapImpl::powerReq"); MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_POWER, token); if (msg == NULL) { RLOGE("SapImpl::powerReq: Error allocating memory for msg"); sendFailedResponse(MsgId_RIL_SIM_SAP_POWER, token, 0); return Void(); } /***** Encode RIL_SIM_SAP_POWER_REQ *****/ RIL_SIM_SAP_POWER_REQ req; memset(&req, 0, sizeof(RIL_SIM_SAP_POWER_REQ)); req.state = state; size_t encodedSize = 0; if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_POWER_REQ_fields, &req)) { RLOGE("SapImpl::powerReq: Error getting encoded size for RIL_SIM_SAP_POWER_REQ"); sendFailedResponse(MsgId_RIL_SIM_SAP_POWER, token, 1, msg); return Void(); } uint8_t *buffer = (uint8_t *)calloc(1, encodedSize); if (buffer == NULL) { RLOGE("SapImpl::powerReq: Error allocating memory for buffer"); sendFailedResponse(MsgId_RIL_SIM_SAP_POWER, token, 1, msg); return Void(); } pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize); RLOGD("SapImpl::powerReq calling pb_encode"); if (!pb_encode(&stream, RIL_SIM_SAP_POWER_REQ_fields, &req)) { RLOGE("SapImpl::powerReq: Error encoding RIL_SIM_SAP_POWER_REQ"); sendFailedResponse(MsgId_RIL_SIM_SAP_POWER, token, 2, buffer, msg); return Void(); } /***** Encode RIL_SIM_SAP_POWER_REQ done *****/ /* encoded req is payload */ return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer); } Return<void> SapImpl::resetSimReq(int32_t token) { RLOGD("SapImpl::resetSimReq"); MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_RESET_SIM, token); if (msg == NULL) { RLOGE("SapImpl::resetSimReq: Error allocating memory for msg"); sendFailedResponse(MsgId_RIL_SIM_SAP_RESET_SIM, token, 0); return Void(); } /***** Encode RIL_SIM_SAP_RESET_SIM_REQ *****/ RIL_SIM_SAP_RESET_SIM_REQ req; memset(&req, 0, sizeof(RIL_SIM_SAP_RESET_SIM_REQ)); size_t encodedSize = 0; if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_RESET_SIM_REQ_fields, &req)) { RLOGE("SapImpl::resetSimReq: Error getting encoded size for RIL_SIM_SAP_RESET_SIM_REQ"); sendFailedResponse(MsgId_RIL_SIM_SAP_RESET_SIM, token, 1, msg); return Void(); } uint8_t *buffer = (uint8_t *)calloc(1, encodedSize); if (buffer == NULL) { RLOGE("SapImpl::resetSimReq: Error allocating memory for buffer"); sendFailedResponse(MsgId_RIL_SIM_SAP_RESET_SIM, token, 1, msg); return Void(); } pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize); RLOGD("SapImpl::resetSimReq calling pb_encode"); if (!pb_encode(&stream, RIL_SIM_SAP_RESET_SIM_REQ_fields, &req)) { RLOGE("SapImpl::resetSimReq: Error encoding RIL_SIM_SAP_RESET_SIM_REQ"); sendFailedResponse(MsgId_RIL_SIM_SAP_RESET_SIM, token, 2, buffer, msg); return Void(); } /***** Encode RIL_SIM_SAP_RESET_SIM_REQ done *****/ /* encoded req is payload */ return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer); } Return<void> SapImpl::transferCardReaderStatusReq(int32_t token) { RLOGD("SapImpl::transferCardReaderStatusReq"); MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS, token); if (msg == NULL) { RLOGE("SapImpl::transferCardReaderStatusReq: Error allocating memory for msg"); sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS, token, 0); return Void(); } /***** Encode RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ *****/ RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ req; memset(&req, 0, sizeof(RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ)); size_t encodedSize = 0; if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ_fields, &req)) { RLOGE("SapImpl::transferCardReaderStatusReq: Error getting encoded size for " "RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ"); sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS, token, 1, msg); return Void(); } uint8_t *buffer = (uint8_t *)calloc(1, encodedSize); if (buffer == NULL) { RLOGE("SapImpl::transferCardReaderStatusReq: Error allocating memory for buffer"); sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS, token, 1, msg); return Void(); } pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize); RLOGD("SapImpl::transferCardReaderStatusReq calling pb_encode"); if (!pb_encode(&stream, RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ_fields, &req)) { RLOGE("SapImpl::transferCardReaderStatusReq: Error encoding " "RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ"); sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS, token, 2, buffer, msg); return Void(); } /***** Encode RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ done *****/ /* encoded req is payload */ return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer); } Return<void> SapImpl::setTransferProtocolReq(int32_t token, SapTransferProtocol transferProtocol) { RLOGD("SapImpl::setTransferProtocolReq"); MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL, token); if (msg == NULL) { RLOGE("SapImpl::setTransferProtocolReq: Error allocating memory for msg"); sendFailedResponse(MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL, token, 0); return Void(); } /***** Encode RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ *****/ RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ req; memset(&req, 0, sizeof(RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ)); req.protocol = (RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ_Protocol)transferProtocol; size_t encodedSize = 0; if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ_fields, &req)) { RLOGE("SapImpl::setTransferProtocolReq: Error getting encoded size for " "RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ"); sendFailedResponse(MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL, token, 1, msg); return Void(); } uint8_t *buffer = (uint8_t *)calloc(1, encodedSize); if (buffer == NULL) { RLOGE("SapImpl::setTransferProtocolReq: Error allocating memory for buffer"); sendFailedResponse(MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL, token, 1, msg); return Void(); } pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize); RLOGD("SapImpl::setTransferProtocolReq calling pb_encode"); if (!pb_encode(&stream, RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ_fields, &req)) { RLOGE("SapImpl::setTransferProtocolReq: Error encoding " "RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ"); sendFailedResponse(MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL, token, 2, buffer, msg); return Void(); } /***** Encode RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ done *****/ /* encoded req is payload */ return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer); } void *sapDecodeMessage(MsgId msgId, MsgType msgType, uint8_t *payloadPtr, size_t payloadLen) { void *responsePtr = NULL; pb_istream_t stream; /* Create the stream */ stream = pb_istream_from_buffer((uint8_t *)payloadPtr, payloadLen); /* Decode based on the message id */ switch (msgId) { case MsgId_RIL_SIM_SAP_CONNECT: responsePtr = malloc(sizeof(RIL_SIM_SAP_CONNECT_RSP)); if (responsePtr) { if (!pb_decode(&stream, RIL_SIM_SAP_CONNECT_RSP_fields, responsePtr)) { RLOGE("Error decoding RIL_SIM_SAP_CONNECT_RSP"); return NULL; } } break; case MsgId_RIL_SIM_SAP_DISCONNECT: if (msgType == MsgType_RESPONSE) { responsePtr = malloc(sizeof(RIL_SIM_SAP_DISCONNECT_RSP)); if (responsePtr) { if (!pb_decode(&stream, RIL_SIM_SAP_DISCONNECT_RSP_fields, responsePtr)) { RLOGE("Error decoding RIL_SIM_SAP_DISCONNECT_RSP"); return NULL; } } } else { responsePtr = malloc(sizeof(RIL_SIM_SAP_DISCONNECT_IND)); if (responsePtr) { if (!pb_decode(&stream, RIL_SIM_SAP_DISCONNECT_IND_fields, responsePtr)) { RLOGE("Error decoding RIL_SIM_SAP_DISCONNECT_IND"); return NULL; } } } break; case MsgId_RIL_SIM_SAP_APDU: responsePtr = malloc(sizeof(RIL_SIM_SAP_APDU_RSP)); if (responsePtr) { if (!pb_decode(&stream, RIL_SIM_SAP_APDU_RSP_fields, responsePtr)) { RLOGE("Error decoding RIL_SIM_SAP_APDU_RSP"); return NULL; } } break; case MsgId_RIL_SIM_SAP_TRANSFER_ATR: responsePtr = malloc(sizeof(RIL_SIM_SAP_TRANSFER_ATR_RSP)); if (responsePtr) { if (!pb_decode(&stream, RIL_SIM_SAP_TRANSFER_ATR_RSP_fields, responsePtr)) { RLOGE("Error decoding RIL_SIM_SAP_TRANSFER_ATR_RSP"); return NULL; } } break; case MsgId_RIL_SIM_SAP_POWER: responsePtr = malloc(sizeof(RIL_SIM_SAP_POWER_RSP)); if (responsePtr) { if (!pb_decode(&stream, RIL_SIM_SAP_POWER_RSP_fields, responsePtr)) { RLOGE("Error decoding RIL_SIM_SAP_POWER_RSP"); return NULL; } } break; case MsgId_RIL_SIM_SAP_RESET_SIM: responsePtr = malloc(sizeof(RIL_SIM_SAP_RESET_SIM_RSP)); if (responsePtr) { if (!pb_decode(&stream, RIL_SIM_SAP_RESET_SIM_RSP_fields, responsePtr)) { RLOGE("Error decoding RIL_SIM_SAP_RESET_SIM_RSP"); return NULL; } } break; case MsgId_RIL_SIM_SAP_STATUS: responsePtr = malloc(sizeof(RIL_SIM_SAP_STATUS_IND)); if (responsePtr) { if (!pb_decode(&stream, RIL_SIM_SAP_STATUS_IND_fields, responsePtr)) { RLOGE("Error decoding RIL_SIM_SAP_STATUS_IND"); return NULL; } } break; case MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS: responsePtr = malloc(sizeof(RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP)); if (responsePtr) { if (!pb_decode(&stream, RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP_fields, responsePtr)) { RLOGE("Error decoding RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP"); return NULL; } } break; case MsgId_RIL_SIM_SAP_ERROR_RESP: responsePtr = malloc(sizeof(RIL_SIM_SAP_ERROR_RSP)); if (responsePtr) { if (!pb_decode(&stream, RIL_SIM_SAP_ERROR_RSP_fields, responsePtr)) { RLOGE("Error decoding RIL_SIM_SAP_ERROR_RSP"); return NULL; } } break; case MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL: responsePtr = malloc(sizeof(RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_RSP)); if (responsePtr) { if (!pb_decode(&stream, RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_RSP_fields, responsePtr)) { RLOGE("Error decoding RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_RSP"); return NULL; } } break; default: break; } return responsePtr; } /* sapDecodeMessage */ sp<SapImpl> getSapImpl(RilSapSocket *sapSocket) { switch (sapSocket->getSocketId()) { case RIL_SOCKET_1: RLOGD("getSapImpl: returning sapService[0]"); return sapService[0]; #if (SIM_COUNT >= 2) case RIL_SOCKET_2: return sapService[1]; #if (SIM_COUNT >= 3) case RIL_SOCKET_3: return sapService[2]; #if (SIM_COUNT >= 4) case RIL_SOCKET_4: return sapService[3]; #endif #endif #endif default: return NULL; } } SapResultCode convertApduResponseProtoToHal(RIL_SIM_SAP_APDU_RSP_Response responseProto) { switch(responseProto) { case RIL_SIM_SAP_APDU_RSP_Response_RIL_E_SUCCESS: return SapResultCode::SUCCESS; case RIL_SIM_SAP_APDU_RSP_Response_RIL_E_GENERIC_FAILURE: return SapResultCode::GENERIC_FAILURE; case RIL_SIM_SAP_APDU_RSP_Response_RIL_E_SIM_NOT_READY: return SapResultCode::CARD_NOT_ACCESSSIBLE; case RIL_SIM_SAP_APDU_RSP_Response_RIL_E_SIM_ALREADY_POWERED_OFF: return SapResultCode::CARD_ALREADY_POWERED_OFF; case RIL_SIM_SAP_APDU_RSP_Response_RIL_E_SIM_ABSENT: return SapResultCode::CARD_REMOVED; default: return SapResultCode::GENERIC_FAILURE; } } SapResultCode convertTransferAtrResponseProtoToHal( RIL_SIM_SAP_TRANSFER_ATR_RSP_Response responseProto) { switch(responseProto) { case RIL_SIM_SAP_TRANSFER_ATR_RSP_Response_RIL_E_SUCCESS: return SapResultCode::SUCCESS; case RIL_SIM_SAP_TRANSFER_ATR_RSP_Response_RIL_E_GENERIC_FAILURE: return SapResultCode::GENERIC_FAILURE; case RIL_SIM_SAP_TRANSFER_ATR_RSP_Response_RIL_E_SIM_ALREADY_POWERED_OFF: return SapResultCode::CARD_ALREADY_POWERED_OFF; case RIL_SIM_SAP_TRANSFER_ATR_RSP_Response_RIL_E_SIM_ABSENT: return SapResultCode::CARD_REMOVED; case RIL_SIM_SAP_TRANSFER_ATR_RSP_Response_RIL_E_SIM_DATA_NOT_AVAILABLE: return SapResultCode::DATA_NOT_AVAILABLE; default: return SapResultCode::GENERIC_FAILURE; } } SapResultCode convertPowerResponseProtoToHal(RIL_SIM_SAP_POWER_RSP_Response responseProto) { switch(responseProto) { case RIL_SIM_SAP_POWER_RSP_Response_RIL_E_SUCCESS: return SapResultCode::SUCCESS; case RIL_SIM_SAP_POWER_RSP_Response_RIL_E_GENERIC_FAILURE: return SapResultCode::GENERIC_FAILURE; case RIL_SIM_SAP_POWER_RSP_Response_RIL_E_SIM_ABSENT: return SapResultCode::CARD_REMOVED; case RIL_SIM_SAP_POWER_RSP_Response_RIL_E_SIM_ALREADY_POWERED_OFF: return SapResultCode::CARD_ALREADY_POWERED_OFF; case RIL_SIM_SAP_POWER_RSP_Response_RIL_E_SIM_ALREADY_POWERED_ON: return SapResultCode::CARD_ALREADY_POWERED_ON; default: return SapResultCode::GENERIC_FAILURE; } } SapResultCode convertResetSimResponseProtoToHal(RIL_SIM_SAP_RESET_SIM_RSP_Response responseProto) { switch(responseProto) { case RIL_SIM_SAP_RESET_SIM_RSP_Response_RIL_E_SUCCESS: return SapResultCode::SUCCESS; case RIL_SIM_SAP_RESET_SIM_RSP_Response_RIL_E_GENERIC_FAILURE: return SapResultCode::GENERIC_FAILURE; case RIL_SIM_SAP_RESET_SIM_RSP_Response_RIL_E_SIM_ABSENT: return SapResultCode::CARD_REMOVED; case RIL_SIM_SAP_RESET_SIM_RSP_Response_RIL_E_SIM_NOT_READY: return SapResultCode::CARD_NOT_ACCESSSIBLE; case RIL_SIM_SAP_RESET_SIM_RSP_Response_RIL_E_SIM_ALREADY_POWERED_OFF: return SapResultCode::CARD_ALREADY_POWERED_OFF; } return SapResultCode::GENERIC_FAILURE; } SapResultCode convertTransferCardReaderStatusResponseProtoToHal( RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP_Response responseProto) { switch(responseProto) { case RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP_Response_RIL_E_SUCCESS: return SapResultCode::SUCCESS; case RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP_Response_RIL_E_GENERIC_FAILURE: return SapResultCode::GENERIC_FAILURE; case RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP_Response_RIL_E_SIM_DATA_NOT_AVAILABLE: return SapResultCode::DATA_NOT_AVAILABLE; } return SapResultCode::GENERIC_FAILURE; } void processResponse(MsgHeader *rsp, RilSapSocket *sapSocket, MsgType msgType) { MsgId msgId = rsp->id; uint8_t *data = rsp->payload->bytes; size_t dataLen = rsp->payload->size; void *messagePtr = sapDecodeMessage(msgId, msgType, data, dataLen); sp<SapImpl> sapImpl = getSapImpl(sapSocket); if (sapImpl->sapCallback == NULL) { RLOGE("processResponse: sapCallback == NULL; msgId = %d; msgType = %d", msgId, msgType); return; } RLOGD("processResponse: sapCallback != NULL; msgId = %d; msgType = %d", msgId, msgType); Return<void> retStatus; switch (msgId) { case MsgId_RIL_SIM_SAP_CONNECT: { RIL_SIM_SAP_CONNECT_RSP *connectRsp = (RIL_SIM_SAP_CONNECT_RSP *)messagePtr; RLOGD("processResponse: calling sapCallback->connectResponse %d %d %d", rsp->token, connectRsp->response, connectRsp->max_message_size); retStatus = sapImpl->sapCallback->connectResponse(rsp->token, (SapConnectRsp)connectRsp->response, connectRsp->max_message_size); break; } case MsgId_RIL_SIM_SAP_DISCONNECT: if (msgType == MsgType_RESPONSE) { RLOGD("processResponse: calling sapCallback->disconnectResponse %d", rsp->token); retStatus = sapImpl->sapCallback->disconnectResponse(rsp->token); } else { RIL_SIM_SAP_DISCONNECT_IND *disconnectInd = (RIL_SIM_SAP_DISCONNECT_IND *)messagePtr; RLOGD("processResponse: calling sapCallback->disconnectIndication %d %d", rsp->token, disconnectInd->disconnectType); retStatus = sapImpl->sapCallback->disconnectIndication(rsp->token, (SapDisconnectType)disconnectInd->disconnectType); } break; case MsgId_RIL_SIM_SAP_APDU: { RIL_SIM_SAP_APDU_RSP *apduRsp = (RIL_SIM_SAP_APDU_RSP *)messagePtr; SapResultCode apduResponse = convertApduResponseProtoToHal(apduRsp->response); RLOGD("processResponse: calling sapCallback->apduResponse %d %d", rsp->token, apduResponse); hidl_vec<uint8_t> apduRspVec; if (apduRsp->apduResponse != NULL && apduRsp->apduResponse->size > 0) { apduRspVec.setToExternal(apduRsp->apduResponse->bytes, apduRsp->apduResponse->size); } retStatus = sapImpl->sapCallback->apduResponse(rsp->token, apduResponse, apduRspVec); break; } case MsgId_RIL_SIM_SAP_TRANSFER_ATR: { RIL_SIM_SAP_TRANSFER_ATR_RSP *transferAtrRsp = (RIL_SIM_SAP_TRANSFER_ATR_RSP *)messagePtr; SapResultCode transferAtrResponse = convertTransferAtrResponseProtoToHal(transferAtrRsp->response); RLOGD("processResponse: calling sapCallback->transferAtrResponse %d %d", rsp->token, transferAtrResponse); hidl_vec<uint8_t> transferAtrRspVec; if (transferAtrRsp->atr != NULL && transferAtrRsp->atr->size > 0) { transferAtrRspVec.setToExternal(transferAtrRsp->atr->bytes, transferAtrRsp->atr->size); } retStatus = sapImpl->sapCallback->transferAtrResponse(rsp->token, transferAtrResponse, transferAtrRspVec); break; } case MsgId_RIL_SIM_SAP_POWER: { SapResultCode powerResponse = convertPowerResponseProtoToHal( ((RIL_SIM_SAP_POWER_RSP *)messagePtr)->response); RLOGD("processResponse: calling sapCallback->powerResponse %d %d", rsp->token, powerResponse); retStatus = sapImpl->sapCallback->powerResponse(rsp->token, powerResponse); break; } case MsgId_RIL_SIM_SAP_RESET_SIM: { SapResultCode resetSimResponse = convertResetSimResponseProtoToHal( ((RIL_SIM_SAP_RESET_SIM_RSP *)messagePtr)->response); RLOGD("processResponse: calling sapCallback->resetSimResponse %d %d", rsp->token, resetSimResponse); retStatus = sapImpl->sapCallback->resetSimResponse(rsp->token, resetSimResponse); break; } case MsgId_RIL_SIM_SAP_STATUS: { RIL_SIM_SAP_STATUS_IND *statusInd = (RIL_SIM_SAP_STATUS_IND *)messagePtr; RLOGD("processResponse: calling sapCallback->statusIndication %d %d", rsp->token, statusInd->statusChange); retStatus = sapImpl->sapCallback->statusIndication(rsp->token, (SapStatus)statusInd->statusChange); break; } case MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS: { RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP *transferStatusRsp = (RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP *)messagePtr; SapResultCode transferCardReaderStatusResponse = convertTransferCardReaderStatusResponseProtoToHal( transferStatusRsp->response); RLOGD("processResponse: calling sapCallback->transferCardReaderStatusResponse %d %d %d", rsp->token, transferCardReaderStatusResponse, transferStatusRsp->CardReaderStatus); retStatus = sapImpl->sapCallback->transferCardReaderStatusResponse(rsp->token, transferCardReaderStatusResponse, transferStatusRsp->CardReaderStatus); break; } case MsgId_RIL_SIM_SAP_ERROR_RESP: { RLOGD("processResponse: calling sapCallback->errorResponse %d", rsp->token); retStatus = sapImpl->sapCallback->errorResponse(rsp->token); break; } case MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL: { SapResultCode setTransferProtocolResponse; if (((RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_RSP *)messagePtr)->response == RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_RSP_Response_RIL_E_SUCCESS) { setTransferProtocolResponse = SapResultCode::SUCCESS; } else { setTransferProtocolResponse = SapResultCode::NOT_SUPPORTED; } RLOGD("processResponse: calling sapCallback->transferProtocolResponse %d %d", rsp->token, setTransferProtocolResponse); retStatus = sapImpl->sapCallback->transferProtocolResponse(rsp->token, setTransferProtocolResponse); break; } default: return; } sapImpl->checkReturnStatus(retStatus); } void sap::processResponse(MsgHeader *rsp, RilSapSocket *sapSocket) { processResponse(rsp, sapSocket, MsgType_RESPONSE); } void sap::processUnsolResponse(MsgHeader *rsp, RilSapSocket *sapSocket) { processResponse(rsp, sapSocket, MsgType_UNSOL_RESPONSE); } void sap::registerService(const RIL_RadioFunctions *callbacks) { using namespace android::hardware; int simCount = 1; const char *serviceNames[] = { android::RIL_getServiceName() #if (SIM_COUNT >= 2) , RIL2_SERVICE_NAME #if (SIM_COUNT >= 3) , RIL3_SERVICE_NAME #if (SIM_COUNT >= 4) , RIL4_SERVICE_NAME #endif #endif #endif }; RIL_SOCKET_ID socketIds[] = { RIL_SOCKET_1 #if (SIM_COUNT >= 2) , RIL_SOCKET_2 #if (SIM_COUNT >= 3) , RIL_SOCKET_3 #if (SIM_COUNT >= 4) , RIL_SOCKET_4 #endif #endif #endif }; #if (SIM_COUNT >= 2) simCount = SIM_COUNT; #endif for (int i = 0; i < simCount; i++) { sapService[i] = new SapImpl; sapService[i]->slotId = i; sapService[i]->rilSocketId = socketIds[i]; RLOGD("registerService: starting ISap %s for slotId %d", serviceNames[i], i); android::status_t status = sapService[i]->registerAsService(serviceNames[i]); RLOGD("registerService: started ISap %s status %d", serviceNames[i], status); } }
c9388e11c9ca4a642ef39cb45cb566780d50df69
27d338d2f3a83562fc4d84dcd929871c64697fc1
/pathfinder.cpp
f6ac42e77c64bc0038f885b83f38b829258ae49a
[ "Apache-2.0" ]
permissive
jinshanwang/A-searchC-code
fa32d368a6d3070f57b3a59a8dc46254f94e633a
a86bc22d1fe94dee9c8f335ce6c00de47ac6b07d
refs/heads/master
2020-05-06T13:47:49.055450
2019-04-08T13:54:12
2019-04-08T13:54:12
180,156,604
0
0
null
null
null
null
UTF-8
C++
false
false
7,241
cpp
pathfinder.cpp
#include <iostream> #include <vector> #include <set> #include <string> #include "Pathfinder.h" #include "node.h" #include "mapBuilder.h" using namespace std; pathFinder::pathFinder (vector<vector<node> > originalMap){ map=originalMap; ExploredCounter=0; } void pathFinder::setStartX(int x){ startX=x+1; } void pathFinder::setStartY(int y){ startY=y+1; } void pathFinder::setEndX(int x){ endX=x+1; } void pathFinder::setEndY(int y){ endY=y+1; } void pathFinder::pathSearching(){ // validate whether the start point and end point is occupied or not // if the start point or the end point is occupied we do not need to find the path if (map[startX][startY].getOccupied()==false && map[endX][endY].getOccupied()==false) { /*step 1: start from the start node, set the cost of the node is 0 and then push the startpoint into the frontier queue*/ node startPoint = map[startX][startY]; startPoint.setGCost(0); frontier.push(startPoint); /*Step 2: 1.check that if the frontier is empty or not if it is and then we can stop search */ while (frontier.empty()==false) { node currentNode = frontier.top(); /*2.if the current node is the goal then assign the node to the target and break.*/ if (currentNode.getX()==endX && currentNode.getY()==endY) { target=currentNode; break; } /*3.if it is node the target then we set the node to be explored and increase the the ExploredCounter by 1.*/ map[currentNode.getX()][currentNode.getY()].setExplored(true); ExploredCounter+=1; /*4.pop out the top node of the frontier*/ frontier.pop(); /*5.looking for the neighborhood on the left*/ node neighbor_L=LeftOperation(currentNode); /*check whether it is occupied or not*/ if (neighbor_L.getOccupied()==false) { if (map[neighbor_L.getX()][neighbor_L.getY()].getExplored()==false) { neighbor_L.setParent(currentNode.getX(),currentNode.getY()); neighbor_L.setGCost(currentNode.getGcost()+1); neighbor_L.setCost(startX,startY,endX,endY); neighbor_L.setPath(currentNode.getPath()+"L "); /*check whether it can be found on the frontier or not we can push the node into the frontier there is no this node before*/ if (findNode(neighbor_L)==false) { frontier.push(neighbor_L); } /*if we can find the node we need to make some comparison and inprovement to refresh the path*/ else if (findNode(neighbor_L)==true ) { Pathimprovement(neighbor_L); } } } /*6.looking for the neighborhood on the right*/ node neighbor_R=RightOperation(currentNode); /*check whether it is occupied or not*/ if (neighbor_R.getOccupied()==false) { if (map[neighbor_R.getX()][neighbor_R.getY()].getExplored()==false) { neighbor_R.setParent(currentNode.getX(),currentNode.getY()); neighbor_R.setGCost(currentNode.getGcost()+1); neighbor_R.setCost(startX,startY,endX,endY); neighbor_R.setPath(currentNode.getPath()+"R "); /*check whether it can be found on the frontier or not we can push the node into the frontier there is no this node before*/ if (findNode(neighbor_R)==false) { frontier.push(neighbor_R); } /*if we can find the node we need to make some comparison and inprovement to refresh the path*/ else if (findNode(neighbor_R)==true ) { Pathimprovement(neighbor_R); } } } /*7.looking for the neighborhood on the top*/ node neighbor_UP=UpOperation(currentNode); /*check whether it is occupied or not*/ if (neighbor_UP.getOccupied()==false) { if (map[neighbor_UP.getX()][neighbor_UP.getY()].getExplored()==false) { neighbor_UP.setParent(currentNode.getX(),currentNode.getY()); neighbor_UP.setGCost(currentNode.getGcost()+1); neighbor_UP.setCost(startX,startY,endX,endY); neighbor_UP.setPath(currentNode.getPath()+"U "); /*check whether it can be found on the frontier or not we can push the node into the frontier there is no this node before*/ if (findNode(neighbor_UP)==false ) { frontier.push(neighbor_UP); } /*if we can find the node we need to make some comparison and inprovement to refresh the path*/ else if (findNode(neighbor_UP)==true ) { Pathimprovement(neighbor_UP); } } } /*8.looking for the neighborhood under the floor*/ node neighbor_D=DownOperation(currentNode); /*check whether it is occupied or not*/ if (neighbor_D.getOccupied()==false) { if (map[neighbor_D.getX()][neighbor_D.getY()].getExplored()==false) { neighbor_D.setParent(currentNode.getX(),currentNode.getY()); neighbor_D.setGCost(currentNode.getGcost()+1); neighbor_D.setCost(startX,startY,endX,endY); neighbor_D.setPath(currentNode.getPath()+"D "); /*check whether it can be found on the frontier or not we can push the node into the frontier there is no this node before*/ if (findNode(neighbor_D)==false) { frontier.push(neighbor_D); } /*if we can find the node we need to make some comparison and inprovement to refresh the path*/ else if (findNode(neighbor_D)==true ) { Pathimprovement(neighbor_D); } } } } } } node pathFinder::LeftOperation(node n){ return map[n.getX()][n.getY()-1]; } node pathFinder::RightOperation(node n){ return map[n.getX()][n.getY()+1]; } node pathFinder::UpOperation(node n){ return map[n.getX()-1][n.getY()]; } node pathFinder::DownOperation(node n){ return map[n.getX()+1][n.getY()]; } bool pathFinder::findNode(node n){ std::priority_queue<node, std::vector<node>, node_cmp> frontierCopy = frontier; while(!frontierCopy.empty()){ node current= frontierCopy.top(); if (current.getX()==n.getX() && current.getY()==n.getY()) { return true; } frontierCopy.pop(); } return false; } /*if there is duplicate node, we need to do some improvement according to the total cost*/ void pathFinder::Pathimprovement(node n){ std::priority_queue<node, std::vector<node>, node_cmp> v; while (!frontier.empty()) { node current = frontier.top(); if (current.getX()==n.getX() && current.getY()==n.getY()) { if (current.getCost()>n.getCost()) { current.nodeModification(n.getParentX(),n.getParentY(),n.getCost(),n.getGcost()); current.pathModification(n.getPath()); } } v.push(current); frontier.pop(); } frontier=v; } node pathFinder::getTarget(){ return target; } int pathFinder::getExploredCounter(){ return ExploredCounter; }
e6fabef506e3b1bd141a7319eee6228716e9e3fb
4c39ed31fe1268302952bbe5c2cd456c8083281e
/ZOJ/2201No Brainer.cpp
d5c2a9e08642f8d1d049c140a4203070d9136ad8
[]
no_license
Abhay4/Algorithm
37e3b8bd3c9990b896d862f1aa20ad8312f20e75
50b157e027c7f0c085a8a15929422e75851fafc4
refs/heads/master
2020-12-11T01:37:58.200719
2018-01-24T18:24:05
2018-01-24T18:24:05
38,934,843
0
0
null
2015-07-11T17:46:17
2015-07-11T17:46:17
null
UTF-8
C++
false
false
293
cpp
2201No Brainer.cpp
/* * zju 2201 No Brainer * 00:00.00 436k * 2004.11.11 by adai */ #include <iostream> using namespace std; int main() { int kase; cin >> kase; while (kase --) { int x, y; cin >> x >> y; if (x < y) cout << "NO BRAINS" << endl; else cout << "MMM BRAINS" << endl; } return 0; }
00a1851db72c1180355bfd34463310862795c985
e351815e80519de411cd3361013a5098fb405fe6
/rgat/headers/graph_display_data.h
6ab4b630cda552e31992b30cfcee93ca6f9e36ff
[ "Apache-2.0" ]
permissive
Lukas-Dresel/rgat
e9e5337d62b15511aca1aeaecdbdbc9be8e96110
6b45e2efeaa10502ea277b53a24eb46acbcb0de3
refs/heads/master
2021-10-20T05:02:24.459104
2019-02-26T01:08:22
2019-02-26T01:08:22
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,461
h
graph_display_data.h
/* Copyright 2016-2017 Nia Catlin 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. */ /* This class holds (and provides dubiously mutex guarded access to) OpenGl vertex and colour data */ #pragma once #include <stdafx.h> #include "mathStructs.h" #include "traceConstants.h" class GRAPH_DISPLAY_DATA { public: GRAPH_DISPLAY_DATA(bool preview = false); ~GRAPH_DISPLAY_DATA(); vector <float>* acquire_pos_read(int holder = 0); vector <float>* acquire_col_read(); vector <float>* acquire_pos_write(int holder = 0); vector <float>* acquire_col_write(); float *readonly_col() { if (!vcolarray.empty()) return &vcolarray.at(0); return 0; } float *readonly_pos() { if (!vposarray.empty()) return &vposarray.at(0); return 0; } void release_pos_write(); void release_pos_read(); void release_col_write(); void release_col_read(); void clear(); void reset(); size_t col_sizec() { return vcolarray.size(); } //this is actually quite slow? or at least is a significant % of reported cpu time unsigned int col_buf_capacity_floats() { return vcolarraySize; } GLsizei get_numVerts() { return numVerts; } GLsizei get_numLoadedVerts() { return loadedVerts; } void set_numLoadedVerts(GLsizei qty) { loadedVerts = qty; } void set_numVerts(GLsizei num); unsigned int get_renderedEdges() { return edgesRendered; } void inc_edgesRendered() { ++edgesRendered; } void drawShortLinePoints(FCOORD &startC, FCOORD &endC, QColor &colour, long *arraypos); int drawLongCurvePoints(FCOORD &bezierC, FCOORD &startC, FCOORD &endC, QColor &colour, int edgeType, long *colarraypos); bool get_coord(NODEINDEX index, FCOORD* result); bool isPreview() { return preview; } private: mutable std::shared_mutex poslock_; mutable std::shared_mutex collock_; unsigned long numVerts = 0; unsigned long loadedVerts = 0; vector<GLfloat> vposarray; vector<GLfloat> vcolarray; unsigned long vcolarraySize = 0; //not used for nodes unsigned int edgesRendered = 0; bool preview = false; };
836691315c2b3f031b16c9dafd252f4712ca6513
7eaefba219a3172cfddd78999bc1bc1496b0c406
/8._Software_Timer/Timer_OneShot/Timer_OneShot.ino
76aef476547a81131d2b3ec5b079f1c8899cd79b
[]
no_license
harithaslam/MCTE4324_RealTimeSystem
297e4ad9c46a650eb1e5fe340f808a14e1302ba0
1037595f86abc088256bdb32057bb7bd24205260
refs/heads/main
2023-05-06T01:12:15.749898
2021-05-31T05:41:18
2021-05-31T05:41:18
348,593,601
0
0
null
null
null
null
UTF-8
C++
false
false
2,413
ino
Timer_OneShot.ino
//if use Vanilla FreeRTOS need to include: //#include timers.h #if CONFIG_FREERTOS_UNICORE static const BaseType_t app_cpu = 0; #else static const BaseType_t app_cpu = 1; #endif //Globals static TimerHandle_t one_shot_timer = NULL; static TimerHandle_t auto_reload_timer = NULL; //************************** // Call backs //Called when one of the timer expires void myTimerCallback(TimerHandle_t xTimer) { // Print message if timer 0 expired if ((uint32_t)pvTimerGetTimerID(xTimer) == 0) { Serial.println ("One-shot timer expired"); } //Print message if timer 1 expired if ((uint32_t)pvTimerGetTimerID(xTimer) == 1){ Serial.println("Auto-reload timer expired"); } } //************************* //Main (runs as its own task with priority 1 on core 1) void setup() { //Configure Serial Serial.begin(115200); //Wait a moment to start(so we don't miss Serial output) vTaskDelay(1000 / portTICK_PERIOD_MS); Serial.println(); Serial.println("---FreeRTOS Timer Demo---"); // Create a one-shot timer one_shot_timer = xTimerCreate( "One-shot timer", 2000 / portTICK_PERIOD_MS, pdFALSE, (void *)0, myTimerCallback); // Create a one-shot timer auto_reload_timer = xTimerCreate( "Auto-Reload timer", //Name of timer 1000 / portTICK_PERIOD_MS, //Period of timer (in ticks) pdTRUE, //Auto-Reload (void *)1, //Timer ID myTimerCallback); //Call back function //Check to make sure timers are created if ((one_shot_timer == NULL) || (auto_reload_timer == NULL)) { Serial.println("Could not create one of the timers"); } else { //Wait and then print out message that we're starting timer vTaskDelay(1000 / portTICK_PERIOD_MS); Serial.println("starting timers..."); //Start timer (max clock time if command queue is full) xTimerStart(one_shot_timer, portMAX_DELAY); xTimerStart(auto_reload_timer, portMAX_DELAY); } //Delete self task to show that timers will work wth no user tasks vTaskDelete(NULL); } void loop() { //Execution will never go here }
048f73e49c58733c0a2836957ad72b0d73f1ab64
71f98d4dbc5cad6318fc29487ba77199ff5965c7
/calibration_common/include/calibration_common/objects/checkerboard.h
884576701b4d4c5b78aeedac8a295054caedbf7e
[ "BSD-2-Clause" ]
permissive
rislab/calibration_toolkit
3c6303e2dcfb2b37d403dad4f668f941cc1af990
ef7f0fa78d1d478b361303e480a808dd0fa6b191
refs/heads/master
2020-05-30T02:07:17.657445
2019-05-30T22:47:05
2019-05-30T22:47:05
189,492,123
0
0
null
2019-05-30T22:46:17
2019-05-30T22:46:16
null
UTF-8
C++
false
false
6,527
h
checkerboard.h
/* * Copyright (c) 2013-2014, Filippo Basso <bassofil@dei.unipd.it> * * 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(s) nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef CALIBRATION_COMMON_OBJECTS_CHECKERBOARD_H_ #define CALIBRATION_COMMON_OBJECTS_CHECKERBOARD_H_ #include <calibration_common/objects/planar_object.h> #include <calibration_common/color/view.h> namespace calibration { /** * @brief The Checkerboard class */ class Checkerboard : public PlanarObject { public: typedef boost::shared_ptr<Checkerboard> Ptr; typedef boost::shared_ptr<const Checkerboard> ConstPtr; typedef Cloud3::Element Element; typedef Cloud3::ConstElement ConstElement; /** * @brief Checkerboard * @param cols * @param rows * @param cell_width * @param cell_height */ Checkerboard(Size1 cols, Size1 rows, Scalar cell_width, Scalar cell_height) : PlanarObject(), corners_(Size2(cols, rows)), cell_width_(cell_width), cell_height_(cell_height) { assert(cols > 0); assert(rows > 0); assert(cell_width > 0); assert(cell_height > 0); for (Size1 r = 0; r < rows; ++r) for (Size1 c = 0; c < cols; ++c) corners_(c, r) << c * cell_width, r * cell_height, Scalar(0); } /** * @brief Checkerboard * @param view */ template <typename ColorSensor> Checkerboard(const ColorView<ColorSensor, Checkerboard> & view) : PlanarObject(), corners_(view.object()->corners()), cell_width_(view.object()->cellWidth()), cell_height_(view.object()->cellHeight()) { setParent(view.sensor()); setPlane(view.object()->plane()); std::stringstream ss; ss << view.object()->frameId() << "_" << view.id(); setFrameId(ss.str()); transform(view.sensor()->cameraModel()->estimatePose(view.points(), view.object()->corners())); } /** * @brief ~Checkerboard */ virtual ~Checkerboard() { // Do nothing } /** * @brief transform * @param transform */ inline virtual void transform(const Transform & transform) { PlanarObject::transform(transform); corners_.transform(transform); } /** * @brief points * @return */ inline virtual const Cloud3 & points() const { return corners(); } /** * @brief center * @return */ inline Point3 center() const { return Point3((corners_(0, 0) + corners_(cols() - 1, rows() - 1)) / 2); } /** * @brief corners * @return */ inline Cloud3 & corners() { return corners_; } /** * @brief corners * @return */ inline const Cloud3 & corners() const { return corners_; } /** * @brief size * @return */ inline Size1 size() const { return corners_.elements(); } /** * @brief rows * @return */ inline Size1 rows() const { return corners_.size().y(); } /** * @brief cols * @return */ inline Size1 cols() const { return corners_.size().x(); } /** * @brief cellWidth * @return */ inline Scalar cellWidth() const { return cell_width_; } /** * @brief cellHeight * @return */ inline Scalar cellHeight() const { return cell_height_; } /** * @brief area * @return */ inline Scalar area() const { return width() * height(); } /** * @brief width * @return */ inline Scalar width() const { return cellWidth() * (cols() + 1); } /** * @brief height * @return */ inline Scalar height() const { return cellHeight() * (rows() + 1); } /** * @brief operator [] * @param index * @return */ inline Element operator [](Size1 index) { return corners_[index]; } /** * @brief operator [] * @param index * @return */ inline const ConstElement operator [](Size1 index) const { return corners_[index]; } /** * @brief at * @param col * @param row * @return */ inline const ConstElement at(Size1 col, Size1 row) const { return corners_.at(Size2(col, row)); } /** * @brief at * @param col * @param row * @return */ inline Element at(Size1 col, Size1 row) { return corners_.at(Size2(col, row)); } /** * @brief operator () * @param col * @param row * @return */ inline const ConstElement operator ()(Size1 col, Size1 row) const { return corners_(Size2(col, row)); } /** * @brief operator () * @param col * @param row * @return */ inline Element operator ()(Size1 col, Size1 row) { return corners_(Size2(col, row)); } /** * @brief toMarker * @param marker */ void toMarker(visualization_msgs::Marker & marker) const; private: Scalar cell_width_; Scalar cell_height_; Cloud3 corners_; }; } /* namespace calibration */ #endif /* CALIBRATION_COMMON_OBJECTS_CHECKERBOARD_H_ */
d38565cce63b6bcb808f5d18dc2f77a2859e7c22
5470aee46382fec6e51c36c1e041185cd070566c
/euclidean_distance/distance_with_structs.cpp
06017524b79f6ad15905feb09601a1fb3b1e4f1e
[]
no_license
Joker-Jerome/cpp
c4167e137cddc7e6681c1f356083373daa770d67
d48fbad4d66a0d949232ba21262368beffe821d4
refs/heads/master
2021-09-10T08:41:16.514455
2018-03-23T03:53:33
2018-03-23T03:53:33
106,119,653
1
0
null
null
null
null
UTF-8
C++
false
false
658
cpp
distance_with_structs.cpp
#include <iostream> #include "geometry.h" // create an alias so we don't have to keep typing "geometry::point" using Point2D = geometry::point; int main(int argc, char **argv) { double totalDistance = 0.0; // read into 1st point Point2D last; std::cin >> last.x >> last.y; Point2D curr; // keep reading points until we can't any more while (std::cin >> curr.x >> curr.y) { // add the distance from the current point to the last one into total totalDistance += euclideanDistance(curr, last); // remember current point for next time around loop last = curr; } std::cout << totalDistance << std::endl; }
6d0b59dc4a8b1097dc6539bc607eb5b7be75c7a8
8ec1987551283f3851c507d8b87c37cd073a9e92
/Super/src/Super/DesignPattern/Mediator.cpp
158762de01675534f46c3343ac32733415670008
[]
no_license
Edlward/public
5bab05e745b62087dc60b0979ce71be853f98b73
370bf770d92c1f7b4970b2aa3fb18408e567d275
refs/heads/master
2022-11-17T12:14:55.414823
2020-07-17T19:03:24
2020-07-17T19:03:24
null
0
0
null
null
null
null
UTF-8
C++
false
false
85
cpp
Mediator.cpp
#include "Mediator.h" Mediator::Mediator(void) { } Mediator::~Mediator(void) { }
dee2c02354fc9de67d191f7f396ea11b200b3ce0
6b2a8dd202fdce77c971c412717e305e1caaac51
/solutions_5695413893988352_0/C++/Lightmoon/B_small.cpp
a640dacf835c011784c171621c209315c544c481
[]
no_license
alexandraback/datacollection
0bc67a9ace00abbc843f4912562f3a064992e0e9
076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf
refs/heads/master
2021-01-24T18:27:24.417992
2017-05-23T09:23:38
2017-05-23T09:23:38
84,313,442
2
4
null
null
null
null
UTF-8
C++
false
false
1,210
cpp
B_small.cpp
#include <bits/stdc++.h> using namespace std; int ntest; string s,t; typedef long long LL; bool correct(int x, string s){ if(s.length()==1 && x > 9) return false; if(s.length()==2 && x>99) return false; for(int i=s.length()-1; i>-1; i--){ if(s[i]!='?' && s[i]-'0'!=x%10) return false; x/=10; } return true; } void solve(int test) { cout << "Case #" << test+1 << ": "; cin>> s>>t; int diff = 1000000; int rc =1000; int rj = 1000; for(int i=0; i<1000; i++){ for(int j=0; j<1000; j++){ if( correct(i,s) && correct(j,t) ) { // cout << s << " " << t << endl; int d = abs(i-j); if( d <diff){ rc = i; rj = j; diff = d; } } } } string rs="",rt=""; for(int i=0;s[i]; i++){ rs= char (rc%10 +'0')+rs; rc/=10; rt= char (rj%10 +'0')+ rt; rj/=10; } cout << rs << " " << rt << endl; } int main() { freopen("B-small-attempt2.in", "r", stdin); freopen("test.out", "w", stdout); ios::sync_with_stdio(false); int ntest; cin >> ntest; for(int test=0; test< ntest; test++) { solve(test); } return 0; }
0714da2aa4711c635b215fb4d63d8eab4748e357
7346a08f114af67997d7e162845cad6a6fbf5da1
/Data Structure(C++)/Polymorphism/Topic.cpp
de1a7183a3ef3b071968d58cee0102ba5f864790
[]
no_license
ruiwenhe-10/Data-structure-Implementation-and-Practice-CPP
9fa62e5b63b4968f719382ba8ecc0be0a6f6103c
8797cf4146046c11b36e4d6b37d376f66b277dfd
refs/heads/master
2022-12-26T14:34:20.584111
2020-09-21T05:06:42
2020-09-21T05:06:42
296,963,845
0
0
null
null
null
null
UTF-8
C++
false
false
328
cpp
Topic.cpp
#include <iostream> #include "Message.h" #include "Topic.h" #include "Reply.h" #include <sstream> using namespace std; Topic::Topic() : Message() {} Topic::Topic(const string &athr, const string &sbjct, const string &body, unsigned id) : Message(athr, sbjct, body, id) {} bool Topic::isReply() const { return false; }
1c19f2a0f5632070c94a2b021b50ca9856457ed2
74e905a1279662262f34ea977c113adde5129163
/fileformats/CellManager.h
af833e73270d8f74b965ba438906b6258e4987f5
[ "MIT" ]
permissive
kcat/XLEngine
a62ec24a83a545059bb6b70f6680187cc24cb16c
0e735ad67fa40632add3872e0cbe5a244689cbe5
refs/heads/master
2020-03-08T19:37:28.132922
2018-04-09T01:50:53
2018-04-09T01:54:14
128,358,918
1
0
null
2018-04-06T06:47:53
2018-04-06T06:47:53
null
UTF-8
C++
false
false
860
h
CellManager.h
#ifndef CELLMANAGER_H #define CELLMANAGER_H #include "../CommonTypes.h" #include "CellTypes.h" #include <string> using namespace std; class WorldCell; class CellLoader; class Archive; class IDriver3D; class World; class CellManager { public: static void Init(); static void Destroy(); //This loads a cell from disk and then formats it for the engine. //The WorldCell is then returned, ready to be added to the world. //Cell types include: levels, dungeon tiles, location tiles, etc. static WorldCell *LoadCell(IDriver3D *pDriver, World *pWorld, uint32_t uCellType, Archive *pCellArchive, const string& sFile, int32_t worldX, int32_t worldY); static WorldCell *LoadFromLocation(IDriver3D *pDriver, World *pWorld, uint32_t uCellType, void *pLocPtr); private: static CellLoader *m_CellLoaders[]; }; #endif //CELLMANAGER_H
53b21c0ce8b68117ec651d1b5b76e3a5291b7ca2
96c70a300633b037b052ef8ef951fde28423381d
/jssy/jssy.cpp
3dbd7d06f1726a8f458615eab19f5e786ba8ce50
[ "MIT" ]
permissive
palmerc/jssy
2ab2dc3eabab75680317776338403e75682aca6a
61099bf7ad7802a3e2de1bc45cad35d13088b9bb
refs/heads/master
2020-03-22T17:54:38.742344
2018-07-10T12:07:25
2018-07-10T13:20:23
140,423,585
1
0
MIT
2018-07-10T11:43:12
2018-07-10T11:43:12
null
UTF-8
C++
false
false
3,049
cpp
jssy.cpp
// // jssy.cpp // jssy // // Created by tihmstar on 21.07.17. // Copyright © 2017 tihmstar. All rights reserved. // #include "jssy.hpp" #include <fstream> #include "helper.h" extern "C"{ #include <string.h> } using namespace std; using namespace jssycpp; std::string ReplaceAll(std::string str, const std::string& from, const std::string& to) { size_t start_pos = 0; while((start_pos = str.find(from, start_pos)) != std::string::npos) { str.replace(start_pos, from.length(), to); start_pos += to.length(); // Handles case where 'to' is a substring of 'from' } return str; } jssy::jssy(string filename){ fstream file; file.open(filename); std::string buffer((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>()); file.close(); assure((_cnt = c::jssy_parse(buffer.c_str(), buffer.size(), NULL, 0)) > 0); assure(_token = (c::jssytok_t*)malloc(_cnt * sizeof(c::jssytok_t))); assure((_cnt = c::jssy_parse(buffer.c_str(), buffer.size(), (c::jssytok_t*)_token, _cnt * sizeof(c::jssytok_t))) > 0); } jssy::jssy(const c::jssytok_t *token) :_token(token), _cnt(0) {} jssy::jssy(const jssy& token) : _token(token._token),_cnt(0) {} jssy::~jssy(){ if (_cnt) free((c::jssytok_t*)_token); } c::jssytype_t jssy::type() const{ return _token->type; } size_t jssy::size() const{ return _token->size; } std::string jssy::stringValue() const{ retassure(_token->type == c::JSSY_STRING || _token->type == c::JSSY_DICT_KEY, "not a string"); string rt(_token->value,_token->size); rt = ReplaceAll(rt, "\\\"", "\""); rt = ReplaceAll(rt, "\\\\", "\\"); rt = ReplaceAll(rt, "\\\t", "\t"); rt = ReplaceAll(rt, "\\\r", "\r"); rt = ReplaceAll(rt, "\\\n", "\n"); return rt; } jssy jssy::subval() const{ assure(_token->type == c::JSSY_DICT_KEY); return {_token->subval}; } float jssy::numval() const{ retassure(_token->type == c::JSSY_PRIMITIVE, "not a number"); return _token->numval; } jssy::operator float() const{ return numval(); } jssy::operator string() const{ return stringValue(); } jssy::operator bool() const{ return _token; } jssy::iterator jssy::begin() const{ return {(*this)[0],_token->size,_token->type == c::JSSY_DICT}; } jssy::iterator jssy::end() const{ return {NULL,0,0}; } jssy jssy::operator [](int index) const{ retassure(_token->type == c::JSSY_ARRAY || _token->type == c::JSSY_DICT, "not a list"); size_t s = _token->size; const c::jssytok_t *cur = _token->subval; while (index--) { assure(s--); cur=cur->next; } return {cur}; } jssy jssy::operator [](string key) const{ retassure(_token->type == c::JSSY_DICT, "not a dict"); c::jssytok_t *tmp = _token->subval; for (size_t i = 0; i< _token->size; i++){ if (tmp->size == key.size() && strncmp(tmp->value, key.c_str(), tmp->size) == 0) return {tmp->subval}; tmp = tmp->next; } return {NULL}; }
94fcd3a3067f64ad5fa3f203139e862a839b4660
e4355967555857fd536787dce39ca30426ffa702
/867/Game Platform/小游戏/大众麻将视频/游戏客户端/ScoreControl.cpp
5f9c73a019cc2b7f2d250e85c942410e88a3e89e
[]
no_license
herox25000/oathx-ogrex-editor
f0fd6044f8065db9cb50a80376e52f502734e877
f645c7997f27e11a9063a0d352accd98a474cef1
refs/heads/master
2020-12-24T14:35:34.912603
2013-08-24T06:20:06
2013-08-24T06:20:06
32,935,652
6
9
null
null
null
null
GB18030
C++
false
false
8,329
cpp
ScoreControl.cpp
#include "StdAfx.h" #include "GameClient.h" #include "ScoreControl.h" #include ".\scorecontrol.h" ////////////////////////////////////////////////////////////////////////// //按钮标识 #define IDC_CLOSE_SCORE 100 //关闭成绩 ////////////////////////////////////////////////////////////////////////// BEGIN_MESSAGE_MAP(CScoreControl, CWnd) ON_WM_PAINT() ON_WM_TIMER() ON_WM_CREATE() ON_WM_ERASEBKGND() ON_WM_LBUTTONDOWN() ON_BN_CLICKED(IDC_CLOSE_SCORE, OnBnClickedClose) ON_WM_NCDESTROY() ON_WM_MOVE() END_MESSAGE_MAP() ////////////////////////////////////////////////////////////////////////// //构造函数 CScoreControl::CScoreControl() { //设置变量 m_cbWeaveCount=0; ZeroMemory(&m_ScoreInfo,sizeof(m_ScoreInfo)); //加载资源 HINSTANCE hResInstance=AfxGetInstanceHandle(); m_ImageWinLose.SetLoadInfo(IDB_WIN_LOSE,hResInstance); m_ImageGameScore.LoadFromResource(hResInstance,IDB_GAME_SCORE); m_ImageGameScoreFlag.SetLoadInfo(IDB_GAME_SCORE_FLAG,hResInstance); //设置控件 for (BYTE i=0;i<CountArray(m_WeaveCard);i++) m_WeaveCard[i].SetDirection(Direction_South); return; } //析构函数 CScoreControl::~CScoreControl() { } //复位数据 void CScoreControl::RestorationData() { //设置变量 m_cbWeaveCount=0; ZeroMemory(&m_ScoreInfo,sizeof(m_ScoreInfo)); //隐藏窗口 if (m_hWnd!=NULL) ShowWindow(SW_HIDE); return; } //设置积分 void CScoreControl::SetScoreInfo(const GametagScoreInfo & ScoreInfo, const tagWeaveInfo & WeaveInfo) { //设置变量 m_ScoreInfo=ScoreInfo; m_cbWeaveCount=WeaveInfo.cbWeaveCount; //组合变量 for (BYTE i=0;i<m_cbWeaveCount;i++) { bool bPublicWeave=(WeaveInfo.cbPublicWeave[i]==TRUE); m_WeaveCard[i].SetCardData(WeaveInfo.cbCardData[i],WeaveInfo.cbCardCount[i]); m_WeaveCard[i].SetDisplayItem(true); } //显示窗口 ShowWindow(SW_SHOW); return; } //关闭按钮 void CScoreControl::OnBnClickedClose() { //隐藏窗口 RestorationData(); return; } //重画函数 void CScoreControl::OnPaint() { CPaintDC dc(this); //获取位置 CRect rcClient; GetClientRect(&rcClient); //创建字体 CFont InfoFont; InfoFont.CreatePointFont(110,TEXT("宋体"),&dc); //创建缓冲 CDC DCBuffer; CBitmap ImageBuffer; DCBuffer.CreateCompatibleDC(&dc); ImageBuffer.CreateCompatibleBitmap(&dc,rcClient.Width(),rcClient.Height()); //设置 DC DCBuffer.SetBkMode(TRANSPARENT); DCBuffer.SelectObject(&ImageBuffer); DCBuffer.SetTextColor(RGB(255,255,255)); DCBuffer.SelectObject(CSkinResourceManager::GetDefaultFont()); //加载资源 CImageHandle HandleWinLose(&m_ImageWinLose); CImageHandle HandleGameScoreFlag(&m_ImageGameScoreFlag); //绘画背景 m_ImageGameScore.Draw(DCBuffer.GetSafeHdc(),0,0); //位置变量 int nCardSpace=5; int nItemWidth=g_CardResource.m_ImageTableBottom.GetViewWidth(); int nTotalWidth=m_cbWeaveCount*(nItemWidth*3+nCardSpace)+nItemWidth*m_ScoreInfo.cbCardCount+nCardSpace; //计算位置 int nYCardPos=110; int nXCardPos=(m_ImageGameScore.GetWidth()-nTotalWidth)/2; //绘画组合 for (BYTE i=0;i<m_cbWeaveCount;i++) { //绘画扑克 m_WeaveCard[i].DrawCardControl(&DCBuffer,nXCardPos,nYCardPos); //设置位置 nXCardPos+=(nCardSpace+nItemWidth*3); } //绘画扑克 for (BYTE i=0;i<m_ScoreInfo.cbCardCount;i++) { //绘画扑克 int nXCurrentPos=nXCardPos; int nYCurrentPos=nYCardPos-g_CardResource.m_ImageTableBottom.GetViewHeight()-5; g_CardResource.m_ImageTableBottom.DrawCardItem(&DCBuffer,m_ScoreInfo.cbCardData[i],nXCurrentPos,nYCurrentPos); //设置位置 nXCardPos+=nItemWidth; if ((i+2)==m_ScoreInfo.cbCardCount) nXCardPos+=nCardSpace; } //绘画牌型 for (WORD i=0;i<GAME_PLAYER;i++) { //用户过虑 if (m_ScoreInfo.dwChiHuKind[i]==CHK_NULL) continue; //牌型信息 DWORD dwCardKind[]={CHK_PENG_PENG,CHK_QI_XIAO_DUI,CHK_SHI_SAN_YAO}; DWORD dwCardRight[]={CHR_DI,CHR_TIAN,CHR_QING_YI_SE,CHR_QIANG_GANG,CHK_QUAN_QIU_REN}; //牌型信息 CString strCardInfo; LPCTSTR pszCardKind[]={TEXT("碰碰胡"),TEXT("七小对"),TEXT("十三幺")}; LPCTSTR pszCardRight[]={TEXT("地胡"),TEXT("天胡"),TEXT("清一色"),TEXT("杠胡"),TEXT("全求人")}; //牌型信息 for (BYTE j=0;j<CountArray(dwCardKind);j++) { if (m_ScoreInfo.dwChiHuKind[i]&dwCardKind[j]) { strCardInfo+=pszCardKind[j]; strCardInfo+=TEXT(" "); } } //牌权信息 for (BYTE j=0;j<CountArray(dwCardRight);j++) { if (m_ScoreInfo.dwChiHuRight[i]&dwCardRight[j]) { strCardInfo+=pszCardRight[j]; strCardInfo+=TEXT(" "); } } //绘画信息 CRect rcCardInfo(20,310,406,322); DCBuffer.DrawText(strCardInfo,rcCardInfo,DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS); break; } //设置 DC DCBuffer.SelectObject(InfoFont); DCBuffer.SetTextColor(RGB(255,255,255)); //积分信息 for (WORD i=0;i<GAME_PLAYER;i++) { //变量定义 TCHAR szUserScore[16]=TEXT(""); _sntprintf(szUserScore,CountArray(szUserScore),TEXT("%I64d"),m_ScoreInfo.lGameScore[i]); //位置计算 CRect rcName(29,165+i*30,132,165+(i+1)*30); CRect rcScore(130,165+i*30,190,165+(i+1)*30); CRect rcStatus(220,165+i*30,260,165+(i+1)*30); //绘画信息 UINT nFormat=DT_SINGLELINE|DT_END_ELLIPSIS|DT_VCENTER; DCBuffer.DrawText(szUserScore,lstrlen(szUserScore),&rcScore,nFormat|DT_CENTER); DCBuffer.DrawText(m_ScoreInfo.szUserName[i],lstrlen(m_ScoreInfo.szUserName[i]),&rcName,nFormat|DT_CENTER); //庄家标志 if (m_ScoreInfo.wBankerUser==i) { int nImageWidht=m_ImageGameScoreFlag.GetWidth(); int nImageHeight=m_ImageGameScoreFlag.GetHeight(); m_ImageGameScoreFlag.BlendDrawImage(&DCBuffer,310,168+i*30,RGB(255,0,255),240); } //用户状态 if ((m_ScoreInfo.dwChiHuKind[i]!=0)&&((m_ScoreInfo.wProvideUser!=i))) DCBuffer.DrawText(TEXT("胡牌"),lstrlen(TEXT("胡牌")),&rcStatus,nFormat|DT_CENTER); //用户状态 if ((m_ScoreInfo.wProvideUser==i)&&(m_ScoreInfo.dwChiHuKind[i]==0)) DCBuffer.DrawText(TEXT("放炮"),lstrlen(TEXT("放炮")),&rcStatus,nFormat|DT_CENTER); //用户状态 if ((m_ScoreInfo.dwChiHuKind[i]!=0)&&((m_ScoreInfo.wProvideUser==i))) DCBuffer.DrawText(TEXT("自摸"),lstrlen(TEXT("自摸")),&rcStatus,nFormat|DT_CENTER); //输赢标志 int nImageWidht=m_ImageWinLose.GetWidth()/3; int nImageHeight=m_ImageWinLose.GetHeight(); //绘画标志 int nImageExcursion=2*nImageWidht; if (m_ScoreInfo.lGameScore[i]>0L) nImageExcursion=0; if (m_ScoreInfo.lGameScore[i]<0L) nImageExcursion=nImageWidht; m_ImageWinLose.BlendDrawImage(&DCBuffer,390,169+i*29,nImageWidht,nImageHeight,nImageExcursion,0,RGB(255,0,255),240); } //绘画界面 dc.BitBlt(0,0,rcClient.Width(),rcClient.Height(),&DCBuffer,0,0,SRCCOPY); //清理资源 DCBuffer.DeleteDC(); InfoFont.DeleteObject(); ImageBuffer.DeleteObject(); return; } //绘画背景 BOOL CScoreControl::OnEraseBkgnd(CDC * pDC) { //更新界面 Invalidate(FALSE); UpdateWindow(); return TRUE; } //创建函数 int CScoreControl::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (__super::OnCreate(lpCreateStruct)==-1) return -1; //设置窗口 SetWindowPos(NULL,0,0,m_ImageGameScore.GetWidth(),m_ImageGameScore.GetHeight(),SWP_NOZORDER|SWP_NOMOVE); //创建按钮 CRect rcCreate(0,0,0,0); m_btCloseScore.Create(NULL,WS_CHILD|WS_VISIBLE,rcCreate,this,IDC_CLOSE_SCORE); m_btCloseScore.SetButtonImage(IDB_BT_SCORE_CLOSE,AfxGetInstanceHandle(),false); //调整按钮 CRect rcClient; GetClientRect(&rcClient); m_btCloseScore.SetWindowPos(NULL,rcClient.Width()-31,3,0,0,SWP_NOSIZE|SWP_NOZORDER); return 0; } //鼠标消息 void CScoreControl::OnLButtonDown(UINT nFlags, CPoint Point) { __super::OnLButtonDown(nFlags,Point); //消息模拟 PostMessage(WM_NCLBUTTONDOWN,HTCAPTION,MAKELPARAM(Point.x,Point.y)); return; } ////////////////////////////////////////////////////////////////////////// void CScoreControl::OnMove(int x, int y) { __super::OnMove(x, y); //更新界面 Invalidate(FALSE); UpdateWindow(); }
66474198945798aed9760ce3eb0b06b19eb17a00
5bef53b0dc9539a4953919f75fde1f0ebd20e9fb
/CF/CONTEST_593D2/B.cpp
4699886417d0d523ebe2840e30492cfe6a894e19
[]
no_license
atrin-hojjat/CompetetiveProgramingCodes
54c8b94092f7acf40d379e42e1f2c0fe8dab9b32
6a02071c3869b8e7cd873ddf7a3a2d678aec6d91
refs/heads/master
2020-11-25T10:51:23.200000
2020-10-08T11:12:09
2020-10-08T11:12:09
228,626,397
1
0
null
null
null
null
UTF-8
C++
false
false
378
cpp
B.cpp
#include <iostream> using namespace std; const int mod = 1e9 + 7; int _pow(int base, int exp) { int ans = 1; for(; exp; exp >>= 1, base = 1ll * base * base % mod) if(exp & 1) ans = 1ll * base * ans % mod; return ans; } int main() { int n, m; cin >> n >> m; int A = _pow(2, m) - 1; if(A < 0) A += mod; int B = _pow(A, n); cout << B << endl; return 0; }
a369a05c54ace753b01f881b63501df1b7956b0e
ece46d54db148fcd1717ae33e9c277e156067155
/ArxProjects/cadtest1/cadtest1/inc/AutoAAD3.h
ebd2998636b0e5fc58f05d07113e4e04e43c8244
[]
no_license
15831944/ObjectArx
ffb3675875681b1478930aeac596cff6f4187ffd
8c15611148264593730ff5b6213214cebd647d23
refs/heads/main
2023-06-16T07:36:01.588122
2021-07-09T10:17:27
2021-07-09T10:17:27
384,473,453
0
1
null
2021-07-09T15:08:56
2021-07-09T15:08:56
null
WINDOWS-1252
C++
false
false
1,076
h
AutoAAD3.h
#pragma once #include "AutoAAD2.h" #include "acedads.h" class AutoAAD3 : public AutoAAD2 { public: AutoAAD3(const TCHAR* pszFuncName) // 1 : AutoAAD2(pszFuncName) { } AutoAAD3(const TCHAR* pszFuncName, bool bAuto) // 2 £º AutoAAD2(pszFuncName, bAuto) { } AutoAAD3(const TCHAR* pszFuncName, bool bAuto, bool bTime) // 3 : AutoAAD2(pszFuncName, bAuto, bTime) { } virtual ~AutoAAD3() { } public: virtual void InfoSysVar(LPCTSTR pVarName) { resbuf* rb = acutNewRb(RTT); if (rb) { memset(rb, 0, sizeof(resbuf)); if (RTNORM == acedGetVar(pVarName, rb)) { AcString dxfCodeStr, valueStr; dxfToStr(rb, dxfCodeStr, valueStr); AutoAAD::InfoFmt(_T("SYSVAR %s: (%s . %s)"), dxfCodeStr.kTCharPtr(), valueStr.kTCharPtr()); } acutRelRb(rb); rb = NULL; } } }; #ifndef AA3 #define AA3(...) AutoAAD3 aa(_T(__FUNCTION__), __VA_ARGS__) #endif
74b8bf11006c9a4b01e3601f6fc12fdffdf1a2ae
b495d715dc9fe3a2ac6bec5da44d6e83fec6c142
/bar_codes.cpp
b9ea707e1a0591a56b8029500031fd5027142299
[]
no_license
shobhitr97/Codes
f68be601c7b974c335722cdb8dc7f06e6c007e83
8d4deb2bb7f27e6f9af0190d5e558ff20f64a495
refs/heads/master
2020-04-15T13:35:59.973444
2018-02-06T18:24:33
2018-02-06T18:24:33
58,259,950
0
0
null
null
null
null
UTF-8
C++
false
false
1,175
cpp
bar_codes.cpp
#include<iostream> #include<vector> #include<algorithm> #include<utility> #include<stdio.h> #include<set> #include<map> #include<cmath> #include<queue> #include<stack> using namespace std; typedef long long int ll; typedef vector<int> vi; typedef vector<ll> vll; typedef pair<int, int> ii; typedef vector<ii> vii; typedef pair<int, ii> iii; typedef vector<iii> viii; typedef set<int> si; #define pb push_back #define mp make_pair #define fori(a, b) for(int i=a ; i<b ; i++ ) #define forn(i, a, b) for(int i=a ; i<b ; i++ ) #define forin(a, b) for(int i=a ; i>=b ; i-- ) #define fi first #define se second #define INF 1000000007 int main(){ int n, k, m, limit; ll dp[52][52], sum; vector<ll>output; while(cin>>n){ cin>>k>>m; if(k==1){ if(n<=m) output.pb(1); else output.pb(0); continue; } forn(i, 0, k+1) forn(j, 0, n+1) dp[i][j]=0; fori(1, n+1) dp[1][i]=1; forn(i, 2, k+1){ forn(j, i, n+1){ sum=0; limit=max(i-1, j-m); forn(z, max(i-1, j-m), min(m*(i-1), j-1)+1) sum+=dp[i-1][z]; dp[i][j]=sum; } } output.pb(dp[k][n]); } for(vector<ll>::iterator it=output.begin();it!=output.end();it++) cout<<(*it)<<"\n"; return 0; }
2552a11937963d83b852ac9911b17079598bad07
dfe1f796a54143e5eb8661f3328ad29dbfa072d6
/psx/_dump_/28/_dump_c_src_/diabpsx/source/player.cpp
56d0e1b5a0d755844cbfa4a32ec8746627456e18
[ "Unlicense" ]
permissive
diasurgical/scalpel
0f73ad9be0750ce08eb747edc27aeff7931800cd
8c631dff3236a70e6952b1f564d0dca8d2f4730f
refs/heads/master
2021-06-10T18:07:03.533074
2020-04-16T04:08:35
2020-04-16T04:08:35
138,939,330
15
7
Unlicense
2019-08-27T08:45:36
2018-06-27T22:30:04
C
UTF-8
C++
false
false
23,030
cpp
player.cpp
// C:\diabpsx\SOURCE\PLAYER.CPP #include "types.h" // address: 0x80058D74 // line start: 270 // line end: 271 bool ismyplr__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x80058DB8 // line start: 275 // line end: 276 int plrind__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x80058DCC // line start: 412 // line end: 418 void InitPlayerGFX__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x80058DEC // line start: 528 // line end: 547 void FreePlayerGFX__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x80058DF4 // line start: 554 // line end: 565 void NewPlrAnim__FP12PlayerStructiii(struct PlayerStruct *ptrplr, int Peq, int numFrames, int Delay) { } // address: 0x80058E10 // line start: 574 // line end: 585 void ClearPlrPVars__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x80058E34 // line start: 591 // line end: 672 void SetPlrAnims__FP12PlayerStruct(struct PlayerStruct *ptrplr) { // register: 3 register int gn; // register: 5 register int pc; } // address: 0x80059070 // line start: 719 // line end: 836 void CreatePlayer__FP12PlayerStructc(struct PlayerStruct *ptrplr, char c) { // register: 2 register int i; // register: 3 register char vc; } // address: 0x8005948C // line start: 843 // line end: 849 int CalcStatDiff__FP12PlayerStruct(struct PlayerStruct *ptrplr) { // register: 6 register int c; // register: 3 register int d; } // address: 0x800594F4 // line start: 855 // line end: 891 void NextPlrLevel__FP12PlayerStruct(struct PlayerStruct *ptrplr) { // register: 5 register long l; } // address: 0x80059664 // line start: 898 // line end: 961 void AddPlrExperience__FP12PlayerStructil(struct PlayerStruct *ptrplr, int lvl, long exp) { // register: 19 register int omp; // register: 4294967295 register long v; // register: 6 register long e; { { // register: 4 register long lLevel; // register: 3 register long lMax; { { // register: 17 register int l; { { { // register: 16 register int i; } } } } } } } } // address: 0x80059870 // line start: 967 // line end: 974 void AddPlrMonstExper__Filc(int lvl, long exp, char pmask) { // register: 3 register int totplrs; { // register: 4 register int i; { { } } } } // address: 0x800598F4 // line start: 983 // line end: 1153 void InitPlayer__FP12PlayerStructUc(struct PlayerStruct *ptrplr, unsigned char FirstTime) { { { { { // register: 17 register int i; } } } } } // address: 0x80059CC0 // line start: 1163 // line end: 1169 void InitMultiView__Fv() { } // address: 0x80059CC8 // line start: 1270 // line end: 1294 bool CheckLeighSolid__Fii(int x, int y) { // address: 0xFFFFFFB0 // size: 0x50 auto struct bbssbb bodge[10]; { // register: 4 register int i; } } // address: 0x80059D60 // line start: 1298 // line end: 1303 unsigned char SolidLoc__Fii(int x, int y) { } // address: 0x80059DE8 // line start: 1357 // line end: 1366 void PlrClrTrans__Fii(int x, int y) { // register: 3 register int i; // register: 7 register int j; } // address: 0x80059E7C // line start: 1373 // line end: 1386 void PlrDoTrans__Fii(int x, int y) { // register: 3 register int i; // register: 7 register int j; } // address: 0x80059F70 // line start: 1392 // line end: 1396 void SetPlayerOld__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x80059F84 // line start: 1431 // line end: 1452 void StartStand__FP12PlayerStructi(struct PlayerStruct *ptrplr, int dir) { } // address: 0x8005A010 // line start: 1457 // line end: 1476 void StartWalkStand__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x8005A074 // line start: 1484 // line end: 1542 void PM_ChangeLightOff__FP12PlayerStruct(struct PlayerStruct *ptrplr) { // register: 4 register int lx; // register: 2 register int ly; // address: 0x800DEF30 // size: 0x9 static unsigned char fix[9]; } // address: 0x8005A0B0 // line start: 1550 // line end: 1572 void PM_ChangeOffset__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x8005A0DC // line start: 1669 // line end: 1701 void StartAttack__FP12PlayerStructi(struct PlayerStruct *ptrplr, int d) { // register: 17 register int co; // register: 18 register unsigned char closeattack; } // address: 0x8005A214 // line start: 1727 // line end: 1742 void StartPlrBlock__FP12PlayerStructi(struct PlayerStruct *ptrplr, int dir) { } // address: 0x8005A2AC // line start: 1748 // line end: 1789 void StartSpell__FP12PlayerStructiii(struct PlayerStruct *ptrplr, int d, int cx, int cy) { } // address: 0x8005A448 // line start: 1822 // line end: 1838 void RemovePlrFromMap__FP12PlayerStruct(struct PlayerStruct *ptrplr) { // register: 13 register int pp; // register: 4 register int pn; // register: 5 register int x; // register: 10 register int y; } // address: 0x8005A568 // line start: 1845 // line end: 1878 void StartPlrHit__FP12PlayerStructiUc(struct PlayerStruct *ptrplr, int dam, unsigned char forcehit) { } // address: 0x8005A688 // line start: 1885 // line end: 1914 void RespawnDeadItem__FP10ItemStructii(struct ItemStruct *itm, int x, int y) { // register: 8 register int ii; } // address: 0x8005A824 // line start: 1920 // line end: 1957 void PlrDeadItem__FP12PlayerStructP10ItemStructii(struct PlayerStruct *ptrplr, struct ItemStruct *itm, int xx, int yy) { // register: 19 register int x; // register: 20 register int y; { // register: 17 register int l; { { // register: 18 register int j; { { // register: 16 register int i; } } } } } } // address: 0x8005A9EC // line start: 1962 // line end: 2086 void StartPlayerKill__FP12PlayerStructi(struct PlayerStruct *ptrplr, int earflag) { // register: 18 // size: 0x98 register struct ItemStruct *pi; // address: 0xFFFFFF50 // size: 0x98 auto struct ItemStruct ear; // register: 16 register int i; // register: 19 // size: 0x23A8 register struct PlayerStruct *p; // register: 20 register unsigned char diablolevel; { { { { { // register: 2 register int pdd; } } } } } } // address: 0x8005AD04 // line start: 2091 // line end: 2257 void DropHalfPlayersGold__FP12PlayerStruct(struct PlayerStruct *ptrplr) { // register: 17 register int i; // register: 18 register long hGold; } // address: 0x8005B14C // line start: 2264 // line end: 2286 void StartPlrKill__FP12PlayerStructi(struct PlayerStruct *ptrplr, int earflag) { // register: 5 register int i; // register: 4 register int mx; } // address: 0x8005B290 // line start: 2292 // line end: 2294 void SyncPlrKill__FP12PlayerStructi(struct PlayerStruct *ptrplr, int earflag) { } // address: 0x8005B2B0 // line start: 2300 // line end: 2325 void RemovePlrMissiles__FP12PlayerStruct(struct PlayerStruct *ptrplr) { // register: 17 register int i; // register: 16 register int mx; { { } } } // address: 0x8005B598 // line start: 2331 // line end: 2351 void InitLevelChange__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x8005B654 // line start: 2358 // line end: 2412 void StartNewLvl__FP12PlayerStructii(struct PlayerStruct *ptrplr, int fom, int lvl) { } // address: 0x8005B798 // line start: 2417 // line end: 2435 void RestartTownLvl__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x8005B828 // line start: 2443 // line end: 2459 void StartWarpLvl__FP12PlayerStructi(struct PlayerStruct *ptrplr, int pidx) { } // address: 0x8005B8E4 // line start: 2467 // line end: 2468 int PM_DoStand__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x8005B8EC // line start: 2496 // line end: 2513 unsigned char ChkPlrOffsets__Fiiii(int wx1, int wy1, int wx2, int wy2) { // register: 17 register int x; // register: 16 register int y; } // address: 0x8005B974 // line start: 2517 // line end: 2634 int PM_DoWalk__FP12PlayerStruct(struct PlayerStruct *ptrplr) { // register: 18 register int owx; // register: 19 register int owy; } // address: 0x8005BCE0 // line start: 2641 // line end: 2690 unsigned char WeaponDur__FP12PlayerStructi(struct PlayerStruct *ptrplr, int durrnd) { } // address: 0x8005BE80 // line start: 2697 // line end: 2811 unsigned char PlrHitMonst__FP12PlayerStructi(struct PlayerStruct *ptrplr, int m) { // register: 18 register int hit; // register: 16 register int hper; // register: 16 register int mind; // register: 5 register int maxd; // register: 16 register int ddp; // register: 18 register long dam; // register: 20 register long skdam; // register: 4 register int phanditype; // register: 3 register int tmac; // register: 21 register unsigned char rv; // address: 0xFFFFFFD8 auto unsigned char ret; } // address: 0x8005C4B0 // line start: 2818 // line end: 2881 unsigned char PlrHitPlr__FP12PlayerStructc(struct PlayerStruct *ptrplr, char p) { // register: 20 register int hit; // register: 16 register int hper; // register: 16 register int mind; // register: 5 register int maxd; // register: 16 register int ddp; // register: 17 register long dam; // register: 4 register long skdam; // register: 4 register int tac; // register: 7 register int blk; // register: 3 register int blkper; // register: 21 register unsigned char rv; } // address: 0x8005C860 // line start: 2888 // line end: 2895 unsigned char PlrHitObj__FP12PlayerStructii(struct PlayerStruct *ptrplr, int mx, int my) { // register: 5 register int oi; } // address: 0x8005C8F0 // line start: 2903 // line end: 2974 int PM_DoAttack__FP12PlayerStruct(struct PlayerStruct *ptrplr) { // register: 17 register int dx; // register: 18 register int dy; // register: 5 register int m; // register: 5 register char p; // register: 19 register unsigned char didhit; // register: 4 register int frame; } // address: 0x8005CC7C // line start: 2982 // line end: 3003 int PM_DoRangeAttack__FP12PlayerStruct(struct PlayerStruct *ptrplr) { // register: 8 register int mistype; } // address: 0x8005CD7C // line start: 3011 // line end: 3036 void ShieldDur__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x8005CE3C // line start: 3042 // line end: 3054 int PM_DoBlock__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x8005CEDC // line start: 3058 // line end: 3222 void do_spell_anim__FiiiP12PlayerStruct(int aframe, int spell, int clss, struct PlayerStruct *ptrplr) { // register: 16 // size: 0x84 register struct CPlayer *test; // register: 30 register int OtPos; // register: 23 register int ScrX; // register: 18 register int ScrY; // register: 20 // size: 0x6C register struct TextDat *missdat; // register: 16 // size: 0x6C register struct TextDat *objdat; // register: 21 register int otad; // address: 0xFFFFFF88 // size: 0x28 auto struct POLY_FT4 *FT4a; // address: 0xFFFFFF8C // size: 0x28 auto struct POLY_FT4 *FT4b; // address: 0xFFFFFF90 // size: 0x28 auto struct POLY_FT4 *FT4c; // register: 19 register int frame; // register: 2 register unsigned int rnd; // register: 18 register unsigned int rot; } // address: 0x8005DEA0 // line start: 3229 // line end: 3290 int PM_DoSpell__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x8005E210 // line start: 3296 // line end: 3321 void ArmorDur__FP12PlayerStruct(struct PlayerStruct *ptrplr) { // register: 18 // size: 0x23A8 register struct PlayerStruct *p; // register: 4 register int a; // register: 17 // size: 0x98 register struct ItemStruct *pi; } // address: 0x8005E30C // line start: 3326 // line end: 3342 int PM_DoGotHit__FP12PlayerStruct(struct PlayerStruct *ptrplr) { // register: 2 register int rv; } // address: 0x8005E388 // line start: 3349 // line end: 3374 int PM_DoDeath__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x8005E4C8 // line start: 3381 // line end: 3382 int PM_DoNewLvl__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x8005E4D0 // line start: 3389 // line end: 3696 void CheckNewPath__FP12PlayerStruct(struct PlayerStruct *ptrplr) { // register: 17 register int i; // register: 17 register int d; // register: 16 register int oi; } // address: 0x8005E910 // line start: 3708 // line end: 3716 unsigned char PlrDeathModeOK__Fi(int p) { } // address: 0x8005E978 // line start: 3723 // line end: 3761 void ValidatePlayer__Fv() { // register: 5 register int i; // register: 7 register int gt; // register: 2 register int pc; // register: 10 register unsigned long msk; // register: 14 register unsigned long b; } // address: 0x8005EE54 // line start: 3808 // line end: 3825 void CheckCheatStats__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x8005EEF0 // line start: 3834 // line end: 3955 void ProcessPlayers__Fv() { // register: 16 register int raflag; // register: 18 register int pnum; // register: 20 register int tplayer; { { // register: 17 // size: 0x23A8 register struct PlayerStruct *ptrplr; } } } // address: 0x8005F224 // line start: 3961 // line end: 3964 void ClrPlrPath__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x8005F24C // line start: 3972 // line end: 3997 unsigned char PosOkPlayer__FP12PlayerStructii(struct PlayerStruct *ptrplr, int px, int py) { // register: 2 register int mi; // register: 16 register int p; // register: 2 register char bv; // register: 17 // size: 0xC register struct map_info *dm; } // address: 0x8005F3F4 // line start: 4004 // line end: 4056 void MakePlrPath__FP12PlayerStructiiUc(struct PlayerStruct *ptrplr, int xx, int yy, unsigned char endspace) { } // address: 0x8005F3FC // line start: 4062 // line end: 4155 void CheckPlrSpell__Fv() { // register: 16 register int sd; // register: 18 // size: 0x24 register struct Spell_Target *spl; // register: 7 register unsigned char addflag; // register: 17 // size: 0x23A8 register struct PlayerStruct *player; // register: 3 register int rspell; } // address: 0x8005F804 // line start: 4222 // line end: 4246 void SyncInitPlrPos__FP12PlayerStruct(struct PlayerStruct *ptrplr) { { { // register: 16 register int i; } } } // address: 0x8005F940 // line start: 4250 // line end: 4255 void SyncInitPlr__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x8005F970 // line start: 4272 // line end: 4306 void CheckStats__Fi(int p) { // register: 4 register int c; // register: 6 register int i; // register: 5 // size: 0x23A8 register struct PlayerStruct *player; } // address: 0x8005FB0C // line start: 4313 // line end: 4325 void ModifyPlrStr__Fii(int p, int l) { // register: 6 // size: 0x23A8 register struct PlayerStruct *player; // register: 3 register int ms; } // address: 0x8005FC28 // line start: 4333 // line end: 4350 void ModifyPlrMag__Fii(int p, int l) { // register: 6 // size: 0x23A8 register struct PlayerStruct *player; // register: 3 register int ms; } // address: 0x8005FD14 // line start: 4358 // line end: 4368 void ModifyPlrDex__Fii(int p, int l) { // register: 16 // size: 0x23A8 register struct PlayerStruct *player; // register: 3 register int ms; } // address: 0x8005FDF8 // line start: 4376 // line end: 4390 void ModifyPlrVit__Fii(int p, int l) { // register: 6 // size: 0x23A8 register struct PlayerStruct *player; // register: 3 register int ms; } // address: 0x8005FED4 // line start: 4398 // line end: 4403 void SetPlayerHitPoints__FP12PlayerStructi(struct PlayerStruct *ptrplr, int newhp) { } // address: 0x8005FF18 // line start: 4410 // line end: 4419 void SetPlrStr__Fii(int p, int v) { // register: 16 // size: 0x23A8 register struct PlayerStruct *player; } // address: 0x8005FFF4 // line start: 4426 // line end: 4435 void SetPlrMag__Fii(int p, int v) { // register: 6 // size: 0x23A8 register struct PlayerStruct *player; } // address: 0x80060064 // line start: 4442 // line end: 4451 void SetPlrDex__Fii(int p, int v) { // register: 16 // size: 0x23A8 register struct PlayerStruct *player; } // address: 0x80060140 // line start: 4458 // line end: 4467 void SetPlrVit__Fii(int p, int v) { // register: 3 // size: 0x23A8 register struct PlayerStruct *player; } // address: 0x800601AC // line start: 4474 // line end: 4477 void InitDungMsgs__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x800601B4 // line start: 4484 // line end: 4551 void PlayDungMsgs__Fv() { // register: 4 // size: 0x23A8 register struct PlayerStruct *player; } // address: 0x800604E4 // line start: 4554 // line end: 4554 void CreatePlrItems__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x8006050C // line start: 4555 // line end: 4555 void WorldToOffset__FP12PlayerStructii(struct PlayerStruct *ptrplr, int x, int y) { } // address: 0x80060550 // line start: 4556 // line end: 4556 void SetSpdbarGoldCurs__FP12PlayerStructi(struct PlayerStruct *ptrplr, int i) { } // address: 0x80060584 // line start: 4557 // line end: 4557 int GetSpellLevel__FP12PlayerStructi(struct PlayerStruct *ptrplr, int val) { } // address: 0x800605B8 // line start: 4558 // line end: 4558 void BreakObject__FP12PlayerStructi(struct PlayerStruct *ptrplr, int val) { } // address: 0x800605EC // line start: 4559 // line end: 4559 void CalcPlrInv__FP12PlayerStructUc(struct PlayerStruct *ptrplr, unsigned char bl) { } // address: 0x80060620 // line start: 4560 // line end: 4560 void RemoveSpdBarItem__FP12PlayerStructi(struct PlayerStruct *ptrplr, int val) { } // address: 0x80060654 // line start: 4561 // line end: 4561 void M_StartKill__FiP12PlayerStruct(int m, struct PlayerStruct *ptrplr) { } // address: 0x8006068C // line start: 4562 // line end: 4562 void SetGoldCurs__FP12PlayerStructi(struct PlayerStruct *ptrplr, int i) { } // address: 0x800606C0 // line start: 4563 // line end: 4563 void HealStart__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x800606E8 // line start: 4564 // line end: 4564 void HealotherStart__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x80060710 // line start: 4565 // line end: 4565 int CalculateGold__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x80060738 // line start: 4566 // line end: 4566 void M_StartHit__FiP12PlayerStructi(int m, struct PlayerStruct *ptrplr, int dam) { } // address: 0x80060780 // line start: 4567 // line end: 4567 void TeleStart__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x800607A8 // line start: 4568 // line end: 4568 void PhaseStart__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x800607D0 // line start: 4569 // line end: 4569 void RemoveInvItem__FP12PlayerStructi(struct PlayerStruct *ptrplr, int i) { } // address: 0x80060804 // line start: 4570 // line end: 4570 void InvisStart__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x8006082C // line start: 4571 // line end: 4571 void PhaseEnd__FP12PlayerStruct(struct PlayerStruct *ptrplr) { } // address: 0x80060854 // line start: 4572 // line end: 4572 void OperateObject__FP12PlayerStructiUc(struct PlayerStruct *ptrplr, int oi, unsigned char bl) { } // address: 0x80060898 // line start: 4573 // line end: 4573 void TryDisarm__FP12PlayerStructi(struct PlayerStruct *ptrplr, int oi) { } // address: 0x800608CC // line start: 4574 // line end: 4574 void TalkToTowner__FP12PlayerStructi(struct PlayerStruct *ptrplr, int val) { } // address: 0x80060900 // line start: 4576 // line end: 4576 unsigned char PosOkPlayer__Fiii(int pnum, int x, int y) { } // address: 0x8006094C // line start: 4577 // line end: 4577 int CalcStatDiff__Fi(int pnum) { } // address: 0x80060998 // line start: 4578 // line end: 4578 void StartNewLvl__Fiii(int pnum, int fom, int lvl) { } // address: 0x800609E4 // line start: 4579 // line end: 4579 void CreatePlayer__Fic(int pnum, char c) { } // address: 0x80060A38 // line start: 4580 // line end: 4580 void StartStand__Fii(int pnum, int dir) { } // address: 0x80060A84 // line start: 4581 // line end: 4581 void SetPlayerHitPoints__Fii(int pnum, int val) { } // address: 0x80060AD0 // line start: 4582 // line end: 4582 void MakePlrPath__FiiiUc(int pnum, int xx, int yy, unsigned char endspace) { } // address: 0x80060B20 // line start: 4583 // line end: 4583 void StartWarpLvl__Fii(int pnum, int pidx) { } // address: 0x80060B6C // line start: 4584 // line end: 4584 void SyncPlrKill__Fii(int pnum, int earflag) { } // address: 0x80060BB8 // line start: 4585 // line end: 4585 void StartPlrKill__Fii(int pnum, int val) { } // address: 0x80060C04 // line start: 4586 // line end: 4586 void NewPlrAnim__Fiiii(int pnum, int Peq, int numFrames, int Delay) { } // address: 0x80060C50 // line start: 4587 // line end: 4587 void AddPlrExperience__Fiil(int pnum, int lvl, long exp) { } // address: 0x80060C9C // line start: 4588 // line end: 4588 void StartPlrBlock__Fii(int pnum, int dir) { } // address: 0x80060CE8 // line start: 4589 // line end: 4589 void StartPlrHit__FiiUc(int pnum, int dam, unsigned char forcehit) { } // address: 0x80060D38 // line start: 4590 // line end: 4590 void StartSpell__Fiiii(int pnum, int d, int cx, int cy) { } // address: 0x80060D84 // line start: 4592 // line end: 4592 void InitPlayer__FiUc(int pnum, unsigned char FirstTime) { } // address: 0x80060DD4 // line start: 4594 // line end: 4594 void PM_ChangeLightOff__Fi(int pnum) { } // address: 0x80060E20 // line start: 4595 // line end: 4595 void CheckNewPath__Fi(int pnum) { } // address: 0x80060E6C // line start: 4596 // line end: 4596 void FreePlayerGFX__Fi(int pnum) { } // address: 0x80060EB8 // line start: 4597 // line end: 4597 void InitDungMsgs__Fi(int pnum) { } // address: 0x80060F04 // line start: 4598 // line end: 4598 void InitPlayerGFX__Fi(int pnum) { } // address: 0x80060F50 // line start: 4599 // line end: 4599 void SyncInitPlrPos__Fi(int pnum) { } // address: 0x80060F9C // line start: 4600 // line end: 4600 void SetPlrAnims__Fi(int pnum) { } // address: 0x80060FE8 // line start: 4601 // line end: 4601 void ClrPlrPath__Fi(int pnum) { } // address: 0x80061034 // line start: 4602 // line end: 4602 void SyncInitPlr__Fi(int pnum) { } // address: 0x80061080 // line start: 4603 // line end: 4603 void RestartTownLvl__Fi(int pnum) { } // address: 0x800610CC // line start: 4604 // line end: 4604 void SetPlayerOld__Fi(int pnum) { } // address: 0x80061118 // line start: 4612 // line end: 4613 void GetGoldSeed__FP12PlayerStructP10ItemStruct(struct PlayerStruct *ptrplr, struct ItemStruct *h) { }
4ee04ced8610ca5b9e9521dc02f8c3116dfb76f9
cd4cd3eb01eca103c32097734491243b699451e3
/Fall 2019/Week10/Contest 7 Solutions.cpp/F - Epic Game.cpp
7db1c10775da64848a8b41f5ecc390b9af68a8b2
[]
no_license
NazirNayal8/KU-Algorithms-Program
4fca38710320dec908b1e8ebcd72a9a5ada688a0
f4b88208467e2d225ed314d44e26b5d38c1ab316
refs/heads/master
2020-08-07T05:49:51.616000
2020-03-04T15:15:40
2020-03-04T15:15:40
213,322,275
1
1
null
2019-10-08T17:46:41
2019-10-07T07:39:10
C++
UTF-8
C++
false
false
395
cpp
F - Epic Game.cpp
#include <bits/stdc++.h> using namespace std; int main(){ int a , b , n , x = 0; cin >> a >> b >> n ; while ( n>0) { if ( x%2==0) { n-= __gcd(a,n); x++ ; } else if (x%2!=0) { n-= __gcd(b , n); x++; } } if ( x%2==0) cout << 1 << endl ; else cout << 0 << endl ; }
04c5489dfd7e9fc1c738aeb9e3dee345e2f88c95
b5174e41a674e67bad7dc8cbcd9b6ea9c048163f
/Pocket Integration/maincpp.cpp
2229175d4709cb477e35bd12285f275c9e153b0a
[]
no_license
frogi16/E-reader-Periodical
8f2d63ffeb66dacc5aeb5f6e95ead6e9fecf768b
75fda2b14994f2f84a8b4ffaa4e6d0a72f72a2ae
refs/heads/master
2021-12-12T01:48:38.443813
2021-11-08T18:35:27
2021-11-08T18:35:27
152,869,974
13
3
null
null
null
null
UTF-8
C++
false
false
246
cpp
maincpp.cpp
#include "Application.h" int main() { try { Application app; app.run(); } catch (const std::exception& e) { std::cout << std::endl << "Encountered critical error, application will be closed." << std::endl << e.what(); } return 0; }
218185a70f6d840c62239d04edfdf720aa9f0327
02bc1f1a87280995dd709d203678d18318d4dc05
/main.cpp
e200bcd332ecc98c0032477531cd34e624551469
[]
no_license
tectronics/sasltutor
a5236021f4365253266d7fcdddd2b994b84dcf98
2fde4c538f5378469ec251c412b2bead304424f9
refs/heads/master
2018-01-11T15:02:50.848349
2010-03-14T18:16:27
2010-03-14T18:16:27
45,293,921
0
0
null
null
null
null
UTF-8
C++
false
false
791
cpp
main.cpp
/* Things necesary to install before this program will work: * libcv-dev * libxine1-ffmpeg * libhighgui-dev */ #include <QtGui/QApplication> #include "mainwindow.h" #include <QtPlugin> //For static builds (phonon doesnt work in static) //Q_IMPORT_PLUGIN(qgif) //Q_IMPORT_PLUGIN(qjpeg) //Q_IMPORT_PLUGIN(qico) /* Main method * This is the driver class for the SSASL Tutor program. * It creates a new QApplication and proceeds to create an instance * of the mainwindow class, setting up the Ui_MainWindow in it as * it runs. */ int main(int argc, char *argv[]) { QApplication app(argc, argv); app.setOrganizationName("UCT Computer Science"); app.setApplicationName("SASL Tutor"); app.setQuitOnLastWindowClosed(true); new MainWindow(); return app.exec(); }
66c00a95064559b4de6f791fe2b73928d829437c
7adc1042dbfce22011b5c56b269a3e9f512f51e1
/loops/8.cpp
f89e0967c140988c821f1213b380e8624e238fda
[]
no_license
yogesh895/CPP-Programs
fca439cbd1843ccf4707587aef4e543f6dfe8721
b32e51bf1a8c37c1c07697dca464c0683caaaaef
refs/heads/master
2023-01-13T03:28:35.333058
2020-11-12T18:16:21
2020-11-12T18:16:21
null
0
0
null
null
null
null
UTF-8
C++
false
false
307
cpp
8.cpp
#include<iostream> using namespace std; int main() { int i,n,count=0; float avg,sum; cout<<"Enter Any Number "; cin>>n; while(n!=0) { sum=sum + n%10; n=n/10; count+=1; } cout<<"Sum is "<<sum<<endl; cout<<"Count is "<<count<<endl; avg= sum/count; cout<<"The average of digits is "<<avg; }
31d92b3a884bdf2901dd2f811cb5d3adc5ff5929
b851cba2e14ae32e1262d1f69bf51226c8e8686b
/src/Outlet.cpp
0426d81c3dbb2c304454857e1683fe6ed165d025
[ "MIT" ]
permissive
akshay1992/Lithe
cc3653fd481e7367652297652183fb66c5c25e8a
515d635f8f55b106a20fa9593c2b057026c6d018
refs/heads/master
2021-04-26T13:27:07.871167
2018-05-17T07:15:01
2018-05-17T07:15:01
63,910,966
0
0
null
null
null
null
UTF-8
C++
false
false
1,075
cpp
Outlet.cpp
#include "Lithe/Outlet.h" #include "Lithe/Inlet.h" #include "Lithe/Node.h" #include "Lithe/Sample.h" #include "Lithe/Patcher.h" #include <cassert> namespace lithe { Outlet::Outlet(Node* parent_node) : parent_node(parent_node) { } void Outlet::connect(Inlet& inlet) { assert(inlet.getConnectedOutlet() != this); Patcher::connect(inlet, *this); } void Outlet::disconnect(Inlet& inlet) { if( inlet.getConnectedOutlet() == this) Patcher::disconnect(inlet, *this); } void Outlet::disconnectAll(void) { for(Inlet* pInlet : connected_inlets) { disconnect(*pInlet); } } Node* Outlet::getParentNode(void) const { return parent_node; } bool Outlet::isConnected(void) { if( connected_inlets.size() != 0 ) return true; else return false; } std::vector<Inlet*> Outlet::getConnectedInlets(void) const { return connected_inlets; } Sample Outlet::getSample() { if( parent_node != nullptr ) if(! parent_node->isDoneProcessing() ) parent_node->Process(); return mSample; } void Outlet::setSample(Sample s) { mSample = s; } }; // namespace lithe
492aee251c10453192376903a6cca7a9aa23e589
6cf0bc246052a1c9202a75fe2cf51ec31d7b70eb
/adhoc_communication/src/RouteRequest.h
7e9ceb3c5421a823a95a2a72e98299d77d147bb8
[]
no_license
OSLL/multibot
ab0cd58e49c03b19b03610bbf108804765fe5d6d
0af5fa139170bb4fe49e8eedac9de73114ab95e2
refs/heads/master
2021-01-18T17:23:17.372972
2016-05-29T13:47:46
2016-05-29T13:47:46
37,917,309
6
4
null
2016-04-25T20:17:34
2015-06-23T12:22:24
C++
UTF-8
C++
false
false
1,263
h
RouteRequest.h
/* * RouteRequest.h * * Created on: 29.07.2013 * Author: Günther Cwioro * * */ #ifndef ROUTEREQUEST_H_ #define ROUTEREQUEST_H_ struct rreq_header { uint8_t frame_type; uint32_t id; uint32_t hop_count; uint32_t hop_limit; uint8_t flag_field; uint32_t hostname_source_len; uint32_t hostname_destination_len; } __attribute__((packed)); class RouteRequest : public EthernetFrame { public: RouteRequest(std::string my_hostname, std::string destination, uint16_t max_hops, bool is_multicast); RouteRequest(route_request req); RouteRequest(unsigned char *buffer); virtual ~RouteRequest(); struct rreq_header header_; std::string hostname_destination_; std::string hostname_source_; std::list<mac> path_l_; uint16_t buffer_str_len_; bool correct_crc_; bool mc_flag_; static uint32_t req_count_stat; static uint32_t HEADER_FIXED_LEN; using EthernetFrame::GetCrc32; std::string getRequestAsNetworkString(unsigned char source_mac[6]); bool isMacInPath(unsigned char mac[]); }; uint32_t RouteRequest::req_count_stat = 0; uint32_t RouteRequest::HEADER_FIXED_LEN = sizeof(eh_header) + sizeof(rreq_header); #endif /* ROUTEREQUEST_H_ */
bb254ed905de8df391ee15ec0edefdc6884b144a
9f520bcbde8a70e14d5870fd9a88c0989a8fcd61
/pitzDaily/884/alphak
2ada55cdf6b69215daecc404dab76bcc43e0a48d
[]
no_license
asAmrita/adjoinShapOptimization
6d47c89fb14d090941da706bd7c39004f515cfea
079cbec87529be37f81cca3ea8b28c50b9ceb8c5
refs/heads/master
2020-08-06T21:32:45.429939
2019-10-06T09:58:20
2019-10-06T09:58:20
213,144,901
1
0
null
null
null
null
UTF-8
C++
false
false
68,780
alphak
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v1806 | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "884"; object alphak; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 -1 0 0 0 0]; internalField nonuniform List<scalar> 6400 ( 0.909290297044 1.48068018728 2.36693300157 3.00177494315 3.6065904506 4.20404094468 4.92616879887 5.72887041945 6.27471984116 7.07015996354 8.39937319447 9.40599489163 10.2751689644 11.2266691748 12.3586656363 13.5537767404 14.6647721642 15.7164595045 16.6140592454 17.2103191008 17.6210963354 18.19689598 19.1262975352 20.3707858506 21.7109903079 22.9463143801 24.0189050328 25.0309553914 26.0762166682 27.169984804 28.2569274507 29.1611767424 29.8062496071 30.2992284789 30.6904443448 30.9983280526 31.4660801605 32.1139797082 32.4839946496 32.6582451276 33.1627238617 34.1090763871 35.0377287283 35.6018593123 35.8321329974 35.8230093327 35.6383659756 35.316911698 34.8714379904 34.3204140935 33.59346105 32.500032047 31.0112250825 29.2161562218 27.5037707597 25.8749563325 23.7757024454 21.0294518819 18.1648876842 15.6111228104 13.0351811286 10.3556497203 7.93932316607 7.32014376741 9.80503061162 14.0852313533 16.7363512996 16.1987372512 14.0148795378 12.2817912585 11.3704401736 11.6174368353 12.2546474888 12.2046074168 14.4128770872 13.9039823576 15.8832853348 9.77678644424 12.8509048977 4.79800737957 3.18065952012 2.57837005368 3.23376764761 4.5255212861 4.56454349399 4.6057431796 4.93197171479 5.47793894193 6.23389736069 7.18313063319 8.3082287997 9.43486645074 10.4494323563 11.4280195279 12.4342344715 13.5754519267 14.7797330717 15.9275470642 17.0531888014 17.4941437164 17.7434699341 18.3081842194 19.2282195068 20.4660723284 21.9045347898 23.0947307709 24.1432733897 25.1863400682 26.242947397 27.3096228839 28.3735482009 29.3481048731 29.9867114087 30.4714529738 30.8877501018 31.1330951827 31.6362339923 32.3090309287 32.6492443427 32.7220517402 33.2039230918 34.5318001981 35.6751433933 36.1637963343 36.3469958503 36.2849087224 36.03493359 35.6684649367 35.1072513801 34.4304585572 33.7517846948 33.0344152809 31.6839884813 29.4380847311 27.806108681 26.0179008526 23.5269835129 20.838038489 18.1409858316 15.451853747 12.8872442715 10.6166273795 8.29548356544 7.8178480063 10.1250392905 15.1431399553 18.515573295 17.0098613407 14.6605007838 12.615338891 11.8856094372 12.3510780868 13.5594259567 13.0244248318 12.9598018907 12.5144174755 11.393983718 9.61018306885 8.1167023959 4.19611722817 3.33450242622 2.97544095975 3.50685094394 3.88472543447 4.5450624165 5.0635283713 5.11084565427 5.36392479902 6.12637928523 7.1532383476 8.29066562931 9.43636741851 10.4926621656 11.4704389003 12.3328821135 13.3789704149 15.8972426641 17.9132333391 18.5253562037 18.2707769954 17.549818043 18.0299163609 19.3283002552 20.6113013525 21.8485084032 23.0890853626 24.2249297019 25.2699094603 26.3073852964 27.366741184 28.4040166123 29.4512569002 30.0798340586 30.3818150049 31.035936624 31.3020750217 31.574204109 32.3842361229 32.7809409045 32.9229665402 33.4194997816 34.3386190459 35.2376143235 35.8012459535 36.0564110863 36.0869713479 35.9353134758 35.620910659 35.1470598878 34.5321725011 33.7715630266 32.7528659434 31.3546717346 29.7836419635 28.1241035132 25.9626064217 23.4541267853 20.8152439986 18.1363612492 15.4957841016 12.9818775857 10.5678005681 8.83563030683 9.13747656964 12.4189831407 16.1864943485 17.9774427753 17.8281579508 16.0938412326 14.3453214514 13.6371247735 13.5563614865 12.9050710948 12.352459472 12.4168967792 12.1725896714 11.27559737 9.69581498322 7.25967066284 7.47653718681 3.45293157095 5.61419969689 3.92060774117 4.1093170468 4.85616067792 11.9884772179 10.4331462513 5.84662799588 6.07789157249 7.13678261829 8.30692261334 9.47484567886 10.5056891378 11.4794950399 13.1500417122 15.2140117003 16.9657403578 17.6407127656 17.0878961364 16.7991395664 17.3992037646 18.2542640509 19.329932841 20.6014493671 21.9178868732 23.1832555417 24.3415154957 25.3710715582 26.4192622127 27.4238130778 28.5521993257 29.446631828 30.2861072938 30.5630811621 30.69573021 31.359678332 31.7185286658 32.1014416525 32.6374797427 33.1292603908 33.7178945212 34.5079932537 35.2948980754 35.8544201801 36.1467738332 36.2121207768 36.0867161248 35.7917106319 35.3358329283 34.7239294506 33.9356636378 32.9055257461 31.5886012112 30.036489342 28.2182826454 26.016902476 23.5019043654 20.8518380817 18.1862305793 15.6009354093 13.2108235451 11.2474821726 10.3225548298 10.7377853253 12.4307810944 16.6886682721 19.6871418929 19.6074470905 17.7978899839 15.3470100407 13.6791939103 12.8619129748 13.0585295441 14.5611528171 14.5651265582 13.3035359748 13.2340095386 16.5952323475 12.9602377564 10.9474521038 5.88702522075 7.72431162029 4.81202838646 5.13547789189 6.84052016569 11.8905063652 8.5644430186 6.4144483285 6.6069819152 7.34880195408 8.43867709475 9.61610224457 11.0759292797 13.253388762 14.3662196293 14.9641636322 15.33216199 15.5848297259 16.0530000937 16.8330918252 17.5134253641 18.3117478184 19.4164404187 20.6875511055 22.0114175293 23.2989049019 24.4375224986 25.5600991455 26.5124734933 27.6435743709 28.5886631177 29.9008309752 30.2314653126 30.28759303 30.7464075585 31.0326505908 31.5561381619 32.1801605367 32.7909573426 33.3661969517 33.9871155397 34.7074497138 35.4172535154 35.9623818983 36.2798949848 36.3769293462 36.2785874192 36.0058398262 35.5693710573 34.9675682227 34.1772644733 33.1554103008 31.8715808319 30.3147451527 28.4273382898 26.1657446291 23.6317127998 20.9964505591 18.3994991485 15.9791192166 13.9311183402 12.5738288884 12.2255860223 12.2444116988 13.1200775144 16.5489609588 19.9184870286 20.9795064618 19.6489032271 16.7854686436 14.2149949405 13.8345776502 16.1332834094 17.0362829462 16.0360124659 15.1648449719 17.9027089337 20.9661148407 16.2169745973 15.3224042145 10.1567838591 9.35206152593 6.00274305043 6.4761586651 12.1844369882 11.6992648753 7.20564767956 7.06156996719 7.26234871905 7.70475278421 8.65705666354 11.1757725791 14.2493740008 14.8236068299 14.6981408509 14.1976368293 14.2970471735 15.0009066828 16.1063395338 16.7814594172 17.4284751431 18.3773582324 19.5418211143 20.8322802809 22.0963439989 23.3878232887 24.7135476902 25.6512783377 26.898229419 27.6937646327 29.1874325645 29.7355330678 30.6659522912 30.429829963 30.3292319157 30.845057518 31.5877942661 32.3217780693 32.9920050303 33.6176034553 34.2588972888 34.943214761 35.6033198834 36.1324174435 36.465067448 36.5886610193 36.5169027766 36.2690057096 35.8564308822 35.2749619642 34.5013897869 33.4992069419 32.2305352191 30.6526710834 28.7150268065 26.4285027046 23.9212918922 21.3697264157 18.9387833741 16.8122896851 15.2151220456 14.4207008286 14.4306472044 13.6899375948 15.1566499313 18.6973627051 21.4395955658 22.3825849318 21.2487955851 17.7680765334 15.459687363 17.1810819824 19.3618039977 18.8296339544 17.8578801277 17.9635903081 22.6399510354 24.2676056334 19.1921916773 18.9952900814 12.3086382504 9.34847682439 7.2874643934 6.83334979892 12.181959493 8.83961611052 7.54906750657 7.69952851704 7.87882348477 8.61651255166 9.21694741827 13.821341043 14.6520680362 14.8397897611 13.8569424905 13.3452958577 13.9581968612 15.3658510999 16.0304647199 16.5198108186 17.4279822326 18.4711041 19.639088883 20.9253407796 22.327419511 23.6706996935 24.7282815512 26.248841545 26.9908902365 28.5603826201 28.9941379709 30.1818121399 30.2589558896 30.2447225388 30.2236452285 30.8348339771 31.6891293614 32.4993726355 33.2160885809 33.8806286091 34.542714431 35.2131667673 35.8453010563 36.3625149293 36.7052692421 36.8510510957 36.8057733348 36.5867657833 36.2053516693 35.6555377062 34.9123141376 33.9362941873 32.6787914322 31.0881024809 29.1374632651 26.8827402181 24.4760906518 22.1009645364 19.9249578821 18.1161324822 16.8747737311 16.2655470997 15.8316300456 15.7434821011 17.2231483475 21.5743963918 23.1135326633 22.9542327121 21.6086253116 19.1831071589 18.7332842453 21.1372154881 21.4806930197 20.6210354807 20.0329517135 22.0734446552 24.9092482284 26.4395654954 21.7935472243 20.6458108837 12.0988267248 9.15517597927 8.48022794468 12.4340636712 12.3653395924 8.11042248985 8.24990386406 8.43728693648 8.53809051929 9.15857176202 13.5141889025 14.5060875757 14.7383381545 14.4581125201 12.885015675 13.0124760524 14.6025860798 15.4493214496 15.709108381 16.3896504018 17.4423143414 18.6035298736 19.8074523383 21.1378582338 22.4052696826 23.9381047123 24.7800409209 26.2572980797 27.9222253591 28.6951329642 28.7510808169 29.7589205777 30.274741843 29.8828988446 30.241243431 30.9860121534 31.8510710876 32.6926574992 33.4545209096 34.1590660387 34.8455150939 35.5181184553 36.1392639455 36.6508733187 37.0021710953 37.1681242124 37.1508470004 36.9662140416 36.6245790142 36.1177528383 35.4172346573 34.4776548704 33.2438516493 31.6713721507 29.7669229741 27.6249329331 25.4068567556 23.2655258118 21.3120574821 19.6876897993 18.584074162 18.0132045708 17.8135731136 18.036133041 18.0322920168 22.3691621931 25.2737551718 24.7225502862 23.7691998295 22.5526389149 23.0651840944 24.1800489027 23.3529631382 22.6079522449 22.8100864558 25.2447401223 26.006407735 26.6759068206 23.7792959587 21.6224668227 11.4786548621 9.20834295812 9.17126862783 13.454890536 11.5131824059 8.84589642872 9.01331125423 9.3345687136 10.3946046104 9.32421377114 14.2794398759 15.0632180673 14.8052819268 13.4007220967 12.6341458705 13.1366746543 14.6418269606 15.2018302922 15.6018131515 16.387564545 17.4246051286 18.6436295683 19.9331892017 21.6062436762 23.0334137041 23.9028523075 25.8334742021 26.1939222583 28.0408071616 28.3194633336 29.578879858 29.2647482696 29.4311767216 29.8280909527 30.4155016747 31.1890064616 32.0466829298 32.9042809693 33.7078851177 34.4567720765 35.1736558411 35.8593591292 36.4827399384 36.996477188 37.3576977639 37.5444418041 37.5588670779 37.4155274781 37.1230040198 36.671060304 36.0278143972 35.1433967325 33.9638510134 32.4642707037 30.6880122729 28.7519806811 26.783105266 24.8315183992 22.9412603778 21.3701612066 20.4468602231 20.1948391012 20.2928795062 20.3532375185 20.1575280418 20.7477018626 25.955256515 27.046337834 26.5182310814 26.6562244801 27.2559091019 26.5598239761 25.3189195892 24.9921195582 25.9900179818 27.303480034 27.281477304 26.7740282191 25.8050903495 24.4542457914 11.0819618382 9.74657318342 10.3187577718 13.5709110702 9.82945543261 9.87873182791 9.78158659079 10.0748977124 12.9146212133 11.7632451189 15.1123285863 15.3702785561 14.9303050531 12.8626648337 12.7081537056 14.2415606836 14.8361339976 14.9804332307 15.5536083961 16.5012086931 17.5269154899 18.6901535142 19.8395055376 21.7093798546 23.8690853708 23.8461120632 25.7602143374 27.2528241705 28.2313536835 29.1587261274 29.0583151547 29.4108191981 29.2096931932 29.7645717973 30.5802398524 31.414345119 32.2707259821 33.1371095376 33.9766359485 34.7736758536 35.5304327306 36.2398507128 36.8755642193 37.3991502014 37.7749595733 37.9858567602 38.0371743305 37.9433196313 37.7104198173 37.3267091212 36.7596653267 35.9600932856 34.8843981063 33.5356722584 31.9875202395 30.3397509254 28.5994162316 26.6564852903 24.6896750643 23.3402891096 22.9398437521 23.1596183183 23.3896150967 23.2484775557 22.7050320128 21.2461701156 20.3743145062 29.1405138646 31.3679815261 31.7142960036 30.95607776 29.0250820796 27.7134097161 27.7615273958 28.9167738271 29.4034185834 29.3837939555 29.28865092 29.7565924006 30.0163559031 11.2041953185 10.6648742935 13.6057970059 13.8444477632 10.088485225 10.6780856392 10.5504442308 10.9775069581 12.5753023674 15.112168821 16.0016516926 15.7027460593 15.2465204043 12.9900871513 12.8808134443 14.7024307 14.9563190623 14.9680732443 15.5577819787 16.5972662966 17.8229232301 19.0169288618 19.971924812 21.3273572045 23.9948829436 25.3649952911 25.4716661667 27.3187179161 27.3720737143 29.1439745657 29.8271374108 29.3940139876 29.2029905536 29.8675772946 30.7689466269 31.6479414407 32.5179293881 33.3955211203 34.2635596264 35.1087979711 35.9158243279 36.6611105566 37.3190787402 37.8602866531 38.2572734023 38.4992110095 38.5951422478 38.5594781994 38.3969408514 38.0966215527 37.6299539621 36.9565023876 36.0535582219 34.9555005658 33.7398969467 32.405585699 30.7420355255 28.631112214 26.775514898 26.1515207016 26.6684604884 27.3373460606 27.5862353043 27.1999625735 26.1761488531 24.3044419218 21.7634029531 21.5249880883 33.1027250885 37.5237105974 35.5369003824 32.3482866963 30.8350380256 30.86444854 31.5566334911 32.1458789926 32.9353553572 33.8475627726 34.6500047774 35.4363641197 11.6784409421 11.5947801654 15.2827189955 14.6660132228 12.9313198469 11.943470052 11.5533989956 12.4115818771 12.1947927424 16.0910611743 16.7222286567 16.1190101534 15.4455981503 13.6998249018 13.6321762368 15.1321195889 15.0108284371 15.0619681808 15.650894124 16.6084790518 17.9207623682 19.4400056266 21.1833604962 21.3955063824 23.4902418218 25.674100871 25.3933292257 27.4944196454 28.6414177129 28.5163752665 29.1187525523 28.9816280067 29.4579565006 30.1614643538 31.0107895727 31.9008454591 32.7908592456 33.6859933995 34.5754549085 35.4602036605 36.3254378091 37.124254454 37.8162361237 38.3822825755 38.808924563 39.0922678434 39.243209051 39.2752044587 39.1933481617 38.9918129764 38.6529449003 38.1575496569 37.5156448059 36.7807004206 35.9652458425 34.8455604282 33.120256189 31.0641548951 29.7082711482 30.5294995784 32.8911475175 33.8034973913 34.0354063473 33.5112431276 32.2611909254 29.9496204595 26.5179971595 21.7165134204 28.5848550884 38.6904746825 40.7845057087 36.9710658527 35.1860058587 34.7936338224 34.9903047308 35.6676423628 37.5871465336 39.0983070118 39.3142444444 39.7055099573 12.3558742642 12.2893867982 15.1037885002 15.2364693204 15.2928222579 13.1561023861 12.6819512032 15.1584840897 12.6753599126 16.9594449583 17.2733961228 16.5410024964 15.6333695115 14.3822273309 15.9994376485 16.1560247703 15.2524186698 15.2954003041 15.8798377124 16.7123337726 17.8435481331 19.4133225459 22.3116904891 23.3331228456 23.0151374145 25.6686221249 26.836886784 27.0829245371 28.5667728851 29.3297693755 29.3712571188 29.0216005737 29.6417095564 30.4629867437 31.3055206944 32.1867009489 33.0837231089 34.0066011894 34.9317086063 35.845269155 36.7564330844 37.6192675219 38.3659057687 38.9697158262 39.4356898473 39.7734450271 39.9930169265 40.1029597411 40.1098638023 40.0190439131 39.8353613718 39.578242676 39.2966788267 39.0174051144 38.5624257746 37.4988220563 36.2474966582 35.3210597365 33.9885912469 36.5026763477 36.1728823497 34.5781853162 32.1986775478 29.5012000202 25.5176618752 20.7629917643 17.2364307846 6.20522472606 1.11207243961 28.6799061462 37.4798235498 36.5892074507 32.2216377495 31.8449747262 33.5219814206 36.6549014107 41.8833658404 44.542675425 44.8921568134 45.2536857039 13.0830308967 13.033103215 12.6837487534 15.6160268394 15.8885270558 14.0027021438 13.6874065109 16.2036921413 13.4100181394 17.869711687 17.7774139733 16.9748152148 15.9138531555 14.7477865297 17.1291431829 16.8103370059 15.7563301888 15.7135980335 16.2222328068 16.9865083075 17.8860782115 19.254239523 22.7388428647 24.370010715 23.3223897412 25.6026773418 27.2856821284 26.6941123647 28.1505516809 28.9548488233 28.7222399748 29.329906264 30.0423192735 30.8142492713 31.6316813538 32.5188548185 33.4241563686 34.3451650106 35.3088277572 36.2777119179 37.2318928874 38.1483712203 38.9589857478 39.6201101465 40.1430436645 40.5528551708 40.857428812 41.0543887772 41.1538433596 41.1795083876 41.1712835787 41.2143233863 41.3851812788 41.5788241587 41.2538250978 40.4251190365 40.872298633 33.8437814892 26.624804186 12.2353218988 1.92798920743e-08 3.91531179534e-12 1.35607675773e-14 1.38357511893e-15 1.09794878458e-16 3.09270020685e-17 3.64034084409e-16 3.71952942579e-15 4.20160126067e-14 1.09741946167e-13 1.82235055136e-10 4.78358102165e-08 4.36509326237e-05 0.0226105466319 23.2569811327 41.3248396802 43.384078474 48.4722046517 51.6470138111 51.9844423935 13.9855239392 14.0861794967 16.2689828648 16.3170450282 16.4028109804 14.7249017718 14.7540268539 17.1171562637 14.4665005203 18.6748006951 18.2673097172 17.4338631035 16.2736321479 15.170851449 17.4453677673 17.0947824217 16.2489588774 16.1953384389 16.6140190426 17.2943373538 18.1066631789 19.2079740771 22.2048962254 25.13882215 25.4153881778 25.0282685444 27.4379056975 28.4953797819 27.2865578399 27.7547823714 28.6433149321 29.5349719789 30.3747801671 31.1807653856 32.0097118681 32.8807414182 33.7979598591 34.7450830486 35.7159647004 36.7338555848 37.7543912887 38.7281008 39.598498712 40.3268943204 40.9303222222 41.4378296404 41.8487053248 42.1460272359 42.3334365223 42.459131115 42.6387997038 43.0372337498 43.7019609158 44.1850454762 43.4473643135 41.2022310574 26.82079071 4.59861651731e-18 5.05800129191e-21 9.4819442597e-23 1.60725453045e-24 4.65018613619e-27 1.32148139209e-29 2.28745927753e-34 1.78925743362e-34 4.34390560182e-34 2.92813581843e-33 1.37152246937e-32 5.06641084805e-32 3.2196249185e-31 2.52089443939e-31 2.18701298466e-29 1.24477581561e-26 1.25126530769e-24 9.49498997793e-23 2.18646675465e-20 3.68051157829e-16 42.4062623785 55.9227423165 52.5437988579 14.8360093553 15.031383776 17.904526407 17.0584684046 16.6202627167 15.4402189614 15.7790713003 17.9104518373 17.892548895 19.6798738989 18.829539189 17.9897924393 16.7227293508 15.7295940611 17.7798403485 17.3024521232 16.7044912816 16.6777494945 17.016494015 17.6061549485 18.3705128558 19.3883100368 21.7188707739 25.3529128892 26.7029929633 24.8346360685 26.8825871703 28.5655791177 28.7538278662 28.0852715787 28.6706537069 29.7101397568 30.696025265 31.5794722843 32.3906747446 33.2724140119 34.1970857928 35.173567853 36.1776264537 37.227464987 38.3132372158 39.3619748107 40.2924992721 41.0814507176 41.7822673033 42.4413079474 43.0094033517 43.4059476966 43.6262317391 43.8268805531 44.2253832284 45.0030561344 46.1495398974 46.3888936674 37.9529639187 14.9202255995 2.54299203896e-24 1.0297890549e-26 2.9779832464e-28 4.33539771847e-30 3.52241903059e-33 5.8774937114e-36 4.14307229092e-37 0 0 0 0 0 0 0 0 5.76230701744e-41 1.94350686353e-38 2.90707201206e-36 1.686590085e-33 2.35575243106e-30 1.27570014988e-25 1.93730467973e-21 1.51039693384e-14 61.6492972467 15.5257585783 15.7427734407 19.9966630172 17.6408456713 16.6004894556 16.0638556369 16.5189205123 18.0533922408 19.4650065571 20.8196222493 19.542796335 18.679993835 17.4183380548 16.566702789 18.3182970605 17.6538580399 17.2271506352 17.1997344488 17.4540263279 17.9528458223 18.6389617573 19.5791749919 21.4996890125 25.1867601956 27.6423243016 27.0740174327 26.3566978464 27.8918411834 28.5603428518 28.181570181 29.0531271534 30.1051988406 31.1381803193 32.0231911909 32.8616573003 33.7027633406 34.6435811527 35.6334565515 36.6778136838 37.7701896795 38.906558581 40.0354627241 41.0603557254 41.9144167867 42.7149918373 43.5564640476 44.3204097355 44.8139684708 45.0490845749 45.306618029 45.917895535 47.0909117416 48.365770406 36.786995082 0.362863718963 3.68166952784e-27 1.20742730216e-30 4.8823373371e-32 6.6569199846e-34 1.82550837566e-36 0 0 0 0 0 0 0 0 0 0 0 0 0 7.42473193378e-40 7.3780858809e-39 1.61743628522e-37 7.84272488746e-36 4.35524509159e-32 3.62514751536e-23 6.98805698238e-28 16.0523476402 16.261628812 21.999671848 18.0826885033 16.791864159 16.6274191988 17.3080088348 17.5425680363 20.3891843303 21.6313621 20.2225841253 19.3785657958 18.2974972873 18.3590021253 19.0739764482 18.2432049445 17.9393265228 17.9081804295 17.9969099914 18.3825412781 18.9574009314 19.8122160723 21.4544425937 24.9847189641 28.0028236368 28.6493033092 26.3264861002 26.9467059776 27.5080917038 28.235155656 29.3135100473 30.5232591338 31.5757873491 32.5132501556 33.3821992422 34.2764858094 35.1544301425 36.1534192009 37.2212931636 38.3429445478 39.5588071292 40.7822947644 41.8935045878 42.772118101 43.622352272 44.9513088312 46.5289483359 47.2364331096 46.9002174213 47.0255720113 47.7622335673 49.0967200321 36.1512158258 1.9482736662e-21 2.93630362878e-26 1.31727197486e-37 1.33111964926e-34 2.17202043407e-36 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.14709780613e-38 7.76795687738e-38 1.43247565158e-35 96.372401192 16.4891751088 16.6653201887 21.8644580508 17.6072000463 17.0276754538 17.1046768033 18.1942687224 17.606237608 21.1759049951 22.3746542156 20.854751104 20.015210358 18.9801916288 20.466182858 20.1036236668 19.0280405797 18.7564559733 18.942649208 18.757427336 18.9781049098 19.3719794288 20.0925682495 21.5436480459 24.7700242839 27.8218661854 29.6858161293 28.7084626875 28.0681202043 28.1963570304 28.3908856601 29.5273470257 31.0343917111 31.9958740317 33.0162272624 34.0856182027 34.8661268716 35.7499543623 36.7655310507 37.8649158867 39.012680835 40.2287331715 41.5302144581 42.784811928 43.9635992675 45.2273761259 46.8885081608 48.3873044951 48.9108803967 49.1900818308 49.4806302121 49.9254212781 39.6487860051 8.85998843368e-21 8.08740016092e-26 1.06294517589e-29 1.44368328556e-31 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3.52960145733e-38 2.56903320496e-27 16.9718432577 17.1235335932 21.5271695787 17.3278272231 17.3204656978 17.4855535063 18.9528218443 18.0839205729 21.871201213 23.0997734456 21.4701143936 20.6341272789 19.5369524085 21.2308871199 21.0455939686 19.8634527024 19.5533574807 19.8308495523 19.6618951563 19.7859886853 19.9762235999 20.4328402452 21.7906118111 24.6889308192 27.4793524099 29.9266583623 29.8346489057 28.6586550436 27.8338953366 28.7980696843 29.9187648951 31.400630642 32.6906964388 33.8581593128 34.87460215 35.5694461844 36.4292582496 37.4603140044 38.5896340011 39.7861263112 41.034437544 42.4266647764 43.9528710508 45.5934693188 46.8806405417 47.8710642177 49.1805238086 50.4039839105 52.2131869261 53.3787208283 44.1055311438 8.07317243188e-20 1.07196317484e-25 1.84854553567e-29 3.79146208896e-32 9.17985904553e-34 3.08136708125e-36 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5.93161395969e-39 7.84806704996e-39 17.6804312763 17.8314108964 21.2370665807 17.6115428001 17.8526608285 17.953369998 18.9951625771 18.7853855816 22.3835877917 23.7856080342 22.1066603694 21.2865744368 20.1901177562 21.9092685168 21.8760098247 20.7595079066 20.3862856736 20.6823086484 20.5406493517 20.7296090803 20.8332271452 20.9243350043 22.2292211952 24.8129791295 27.2802327723 29.9305996803 30.3497677205 29.460288431 28.3429104502 28.9614201376 30.3918663848 31.5607786867 32.7616605307 34.1142218566 35.7296603879 36.5609456204 37.3460502601 38.2674667168 39.3705993106 40.6437456808 42.0052005776 43.53055151 45.5510613838 47.3472010133 48.1122387747 49.0236710139 50.8997935821 54.3867745545 59.8482898027 48.5128583081 2.30653050673e-20 3.8315521438e-27 1.58558587656e-31 5.19861572002e-35 3.2618525699e-37 6.61151081778e-37 1.01528135189e-37 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4.38422995958e-40 1.99074999908e-39 18.7565465884 18.8714565801 21.547251925 18.5119078472 18.9584372041 18.7767159152 19.3216887793 20.0399483872 22.4782309761 24.3064164669 22.7930563401 21.9959481982 20.9363824863 22.6810741724 22.7263103189 21.7983022936 21.3792644822 21.6615308013 21.4226208935 21.7583262243 21.9773637739 21.621066491 22.7528756451 25.1490718169 27.285074638 29.7384173972 30.548546071 30.1344566537 30.1537063173 29.7435525083 30.6871588472 32.1712306017 33.8997203773 34.6669833549 36.0333814839 37.5271281953 38.3884797469 39.3579045904 40.3802798949 41.5897174085 43.0837000759 45.1900290316 47.7061393196 48.9056601045 49.2938627471 50.7899925433 54.9629217345 61.418050683 54.9311709773 31.2868017032 5.80500832447e-29 5.41976679809e-34 3.70838310686e-36 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 20.2653173431 20.1631082974 22.3633662574 20.3147013773 20.8262653819 19.9908027545 20.238205311 21.8514455821 22.7179882091 24.9182993466 23.5790516268 22.7717113754 21.7502082872 23.4857053244 23.5696742118 22.9363792044 22.8148044965 22.9365545963 22.3949342534 22.8678478483 23.3962064854 22.6008311589 23.1649224488 25.5775459101 27.5017176898 29.5744984193 30.6481291937 30.2810646445 31.2848783268 31.2447976228 31.6283134198 31.9246088423 33.6979269784 35.7352163269 36.9375892172 38.2771646627 39.4294032482 40.4486753151 41.5886615636 42.8229684607 44.6410978197 47.5773790613 49.8396494239 50.60525997 51.5112582436 54.8402183766 61.8311771759 58.0666883313 33.7359746679 5.18048999841e-31 9.0565899445e-34 4.1468970611e-36 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 21.8537356377 21.3659800872 23.2286560242 22.7006619556 22.463282874 21.3777456386 21.228018526 22.9336843337 22.0364888397 25.3924941186 24.4469031879 23.6045128178 22.619159196 24.2914278571 24.345921446 23.8812983813 24.7607782453 24.4582462833 23.470574507 24.0684147376 24.662938702 23.8370706913 23.3262767155 25.5278850279 27.6232989929 29.4327816705 30.6379321781 30.2947382203 31.6329687542 32.4641109919 32.971791862 32.6382668373 33.7946078016 35.6687085524 37.7837931961 39.4418429803 40.6917207702 41.7009772894 42.8339917797 44.3910924414 47.1460293767 50.2844658148 52.1554457032 53.3046453461 55.6659877892 60.4783779535 58.8320117209 32.8522127611 1.39489180771e-30 2.01940018722e-33 7.0723290319e-36 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 22.6114849296 22.1744666295 23.7531681648 23.6887944328 23.4572262203 22.6630226771 22.3358007342 24.2261099207 23.0249379011 25.9927918204 25.320586282 24.4666507052 23.5367462768 25.1093695054 25.1101453666 24.6509204283 25.6823833445 25.5124606221 24.474318676 25.2099994323 25.3481068991 24.5883720012 24.2119125856 24.4288171862 26.9949673543 28.8030387515 30.3032067731 30.1366985798 31.6021308987 32.9391136373 34.0612790155 34.3111019998 34.1700716084 35.6597486859 37.95117437 40.2639189323 42.0652069639 43.3331314785 44.456596619 46.8272174391 50.2642550338 53.1315260451 54.8288395249 56.7934629592 60.5495387524 57.2634654969 33.8722915917 22.9708670834 6.63800687707e-33 1.89053872418e-35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 22.6306420457 22.6301874574 24.0283978791 23.8404062439 24.0451739044 23.6292245229 23.2767685591 25.4923110305 24.6061335854 26.7423189255 26.2351742894 25.3412302527 24.4976064171 25.9546472032 25.9223503007 25.5242583123 26.4294113935 26.4034729995 25.4898648805 26.1486639812 25.2198236113 25.2512929711 25.1281739917 25.3594339442 26.1313319127 27.2328635567 29.2605626583 29.6985427975 31.0561361711 32.8326168265 34.4034850823 35.5670641809 35.5907143609 36.3639259797 38.1075180317 40.4366235893 42.9621272558 45.032559028 46.77223956 49.9797971534 53.4757735098 55.9319847309 57.4031879173 59.3967799795 55.1826626846 36.9563015921 39.3225216571 2.3057486711e-32 5.16509271626e-35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 22.7727164151 22.9039844402 24.2275984367 22.9206930899 24.2418297195 24.113507089 23.8656908031 26.0324237303 25.3686703743 27.4722477463 27.1567171483 26.1932445448 25.5064250182 26.8144683818 26.7598373446 26.5183778982 27.2722121981 27.4016654784 26.6334013012 27.4644132274 26.4667895071 26.7397045094 26.2923851863 26.5854823331 27.772973992 28.3845523873 28.6702907694 29.1500780738 30.4031691014 32.5444829848 34.1779875001 35.6442158407 36.6948565849 37.3389427102 39.2159917724 41.0638700675 43.6598805212 46.5804998348 49.6007122436 53.4121661079 56.6115626075 58.4496704946 58.4376725133 56.2411320397 55.8554076566 34.3187298846 1.93481414925e-31 4.40469908661e-34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 23.3314162173 23.428556358 24.42348738 23.1952054878 24.3869563975 24.3234425989 24.2283496866 26.1495933797 25.8498078482 27.9749489809 28.0265613718 26.9621479698 26.5480939858 27.6364031461 27.5352432537 27.4643753509 28.0723322729 28.4713869097 27.8224052129 28.8082715363 28.1411437015 28.645979559 28.515939067 27.5322841167 28.4904351321 29.3588967817 29.5762975037 28.6754375438 29.6409284325 32.1594927619 34.0360562121 35.1027284056 36.3220469911 37.4433902936 39.4567364866 41.6054957554 44.4324676067 48.1141274728 52.6096114557 56.9887521107 59.5810607721 60.184437488 58.5265815813 53.7641050418 34.5898827737 45.9013550057 3.06936748453e-33 1.24463533901e-35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 24.0538258263 25.0694972718 24.7394610107 23.9842459556 24.7729056333 24.5624877781 24.5467828512 26.2086120143 26.2590098779 28.1189529907 28.8355316871 27.6068449501 27.4352336454 28.266155779 28.2185488819 28.1383988086 28.3325214076 29.4107829948 29.0440894699 29.9526860527 29.9174117199 29.8852975377 29.8042917027 29.4531159657 28.7698940116 29.3828901099 30.2511395597 27.9070257361 28.7373471671 31.145010865 33.7406097543 35.2480271786 36.5484645994 37.0778409159 38.9861786094 41.5690093786 44.7993634077 49.5051468837 55.6368939179 60.5002791076 62.1955402397 59.2314462736 57.7397250502 60.3357253162 40.8891149742 2.0804451238e-32 5.30979635829e-35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 24.5329093544 25.5969761277 25.2485959698 24.6514172658 25.2736997689 24.9348675921 24.8987805105 26.3108580443 26.6279788201 27.9765400899 29.5108894882 28.1763910877 27.9037682267 28.7241483501 28.9049084048 28.6880207718 28.4841850824 30.0347138906 30.2553684579 30.9136205641 31.1034361467 31.3515361926 30.3467190522 30.3682332404 29.8547436063 30.7261970743 31.2802204683 29.0583241513 27.7463946023 29.6169117652 32.5009602469 34.8946293331 36.3964066198 37.123636002 38.097044293 40.7549851244 44.3665180668 50.4536729249 58.5145065145 64.08308169 63.8720105834 59.9468015146 53.933397157 31.2972712077 50.8624471213 6.13427811123e-34 2.06146581643e-36 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 24.7906915054 25.7533413154 25.6300072519 25.0243846732 25.7185734209 25.3945360836 25.2857413905 26.5199829924 27.0012730142 27.4415124908 29.900571576 28.7431453255 28.1586211197 28.5670405394 29.5596408176 29.3073649053 28.9000240064 30.5098540183 30.8765090208 31.6569210529 31.9518601722 32.4954921396 32.7037118805 32.7334418302 32.3663275859 31.7770177958 32.5073590141 30.5322398504 27.1715322482 27.9695344192 29.9266149293 32.8619631568 35.3107664242 37.3400415593 37.7784502108 39.1290533841 42.5344476493 50.1188433719 61.0814007356 66.6483974745 64.1781903223 65.2505801324 65.0231612441 35.6607471959 8.78913768288e-33 2.40312097807e-35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 24.979153486 25.8349924578 25.8577329947 25.1754015809 26.0393128335 25.9028409537 25.6399947241 26.779367224 27.4999881282 26.7590257967 30.0656618287 29.3629875803 28.536434136 28.0273238804 30.1039179912 29.9620722574 29.5648149829 31.1064070261 31.2880306939 31.9320357604 32.7876760434 32.4447093584 33.9803613326 34.5289589843 34.5664064851 34.4279658247 34.430805608 33.4075587561 28.8055700834 26.8471456404 27.9028728633 29.6990378712 32.4547335487 34.7354657472 37.213274818 37.7884385153 39.5027656043 46.2739544003 63.9203634021 69.1132223768 61.7426230673 58.5723283547 64.2930841486 60.1385707018 2.98199598321e-34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 25.098175139 25.8385789143 25.5930584395 25.162456347 26.2211294301 26.3154073363 25.8567430612 26.5595293 28.1838188445 27.4379990563 30.1141856695 30.0396192961 29.1208172182 28.495447524 30.6528999569 30.6173783448 30.4900093925 31.904337952 31.9673915127 31.8120786094 33.6980595126 33.6094883765 34.9170652444 35.5474898419 36.1060275981 36.6887880134 37.0691770195 37.007564189 34.4780011859 28.3146616364 27.2522813526 27.9059264112 30.1828433819 31.7529320008 33.9416718011 35.7740087159 36.5363415278 37.9887782596 59.3791047787 70.5812470325 69.2061821679 58.0234695313 18.4160370575 50.1768647655 2.45497582875e-35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 25.1147168013 25.7290461207 25.1580345759 25.2648738542 26.371488421 26.4299804158 25.9818723989 26.1645539676 28.379120369 28.1363214286 29.7692117621 30.7084452457 29.7307936439 29.4559963983 31.190060844 31.2088552656 31.5166453781 32.6292534608 32.9250885386 32.7938896664 34.5672347413 34.9597412037 35.9894464369 36.3232115487 37.6428385473 38.348390603 39.5134294787 40.5376029207 41.0098875591 36.5646374955 30.0060872669 29.0321940082 28.1909529201 30.0163271922 31.192094118 32.157599284 32.3735732134 30.1314700941 34.3884211031 61.3827894624 76.3376732453 79.901495496 45.1884973659 6.10544724857e-34 7.47826921586e-37 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 25.0967832753 25.2452492312 25.4673916612 26.0834768833 26.5818153339 26.5157031298 26.1610478093 26.2116474777 28.0264060064 28.4593618406 29.22639437 31.195652614 30.2098497076 30.1392929968 31.3943347553 31.6911129202 31.8327707925 32.882581976 33.7654084617 34.0319776327 35.3461790927 35.8886081544 36.7917479815 37.87910852 38.964678871 39.2186657912 41.1125571196 42.7059820654 44.4359608354 45.5852229935 40.5870272972 33.6578690616 31.1208846496 29.352886498 28.8697554215 28.5482933684 27.3032763324 23.8720095918 10.5454250602 2.37687286066 55.2143472218 78.9584115278 72.5482108625 4.5628390554e-35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 25.0505005501 25.1490392947 26.7201956309 26.7003883911 26.6303742668 26.5208272942 26.389049313 26.4022530588 27.825050013 28.7878648688 28.2863016275 31.1565369788 30.6198502133 30.1515106805 30.7590214022 32.0851842877 31.9022630111 32.0389005559 34.20692855 34.4975680856 35.662244553 36.7861815439 36.738340457 39.1267515311 40.1259727684 41.4525969099 42.7777689035 44.3273825676 46.4103062029 48.7243837874 50.2103610983 46.3039086328 41.07790552 36.6938646662 34.4147644661 33.1041527109 32.6642829609 32.0059349732 21.2694192067 23.063047357 0.00012872192461 35.3231440665 66.1387065816 5.76846253078e-36 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.74988684087e-40 24.8455705332 25.0785859691 25.3548789064 26.2939295032 26.3379965691 26.3786905813 26.5542034658 26.4273706499 27.6418511088 28.9372102426 28.3599966483 30.4893024952 31.1521854775 30.2188383428 29.8431551258 32.3013423168 32.207767608 32.2568467745 34.3844551529 34.8079747203 35.0933005203 37.6812980121 37.9580670455 39.7866148001 40.8163145466 42.9386040645 44.1467937844 45.8037512154 47.9390764957 50.3201668319 52.8230521909 55.5204813637 54.5312676619 52.0299247824 50.1773183159 49.574499614 50.0474230066 51.8309456233 54.562557446 61.518666268 53.1428867353 1.13641333533e-09 1.85852199205e-34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4.38422995958e-40 24.5050398453 24.7763803166 24.6795871431 25.7558842622 26.1954027278 26.2323370531 26.4510490768 26.1955088439 26.8444767367 28.6483192909 28.5071944375 29.3626888579 31.6028481446 30.5554471685 30.3967868643 32.1975430736 32.651002273 32.8301236256 34.3087333997 35.3999076628 35.8129230366 38.0214770137 38.8642239568 40.2129863158 41.9820502445 43.5296553585 45.2844517489 47.2608523347 49.1667128263 51.7437578067 53.8880192346 57.5371827418 60.2187819248 62.6073383195 62.5291816618 62.9365002074 63.7316692251 66.8970546399 73.0008816938 82.4525631371 91.6476729568 59.9797717974 2.5114263882e-35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4.38422995958e-40 4.38422995958e-40 24.1531655939 24.4487277227 25.0238547165 26.1365887366 26.3449375069 26.080629612 26.106104223 25.8165549063 26.0776937676 27.8432023085 28.5790815425 27.7861110056 30.8363931775 31.0368105082 30.4605057376 31.1055804367 32.9747340001 32.8870159748 33.2627900673 35.6406116316 36.2190668952 37.955480643 39.553220405 39.8519436937 42.5758443844 43.4403204453 46.3527404678 47.8573506061 49.7417743967 52.501841719 54.8978052737 57.46956003 60.1171750498 62.9147815459 64.7587884355 65.6201007313 66.7065071407 68.9688810846 72.9361824615 80.1961109463 98.6336699459 92.7335197588 3.49549236443e-36 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2.13977761318e-40 4.38422995958e-40 4.38422995958e-40 23.755416017 24.0145361688 25.3729580338 26.6524694892 26.0325305046 25.7036124193 25.6359213893 25.425344286 25.5284798279 27.0316219592 28.288437647 28.0508124437 29.2042158052 31.619795706 30.4892446404 30.3523284011 32.8232055795 33.034707707 33.308583626 35.4917691163 36.455906285 37.178234689 39.8849934396 40.6604082821 42.7317899154 44.4587675087 46.3634174897 48.013698759 50.2533587504 52.3077747121 54.6468726946 56.8223110858 59.006095715 61.2857222017 63.1185265949 64.0355396264 63.7555943671 62.3913383251 59.1403909371 57.2809842242 60.6814048554 81.1066957974 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2.6638940838e-40 4.38422995958e-40 7.0291051734e-39 7.41701028129e-39 23.295567353 23.4709562839 24.438091725 25.3338990955 25.3094061481 25.0998833588 25.0426283906 25.0346066477 24.8894754525 25.7051746143 27.3055364383 27.9963751459 27.223063403 30.3649172796 30.8292522684 30.1794724813 31.2405296214 33.1391138408 33.2515476357 34.1974202954 36.6232238174 37.2055536761 39.5335577074 41.2059722628 41.6206491545 44.501738497 46.2133955096 48.4721839622 50.1772058322 52.058057822 54.7361936278 56.6385001146 58.686254783 60.6345546192 61.7579069202 62.7406686602 61.7410541697 58.853981164 44.622669882 54.7147915821 1.19770480976e-08 2.77090746732e-35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5.45614092154e-39 1.84169292171e-38 2.74490184085e-38 22.8227010694 22.9072839511 23.7392482002 22.5941788625 24.1532950399 24.3715612824 24.3332324702 24.4497080353 24.0121433431 24.4151103682 26.0587738322 27.4659362259 27.4844635085 28.2841983458 30.9275185309 30.2719376438 30.2751277805 32.8338829839 33.4639672372 33.6387927742 36.3069749497 37.3836838216 38.1266066472 40.5716776927 41.9615954021 43.990153242 46.3410825953 48.1808282317 50.411823488 52.6329579121 54.7909369783 56.841604588 59.1990103164 61.340693706 63.0227101784 64.0021854338 64.7204777972 64.395846906 59.766041576 65.1184154734 3.92229823758e-05 8.21834351643e-36 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2.48407698031e-39 8.89911153832e-39 1.251129443e-37 8.48393744075e-34 22.1425487466 22.2015641324 23.613352631 22.5602137108 23.1877696907 23.5003802663 23.5080337776 23.5557182331 23.1784415087 23.3189834025 24.3341362606 26.0739494928 27.4449966011 27.3433396297 28.9213884599 30.7437656892 29.9756960906 29.9624597204 33.1435522261 33.1276715704 33.7381731112 36.717940162 37.5274211401 39.7772615053 41.7179417882 43.1954174091 45.757386797 47.8686469396 50.4817076615 52.3929364355 54.9233252311 57.9992068013 60.8913167571 63.3886716067 65.8380737118 68.2697855041 70.2362538292 71.5771070722 76.6033788988 80.2039474161 48.1023651661 2.19099799382e-37 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.56744340824e-39 5.21036625918e-39 4.99895227293e-37 1.44904911729e-34 6.997077641e-25 21.0682351637 21.0975058817 22.4357402117 22.8278070819 21.5079728064 22.4752608224 22.6368244918 22.6984797693 22.6635252079 22.315879587 22.7073518752 24.4004000788 25.9733666653 26.9879040239 26.5204490874 29.529143949 30.2069883714 29.3071395475 31.7681089104 32.7966601884 32.9669044572 35.6569283358 37.2361255267 38.9386921565 41.0668045412 43.3212002435 45.2090836833 48.1735590613 50.0603203921 52.2482869428 56.1003427795 59.3748801742 62.764625726 65.9218099998 69.8314758092 73.2199172046 76.3807103688 78.1242172106 80.7491040503 79.709738623 35.8370429438 1.50540989447e-38 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5.03738702422e-39 6.23797550387e-37 1.43451196658e-34 5.38705981968e-30 1.09226234092e-19 19.9820135541 19.9365957168 19.9644702093 22.1585663153 20.3962338034 21.4535752297 21.8786317044 21.9563678645 22.1084865988 21.4630122029 21.6502873104 21.9228019576 24.0881305466 25.7973511061 25.8282059731 25.7679680469 28.6933453946 28.9087887097 29.076101662 31.5738420742 32.5934115064 33.8204954235 36.2884737855 38.168315034 40.3110479102 42.4967945026 45.0300989041 47.4364300786 49.9530851999 53.4050786604 57.0117245927 60.8114383634 65.0670307994 69.8239487599 75.2040545229 80.8480255563 85.6505790738 90.5315599717 95.9057331688 84.05487724 6.48226594735e-07 3.66191221537e-38 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.56744340824e-39 3.71846608545e-37 8.37452087988e-35 1.23968406528e-30 3.10328568616e-21 0.00012590858015 19.3917120394 19.2488449965 19.1304643043 21.9119119419 22.3750355057 21.3195057889 21.3519718532 21.3116695772 21.2965712138 20.9525664295 20.5480699301 20.9861416009 21.9129039936 23.6230163598 25.0018998358 24.2364834662 25.7141982944 27.6133690809 27.9906091638 28.4106883099 31.3364158682 32.8412594145 34.2907511386 37.0192635479 39.2074373056 41.40397664 44.1836452747 47.005379138 51.0145103276 54.829739225 59.3564793321 64.3117775143 69.0810215404 74.8045371558 81.4077154203 88.3180999307 97.5322000713 100 100 100 53.2499005924 3.66191221537e-38 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7.81183289988e-38 2.55884084678e-35 1.22359743477e-31 2.95116000128e-24 2.74083647309e-08 75.9232532952 19.1219829153 18.7931321395 19.32985403 20.879197554 22.0065097693 21.4191759263 21.4547838048 20.9606789647 20.601883632 20.5438947096 19.5796036864 19.8602257945 19.5719899981 21.0918100646 22.2129469043 23.25439018 22.8714810357 25.2095541286 26.2232415618 26.9812680767 27.6341445582 31.0400194343 32.9730950015 35.1831843886 37.7009035864 40.9121279408 43.8936394844 48.2833332606 52.0951751944 57.0272782161 61.2848720866 66.2198600731 71.7406942429 78.3233363693 85.2831788224 94.1441670259 99.999999979 100 100 100 60.7701797391 9.83109875515e-41 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3.92679088468e-39 3.64130654783e-36 9.52810945971e-33 2.5397779806e-27 1.25871258287e-13 66.6856946807 68.8066862457 18.6801593024 17.9617100259 18.8149670843 18.6997277516 20.355860362 22.0667328888 22.8449070944 21.1665564844 20.0327164127 19.5361191937 19.0593816485 17.8175361534 18.3453672547 17.2646731404 18.2415158453 20.1355413393 20.9153559675 20.6814265563 23.2727018093 24.5111438657 25.9603084066 27.1061775557 30.9821274224 33.2953296061 36.3473735663 40.2675179622 44.3927395675 48.2592246163 52.6376439159 56.7267956512 61.2472892601 67.0713681817 73.781710233 80.3498875671 87.5109819909 97.7042248547 99.999999942 100 100 99.999999992 99.9999999995 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7.58202365049e-38 4.00236660135e-34 1.84379496025e-29 9.73809189328e-20 49.2411580714 57.0939130624 60.0976656848 18.205681765 16.6852059274 16.6005164616 16.7355083224 17.3438910654 20.2922626373 22.8306960423 20.8390567207 19.4005454697 18.4684632887 17.991023884 16.5853065407 16.7117033905 15.5485966876 15.080936523 13.9597480689 17.538253805 18.0956689188 18.19786626 20.9071314141 22.6280848647 25.0039347017 26.9359165346 31.4301561509 35.3635739015 39.373489371 43.2798270362 47.2193470185 51.8375964493 56.4882525783 63.033576293 68.8056749323 74.6745151257 80.8447386981 88.7874421363 97.4312917678 99.999952451 99.9999985894 99.9999999796 99.999999937 99.9999996934 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5.57650028638e-36 1.56501922308e-31 1.8730900738e-24 3.15038426807e-05 53.3435922558 52.7017689296 51.3896710177 18.1097270976 15.3006572188 14.7896780855 14.8590975035 15.3022566694 17.23753337 19.8195600773 20.2727062589 18.6036670636 17.4651887246 16.5781096296 16.0643747143 13.4017192895 13.5802831813 10.3996890799 13.14076612 9.15365172305 14.4211939371 15.2860372831 14.0973965925 18.1092018254 21.5518418584 25.2885077634 29.1424796814 34.2686168557 38.715030315 42.1817846817 47.3987690131 52.3064603866 58.8532067759 63.5450128843 68.5651620174 74.4656915518 81.6271196881 90.221715041 99.724561707 99.9999996305 100 99.9999999981 91.9226566748 7.23640854028e-09 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4.19642081532e-39 6.11603467184e-34 6.08223549546e-28 1.46354594353e-13 52.4873227627 53.1203755253 46.7720537792 45.0570162591 18.3271068242 14.1854452127 13.2642658577 12.9495736633 13.2734020704 14.4861794139 17.0591475982 19.4600515152 17.9674708133 16.5176411559 15.3858405632 14.2766360442 13.0102117807 7.95698964436 8.5506437902 2.54187792691 8.13865340999 1.0480202571 12.5851013967 10.8384142851 10.3704392481 14.3236257701 23.4199015749 28.4028008055 33.4366801759 38.037206825 42.9124895914 48.1439164239 54.4285810569 58.4940497039 62.5237911418 69.0583868853 75.9672230053 83.9578008031 93.1118109605 99.9995074239 99.9999999992 100 64.0195818183 6.78918109133e-22 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5.07631840755e-38 1.36154325906e-31 3.95079428704e-19 53.3267615331 56.1843573045 49.6334822771 43.8002141065 41.3915985949 17.2719221923 13.4692860929 11.9134470868 11.5167266013 11.3792491611 12.1382644854 12.2469172655 16.7853433471 17.6387969522 15.7768627953 14.3784907323 13.0148840435 11.1253394675 7.63010463481 8.2100883546 1.66284096524 0.0215282679414 2.80296987492 0.947169328468 0.316364422768 9.66905528818 11.8703682075 21.1682471043 27.85838148 33.1482027828 37.9374394554 43.5244009497 49.3224182944 53.3624682885 56.925006699 63.7098324527 70.1682123989 77.203903497 85.1840844495 93.9918167841 99.9996312522 99.9999999759 99.9999999999 2.44153838423e-23 1.35562590229e-22 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5.99053243594e-35 3.5323299253e-26 48.8083023241 62.6376945425 54.130098839 47.0980699307 43.0485666304 41.6767039352 15.6271915264 13.110803013 10.8976412027 10.4133276949 10.1733832336 9.86538795532 11.4163101228 11.6014356053 15.730815178 15.0258095029 13.5487565888 12.1764341733 9.54381013649 7.43914377035 0.00964861826949 0.0151676541648 0.00411375300062 5.80773385319 0.0509442685417 0.517399437115 0.585703285952 15.1478424525 21.0913826763 28.0257784417 32.8525575972 38.8243694497 43.8732702035 48.5904088919 52.2268235574 58.7205720259 64.7364868575 71.2075873124 78.0475267595 85.5019213765 93.3786105728 99.947203935 99.99998106 99.9999999156 3.42621282656e-22 6.02944343262e-17 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.13771626728e-39 4.46572445963e-32 5.03416236071e-05 67.1799577152 60.5859929619 53.201002405 47.4546942376 44.2279133757 43.3907453943 14.6698852096 12.2093125134 10.0976180834 9.26238223607 9.28083517092 8.73078295021 7.79054934611 10.0335932394 9.84796931679 14.0151326871 13.0554273221 11.7295321604 7.29160056624 4.9167279647 0.00297863197887 0.000442490847916 0.00705884018495 0.00203659765068 0.0287457783147 0.0202404200284 11.3804304692 15.6713441115 23.2242851298 28.3562989286 33.5764452264 38.9925077168 44.6864785715 48.5353538431 54.551242275 59.9863072416 65.9878340777 71.545211907 77.4869966986 83.6887077493 89.7651964873 97.0185296605 99.999797026 91.8498392414 4.53904007821e-22 7.9092742694e-14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3.54834965436e-38 5.39964069516e-20 67.9277833785 66.0517082784 59.1877706535 53.3557232881 49.2014375652 46.9396505541 46.5923475491 14.7605773635 10.7071827573 8.85119051736 7.95345430443 8.42252971097 8.15247644792 6.09790956348 4.71719157376 7.33222136887 8.11061833065 13.4199248624 12.6191826419 7.71025502607 0.00169492960422 0.000136967517786 0.00018947375787 0.00020690966361 0.00263393518534 0.00223590358884 9.83533099441 11.6493631095 20.3244634154 25.0112751182 29.7138730894 34.978808564 40.6371086188 45.3011364306 50.9876760474 55.9186955558 61.3020644576 66.2120948566 71.5178688728 76.4498169981 81.1659465475 85.8710141447 93.1503356248 96.9237132573 34.7968869524 1.65882793912e-21 2.33719479416e-10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.50676565663e-33 61.8682291549 71.5978179736 64.6805046916 59.0027256679 54.5921028441 51.6213951683 49.992396213 48.8886302445 15.5812390441 8.9231634234 5.76636110161 6.47364827724 7.4598605638 7.9850441504 6.49880540629 0.000776003233667 5.58604639419 5.49840177593 8.17014740559 11.5192242773 6.20265616403e-05 6.72950513986e-05 2.8884264805e-05 4.57516979299e-05 0.000159481461864 0.000402163123231 8.52753759622 9.65629370979 17.8917927941 22.309871197 27.1060169992 32.2817237763 36.9731241035 42.0070951038 47.6425211105 52.3802809716 57.4883842967 62.0187611085 67.1317741415 71.0979253604 74.6354694839 78.21973074 82.2482798547 87.3408432416 81.214841029 0.00584082435468 2.81384215958e-20 81.9389837712 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2.50655266822e-39 42.8111553172 76.863510891 71.0342383436 64.7202104227 60.238978226 57.0161337395 54.7615097293 53.6124921149 52.822165254 15.278076112 9.28483283189 3.25570348035 3.51865001897 6.3165862015 7.55201810794 6.73610595989 0.21636670223 1.34197186984e-05 0.000535558787783 1.58791463325 9.83185323742 0.000634120595252 5.01444871472e-06 1.13865322742e-05 2.06548468247e-05 0.00012139418219 6.31220284289 9.43303335056 16.3905908894 20.0972955642 25.3665586933 30.014278399 34.5914058581 39.1164042296 44.2470299951 48.8066527881 54.2133220541 58.5025255566 63.2536472991 67.0820094061 70.8906606753 73.6774544329 77.0074266875 79.0262714502 77.7889111001 76.5412219855 46.3234544773 4.19322486765e-19 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.80077145768e-15 76.661201226 75.2024062281 70.3776561967 65.8414622048 62.7032921321 61.1810292557 59.9546662889 58.8622869365 58.6086641781 13.8399134079 0.00887689294809 3.91250072973e-05 0.196026738526 5.61343200079 7.08785185654 6.75546326687 3.92796178299 7.0624473873e-07 4.52282192808 2.00265537183 8.68870727941e-05 2.17930854471e-07 0.000168734996974 5.75851494346e-06 2.03582467913e-05 4.01341537171 9.84160350405 14.6309074732 18.1212116582 23.0289759153 26.9665298354 32.0686873715 36.6793726087 40.7952492189 45.6411518568 50.9171854293 55.3828213732 60.0800688217 63.995417909 68.3844527021 71.2967665072 74.3375185034 77.8590298764 77.4057373804 77.5514526675 82.4252980862 68.7445280037 9.08093983581e-19 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.71323338054e-38 70.3135653678 73.8780691044 73.7038585414 70.6446576367 67.9853939368 66.362768531 66.0651840428 66.9883888043 65.2288607347 66.5140847998 12.1174376475 1.09941930999e-06 4.45304301148e-07 1.70846412745 6.11356293818 7.31468232133 7.30360893209 5.75495731717 6.33553461958e-07 8.22854945755e-08 1.17584185983e-06 4.62881530563e-07 1.92490766773e-07 6.35084076016e-07 1.74115660069e-06 0.103618479843 10.5412977115 12.6907228791 17.5075329563 21.0445258921 24.3818014676 29.3700231076 34.2859896779 38.4732564237 42.6775291893 47.5406889576 51.988586049 57.1297380015 61.0746645727 65.4160197526 69.2532644522 73.4712559696 77.2958883289 78.4681017466 77.7788812722 77.2666925178 78.6465548778 82.1793020044 2.45942415309e-18 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50.2686218371 79.7467801896 76.9469505194 74.7494778938 72.3383359409 70.6532390851 69.7551342934 69.474285056 71.1278517418 70.2367227141 69.7310289518 10.2214018754 3.51315255766e-07 5.88420866352e-08 4.31939473788 7.29288228588 8.04281663382 7.73032358182 6.39514728616 0.000108118980492 3.78102858397e-08 1.67666770516e-08 6.97960439472e-08 6.33672405204e-07 2.78415523218e-07 2.5685587674e-05 8.70512482805 12.9729889598 16.8280495567 20.9715635245 22.7111010053 26.7816299824 31.1508865246 35.7884884403 39.9549858226 43.874433666 48.5952888853 53.7532862468 57.9773671229 62.5360746512 66.8608579538 72.9100202286 77.2111215819 80.432252474 81.194446524 79.9588745349 74.8724487335 74.3156535498 83.1966990327 4.2502675791e-18 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.08164250902e-32 84.1090575456 79.8719648633 78.0344359562 76.1124892512 74.3220956643 73.0895940398 72.3198899233 71.8257212103 72.5214262521 72.3011144723 71.0729557158 6.82296582367 2.81495350813e-08 1.05604765379e-08 7.15959923903 8.96723121304 9.05429374336 8.34272383974 6.79492656777 2.67717806759 1.56863785402e-08 6.97688230853e-09 7.50526340632e-09 3.78646936703e-08 0.0742518241018 8.29644503281 11.8590590076 14.4752018674 18.1540360544 21.6350144369 25.2363027689 29.3228285875 32.3771916461 36.8865739806 41.0543946151 45.2129764985 50.0258557588 54.6143946745 59.713390026 64.1218398899 71.1961410893 77.8448036718 81.7697848527 84.707765307 86.6979044927 84.1368564069 79.767688273 75.0978565714 78.1661354436 3.00545448513e-18 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 71.5019153139 74.3798738543 79.6222945018 78.6840873166 77.6073827862 76.3261590668 75.3266694628 74.5728059897 74.0016637419 74.4010269571 73.8941298745 72.8053829893 8.16286293535e-10 2.71944335109e-09 2.26984595485e-06 10.1545817534 10.6855746919 10.1995174537 9.06444882793 7.52155642808 4.33443261126 7.21622354069e-09 3.02670768552e-09 2.90889479339e-09 9.44753068653e-09 4.70857005835e-05 10.480703365 9.70501036382 16.6076945823 19.0012559504 22.4963709407 25.8876268773 29.996102766 33.7931686771 37.6492147955 41.9268959821 46.2189551366 51.0440944699 56.380247201 61.0438264492 68.6017801371 76.4691767352 81.3170426176 86.6184502375 91.2534999198 93.9367098137 94.9202084947 96.5159352342 97.9330511662 99.9999997361 71.0571363237 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2.27906835984e-17 95.5795745363 85.5834610891 82.9145353039 80.7939505341 79.4564786496 78.2644750209 77.3350559905 76.6044402499 76.0431244004 76.1410111837 75.4356239942 74.9928497491 3.12679033656e-10 5.40813092533e-10 7.00888511351 10.2936681389 10.4762288225 10.2388270713 9.7680218908 8.20618654657 5.63003716081 3.50980563007e-09 1.36233033076e-09 1.29656038155e-09 2.07187259343e-09 2.65286567185 1.39184490924 14.739513638 17.8356877516 20.6007346348 24.136624265 27.2140731297 30.8764546713 34.3186238228 38.4056553283 42.6825316139 47.2708409046 52.8265381277 57.8618926658 64.9854335118 72.7683149754 78.9820587895 85.2764389506 91.8215078952 98.9250088736 99.9999907772 99.9999999999 100 100 100 99.9999999971 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 91.1849108322 87.7006894148 86.9627309971 84.074954068 82.1052005486 80.6144542327 79.4427388257 78.5214761976 77.8352239678 77.3597657942 76.9430188068 76.2584775453 76.1731898421 2.9107513361e-10 2.31679838776e-10 6.06468318753 9.83853371234 10.3635456896 10.1307700374 9.45418053782 8.4228083397 6.55682336828 1.6568397018e-09 6.48596160027e-10 6.09707042777e-10 1.14408398531e-09 5.72705541302e-09 11.4323095704 16.7362682715 17.7843374381 22.3235866687 25.7291351301 27.9466897042 31.0288490919 34.8065385315 39.2628448442 43.3744005883 48.8693030013 54.2529534954 60.3720852296 67.5126163179 74.8467306093 81.8605302748 89.0531228217 98.6028202245 99.9999989455 100 100 100 100 100 98.6361923508 5.78392923017e-10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9.06493955733e-25 91.5656140496 88.1051507241 86.2671231076 84.1403865548 82.3550358494 80.5869607308 79.2839388025 78.1942601214 77.3596402144 77.0723800803 76.396638763 75.5919020715 75.9010710591 3.9170500288e-10 1.17755932389e-10 1.17871931307e-09 10.0951679168 10.6753432481 10.2037347739 9.31254615511 7.95379694619 6.11758727206 3.35571121584e-09 3.54959054357e-10 3.19048932278e-10 6.43095870509e-10 3.75216618211 9.37446111547 13.9790052628 20.1565718446 23.1825625009 24.7923616266 28.8800448538 32.5118941435 35.4235222702 39.1421602535 44.6753652637 50.376300628 55.2513361197 61.9464296265 69.718019496 77.0199047755 84.2338813948 94.3055135269 99.9999138216 99.9999999999 100 100 100 100 100 1.04049549865e-16 5.34834753507e-18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 96.3428685423 86.9370931914 87.8475755452 85.4747587288 83.8065796955 81.6547141251 79.6200082752 78.0057537686 76.610238542 75.4364162708 74.495375284 73.9899768733 73.6716888439 74.5516438481 1.1294330668e-09 7.39344238944e-11 7.80689379317e-11 10.6072841893 11.0819690981 10.3250728339 9.16955164831 7.49693342067 4.78456680703 3.66778895197e-10 2.31122778844e-10 2.08341978071e-10 3.32870969536e-10 3.98448562499 9.46338862508 13.3711109718 18.7612998854 23.0587265674 25.8639375926 29.7043561746 31.1980624049 35.5088037909 41.1336933265 46.1675498218 50.1703201693 56.8840524605 64.1865761936 70.7287822835 78.5850994605 88.2467338956 99.1713313422 99.9999995031 100 100 100 100 100 100 8.66883382053e-22 1.46906786199 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3.94109988771e-37 99.9999742831 94.1711243684 89.6670271793 86.1313577223 83.4757670029 81.1470493736 78.3824993151 76.4134729135 74.8064191732 73.5262808547 72.5535391905 72.1614666042 71.585393323 72.1467495512 5.18243619164e-08 6.63224518605e-11 3.35444889022e-11 10.8971526689 11.3387007904 10.3722569687 8.97427438511 7.08941304127 4.48092507317 2.15733823841e-10 1.23464435743e-10 1.35343324497e-10 3.92596326073e-10 5.55368425795 10.0295298342 13.8606533084 17.0761607033 21.6344566062 26.2659263595 28.6895745557 31.9870140313 36.9810563416 41.9379399695 45.0440389055 51.4328333051 58.4147987026 64.4620874172 71.9822572797 81.0899466763 90.4629099571 99.9711920728 99.9999999911 100 100 100 100 100 100 2.03966322458e-26 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 95.6693569004 86.6873736872 93.6824332851 90.1146894073 86.679637837 83.4349042227 80.4014073841 77.2863812152 74.9909028842 73.203334514 71.828076281 70.9206298263 70.5902321311 69.7415065414 69.0206826721 1.73196259979e-10 6.87307421728e-08 2.13909823427e-11 10.1858014038 11.3962726766 10.2439998003 8.46666210205 5.3564701999 1.20911790416e-10 5.44584116316e-11 4.47476466347e-11 5.31913633592e-11 1.06498402732e-10 5.93890227183 11.5216389001 14.8801725471 17.2393045467 19.7017335195 23.8573119873 28.3987871109 32.0978724615 36.4883219577 40.1601258341 45.2817899424 52.7082807977 58.8770310245 64.4189873586 72.3539332564 81.800349348 92.8956198643 99.9990586548 99.9999999982 100 100 100 100 100 100 5.4116816757e-26 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 100 99.9999999829 98.9106783588 92.8103352291 88.250463007 83.7533284121 79.7885080761 76.5303413535 73.9635838942 71.9910032912 70.4724287949 69.559205424 68.9778889714 68.0609551191 67.3490989116 1.10690305295e-10 5.21747952282 1.3036308726e-11 9.22982686564 11.4597392744 10.0771211445 8.15617283455 6.72060817397 4.74349489098 1.78969022257e-09 2.87075738076e-10 2.21972504225e-10 6.3393155988e-10 6.74602224962 11.8847669119 15.0624342274 17.5949589457 20.007774172 22.197000245 24.8172097196 29.7028891602 34.696063513 39.138942912 45.2972622246 52.284521124 58.1233029195 64.5129153613 73.328792465 83.4111066768 93.0775436128 99.9993067337 99.9999999998 100 100 100 100 100 100 7.01712145587e-20 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9.19162692726e-12 82.9998575713 99.9999901741 99.8602687196 95.0086961472 89.2235722264 84.6925079037 79.7512819817 76.1881786883 73.3133464013 71.1456159951 69.609556053 68.9437701713 67.6095303709 66.6393777057 66.0399764062 2.29491258575e-11 5.84178584899 7.55841171589e-12 9.68587006824 10.7934479851 8.36318129449 5.34302847043 2.43947356517 9.56813966666e-12 5.50371899957e-12 4.99693189548e-12 6.33625268432e-12 1.36353255643e-11 4.84131993947 12.4528885113 16.1323345384 17.6400381366 18.9796095893 20.8804107724 23.7312742915 27.1115275403 31.2141805014 36.902385811 44.533161597 51.6982724355 58.1635116227 63.7669719123 72.1754195116 82.1499822671 93.801246911 99.9999476035 100 100 100 100 100 100 100 8.91520269012e-19 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 100 100 100 99.9999867599 97.8626586019 91.2549455317 85.137351155 80.1516053974 75.9617559043 72.6057679928 70.139579492 68.4814544387 67.464021757 65.987861082 65.1849268948 65.3213055783 3.14368875899e-11 2.63701792688 4.41202802748e-12 9.28873282004 8.07831946832 5.75614286443 4.00931882811 2.67636953819 2.62103315964e-12 2.81598711666e-12 4.0911953054e-12 8.75961686894e-12 1.24523376559e-10 6.41213361748 12.0192735037 14.3827750045 15.5404038856 16.4914661784 18.5822364996 22.375562894 25.9210267949 30.2510290876 35.6458068414 42.2838196924 48.903322431 54.6894543227 61.5375483279 71.3497935846 82.2125274604 94.763967359 99.9999778551 99.9999999998 100 100 100 100 100 100 1.32094710857e-17 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7.98474671331e-38 99.9999999932 100 100 99.9999999932 99.8633776177 93.179936854 85.9327114971 80.2060880088 75.3783426444 71.3922916943 68.4419112731 66.5401051359 64.8983983398 63.5842084372 62.6612713523 63.4098573134 3.97927651158 2.93563022739e-12 2.69026756579e-12 10.7803686354 9.15741385851 5.97377828562 4.01055278815 2.66529602908 1.87899913272e-12 1.77376675872e-12 1.86792765524e-12 2.25245408485e-12 4.18752438348e-12 1.35871970382 12.4915188892 14.8796448792 15.527950063 15.8231272162 16.6605097353 18.7262769302 22.6718530467 28.1389082957 34.1265643193 40.5196157234 46.1496150622 51.9713205435 59.6219583376 69.5760974759 81.4140251359 93.764541671 99.9997893234 99.9999999995 100 100 100 100 100 100 5.28581170866e-17 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 83.404195502 100 100 100 100 99.9999391513 94.406873672 86.5334146869 79.8214522786 74.291882271 69.7417978977 66.1665720252 63.5984743918 61.3884356453 59.960297483 58.9068005745 59.9285049173 8.4026436707 8.66497358986e-11 2.4930856825e-12 11.4183747568 10.5350331859 5.78496424024 4.46803951344 3.10324522809 1.22738907887e-12 1.4476510776e-12 2.8887598782e-12 6.93957711292e-12 7.96408799033e-12 1.90219100163e-05 11.1216402934 14.5163305574 14.7043210688 13.7261568101 12.8398589959 14.546451518 19.2049216429 25.1970728099 31.4534450809 37.8107096736 44.226895892 50.0727154764 58.237562624 67.8259823499 78.4733254701 90.5590984894 99.9951773387 99.9999999992 100 100 100 100 100 100 2.25654232036e-15 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 100 100 100 100 100 99.9999999939 97.6767022785 87.5483855578 79.3283598559 72.9593102063 67.8239321891 62.904499107 59.4001323051 56.9224589733 55.5372132263 54.520805116 55.3730873209 9.69982812155 0.431342572521 3.23005467895e-12 1.49038301972 6.24883733101 6.5585599686 5.7908023611 5.39181217016 6.25424870376 8.7280899097e-12 2.77105694684e-12 2.05321241191e-12 2.06437655758e-12 4.13059472644e-12 9.4144208479 14.7411954238 14.5103442633 11.4561301485 5.62746861094 6.6199441769 13.8123548747 22.5442640608 29.5256048202 35.2933456141 40.8995322962 47.367310027 55.5823567182 65.2456665238 75.9182164816 87.2096270244 98.4150448456 99.9999998037 100 100 100 100 100 100 8.93486959216e-15 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3.9764055241e-37 100 100 100 100 100 100 99.9969312157 89.7680176888 79.3546594053 71.2960797657 65.1697123927 60.1562944784 56.1672088042 52.6880418382 50.4430320606 49.9276083765 49.8891222386 7.45263049171 4.15313910496 9.26881390302e-12 1.88559643587e-09 7.09425134373 9.41306205083 10.3850241073 8.76893713492 6.07098013394 1.05186465939e-11 2.4702598407e-12 1.5869706727e-12 1.31866413658e-12 1.62796312973e-12 6.66027828804 14.9058453801 15.6022321476 11.9795019882 4.0765807743 2.29256631697e-06 9.35759686137 18.9638240536 25.7320612929 31.3799283286 37.0996362446 43.809727578 52.2653894139 62.0219980673 71.8693609703 81.4162496406 92.806164303 99.9999727178 99.9999999999 100 100 100 100 100 1.07787607464e-11 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 96.7153600798 100 100 100 100 100 100 99.9999993441 92.8784705787 80.1873028803 70.0528988181 62.4432219664 56.319671345 51.8023727719 48.36616172 44.7580100707 44.6519924365 43.8275781446 4.88540369606 5.53150942432 3.93366401493e-11 7.5135770515e-11 9.39775376206 11.1649914963 10.579030407 9.80337137461 8.62258360453 4.03922671032 5.646888354e-12 1.5697865384e-12 1.07322755085e-12 1.07089840285e-12 7.21512215114e-06 16.8578192195 18.8149158846 8.96521910242 4.93449796838e-11 2.56899186475e-12 2.78744336669e-12 7.08671015313 21.1866883437 27.1685415933 32.3973543446 38.9960344011 47.5419468839 57.7168248445 66.4428449459 73.9855779754 84.3124190601 98.329490205 99.9999978903 100 100 100 100 100 2.56099668125e-08 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 100 100 100 100 100 100 100 99.9999999998 96.6764312318 82.2135805459 69.899185561 60.7163497552 53.1188642673 47.162158145 43.1262199736 39.086313846 38.3265346386 38.9176807018 4.53709347649 7.57579760845 1.41651808493e-09 2.30991610786e-11 11.3142021695 11.7353343153 11.6851762849 11.311312379 10.7127797836 8.62789275992 3.94589693535e-06 2.31936106947e-12 8.67348233498e-13 7.16873605869e-13 9.30364045287 21.2322330967 16.2542911763 1.15388220858e-08 2.36294612759e-10 6.83715383539e-13 1.65795881285e-13 4.90400320116e-05 11.0617375728 18.7219187985 23.1660884734 31.7381420536 40.7772513233 53.0762428795 60.7426242557 64.2968997354 71.9259488317 85.3018701117 95.4401231353 99.9999963704 100 100 100 100 99.9999997334 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9.22286007825e-38 100 100 100 100 100 100 100 100 99.9647227703 84.8629814268 70.5848823946 59.5269521637 51.3208542314 43.9555969834 37.8839773141 33.169142587 32.8894469436 36.9047472113 0.253066561039 0.00523772271762 8.75095865858e-10 0.000521390805773 13.024789494 13.5029969374 13.7624900273 13.5860649479 13.3840329259 12.8014368454 7.90562122877 3.09573106264e-09 1.53177701462e-12 4.57765484726e-13 2.95887082505e-13 22.4354496883 6.35529868659e-06 1.28075303056e-08 2.73644741284e-07 7.30601617976 5.53628278401e-14 1.32527671645e-14 9.43591011272e-06 15.3674040674 22.5516913775 23.015059848 27.5633538766 44.4954698174 57.4299541032 52.095326737 54.3233239144 64.0315463554 74.323642795 89.231070378 99.9999978954 100 100 100 100 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 100 100 100 100 100 100 100 100 100 99.9999439539 87.0961001245 71.6891400673 59.2404903407 49.673094554 42.1457066578 35.9262171681 31.2264712663 30.8725166708 29.6001774436 1.49205532937 1.78243890527e-09 2.81272696807e-07 1.08034166115e-11 13.8960243542 15.8687710464 16.7834958687 16.6623495281 16.8291416101 15.5951299363 13.8390944369 0.655086869321 9.1158572133e-12 3.48566995568e-13 2.41541643141e-13 3.3205906969e-12 2.58189788872e-09 0.524917448313 20.9775748827 13.0472533315 1.21788634779e-14 2.38190089393e-15 5.44854458394e-16 4.14502591048e-16 4.20422381484e-16 2.24435406126e-09 3.56669202171 1.87545793505e-13 32.913561875 39.2083571031 36.3755784285 57.7228783499 59.8078062215 76.9020233702 87.9829752582 99.9997965726 99.999998914 100 100 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.4931960889e-39 98.111182343 100 100 100 100 100 100 100 100 99.9999968653 88.5520947679 73.2244375042 60.2363333756 49.7409790122 41.7172425394 35.0711910049 29.3294125681 25.7073993097 19.0996728682 1.12334113917 6.27957007853 1.82551915345 2.14101341765e-11 2.75684069894e-13 7.66168693338e-13 8.61922089031e-10 5.57476612681e-12 3.93290698018e-12 2.08614053768e-12 1.11203067655e-12 5.58313511694e-13 2.42003679354e-13 8.23692711641e-14 3.03913966178e-14 8.53871041908e-15 4.27301690759e-15 4.005229251e-15 2.91678799666e-15 1.83315051918e-15 1.20512536491e-15 7.1766156939e-16 3.57235898231e-16 1.93173745248e-16 1.56216618748e-16 9.93510581001e-17 4.80174505873e-17 2.00415793982e-17 1.41957566256e-17 5.14970797221e-18 4.65105159119e-18 2.50359637596e-19 6.26341480841e-17 4.56970786549e-22 6.75590814328e-17 3.24780283063e-25 5.49864317117e-16 7.06548034281e-31 4.46664198827e-30 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2.48407698031e-39 100 1.09703382024e-18 100 100 100 100 100 100 100 99.9999964969 87.998833334 72.8794388368 60.0137588912 48.9241552367 39.8779758963 32.5362927947 26.7225096989 22.8041132837 12.9034525977 ) ; boundaryField { frontAndBack { type empty; } upperWall { type calculated; value uniform 0; } lowerWall { type calculated; value uniform 0; } inlet { type calculated; value uniform 8.87806566814e-37; } outlet { type calculated; value nonuniform List<scalar> 20 ( 5.11265208313e-39 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4.38422995958e-40 9.93761245989e-39 ) ; } } // ************************************************************************* //
f8fbd36fbaf0955e9f73a459690f8366b506ccac
eec5833ea113c4ae3b83d2474e339afeee83364f
/up05/task_05.cpp
1adbd3f9e5fc2de386fa3c99905e18da6e84a9ad
[]
no_license
kirillserious/2018-1-contest
9887328c27a1bffeae289954774a59d9978b9b03
a248b881ce5f008287d57cc4d78e391fe0d4b1c6
refs/heads/master
2020-04-26T15:11:29.877326
2019-03-03T22:57:00
2019-03-03T22:57:00
173,639,586
3
0
null
null
null
null
UTF-8
C++
false
false
1,282
cpp
task_05.cpp
#include <string> #include <sstream> #include <cmath> class Square : public Figure { double _a; Square (double a) : _a (a) {} public: static Square* make (const std::string &str) { std::istringstream in (str); double a = 0; in >> a; return new Square(a); } virtual double get_square () const { return _a * _a; } }; class Rectangle : public Figure { double _a, _b; Rectangle (double a, double b) : _a (a), _b (b) {} public: static Rectangle* make (const std::string &str) { std::istringstream in (str); double a = 0, b = 0; in >> a >> b; return new Rectangle(a, b); } virtual double get_square () const { return _a * _b; } }; class Circle : public Figure { double _r; Circle (double r) : _r (r) {} public: static Circle* make (const std::string &str) { std::istringstream in (str); double r = 0; in >> r; return new Circle(r); } virtual double get_square () const { return M_PI * _r * _r; } };
fa3077f0c39fc580774dfb19da6192973c256bd6
d1cd0f3830b16fd0a51e583ae5e3d8cb25b532e4
/BeaverTetris/proj.win32/GamePlayersDatabase.cpp
e4d6573ef9f3b8d9b660ddc17b0f0806cecaf137
[]
no_license
sburavtsov/BeaverTetris
f5939afdfe417e1a5601b8e04db7d7b4ef21e5c7
fc28f5746b8c90073d82ca886d4d8e93d144897f
refs/heads/master
2021-01-18T08:55:59.364976
2014-12-18T19:46:51
2014-12-18T19:46:51
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,087
cpp
GamePlayersDatabase.cpp
#include "GamePlayersDatabase.h" using namespace std; bool sortFunction(const PlayerInformation &left, const PlayerInformation &right); GamePlayersDatabase::GamePlayersDatabase(void) { _players = vector <PlayerInformation>(); } GamePlayersDatabase::~GamePlayersDatabase(void) { } int GamePlayersDatabase::getPlayersCount() { return _players.size(); } string GamePlayersDatabase::getPlayerNameForIndex(int aIndex) { PlayerInformation player = _players[aIndex]; return player.playerName; } int GamePlayersDatabase::getPlayerScoreForIndex(int aIndex) { PlayerInformation player = _players[aIndex]; return player.playerScore; } void GamePlayersDatabase::setPlayerResult(std::string aPlayerName, int playerScore) { PlayerInformation player; player.playerName = aPlayerName; player.playerScore = playerScore; _players.push_back(player); } void GamePlayersDatabase::sortPlayers() { sort(_players.begin(), _players.end(), sortFunction); } bool sortFunction(const PlayerInformation &left, const PlayerInformation &right) { return (left.playerScore > right.playerScore); }
00947a89e136808d04a2c3ec4c0119bb7c5171ef
f4b88c1d810114149bb3479bdd460d6c5207b6a8
/src/common/platform/osx/Convert.cpp
4792df1f01edee12ed54dcc4955405c4cb7a8f2e
[ "Apache-2.0" ]
permissive
crupest/cru
f0523639f791074cb272835d6a3b367846c2a3a7
6b14866d4cb0e496d28142f3f42e5f2624d6dc77
refs/heads/main
2023-07-09T23:56:34.977412
2022-09-06T07:24:04
2022-09-06T07:24:04
147,010,144
3
0
Apache-2.0
2022-10-27T12:44:40
2018-09-01T15:28:58
C++
UTF-8
C++
false
false
739
cpp
Convert.cpp
#include "cru/common/platform/osx/Convert.h" namespace cru::platform::osx { CFStringRef Convert(const String& string) { return CFStringCreateWithBytes( nullptr, reinterpret_cast<const UInt8*>(string.data()), string.size() * sizeof(std::uint16_t), kCFStringEncodingUTF16, false); } String Convert(CFStringRef string) { auto length = CFStringGetLength(string); String result; for (int i = 0; i < length; i++) { result.AppendCodePoint(CFStringGetCharacterAtIndex(string, i)); } return result; } CFRange Convert(const Range& range) { return CFRangeMake(range.position, range.count); } Range Convert(const CFRange& range) { return Range(range.location, range.length); } } // namespace cru::platform::osx
b2b9dd57a44371f2aef7f33f445177bff688e95b
0eff74b05b60098333ad66cf801bdd93becc9ea4
/second/download/squid/gumtree/squid_repos_function_1729_last_repos.cpp
1e68b211969b4794c36d15231144aa05a6cc35d4
[]
no_license
niuxu18/logTracker-old
97543445ea7e414ed40bdc681239365d33418975
f2b060f13a0295387fe02187543db124916eb446
refs/heads/master
2021-09-13T21:39:37.686481
2017-12-11T03:36:34
2017-12-11T03:36:34
null
0
0
null
null
null
null
UTF-8
C++
false
false
68
cpp
squid_repos_function_1729_last_repos.cpp
static Initiators AllInitiators() { return 0xFFFFFFFF; }
ab9b6ee138ed2c55b46603e83824f07754541442
81b6521d8204a962b908094deb8998c291cdb07b
/codeforces/round360/a.cpp
2d4576acf5845e1a9eb6c80d983559b0a5d83a0e
[]
no_license
doldre/ACM
9c86c242a347e5b31daa365ddf0e835af7468fa9
23e4694fee51831831b1346b8ccc0e97eebef20a
refs/heads/master
2020-04-12T02:29:59.345719
2017-04-10T08:15:10
2017-04-10T08:15:10
55,833,991
3
0
null
null
null
null
UTF-8
C++
false
false
1,970
cpp
a.cpp
/************************************************ *Author :mathon *Email :luoxinchen96@gmail.com *************************************************/ #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #include <vector> #include <queue> #include <set> #include <map> #include <string> #include <cmath> #include <cstdlib> #include <ctime> #include <stack> using namespace std; typedef pair<int, int> pii; typedef long long ll; typedef unsigned long long ull; #define xx first #define lowbit(x) (x&-x) #define yy second #define pr(x) cout << #x << " " << x << " " #define prln(x) cout << #x << " " << x << endl const int maxn = 1e5 + 7; vector<int> G[maxn]; vector<int> ans[2]; int used[maxn]; int col[maxn]; bool suc = true; void dfs(int v, int color) { used[v] = true; col[v] = color; if(!suc) return; for (auto u: G[v]) { if(used[u] && col[u] == color) { suc = false; return; } else if(used[u] && col[u] != color) { continue; } else if(!used[u]) { dfs(u, !color); } } } int main(void) { #ifdef MATHON //freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout); #endif int n, m; scanf("%d%d", &n, &m); for (int i = 1; i <= m; i++) { int u, v; scanf("%d%d", &u, &v); G[u].push_back(v); G[v].push_back(u); } suc = true; for (int i = 1; i <= n; i++) { if(used[i] == false) { dfs(i, 0); } } if(!suc) { printf("-1\n"); } else { for (int i = 1; i <= n; i++) { ans[col[i]].push_back(i); } printf("%d\n", (int)ans[0].size()); for (auto x: ans[0]) { printf("%d ", x); } puts(""); printf("%d\n", (int)ans[1].size()); for (auto x: ans[1]) { printf("%d ", x); } puts(""); } return 0; }
af9db11405d900bbdb82d1ebf360b3a02add84cd
80be40b336ecc0e919f1b835a513d8b1db9fdee3
/examples/Chapter_4/rangeCheck.cpp
452176b1803e82d85fb68ab72563dfccc8c1f5ce
[]
no_license
Lwuuuuu/cpp_examples
ad3ad727f5febd3fd6f37aa14d2f73286e42490c
486830d0de0433dc6d00ff2b0b9eff7c08e92d1c
refs/heads/master
2020-09-02T07:33:16.296510
2020-01-27T00:15:37
2020-01-27T00:15:37
219,168,494
0
0
null
null
null
null
UTF-8
C++
false
false
1,646
cpp
rangeCheck.cpp
#include <iostream> #include <vector> #include <string> using namespace std; struct Entry { string name; int number; //Entry(string x, int y) :name{x}, number{y} {} }; ostream& operator<<(ostream& os, const Entry& e){ return os << "{\"" << e.name << "\", " << e.number << "}"; } istream& operator>>(istream& is, Entry& e){ char c, c2; if(is>>c && c == '{' && is>>c2 && c2 == '"') { //is>>c skips whitespace, eliminates the readings of { and the first " from cin string name; while(is.get(c) && c != '"') //Does not skip whitespace, so skips whitespace outside the name string, but not within. Reads the next bytes off the stream till " name += c; if (is >> c && c == ',') { int number = 0 ; if (is >> number >> c && c == '}') { e = {name,number}; return is; } } } is.setstate(ios_base::failbit); return is; } template<typename T> class Vec : public vector<T>{ public: using vector<T>::vector; //use the constructor from vector under the name Vec T& operator[](int i) //Range checking {return vector <T>::at(i);} // at() operation is a vector subscript operation that throws an exception of type out_of_range if its argument is out of range const T& operator[](int i) const //Range Checkign for const objects { return vector<T>::at(i);} }; int main() { Vec<Entry> phone_book = { {"David Hume", 123456}, {"Karl Popper", 234567}, {"Bertrand Arthur William Russell", 345678} }; cout << phone_book[5]; }
58ed6bdda5eeb37293cadedf53f86a04d6073c58
bb0024cb1e9242be34c58e14305c438bc9f1cf52
/compute.cpp
d6ea97e9fd171ba82b319d6e27fdb3a04662c8bf
[]
no_license
NYU-HPC21/lecture3
70528e97e309a2b8e99f7d4d4f95da1c998fead2
8a0dd8c8bfcd24c0a4fabff23bd0a7d231c6d1cb
refs/heads/master
2023-03-04T03:23:22.083858
2021-02-18T17:55:50
2021-02-18T17:55:50
340,127,912
0
0
null
null
null
null
UTF-8
C++
false
false
1,481
cpp
compute.cpp
// $ g++ -std=c++11 -O3 -march=native compute.cpp && ./a.out // $ g++ -std=c++11 -O3 -march=native compute.cpp -ftree-vectorize -fopt-info-vec-optimized && ./a.out -n 1000000000 #include <stdio.h> #include <math.h> #include "utils.h" #define CLOCK_FREQ 3.3e9 void compute_fn(double* A, double B, double C) { (*A) = (*A) * B + C; //(*A) = C / (*A); //(*A) = sqrt(*A); //(*A) = sin(*A); } int main(int argc, char** argv) { Timer t; long repeat = read_option<long>("-n", argc, argv); double A = 1.5; double B = 1./2; double C = 2.; t.tic(); for (long i = 0; i < repeat; i++) compute_fn(&A, B, C); printf("%f seconds\n", t.toc()); printf("%f cycles/eval\n", t.toc()*CLOCK_FREQ/repeat); printf("%f Gflop/s\n", 2*repeat/1e9/t.toc()); return A; } // Synopsis // // By design, this computation is such that only one fused-multiply-accumulate // instruction can execute at one time i.e. this computation cannot be // vectorized or pipelined. Therefor, this example can be used to measure // latency of operations. // // * Compare the observed latency with the expected latency for _mm256_fmadd_pd // instruction for your architecture from this link: // (https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm256_fmadd_pd&expand=2508) // // * Try replacing the mult-add operation with some other computation, like // division, sqrt, sin, cos etc. to measure the latency of those operations and // compare it with the latency of mult-add.
563972409d50bbf87a8d3054d999a3d426a099dc
a85512fec5ed090cc5d3c34158cc28deb68f16d2
/cube_row.h
4cfe9864945bcb08196149a8bf8d0938b9e8713e
[]
no_license
solven-eu/xmlaconnect
fb22595ae77df401c80e97baf77616e1e3199359
6c717b82421dc9f555c954ae6c2f6138856d144c
refs/heads/master
2022-01-27T03:35:13.004081
2016-01-26T12:49:12
2016-01-26T12:49:12
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,906
h
cube_row.h
/* ODBO provider for XMLA data stores Copyright (C) 2014-2015 ARquery LTD http://www.arquery.com This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. @description a row in the cube rowset */ #pragma once #include "soapH.h" class cube_row { private: static const size_t MAX_BUF_SIZE = 1024 * sizeof( wchar_t ); private: void copy( const cube_row& other ) { m_schema = nullptr; m_shema_updated_by = nullptr; m_data_updated_by = nullptr; ZeroMemory( &m_cube_guid, sizeof( m_cube_guid ) ); ZeroMemory( &m_creation_time, sizeof( m_creation_time ) ); m_last_data_update = m_last_schema_update = m_creation_time; m_drill_throught = other.m_drill_throught; m_catalog = _wcsdup( other.m_catalog ); m_cube = _wcsdup( other.m_cube ); m_cube_type = _wcsdup( other.m_cube_type ); m_description = _wcsdup( other.m_description ); } public: wchar_t* m_catalog; wchar_t* m_schema; wchar_t* m_cube; wchar_t* m_cube_type; GUID m_cube_guid; DBTIMESTAMP m_creation_time; DBTIMESTAMP m_last_schema_update; wchar_t* m_shema_updated_by; DBTIMESTAMP m_last_data_update; wchar_t* m_data_updated_by; wchar_t* m_description; DWORD m_drill_throught; cube_row( row& a_row ) { m_schema = nullptr; m_shema_updated_by = nullptr; m_data_updated_by = nullptr; ZeroMemory( &m_cube_guid, sizeof( m_cube_guid ) ); ZeroMemory( &m_creation_time, sizeof( m_creation_time ) ); m_last_data_update = m_last_schema_update = m_creation_time; m_catalog = _wcsdup( FROM_STRING( a_row.CATALOG_USCORENAME, CP_UTF8 ) ); m_cube = _wcsdup( FROM_STRING( a_row.CUBE_USCORENAME, CP_UTF8 ) ); m_cube_type = _wcsdup( FROM_STRING( a_row.CUBE_USCORETYPE, CP_UTF8 ) ); m_description = _wcsdup( FROM_STRING( a_row.DESCRIPTION, CP_UTF8 ) ); m_drill_throught = a_row.IS_USCOREDRILLTHROUGH_USCOREENABLED; } cube_row( const cube_row& other ) { copy( other ); } cube_row& operator=( const cube_row& other ) { if ( this != &other ) { copy( other ); } return *this; } ~cube_row() { delete[] m_catalog; delete[] m_cube; delete[] m_cube_type; delete[] m_description; } EMPTY_CONSTRUCTOR(cube_row); static char* schema_name() { return "MDSCHEMA_CUBES"; } BEGIN_PROVIDER_COLUMN_MAP( cube_row ) PROVIDER_COLUMN_ENTRY_VAR_WSTR( "CATALOG_NAME", 1, MAX_BUF_SIZE, m_catalog ) PROVIDER_COLUMN_ENTRY_VAR_WSTR( "SCHEMA_NAME", 2, MAX_BUF_SIZE, m_schema ) PROVIDER_COLUMN_ENTRY_VAR_WSTR( "CUBE_NAME", 3, MAX_BUF_SIZE, m_cube ) PROVIDER_COLUMN_ENTRY_VAR_WSTR( "CUBE_TYPE", 4, MAX_BUF_SIZE, m_cube_type ) PROVIDER_COLUMN_ENTRY_TYPE( "CUBE_GUID", 5, VT_CLSID, m_cube_guid ) PROVIDER_COLUMN_ENTRY_TYPE( "CREATED_ON", 6, DBTYPE_DBTIMESTAMP, m_creation_time ) PROVIDER_COLUMN_ENTRY_TYPE( "LAST_SCHEMA_UPDATE", 7, DBTYPE_DBTIMESTAMP, m_last_schema_update ) PROVIDER_COLUMN_ENTRY_VAR_WSTR( "SCHEMA_UPDATED_BY", 8, MAX_BUF_SIZE, m_shema_updated_by ) PROVIDER_COLUMN_ENTRY_TYPE( "LAST_DATA_UPDATE", 9, DBTYPE_DBTIMESTAMP, m_last_data_update ) PROVIDER_COLUMN_ENTRY_VAR_WSTR( "DATA_UPDATED_BY", 10, MAX_BUF_SIZE, m_data_updated_by ) PROVIDER_COLUMN_ENTRY_VAR_WSTR( "DESCRIPTION", 11, MAX_BUF_SIZE, m_description ) PROVIDER_COLUMN_ENTRY_TYPE( "IS_DRILLTHROUGH_ENABLED", 12, DBTYPE_BOOL, m_drill_throught ) END_PROVIDER_COLUMN_MAP() };
b3e0fded3da89fefbd6e826ba8285003add06075
a08836d65ae574ce124eacfd3476ce2d11352d7c
/MessageService.cpp
632768b0d40e9dd4f8f4a2f3c26cb0adefa97d81
[]
no_license
zhongwuzw/blmbusiness
28f70c51ee419a77d1bec357d646a0eaf50b772a
35646f450e8afd5cad6e6c74baf9187cc73c567c
refs/heads/master
2016-09-16T09:37:16.752879
2014-07-18T08:08:37
2014-07-18T08:08:37
20,587,830
1
0
null
null
null
null
GB18030
C++
false
false
2,836
cpp
MessageService.cpp
#include "MessageService.h" #include "MainConfig.h" #include "Message.h" #include "LogMgr.h" #include "CacheMgr.h" #include "ClientSocketMgr.h" #include "UniqueNumber.h" #include "IBusinessService.h" #include "ObjectPool.h" CMessageService::CMessageService(void) { } bool CMessageService::DoMessage(void* pMessage) { CMessage* pMsg = reinterpret_cast<CMessage*>(pMessage); const char* szUid = pMsg->GetMessageBase()->m_szUid; uint32 u4ConnectID = pMsg->GetMessageBase()->m_u4ConnectID; uint16 u2CommandID = pMsg->GetMessageBase()->m_u2Cmd; uint64 u8JobID = pMsg->GetMessageBase()->m_u8JobID; uint16 mt, st; SplitCommandID(u2CommandID, mt, st); IterMapBusinessSvc iter = m_mapSvc.find(mt); if(iter == m_mapSvc.end()) { DEBUG_LOG("[CMessageService::DoMessage] mid 0x%02x not found.", mt); pMsg->Clear(); g_MessagePool::instance()->Delete(pMsg); g_ClientSocketMgr::instance()->SendPacket(u4ConnectID, u8JobID, u2CommandID, MSG_FAIL, ACE_OS::strlen(MSG_FAIL)); return false; } bool bSucc = true; ACE_Message_Block* pRes = NULL; if(pMsg->GetMessageBody() != NULL) bSucc = iter->second->ExecuteCmd(szUid, st, pMsg->GetMessageBody()->rd_ptr()+8, pRes); else bSucc = iter->second->ExecuteCmd(szUid, st, NULL, pRes); if(pRes) { g_ClientSocketMgr::instance()->SendPacket(u4ConnectID, u8JobID, u2CommandID, pRes->rd_ptr(), pRes->length()); } else if(!bSucc) { g_ClientSocketMgr::instance()->SendPacket(u4ConnectID, u8JobID, u2CommandID, MSG_FAIL, ACE_OS::strlen(MSG_FAIL)); } pMsg->Clear(); g_MessagePool::instance()->Delete(pMsg); SAFE_RELEASE(pRes); return bSucc; } uint16 CMessageService::GetMessageCmd(void* pMessage) { CMessage* msg = reinterpret_cast<CMessage*>(pMessage); return msg->GetMessageBase()->m_u2Cmd; } bool CMessageService::RegisterCmd(uint16 u2Mid, IBusinessService* svc) { IterMapBusinessSvc iter = m_mapSvc.find(u2Mid); if(iter != m_mapSvc.end()) { DEBUG_LOG("[CMessageService::RegisterCmd] register mid failed: 0x%02x already registered.", u2Mid); return false; } svc->SetMid(u2Mid); m_mapSvc.insert(std::make_pair(u2Mid, svc)); return true; } int CMessageService::handle_timeout(const ACE_Time_Value &tv, const void *arg) { CheckMessagePool(); return 0; } void CMessageService::CheckMessagePool() { //检查消息池使用情况 SYSTEM_LOG("[MessagePool][Used:%d][Free:%d]", g_MessagePool::instance()->GetUsedCount(), g_MessagePool::instance()->GetFreeCount()); SYSTEM_LOG("[DBPool][Used:%d][Free:%d]", g_DBConnPool::instance()->GetUsedCount(), g_DBConnPool::instance()->GetFreeCount()); g_DBConnPool::instance()->ReduceTo(10); g_DBConnPoolBj::instance()->ReduceTo(3); }
4d5780d9facaff601fc14725ad57e289d252c6ea
ac507e24073717f0f2f43480101be5db0213c2c4
/pwiz/analysis/calibration/CalibratorTrial.cpp
ce064ecc3e6439ff18faafee8361ea9e051f9922
[ "LicenseRef-scancode-free-unknown", "Apache-2.0" ]
permissive
ProteoWizard/pwiz
7adbd5a276b49d5f0271eb8cfddbd6d21ee31318
f708f62d098c33ef60a76d92b038fde74361570a
refs/heads/master
2023-08-27T20:42:37.708268
2023-08-25T18:30:50
2023-08-25T18:30:50
124,952,577
185
92
Apache-2.0
2023-09-14T20:39:46
2018-03-12T21:16:01
C#
UTF-8
C++
false
false
12,620
cpp
CalibratorTrial.cpp
// // $Id$ // // // Darren Kessner <darren@proteowizard.org> // // Copyright 2009 Spielberg Family Center for Applied Proteomics // Cedars Sinai Medical Center, Los Angeles, California 90048 // // 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 "CalibratorTrial.hpp" #include "MassSpread.hpp" #include "pwiz/utility/chemistry/Ion.hpp" #include <iostream> #include <stdexcept> #include <fstream> #include <sstream> #include <iomanip> using namespace std; namespace pwiz { namespace calibration { CalibratorTrial::Configuration::Configuration() : massDatabase(0), calibratorIterationCount(0), errorEstimatorIterationCount(0), measurementError(0), initialErrorEstimate(0) {} void CalibratorTrial::Configuration::readTrialData(const string& filename) { ifstream is(filename.c_str()); if (!is) throw runtime_error("[CalibratorTrial::Configuration::readTrialData] Unable to open file " + filename); double measurementCount = 0; while (is) { string buffer; getline(is, buffer); if (!is) break; istringstream iss(buffer); string label; iss >> label; if (label == "parametersTrue") iss >> parametersTrue.A >> parametersTrue.B; else if (label == "parametersInitialEstimate") iss >> parametersInitialEstimate.A >> parametersInitialEstimate.B; else if (label == "measurementError") iss >> measurementError; else if (label == "initialErrorEstimate") iss >> initialErrorEstimate; else if (label == "measurementCount") iss >> measurementCount; else if (label == "measurement") { double mass=0, frequency=0; int charge=0; iss >> mass >> frequency >> charge; trueMasses.push_back(mass); measurements.push_back(Calibrator::Measurement(frequency, charge)); } } if (measurementCount != measurements.size()) throw runtime_error("[CalibratorTrial::Configuration::readTrialData()] Bad measurementCount."); } void CalibratorTrial::Configuration::writeTrialData(const string& filename) const { ofstream os(filename.c_str()); if (!os) throw runtime_error("[CalibratorTrial::Configuration::writeTrialData] Unable to open file " + filename); if (trueMasses.size() != measurements.size()) throw runtime_error("[CalibratorTrial::Configuration::writeTrialData] Mass count != measurement count."); double errorA = (parametersInitialEstimate.A - parametersTrue.A)/parametersTrue.A; double errorB = (parametersInitialEstimate.B - parametersTrue.B)/parametersTrue.B; os.precision(20); os << "parametersTrue " << parametersTrue.A << " " << parametersTrue.B << endl; os << "parametersInitialEstimate " << parametersInitialEstimate.A << " " << parametersInitialEstimate.B << endl; os << "parametersError " << errorA << " " << errorB << endl; os << "measurementError " << measurementError << endl; os << "initialErrorEstimate " << initialErrorEstimate << endl; os << "measurementCount " << measurements.size() << endl; for (unsigned int i=0; i<measurements.size(); i++) os << "measurement " << trueMasses[i] << " " << measurements[i].frequency << " " << measurements[i].charge << endl; } const char* StateHeader_ = " A B error(true/est/cal) id"; ostream& operator<<(ostream& os, const CalibratorTrial::State& state) { os << scientific << setprecision(4) << setfill(' ') << state.parameters.A << " " << state.parameters.B << " [ " << fixed << showpoint << setw(8) << state.errorTrue * 1e6 << " " << setw(8) << state.errorEstimate * 1e6 << " " << setw(8) << state.errorCalibration * 1e6 << " ] " << setprecision(2) << "( " << state.correct << " / " << state.confident << " )"; return os; } struct MassCalculation { int z; double f_obs; double mz_obs; double m_obs; double f_true; double mz_true; double m_true; double error_mass; double error_calibration; bool correct; bool confident; MassCalculation(const data::CalibrationParameters& parameters, const Calibrator::Measurement* measurement, const MassSpread* massSpread, const data::CalibrationParameters& trueParameters, double trueMass); }; MassCalculation::MassCalculation(const data::CalibrationParameters& parameters, const Calibrator::Measurement* measurement, const MassSpread* massSpread, const data::CalibrationParameters& trueParameters, double trueMass) : z(1), f_obs(0), mz_obs(0), m_obs(0), f_true(0), mz_true(0), m_true(trueMass), error_mass(0), error_calibration(0), correct(false), confident(false) { using namespace proteome; // for Ion if (!measurement) throw runtime_error("[CalibratorTrialImpl::MassCalculation::MassCalculation()] Null measurement."); z = measurement->charge; f_obs = measurement->frequency; mz_obs = parameters.mz(f_obs); m_obs = Ion::neutralMass(mz_obs, z); mz_true = Ion::mz(m_true, z); f_true = trueParameters.frequency(mz_true); error_mass = (m_obs - m_true)/m_true; double term1 = (parameters.A - trueParameters.A)/f_true; double term2 = (parameters.B - trueParameters.B)/(f_true*f_true); error_calibration = (term1 + term2)/mz_true; if (massSpread && !massSpread->distribution().empty()) { const MassSpread::Pair& id = massSpread->distribution()[0]; const double epsilon = 1e-8; const double confidenceThreshold = .95; if (fabs(id.mass-m_true) < epsilon) { correct = true; if (id.probability > confidenceThreshold) confident = true; } } } const char* MassCalculationHeader_ = " m_true z f m_calc error id distribution"; ostream& operator<<(ostream& os, const MassCalculation& mc) { os << fixed << setprecision(4) << setfill(' ') << setw(10) << mc.m_true << " " << setw(1) << mc.z << " " << setw(11) << mc.f_obs << " " << setw(10) << mc.m_obs << " " << setw(9) << mc.error_mass * 1e6 << " " << (mc.correct ? "*" : " ") << (mc.confident ? "!" : " "); return os; } class CalibratorTrialImpl : public CalibratorTrial { public: CalibratorTrialImpl(const Configuration& configuration); virtual void run(); virtual const Configuration& configuration() const {return config_;} virtual const Results& results() const {return results_;} private: Configuration config_; Results results_; auto_ptr<Calibrator> calibrator_; vector<MassCalculation> massCalculations_; void updateMassCalculations(); State state_; void updateState(); // logging ofstream osLog_; ofstream osSummary_; void initializeLogs(); void updateLogs(); void finalizeLogs(); }; auto_ptr<CalibratorTrial> CalibratorTrial::create(const Configuration& configuration) { return auto_ptr<CalibratorTrial>(new CalibratorTrialImpl(configuration)); } CalibratorTrialImpl::CalibratorTrialImpl(const Configuration& configuration) : config_(configuration) { if (!config_.massDatabase) throw runtime_error("[CalibratorTrialImpl::CalibratorTrialImpl] Null MassDatabase*"); if (config_.measurements.size() != config_.trueMasses.size()) throw runtime_error("[CalibratorTrialImpl::CalibratorTrialImpl()] Measurement size mismatch."); calibrator_ = Calibrator::create(*config_.massDatabase, config_.measurements, config_.parametersInitialEstimate, config_.initialErrorEstimate, config_.errorEstimatorIterationCount, config_.outputDirectory); updateState(); results_.initial = state_; initializeLogs(); updateLogs(); } void CalibratorTrialImpl::run() { for (int i=0; i<config_.calibratorIterationCount; i++) { calibrator_->iterate(); updateState(); updateLogs(); } results_.final = state_; finalizeLogs(); } void CalibratorTrialImpl::updateMassCalculations() { massCalculations_.clear(); for (int i=0; i<calibrator_->measurementCount(); i++) { massCalculations_.push_back(MassCalculation(calibrator_->parameters(), calibrator_->measurement(i), calibrator_->massSpread(i), config_.parametersTrue, config_.trueMasses[i])); } } void CalibratorTrialImpl::updateState() { updateMassCalculations(); double totalSquaredMassError = 0; double totalSquaredCalibrationError = 0; int totalCorrect = 0; int totalConfident = 0; for (vector<MassCalculation>::iterator it=massCalculations_.begin(); it!=massCalculations_.end(); ++it) { totalSquaredMassError += it->error_mass * it->error_mass; totalSquaredCalibrationError += it->error_calibration * it->error_calibration; totalCorrect += it->correct ? 1 : 0; totalConfident += it->confident ? 1 : 0; } int N = massCalculations_.size(); if (N <= 0) throw runtime_error("[CalibratorTrialImpl::updateState()] Zero calculations."); state_.parameters = calibrator_->parameters(); state_.errorTrue = sqrt(totalSquaredMassError / N); state_.errorEstimate = calibrator_->error(); state_.errorCalibration = sqrt(totalSquaredCalibrationError / N); state_.correct = (double)totalCorrect / N; state_.confident = (double)totalConfident / N; } void CalibratorTrialImpl::initializeLogs() { system(("mkdir " + config_.outputDirectory + " 2> /dev/null").c_str()); string filenameLog = config_.outputDirectory + "/ct.log.txt"; osLog_.open(filenameLog.c_str()); if (!osLog_) throw runtime_error(("[CalibratorTrial] Unable to open file: " + filenameLog).c_str()); osLog_ << fixed << setprecision(7); string filenameSummary = config_.outputDirectory + "/ct.summary.txt"; osSummary_.open(filenameSummary.c_str()); if (!osSummary_) throw runtime_error(("[CalibratorTrial] Unable to open file: " + filenameSummary).c_str()); osSummary_ << fixed << setprecision(7); osSummary_ << "#: " << StateHeader_ << endl; } void CalibratorTrialImpl::updateLogs() { osSummary_ << setw(2) << setfill('0') << calibrator_->iterationCount() << ": " << state_ << endl; osLog_ << "#: " << StateHeader_ << endl; osLog_ << setw(2) << setfill('0') << calibrator_->iterationCount() << ": " << state_ << endl << endl; osLog_ << MassCalculationHeader_ << endl; for (unsigned int i=0; i<massCalculations_.size(); i++) { osLog_ << massCalculations_[i] << " "; if (calibrator_->massSpread(i)) calibrator_->massSpread(i)->output(osLog_); osLog_ << endl; } osLog_ << endl; } void CalibratorTrialImpl::finalizeLogs() { osLog_ << " " << StateHeader_ << endl; osLog_ << "final: " << state_ << endl; } } // namespace calibration } // namespace pwiz
f88990f2408ed9bb846cece77abcd0c8cd9f8852
75b8fe31e669e1f79ebab2ea5d78eea52e26c2ec
/SortLearning.cpp
fc675b4cd41a9ba12f62ee75b7e5b8fe910b2f7b
[]
no_license
kinstep/SorltLearning
527d7359a62d078b15bf10a656b693d9f7c2ecde
b606f301b1b192fc8c0a15a39d1cd5c570d10eac
refs/heads/master
2020-04-05T22:50:31.638579
2014-09-30T01:54:25
2014-09-30T01:54:25
null
0
0
null
null
null
null
GB18030
C++
false
false
3,644
cpp
SortLearning.cpp
// SortLearning.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #define random(x) (rand()%x) typedef int KeyType; typedef struct { KeyType key; } RedType;//key words typedef struct { RedType r[21]; int length; } SqList; void InsertSort(SqList &q) { for(int i = 2; i < q.length; ++i)//从第二个开始比较,假设第一个为有序序列 { if(q.r[i].key < q.r[i - 1].key)//如果后面的较小,就是如果需要调整 { q.r[0] = q.r[i];//保存前面的 q.r[i] = q.r[i - 1];//后面的移到前面来 // 此时得到一个长度为一的有序序列 //其次将放入0的元素插入这个序列的相对位置 //从后面比较,如果小于则插入 int j = i - 2;//求得当前的有序串的长度,结尾位置 for(j; q.r[0].key < q.r[j].key; --j)//找到当前串中适合的位置插入 倒序查找 q.r[j + 1] = q.r[j];//当前串中的移动 //终止条件就是当移动到从尾部结算的第一个小于的元素时候的J的值 q.r[j + 1] = q.r[0]; } } } void QuestionOne()//求最长子数组之和 { int c[10] = {1, - 2, 3, 10, -4, 7, 2, -5}; int currentMax = 0, resultMax = 0; for(int i = 0; i < 10; i++) { currentMax = (c[i] > currentMax + c[i]) ? c[i] : currentMax + c[i]; resultMax = (resultMax > currentMax) ? resultMax : currentMax; } } void QuickSort(int *s, int l, int r)//快速排序 { if(l < r) { int i = l; int j = r; int listener = s[l]; while(i != j) { while(i < j && s[j] >= listener) { j--; }//直到后面有一个元素是小于listener if(i < j) s[i++] = s[j];//将这个元素放到这个位置 while(i < j && s[i] <= listener) { i++; }//直到有个元素是大于listener if(i < j) s[j--] = s[i];//就把这个元素放到后面,位置就是前面被移除元素的位置 } s[i] = listener;//这个元素的最终位置被确定了 QuickSort(s, l, j - 1); QuickSort(s, j + 1, r); } } void BubbleSort(int *c, int n) { for(int i = 0; i < 100 ; i++) { for(int j = 1; j < 100 - i ; j++) { if(c[j - 1] > c[j ]) { int temp = c[j ]; c[j ] = c[j - 1]; c[j - 1] = temp; } } } } void SelectSort(int *c, int n) { int temp = 0; for(int i = 0; i < n; i++) { temp = c[i] ; int key = i; for(int j = i + 1; j < n ; j++) { if(c[j] < temp) { temp = c[j]; key = j; } } c[key--] = c[i]; c[i] = temp; } } int _tmain(int argc, _TCHAR* argv[]) { SqList *q = (SqList*)malloc(sizeof(SqList)); q->length = 21; for(int i = 1; i < q->length; i++) { q->r[i].key = random(100); printf("%d_", q->r[i].key); } QuestionOne(); InsertSort(*q); int c[100] = {}; int b[100] = {}; for(int i = 0; i < 100; i++) { c[i] = b[i] = random(100); } // QuickSort(p, 0, 99); // BubbleSort(c, 100); SelectSort(c, 100); getchar(); return 0; }
ba04d8939b6278d2fa84f4657d2dbf9509e27aed
52ca17dca8c628bbabb0f04504332c8fdac8e7ea
/boost/fusion/container/deque/detail/cpp03/preprocessed/deque10_fwd.hpp
6e5d482ef5ab81c5b599c9916844f48b01cdc0e9
[]
no_license
qinzuoyan/thirdparty
f610d43fe57133c832579e65ca46e71f1454f5c4
bba9e68347ad0dbffb6fa350948672babc0fcb50
refs/heads/master
2021-01-16T17:47:57.121882
2015-04-21T06:59:19
2015-04-21T06:59:19
33,612,579
0
0
null
2015-04-08T14:39:51
2015-04-08T14:39:51
null
UTF-8
C++
false
false
106
hpp
deque10_fwd.hpp
#include "thirdparty/boost_1_58_0/boost/fusion/container/deque/detail/cpp03/preprocessed/deque10_fwd.hpp"
fda95e7a642999cfab272a266b28b54925bbab8e
aaafa1638fb3309b2073de4b3778ec05f3d2a15d
/1.9 QPushButton, QFocusFrame/myclass.cpp
3f75a7ea0f15da991c2bfd94ca0b5326216f5a89
[]
no_license
bemaru/QtStudy
8498d552fb2bd45a32ce738769cc0142dd0828ec
22455dce46fe55858365a0d483c6de5250b7e728
refs/heads/master
2021-04-03T08:31:41.185666
2018-03-21T04:07:17
2018-03-21T04:07:17
125,152,516
0
0
null
null
null
null
UTF-8
C++
false
false
890
cpp
myclass.cpp
#include "myclass.h" #include <QFocusFrame> MyClass::MyClass(QWidget *parent) : QMainWindow(parent) { ui.setupUi(this); int ypos = 30; for (int i = 0; i < 3; i++) { btn[i] = new QPushButton(QString("Frame's button %1").arg(i), this); btn[i]->setGeometry(10, ypos, 300, 40); ypos += 50; } connect(btn[0], SIGNAL(clicked()), this, SLOT(btn_clicked())); connect(btn[0], SIGNAL(pressed()), this, SLOT(btn_pressed())); connect(btn[0], SIGNAL(released()), this, SLOT(btn_released())); QFocusFrame* btn_frame = new QFocusFrame(this); btn_frame->setWidget(btn[0]); btn_frame->setAutoFillBackground(true); } MyClass::~MyClass() { } void MyClass::btn_clicked() { qDebug("Button Cliked"); } void MyClass::btn_pressed() { qDebug("Button Pressed"); } void MyClass::btn_released() { qDebug("Button Released"); }
b728401267ed6572b63f09e6b22e70d325cedfa7
b40424eca54777356edba1fd75ce5a227b0a3486
/Root/LinkDef.h
e4c5b4c7140af0a8b64cd03bfefcf86384fd1582
[]
no_license
gitter-badger/SusyCommon
469a424ee20a8c38baea7097313e3803ba9fbc77
5e0f8f477fe4803d02004d66073177cae0547362
refs/heads/master
2021-01-15T20:33:34.441664
2014-11-12T00:48:49
2014-11-12T00:48:49
41,424,151
0
0
null
2015-08-26T12:26:19
2015-08-26T12:26:17
C++
UTF-8
C++
false
false
596
h
LinkDef.h
#include <vector> #include "SusyCommon/SusyD3PDInterface.h" #include "SusyCommon/SusyD3PDAna.h" #include "SusyCommon/SusyD3PDSkimmer.h" #include "SusyCommon/SusyNtMaker.h" #include "SusyCommon/SusyMetValidation.h" #ifdef __CINT__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ nestedclass; #pragma link C++ nestedtypedef; #pragma link C++ class SusyD3PDInterface; #pragma link C++ class SusyD3PDAna; #pragma link C++ class SusyD3PDSkimmer; #pragma link C++ class SusyNtMaker; #pragma link C++ class SusyMetValidation; #endif
2e0d22d1eccb3533fbc3cd9f5942b6ae30c9ba66
f0a26ec6b779e86a62deaf3f405b7a83868bc743
/Engine/Source/Runtime/Engine/Classes/Sound/SoundNodeDeprecated.h
7e75880ec8a482b1565dcd4c8dedd0be3c401f44
[]
no_license
Tigrouzen/UnrealEngine-4
0f15a56176439aef787b29d7c80e13bfe5c89237
f81fe535e53ac69602bb62c5857bcdd6e9a245ed
refs/heads/master
2021-01-15T13:29:57.883294
2014-03-20T15:12:46
2014-03-20T15:12:46
18,375,899
1
0
null
null
null
null
UTF-8
C++
false
false
391
h
SoundNodeDeprecated.h
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved. /** * An intermediary class to parent all deprecated sound nodes from to easily * restrict them from being placed on a sound canvas */ #pragma once #include "SoundNodeDeprecated.generated.h" UCLASS(deprecated, abstract, MinimalAPI) class UDEPRECATED_SoundNodeDeprecated : public USoundNode { GENERATED_UCLASS_BODY() };
f56b9853d0c2526ca0a7d7f9df4f28064af835bf
ea6040428c439582eb6e40978fc924174cf85d85
/Major.cpp
a78c18c837ed3340b3aae3cd23474184e02516de
[]
no_license
Ming45/management
7a35a16d8624cfb117d8bc9e860f1c6f09c4b69f
55ecf7e71ae948a95a05b5377c71ebe6e02846e5
refs/heads/main
2023-02-10T02:30:47.851017
2021-01-06T15:10:51
2021-01-06T15:10:51
327,346,150
0
0
null
null
null
null
GB18030
C++
false
false
601
cpp
Major.cpp
#include"mymanage.h" /* Major* Major::findmname(char* name) { for (Major* p = head; p->next != end; p = p->next) if (!strcmp(p->next->mname, name))return p;//strcmp函数是string compare(字符串比较)的缩写,用于比较两个字符串并根据比较结果返回整数。 //基本形式为strcmp(str1,str2),若str1=str2,则返回零;若str1<str2,则返回负数;若str1>str2,则返回正数 return NULL; } Major* Major::findmid(char* Id) { for (Major* p = head; p->next != end; p = p->next) if (!strcmp(p->next->mid, Id))return p; return NULL; }*/
af1dab24e5e6e3114bdbe7325ef16f76f62e1ddc
7f771b3bfbad58465c612b46fa2da0b632ae055a
/QuizGameBeta.cpp
370c273d8b1fe1b960e0265310403983ffe2be0b
[]
no_license
bebo999/quiz-game
854ee6b60160f170b9f4af04849af5d3ea4a8e6c
d2c6ad4502327405a44c5a4d7727191d974e2f3b
refs/heads/master
2020-06-16T13:21:38.115671
2019-07-06T23:06:20
2019-07-06T23:06:20
195,589,994
0
0
null
null
null
null
UTF-8
C++
false
false
2,951
cpp
QuizGameBeta.cpp
#include <fstream> #include<stdio.h> #include <string> #include <iostream> using namespace std; void sports(string c[100]) { int i=0,score=i,b=i; int ans; int correct[4]={3,1,1,4}; for(i=0;i<4;i++) { cout<<c[b]<<'\n'; cout<<c[b+1]<<'\n'; cout<<c[b+2]<<'\n'; cout<<c[b+3]<<'\n'; cout<<c[b+4]<<'\n'; cin>>ans; b=b+5; if(ans==correct[i]) { score=score+10; cout<<"Correct answer the score is: "<<score<<endl; } else cout<<"Wrong answer"<<endl; } cout<<"The final score is "<<score<<endl; } void geo(string c[100]) { int i=0,score=i,b=i; int ans; int correct[5]={2,1,4,1,2}; for(i=0;i<5;i++) { cout<<c[b]<<'\n'; cout<<c[b+1]<<'\n'; cout<<c[b+2]<<'\n'; cout<<c[b+3]<<'\n'; cout<<c[b+4]<<'\n'; cin>>ans; b=b+5; if(ans==correct[i]) { score=score+10; cout<<"Correct answer the score is: "<<score<<endl; } else cout<<"Wrong answer"<<endl; } cout<<"The final score is "<<score<<endl; } void ent(string c[100]) { int i=0,score=i,b=i; int ans; int correct[5]={3,2,3,1,4}; for(i=0;i<5;i++) { cout<<c[b]<<'\n'; cout<<c[b+1]<<'\n'; cout<<c[b+2]<<'\n'; cout<<c[b+3]<<'\n'; cout<<c[b+4]<<'\n'; cin>>ans; b=b+5; if(ans==correct[i]) { score=score+10; cout<<"Correct answer the score is: "<<score<<endl; } else cout<<"Wrong answer"<<endl; } cout<<"The final score is "<<score<<endl; } void history(string c[100]) { int i=0,score=i,b=i; int ans; int correct[4]={1,3,2,1}; for(i=0;i<4;i++) { cout<<c[b]<<'\n'; cout<<c[b+1]<<'\n'; cout<<c[b+2]<<'\n'; cout<<c[b+3]<<'\n'; cout<<c[b+4]<<'\n'; cin>>ans; b=b+5; if(ans==correct[i]) { score=score+10; cout<<"Correct answer the score is: "<<score<<endl; } else cout<<"Wrong answer"<<endl; } cout<<"The final score is "<<score<<endl; } void quiz(string y,string (&c)[100]) { int i=0; string line; ifstream file(y); if (file.is_open()) { while(getline(file,line)) { c[i]=line; i++; } file.close(); } } int main() { loop1:int x; cout<<"please select the quiz genre:\n 1-Sports\t 2-Geography\n3-Entertainment\t 4-History"<<endl; cin>>x; string c[100]; if(x==1) {string y="sports.txt"; quiz(y,c); sports(c); } else if(x==2) {string y="geo.txt"; quiz(y,c); geo(c); } else if(x==3) {string y="ent.txt"; quiz(y,c); ent(c); } else { string y="history.txt"; quiz(y,c); history(c); } int select; cout<<"To play again enter 1 or enter any other key to exit\n "; cin>>select; if(select==1) { goto loop1; } cout<<"Thank you for playing"<<endl; }
e3055ab9e53b6163f484fa7c9bea977741e67b48
c04b33824d1f70602b8439654c0c52d23e42fb8e
/napi-async-inl.h
1fabc89ad8251d37f718f5fd86021135befd452d
[ "MIT" ]
permissive
ebickle/node-addon-api-async-poc
f57ff1766633150077605008a71c5964f142b2a4
236b450e96a100dc7e0d563dbc0440331afd892c
refs/heads/master
2021-04-26T22:43:32.405006
2018-03-06T22:37:32
2018-03-06T22:37:32
124,136,811
0
0
null
null
null
null
UTF-8
C++
false
false
3,119
h
napi-async-inl.h
#ifndef SRC_NAPI_ASYNC_POC_INL_H_ #define SRC_NAPI_ASYNC_POC_INL_H_ namespace Napi { // Helpers to handle functions exposed from C++. namespace details { #ifdef NAPI_CPP_EXCEPTIONS // When C++ exceptions are enabled, Errors are thrown directly. There is no need // to return anything after the throw statement. The variadic parameter is an // optional return value that is ignored. #define NAPI_THROW_IF_FAILED(env, status, ...) \ if ((status) != napi_ok) throw Error::New(env); #else // NAPI_CPP_EXCEPTIONS // When C++ exceptions are disabled, Errors are thrown as JavaScript exceptions, // which are pending until the callback returns to JS. The variadic parameter // is an optional return value; usually it is an empty result. #define NAPI_THROW_IF_FAILED(env, status, ...) \ if ((status) != napi_ok) { \ Error::New(env).ThrowAsJavaScriptException(); \ return __VA_ARGS__; \ } #endif // NAPI_CPP_EXCEPTIONS } // namespace details //////////////////////////////////////////////////////////////////////////////// // AsyncWork class //////////////////////////////////////////////////////////////////////////////// inline AsyncWork::AsyncWork(Napi::Env env, AsyncWorkExecuteCallback execute, AsyncWorkCompleteCallback complete, void* data) : _env(env), _execute(execute), _complete(complete), _data(data) { napi_value resource_id; napi_status status = napi_create_string_latin1( env, "generic", NAPI_AUTO_LENGTH, &resource_id); NAPI_THROW_IF_FAILED(env, status); napi_async_work work; status = napi_create_async_work( env, nullptr, resource_id, OnExecute, OnComplete, this, &work); NAPI_THROW_IF_FAILED(env, status); } inline AsyncWork::~AsyncWork() { napi_delete_async_work(_env, _work); } inline AsyncWork::AsyncWork(AsyncWork&& other) { _env = other._env; other._env = nullptr; _work = other._work; other._work = nullptr; } inline AsyncWork& AsyncWork::operator =(AsyncWork&& other) { _env = other._env; other._env = nullptr; _work = other._work; other._work = nullptr; return *this; } inline AsyncWork::operator napi_async_work() const { return _work; } inline Napi::Env AsyncWork::Env() const { return _env; } inline void AsyncWork::Queue() { napi_status status = napi_queue_async_work(_env, _work); NAPI_THROW_IF_FAILED(_env, status); } inline void AsyncWork::Cancel() { napi_status status = napi_cancel_async_work(_env, _work); NAPI_THROW_IF_FAILED(_env, status); } inline void AsyncWork::OnExecute(napi_env env, void* data) { AsyncWork* self = static_cast<AsyncWork*>(data); self->_execute(self->_data); } inline void AsyncWork::OnComplete(napi_env env, napi_status status, void* data) { AsyncWork* self = static_cast<AsyncWork*>(data); HandleScope scope(env); details::WrapCallback([&] { self->_complete(env, self->_data); return nullptr; }); } } // namespace Napi #endif // SRC_NAPI_ASYNC_POC_INL_H_
3d92e6e0f27891a9f43d80e21a6fcaeb2ad95069
30bdd8ab897e056f0fb2f9937dcf2f608c1fd06a
/DP/93.cpp
d0c55affefcdb7687acb585cc8e4c50846316759
[]
no_license
thegamer1907/Code_Analysis
0a2bb97a9fb5faf01d983c223d9715eb419b7519
48079e399321b585efc8a2c6a84c25e2e7a22a61
refs/heads/master
2020-05-27T01:20:55.921937
2019-11-20T11:15:11
2019-11-20T11:15:11
188,403,594
2
1
null
null
null
null
UTF-8
C++
false
false
567
cpp
93.cpp
#include<iostream> #include<cstdio> #include<algorithm> #include<cmath> #define ll long long using namespace std; int n,m,a[200],b[200],bo=1,gi=1,s; int main(){ cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; cin>>m; for(int i=1;i<=m;i++) cin>>b[i]; sort(a+1,a+n+1);sort(b+1,b+1+m); while(1){ if(bo>n||gi>m) break; if(a[bo]>=b[gi]){ if(a[bo]-b[gi]<=1){ s++; bo++;gi++; } else gi++; } else{ if(b[gi]-a[bo]<=1){ s++; bo++;gi++; }else bo++; } } cout<<s; return 0; }
9ea1fadb60aeae5d8b501828ced04f21b4e4c65c
225b9a9ce807b669f5da0224b374bbf496d0bc70
/数学/多项式/FWT/test20191112bitop.cpp
5d462699becd8e058cb385aa322c8be9758800da
[]
no_license
Kewth/OJStudy
2ed55f9802d430fc65647d8931c028b974935c03
153708467133338a19d5537408750b4732d6a976
refs/heads/master
2022-08-15T06:18:48.271942
2022-07-25T02:18:20
2022-07-25T02:18:20
172,679,963
6
2
null
null
null
null
UTF-8
C++
false
false
34
cpp
test20191112bitop.cpp
../../../test/2019/11/12/bitop.cpp
2f55ab3030b289e74ad507c717414636b2a24f99
c50c4796cc416e78ef2c8883899d12f1d4e0a9e8
/RPG/ICombatable.h
c5f0d759ecdc66d425144bf250d6c1caa47184bf
[ "MIT" ]
permissive
kriskirov/RPG-Remote
052b5c9eb24a1f61415def3cb3d72e0d30489a49
f446f5461ad38267ed3a34dc80e8bd807ae29ef9
refs/heads/master
2021-01-20T01:19:10.416123
2017-05-09T11:37:42
2017-05-09T11:37:42
89,253,403
0
0
null
null
null
null
UTF-8
C++
false
false
411
h
ICombatable.h
#ifndef I_COMBATABLE_H #define I_COMBATABLE_H #include "IIdentifiable.h" #include "IStatistics.h" #include "ITriggerable.h" class ICombatable : public IIdentifiable, public IStatistics, public ITriggerable { public: virtual void dealDamage(ICombatable& target, ICombatable& dealer) = 0; virtual void takeDamage(float amount, ICombatable* attacker) = 0; virtual ICombatable* getLastAttacker() = 0; }; #endif
de435c1033c2c0b7205a6e72ea76979060b40bf9
41304bc18523492086aaff272ca93e2afe0d43fb
/Linearalgebra/myexception.h
1f62dc0f1360e604b3b74127953b608a4f971d24
[]
no_license
rejie/Linearalgebra
d0e4064ae02744d758fa91ea966f011960068bb6
11133ae00c21e1d4b7da4615ef1ec1d124753fda
refs/heads/master
2021-01-19T17:42:26.046423
2015-04-25T14:21:35
2015-04-25T14:21:35
33,907,374
0
0
null
null
null
null
UTF-8
C++
false
false
211
h
myexception.h
#ifndef MYEXCEPTION_H #define MYEXCEPTION_H #include <stdexcept> class MyException : public std::runtime_error { public: MyException(const char* msg) : std::runtime_error(msg) {} }; #endif // EXCEPTION_H
6f89a3ed4434797dd10d66abea0fc869d191d652
e244777fbd8cb599c9c0cb150e0165cfdce3b7f6
/Chapter5/5_2 조건문 if/5_2 조건문 if.cpp
7cedbd1a94f2df68ac717135f2c5232f0e210908
[]
no_license
leeyunhome/tbcpp_0909
0a93d9ccfc9f6cf9fb8a9e3f809991b20f17fdf1
2741fc3dfc6533538aab426f71cd1a5791517515
refs/heads/master
2023-01-20T21:26:20.301338
2020-12-03T19:37:51
2020-12-03T19:37:51
293,912,840
1
0
null
null
null
null
UTF-8
C++
false
false
552
cpp
5_2 조건문 if.cpp
// 5_2 조건문 if.cpp : This file contains the 'main' function. Program execution begins and ends there. // #include <iostream> using namespace std; int main() { int x; cin >> x; if (x > 10) cout << "x is greater than 10" << endl; else if (x < 10) cout << "x is less than 10" << endl; else // if (x == 10 cout << "x is exactly 10" << endl; /*if (x > 10) { cout << x << " is greater than 10" << endl; cout << "Test 1" << endl; } else { cout << x << " is not greater than 10" << endl; cout << "Test 1" << endl; }*/ }
e8332450a0a0cbf4dc4ab1058e7a3868e3eab6ae
553e050f44bc5058b99c91a3ba0e6d2fd53b1933
/QuadTreee/Nodo.h
063ebff529178e64d5c9010f45b83effaea19e36
[]
no_license
esmarienkafer/BelieveWhatUC
668b91136e0d70d2baf6d1fbdd7e8b0514007e8c
6c57c0629cb4973a9642c223932ae98dcdb1c1a9
refs/heads/master
2022-09-21T00:35:35.946601
2017-05-19T23:37:32
2017-05-19T23:37:32
null
0
0
null
null
null
null
UTF-8
C++
false
false
514
h
Nodo.h
#ifndef NODO_H_ #define NODO_H_ #include <iostream> using namespace std; template <class T> class Nodo { private: Nodo<T> *prox; T elem; public: ///Constructores Nodo<T>(): prox(NULL), elem() {} Nodo<T>(T elemento, Nodo<T> *p): prox(p), elem(elemento){} Nodo<T>(T elemento): prox(NULL), elem(elemento){} ///Observadores T get_info() {return elem;} Nodo<T> *get_sig() {return prox;} /// Modificadores void set_info(T elemento) {elem=elemento;} void set_sig(Nodo<T> *p) {prox = p;} }; #endif
b53823225c495cd5864f2d468d4d1e860d3fba93
775acebaa6559bb12365c930330a62365afb0d98
/source/public/interfaces/incopy/ITextAreaPrefsData.h
bdc700f91c61c41539dc00eb58f7f8c781018bcf
[]
no_license
Al-ain-Developers/indesing_plugin
3d22c32d3d547fa3a4b1fc469498de57643e9ee3
36a09796b390e28afea25456b5d61597b20de850
refs/heads/main
2023-08-14T13:34:47.867890
2021-10-05T07:57:35
2021-10-05T07:57:35
339,970,603
1
1
null
2021-10-05T07:57:36
2021-02-18T07:33:40
C++
UTF-8
C++
false
false
2,947
h
ITextAreaPrefsData.h
//======================================================================================== // // $File: //depot/devtech/16.0.x/plugin/source/public/interfaces/incopy/ITextAreaPrefsData.h $ // // Owner: psorrick // // $Author: pmbuilder $ // // $DateTime: 2020/11/06 13:08:29 $ // // $Revision: #2 $ // // $Change: 1088580 $ // // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved. // // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance // with the terms of the Adobe license agreement accompanying it. If you have received // this file from a source other than Adobe, then your use, modification, or // distribution of it requires the prior written permission of Adobe. // //======================================================================================== #pragma once #ifndef __ITextAreaPrefsData__ #define __ITextAreaPrefsData__ #include "IPMUnknown.h" #include "PMRect.h" #include "InCopyCoreID.h" #include "ITextAreaPrefs.h" /** This interface is used to cache data for creating document or document styles related commands including kInCopyNewDocCmdBoss, kDocEditPresetCmdBoss, kSaveDocumentPresetDataCmdBoss, kSetTextAreaPrefsCmdBoss */ class ITextAreaPrefsData : public IPMUnknown { public: /** Define the default IID for ITextAreaPrefsData. */ enum { kDefaultIID = IID_ITEXTAREAPREFSDATA }; virtual void Set(UIDRef docref, const PMReal width, const PMReal depth,const ITextAreaPrefs::TextAreaDepthUnit unitIndex) =0; /** SetDocument indicating the document to set the ITextAreaPrefs. not setting the document means to set the ITextAreaPrefs in session workspace @param docref refers to the document to set the ITextAreaPrefs . @return void. */ virtual void SetDocument(UIDRef docref) = 0; /** Get the document UIDRef @return UIDRef of document */ virtual UIDRef GetDocument() const = 0; /** Set the width of text area. @param width the width of the text area @return void. */ virtual void SetTextAreaWidth(const PMReal width) = 0; /** Get the width of text area. @return const the width of the text area */ virtual PMReal GetTextAreaWidth() const = 0; /** Set the depth of text area. @param depth the depth of the text area @return void. */ virtual void SetTextAreaDepth(const PMReal depth) = 0; /** Get the depth of text area. @return const the depth of the text area */ virtual PMReal GetTextAreaDepth() const = 0; /** Set the unit index for the depth of text area. @param unitIndex the index of unit for the depth of the text area @return void. */ virtual void SetTextAreaDepthUnit(const ITextAreaPrefs::TextAreaDepthUnit unitIndex) = 0; /** Get the unit idnex of depth of text area. @return const the unit index of depth of the text area */ virtual ITextAreaPrefs::TextAreaDepthUnit GetTextAreaDepthUnit() const = 0; }; #endif
fee0a4b0d38fdc728734c490d8cbfa320932a874
6f9a1c7aca3b414b80cbdda95f606e7968492211
/code_practise/leetcode/00239.cpp
c00914cb177ae13731561db6aedc3b0e8f7e1437
[]
no_license
junlong-gao/recreations
dee02a5a6497c4f7613b5b785505616d509dcb9c
357f74eb4cac2e2a6d52a10cd322e1a5752b6347
refs/heads/master
2023-08-03T09:13:01.534095
2023-08-01T21:38:30
2023-08-01T21:38:30
92,252,559
1
2
null
null
null
null
UTF-8
C++
false
false
631
cpp
00239.cpp
class Solution { struct pt { int idx; int val; }; public: vector<int> maxSlidingWindow(vector<int>& nums, int k) { deque<pt> q; vector<int> ret; for (int i = 0; i <nums.size(); ++i) { while (q.size() > 0 && q.back().val <= nums[i]) { q.pop_back(); } q.push_back(pt{i, nums[i]}); while (q.size() > 0 && q.front().idx + k <= i) { q.pop_front(); } if (i + 1 >= k) { ret.push_back(q.front().val); } } return ret; } };
8b84d28787bc5e6f282ef748883a4bc7f671b84b
6263e3b901cb116b8ae0851f29da419089d8f07d
/src/Inst/Cst.cpp
c248d07ab720d0a50064cffa58dbd05c90c0431e
[ "Apache-2.0" ]
permissive
hleclerc/Sane_inter
e90079a3d3b501d13925581a66d2c0b5a7401f66
a9dc649ef88ac99f32ca16b95f3b6f2afbd55ed3
refs/heads/master
2021-04-25T13:09:30.203723
2018-01-17T16:20:45
2018-01-17T16:20:45
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,139
cpp
Cst.cpp
#include "../System/byte_swap.h" #include "../System/Memcpy.h" #include "../Codegen/Codegen.h" #include "../Type.h" #include "../gvm.h" #include "Cst.h" Cst::Cst( Type *type, int size, void *val, void *kno ) : type( type ), val( size ), kno( size ) { if ( val ) memcpy( this->val.data, val, ( size + 7 ) / 8 ); else this->val.set( false ); if ( kno ) memcpy( this->kno.data, kno, ( size + 7 ) / 8 ); else this->kno.set( bool( val ) ); } Cst::Cst( AttrClone, const Cst *cst ) : type( cst->type ), val( cst->val ), kno( cst->kno ) { } void Cst::write_inline_code( StreamPrio &ss, Codegen &cg, int nout, int flags ) { if ( ! kno.all_false() ) type->write_cst( ss.stream, val.data, 0, false ); else ss << "{}"; } void Cst::write_to_stream( std::ostream &os, SI32 nout, Type *type, int offset ) const { if ( type ) type->write_cst( os, val.data + offset / 8, offset % 8 ); else this->type->write_cst( os, val.data, 0 ); } Inst::AsFunc Cst::get_assign_func( int nout, int off, int len ) { return [this,off,len]( const PI8 *data ) { memcpy_bit( val.data, off, data, 0, len ); memset_bit( kno.data, off, true, len ); }; } void Cst::write_dot( std::ostream &os ) const { type->write_cst( os, val.data, 0 ); } void Cst::get_bytes( int nout, void *dst, int beg_dst, int beg_src, int len, void *msk ) const { if ( PI32( beg_src ) >= val.size ) return; if ( PI32( beg_src + len ) > val.size ) len = val.size - beg_src; memcpy_bit( dst, beg_dst, val.data, beg_src, len, msk ); memset_bit( msk, beg_dst, false, len ); } Type *Cst::out_type( int nout ) const { return type; } int Cst::nb_outputs() const { return 1; } Value make_Cst_PI64( PI64 val ) { if ( gvm->reverse_endianness ) val = byte_swaped( val ); return { new Cst( gvm->type_PI64, 64, &val ), 0, gvm->type_PI64 }; } Value make_Cst_SI64( SI64 val ) { if ( gvm->reverse_endianness ) val = byte_swaped( val ); return { new Cst( gvm->type_SI64, 64, &val ), 0, gvm->type_SI64 }; } Value make_Cst_PI32( PI32 val ) { if ( gvm->reverse_endianness ) val = byte_swaped( val ); return { new Cst( gvm->type_PI32, 32, &val ), 0, gvm->type_PI32 }; } Value make_Cst_SI32( SI32 val ) { if ( gvm->reverse_endianness ) val = byte_swaped( val ); return { new Cst( gvm->type_SI32, 32, &val ), 0, gvm->type_SI32 }; } Value make_Cst_PI16( PI16 val ) { if ( gvm->reverse_endianness ) val = byte_swaped( val ); return { new Cst( gvm->type_PI16, 16, &val ), 0, gvm->type_PI16 }; } Value make_Cst_SI16( SI16 val ) { if ( gvm->reverse_endianness ) val = byte_swaped( val ); return { new Cst( gvm->type_SI16, 16, &val ), 0, gvm->type_SI16 }; } Value make_Cst_PI8 ( PI8 val ) { return { new Cst( gvm->type_PI8 , 8, &val ), 0, gvm->type_PI8 }; } Value make_Cst_SI8 ( SI8 val ) { return { new Cst( gvm->type_SI8 , 8, &val ), 0, gvm->type_SI8 }; } Value make_Cst_Bool( Bool val ) { return { new Cst( gvm->type_Bool, 1, &val ), 0, gvm->type_Bool }; } Value make_Cst( Type *type ) { return { new Cst( type, type->content.data.size ), 0, type }; }
6060d6e8c24de89ad3b727bb4732e94ef9bf7185
7cf0159bb5a0be127e80f71dc6c080499c5ecbe1
/src/linux_platform.cpp
e255978aea380f952cf4fc51f1c5379ba50b7953
[]
no_license
AnTAVR/Kleos
796e68feacb99911cd8d7a00c1bdc0b4496c4035
e53214a39ad9d91f103930bbfe95d4c6a0818824
refs/heads/master
2022-04-02T21:21:13.238229
2020-02-04T06:16:00
2020-02-04T06:16:00
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,492
cpp
linux_platform.cpp
#include "linux_platform.h" #include "main.h" #include <dlfcn.h> #include <iostream> // #if WINDOWS // #include <SDL.h> // #else #include "sdl_common.h" // #endif /* functions related to windows specific platform */ bool WindowSetup(SDL_Window **mainWindow, const char *programName) { // Initialize SDL's video subsystem if (SDL_Init(SDL_INIT_VIDEO) < 0) { std::cout << "Failed to init SDL\n"; return false; } *mainWindow = SDL_CreateWindow(programName, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_OPENGL); if (mainWindow == nullptr) { std::cout << "Unable to create window\n"; CheckSDLError(__LINE__); return false; } return true; } bool WindowsSDLTTFSetup() { if (TTF_Init() < 0) { printf("TTF failed to init\n"); return false; } printf("TTF init complete\n"); return true; } bool WindowsOpenGLSetup(SDL_Window *mainWindow, SDL_GLContext *mainContext) { /* create our opengl context and attach it to our window */ *mainContext = SDL_GL_CreateContext(mainWindow); /* This needs to be after the create context in linux for some reason ? */ _setOpenGLSettings(); /* initialize to start using opengl */ glewExperimental = GL_TRUE; GLenum glewError = glewInit(); GLenum err; if ((err = glGetError()) != GL_NO_ERROR) { /* Ignore GL_INVALID_ENUM. There are cases where using glewExperimental * can cause a GL_INVALID_ENUM, which is fine -- just ignore it. * Otherwise, we do have a problem. */ if (err != GL_INVALID_ENUM) { printf("OpenGL: found true error x%x\n", err); } } if (glewError != GLEW_OK) { std::cout << "Error initializing GLEW! " << glewGetErrorString(glewError) << std::endl; return false; } if (SDL_GL_SetSwapInterval(1) < 0) { printf("Warning: Unable to set VSync! SDL Error: %s\n", SDL_GetError()); } /* clean up the screen */ glClearColor(0.0, 0.0, 0.0, 1.0); glClear(GL_COLOR_BUFFER_BIT); SDL_GL_SwapWindow(mainWindow); return true; } void _setOpenGLSettings() { // Set our OpenGL version. // SDL_GL_CONTEXT_CORE gives us only the newer version, deprecated functions // are disabled SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); // Turn on double buffering with a 24bit Z buffer. // You may need to change this to 16 or 32 for your system SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); // This makes our buffer swap syncronized with the monitor's vertical // refresh SDL_GL_SetSwapInterval(1); } void CheckSDLError(int /*line*/) { std::string error = SDL_GetError(); /* TODO: Do something here */ SDL_ClearError(); } void WindowsCleanup(SDL_Window *mainWindow, SDL_GLContext *mainContext) { SDL_GL_DeleteContext(mainContext); SDL_DestroyWindow(mainWindow); TTF_Quit(); SDL_Quit(); } void *LinuxLoadFunction(void *LibHandle, const char *Name) { void *Symbol = dlsym(LibHandle, Name); if (Symbol == nullptr) { fprintf(stderr, "dlsym failed: %s\n", dlerror()); } return Symbol; } static void *LinuxLoadLibrary(const char *LibName) { void *Handle = nullptr; Handle = dlopen(LibName, RTLD_NOW | RTLD_LOCAL); if (Handle == nullptr) { fprintf(stderr, "dlopen failed: %s\n", dlerror()); } return Handle; } static void LinuxUnloadLibrary(void *Handle) { if (Handle != nullptr) { dlclose(Handle); Handle = nullptr; } } bool LoadDLLWindows(RenderAPI *renderAPI) { const char *DLLName = "./libupdate_and_render.so"; renderAPI->libHandle = LinuxLoadLibrary(DLLName); if (renderAPI->libHandle == nullptr) { printf("Failed to load library! \n"); return false; } *reinterpret_cast<void **>(&renderAPI->updateAndRender) = LinuxLoadFunction(renderAPI->libHandle, "UpdateAndRender"); if (renderAPI->updateAndRender == nullptr) { printf("Failed to load function \"UpdateAndRender\"!\n"); return false; } return true; } /* HELPER FUNCTIONS */ void PrintSDLTTFVersion() { const SDL_version *linkedVersion = TTF_Linked_Version(); SDL_version compiledVersion{}; SDL_TTF_VERSION(&compiledVersion); std::cout << "Linked version:\n" << linkedVersion->major << "." << linkedVersion->minor << "." << linkedVersion->patch; std::cout << "Compiled version:\n" << compiledVersion.major << "." << compiledVersion.minor << "." << compiledVersion.patch << std::endl; } char *GetProgramPath() { char *dataPath = nullptr; char *basePath = SDL_GetBasePath(); if (basePath != nullptr) { dataPath = basePath; } else { dataPath = SDL_strdup("./"); } return dataPath; } void PrintFileTimeStamp(char /*searchData*/) { } void FindFile(const char * /*dirPath*/, const char * /*fileRegex*/) { } void GetLatestFile() { } void ListFiles(const char * /*dirPath*/) { }
10e0f2da2dbefb3a3307eb3a268dbd1c50285abf
627157a23a44a38852c3e146efb8fd993f6c4128
/4344.cpp
5a9f5ab454a98899089c863f1625474f78633945
[]
no_license
hsh778205/luogu_code
e598fd87896a61ea6c75e3c918885bd00ea6933b
5280e8d5cae5d5ac51cb9dbbe2a69fd8a8c3595a
refs/heads/master
2021-07-21T12:24:37.708033
2021-03-30T06:29:21
2021-03-30T06:29:21
247,858,584
0
0
null
null
null
null
GB18030
C++
false
false
3,711
cpp
4344.cpp
#include<iostream> #include<algorithm> #include<cstdio> #include<cstring> #include<cmath> #include<map> #include<set> #include<queue> #include<vector> #define IL inline #define re register #define LL long long #define ULL unsigned long long #ifdef TH #define debug printf("Now is %d\n",__LINE__); #else #define debug #endif using namespace std; template<class T>inline void read(T&x) { char ch=getchar(); int fu; while(!isdigit(ch)&&ch!='-') ch=getchar(); if(ch=='-') fu=-1,ch=getchar(); x=ch-'0';ch=getchar(); while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();} x*=fu; } inline int read() { int x=0,fu=1; char ch=getchar(); while(!isdigit(ch)&&ch!='-') ch=getchar(); if(ch=='-') fu=-1,ch=getchar(); x=ch-'0';ch=getchar(); while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();} return x*fu; } int G[55]; template<class T>inline void write(T x) { int g=0; if(x<0) x=-x,putchar('-'); do{G[++g]=x%10;x/=10;}while(x); for(int i=g;i>=1;--i)putchar('0'+G[i]);putchar('\n'); } //区间修改为0 //区间求和 //区间覆盖? //区间最长连续0 struct node { int l,r,v; int lazy; int lmax,rmax,zmax; #define l(x) b[x].l #define r(x) b[x].r #define v(x) b[x].v #define lazy(x) b[x].lazy #define v0(x) (r(x)-l(x)+1-v(x)) #define lmax(x) b[x].lmax #define rmax(x) b[x].rmax #define zmax(x) b[x].zmax }b[800010]; int n,m; node upd(node a,node b) { return (node){a.l,b.r,a.v+b.v,0,(a.lmax==a.r-a.l+1)?a.lmax+b.lmax:a.lmax,(b.rmax==b.r-b.l+1)?b.rmax+a.rmax:b.rmax,max(max(a.zmax,b.zmax),a.rmax+b.lmax)}; } void upd(int p) { v(p)=v(p<<1)+v(p<<1|1); lmax(p)=lmax(p<<1); if(lmax(p<<1)==r(p<<1)-l(p<<1)+1) lmax(p)+=lmax(p<<1|1); rmax(p)=rmax(p<<1|1); if(rmax(p<<1|1)==r(p<<1|1)-l(p<<1|1)+1) rmax(p)+=rmax(p<<1); zmax(p)=max(max(zmax(p<<1),zmax(p<<1|1)),rmax(p<<1)+lmax(p<<1|1)); } void build(int p,int l,int r) { l(p)=l; r(p)=r; if(l==r) { v(p)=lmax(p)=rmax(p)=zmax(p)=1; return; } int mid=l+r>>1; build(p<<1,l,mid); build(p<<1|1,mid+1,r); upd(p); } void spread(int p) { if(lazy(p)) { lazy(p<<1)=lazy(p<<1|1)=lazy(p); lazy(p)--; if(lazy(p)) { v(p<<1)=v(p<<1|1)=lmax(p<<1)=lmax(p<<1|1)=rmax(p<<1)=rmax(p<<1|1)=zmax(p<<1)=zmax(p<<1|1)=0; } else { v(p<<1)=lmax(p<<1)=rmax(p<<1)=zmax(p<<1)=r(p<<1)-l(p<<1)+1; v(p<<1|1)=lmax(p<<1|1)=rmax(p<<1|1)=zmax(p<<1|1)=r(p<<1|1)-l(p<<1|1)+1; } lazy(p)=0; } } void change(int p,int l,int r) { if(l<=l(p)&&r(p)<=r) { v(p)=lmax(p)=rmax(p)=zmax(p)=0; lazy(p)=1; return; } spread(p); int mid=l(p)+r(p)>>1; if(l<=mid) change(p<<1,l,r); if(r>mid) change(p<<1|1,l,r); upd(p); } void change_first(int p,int l,int r,int &last) { if(last<=0) return; if(l<=l(p)&&r(p)<=r&&v0(p)<=last) { v(p)=lmax(p)=rmax(p)=zmax(p)=r(p)-l(p)+1; lazy(p)=2; return; } spread(p); int mid=l(p)+r(p)>>1; if(l<=mid) change_first(p<<1,l,r,last); if(r>mid) change_first(p<<1|1,l,r,last); upd(p); } int ask_one(int p,int l,int r) { if(l<=l(p)&&r(p)<=r) { return v(p); } spread(p); int ans=0,mid=l(p)+r(p)>>1; if(l<=mid) ans+=ask_one(p<<1,l,r); if(r>mid) ans+=ask_one(p<<1|1,l,r); return ans; } node ask(int p,int l,int r) { if(l<=l(p)&&r(p)<=r) { return b[p]; } spread(p); int mid=l(p)+r(p)>>1; if(r<=mid) return ask(p<<1,l,r); if(l>mid) return ask(p<<1|1,l,r); return upd(ask(p<<1,l,r),ask(p<<1|1,l,r)); } int main() { n=read(); m=read(); build(1,1,n); int op,l,r,ans; while(m--) { op=read(); if(op==0) { l=read(); r=read(); change(1,l,r); } else if(op==1) { l=read(); r=read(); ans=ask_one(1,l,r); change(1,l,r); l=read(); r=read(); change_first(1,l,r,ans); } else { l=read(); r=read(); write(ask(1,l,r).zmax); } } return 0; }
901d76453fa603a06d35ac6e283a390d90228a65
d4af01a773900476c879d484f8390b05222f417b
/POI 02/Stage I/Trees.cpp
bc9149d3a6324848fea705b1b94e6daa08f41c69
[]
no_license
huynd2001/POI
e284a860c92e637a111301216162c8a7f2675c0d
c3334aed606c1dfbb10b51e80c60b5e3ee793726
refs/heads/master
2021-08-07T16:26:24.776670
2021-02-02T08:12:12
2021-02-02T08:12:12
88,487,881
0
1
null
null
null
null
UTF-8
C++
false
false
1,169
cpp
Trees.cpp
// Trees #include <bits/stdc++.h> using namespace std; int a,par[100007],conv[100007]; int ans[100007]; vector <int> v[100007]; vector <int> euler; string concat=""; void dfs(int node) { euler.push_back(node); for(int i=0;i<v[node].size();i++) { int k=v[node][i]; dfs(k); } return ; } void dfs2(int node) { concat=concat+"("; for(int i=0;i<v[node].size();i++) { int k=v[node][i]; dfs2(k); } concat=concat+")"; return ; } int main() { int n; cin >> n; int cnt=1; stack <pair<int,int> > st; for(int i=1;i<=n;i++) { cin >> a; while(!st.empty() && st.top().first==a) { par[st.top().second]=cnt+1; par[cnt]=cnt+1; v[cnt+1].push_back(st.top().second); v[cnt+1].push_back(cnt); st.pop(); cnt++; a--; } st.push(make_pair(a,cnt)); cnt++; } cnt--; if(st.size()==1 && st.top().first==0) { dfs(cnt); conv[0]=0; for(int i=0;i<euler.size();i++) { conv[euler[i]]=i+1; } for(int i=1;i<=cnt;i++) { ans[i]=conv[par[euler[i-1]]]; } for(int i=1;i<=cnt;i++) { cout << ans[i] << " "; } cout << endl; dfs2(cnt); cout << concat << endl; } else { cout << "NIE" << endl; } return 0; }
7315461cc0873dc1d4c3788c8085bddfcc27a1cd
3833ff7333211b06d301339b8ae11fc22cb118d4
/c/libxutl/cport/libxutl.cpp
edb4f77201c32fc7d0282c120bd53a21cab68a79
[]
no_license
evertonagilar/study
c4a6fed603b01bc8549813e7ef09e11a206ada99
03af0f0fa87e7ab90b4ce0dbc333c532b5610067
refs/heads/master
2023-03-09T01:43:46.393800
2023-03-04T10:58:20
2023-03-04T10:58:20
54,847,850
3
0
null
2023-03-02T14:18:01
2016-03-27T20:59:24
C
UTF-8
C++
false
false
2,983
cpp
libxutl.cpp
#ifdef WIN32 /* Windows Plataform */ #include <windows.h> #include "libxutl.h" #include "imp\stringutils_imp.h" #else /* Linux Plataform */ #include "libxutl.h" #include "imp/stringutils_imp.h" #endif #include <stdio.h> #include <time.h> #include <stdlib.h> #ifdef __cplusplus extern "C" { #endif //////////// ZEOS FRAMEWORK //////////////////// namespace libxutl { StringUtils* CreateStringUtils() { return new StringUtilsImp(); } }; //////////// ZEOS FUNCTIONS //////////////////// /* * * String utils * * */ PChar CALL Zeos_ltrim(PChar str) { if (str == NULL) return NULL; register PChar p = str; while (*p == ' ') p++; PChar Result = (PChar) malloc(strlen(p)); strcpy(Result, p); return Result; } /* * * Date time utils * * */ PChar CALL Zeos_StrDate(time_t * timeptr){ if (timeptr == NULL) { timeptr = (time_t*) malloc(sizeof(time_t*)); time(timeptr); } struct tm * timeinfo = localtime(timeptr); PChar result = (PChar) malloc(sizeof(PChar)*9); sprintf(result, "%02d/%02d/%04d\0", timeinfo->tm_mday, timeinfo->tm_mon, timeinfo->tm_year+1900); return result; } PChar CALL Zeos_StrDateTime(time_t * timeptr){ if (timeptr == NULL) { timeptr = (time_t*) malloc(sizeof(time_t*)); time(timeptr); } struct tm * timeinfo = localtime(timeptr); PChar result = (PChar) malloc(sizeof(PChar)*20); sprintf(result, "%02d/%02d/%04d %02d:%02d:%02d\0", timeinfo->tm_mday, timeinfo->tm_mon, timeinfo->tm_year+1900, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); return result; } /* * * Log file utils * * */ void CALL Zeos_SetLogFileName(const PChar ALogFileName){ logFileName = ALogFileName; } PChar CALL Zeos_GetLogFileName(){ return logFileName; } int CALL Zeos_WriteAlert(const PChar AMessage){ FILE *arq; if (logFileName != NULL && (arq = fopen(logFileName, "a+")) != NULL) { PChar datestr = Zeos_StrDateTime(NULL); fprintf(arq, "%s %s\n", datestr, AMessage); fclose(arq); return 1; } else { return 0; } } #ifdef WIN32 BOOL APIENTRY DllMain (HINSTANCE hInst /* Library instance handle. */ , DWORD reason /* Reason this function is being called. */ , LPVOID reserved /* Not used. */ ) { switch (reason) { case DLL_PROCESS_ATTACH: break; case DLL_PROCESS_DETACH: break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; } /* Returns TRUE on success, FALSE on failure */ return TRUE; } #endif #ifdef __cplusplus } #endif
52c0492fee99ec0c8cd6e7cf06afdfb041e8b7e0
11d88efb3a4325654a3285bf12e8bb464fbd076a
/Code/Engine/Renderer/TextureView.cpp
0d7f68ddaa1ccdc0fc417f33ba877f70b66f9083
[ "MIT" ]
permissive
iomeone/Engine-1
eb465d4080bf8004023027cc8a7fe2539e43b558
0ca9720a00f51340c6eb6bba07d70972489663e8
refs/heads/master
2022-11-07T05:03:07.614714
2020-06-20T04:23:01
2020-06-20T04:23:01
null
0
0
null
null
null
null
UTF-8
C++
false
false
839
cpp
TextureView.cpp
//------------------------------------------------------------------------------------------------------------------------------ #include "Engine/Renderer/TextureView.hpp" #include "Engine/Renderer/Sampler.hpp" //------------------------------------------------------------------------------------------------------------------------------ #define DX_SAFE_RELEASE(dx_resource) if ((dx_resource) != nullptr) { dx_resource->Release(); dx_resource = nullptr; } //------------------------------------------------------------------------------------------------------------------------------ TextureView::TextureView() { } //------------------------------------------------------------------------------------------------------------------------------ TextureView::~TextureView() { DX_SAFE_RELEASE(m_view); DX_SAFE_RELEASE(m_source); }
6c2022587dfe9030fe778d888f2a9a554640ea70
c4a9667dd8f32a26260d1fd71b1ba006d80a96a6
/main.cpp
d9b10e2367c74557f0210a56b52288f648a3d34b
[]
no_license
samueltenka/ArithmeticCompressor
397aa870cf008b75fbf44fe02d59aadd5a09922e
6978b60a15eb548dfd70b728de4167a11b89d16d
refs/heads/master
2021-01-21T12:47:34.009782
2016-03-23T01:56:40
2016-03-23T01:56:40
21,152,676
0
0
null
null
null
null
UTF-8
C++
false
false
2,952
cpp
main.cpp
// Compressor.cpp : Defines the entry point for the console application. // #include "stdafx.h" //#include "TextFile.h" #include "Huffman.h" #include <iostream> #include <fstream> using namespace std; #define PAUSE {char l; cin >> l;} int _tmain(int argc, _TCHAR* argv[]) { HuffmanCoder H; //string lorem = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; //string lorem = "Lorem ipsum dolor sit amet, \ consectetur adipiscing elit. \ Videamus animi partes, \ quarum est conspectus illustrior; \ Quae cum essent dicta, \ finem fecimus et ambulandi et disputandi. \ Ad corpus diceres pertinere, \ sed ea, quae dixi, ad corpusne refers? \ Duo Reges: constructio interrete. \ Expectoque quid ad id, \ quod quaerebam, respondeas. \ Nunc ita separantur, ut disiuncta sint, \ quo nihil potest esse perversius. \ At miser, si in flagitiosa et \ vitiosa vita afflueret voluptatibus."; string lorem; ifstream myfile("C:\\Users\\Sam\\Desktop\\Compressor\\Genesis.txt"); for(int i = 0; myfile && i<16000; i++) { lorem += myfile.get(); } myfile.close(); cout << "read" << endl; string coded = H.encode(lorem); cout << lorem.length()*8 << "->" << coded.length() << endl; PAUSE return 0; }
7c2dc16f70c8c35009113c4a44d4e8a96c1b3206
17d5640307188855b0f2247808fd06f87de2c3c0
/Matrix.tpp
c59f55a6819211252742f49f38ee7321e87906a6
[ "MIT" ]
permissive
rmicolon/MatrixLite
6896e3b69f0a8f4b3d5238f3030a081c3a9d8908
51dae2be51d9c86353a6a95f42e97b0692341fb4
refs/heads/master
2020-08-24T12:52:43.969948
2019-10-22T14:10:38
2019-10-22T14:10:38
216,829,441
0
0
null
null
null
null
UTF-8
C++
false
false
9,811
tpp
Matrix.tpp
template<class T> void Matrix<T>::resize( uint32_t rows, uint32_t cols, T init ) { N = rows; M = cols; matrix.resize(rows); #pragma omp parallel for num_threads(NUM_THREADS) for (uint32_t i = 0; i < rows; ++i) { (init) ? matrix[i].resize(cols, init) : matrix[i].resize(cols); } } template<class T> Matrix<T> Matrix<T>::getRows( uint32_t i ) const { if (i >= N) throw std::logic_error("Index exceeds Matrix dimensions"); std::vector<std::vector<T>> vec = { matrix[i] }; return (Matrix<T>(vec)); } template<class T> Matrix<T> Matrix<T>::getCols( uint32_t j ) const { if (j >= M) throw std::logic_error("Index exceeds Matrix dimensions"); auto lambda = [this, j, i=0]() mutable { return matrix[i++][j]; }; return (Matrix<T>(N, 1, lambda)); } template<class T> Matrix<T> Matrix<T>::getRows( std::vector<int> rows ) const { Matrix<T> ret = this->getRows(rows[0]); for (auto it = rows.begin() + 1; it != rows.end(); ++it) { ret.appendVer(this->getRows(*it)); } return ret; } template<class T> Matrix<T> Matrix<T>::getCols( std::vector<int> cols ) const { Matrix<T> ret = this->getCols(cols[0]); for (auto it = cols.begin() + 1; it != cols.end(); ++it) { ret.appendHor(this->getCols(*it)); } return ret; } template<class T> Matrix<T>& Matrix<T>::dropRows( uint32_t i ) { if (i >= N) throw std::logic_error("Index exceeds Matrix dimensions"); matrix.erase(matrix.begin() + i); --N; return (*this); } template<class T> Matrix<T>& Matrix<T>::dropCols( uint32_t j ) { if (j >= M) throw std::logic_error("Index exceeds Matrix dimensions"); for (auto it = matrix.begin(); it != matrix.end(); ++it) { it->erase((*it).begin() + j); } --M; return (*this); } template<class T> Matrix<T>& Matrix<T>::dropRows( std::vector<int> rows ) { std::sort(rows.begin(), rows.end()); for (auto it = rows.rbegin(); it != rows.rend(); ++it) { this->dropRows(*it); } return (*this); } template<class T> Matrix<T>& Matrix<T>::dropCols( std::vector<int> cols ) { std::sort(cols.begin(), cols.end()); for (auto it = cols.rbegin(); it != cols.rend(); ++it) { this->dropCols(*it); } return (*this); } template<class T> Matrix<T> & Matrix<T>::appendVer( T init, uint32_t nrows ) { this->resize(N + nrows, M, init); return (*this); } template<class T> Matrix<T> & Matrix<T>::appendVer( std::vector<T> const & vec ) { if (vec.size() != M) throw std::logic_error("Vector size is not equal to Matrix cols"); matrix.resize(N + 1); matrix[N] = vec; N += 1; return (*this); } template<class T> Matrix<T> & Matrix<T>::appendVer( Matrix<T> const & other ) { if (other.getMcols() != M) throw std::logic_error("Matrices don't have the same number of cols"); matrix.resize(N + other.getNrows()); for (uint32_t i = N, j = 0; i < N + other.getNrows(); ++i, ++j) matrix[i] = other[j]; N += other.getNrows(); return (*this); } template<class T> Matrix<T> & Matrix<T>::appendHor( T init, uint32_t ncols ) { this->resize(N, M + ncols, init); return (*this); } template<class T> Matrix<T> & Matrix<T>::appendHor( std::vector<T> const & vec ) { if (vec.size() != N) throw std::logic_error("Vector size is not equal to Matrix rows"); #pragma omp parallel for num_threads(NUM_THREADS) for (uint32_t i = 0; i < N; ++i) { matrix[i].resize(M + 1); matrix[i][M] = vec[i]; } M += 1; return (*this); } template<class T> Matrix<T> & Matrix<T>::appendHor( Matrix<T> const & other ) { if (other.getNrows() != N) throw std::logic_error("Matrices don't have the same number of rows"); #pragma omp parallel for num_threads(NUM_THREADS) for (uint32_t i = 0; i < N; ++i) { matrix[i].resize(M + other.getMcols()); for (uint32_t j = 0; j < other.getMcols(); ++j) { matrix[i][j+M] = other[i][j]; } } M += other.getMcols(); return (*this); } template<class T> Matrix<T> Matrix<T>::cofact(uint32_t row, uint32_t col) const { Matrix<T> ret(N-1, M-1); for (uint32_t i = 0, k = 0; i < N; ++i) { if (i == row) continue; for (uint32_t j = 0, l = 0; j < M; ++j) { if (j == col) continue; ret[k][l] = matrix[i][j]; ++l; } ++k; } return ret; } template<class T> T Matrix<T>::det( Matrix<T> const & mat ) { if (mat.getNrows() != mat.getMcols()) throw std::logic_error("Non-square Matrix"); if (mat.getNrows() == 0) throw std::logic_error("Empty Matrix"); if (mat.getNrows() == 1) return mat[0][0]; if (mat.getNrows() == 2) return mat[0][0]*mat[1][1] - mat[0][1]*mat[1][0]; T ret = 0; int8_t sign; for (uint32_t i = 0; i < mat.getNrows(); ++i) { sign = i % 2 ? -1 : 1; ret += (sign * mat[0][i] * mat.cofact(0, i).det()); } return ret; } template<class T> T Matrix<T>::det( void ) const { return det(*this); } template<class T> Matrix<T> Matrix<T>::inv( void ) const { if (N != M) throw std::logic_error("Non-square Matrix"); if (this->det() == 0) throw std::logic_error("Non-invertible matrix (Determinant = 0)"); Matrix<T> cofactor(N, M); int8_t sign; #pragma omp parallel for collapse(2) num_threads(NUM_THREADS) for (uint32_t i = 0; i < N; ++i) { for (uint32_t j = 0; j < N; ++j) { sign = ((i + j) % 2) ? -1 : 1; cofactor[i][j] = sign * this->cofact(i, j).det(); } } return (cofactor.transpose() / this->det()); } template<class T> Matrix<T> Matrix<T>::transpose( void ) const { Matrix<T> ret(M, N); #pragma omp parallel for collapse(2) num_threads(NUM_THREADS) for (uint32_t i = 0; i < N; ++i) { for (uint32_t j = 0; j < M; ++j) { ret[j][i] = matrix[i][j]; } } return ret; } template<class T> Matrix<T> & Matrix<T>::operator=( Matrix<T> const & rhs ) { N = rhs.getNrows(); M = rhs.getMcols(); matrix.resize(N); #pragma omp parallel for num_threads(NUM_THREADS) for (uint32_t i = 0; i < N; ++i) { matrix[i].resize(M); matrix[i] = rhs[i]; } return (*this); } template<class T> Matrix<T> Matrix<T>::operator+( Matrix<T> const & rhs ) const { if (rhs.getNrows() != N || rhs.getMcols() != M) throw std::logic_error("Matrices don't have the same dimensions"); Matrix<T> ret(N, M); #pragma omp parallel for collapse(2) num_threads(NUM_THREADS) for (uint32_t i = 0; i < N; ++i) { for (uint32_t j = 0; j < M; ++j) { ret[i][j] = matrix[i][j] + rhs[i][j]; } } return ret; } template<class T> Matrix<T> Matrix<T>::operator+( T const & rhs ) const { Matrix<T> ret(N, M); #pragma omp parallel for collapse(2) num_threads(NUM_THREADS) for (uint32_t i = 0; i < N; ++i) { for (uint32_t j = 0; j < M; ++j) { ret[i][j] = matrix[i][j] + rhs; } } return ret; } template<class T> Matrix<T> Matrix<T>::operator-( Matrix<T> const & rhs ) const { if (rhs.getNrows() != N || rhs.getMcols() != M) throw std::logic_error("Matrices don't have the same dimensions"); Matrix<T> ret(N, M); #pragma omp parallel for collapse(2) num_threads(NUM_THREADS) for (uint32_t i = 0; i < N; ++i) { for (uint32_t j = 0; j < M; ++j) { ret[i][j] = matrix[i][j] - rhs[i][j]; } } return ret; } template<class T> Matrix<T> Matrix<T>::operator-( T const & rhs ) const { Matrix<T> ret(N, M); #pragma omp parallel for collapse(2) num_threads(NUM_THREADS) for (uint32_t i = 0; i < N; ++i) { for (uint32_t j = 0; j < M; ++j) { ret[i][j] = matrix[i][j] - rhs; } } return ret; } template<class T> Matrix<T> Matrix<T>::operator*( Matrix<T> const & rhs ) const { if (M != rhs.getNrows()) throw std::logic_error("Matrix A cols != matrix B rows"); Matrix<T> ret(N, rhs.getMcols()); #pragma omp parallel for collapse(3) num_threads(NUM_THREADS) for (uint32_t i = 0; i < ret.getNrows(); ++i) { for (uint32_t j = 0; j < ret.getMcols(); ++j) { for (uint32_t k = 0; k < M; ++k) { ret[i][j] += matrix[i][k] * rhs[k][j]; } } } return ret; } template<class T> Matrix<T> Matrix<T>::operator*( T const & rhs ) const { Matrix<T> ret(N, M); #pragma omp parallel for collapse(2) num_threads(NUM_THREADS) for (uint32_t i = 0; i < N; ++i) { for (uint32_t j = 0; j < M; ++j) { ret[i][j] = matrix[i][j] * rhs; } } return ret; } template<class T> Matrix<T> Matrix<T>::operator/( T const & rhs ) const { if (rhs == 0) throw std::logic_error("Division by 0"); Matrix<T> ret(N, M); #pragma omp parallel for collapse(2) num_threads(NUM_THREADS) for (uint32_t i = 0; i < N; ++i) { for (uint32_t j = 0; j < M; ++j) { ret[i][j] = matrix[i][j] / rhs; } } return ret; } template<class T> Matrix<T> & Matrix<T>::operator+=( Matrix<T> const & rhs ) { *this = *this + rhs; return *this; } template<class T> Matrix<T> & Matrix<T>::operator+=( T const & rhs ) { *this = *this + rhs; return *this; } template<class T> Matrix<T> & Matrix<T>::operator-=( Matrix<T> const & rhs ) { *this = *this - rhs; return *this; } template<class T> Matrix<T> & Matrix<T>::operator-=( T const & rhs ) { *this = *this - rhs; return *this; } template<class T> Matrix<T> & Matrix<T>::operator*=( Matrix<T> const & rhs ) { *this = *this * rhs; return *this; } template<class T> Matrix<T> & Matrix<T>::operator*=( T const & rhs ) { *this = *this * rhs; return *this; } template<class T> Matrix<T> & Matrix<T>::operator/=( T const & rhs ) { *this = *this / rhs; return *this; } template<class T> bool Matrix<T>::operator==( Matrix<T> const & rhs ) const { if (N != rhs.getNrows()) return false; for (uint32_t i = 0; i < N; ++i) if (matrix[i] != rhs[i]) return false; return true; } template<class T> Matrix<T> operator*( T const & lhs, Matrix<T> const & rhs ) { return rhs * lhs; } template<class T> std::ostream & operator<<( std::ostream & o, Matrix<T> const & rhs ) { for (uint32_t i = 0; i < rhs.getNrows(); ++i) { o << "["; for (uint32_t j = 0; j < rhs.getMcols(); ++j) o << " " << rhs[i][j]; o << " ]" << std::endl; } return o; }
c090200a6699fd53e432aaf6d1a208a89961671c
2293801ef5ce447058b63ab0feaef1c0a06d65a0
/MyGame/HallScreen.cpp
01f629ef38ba0d669f89885bd3d6632e177c280c
[]
no_license
MuhammadUsaid/GameProject
dcc46f0a9c5e4dff88c87e22b5845bb6dc105251
e4b0c68745eb1911f1071f26dc830975de4f67d4
refs/heads/master
2020-04-07T19:18:08.366304
2018-12-02T14:28:26
2018-12-02T14:28:26
158,643,055
0
1
null
null
null
null
UTF-8
C++
false
false
2,603
cpp
HallScreen.cpp
#include "HallScreen.h" #include "TextManager.h" #include "Room.h" HallScreen::HallScreen() { roomNumber = 0; // 0 means we are in hallway // InitializeRooms(); state = 0; player = Player::GetInstance(); healthBar = new Health; objectList = new ObjectList; objectFactory = new ObjectFactory; backGround = TextureManager::LoadTexture("Images/hall.jpg"); running = true; Screen::pause = 0; } void HallScreen::InitializeRooms() { roomScreen[0] = new Room; roomScreen[1] = new Room; roomScreen[2] = new Room; roomScreen[3] = new Room; } void HallScreen::HandleEvents() { SDL_Event e; while(SDL_PollEvent(&e)) { switch(e.type) { case SDL_QUIT: running = false; break; case SDL_KEYDOWN: switch(e.key.keysym.sym) { case SDLK_ESCAPE: state = 1; break; case SDLK_p: Screen::pause = 1; break; case SDLK_UP: player->MoveUp(); break; case SDLK_DOWN: player->MoveDown(); break; case SDLK_RIGHT: player->MoveRight(); break; case SDLK_LEFT: player->MoveLeft(); break; } break; } } } void HallScreen::Update() { if(player->GetHealth() <= 0) { state = 3; } switch(roomNumber) { case 1: roomScreen[0]->Update(); break; case 2: roomScreen[1]->Update(); break; case 3: roomScreen[2]->Update(); break; case 4: roomScreen[3]->Update(); break; default: // enemyList->Update(); break; } player->Update(); healthBar->Update(); } void HallScreen::Render() { switch(roomNumber) { case 1: roomScreen[0]->Render(); break; case 2: roomScreen[1]->Render(); break; case 3: roomScreen[2]->Render(); break; case 4: roomScreen[3]->Render(); break; default: SDL_RenderCopy(Game::renderer, backGround, nullptr, nullptr); //objectList->Render(); //enemyList->Render(); break; } healthBar->Render(); player->Render(); } HallScreen::~HallScreen() { SDL_DestroyTexture(backGround); delete player; delete healthBar; delete objectList; delete enemyList; delete objectFactory; delete[] roomScreen; }
afc71cf2ac5062eb56bceb075e2515b96eb7223e
6d8009bba14682c2266581962d2c10199ca9e1ed
/KeypadSequencer.cpp
2ef952e7276202334042e7326ece033ea53f382f
[]
no_license
normannexo/MidiKeypadSequencer
7c4f7a66368bcc20cd3c96d42db232cd59fd5503
e0e8ab6933f042eb66387993bb99e99aea316f66
refs/heads/master
2021-01-11T01:10:08.837739
2016-10-23T17:42:01
2016-10-23T17:42:01
71,049,467
0
0
null
null
null
null
UTF-8
C++
false
false
1,435
cpp
KeypadSequencer.cpp
#include "KeypadSequencer.h" byte TimeDiv::nextValue() { mIndex = (mIndex + 1) % 4; return mValues[mIndex]; } byte TimeDiv::getValue() { return mValues[mIndex]; } void TimeDiv::drawValue(Adafruit_7segment* seg) { seg->printNumber(mValues[mIndex], DEC); seg->writeDigitNum(1, 1, true); if (swing == 1) { seg->writeDigitRaw(0, B01101101); } seg->writeDisplay(); } TimeDiv::TimeDiv(uint8_t initIndex) { mIndex = initIndex; } void displayStep(Adafruit_7segment* seg, int stepdisplay) { } // Step class Step::Step(byte note, byte active) { this->note = note; this->active = active; } Step::Step() { this->note = 0; this->active = true; } //Pattern class Pattern::Pattern(byte * notes, byte* actives) { for (int i = 0; i < 16; i++) { this->notes[i] = notes[i]; this->actives[i] = actives[i]; } } void Pattern::setPattern(byte * notes, byte * actives) { for (int i = 0; i < 16; i++) { this->notes[i] = notes[i]; this->actives[i] = actives[i]; } } // util functions Step* buildStepArrayFromRaw(byte* notes, byte* actives) { Step tmpStep[16]; for (int i = 0; i < 16; i++) { tmpStep[i].note = notes[i]; tmpStep[i].active = actives[i]; } return tmpStep; } void copyPatternToSlot(byte * targetn, byte * targeta, byte * notes, byte * actives) { for (int i = 0; i < 16; i++) { targetn[i] = notes[i]; targeta[i]= actives[i]; } }
ee27c0b21d05ba36cb42daf6fbfbce328b265794
3da1d05a9bde4410abeecef3bf644a1cf91de5ed
/lib/AIECreateFlows.cpp
9691ab5a2084eb0024452a084bcd7a8a485512d9
[ "LLVM-exception", "Apache-2.0" ]
permissive
Sibylau/mlir-aie
b15edd5cae0da05a8e8fc2cab2add49fcd194564
63ce4152885af66bf245bb9a2a25276fdaec67f3
refs/heads/main
2023-08-17T06:10:28.073855
2021-09-22T16:52:10
2021-09-22T16:52:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
18,075
cpp
AIECreateFlows.cpp
//===- AIECreateFlows.cpp ---------------------------------------*- C++ -*-===// // // This file is licensed under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // (c) Copyright 2019 Xilinx Inc. // //===----------------------------------------------------------------------===// #include "mlir/IR/Attributes.h" #include "mlir/IR/BlockAndValueMapping.h" #include "mlir/IR/PatternMatch.h" #include "mlir/IR/Location.h" #include "mlir/Pass/Pass.h" #include "mlir/Transforms/DialectConversion.h" #include "mlir/Translation.h" #include "aie/AIEDialect.h" #include "llvm/Support/Debug.h" using namespace mlir; using namespace xilinx; using namespace xilinx::AIE; #define DEBUG_TYPE "aie-create-flows" static llvm::cl::opt<bool> debugRoute("debug-route", llvm::cl::desc("Enable Debugging of routing process"), llvm::cl::init(false)); typedef llvm::Optional<std::pair<Operation *, Port>> PortConnection; class TileAnalysis { ModuleOp &module; int maxcol, maxrow; DenseMap<std::pair<int, int>, TileOp> coordToTile; DenseMap<std::pair<int, int>, SwitchboxOp> coordToSwitchbox; DenseMap<std::pair<int, int>, ShimMuxOp> coordToShimMux; // DenseMap<int, ShimSwitchboxOp> coordToShimSwitchbox; DenseMap<int, PLIOOp> coordToPLIO; public: int getMaxCol() { return maxcol; } int getMaxRow() { return maxrow; } int getConstantInt(Value val) { return 0; } TileAnalysis(ModuleOp &m) : module(m) { maxcol = 0; maxrow = 0; for (auto tileOp : module.getOps<TileOp>()) { int col, row; col = tileOp.colIndex(); row = tileOp.rowIndex(); maxcol = std::max(maxcol, col); maxrow = std::max(maxrow, row); assert(coordToTile.count(std::make_pair(col, row)) == 0); coordToTile[std::make_pair(col, row)] = tileOp; } for (auto switchboxOp : module.getOps<SwitchboxOp>()) { int col, row; col = switchboxOp.colIndex(); row = switchboxOp.rowIndex(); assert(coordToSwitchbox.count(std::make_pair(col, row)) == 0); coordToSwitchbox[std::make_pair(col, row)] = switchboxOp; } for (auto switchboxOp : module.getOps<ShimMuxOp>()) { int col, row; col = switchboxOp.colIndex(); row = switchboxOp.rowIndex(); assert(coordToShimMux.count(std::make_pair(col, row)) == 0); coordToShimMux[std::make_pair(col, row)] = switchboxOp; } } TileOp getTile(OpBuilder &builder, int col, int row) { if(coordToTile.count(std::make_pair(col, row))) { return coordToTile[std::make_pair(col, row)]; } else { TileOp tileOp = builder.create<TileOp>(builder.getUnknownLoc(), col, row); coordToTile[std::make_pair(col, row)] = tileOp; maxcol = std::max(maxcol, col); maxrow = std::max(maxrow, row); return tileOp; } } SwitchboxOp getSwitchbox(OpBuilder &builder, int col, int row) { assert(col >= 0); assert(row >= 0); if(coordToSwitchbox.count(std::make_pair(col, row))) { return coordToSwitchbox[std::make_pair(col, row)]; } else { SwitchboxOp switchboxOp = builder.create<SwitchboxOp>(builder.getUnknownLoc(), getTile(builder, col, row)); //coordToTile[std::make_pair(col, row)]); switchboxOp.ensureTerminator(switchboxOp.connections(), builder, builder.getUnknownLoc()); coordToSwitchbox[std::make_pair(col, row)] = switchboxOp; maxcol = std::max(maxcol, col); maxrow = std::max(maxrow, row); return switchboxOp; } } ShimMuxOp getShimMux(OpBuilder &builder, int col) { assert(col >= 0); int row = 0; if(coordToShimMux.count(std::make_pair(col, row))) { return coordToShimMux[std::make_pair(col, row)]; } else { assert(getTile(builder, col, row).isShimNOCTile()); ShimMuxOp switchboxOp = builder.create<ShimMuxOp>(builder.getUnknownLoc(), getTile(builder, col, row)); switchboxOp.ensureTerminator(switchboxOp.connections(), builder, builder.getUnknownLoc()); coordToShimMux[std::make_pair(col, row)] = switchboxOp; maxcol = std::max(maxcol, col); maxrow = std::max(maxrow, row); return switchboxOp; } } PLIOOp getPLIO(OpBuilder &builder, int col) { if(coordToPLIO.count(col)) { return coordToPLIO[col]; } else { IntegerType i32 = builder.getIntegerType(32); PLIOOp op = builder.create<PLIOOp>(builder.getUnknownLoc(), builder.getIndexType(), IntegerAttr::get(i32, (int32_t)col)); coordToPLIO[col] = op; maxcol = std::max(maxcol, col); return op; } } }; struct RouteFlows : public OpConversionPattern<AIE::FlowOp> { using OpConversionPattern<AIE::FlowOp>::OpConversionPattern; ModuleOp &module; TileAnalysis &analysis; RouteFlows(MLIRContext *context, ModuleOp &m, TileAnalysis &a, PatternBenefit benefit = 1) : OpConversionPattern<FlowOp>(context, benefit), module(m), analysis(a) {} LogicalResult match(Operation *op) const override { return success(); } void addConnection(ConversionPatternRewriter &rewriter, // could be a shim-mux or a switchbox. Interconnect op, FlowOp flowOp, WireBundle inBundle, int inIndex, WireBundle outBundle, int &outIndex) const { LLVM_DEBUG(llvm::dbgs() << " - addConnection (" << stringifyWireBundle(inBundle) << " : " << inIndex << ") -> (" << stringifyWireBundle(outBundle) << " : " << outIndex << ")\n"); Region &r = op.connections(); Block &b = r.front(); auto point = rewriter.saveInsertionPoint(); rewriter.setInsertionPoint(b.getTerminator()); std::vector<int> validIndices; //TODO: may need to reserve index for DMA connections so that PLIO doesn't use them // if this interconnect is a shim-mux then.. if(isa<ShimMuxOp>(op)) { // (enforce) in-bound connections from 'South' must route straight through. // (enforce) in-bound connections from north to South must route straight through if( (inBundle == WireBundle::South && outBundle == WireBundle::North) || (inBundle == WireBundle::North && outBundle == WireBundle::South) ) { outIndex = inIndex; } // (enforce) out-bound connections from 'DMA' on index 0 go out on north-bound 3 // (enforce) out-bound connections from 'DMA' on index 1 go out on north-bound 7 else if(inBundle == WireBundle::DMA && outBundle == WireBundle::North) { if(inIndex == 0) outIndex = 3; else outIndex = 7; } } else { // not a shimmux // if shim switch to shimmux connection... // (enforce) in-bound connections from north to DMA channel 0 must come in on index 2 // (enforce) in-bound connections from north to DMA channel 1 must come in on index 3 if(op.rowIndex() == 0 && outBundle == WireBundle::South && flowOp.destBundle() == WireBundle::DMA) { if(flowOp.destChannel() == 0) outIndex = 2; else outIndex = 3; } else if(outBundle == WireBundle::North) validIndices = {0, 1, 2, 3, 4, 5}; else validIndices = {0, 1, 2, 3}; //most connections have 4 valid outIndex options } // If no index has been dictated, find an index that is bigger than any existing index. if(outIndex == -1) { uint8_t choice = 0; outIndex = validIndices[choice]; for (auto connectOp : b.getOps<ConnectOp>()) { if(connectOp.destBundle() == outBundle) while(connectOp.destIndex() >= outIndex) { outIndex = validIndices[++choice]; } } for (auto masterOp : b.getOps<MasterSetOp>()) { if(masterOp.destBundle() == outBundle) while(masterOp.destIndex() >= outIndex) { outIndex = validIndices[++choice]; } } if(choice >= validIndices.size()) op.emitOpError("\nAIECreateFlows: Illegal routing channel detected!\n") << "Too many routes in tile (" << op.colIndex() << ", " << op.rowIndex() << ")\n"; } // This might fail if an outIndex was exactly specified. rewriter.template create<ConnectOp>(rewriter.getUnknownLoc(), inBundle, inIndex, outBundle, outIndex); rewriter.restoreInsertionPoint(point); if(debugRoute) { int col, row; col = op.colIndex(); row = op.rowIndex(); llvm::dbgs() << "\t\tRoute@(" << col << "," << row << "): " << stringifyWireBundle(inBundle) << ":" << inIndex << "->" << stringifyWireBundle(outBundle) << ":" << outIndex << "\n"; } } void rewrite(AIE::FlowOp op, ArrayRef<Value > operands, ConversionPatternRewriter &rewriter) const override { Operation *Op = op.getOperation(); WireBundle sourceBundle = op.sourceBundle(); int sourceIndex = op.sourceIndex(); WireBundle destBundle = op.destBundle(); int destIndex = op.destIndex(); int col, row; if(FlowEndPoint source = dyn_cast<FlowEndPoint>(op.source().getDefiningOp())) { col = source.colIndex(); row = source.rowIndex(); } else llvm_unreachable("Unimplemented case"); int destcol, destrow; if(FlowEndPoint dest = dyn_cast<FlowEndPoint>(op.dest().getDefiningOp())) { destcol = dest.colIndex(); destrow = dest.rowIndex(); } else llvm_unreachable("Unimplemented case"); if(debugRoute) llvm::dbgs() << "Route: " << col << "," << row << "->" << destcol << "," << destrow << "\n"; WireBundle bundle = sourceBundle; int index = sourceIndex; // sourcing from the shim tile // If intent is to route from PLIO - "south" is specified (Attach ShimMux to to PLIO) // if intent is to route from DMA - "DMA" is specificed ( Attach ShimMux to DMA) if(row == 0) { // The Shim row of tiles needs some extra connectivity // FIXME: is this correct in a ShimPLTile? LLVM_DEBUG(llvm::dbgs() << "\tInitial Extra shim connectivity\t"); ShimMuxOp shimMuxOp = analysis.getShimMux(rewriter, col); int internalIndex = -1; addConnection(rewriter, cast<Interconnect>(shimMuxOp.getOperation()), op, bundle, index, WireBundle::North, internalIndex); bundle = WireBundle::South; index = internalIndex; // does not update row... instead connection made in `while' loop } int nextcol = col, nextrow = row; WireBundle nextBundle; int done = false; while(!done) { // Travel vertically to the destination row, then horizontally to the destination column // Create a connection inside this switchbox. WireBundle outBundle; int outIndex = -1; // pick connection. if(row > destrow) { outBundle = WireBundle::South; nextBundle = WireBundle::North; nextrow = row-1; } else if(row < destrow) { outBundle = WireBundle::North; nextBundle = WireBundle::South; nextrow = row+1; } else if(col > destcol) { outBundle = WireBundle::West; nextBundle = WireBundle::East; nextcol = col-1; } else if(col < destcol) { outBundle = WireBundle::East; nextBundle = WireBundle::West; nextcol = col+1; } else { assert(row == destrow && col == destcol); // In the destination tile streamswitch, done, so connect to the correct target bundle. outBundle = destBundle; outIndex = destIndex; done = true; } if(nextrow < 0) { assert(false); } else { if(row == 0 && done) { // we reached our destination, and that destination is in the shim, // we're terminating in either the DMA or the PLIO // The Shim row of tiles needs some extra connectivity // FIXME: is this correct in a ShimPLTile? SwitchboxOp swOp = analysis.getSwitchbox(rewriter, col, row); ShimMuxOp shimMuxOp = analysis.getShimMux(rewriter, col); int internalIndex = -1; LLVM_DEBUG(llvm::dbgs() << "\tExtra shim switch connectivity\t"); addConnection(rewriter, cast<Interconnect>(swOp.getOperation()), op, bundle, index, WireBundle::South, internalIndex); LLVM_DEBUG(llvm::dbgs() << "\tExtra shim DMA connectivity\t"); addConnection( rewriter, cast<Interconnect>(shimMuxOp.getOperation()), op, WireBundle::North, internalIndex, outBundle, outIndex); } else { // Most tiles are simple and just go through a switchbox. LLVM_DEBUG(llvm::dbgs() << "\tRegular switch connectivity\t"); SwitchboxOp swOp = analysis.getSwitchbox(rewriter, col, row); addConnection(rewriter, cast<Interconnect>(swOp.getOperation()), op, bundle, index, outBundle, outIndex); } } if(done) break; col = nextcol; row = nextrow; bundle = nextBundle; index = outIndex; } rewriter.eraseOp(Op); } }; struct AIERouteFlowsPass : public AIERouteFlowsBase<AIERouteFlowsPass> { void runOnOperation() override { ModuleOp m = getOperation(); TileAnalysis analysis(m); OpBuilder builder = OpBuilder::atBlockEnd(m.getBody()); // Populate tiles and switchboxes. for(int col = 0; col <= analysis.getMaxCol(); col++) { for(int row = 0; row <= analysis.getMaxRow(); row++) { analysis.getTile(builder, col, row); } } for(int col = 0; col <= analysis.getMaxCol(); col++) { for(int row = 0; row <= analysis.getMaxRow(); row++) { analysis.getSwitchbox(builder, col, row); } } for(int col = 0; col <= analysis.getMaxCol(); col++) { analysis.getPLIO(builder, col); } // Populate wires betweeh switchboxes and tiles. for(int col = 0; col <= analysis.getMaxCol(); col++) { for(int row = 0; row <= analysis.getMaxRow(); row++) { auto tile = analysis.getTile(builder, col, row); auto sw = analysis.getSwitchbox(builder, col, row); if(col > 0) { // connections east-west between stream switches auto westsw = analysis.getSwitchbox(builder, col-1, row); builder.create<WireOp>(builder.getUnknownLoc(), westsw, WireBundle::East, sw, WireBundle::West); } if(row > 0) { // connections between abstract 'core' of tile builder.create<WireOp>(builder.getUnknownLoc(), tile, WireBundle::Core, sw, WireBundle::Core); // connections between abstract 'dma' of tile builder.create<WireOp>(builder.getUnknownLoc(), tile, WireBundle::DMA, sw, WireBundle::DMA); // connections north-south inside array ( including connection to shim row) auto southsw = analysis.getSwitchbox(builder, col, row-1); builder.create<WireOp>(builder.getUnknownLoc(), southsw, WireBundle::North, sw, WireBundle::South); } else if(row == 0) { if (tile.isShimNOCTile()) { auto shimsw = analysis.getShimMux(builder, col); builder.create<WireOp>( builder.getUnknownLoc(), shimsw, WireBundle::North, // Changed to connect into the north sw, WireBundle::South); // PLIO is attached to shim mux auto plio = analysis.getPLIO(builder, col); builder.create<WireOp>(builder.getUnknownLoc(), plio, WireBundle::North, shimsw, WireBundle::South); // abstract 'DMA' connection on tile is attached to shim mux ( in // row 0 ) builder.create<WireOp>(builder.getUnknownLoc(), tile, WireBundle::DMA, shimsw, WireBundle::DMA); } else if (tile.isShimPLTile()) { // PLIO is attached directly to switch auto plio = analysis.getPLIO(builder, col); builder.create<WireOp>(builder.getUnknownLoc(), plio, WireBundle::North, sw, WireBundle::South); } } } } ConversionTarget target(getContext()); target.addLegalOp<ConnectOp>(); target.addLegalOp<SwitchboxOp>(); target.addLegalOp<ShimMuxOp>(); target.addLegalOp<EndOp>(); OwningRewritePatternList patterns(&getContext()); patterns.insert<RouteFlows>(m.getContext(), m, analysis); if (failed(applyPartialConversion(m, target, std::move(patterns)))) signalPassFailure(); return; } }; std::unique_ptr<OperationPass<ModuleOp>> xilinx::AIE::createAIERouteFlowsPass() { return std::make_unique<AIERouteFlowsPass>(); }
64e9e87ba074d8327e8aa406f74aa5fd7ccacf77
06db767eba25a66e91335b10d657035e0fa7068f
/NLEquation.h
302a17782a2ad20d6099df894b767bca757afd68
[]
no_license
zh4545666/PersonalMethodLibrary
946b205e8646f1f4d860294573c120b97362937b
8bbc8edd3aa85a47c1279af6fc0070b5cb63bf02
refs/heads/master
2020-04-12T18:12:29.310186
2019-03-04T02:31:16
2019-03-04T02:31:16
162,672,786
0
0
null
null
null
null
UTF-8
C++
false
false
3,566
h
NLEquation.h
#pragma once #ifdef AFX_CLASS #define AFX_EX_CLASS _declspec(dllexport) #else #define AFX_EX_CLASS _declspec(dllimport) #endif #include "LEquation.h" #include "Matrix.h" #include "Complex.h" class AFX_EX_CLASS CNLEquation { // // 公有接口函数 // public: // // 构造与析构 // CNLEquation(); virtual ~CNLEquation(); // // 虚函数:计算方程左端函数值,必须在引申类中覆盖该类函数 // virtual double Func(double x) { return 0.0; } virtual double Func(int n, double x[]) { return 0.0; } virtual void Func(double x, double y[]) { } virtual double Func(double x, double y) { return 0.0; } virtual double Func(double x[], double y[]) { return 0.0; } virtual void FuncMJ(int n, double x[], double p[]) { } // // 非线性方程求解算法 // // 求非线性方程实根的对分法 int GetRootBisect(int nNumRoots, double x[], double xStart, double xEnd, double dblStep, double eps = 0.000001); // 求非线性方程一个实根的牛顿法 bool GetRootNewton(double* x, int nMaxIt = 60, double eps = 0.000001); // 求非线性方程一个实根的埃特金迭代法 bool GetRootAitken(double* x, int nMaxIt = 60, double eps = 0.000001); // 求非线性方程一个实根的连分式解法 bool GetRootPq(double* x, double eps = 0.000001); // 求实系数代数方程全部根的QR方法 bool GetRootQr(int n, double dblCoef[], double xr[], double xi[], int nMaxIt = 60, double eps = 0.000001); // 求实系数代数方程全部根的牛顿下山法 bool GetRootNewtonDownHill(int n, double dblCoef[], double xr[], double xi[]); // 求复系数代数方程全部根的牛顿下山法 bool GetRootNewtonDownHill(int n, double ar[], double ai[], double xr[], double xi[]); // 求非线性方程一个实根的蒙特卡洛法 void GetRootMonteCarlo(double* x, double xStart, int nControlB, double eps = 0.000001); // 求实函数或复函数方程一个复根的蒙特卡洛法 void GetRootMonteCarlo(double* x, double* y, double xStart, int nControlB, double eps = 0.000001); // // 非线性方程组求解算法 // // 求非线性方程组一组实根的梯度法 bool GetRootsetGrad(int n, double x[], int nMaxIt = 500, double eps = 0.000001); // 求非线性方程组一组实根的拟牛顿法 bool GetRootsetNewton(int n, double x[], double t, double h, int nMaxIt = 500, double eps = 0.000001); // 求非线性方程组最小二乘解的广义逆法 bool GetRootsetGinv(int m, int n, double x[], double eps1 = 0.000001, double eps2 = 0.000001); // 求非线性方程组一组实根的蒙特卡洛法 void GetRootsetMonteCarlo(int n, double x[], double xStart, int nControlB, double eps = 0.000001); // // 内部函数 // private: void g60(double* t, double* x, double* y, double* x1, double* y1, double* dx, double* dy, double* p, double* q, int* k, int* it); void g90(double xr[], double xi[], double dblCoef[], double* x, double* y, double* p, double* q, double* w, int* k); void g65(double* x, double* y, double* x1, double* y1, double* dx, double* dy, double* dd, double* dc, double* c, int* k, int* is, int* it); void g60c(double* t, double* x, double* y, double* x1, double* y1, double* dx, double* dy, double* p, double* q, int* k, int* it); void g90c(double xr[], double xi[], double ar[], double ai[], double* x, double* y, double* p, double* w, int* k); void g65c(double* x, double* y, double* x1, double* y1, double* dx, double* dy, double* dd, double* dc, double* c, int* k, int* is, int* it); double rnd(double* r); };
25a8cfabd76d15e888ee9baac9b6abc33db98ef9
ce75378df49c4d3893614b18874192b64798055c
/Labarator13/1.4/Fig12_03New.cpp
63fe8f91945c1858413880aa255a0f6bcc63ca2e
[]
no_license
ArtyomLazyan/Labaratorner-C-C-
2c601b446340f509da510795f3f2cb4ec25224ab
f5528cd5d9f3c87970502a8df677aaaf2530a576
refs/heads/master
2021-08-20T00:17:50.433860
2017-11-27T19:29:56
2017-11-27T19:29:56
null
0
0
null
null
null
null
UTF-8
C++
false
false
719
cpp
Fig12_03New.cpp
#include <iostream> using std::cout; using std::cin; using std::endl; #include "tstack1New.h" int main() { Stack Stack5( 5 ); double f = 1.1; while ( Stack5.push( f ) ) { // success true returned cout << f << ' '; f += 1.1; } cout << "\nStack is full.\n"; while ( Stack5.pop( &f ) ) // success true returned cout << f << ' '; cout << "\nStack is empty.\n"; Stack Stack10( 10 ); f = 1.1; while (Stack10.push(f ) ) { // success true returned cout << f << ' '; f += 1.1; } cout << "\nStack is full.\n"; while ( Stack10.pop( &f ) ) // success true returned cout << f << ' '; cout << "\nStack is empty.\n"; return 0; }
7bd53040381a6331bc6dfc9db71534f69eab8bc0
193f353dbf28356f605474aa34661c7e8c557045
/solutions/plus-minus.cpp
30efb41264668be564ab3de244052d23f2f01e4c
[]
no_license
caddok/CPlus-Excersises
7224f3cdebba335aa3df09fde567335cb2a9953f
96cd4638b659058bf80e27dc0e1d76dd4ca5871d
refs/heads/master
2021-05-07T14:55:36.157158
2017-12-04T21:28:12
2017-12-04T21:28:12
109,957,850
0
0
null
null
null
null
UTF-8
C++
false
false
813
cpp
plus-minus.cpp
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> #include <iomanip> using namespace std; int main(){ int n; cin >> n; vector<int> arr(n); for (int i = 0; i < n; i++) { cin >> arr[i]; } float positiveCount = 0; float negativeCount = 0; float zeroCount = 0; for (int i = 0; i < arr.size(); i++) { if (arr[i] > 0) { positiveCount++; } else if (arr[i] < 0) { negativeCount++; } else { zeroCount++; } } std::cout << fixed <<std::setprecision(6) << (positiveCount/arr.size()) << '\n'; std::cout << (negativeCount/arr.size()) << '\n'; std::cout << (zeroCount/arr.size()) << '\n'; return 0; }
453247ec99ffd77da3506cc5fdc9eef6848d6627
19194c2f2c07ab3537f994acfbf6b34ea9b55ae7
/android-32/android/util/AndroidException.def.hpp
1d999aa562f3456dcbd4b0179fd983546e37dea7
[ "GPL-3.0-only" ]
permissive
YJBeetle/QtAndroidAPI
e372609e9db0f96602da31b8417c9f5972315cae
ace3f0ea2678967393b5eb8e4edba7fa2ca6a50c
refs/heads/Qt6
2023-08-05T03:14:11.842336
2023-07-24T08:35:31
2023-07-24T08:35:31
249,539,770
19
4
Apache-2.0
2022-03-14T12:15:32
2020-03-23T20:42:54
C++
UTF-8
C++
false
false
734
hpp
AndroidException.def.hpp
#pragma once #include "../../java/lang/Exception.def.hpp" namespace java::lang { class Exception; } class JString; class JThrowable; namespace android::util { class AndroidException : public java::lang::Exception { public: // Fields // QJniObject forward template<typename ...Ts> explicit AndroidException(const char *className, const char *sig, Ts...agv) : java::lang::Exception(className, sig, std::forward<Ts>(agv)...) {} AndroidException(QJniObject obj) : java::lang::Exception(obj) {} // Constructors AndroidException(); AndroidException(java::lang::Exception arg0); AndroidException(JString arg0); AndroidException(JString arg0, JThrowable arg1); // Methods }; } // namespace android::util
0643b5e91dcaf8d09229b2124752f7c6a44454eb
230e9c6717e385b1b5bbf265fb681d0c75a758db
/ps1/test.cpp
e9f25f708b58fb91e0eda2d651d09308fb20314f
[]
no_license
paglenn/CHEM220B
b3b1e5c648be32c54c587ffd7be108c4d18cd102
a6ce9670329cd96ba4faa036d6542a6edfc09c0c
refs/heads/master
2021-01-01T16:21:01.124496
2015-09-25T06:55:20
2015-09-25T06:55:20
42,403,307
0
0
null
null
null
null
UTF-8
C++
false
false
168
cpp
test.cpp
#include<cholmod.h> #include<vector> #include<Eigen/Dense> using Eigen::MatrixXd; int main() { vector< vector<double> > myvec; MatrixXd m(2,2); return 0; }
9a61ff981f1ad0a57120989692d1ec9068d7a6bd
9f69d7c9dab0566daf8cf72936ffd7de42e116f4
/LIMoSim/mobility/followerModel/followermodel.cc
964cffebdaae26e92c90fdc83f4d11982acf4607
[ "MIT" ]
permissive
inet-framework/LIMoSim
3ef7b590e58148ed9f246e093a7bfdba8a845286
d9bdcefe82d41d4c8fd665a268843763fce59363
refs/heads/master
2020-03-24T21:13:24.970544
2019-08-08T12:59:09
2019-08-08T13:12:20
143,019,523
0
0
null
null
null
null
UTF-8
C++
false
false
221
cc
followermodel.cc
#include "followermodel.h" namespace LIMoSim { FollowerModel::FollowerModel(Car *_car, const std::string &_type) : p_car(_car), m_type(_type) { } std::string FollowerModel::getType() { return m_type; } }
f321a200db59e7c091118d106f6a0395407de2bd
9ae7b1e58f02623aef5a2c3186fb24163d27f38f
/SplayTree/SplayTree/src/Main.cpp
43c52e2bcdf205e2e43cc655741ee782bcef9788
[ "MIT" ]
permissive
guangylegend/Data-Structures
cc148ceacdcb812a6522d7ce49efb7b199c57fa4
0e39034833e7e3be9cb1b2193f86db24c8df5bba
refs/heads/master
2020-04-10T23:21:58.766949
2018-03-26T20:10:50
2018-03-26T20:10:50
124,306,307
0
0
null
null
null
null
UTF-8
C++
false
false
502
cpp
Main.cpp
#include<iostream> #include<algorithm> #include<vector> #include<list> #include"../include/AVLTree.h" #include"../include/SplayTree.h" using namespace std; int main() { AVLTree* avlTree = new AVLTree(); vector<int> res1; avlTree->insert(1); avlTree->insert(3); avlTree->insert(5); avlTree->erase(1); avlTree->insert(-2); avlTree->erase(3); avlTree->insert(-10); res1 = avlTree->inorderTraversal(); for (int num : res1) { cout << num << " "; } cout << endl; cin.get(); return 0; }
48daf56a100301c48f1c0478f02c4c131851424d
ad8371cd760a78d026085408b6ea9aefaffd359c
/instance/problem/continuous/multi_objective/UF/UF07.h
db88744fe97c5a20cd819b63bd99565fea5e4ceb
[]
no_license
Changhe160/OFEC_Alpha
f117384c4c026316b43c62849bf86c9e975ab4a5
e8fe5dd7928e4051e94cc8bd574d548794c76d26
refs/heads/master
2021-01-19T20:55:34.735993
2020-02-27T10:01:16
2020-02-27T10:01:16
101,239,434
11
8
null
2017-11-08T06:59:28
2017-08-24T01:14:55
C++
UTF-8
C++
false
false
295
h
UF07.h
#ifndef UF7_H #define UF7_H #include "UF.h" namespace OFEC { class UF07 final : public UF { public: UF07(param_map &v); UF07(const std::string &name, size_t size_var); ~UF07() {} void initialize(); private: void evaluate_objective(real *x, std::vector<real> &obj); }; } #endif
ad387cb35c0072690e65d6767b3ec27c219549a5
7de7c3c89d0547fa886c79949b63a27393d20829
/OrderBook/src/orderbook/OrderList.h
b8b5eef19d309a987db9e2433f9e1891e9baccc1
[]
no_license
encodeco/BitExchange
2622e1cd817cb0f0309bd6c3166fd58a86b87389
1454d0ce5d52d78df9c47596b9b5e76e0d8e9a17
refs/heads/master
2020-04-23T21:53:40.605328
2018-12-11T08:06:53
2018-12-11T08:06:53
171,484,068
0
0
null
null
null
null
UTF-8
C++
false
false
948
h
OrderList.h
#pragma once #include <list> #include <memory> class Order; class OrderList { private: std::list<std::shared_ptr<Order>> order_list; unsigned int volume; public: OrderList(); ~OrderList(); public: std::shared_ptr<Order> get_head_order() { return *(order_list.begin()); } std::shared_ptr<Order> get_tail_order() { return *(std::next(order_list.end(), -1)); } unsigned int length() { return order_list.size(); } bool is_exist() { return order_list.empty(); } void append_order(std::shared_ptr<Order> order); void remove_order(std::shared_ptr<Order> order); void set_volume(unsigned int volume) { this->volume = volume; } unsigned int get_volume() { return this->volume; } void move_to_tail(Order* order); //friend std::ostream& operator<< (std::ostream& os, const OrderList& obj); const std::list<std::shared_ptr<Order>> &get_order_list() { return order_list; } void print(); std::string text(); size_t quantity_sum(); };
0090530f2636a044d32ed817455d61074841e908
60705df548fcefe97c7f2b9bfbe5266526059560
/Source/OrdersAbilities/Classes/Orders/RTSOrderWithBehavior.h
5bdca85c8711a0e7f262cae9a6c9fbde678a7e80
[ "MIT" ]
permissive
DaedalicEntertainment/ue4-orders-abilities
c390487ab70cda10dd00d903863f6ee1069aeac1
11fba4da44ec414a92a4e9a673a2a75613075af2
refs/heads/develop
2021-07-05T09:38:53.076994
2019-04-08T09:35:43
2019-04-08T09:35:43
179,948,245
185
57
MIT
2020-10-09T01:51:57
2019-04-07T10:12:29
C++
UTF-8
C++
false
false
2,146
h
RTSOrderWithBehavior.h
#pragma once #include "CoreMinimal.h" #include "Orders/RTSOrderWithDisplay.h" #include "RTSOrderWithBehavior.generated.h" class AActor; class UBehaviorTree; /** * Order with custom behavior in form of a behavior tree. */ UCLASS(BlueprintType, Abstract, Blueprintable) class ORDERSABILITIES_API URTSOrderWithBehavior : public URTSOrderWithDisplay { GENERATED_BODY() public: URTSOrderWithBehavior(); /** Gets the behavior tree that should run in order to obey this order. */ UBehaviorTree* GetBehaviorTree() const; /** Whether to restart the behavior tree whenever a new order of this type is issued. */ bool ShouldRestartBehaviourTree() const; //~ Begin URTSOrder Interface virtual void IssueOrder(AActor* OrderedActor, const FRTSOrderTargetData& TargetData, int32 Index, FRTSOrderCallback Callback, const FVector& HomeLocation) const override; virtual bool GetAcquisitionRadiusOverride(const AActor* OrderedActor, int32 Index, float& OutAcquisitionRadius) const override; //~ End URTSOrder Interface private: /** The behavior tree that should run in order to obey this order. */ UPROPERTY(Category = "RTS Behavior", EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true)) UBehaviorTree* BehaviorTree; /** Whether to restart the behavior tree whenever a new order of this type is issued. */ UPROPERTY(Category = "RTS Behavior", EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true)) bool bShouldRestartBehaviourTree; /** The specific acquisition radius for this order. */ UPROPERTY(Category = "RTS Behavior", EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true, EditCondition = bIsAcquisitionRadiusOverridden)) float AcquisitionRadiusOverride; /** Whether this order uses a specific acquisition radius. */ UPROPERTY(Category = "RTS Behavior", EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = true, InlineEditConditionToggle = true)) bool bIsAcquisitionRadiusOverridden; };
9ee19a7c8a7ee93eea704c0779589144824650d9
9b85f76be1070dcf983012524366cfeb517e6219
/Magic/Torment/CardTorment.h
c701632b40462c26645f4b2c9962e54e7800774a
[]
no_license
Homebrew-Engine-Archive/botarena
691d35595a936c7adf5e0a495a5fbf35812244ef
044e2713315b165002f2e06911ce7455de2f773f
refs/heads/main
2023-05-10T15:58:08.520085
2021-03-17T13:11:56
2021-03-17T13:11:56
null
0
0
null
null
null
null
UTF-8
C++
false
false
30,261
h
CardTorment.h
#pragma once //____________________________________________________________________________ // __declspec(dllexport) counted_ptr<CCard> _cdecl CreateCard(CGame* pGame, LPCTSTR strCardName, StringArray& cardClassNames, UINT uID); //____________________________________________________________________________ // class CAngelOfRetributionCard : public CFlyingCreatureCard { DECLARE_CARD_CSTOR(CAngelOfRetributionCard); }; //____________________________________________________________________________ // class CAnuridScavengerCard : public CCreatureCard { DECLARE_CARD_CSTOR(CAnuridScavengerCard); }; //_____________________________________________________________________________ // class CCephalidSnitchCard : public CCreatureCard { DECLARE_CARD_CSTOR(CCephalidSnitchCard); }; //_____________________________________________________________________________ // class CSternJudgeCard : public CCreatureCard { DECLARE_CARD_CSTOR(CSternJudgeCard); }; //_____________________________________________________________________________ // class CDeepAnalysisCard : public CCard { DECLARE_CARD_CSTOR(CDeepAnalysisCard); }; //_____________________________________________________________________________ // class CAcornHarvestCard : public CCard { DECLARE_CARD_CSTOR(CAcornHarvestCard); }; //_____________________________________________________________________________ // class CChainersEdictCard : public CCard { DECLARE_CARD_CSTOR(CChainersEdictCard); }; //_____________________________________________________________________________ // class CCripplingFatigueCard : public CCard { DECLARE_CARD_CSTOR(CCripplingFatigueCard); }; //_____________________________________________________________________________ // class CAvenTrooperCard : public CPumpCreatureCard { DECLARE_CARD_CSTOR(CAvenTrooperCard); }; //____________________________________________________________________________ // class CBalshanCollaboratorCard : public CPumpCreatureCard { DECLARE_CARD_CSTOR(CBalshanCollaboratorCard); }; //____________________________________________________________________________ // class CBalthorTheStoutCard : public CCreatureCard { DECLARE_CARD_CSTOR(CBalthorTheStoutCard); }; //____________________________________________________________________________ // class CBarbarianOutcastCard : public CCreatureCard { DECLARE_CARD_CSTOR(CBarbarianOutcastCard); protected: bool SetTriggerContext1(CTriggeredMoveCardAbility::TriggerContextType& triggerContext, CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType) const; bool SetTriggerContext2(CTriggeredMoveCardAbility::TriggerContextType& triggerContext, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType) const; }; //____________________________________________________________________________ // class CCentaurVeteranCard : public CRegenerationCreatureCard { DECLARE_CARD_CSTOR(CCentaurVeteranCard); }; //____________________________________________________________________________ // class CEnslavedDwarfCard : public CCreatureCard { DECLARE_CARD_CSTOR(CEnslavedDwarfCard); }; //____________________________________________________________________________ // class CGrotesqueHybridCard : public CCreatureCard { DECLARE_CARD_CSTOR(CGrotesqueHybridCard); protected: bool SetTriggerContext(CTriggeredMoveCardAbility::TriggerContextType& triggerContext, CCreatureCard* pToCreature, Damage damage) const; }; //____________________________________________________________________________ // class CKrosanConstrictorCard : public CLandwalkCreatureCard { DECLARE_CARD_CSTOR(CKrosanConstrictorCard); }; //____________________________________________________________________________ // class CLlawanCephalidEmpressCard : public CCreatureCard { DECLARE_CARD_CSTOR(CLlawanCephalidEmpressCard); }; //____________________________________________________________________________ // class CNantukoCalmerCard : public CCreatureCard { DECLARE_CARD_CSTOR(CNantukoCalmerCard); }; //____________________________________________________________________________ // class CCentaurChieftainCard : public CHasteCreatureCard { DECLARE_CARD_CSTOR(CCentaurChieftainCard); protected: bool SetTriggerContext1(CTriggeredModifyCreatureAbility::TriggerContextType& triggerContext, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType) const; }; //____________________________________________________________________________ // class CTerohsVanguardCard : public CCreatureCard { DECLARE_CARD_CSTOR(CTerohsVanguardCard); protected: bool SetTriggerContext1(CTriggeredModifyCreatureAbility::TriggerContextType& triggerContext, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType) const; }; //____________________________________________________________________________ // class CPardicArsonistCard : public CCreatureCard { DECLARE_CARD_CSTOR(CPardicArsonistCard); protected: bool SetTriggerContext1(CTriggeredModifyLifeAbility::TriggerContextType& triggerContext, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType) const; }; //____________________________________________________________________________ // class CGloomdrifterCard : public CFlyingCreatureCard { DECLARE_CARD_CSTOR(CGloomdrifterCard); protected: bool SetTriggerContext1(CTriggeredModifyCreatureAbility::TriggerContextType& triggerContext, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType) const; }; //____________________________________________________________________________ // class CCephalidSageCard : public CCreatureCard { DECLARE_CARD_CSTOR(CCephalidSageCard); protected: bool SetTriggerContext(CTriggeredDiscardCardAbility::TriggerContextType& triggerContext, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType) const; }; //____________________________________________________________________________ // class CMysticFamiliarCard : public CFlyingCreatureCard { DECLARE_CARD_CSTOR(CMysticFamiliarCard); }; //____________________________________________________________________________ // class CCabalTorturerCard : public CCreatureCard { DECLARE_CARD_CSTOR(CCabalTorturerCard); protected: BOOL CanPlay(BOOL bIncludeTricks); }; //____________________________________________________________________________ // class CCabalRitualCard : public CCard { DECLARE_CARD_CSTOR(CCabalRitualCard); protected: bool BeforeResolution(CAbilityAction* pAction) const; }; //____________________________________________________________________________ // class CPutridImpCard : public CPumpCreatureCard { DECLARE_CARD_CSTOR(CPutridImpCard); }; //____________________________________________________________________________ // class CSetonsScoutCard : public CCreatureCard { DECLARE_CARD_CSTOR(CSetonsScoutCard); }; //____________________________________________________________________________ // class CMajorTerohCard : public CFlyingCreatureCard { DECLARE_CARD_CSTOR(CMajorTerohCard); }; //____________________________________________________________________________ // class CMilitantMonkCard : public CCreatureCard { DECLARE_CARD_CSTOR(CMilitantMonkCard); }; //____________________________________________________________________________ // class CPardicCollaboratorCard : public CPumpCreatureCard { DECLARE_CARD_CSTOR(CPardicCollaboratorCard); }; //____________________________________________________________________________ // class CSkywingAvenCard : public CFlyingCreatureCard { DECLARE_CARD_CSTOR(CSkywingAvenCard); }; //____________________________________________________________________________ // class CTerohsFaithfulCard : public CCreatureCard { DECLARE_CARD_CSTOR(CTerohsFaithfulCard); }; //____________________________________________________________________________ // class CZombieTrailblazerCard : public CCreatureCard { DECLARE_CARD_CSTOR(CZombieTrailblazerCard); protected: CCardFilter m_CardFilter; }; //____________________________________________________________________________ // class CCabalCoffersCard : public CNonbasicLandCard { DECLARE_CARD_CSTOR(CCabalCoffersCard); protected: bool BeforeResolution(CAbilityAction* pAction) const; }; //____________________________________________________________________________ // class CTaintedFieldCard : public CNonbasicLandCard { DECLARE_CARD_CSTOR(CTaintedFieldCard); protected: BOOL CanPlay(BOOL bIncludeTricks); }; //____________________________________________________________________________ // class CTaintedIsleCard : public CNonbasicLandCard { DECLARE_CARD_CSTOR(CTaintedIsleCard); protected: BOOL CanPlay(BOOL bIncludeTricks); }; //____________________________________________________________________________ // class CTaintedPeakCard : public CNonbasicLandCard { DECLARE_CARD_CSTOR(CTaintedPeakCard); protected: BOOL CanPlay(BOOL bIncludeTricks); }; //____________________________________________________________________________ // class CTaintedWoodCard : public CNonbasicLandCard { DECLARE_CARD_CSTOR(CTaintedWoodCard); protected: BOOL CanPlay(BOOL bIncludeTricks); }; //____________________________________________________________________________ // class CCompulsionCard : public CInPlaySpellCard { DECLARE_CARD_CSTOR(CCompulsionCard); }; //____________________________________________________________________________ // class CCracklingClubCard : public CChgPwrTghAttrEnchantCard { DECLARE_CARD_CSTOR(CCracklingClubCard); }; //____________________________________________________________________________ // class CHypochondriaCard : public CInPlaySpellCard { DECLARE_CARD_CSTOR(CHypochondriaCard); }; //____________________________________________________________________________ // class CMortiphobiaCard : public CInPlaySpellCard { DECLARE_CARD_CSTOR(CMortiphobiaCard); }; //____________________________________________________________________________ // class CNarcissismCard : public CInPlaySpellCard { DECLARE_CARD_CSTOR(CNarcissismCard); }; //____________________________________________________________________________ // class CAccelerateCard : public CChgPwrTghAttrSpellCard { DECLARE_CARD_CSTOR(CAccelerateCard); }; //____________________________________________________________________________ // class CWasteAwayCard : public CChgPwrTghAttrSpellCard { DECLARE_CARD_CSTOR(CWasteAwayCard); protected: CCardFilter m_CardFilter; }; //____________________________________________________________________________ // class CFlashOfDefianceCard : public CCard { DECLARE_CARD_CSTOR(CFlashOfDefianceCard); }; //____________________________________________________________________________ // class CMorningtideCard : public CCard { DECLARE_CARD_CSTOR(CMorningtideCard); }; //____________________________________________________________________________ // class CUnhingeCard : public CCard { DECLARE_CARD_CSTOR(CUnhingeCard); }; //____________________________________________________________________________ // class CFacelessButcherCard : public CCreatureCard { DECLARE_CARD_CSTOR(CFacelessButcherCard); protected: CCountedCardContainer_ pExiled; bool BeforeResolution1(CAbilityAction* pAction); typedef TTriggeredAbility < CTriggeredAbility<>, CWhenSelfInplay, CWhenSelfInplay::EventCallback, &CWhenSelfInplay::SetLeaveEventCallback > TriggeredAbility; bool SetTriggerContext(CTriggeredAbility<>::TriggerContextType& triggerContext, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType) const; bool BeforeResolution2(TriggeredAbility::TriggeredActionType* pAction); void OnZoneChanged(CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType); ListenerPtr<CardMovementEventSource::Listener> m_cpAListener; bool SetTriggerContextAux(CTriggeredAbility<>::TriggerContextType& triggerContext, CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType) const; bool BeforeResolutionAux(CAbilityAction* pAction); }; //____________________________________________________________________________ // class CPetravarkCard : public CCreatureCard { DECLARE_CARD_CSTOR(CPetravarkCard); private: CCardFlagModifier m_CardFlagModifier1; CCardFlagModifier m_CardFlagModifier2; }; //____________________________________________________________________________ // class CPetradonCard : public CPumpCreatureCard { DECLARE_CARD_CSTOR(CPetradonCard); private: CCardFlagModifier m_CardFlagModifier1; CCardFlagModifier m_CardFlagModifier2; }; //____________________________________________________________________________ // class CCabalSurgeonCard : public CCreatureCard { DECLARE_CARD_CSTOR(CCabalSurgeonCard); }; //____________________________________________________________________________ // class CCephalidAristocratCard : public CCreatureCard { DECLARE_CARD_CSTOR(CCephalidAristocratCard); }; //____________________________________________________________________________ // class CCephalidIllusionistCard : public CCreatureCard { DECLARE_CARD_CSTOR(CCephalidIllusionistCard); }; //____________________________________________________________________________ // class CKrosanRestorerCard : public CCreatureCard { DECLARE_CARD_CSTOR(CKrosanRestorerCard); protected: BOOL CanPlay(BOOL bIncludeTricks); }; //____________________________________________________________________________ // class COrganGrinderCard : public CCreatureCard { DECLARE_CARD_CSTOR(COrganGrinderCard); }; //____________________________________________________________________________ // class CMesmericFiendCard : public CCreatureCard { DECLARE_CARD_CSTOR(CMesmericFiendCard); protected: CCountedCardContainer_ pExiled; bool BeforeResolution1(CAbilityAction* pAction); typedef TTriggeredAbility < CTriggeredAbility<>, CWhenSelfInplay, CWhenSelfInplay::EventCallback, &CWhenSelfInplay::SetLeaveEventCallback > TriggeredAbility; bool SetTriggerContext(CTriggeredAbility<>::TriggerContextType& triggerContext, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType) const; bool BeforeResolution2(TriggeredAbility::TriggeredActionType* pAction); void OnZoneChanged(CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType); ListenerPtr<CardMovementEventSource::Listener> m_cpAListener; bool SetTriggerContextAux(CTriggeredAbility<>::TriggerContextType& triggerContext, CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType) const; bool BeforeResolutionAux(CAbilityAction* pAction); CSelectionSupport m_CardSelection; void OnCardSelected(const std::vector<SelectionEntry>& selection, int nSelectedCount, CPlayer* pSelectionPlayer, DWORD dwContext1, DWORD dwContext2, DWORD dwContext3, DWORD dwContext4, DWORD dwContext5); }; //____________________________________________________________________________ // class CIchoridCard : public CHasteCreatureCard { DECLARE_CARD_CSTOR(CIchoridCard); protected: CCardFilter m_CardFilter; bool SetTriggerContext(CTriggeredMoveCardAbility::TriggerContextType& triggerContext, CNode* pToNode) const; bool BeforeResolution(CAbilityAction* pAction) const; }; //____________________________________________________________________________ // class CInvigoratingFallsCard : public CCard { DECLARE_CARD_CSTOR(CInvigoratingFallsCard); }; //____________________________________________________________________________ // class CGravegougerCard : public CCreatureCard { DECLARE_CARD_CSTOR(CGravegougerCard); private: CCardFlagModifier m_CardFlagModifier1; CCardFlagModifier m_CardFlagModifier2; }; //____________________________________________________________________________ // class CSlitheryStalkerCard : public CLandwalkCreatureCard { DECLARE_CARD_CSTOR(CSlitheryStalkerCard); private: CCardFlagModifier m_CardFlagModifier1; CCardFlagModifier m_CardFlagModifier2; }; //____________________________________________________________________________ // class CDawnOfTheDeadCard : public CInPlaySpellCard { DECLARE_CARD_CSTOR(CDawnOfTheDeadCard); private: void OnResolutionCompleted(const CAbilityAction* pAbilityAction, BOOL bResult); ListenerPtr<ResolutionCompletedEventSource::Listener> m_cpEventListener; }; //____________________________________________________________________________ // class CFalseMemoriesCard : public CCard { DECLARE_CARD_CSTOR(CFalseMemoriesCard); protected: void OnResolutionCompleted(const CAbilityAction* pAbilityAction, BOOL bResult); ListenerPtr<ResolutionCompletedEventSource::Listener> m_cpEventListener; }; //____________________________________________________________________________ // class CChurningEddyCard : public CCard { DECLARE_CARD_CSTOR(CChurningEddyCard); }; //____________________________________________________________________________ // class CDwellOnThePastCard : public CCard { DECLARE_CARD_CSTOR(CDwellOnThePastCard); private: void OnResolutionCompleted(const CAbilityAction* pAbilityAction, BOOL bResult); ListenerPtr<ResolutionCompletedEventSource::Listener> m_cpEventListener; }; //____________________________________________________________________________ // class CKamahlsSledgeCard : public CTargetChgLifeSpellCard { DECLARE_CARD_CSTOR(CKamahlsSledgeCard); private: bool BeforeResolution(CAbilityAction* pAction) const; }; //____________________________________________________________________________ // class CBreakthroughCard : public CCard { DECLARE_CARD_CSTOR(CBreakthroughCard); private: void OnResolutionCompleted1(const CAbilityAction* pAbilityAction, BOOL bResult); ListenerPtr<ResolutionCompletedEventSource::Listener> m_cpEventListener1; }; //_____________________________________________________________________________ // class CGhostlyWingsCard : public CChgPwrTghAttrEnchantCard { DECLARE_CARD_CSTOR(CGhostlyWingsCard); protected: counted_ptr<CAbility> CreateAdditionalAbility(CCard* pCard); }; //___________________________________________________________________________ // class CAquamoebaCard : public CPumpCreatureCard { DECLARE_CARD_CSTOR(CAquamoebaCard); }; //_____________________________________________________________________________ // class CHypnoxCard : public CFlyingCreatureCard { DECLARE_CARD_CSTOR(CHypnoxCard); protected: typedef TTriggeredAbility< CTriggeredMoveCardAbility, CWhenSelfInplay, CWhenSelfInplay::EventCallback, &CWhenSelfInplay::SetEnterEventCallback > TriggeredAbility1; bool BeforeResolveSelection(TriggeredAbility1::TriggeredActionType* pAction); private: bool SetTriggerContext(CTriggeredMoveCardAbility::TriggerContextType& triggerContext, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType) const; CCardFlagModifier pModifier1; CCardFlagModifier pModifier2; CCardFlagModifier m_CardFlagModifier1; CCardFlagModifier m_CardFlagModifier2; }; //____________________________________________________________________________ // class CFieryTemperCard : public CTargetChgLifeSpellCard { DECLARE_CARD_CSTOR(CFieryTemperCard); protected: BOOL CanPlay1(BOOL bIncludeTricks); }; //_____________________________________________________________________________ // class CBaskingRootwallaCard : public CPumpCreatureCard { DECLARE_CARD_CSTOR(CBaskingRootwallaCard); protected: BOOL CanPlay1(BOOL bIncludeTricks); }; //_____________________________________________________________________________ // class CArrogantWurmCard : public CCreatureCard { DECLARE_CARD_CSTOR(CArrogantWurmCard); protected: BOOL CanPlay1(BOOL bIncludeTricks); }; //_____________________________________________________________________________ // class CFranticPurificationCard : public CTargetMoveCardSpellCard { DECLARE_CARD_CSTOR(CFranticPurificationCard); protected: BOOL CanPlay1(BOOL bIncludeTricks); }; //_____________________________________________________________________________ // class CViolentEruptionCard : public CTargetChgLifeSpellCard { DECLARE_CARD_CSTOR(CViolentEruptionCard); protected: BOOL CanPlay1(BOOL bIncludeTricks); }; //_____________________________________________________________________________ // class CObsessiveSearchCard : public CCard { DECLARE_CARD_CSTOR(CObsessiveSearchCard); protected: BOOL CanPlay1(BOOL bIncludeTricks); }; //_____________________________________________________________________________ // class CPsychoticHazeCard : public CGlobalChgLifeSpellCard { DECLARE_CARD_CSTOR(CPsychoticHazeCard); protected: BOOL CanPlay1(BOOL bIncludeTricks); }; //_____________________________________________________________________________ // class CStrengthOfIsolationCard : public CChgPwrTghAttrEnchantCard { DECLARE_CARD_CSTOR(CStrengthOfIsolationCard); protected: BOOL CanPlay1(BOOL bIncludeTricks); }; //_____________________________________________________________________________ // class CStrengthOfLunacyCard : public CChgPwrTghAttrEnchantCard { DECLARE_CARD_CSTOR(CStrengthOfLunacyCard); protected: BOOL CanPlay1(BOOL bIncludeTricks); }; //_____________________________________________________________________________ // class CInsidiousDreamsCard : public CCard { DECLARE_CARD_CSTOR(CInsidiousDreamsCard); protected: bool BeforeResolution(CAbilityAction* pAction) const; CCardFilter m_CardFilter; }; //_____________________________________________________________________________ // class CSickeningDreamsCard : public CCard { DECLARE_CARD_CSTOR(CSickeningDreamsCard); protected: bool BeforeResolution(CAbilityAction* pAction) const; CCardFilter m_CardFilter; }; //____________________________________________________________________________ // class CShadesFormCard : public CCard { DECLARE_CARD_CSTOR(CShadesFormCard); protected: counted_ptr<CAbility> CreateEnchantAbility(CCard* pEnchantedCard, CCard* pEnchantCard, ContextValue_& contextValue); bool SetTriggerContext(CTriggeredMoveCardAbility::TriggerContextType& triggerContext, CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType) const; }; //____________________________________________________________________________ // class CFarWanderingsCard : public CCard { DECLARE_CARD_CSTOR(CFarWanderingsCard); protected: bool BeforeResolution(CAbilityAction* pAction) const; }; //_____________________________________________________________________________ // class CChainerDementiaMasterCard : public CCreatureCard { DECLARE_CARD_CSTOR(CChainerDementiaMasterCard); protected: bool BeforeResolution(CAbilityAction* pAction) const; }; //____________________________________________________________________________ // class CBoneshardSlasherCard : public CFlyingCreatureCard { DECLARE_CARD_CSTOR(CBoneshardSlasherCard); protected: counted_ptr<CAbility> CreateAdditionalAbility(CCard* pCard); }; //___________________________________________________________________________ // class CPossessedAvenCard : public CFlyingCreatureCard { DECLARE_CARD_CSTOR(CPossessedAvenCard); protected: counted_ptr<CAbility> CreateAdditionalAbility(CCard* pCard); }; //___________________________________________________________________________ // class CPossessedBarbarianCard : public CFirstStrikeCreatureCard { DECLARE_CARD_CSTOR(CPossessedBarbarianCard); protected: counted_ptr<CAbility> CreateAdditionalAbility(CCard* pCard); }; //___________________________________________________________________________ // class CPossessedCentaurCard : public CCreatureCard { DECLARE_CARD_CSTOR(CPossessedCentaurCard); protected: counted_ptr<CAbility> CreateAdditionalAbility(CCard* pCard); }; //___________________________________________________________________________ // class CPossessedNomadCard : public CCreatureCard { DECLARE_CARD_CSTOR(CPossessedNomadCard); protected: counted_ptr<CAbility> CreateAdditionalAbility(CCard* pCard); }; //___________________________________________________________________________ // class CRancidEarthCard : public CTargetMoveCardSpellCard { DECLARE_CARD_CSTOR(CRancidEarthCard); protected: void OnResolutionCompleted(const CAbilityAction* pAbilityAction, BOOL bResult); ListenerPtr<ResolutionCompletedEventSource::Listener> m_cpEventListener; }; //____________________________________________________________________________ // class CCrazedFirecatCard : public CCreatureCard { DECLARE_CARD_CSTOR(CCrazedFirecatCard); protected: typedef TTriggeredAbility< CTriggeredAbility<>, CWhenSelfInplay, CWhenSelfInplay::EventCallback, &CWhenSelfInplay::SetEnterEventCallback > TriggeredAbility; CSelectionSupport m_FlipSelection; int FlipCount; bool BeforeResolution(TriggeredAbility::TriggeredActionType* pAction); void FlipFunction(CPlayer* pController); void OnFlipSelected(const std::vector<SelectionEntry>& selection, int nSelectedCount, CPlayer* pSelectionPlayer, DWORD dwContext1, DWORD dwContext2, DWORD dwContext3, DWORD dwContext4, DWORD dwContext5); }; //______________________________________________________________________________ // class CSkullscorchCard : public CCard { DECLARE_CARD_CSTOR(CSkullscorchCard); protected: CSelectionSupport m_PunisherSelection; bool BeforeResolution(CAbilityAction* pAction); void OnPunisherSelected(const std::vector<SelectionEntry>& selection, int nSelectedCount, CPlayer* pSelectionPlayer, DWORD dwContext1, DWORD dwContext2, DWORD dwContext3, DWORD dwContext4, DWORD dwContext5); }; //______________________________________________________________________________ // class CLonghornFirebeastCard : public CCreatureCard { DECLARE_CARD_CSTOR(CLonghornFirebeastCard); protected: CSelectionSupport m_PunisherSelection; bool BeforeResolution(CAbilityAction* pAction); void PunisherFunction(int PlayerID); void Advance(int PlayerID); void OnPunisherSelected(const std::vector<SelectionEntry>& selection, int nSelectedCount, CPlayer* pSelectionPlayer, DWORD dwContext1, DWORD dwContext2, DWORD dwContext3, DWORD dwContext4, DWORD dwContext5); }; //______________________________________________________________________________ // class CNantukoCultivatorCard : public CCreatureCard { DECLARE_CARD_CSTOR(CNantukoCultivatorCard); protected: CSelectionSupport m_NumberSelection; bool BeforeResolution(CAbilityAction* pAction); void OnNumberSelected(const std::vector<SelectionEntry>& selection, int nSelectedCount, CPlayer* pSelectionPlayer, DWORD dwContext1, DWORD dwContext2, DWORD dwContext3, DWORD dwContext4, DWORD dwContext5); }; //______________________________________________________________________________ // class CRetracedImageCard : public CCard { DECLARE_CARD_CSTOR(CRetracedImageCard); protected: CSelectionSupport m_CardSelection; bool BeforeResolution(CAbilityAction* pAction); void OnCardSelected(const std::vector<SelectionEntry>& selection, int nSelectedCount, CPlayer* pSelectionPlayer, DWORD dwContext1, DWORD dwContext2, DWORD dwContext3, DWORD dwContext4, DWORD dwContext5); }; //____________________________________________________________________________ // class CCircularLogicCard : public CCard { DECLARE_CARD_CSTOR(CCircularLogicCard); protected: class CCircularLogicAbility: public CCounterSpell { DEFINE_CREATE_TO_CPTR_ONLY; public: OVERRIDE(CCost, GetSpecialDenialCost)(CPlayer* pPlayer); protected: CCircularLogicAbility(CCard* pCard, LPCTSTR strManaCost); virtual ~CCircularLogicAbility() {} }; BOOL CanPlay1(BOOL bIncludeTricks); }; //____________________________________________________________________________ // class CLaquatussChampionCard : public CRegenerationCreatureCard { DECLARE_CARD_CSTOR(CLaquatussChampionCard); protected: CPlayer* pAffected; bool BeforeResolution1(CAbilityAction* pAction); bool BeforeResolution2(CAbilityAction* pAction); void OnZoneChanged(CCard* pCard, CZone* pFromZone, CZone* pToZone, CPlayer* pByPlayer, MoveType moveType); ListenerPtr<CardMovementEventSource::Listener> m_cpAListener; }; //____________________________________________________________________________ // class CGurzigostCard : public CCreatureCard { DECLARE_CARD_CSTOR(CGurzigostCard); }; //_____________________________________________________________________________ // class CPitchstoneWallCard : public CCreatureCard { DECLARE_CARD_CSTOR(CPitchstoneWallCard); protected: typedef TTriggeredAbility< CTriggeredAbility<>, CWhenCardDiscarded > TriggeredAbility; bool SetTriggerContext(CTriggeredAbility<>::TriggerContextType& triggerContext, CPlayer* pPlayer1, CCard* pCard, CPlayer* pByPlayer) const; bool BeforeResolution(TriggeredAbility::TriggeredActionType* pAction); CSelectionSupport m_UseSelection; void OnUseSelected(const std::vector<SelectionEntry>& selection, int nSelectedCount, CPlayer* pSelectionPlayer, DWORD dwContext1, DWORD dwContext2, DWORD dwContext3, DWORD dwContext4, DWORD dwContext5); }; //_____________________________________________________________________________ // class CInsistCard : public CCard { DECLARE_CARD_CSTOR(CInsistCard); }; //____________________________________________________________________________ // class COvermasterCard : public CCard { DECLARE_CARD_CSTOR(COvermasterCard); }; //____________________________________________________________________________ //
36a2489680a1d3f9bdb7c81df5f001f8d891c594
7206b6829a9bbb72b69c884e67a4f0716e5398cb
/lab-02-vector-addition/solution/vector_addition.cpp
2c49321fa1bd7ea678eac21a4726bd7d836f9a28
[]
no_license
umar456/training
7c426c50712acfb1598230d4eebe74786ac9f756
8a8295de8fb6482e7ec442b03c5fe1af60d3956d
refs/heads/master
2021-01-11T20:30:16.495158
2017-05-23T04:46:59
2017-05-23T04:46:59
79,130,444
0
0
null
null
null
null
UTF-8
C++
false
false
1,653
cpp
vector_addition.cpp
/* ArrayFire Training Day 1 Lab: Vector Addition This program will add two vectors and store the result in a third vector using the FPGA */ #define __CL_ENABLE_EXCEPTIONS #include "cl_helpers.hpp" #include <CL/cl.hpp> #include <iostream> #include <vector> using namespace std; using namespace cl; int main(void) { cl::Context context(CL_DEVICE_TYPE_ALL); vector<Device> devices = context.getInfo<CL_CONTEXT_DEVICES>(); for (int i = 0; i < devices.size(); i++) { cout << "Device Name: " << devices[i].getInfo<CL_DEVICE_NAME>() << endl; ; } cl::CommandQueue queue(context, devices[0]); vector<char> contents = readBinary("vector_addition.xclbin"); cl::Program::Binaries binaries; binaries.push_back(std::make_pair(contents.data(), contents.size())); cl::Program add_program(context, devices, binaries); cl::Kernel add_kernel(add_program, "add"); // setup data and create buffers int N = 100; ::size_t size = N * sizeof(int); vector<int> h_a(N, 1); vector<int> h_b(N, 2); vector<int> h_c(N); Buffer d_a(context, CL_MEM_COPY_HOST_PTR, size, &h_a.front()); Buffer d_b(context, CL_MEM_COPY_HOST_PTR, size, &h_b.front()); Buffer d_c(context, CL_MEM_WRITE_ONLY, size); // Setup and launch kernel add_kernel.setArg(0, d_a); add_kernel.setArg(1, d_b); add_kernel.setArg(2, d_c); // Enqueue the kernel with automatically determined work groups queue.enqueueNDRangeKernel(add_kernel, 0, N); // Retreive new values queue.enqueueReadBuffer(d_c, CL_TRUE, 0, size, &h_c.front()); // Display results for (int i = 0; i < N; i++) cout << h_c[i] << ", "; return EXIT_SUCCESS; }
4cb250c47866f9557a3c9c59407a70443c6e81ce
a5484aff3a74352ac63e0210e7094839f0e45e7d
/opengl-engine/src/util/Util.h
8ce0341f00796b766b30861963dfd7cee1decb9c
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
CaioIcy/ICG_OpenGL
f60882ac9cceb770a3b6c76d2908a6ac28aa9735
fc056514e4fad8139e1bc72a54b1023c1682d68d
refs/heads/master
2021-01-10T19:33:43.742853
2015-06-19T02:12:14
2015-06-19T02:12:14
32,032,222
0
1
null
null
null
null
UTF-8
C++
false
false
168
h
Util.h
#pragma once #include <string> namespace ogle { namespace util { std::string FileContentsToString(const std::string& path); } // namespace util } // namespace ogle
f82b9b22224464f4c409a9df98e6f61a3f2b4167
711500cddf75d009468e08fe737956b2f550e189
/Row.h
37eedf7e62618b09154daf2b554094d376608758
[]
no_license
ryanf323/ISTE100P1
2a33f7df5f57696673e0fa8e8399d9a4aa75b0a3
e44bafbbff36edfab0e72ca24c34fedb900b4a91
refs/heads/master
2021-01-20T07:51:08.916798
2014-03-02T17:20:05
2014-03-02T17:20:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
854
h
Row.h
/***************** * ISTE-101 * Project 1 * Row Header File * Edward Alvarez Mercedes * Ryan Flynn ******************/ #include <string> #include <iostream> using std::cout; using std::string; class Row { private: string number; string time; string source; string destination; string protocol; string info; public: //Constructor Row(); Row(string, string, string, string, string, string); //Mutators void setNumber (string); void setTime (string); void setDestination(string); void setProtocol(string); void setInfo(string); //Accessors string getNumber(); string getTime(); string getSource(); string getDestination(); string getProtocol(); string getInfo(); };
caca0f659b7bb55caf6b84c4ed8c226684637225
3bfdf726519f4c6871b19a5312bc29643a35ed35
/src/Evel/UdpSocket_WF.h
45691e63d2309d1b1078e56a5b7d3c6ac7345af1
[ "Apache-2.0" ]
permissive
hleclerc/Evel
3e9ee6d850b01ad01ede4b76ae5e1617313adfca
c607adda555f417dfc9fb4de310c07c48ea3642f
refs/heads/master
2021-01-20T12:54:56.993183
2017-03-23T10:59:20
2017-03-23T10:59:20
82,668,811
0
0
null
null
null
null
UTF-8
C++
false
false
1,180
h
UdpSocket_WF.h
#pragma once #include "UdpSocket.h" #include <functional> namespace Evel { /** */ class UdpSocket_WF : public UdpSocket { public: using TF_rdy = std::function<void ( UdpSocket_WF *socket )>; using TF_parse = std::function<void ( UdpSocket_WF *socket, const InetAddress &src, char **data, unsigned size )>; using TF_on_bind_error = std::function<void ( UdpSocket_WF *socket, const char *msg )>; using TF_allocate = std::function<void*( UdpSocket_WF *socket, size_t size )>; using TF_close = std::function<void ( UdpSocket_WF *socket )>; /// if f_parse is not defined wait_for_inp_at_beg() will be false using UdpSocket::UdpSocket; ~UdpSocket_WF(); TF_rdy f_rdy; TF_parse f_parse; TF_close f_close; TF_allocate f_allocate; TF_on_bind_error f_on_bind_error; protected: virtual void on_rdy (); virtual void parse ( const InetAddress &src, char **data, unsigned size ); virtual void *allocate ( size_t inp_buf_size ); virtual void on_bind_error ( const char *msg ); }; } // namespace Evel
d9449c6487094be9dcc91e47f031ca48f3a8b3cf
2e66fc50589d666a0cd8b2938bf74178813dbdf9
/testC++++/239_滑动窗口最大值.hpp
506ee79ab73083e83e4ec5b16af5b1827012a5d2
[]
no_license
kevinMkY/CPP_ALGO
dfae7e15d9ce75245b90ca1e6fe1e00ca13bee13
9bddfc60a9698e261aced5a4d6e4f90b3cc78865
refs/heads/master
2023-03-15T23:06:44.238375
2021-03-07T18:41:01
2021-03-07T18:41:01
294,155,521
1
0
null
null
null
null
UTF-8
C++
false
false
188
hpp
239_滑动窗口最大值.hpp
// // 239_滑动窗口最大值.hpp // testC++++ // // Created by ykh on 2020/9/17. // #ifndef _39_________hpp #define _39_________hpp void _239_test(); #endif /* _39_________hpp */
a465c848c472304ab1d34ea99510c52b3456dd7c
d858e33c1ee0a545ff14c5b7e92b76f3de4d3550
/Q151.cpp
e19559646d21c5372aa8a26e51077e359bdd9569
[]
no_license
haoyuan2016/leetcode
c00531c5dd9925e2a35a85e606dcb2bf053bb804
c15bb4fe3b3230815afe69f475d1349fb3d3320c
refs/heads/master
2021-01-11T01:04:27.706152
2017-02-15T22:26:41
2017-02-15T22:26:41
70,842,892
0
0
null
null
null
null
UTF-8
C++
false
false
506
cpp
Q151.cpp
class Solution { public: void reverseWords(string &s) { if(s.empty()) return; stringstream ss(s); string tmp; stack<string> st; while(getline(ss, tmp, ' ')) { if(!tmp.empty()) st.push(tmp); } string res = ""; while(!st.empty()) { res += st.top(); res += " "; st.pop(); } if(!res.empty()) res.pop_back(); s = res; } };
0be383d007ddfbd01bdbd90002d3310632f50728
3d9e2d58cb310dd5e3b8e1aca5979d66b81c6510
/algorithm/454_B.cpp
4955d3ee77817489ed4d5c10c3f18c6784b213b1
[]
no_license
praveen4698/competitiveProgrammingWithCpp
906f1ec5d3689755ff9c2547f987ae96ec8f8387
fbeeb8a9ccc7ea45201889415adfea07ab5dc92c
refs/heads/master
2021-07-08T21:19:20.250388
2020-09-20T08:40:49
2020-09-20T08:40:49
193,205,068
0
0
null
null
null
null
UTF-8
C++
false
false
748
cpp
454_B.cpp
#include<bits/stdc++.h> using namespace std; #define PI 3.14159265 #define ll long long int #define S(x) scanf("%d",&x) #define S2(x,y) scanf("%d %d",&x,&y) #define S3(x,y,z) scanf("%d %d %d",&x,&y,&z) #define P(x) printf("%d\n",x) static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL; vector<char> A[10]; int main() { for(int i=0;i<11;++i) { string s; getline(cin,s); if( i == 3 || i == 7) continue; if( i < 3) { int cont = 0; for(auto a:s) { if( s != ' ') { if( cont < 3) A[] } } } } return 0; }