blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
264
content_id
stringlengths
40
40
detected_licenses
listlengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
5
140
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
905 values
visit_date
timestamp[us]date
2015-08-09 11:21:18
2023-09-06 10:45:07
revision_date
timestamp[us]date
1997-09-14 05:04:47
2023-09-17 19:19:19
committer_date
timestamp[us]date
1997-09-14 05:04:47
2023-09-06 06:22:19
github_id
int64
3.89k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]date
2012-06-07 00:51:45
2023-09-14 21:58:39
gha_created_at
timestamp[us]date
2008-03-27 23:40:48
2023-08-21 23:17:38
gha_language
stringclasses
141 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
10.4M
extension
stringclasses
115 values
content
stringlengths
3
10.4M
authors
listlengths
1
1
author_id
stringlengths
0
158
761037c52df522ce2070629dd47a31923389d6d0
358668370a91ea6dbefc52fac818677af78f7669
/homework/Week05_trig_particles/src/testApp.h
d52e04811b576336cceb7f36e6d30fe00a1aacbf
[]
no_license
jmatthewgriffis/griffis_algo2013
73efb45b53f5a76e617d1e46257acebcec07bcbb
4cd17cff9481a6c845683a0da6b531ebb6b0d049
refs/heads/master
2016-09-07T23:56:35.770684
2015-01-05T21:32:51
2015-01-05T21:32:51
12,420,109
0
0
null
null
null
null
UTF-8
C++
false
false
629
h
#pragma once #include "ofMain.h" #include "Particle.h" #define numParticles 10 class testApp : public ofBaseApp{ public: void setup(); void update(); void draw(); void keyPressed(int key); void keyReleased(int key); void mouseMoved(int x, int y ); void mouseDragged(int x, int y, int button); void mousePressed(int x, int y, int button); void mouseReleased(int x, int y, int button); void windowResized(int w, int h); void dragEvent(ofDragInfo dragInfo); void gotMessage(ofMessage msg); float angle; // Store the angle of the vector of motion. vector<Particle> particleList; };
[ "grifj153@newschool.edu" ]
grifj153@newschool.edu
33c9a7c3fa130f2bec11640733dee057ee124a2b
a6ead881ba8aaa3d4e7b327c876df4fb28b81135
/chapter5/lcm.cpp
4a4dd2f0592b03df03b9a7cd4756d1868b1e41c5
[]
no_license
middleprince/AlgorithmNotes
11eff6e6f9f1ea93ffe8e88e8dc01587ac15736c
f587d977adf38de4a6d5736c94168cd4171949b9
refs/heads/master
2021-06-24T16:23:40.333101
2021-01-17T15:24:26
2021-01-17T15:24:26
189,587,442
0
0
null
null
null
null
UTF-8
C++
false
false
425
cpp
#include <cstdio> int gcd(int a, int b) { if(b == 0) return a; return gcd(b, a%b); } void swap(int* &a, int* &b) { int *temp = a; a = b; b = temp; } int main(void) { int a, b, d; while(scanf("%d %d", &a, &b) != EOF){ if(a<b){ int *x = &a, *y = &b; swap(x, y); printf("%d\n", a*(b/gcd(a, b))); //避免溢出 } } return 0; }
[ "hellangel.ah+github@gmail.com" ]
hellangel.ah+github@gmail.com
abf00e5eb3ec524e833326a1a1b64cd367d02e5e
b2fd3ad09b5986a45f4752ac9d2dd38e515b84e4
/MoravaEngine/src/Scene/SceneDeferredOGL.cpp
a28f04e12d27eef4e016599c1dcee0769efdc24b
[ "Apache-2.0" ]
permissive
HoogDooo/MoravaEngine
3778e33e55246e24dcfdd95903e51bc0ddbbb8ba
bddbcd572b600c9be6eaf3a059b81bd770b821ed
refs/heads/master
2023-05-06T00:41:39.075091
2021-05-25T02:34:04
2021-05-25T02:34:04
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,873
cpp
#include "Scene/SceneDeferredOGL.h" SceneDeferredOGL::SceneDeferredOGL() { sceneSettings.cameraPosition = glm::vec3(0.0f, 0.0f, 2.0f); sceneSettings.cameraStartYaw = -90.0f; sceneSettings.cameraStartPitch = 0.0f; sceneSettings.cameraMoveSpeed = 1.0f; // directional light sceneSettings.directionalLight.base.enabled = true; sceneSettings.directionalLight.base.ambientIntensity = 0.6f; sceneSettings.directionalLight.base.diffuseIntensity = 0.4f; ResourceManager::Init(); SetCamera(); SetLightManager(); m_RenderTarget = (int)RenderTarget::Forward; } SceneDeferredOGL::~SceneDeferredOGL() { } void SceneDeferredOGL::Update(float timestep, Window* mainWindow) { Scene::Update(timestep, mainWindow); } void SceneDeferredOGL::UpdateImGui(float timestep, Window* mainWindow) { bool p_open = true; ShowExampleAppDockSpace(&p_open, mainWindow); ImGui::Begin("Render Targets"); { ImGui::Text("Forward Rendering"); ImGui::RadioButton("Forward Rendering", &m_RenderTarget, (int)RenderTarget::Forward); ImGui::Separator(); ImGui::Text("Deferred Rendering"); ImGui::RadioButton("Deferred - Position", &m_RenderTarget, (int)RenderTarget::Deferred_Position); ImGui::RadioButton("Deferred - Diffuse", &m_RenderTarget, (int)RenderTarget::Deferred_Diffuse); ImGui::RadioButton("Deferred - Normal", &m_RenderTarget, (int)RenderTarget::Deferred_Normal); ImGui::RadioButton("Deferred - TexCoord", &m_RenderTarget, (int)RenderTarget::Deferred_TexCoord); ImGui::RadioButton("Deferred - SSAO", &m_RenderTarget, (int)RenderTarget::Deferred_SSAO); } ImGui::End(); } void SceneDeferredOGL::Render(Window* mainWindow, glm::mat4 projectionMatrix, std::string passType, std::map<std::string, Shader*> shaders, std::map<std::string, int> uniforms) { }
[ "dtrajko@gmail.com" ]
dtrajko@gmail.com
08560d1453bb9b9d328232eb24d01f205e465622
03277a6fc47da4c3ea98bb21cfe7efd6cd7ed343
/arm_compute/streamingClassifier_data.cpp
40ce00675e0f63b28cb37cd829f6f51bfcec49ef
[ "BSD-2-Clause" ]
permissive
matlab-deep-learning/Fault-Detection-Using-Deep-Learning-Classification
869382d3960c372d192db5f627a2b3b5418a3cba
539670f3868fbf66c51762fff8dc3843f7880242
refs/heads/master
2022-09-09T17:25:23.360209
2022-09-06T19:43:24
2022-09-06T19:43:24
248,592,738
64
25
NOASSERTION
2020-05-21T21:03:49
2020-03-19T19:56:02
C++
UTF-8
C++
false
false
388
cpp
// // File: streamingClassifier_data.cpp // // MATLAB Coder version : 5.2 // C/C++ source code generated on : 19-Mar-2021 15:00:36 // // Include Files #include "streamingClassifier_data.h" #include "rt_nonfinite.h" // Variable Definitions c_struct_T config; bool isInitialized_streamingClassifier{false}; // // File trailer for streamingClassifier_data.cpp // // [EOF] //
[ "dwilling@mathworks.com" ]
dwilling@mathworks.com
f0b585ffc22168ed669940ee4189f587e0cd685b
85d71de186845d23cba8bcd22a816adfbc1d3c2a
/src/multipolygon_handler_wrap.cpp
e715bfea3b243432ec950e0b4dc2005ecdf8406f
[ "BSL-1.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
mpmckenna8/node-osmium
07e851c8bbf27e4e83fbffdb9bbf00b2eaa30042
e0e235e8406b9cbbdca27c0240fc97a7c3fb8e91
refs/heads/master
2020-12-26T21:39:25.629792
2015-05-06T09:16:06
2015-05-06T09:16:06
37,078,625
1
0
null
2015-06-08T16:25:34
2015-06-08T16:25:34
null
UTF-8
C++
false
false
1,233
cpp
// node #include <node_buffer.h> // node-osmium #include "node_osmium.hpp" #include "multipolygon_handler_wrap.hpp" #include "utils.hpp" namespace node_osmium { v8::Persistent<v8::FunctionTemplate> MultipolygonHandlerWrap::constructor; void MultipolygonHandlerWrap::Initialize(v8::Handle<v8::Object> target) { v8::HandleScope scope; constructor = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(MultipolygonHandlerWrap::New)); constructor->InstanceTemplate()->SetInternalFieldCount(1); constructor->SetClassName(symbol_MultipolygonHandler); target->Set(symbol_MultipolygonHandler, constructor->GetFunction()); } v8::Handle<v8::Value> MultipolygonHandlerWrap::New(const v8::Arguments& args) { if (args.Length() == 1 && args[0]->IsExternal()) { v8::Local<v8::External> ext = v8::Local<v8::External>::Cast(args[0]); static_cast<MultipolygonHandlerWrap*>(ext->Value())->Wrap(args.This()); return args.This(); } else { return ThrowException(v8::Exception::TypeError(v8::String::New("osmium.MultipolygonHandler cannot be created in Javascript"))); } } } // namespace node_osmium
[ "jochen@topf.org" ]
jochen@topf.org
f5d4be1992165142ba8af9ab2010acd7bd9ca679
986964448a8813d5b9116b4f984543db043b6224
/src/core/lib/song.cpp
0483936e22e3ba851bd831834a73692d8c4d17aa
[]
no_license
Lenium37/SigLight
3c34c25a3ab673012685b3d535467049bed90bcf
cdc639f7667a3ee082446925fd7c4b9c9e7315df
refs/heads/master
2021-07-12T04:16:35.385565
2020-10-15T12:01:50
2020-10-15T12:01:50
213,935,458
0
0
null
null
null
null
UTF-8
C++
false
false
1,574
cpp
// // Created by Jan on 20.06.2019. // #include "song.h" #include "logger.h" #include <ghc/filesystem.hpp> Song::Song(const std::string &file_path) : file_path(file_path) {} const std::string Song::get_file_path() const { return file_path; } void Song::set_file_path(std::string _file_path) { this->file_path = _file_path; } bool Song::operator==(const Song &rhs) const { return file_path == rhs.file_path; } bool Song::operator!=(const Song &rhs) const { return !(rhs == *this); } Song::Song(const std::string &file_path, const int duration_in_sec) : file_path(file_path), duration_in_sec(duration_in_sec) { Logger::debug("new Song with fila path: {}", file_path); int minutes = duration_in_sec / 60; int secs = duration_in_sec % 60; this->formatted_duration = std::to_string(minutes) + ":" + std::to_string(secs); } const std::string Song::get_song_name() { return ghc::filesystem::path(file_path).filename().string(); } std::ostream &operator<<(std::ostream &os, const Song &song) { os << "file_path: " << song.file_path; return os; } Song::Song() { file_path = ""; } bool Song::is_empty() { return file_path.empty(); } const int Song::get_duration() { return this->duration_in_sec; } std::string Song::get_formatted_duration() { return this->formatted_duration; } void Song::set_title(std::string title) { this->title = title; } std::string Song::get_title() { return this->title; } void Song::set_artist(std::string artist) { this->artist = artist; } std::string Song::get_artist() { return this->artist; }
[ "hirth.johannes@gmx.de" ]
hirth.johannes@gmx.de
73cd4cb1786e70c415e7e65cd2226f0430613164
634120df190b6262fccf699ac02538360fd9012d
/Develop/mdk/cml2/MOBox.cpp
581fd12d058752599e02f559a12ba0057ed5ed49
[]
no_license
ktj007/Raiderz_Public
c906830cca5c644be384e68da205ee8abeb31369
a71421614ef5711740d154c961cbb3ba2a03f266
refs/heads/master
2021-06-08T03:37:10.065320
2016-11-28T07:50:57
2016-11-28T07:50:57
74,959,309
6
4
null
2016-11-28T09:53:49
2016-11-28T09:53:49
null
UHC
C++
false
false
5,343
cpp
#include "stdafx.h" #include "MMath.h" #include "MBox.h" #include "MObox.h" #include "MMatrix3.h" MOBox::MOBox(const MMatrix &_transform) { MVector3 axisX(_transform._11, _transform._21, _transform._31); MVector3 axisY(_transform._12, _transform._22, _transform._32); MVector3 axisZ(_transform._13, _transform._23, _transform._33); vRange.x = axisX.Length(); vRange.y = axisY.Length(); vRange.z = axisZ.Length(); vAxis[0] = axisX / vRange.x; vAxis[1] = axisY / vRange.y; vAxis[2] = axisZ / vRange.z; vPosition = MVector3(_transform._41, _transform._42, _transform._43); } MOBox::MOBox(const MVector3 &_xaxis, const MVector3 &_yaxis, const MVector3 &_zaxis, const MVector3 &_range, const MVector3 &_position) : vRange(_range) , vPosition(_position) { _ASSERT(MMath::Equals(_xaxis.Length(), 1.0f)); _ASSERT(MMath::Equals(_yaxis.Length(), 1.0f)); _ASSERT(MMath::Equals(_zaxis.Length(), 1.0f)); vAxis[0] = _xaxis; vAxis[1] = _yaxis; vAxis[2] = _zaxis; } bool MOBox::Intersect( const MBox &aabb ) { MOBox obb; //AABB정보 obb형태로 변환 obb.vPosition = (aabb.vmax + aabb.vmin) * 0.5f; obb.vAxis[0] = MVector3(1,0,0); obb.vAxis[1] = MVector3(0,1,0); obb.vAxis[2] = MVector3(0,0,1); obb.vRange[0] = (aabb.maxx - aabb.minx) * 0.5f; obb.vRange[1] = (aabb.maxy - aabb.miny) * 0.5f; obb.vRange[2] = (aabb.maxz - aabb.minz) * 0.5f; return intersect(*this,obb); } bool MOBox::Intersect( MOBox &rhs ) { return intersect(*this,rhs); } bool MOBox::intersect(MOBox &a, MOBox &b) { float ra, rb; MMatrix3 R, AbsR; // Compute rotation matrix expressing b in a's coordinate frame for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) R._m[i][j] = DotProduct(a.vAxis[i], b.vAxis[j]); // Compute translation vector t MVector3 t = b.vPosition - a.vPosition; // Bring translation into a's coordinate frame t = MVector3(DotProduct(t, a.vAxis[0]), DotProduct(t, a.vAxis[1]), DotProduct(t, a.vAxis[2])); // Compute common subexpressions. Add in an epsilon term to // counteract arithmetic errors when two edges are parallel and // their cross product is (near) null (see text for details) for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) AbsR._m[i][j] = fabs(R._m[i][j]) + MMath::EPSILON; // Test axes L = A0, L = A1, L = A2 for (int i = 0; i < 3; i++) { ra = a.vRange[i]; rb = b.vRange[0] * AbsR._m[i][0] + b.vRange[1] * AbsR._m[i][1] + b.vRange[2] * AbsR._m[i][2]; if (fabs(t[i]) > ra + rb) return 0; } // Test axes L = B0, L = B1, L = B2 for (int i = 0; i < 3; i++) { ra = a.vRange[0] * AbsR._m[0][i] + a.vRange[1] * AbsR._m[1][i] + a.vRange[2] * AbsR._m[2][i]; rb = b.vRange[i]; if (fabs(t[0] * R._m[0][i] + t[1] * R._m[1][i] + t[2] * R._m[2][i]) > ra + rb) return 0; } // Test axis L = A0 x B0 ra = a.vRange[1] * AbsR._m[2][0] + a.vRange[2] * AbsR._m[1][0]; rb = b.vRange[1] * AbsR._m[0][2] + b.vRange[2] * AbsR._m[0][1]; if (fabs(t[2] * R._m[1][0] - t[1] * R._m[2][0]) > ra + rb) return 0; // Test axis L = A0 x B1 ra = a.vRange[1] * AbsR._m[2][1] + a.vRange[2] * AbsR._m[1][1]; rb = b.vRange[0] * AbsR._m[0][2] + b.vRange[2] * AbsR._m[0][0]; if (fabs(t[2] * R._m[1][1] - t[1] * R._m[2][1]) > ra + rb) return 0; // Test axis L = A0 x B2 ra = a.vRange[1] * AbsR._m[2][2] + a.vRange[2] * AbsR._m[1][2]; rb = b.vRange[0] * AbsR._m[0][1] + b.vRange[1] * AbsR._m[0][0]; if (fabs(t[2] * R._m[1][2] - t[1] * R._m[2][2]) > ra + rb) return 0; // Test axis L = A1 x B0 ra = a.vRange[0] * AbsR._m[2][0] + a.vRange[2] * AbsR._m[0][0]; rb = b.vRange[1] * AbsR._m[1][2] + b.vRange[2] * AbsR._m[1][1]; if (fabs(t[0] * R._m[2][0] - t[2] * R._m[0][0]) > ra + rb) return 0; // Test axis L = A1 x B1 ra = a.vRange[0] * AbsR._m[2][1] + a.vRange[2] * AbsR._m[0][1]; rb = b.vRange[0] * AbsR._m[1][2] + b.vRange[2] * AbsR._m[1][0]; if (fabs(t[0] * R._m[2][1] - t[2] * R._m[0][1]) > ra + rb) return 0; // Test axis L = A1 x B2 ra = a.vRange[0] * AbsR._m[2][2] + a.vRange[2] * AbsR._m[0][2]; rb = b.vRange[0] * AbsR._m[1][1] + b.vRange[1] * AbsR._m[1][0]; if (fabs(t[0] * R._m[2][2] - t[2] * R._m[0][2]) > ra + rb) return 0; // Test axis L = A2 x B0 ra = a.vRange[0] * AbsR._m[1][0] + a.vRange[1] * AbsR._m[0][0]; rb = b.vRange[1] * AbsR._m[2][2] + b.vRange[2] * AbsR._m[2][1]; if (fabs(t[1] * R._m[0][0] - t[0] * R._m[1][0]) > ra + rb) return 0; // Test axis L = A2 x B1 ra = a.vRange[0] * AbsR._m[1][1] + a.vRange[1] * AbsR._m[0][1]; rb = b.vRange[0] * AbsR._m[2][2] + b.vRange[2] * AbsR._m[2][0]; if (fabs(t[1] * R._m[0][1] - t[0] * R._m[1][1]) > ra + rb) return 0; // Test axis L = A2 x B2 ra = a.vRange[0] * AbsR._m[1][2] + a.vRange[1] * AbsR._m[0][2]; rb = b.vRange[0] * AbsR._m[2][1] + b.vRange[1] * AbsR._m[2][0]; if (fabs(t[1] * R._m[0][2] - t[0] * R._m[1][2]) > ra + rb) return 0; // Since no separating axis found, the OBBs must be intersecting return true; } bool MOBox::IsOut( MVector3& v ) { //v를 obb좌표계로 MVector3 k = v - this->vPosition; MVector3 p (DotProduct(this->vAxis[0],k ) , DotProduct(this->vAxis[1],k ) , DotProduct(this->vAxis[2],k) ); float absx = fabs(this->vRange.x); float absy = fabs(this->vRange.y); float absz = fabs(this->vRange.z); if( p.x < -absx || absx < p.x ) return true; if( p.y < -absy || absy < p.y ) return true; if( p.z < -absz || absz < p.z ) return true; return false; }
[ "espause0703@gmail.com" ]
espause0703@gmail.com
f1cb677ba2a3451f2f9837a8b5bedaf792fca9b0
9240ceb15f7b5abb1e4e4644f59d209b83d70066
/sp/src/game/client/c_te_basebeam.h
b96a59a8658b946e66aa06deb3f1c1d9fa106274
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
Margen67/blamod
13e5cd9f7f94d1612eb3f44a2803bf2f02a3dcbe
d59b5f968264121d013a81ae1ba1f51432030170
refs/heads/master
2023-04-16T12:05:12.130933
2019-02-20T10:23:04
2019-02-20T10:23:04
264,556,156
2
0
NOASSERTION
2020-05-17T00:47:56
2020-05-17T00:47:55
null
UTF-8
C++
false
false
1,262
h
//========= Copyright Valve Corporation, All rights reserved. ============// // // Purpose: // // $Workfile: $ // $Date: $ // $NoKeywords: $ //=============================================================================// #if !defined( C_TE_BASEBEAM_H ) #define C_TE_BASEBEAM_H #ifdef _WIN32 #pragma once #endif #include "c_basetempentity.h" //----------------------------------------------------------------------------- // Purpose: Base entity for beam te's //----------------------------------------------------------------------------- class C_TEBaseBeam : public C_BaseTempEntity { public: DECLARE_CLASS( C_TEBaseBeam, C_BaseTempEntity ); DECLARE_CLIENTCLASS(); private: public: C_TEBaseBeam( void ); virtual ~C_TEBaseBeam( void ); virtual void PreDataUpdate( DataUpdateType_t updateType ); virtual void PostDataUpdate( DataUpdateType_t updateType ); public: int m_nModelIndex; int m_nHaloIndex; int m_nStartFrame; int m_nFrameRate; float m_fLife; float m_fWidth; float m_fEndWidth; int m_nFadeLength; float m_fAmplitude; int r, g, b, a; int m_nSpeed; int m_nFlags; }; EXTERN_RECV_TABLE(DT_BaseBeam); #endif // C_TE_BASEBEAM_H
[ "joe@valvesoftware.com" ]
joe@valvesoftware.com
8df800ed548d0923bbca70f315ce8dc50b551258
182681892a79c02bab76c9a96ccced8b587119b2
/App/MainView/MainView.h
e391ab10a897ff0bfc6dd283de11fdaeef11cf8e
[]
no_license
MarcinFilipek/HomCenter
71fdc7ab9e8b98c93334c565cd7776743e576031
15ab5fcc57b9f07a12780869b61119ec76d24cbf
refs/heads/master
2020-06-18T05:51:10.933122
2019-07-10T10:42:34
2019-07-10T10:42:34
196,185,538
1
0
null
null
null
null
UTF-8
C++
false
false
1,087
h
/* * MainView.h * * Created on: 5 maj 2017 * Author: Uzume */ #ifndef MAINVIEW_MAINVIEW_H_ #define MAINVIEW_MAINVIEW_H_ #include "../Touch/View/View.h" #include "../TestPresenter/TestPresenter.h" #include "../Touch/Image/Image.h" #include "../Touch/Button/Button.h" #include "../Touch/TextArea/TextArea.h" #include "../Touch/TextAreaWithWildcard/TextAreaWithWildcard.h" class MainView: public View<TestPresenter> { public: MainView() : buttonClicedCallback(this, &MainView::buttonClicked) { } virtual ~MainView() { } void setupScreen(void); void tearDownScreen(void); void buttonClicked(const AbstractButton& source); private: Image m_imageBackground; Image m_imageExit; Image m_imageKafelek; Image m_imageKreska; Image m_imageKreska2; Button m_buttonPower; Button m_buttonPower2; TextArea m_textCzesc; TextArea m_textDlugi; TextArea m_textDlugiLF; Unicode::UnicodeChar m_buffer[10]; TextAreaWithOneWildcard m_textWildcard; Container m_kontener; Callback<MainView, const AbstractButton&> buttonClicedCallback; }; #endif /* MAINVIEW_MAINVIEW_H_ */
[ "filipekmarcin180@gmail.com" ]
filipekmarcin180@gmail.com
6264c856b2fff0c244132f83942c037b05e0338d
f3648c911bddea84b6db0922dbc85cca26e812cb
/Match3/src/system/states/BootState.h
439268dd4c64ce75af03092bcef4f8c3dadef6e9
[]
no_license
bismyc/Match3
ebea1717ee794290c7f9dc1e913ef9e447ebb6da
d74b9222a0dbecf164ea28898803a43c8cb1380c
refs/heads/master
2023-01-23T01:14:53.156678
2019-05-09T20:25:45
2019-05-09T20:25:45
null
0
0
null
null
null
null
UTF-8
C++
false
false
296
h
#pragma once #include "IState.h" class BootState : public IState { public: BootState(); ~BootState(); virtual void Activate() override; virtual void Update(float deltaTime) override {} virtual void Render(Graphics* graphics) override {} virtual void Deactivate() override; private: };
[ "bismyc@9tailstudios.com" ]
bismyc@9tailstudios.com
6ede67d366e5620f5f25f442cf8c244dab62c4ca
388053b5097864119fa84eb0ecac00b88e21334d
/improved/src/ins-gnss/ins-pnp.cc
50750a4b6747534a4b2d1aeefafd9bfac40bd518
[]
no_license
Erensu/ignav
dffc4a334d15e51307dabd08ca23dcd237803ec1
c27110b267ae9ff19865d38eec4c5e71f5e73389
refs/heads/master
2021-12-10T02:50:52.151418
2021-12-07T02:09:44
2021-12-07T02:09:44
146,999,557
272
154
null
null
null
null
UTF-8
C++
false
false
17,558
cc
/*------------------------------------------------------------------------------ * ins-pnp.cc : PnP pose estimation algorithm * * reference : * [1] Lepetit V,Moreno-Noguer F,Fua P. EPnP: An AccurateO(n) Solution * to the PnP Problem[J]. International Journal of Computer Vision,2009, * 81(2):155-166. * * version : $Revision: 1.1 $ $Date: 2008/09/05 01:32:44 $ * history : 2018/11/27 1.0 new *-----------------------------------------------------------------------------*/ #include "carvig.h" /*-----------------------------------------------------------------------------*/ static int solve_deg2(double a, double b, double c, double &x1, double &x2) { double delta=b*b-4*a*c; if (delta<0) return 0; double inv_2a=0.5/a; if (delta==0) { x1=-b*inv_2a; x2=x1; return 1; } double sqrt_delta=sqrt(delta); x1=(-b+sqrt_delta)*inv_2a; x2=(-b-sqrt_delta)*inv_2a; return 2; } /* ---------------------------------------------------------------------------- * Reference : Eric W. Weisstein. "Cubic Equation." From MathWorld--A Wolfram * Web Resource. * http://mathworld.wolfram.com/CubicEquation.html * \return Number of real roots found. * ---------------------------------------------------------------------------*/ static int solve_deg3(double a, double b, double c, double d, double &x0, double &x1, double &x2) { if (a==0) { if (b==0) { if (c==0) return 0; x0=-d/c; return 1; } x2=0; return solve_deg2(b,c,d,x0,x1); } double inv_a=1.0/a; double b_a=inv_a*b,b_a2=b_a*b_a; double c_a=inv_a*c; double d_a=inv_a*d; double Q =(3*c_a-b_a2)/9; double R =(9*b_a*c_a-27*d_a-2*b_a*b_a2)/54; double Q3=Q*Q*Q; double D =Q3+R*R; double b_a_3=(1.0/3.0)*b_a; if (Q==0) { if (R==0) { x0=x1=x2=-b_a_3; return 3; } else { x0=pow(2*R,1.0/3.0)-b_a_3; return 1; } } if (D<=0) { double theta =acos(R/sqrt(-Q3)); double sqrt_Q=sqrt(-Q); x0=2*sqrt_Q*cos( theta /3.0)-b_a_3; x1=2*sqrt_Q*cos((theta+2*PI)/3.0)-b_a_3; x2=2*sqrt_Q*cos((theta+4*PI)/3.0)-b_a_3; return 3; } double AD=pow(fabs(R)+sqrt(D),1.0/3.0)*(R>0?1:(R<0?-1:0)); double BD=(AD==0)?0:-Q/AD; x0=AD+BD-b_a_3; return 1; } /* ---------------------------------------------------------------------------- * Reference : Eric W. Weisstein. "Quartic Equation." From MathWorld--A Wolfram * Web Resource. * http://mathworld.wolfram.com/QuarticEquation.html * \return Number of real roots found. * ---------------------------------------------------------------------------*/ static int solve_deg4(double a, double b, double c, double d, double e, double &x0, double &x1, double &x2, double &x3) { if (a==0) { x3=0; return solve_deg3(b,c,d,e,x0,x1,x2); } double inv_a=1.0/a; b*=inv_a; c*=inv_a; d*=inv_a; e*=inv_a; double b2=b*b,bc=b*c,b3=b2*b; double r0,r1,r2; int n=solve_deg3(1,-c,d*b-4*e,4*c*e-d*d-b2*e,r0,r1,r2); if (n==0) return 0; double R2=0.25*b2-c+r0,R; if (R2<0) return 0; R=sqrt(R2); double inv_R=1.0/R; int nb_real_roots=0; double D2,E2; if (R<10E-12) { double temp=r0*r0-4*e; if (temp<0) D2=E2=-1; else { double sqrt_temp=sqrt(temp); D2=0.75*b2-2*c+2*sqrt_temp; E2=D2-4*sqrt_temp; } } else { double u=0.75*b2-2*c-R2, v=0.25*inv_R*(4*bc-8*d-b3); D2=u+v; E2=u-v; } double b_4=0.25*b,R_2=0.5*R; if (D2>=0) { double D=sqrt(D2); nb_real_roots=2; double D_2=0.5*D; x0=R_2+D_2-b_4; x1=x0-D; } if (E2>=0) { double E =sqrt(E2); double E_2=0.5*E; if (nb_real_roots==0) { x0=-R_2+E_2-b_4; x1=x0-E; nb_real_roots=2; } else { x2=-R_2+E_2-b_4; x3=x2-E; nb_real_roots=4; } } return nb_real_roots; } /*----------------------------------------------------------------------------*/ static int jacobi_4x4(double *A, double *D, double *U) { static double Id[16]={1.0,0.0,0.0,0.0, 0.0,1.0,0.0,0.0, 0.0,0.0,1.0,0.0, 0.0,0.0,0.0,1.0 }; double B[4],Z[4],g,h,sum; int i,j,k; memcpy(U,Id,16*sizeof(double)); B[0]=A[0]; B[1]=A[5]; B[2]=A[10]; B[3]=A[15]; memcpy(D,B,4*sizeof(double)); memset(Z,0,4*sizeof(double)); for (int iter=0;iter<50;iter++) { sum=fabs(A[1])+fabs(A[2])+fabs(A[3])+fabs(A[6])+fabs(A[7])+fabs(A[11]); if (sum==0.0) return 1; double tresh=(iter<3)?0.2*sum/16.0:0.0; for (i=0;i<3;i++) { double *pAij=A+5*i+1; for (j=i+1;j<4;j++) { double Aij=*pAij,eps_machine=100.0*fabs(Aij); if (iter>3&&fabs(D[i])+eps_machine==fabs(D[i]) &&fabs(D[j])+eps_machine==fabs(D[j])) { *pAij=0.0; } else if (fabs(Aij)>tresh) { double hh=D[j]-D[i],t; if (fabs(hh)+eps_machine==fabs(hh)) t=Aij/hh; else { double theta=0.5*hh/Aij; t=1.0/(fabs(theta)+sqrt(1.0+theta*theta)); if (theta<0.0) t=-t; } hh=t*Aij; Z[i]-=hh; Z[j]+=hh; D[i]-=hh; D[j]+=hh; *pAij=0.0; double c=1.0/sqrt(1+t*t),s=t*c,tau=s/(1.0+c); for (k=0;k<=i-1;k++) { g=A[k*4+i]; h=A[k*4+j]; A[k*4+i]=g-s*(h+g*tau); A[k*4+j]=h+s*(g-h*tau); } for (k=i+1; k<=j-1;k++) { g=A[i*4+k]; h=A[k*4+j]; A[i*4+k]=g-s*(h+g*tau); A[k*4+j]=h+s*(g-h*tau); } for (k=j+1;k<4;k++) { g=A[i*4+k]; h=A[j*4+k]; A[i*4+k]=g-s*(h+g*tau); A[j*4+k]=h+s*(g-h*tau); } for (k=0;k<4;k++) { g=U[k*4+i]; h=U[k*4+j]; U[k*4+i]=g-s*(h+g*tau); U[k*4+j]=h+s*(g-h*tau); } } pAij++; } } for (i=0;i<4;i++) B[i]+=Z[i]; memcpy(D,B,4*sizeof(double)); memset(Z,0,4*sizeof(double)); } return 0; } /* pnp align------------------------------------------------------------------*/ static int pnpalign(double M_end[3][3], double X0,double Y0,double Z0,double X1,double Y1,double Z1, double X2,double Y2,double Z2,double R[3][3],double T[3]) { double Cs[3],Ce[3],s[3*3],Qs[16],evs[4],U[16]; double q[4],ev_max,q02,q0_1,q1_2,q2_3; double q12,q0_2,q1_3,q22,q0_3,q32; int i,j,i_ev; for (i=0;i<3;i++) { Ce[i]=(M_end[0][i]+M_end[1][i]+M_end[2][i])/3; } Cs[0]=(X0+X1+X2)/3; Cs[1]=(Y0+Y1+Y2)/3; Cs[2]=(Z0+Z1+Z2)/3; /* Covariance matrix s: */ for (j=0;j<3;j++) { s[0*3+j]=(X0*M_end[0][j]+X1*M_end[1][j]+X2*M_end[2][j])/3-Ce[j]*Cs[0]; s[1*3+j]=(Y0*M_end[0][j]+Y1*M_end[1][j]+Y2*M_end[2][j])/3-Ce[j]*Cs[1]; s[2*3+j]=(Z0*M_end[0][j]+Z1*M_end[1][j]+Z2*M_end[2][j])/3-Ce[j]*Cs[2]; } Qs[0*4+0]=s[0*3+0]+s[1*3+1]+s[2*3+2]; Qs[1*4+1]=s[0*3+0]-s[1*3+1]-s[2*3+2]; Qs[2*4+2]=s[1*3+1]-s[2*3+2]-s[0*3+0]; Qs[3*4+3]=s[2*3+2]-s[0*3+0]-s[1*3+1]; Qs[1*4+0]=Qs[0*4+1]=s[1*3+2]-s[2*3+1]; Qs[2*4+0]=Qs[0*4+2]=s[2*3+0]-s[0*3+2]; Qs[3*4+0]=Qs[0*4+3]=s[0*3+1]-s[1*3+0]; Qs[2*4+1]=Qs[1*4+2]=s[1*3+0]+s[0*3+1]; Qs[3*4+1]=Qs[1*4+3]=s[2*3+0]+s[0*3+2]; Qs[3*4+2]=Qs[2*4+3]=s[2*3+1]+s[1*3+2]; jacobi_4x4(Qs,evs,U); /* Looking for the largest eigen value: */ i_ev=0; ev_max=evs[i_ev]; for (i=1;i<4;i++) if (evs[i]>ev_max) ev_max=evs[i_ev=i]; /* Quaternion: */ for (i=0;i<4;i++) q[i]=U[i*4+i_ev]; q02 =q[0]*q[0],q12 =q[1]*q[1],q22 =q[2]*q[2],q32=q[3]*q[3]; q0_1=q[0]*q[1],q0_2=q[0]*q[2],q0_3=q[0]*q[3]; q1_2=q[1]*q[2],q1_3=q[1]*q[3]; q2_3=q[2]*q[3]; R[0][0]=q02+q12-q22-q32; R[0][1]=2.0*(q1_2-q0_3); R[0][2]=2.0*(q1_3+q0_2); R[1][0]=2.0*(q1_2+q0_3); R[1][1]=q02+q22-q12-q32; R[1][2]=2.0*(q2_3-q0_1); R[2][0]=2.0*(q1_3-q0_2); R[2][1]=2.0*(q2_3+q0_1); R[2][2]=q02+q32-q12-q22; for (i=0;i<3;i++) { T[i]=Ce[i]-(R[i][0]*Cs[0]+R[i][1]*Cs[1]+R[i][2]*Cs[2]); } return 1; } /* ---------------------------------------------------------------------------- * Given 3D distances between three points and cosines of 3 angles at the apex, * calculates. the lentghs of the line segments connecting projection center (P) * and the three 3D points (A, B, C). * Returned distances are for |PA|, |PB|, |PC| respectively. * Only the solution to the main branch. * Reference : X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang; "Complete Solution * Classification for the Perspective-Three-Point Problem" * IEEE Trans. on PAMI, vol. 25, No. 8, August 2003 * \param lengths3D Lengths of line segments up to four solutions. * \param dist3D Distance between 3D points in pairs |BC|, |AC|, |AB|. * \param cosines Cosine of the angles /_BPC, /_APC, /_APB. * \returns Number of solutions. * WARNING: NOT ALL THE DEGENERATE CASES ARE IMPLEMENTED * ----------------------------------------------------------------------------*/ static int solve_for_lengths(double lengths[4][3],double distances[3], double cosines[3]) { double p=cosines[0]*2; double q=cosines[1]*2; double r=cosines[2]*2; double inv_d22=1.0/(distances[2]*distances[2]); double a=inv_d22*(distances[0]*distances[0]); double b=inv_d22*(distances[1]*distances[1]); double a2=a*a,b2=b*b,p2=p*p,q2=q*q,r2=r*r; double pr=p*r,pqr=q*pr; /* check reality condition (the four points should not be coplanar) */ if (p2+q2+r2-pqr-1==0) { return 0; } double ab=a*b,a_2=2*a; double A=-2*b+b2+a2+1+ab*(2-r2)-a_2; /* check reality condition */ if (A==0) return 0; double a_4=4*a; double B=q*(-2*(ab+a2+1-b)+r2*ab+a_4)+pr*(b-b2+ab); double C=q2+b2*(r2+p2-2)-b*(p2+pqr)-ab*(r2+pqr)+(a2-a_2)*(2+q2)+2; double D=pr*(ab-b2+b)+q*((p2-2)*b+2*(ab-a2)+a_4-2); double E=1+2*(b-a-ab)+b2-b*p2+a2; double temp=(p2*(a-1+b)+r2*(a-1-b)+pqr-a*pqr); double b0=b*temp*temp; /* check reality condition */ if (b0==0) return 0; double real_roots[4]; int n=solve_deg4(A,B,C,D,E,real_roots[0],real_roots[1],real_roots[2],real_roots[3]); if (n==0) return 0; int nb_solutions=0; double r3=r2*r,pr2=p*r2,r3q=r3*q; double inv_b0=1.0/b0; /* for each solution of x */ for(int i=0;i<n;i++) { double x=real_roots[i]; /* check reality condition */ if (x<=0) continue; double x2=x*x; double b1= ((1-a-b)*x2+(q*a-q)*x+1-a+b)*(((r3*(a2+ab*(2-r2)-a_2+b2-2*b+1))*x+ (r3q*(2*(b-a2)+a_4+ab*(r2-2) -2)+pr2*(1+a2 +2*(ab-a-b) +r2*(b-b2) +b2)))*x2 + (r3*(q2*(1-2*a+a2)+r2*(b2-ab)-a_4+2*(a2-b2)+2)+r*p2*(b2+2*(ab-b-a)+1+a2)+pr2*q*(a_4+2*(b-ab-a2)-2-r2*b))*x+ 2*r3q*(a_2-b-a2+ab-1)+pr2*(q2-a_4+2*(a2-b2)+r2*b+q2*(a2-a_2)+2)+ p2*(p*(2*(ab-a-b)+a2+b2+1)+2*q*r*(b+a_2-a2-ab-1))); /* check reality condition */ if (b1<=0) continue; double y=inv_b0*b1; double v=x2+y*y-x*y*r; if (v<=0) continue; double Z=distances[2]/sqrt(v); double X=x*Z; double Y=y*Z; lengths[nb_solutions][0]=X; lengths[nb_solutions][1]=Y; lengths[nb_solutions][2]=Z; nb_solutions++; } return nb_solutions; } /* internal solve for p3p ----------------------------------------------------*/ static int p3pinternal(double R[4][3][3], double t[4][3], const voopt_t *opt, double mu0, double mv0, double X0, double Y0, double Z0, double mu1, double mv1, double X1, double Y1, double Z1, double mu2, double mv2, double X2, double Y2, double Z2) { double mk0,mk1,mk2; double norm,cx_fx,cy_fy; double inv_fx,inv_fy,M_orig[3][3];; double distances[3],cosines[3],lengths[4][3]; int n,i,nsols=0; cx_fx=opt->cam.K[6]/opt->cam.K[0]; cy_fy=opt->cam.K[7]/opt->cam.K[4]; inv_fx=1.0/opt->cam.K[0]; inv_fy=1.0/opt->cam.K[4]; mu0=inv_fx*mu0-cx_fx; mv0=inv_fy*mv0-cy_fy; norm=sqrt(mu0*mu0+mv0*mv0+1); mk0 =1.0/norm; mu0*=mk0; mv0*=mk0; mu1=inv_fx*mu1-cx_fx; mv1=inv_fy*mv1-cy_fy; norm=sqrt(mu1*mu1+mv1*mv1+1); mk1 =1.0/norm; mu1*=mk1; mv1*=mk1; mu2=inv_fx*mu2-cx_fx; mv2=inv_fy*mv2-cy_fy; norm=sqrt(mu2*mu2+mv2*mv2+1); mk2 =1.0/norm; mu2*=mk2; mv2*=mk2; distances[0]=sqrt((X1-X2)*(X1-X2)+(Y1-Y2)*(Y1-Y2)+(Z1-Z2)*(Z1-Z2)); distances[1]=sqrt((X0-X2)*(X0-X2)+(Y0-Y2)*(Y0-Y2)+(Z0-Z2)*(Z0-Z2)); distances[2]=sqrt((X0-X1)*(X0-X1)+(Y0-Y1)*(Y0-Y1)+(Z0-Z1)*(Z0-Z1)); /* calculate angles */ cosines[0]=mu1*mu2+mv1*mv2+mk1*mk2; cosines[1]=mu0*mu2+mv0*mv2+mk0*mk2; cosines[2]=mu0*mu1+mv0*mv1+mk0*mk1; n=solve_for_lengths(lengths,distances,cosines); for (i=0;i<n;i++) { M_orig[0][0]=lengths[i][0]*mu0; M_orig[0][1]=lengths[i][0]*mv0; M_orig[0][2]=lengths[i][0]*mk0; M_orig[1][0]=lengths[i][1]*mu1; M_orig[1][1]=lengths[i][1]*mv1; M_orig[1][2]=lengths[i][1]*mk1; M_orig[2][0]=lengths[i][2]*mu2; M_orig[2][1]=lengths[i][2]*mv2; M_orig[2][2]=lengths[i][2]*mk2; if (!pnpalign(M_orig,X0,Y0,Z0,X1,Y1,Z1,X2,Y2,Z2,R[nsols],t[nsols])) { continue; } nsols++; } return nsols; } /* p3p solver-----------------------------------------------------------------*/ static int p3psolve(double R[3][3], double t[3], const voopt_t *opt, double mu0, double mv0, double X0, double Y0, double Z0, double mu1, double mv1, double X1, double Y1, double Z1, double mu2, double mv2, double X2, double Y2, double Z2, double mu3, double mv3, double X3, double Y3, double Z3) { double Rs[4][3][3],ts[4][3]; int ns=0,i,j,n; double min_reproj=0; n=p3pinternal(Rs,ts,opt,mu0,mv0,X0,Y0,Z0,mu1,mv1,X1,Y1,Z1,mu2,mv2,X2,Y2,Z2); if (n==0) return 0; for (i=0;i<n;i++) { double X3p=Rs[i][0][0]*X3+Rs[i][0][1]*Y3+Rs[i][0][2]*Z3+ts[i][0]; double Y3p=Rs[i][1][0]*X3+Rs[i][1][1]*Y3+Rs[i][1][2]*Z3+ts[i][1]; double Z3p=Rs[i][2][0]*X3+Rs[i][2][1]*Y3+Rs[i][2][2]*Z3+ts[i][2]; double mu3p=opt->cam.K[6]+opt->cam.K[0]*X3p/Z3p; double mv3p=opt->cam.K[7]+opt->cam.K[4]*Y3p/Z3p; double reproj=(mu3p-mu3)*(mu3p-mu3)+(mv3p-mv3)*(mv3p-mv3); if (i==0||min_reproj>reproj) { ns=i; min_reproj=reproj; } } for (i=0;i<3;i++) { for (j=0;j<3;j++) R[i][j]=Rs[ns][i][j]; t[i]=ts[ns][i]; } return 1; } /* p3p pose estimation use only three points---------------------------------- * args: feature *feats I feature points * int nf I number of feature points * double *xp I points of world frame * int np I number of points in world frame * voopt_t *opt I options * double *R,*t O rotation matrix and translation vector * return: status (1: ok,0: fail) * note: input more than four points, use three to solve, use others to validate * ---------------------------------------------------------------------------*/ extern int p3pthree(const feature *feats,int nf,double *xp,int np, const voopt_t *opt,double *R,double *t) { double Rot[3][3],trans[3]; trace(3,"p3pthree:\n"); if (nf<4||np<4) { trace(2,"need more than four feature points\n"); return 0; } double mp[2*4]; int i,j; for (i=0;i<4;i++) { mp[2*i+0]=feats[i].u; mp[2*i+1]=feats[i].v; } if (!p3psolve(Rot,trans,opt,mp[0],mp[1],xp[0],xp[1],xp[2], mp[2],mp[3],xp[3],xp[ 4],xp[ 5], mp[4],mp[5],xp[6],xp[ 7],xp[ 8], mp[6],mp[7],xp[9],xp[10],xp[11])) { trace(2,"p3pthree solve fail\n"); seteye(R,3); setzero(t,1,3); return 0; } for (i=0;i<3;i++) { for (j=0;j<3;j++) R[i+3*j]=Rot[i][j]; t[i]=trans[i]; } return 1; } /* p3p pose estimation-------------------------------------------------------- * args: feature *feats I feature points * int nf I number of feature points * double *xp I points of world frame * int np I number of points in world frame * voopt_t *opt I options * double *R,*t O rotation matrix and translation vector * return: status (1: ok,0: fail) * ---------------------------------------------------------------------------*/ extern int p3p(const feature *feats,int nf,const double *xp,int np, const voopt_t *opt,double *R,double *t) { trace(3,"p3p:\n"); }
[ "1971129844@qq.com" ]
1971129844@qq.com
b5cad8b244222208ff2f67b136649f5584517c8e
33931acd25591d1066ec27b5453e01f66856c8f7
/Camera.h
abd6d0356eaf44ce541dec53f3e400e9d2fcc167
[]
no_license
AlfieEducation/OpenGL
87aea6509b3af2f86ceec52c942f2f602701238f
618a1e80a7f75ac909141a0bef9e5943b748dcdd
refs/heads/master
2020-11-28T19:28:24.888137
2020-01-30T14:24:58
2020-01-30T14:24:58
229,902,948
0
0
null
null
null
null
UTF-8
C++
false
false
716
h
#pragma once #include <GL\glew.h> #include <glm\glm.hpp> #include <glm\gtc\matrix_transform.hpp> #include <GLFW\glfw3.h> class Camera { public: Camera(); Camera(glm::vec3 startPosition, glm::vec3 startUp, GLfloat startYaw, GLfloat startPitch, GLfloat startMoveSpeed, GLfloat startTurnSpeed); void keyControl(bool* keys, GLfloat deltaTime); void mouseControl(GLfloat xChange, GLfloat yChange); glm::vec3 getCameraPosition(); glm::vec3 getCameraDirection(); glm::mat4 calculateViewMatrix(); ~Camera(); private: glm::vec3 position; glm::vec3 front; glm::vec3 up; glm::vec3 right; glm::vec3 worldUp; GLfloat yaw; GLfloat pitch; GLfloat moveSpeed; GLfloat turnSpeed; void update(); };
[ "alfie.developer@gmail.com" ]
alfie.developer@gmail.com
dc4331d6528222efa4aef59a83142cbcd8f58508
b1cc102f2c360707dce70e068f50f93e1ad8fb4c
/csSpreadControl.ino
c135da4840fbdf32f8f0320a965ce9c889d8985b
[ "MIT" ]
permissive
petruspierre/csSpreadControl
6f8d27adc64991a6466baa35f17489f076013c51
daebd46ed4c3fa773f0a1c6952d8a6a16f146545
refs/heads/master
2022-04-22T21:34:37.200108
2020-04-21T23:05:08
2020-04-21T23:05:08
257,680,229
1
0
null
null
null
null
UTF-8
C++
false
false
2,106
ino
#define pinBtn 13 int count = 0; void setup() { Serial.begin(9600); pinMode(pinBtn, INPUT_PULLUP); } void loop() { int _isPressed = digitalRead(pinBtn); Serial.println(_isPressed); if(_isPressed){ count++; mouse(count); delay(95); } else { if(count > 0){ Serial.println("release"); count=0; } } delay(10); } void mouse(int n){ switch(n){ case 1: Serial.println("press"); break; case 2: Serial.println("-2,19"); break; case 3: Serial.println("1,27"); break; case 4: Serial.println("2,27"); break; case 5: Serial.println("4,26"); break; case 6: Serial.println("5,27"); break; case 7: Serial.println("5,27"); break; case 8: Serial.println("2,29"); break; case 9: Serial.println("-10,29"); break; case 10: Serial.println("-20,10"); break; case 11: Serial.println("-15,3"); break; case 12: Serial.println("-10,4"); break; case 13: Serial.println("-6,2"); break; case 14: Serial.println("4,2"); break; case 15: Serial.println("14,3"); break; case 16: Serial.println("20,3"); break; case 17: Serial.println("20,3"); break; case 18: Serial.println("19,2"); break; case 19: Serial.println("12,-2"); break; case 20: Serial.println("2,-2"); break; case 21: Serial.println("-2,2"); break; case 22: Serial.println("-2,4"); break; case 23: Serial.println("3,2"); break; case 24: Serial.println("3,2"); break; case 25: Serial.println("-3,0"); break; case 26: Serial.println("-15,-2"); break; case 27: Serial.println("-44,-5"); break; case 28: Serial.println("-28,-7"); break; case 29: Serial.println("-29,-8"); break; case 30: count=0; Serial.println("release"); break; } }
[ "petrus.pierre@academico.ifpb.edu.br" ]
petrus.pierre@academico.ifpb.edu.br
929243d51a7f0716022507a886f9a1b025fa4127
fb4ce7ecd3f60a7f3e5abb902a943abc26b12849
/src/template.hpp
97650be941351bd967a6471c30c03a40310ff9dd
[]
no_license
shijieliu/snake
6763483a24bd1a536519a91e068832dcc5f350ee
96a4447a4b199b82e84f6355c40dde5d113056a3
refs/heads/master
2021-06-24T19:20:42.987465
2017-09-16T08:22:05
2017-09-16T08:22:05
103,082,495
0
0
null
null
null
null
UTF-8
C++
false
false
647
hpp
#ifndef TEMPLATE_H #define TEMPLATE_H #include <memory> namespace snake{ class snake; class apple; template <typename T> class initial_trait{//trait出shared_ptr的原有类型 public: typedef T value; }; template <> class initial_trait<std::shared_ptr<snake>>{ public: typedef snake value; }; template <> class initial_trait<std::shared_ptr<apple>>{ public: typedef apple value; }; struct score_t{ int _value; score_t(int _x):_value(_x){} int value() const {return _value;} }; struct level_t{ int _value; level_t(int x):_value(x){} int value() const {return _value;} }; } #endif
[ "13146012964@163.com" ]
13146012964@163.com
c462da1dc851b235af7309eb933bbc89a6f55e36
3482e6df74b3b47854adfe6050c60f7d206ed86b
/c++/studium/numerik/vonMises.cpp
1b482dd8d7d4a87f74e6b9c86e1836e218e3ca32
[]
no_license
acpanna/coding
8bef9275dc8a6606cc9d687bb3683ead79dacb7c
a0c9a6023c91c5a6f220b9b9f7170f7cb0b12c72
refs/heads/master
2020-12-03T08:13:17.116743
2013-10-01T08:02:47
2013-10-01T08:02:47
null
0
0
null
null
null
null
ISO-8859-1
C++
false
false
4,041
cpp
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <fstream.h> int main(void) { char enter, datei[256]; double **matrix; double *vektor1; double *vektor2; double norm; unsigned int zeilen, iterationen; unsigned int i, j, k; printf("Von - Mises - Eigenwert/Eigenvektor - Iteration\n"); printf("===============================================\n\n"); printf("\nBitte geben Sie die Dimension der quadrat. Matrix an : "); scanf("%u",&zeilen); if (zeilen == 0) exit(1); /* Speicherreservierung für Matrix, vektor1 und vektor2 */ matrix = (double **) calloc(zeilen, sizeof(double)); vektor1 = (double *) calloc(zeilen, sizeof(double)); vektor2 = (double *) calloc(zeilen, sizeof(double)); if (matrix == NULL || vektor1 == NULL || vektor2 == NULL) { printf("\n\nEs konnte nicht genügend freier Speicherplatz bereitgestellt"); printf("\nwerden, Sie müssen die Dimensionen kleiner wählen"); exit(1); } else { for (i=0; i<zeilen; i++) { matrix[i] = (double *) calloc(zeilen, sizeof(double)); if (matrix[i] == NULL) { printf("\n\nEs konnte nicht genügend freier Speicherplatz bereitgestellt"); printf("\nwerden, Sie müssen die Dimensionen kleiner wählen"); exit(1); } } } printf("\nWollen Sie die Matrix aus einer Datei einlesen (j/n) : "); scanf(" %c",&enter); if (enter == 'j' || enter == 'J') { printf("Dateiname : "); scanf("%s",&datei); ifstream fin(datei); /* Einlesen der Matrix */ for (i=0; i<zeilen; i++) for (j=0; j<zeilen; j++) { if (fin.eof()) { printf("\nEinlesefehler !!! Programmabbruch !!!"); exit(1); } fin >> matrix[i][j]; } fin.close(); } else /* Eingabe der Matrix */ { printf("\nBitte geben Sie nun die Matrixeinträge ein :\n"); for (i=0; i<zeilen; i++) for (j=0; j<zeilen; j++) { printf("Eintrag (%u,%u) : ",i+1,j+1); cin >> matrix[i][j]; } } printf("\nWollen Sie den Startvektor aus einer Datei einlesen (j/n) : "); scanf(" %c",&enter); if (enter == 'j' || enter == 'J') { printf("Dateiname : "); scanf("%s",&datei); ifstream fin(datei); /* Einlesen des Startvektors */ for (i=0; i<zeilen; i++) { if (fin.eof()) { printf("\nEinlesefehler !!! Programmabbruch !!!"); exit(1); } fin >> vektor1[i]; } fin.close(); } else /* Eingabe des Startvektors */ { printf("\nBitte geben Sie nun den Startvektor ein :\n"); for (i=0; i<zeilen; i++) { printf("Eintrag (%u) : ",i+1); cin >> vektor1[i]; } } printf("\nBitte geben Sie die maximale Iterationszahl ein : "); scanf("%u",&iterationen); /* ///// Beginn der Iteration ///// */ for (k=0; k<iterationen; k++) { norm = 0.0; for (i=0; i<zeilen; i++) norm += pow(vektor1[i],2); // Normierung des (Start-) Vektors norm = sqrt(norm); for (i=0; i<zeilen; i++) vektor1[i] /= norm; for (i=0; i<zeilen; i++) // Multiplikation A * x(i) { vektor2[i] = 0.0; for(j=0; j<zeilen;j++) vektor2[i] += matrix[i][j] * vektor1[j]; } for (i=0; i<zeilen; i++) // Kopiere gewonne Iterierte in vektor1 { double temp; temp = vektor1[i]; vektor1[i] = vektor2[i]; vektor2[i] = temp; } /* // Ausgabeanfang // */ printf("\n\nEigenvektor : (%lg",vektor2[0]); for (i=1; i<zeilen; i++) printf(", %lg",vektor2[i]); printf(")"); printf("\nKomponentenweise Eigenwerte : "); for (i=0; i<zeilen; i++) printf("%lg ",vektor1[i]/vektor2[i]); /* // Ausgabeende // */ } /* ///// Ende der Iteration ///// */ printf("\n\n"); for (i=0; i<zeilen; i++) delete matrix[i]; delete matrix; delete vektor1; delete vektor2; return 0; }
[ "heiko.vogel@birdworx.de" ]
heiko.vogel@birdworx.de
2e9560e562fc574a8fc63cbdfd99b3ac9cd17604
e11d62362decf103d16b5469a09f0d575bb5ccce
/ash/login/ui/parent_access_view_unittest.cc
3313a300b5a273b3e8fba274f85f09cc394cdd87
[ "BSD-3-Clause" ]
permissive
nhiroki/chromium
1e35fd8511c52e66f62e810c2f0aee54a20215c9
e65402bb161a854e42c0140ac1ab3217f39c134e
refs/heads/master
2023-03-13T18:09:40.765227
2019-09-10T06:06:31
2019-09-10T06:06:31
207,478,927
0
0
BSD-3-Clause
2019-09-10T06:12:21
2019-09-10T06:12:20
null
UTF-8
C++
false
false
26,089
cc
// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "ash/login/ui/parent_access_view.h" #include <memory> #include <string> #include "ash/accessibility/accessibility_controller_impl.h" #include "ash/keyboard/keyboard_controller_impl.h" #include "ash/login/mock_login_screen_client.h" #include "ash/login/ui/arrow_button_view.h" #include "ash/login/ui/login_button.h" #include "ash/login/ui/login_pin_view.h" #include "ash/login/ui/login_test_base.h" #include "ash/login/ui/login_test_utils.h" #include "ash/login/ui/parent_access_widget.h" #include "ash/session/test_session_controller_client.h" #include "ash/shell.h" #include "ash/strings/grit/ash_strings.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "ash/wm/work_area_insets.h" #include "base/bind.h" #include "base/macros.h" #include "base/optional.h" #include "base/test/bind_test_util.h" #include "base/test/metrics/histogram_tester.h" #include "base/time/time.h" #include "components/account_id/account_id.h" #include "components/session_manager/session_manager_types.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/aura/window.h" #include "ui/base/l10n/l10n_util.h" #include "ui/events/base_event_utils.h" #include "ui/events/event.h" #include "ui/events/test/event_generator.h" #include "ui/gfx/geometry/point.h" #include "ui/views/controls/button/label_button.h" #include "ui/views/controls/textfield/textfield.h" #include "ui/views/widget/widget.h" namespace ash { namespace { // Struct containing the correct title and description that are displayed when // the dialog is instantiated with a given ParentAccessRequestReason. struct ViewModifiersTestData { ParentAccessRequestReason reason; // The title string id. int title; // The description string id. int description; }; const ViewModifiersTestData kViewModifiersTestData[] = { {ParentAccessRequestReason::kUnlockTimeLimits, IDS_ASH_LOGIN_PARENT_ACCESS_TITLE, IDS_ASH_LOGIN_PARENT_ACCESS_DESCRIPTION}, {ParentAccessRequestReason::kChangeTime, IDS_ASH_LOGIN_PARENT_ACCESS_TITLE_CHANGE_TIME, IDS_ASH_LOGIN_PARENT_ACCESS_GENERIC_DESCRIPTION}, {ParentAccessRequestReason::kChangeTimezone, IDS_ASH_LOGIN_PARENT_ACCESS_TITLE_CHANGE_TIMEZONE, IDS_ASH_LOGIN_PARENT_ACCESS_GENERIC_DESCRIPTION}}; // TODO(crbug.com/996828): Make (at least some of) the tests use // ParentAccessWidget. class ParentAccessViewTest : public LoginTestBase { protected: ParentAccessViewTest() : account_id_(AccountId::FromUserEmail("child@gmail.com")) {} ~ParentAccessViewTest() override = default; // LoginScreenTest: void SetUp() override { LoginTestBase::SetUp(); login_client_ = std::make_unique<MockLoginScreenClient>(); } void TearDown() override { LoginTestBase::TearDown(); // If the test did not explicitly dismissed the widget, destroy it now. if (ParentAccessWidget::Get()) ParentAccessWidget::Get()->Destroy(); } // Simulates mouse press event on a |button|. void SimulateButtonPress(views::Button* button) { ui::MouseEvent event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), 0, 0); view_->ButtonPressed(button, event); } // Simulates mouse press event on pin keyboard |button|. void SimulatePinKeyboardPress(views::View* button) { ui::MouseEvent event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), 0, 0); button->OnEvent(&event); } // Called when ParentAccessView finished processing. void OnFinished(bool access_granted) { access_granted ? ++successful_validation_ : ++back_action_; } void StartView(ParentAccessRequestReason reason = ParentAccessRequestReason::kUnlockTimeLimits) { ParentAccessView::Callbacks callbacks; callbacks.on_finished = base::BindRepeating( &ParentAccessViewTest::OnFinished, base::Unretained(this)); validation_time_ = base::Time::Now(); view_ = new ParentAccessView(account_id_, callbacks, reason, validation_time_); SetWidget(CreateWidgetWithContent(view_)); } // Shows parent access widget with the specified |reason|. void ShowWidget(ParentAccessRequestReason reason) { ParentAccessWidget::Show( account_id_, base::BindRepeating(&ParentAccessViewTest::OnFinished, base::Unretained(this)), reason); ParentAccessWidget* widget = ParentAccessWidget::Get(); ASSERT_TRUE(widget); } // Dismisses existing parent access widget with back button click. Should be // only called when the widget is shown. void DismissWidget() { ParentAccessWidget* widget = ParentAccessWidget::Get(); ASSERT_TRUE(widget); ParentAccessView* view = ParentAccessWidget::TestApi(widget).parent_access_view(); ParentAccessView::TestApi test_api(view); ui::MouseEvent event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), 0, 0); view->ButtonPressed(test_api.back_button(), event); } // Verifies expectation that UMA |action| was logged. void ExpectUMAActionReported(ParentAccessView::UMAAction action, int bucket_count, int total_count) { histogram_tester_.ExpectBucketCount( ParentAccessView::kUMAParentAccessCodeAction, action, bucket_count); histogram_tester_.ExpectTotalCount( ParentAccessView::kUMAParentAccessCodeAction, total_count); } void SimulateFailedValidation() { login_client_->set_validate_parent_access_code_result(false); EXPECT_CALL(*login_client_, ValidateParentAccessCode_(account_id_, "012345", validation_time_)) .Times(1); ui::test::EventGenerator* generator = GetEventGenerator(); for (int i = 0; i < 6; ++i) { generator->PressKey(ui::KeyboardCode(ui::KeyboardCode::VKEY_0 + i), ui::EF_NONE); base::RunLoop().RunUntilIdle(); } } const AccountId account_id_; std::unique_ptr<MockLoginScreenClient> login_client_; // Number of times the view was dismissed with back button. int back_action_ = 0; // Number of times the view was dismissed after successful validation. int successful_validation_ = 0; // Time that will be used on the code validation. base::Time validation_time_; base::HistogramTester histogram_tester_; ParentAccessView* view_ = nullptr; // Owned by test widget view hierarchy. private: DISALLOW_COPY_AND_ASSIGN(ParentAccessViewTest); }; class ParentAccessViewModifiersTest : public ParentAccessViewTest, public ::testing::WithParamInterface<ViewModifiersTestData> {}; } // namespace // Tests that title and description are correctly set. TEST_P(ParentAccessViewModifiersTest, CheckStrings) { const ViewModifiersTestData& test_data = GetParam(); StartView(test_data.reason); ParentAccessView::TestApi test_api(view_); EXPECT_EQ(l10n_util::GetStringUTF16(test_data.title), test_api.title_label()->GetText()); EXPECT_EQ(l10n_util::GetStringUTF16(test_data.description), test_api.description_label()->GetText()); } INSTANTIATE_TEST_SUITE_P(, ParentAccessViewModifiersTest, testing::ValuesIn(kViewModifiersTestData)); // Tests that back button works. TEST_F(ParentAccessViewTest, BackButton) { StartView(); ParentAccessView::TestApi test_api(view_); EXPECT_TRUE(test_api.back_button()->GetEnabled()); EXPECT_EQ(0, back_action_); SimulateButtonPress(test_api.back_button()); EXPECT_EQ(1, back_action_); EXPECT_EQ(0, successful_validation_); ExpectUMAActionReported(ParentAccessView::UMAAction::kCanceledByUser, 1, 1); } // Tests that the code is autosubmitted when input is complete. TEST_F(ParentAccessViewTest, Autosubmit) { StartView(); ParentAccessView::TestApi test_api(view_); EXPECT_FALSE(test_api.submit_button()->GetEnabled()); login_client_->set_validate_parent_access_code_result(true); EXPECT_CALL(*login_client_, ValidateParentAccessCode_(account_id_, "012345", validation_time_)) .Times(1); ui::test::EventGenerator* generator = GetEventGenerator(); for (int i = 0; i < 6; ++i) { generator->PressKey(ui::KeyboardCode(ui::KeyboardCode::VKEY_0 + i), ui::EF_NONE); base::RunLoop().RunUntilIdle(); } EXPECT_EQ(1, successful_validation_); ExpectUMAActionReported(ParentAccessView::UMAAction::kValidationSuccess, 1, 1); } // Tests that submit button submits code from code input. TEST_F(ParentAccessViewTest, SubmitButton) { StartView(); ParentAccessView::TestApi test_api(view_); EXPECT_FALSE(test_api.submit_button()->GetEnabled()); SimulateFailedValidation(); auto* generator = GetEventGenerator(); // Updating input code (here last digit) should clear error state. generator->PressKey(ui::KeyboardCode::VKEY_6, ui::EF_NONE); EXPECT_EQ(ParentAccessView::State::kNormal, test_api.state()); EXPECT_TRUE(test_api.submit_button()->GetEnabled()); login_client_->set_validate_parent_access_code_result(true); EXPECT_CALL(*login_client_, ValidateParentAccessCode_(account_id_, "012346", validation_time_)) .Times(1); SimulateButtonPress(test_api.submit_button()); base::RunLoop().RunUntilIdle(); EXPECT_EQ(1, successful_validation_); ExpectUMAActionReported(ParentAccessView::UMAAction::kValidationSuccess, 1, 2); } // Tests that help button opens help app. TEST_F(ParentAccessViewTest, HelpButton) { auto client = std::make_unique<MockLoginScreenClient>(); StartView(); ParentAccessView::TestApi test_api(view_); EXPECT_TRUE(test_api.help_button()->GetEnabled()); EXPECT_CALL(*client, ShowParentAccessHelpApp()).Times(1); SimulateButtonPress(test_api.help_button()); ExpectUMAActionReported(ParentAccessView::UMAAction::kGetHelp, 1, 1); } // Tests that access code can be entered with numpad. TEST_F(ParentAccessViewTest, Numpad) { StartView(); ParentAccessView::TestApi test_api(view_); login_client_->set_validate_parent_access_code_result(true); EXPECT_CALL(*login_client_, ValidateParentAccessCode_(account_id_, "012345", validation_time_)) .Times(1); ui::test::EventGenerator* generator = GetEventGenerator(); for (int i = 0; i < 6; ++i) { generator->PressKey(ui::KeyboardCode(ui::VKEY_NUMPAD0 + i), ui::EF_NONE); base::RunLoop().RunUntilIdle(); } EXPECT_TRUE(test_api.submit_button()->GetEnabled()); EXPECT_EQ(1, successful_validation_); ExpectUMAActionReported(ParentAccessView::UMAAction::kValidationSuccess, 1, 1); } // Tests that access code can be submitted with press of 'enter' key. TEST_F(ParentAccessViewTest, SubmitWithEnter) { StartView(); ParentAccessView::TestApi test_api(view_); EXPECT_FALSE(test_api.submit_button()->GetEnabled()); SimulateFailedValidation(); // Updating input code (here last digit) should clear error state. auto* generator = GetEventGenerator(); generator->PressKey(ui::KeyboardCode::VKEY_6, ui::EF_NONE); EXPECT_EQ(ParentAccessView::State::kNormal, test_api.state()); login_client_->set_validate_parent_access_code_result(true); EXPECT_CALL(*login_client_, ValidateParentAccessCode_(account_id_, "012346", validation_time_)) .Times(1); generator->PressKey(ui::KeyboardCode::VKEY_RETURN, ui::EF_NONE); base::RunLoop().RunUntilIdle(); EXPECT_EQ(1, successful_validation_); ExpectUMAActionReported(ParentAccessView::UMAAction::kValidationSuccess, 1, 2); } // Tests that 'enter' key does not submit incomplete code. TEST_F(ParentAccessViewTest, PressEnterOnIncompleteCode) { StartView(); ParentAccessView::TestApi test_api(view_); EXPECT_FALSE(test_api.submit_button()->GetEnabled()); // Enter incomplete code. ui::test::EventGenerator* generator = GetEventGenerator(); for (int i = 0; i < 5; ++i) { generator->PressKey(ui::KeyboardCode(ui::KeyboardCode::VKEY_0 + i), ui::EF_NONE); base::RunLoop().RunUntilIdle(); } EXPECT_FALSE(test_api.submit_button()->GetEnabled()); login_client_->set_validate_parent_access_code_result(true); EXPECT_CALL(*login_client_, ValidateParentAccessCode_).Times(0); // Pressing enter should not submit incomplete code. generator->PressKey(ui::KeyboardCode::VKEY_RETURN, ui::EF_NONE); base::RunLoop().RunUntilIdle(); EXPECT_EQ(0, successful_validation_); login_client_->set_validate_parent_access_code_result(false); EXPECT_CALL(*login_client_, ValidateParentAccessCode_(account_id_, "012349", validation_time_)) .Times(1); // Fill in last digit of the code. generator->PressKey(ui::KeyboardCode(ui::KeyboardCode::VKEY_9), ui::EF_NONE); base::RunLoop().RunUntilIdle(); // Updating input code (here last digit) should clear error state. generator->PressKey(ui::KeyboardCode::VKEY_6, ui::EF_NONE); EXPECT_EQ(ParentAccessView::State::kNormal, test_api.state()); login_client_->set_validate_parent_access_code_result(true); EXPECT_CALL(*login_client_, ValidateParentAccessCode_(account_id_, "012346", validation_time_)) .Times(1); // Now the code should be submitted with enter key. generator->PressKey(ui::KeyboardCode::VKEY_RETURN, ui::EF_NONE); base::RunLoop().RunUntilIdle(); EXPECT_EQ(1, successful_validation_); ExpectUMAActionReported(ParentAccessView::UMAAction::kValidationSuccess, 1, 2); } // Tests that backspace button works. TEST_F(ParentAccessViewTest, Backspace) { StartView(); ParentAccessView::TestApi test_api(view_); EXPECT_FALSE(test_api.submit_button()->GetEnabled()); SimulateFailedValidation(); EXPECT_EQ(ParentAccessView::State::kError, test_api.state()); ui::test::EventGenerator* generator = GetEventGenerator(); // Active field has content - backspace clears the content, but does not move // focus. generator->PressKey(ui::KeyboardCode::VKEY_BACK, ui::EF_NONE); EXPECT_FALSE(test_api.submit_button()->GetEnabled()); // Active Field is empty - backspace moves focus to before last field. generator->PressKey(ui::KeyboardCode::VKEY_BACK, ui::EF_NONE); EXPECT_FALSE(test_api.submit_button()->GetEnabled()); // Change value in before last field. generator->PressKey(ui::KeyboardCode::VKEY_2, ui::EF_NONE); base::RunLoop().RunUntilIdle(); EXPECT_FALSE(test_api.submit_button()->GetEnabled()); // Fill in value in last field. generator->PressKey(ui::KeyboardCode::VKEY_3, ui::EF_NONE); base::RunLoop().RunUntilIdle(); EXPECT_TRUE(test_api.submit_button()->GetEnabled()); login_client_->set_validate_parent_access_code_result(true); EXPECT_CALL(*login_client_, ValidateParentAccessCode_(account_id_, "012323", validation_time_)) .Times(1); SimulateButtonPress(test_api.submit_button()); base::RunLoop().RunUntilIdle(); EXPECT_EQ(1, successful_validation_); ExpectUMAActionReported(ParentAccessView::UMAAction::kValidationSuccess, 1, 2); } // Tests input with virtual pin keyboard. TEST_F(ParentAccessViewTest, PinKeyboard) { StartView(); Shell::Get()->tablet_mode_controller()->SetEnabledForTest(true); ParentAccessView::TestApi test_api(view_); LoginPinView::TestApi test_pin_keyboard(test_api.pin_keyboard_view()); EXPECT_FALSE(test_api.submit_button()->GetEnabled()); login_client_->set_validate_parent_access_code_result(true); EXPECT_CALL(*login_client_, ValidateParentAccessCode_(account_id_, "012345", validation_time_)) .Times(1); for (int i = 0; i < 6; ++i) { SimulatePinKeyboardPress(test_pin_keyboard.GetButton(i)); base::RunLoop().RunUntilIdle(); } EXPECT_TRUE(test_api.submit_button()->GetEnabled()); EXPECT_EQ(1, successful_validation_); ExpectUMAActionReported(ParentAccessView::UMAAction::kValidationSuccess, 1, 1); } // Tests that pin keyboard visibility changes upon tablet mode changes. TEST_F(ParentAccessViewTest, PinKeyboardVisibilityChange) { StartView(); ParentAccessView::TestApi test_api(view_); LoginPinView::TestApi test_pin_keyboard(test_api.pin_keyboard_view()); EXPECT_FALSE(test_api.pin_keyboard_view()->GetVisible()); Shell::Get()->tablet_mode_controller()->SetEnabledForTest(true); EXPECT_TRUE(test_api.pin_keyboard_view()->GetVisible()); Shell::Get()->tablet_mode_controller()->SetEnabledForTest(false); EXPECT_FALSE(test_api.pin_keyboard_view()->GetVisible()); } // Tests that error state is shown and cleared when neccesary. TEST_F(ParentAccessViewTest, ErrorState) { StartView(); ParentAccessView::TestApi test_api(view_); EXPECT_EQ(ParentAccessView::State::kNormal, test_api.state()); // Error should be shown after unsuccessful validation. SimulateFailedValidation(); EXPECT_EQ(ParentAccessView::State::kError, test_api.state()); EXPECT_EQ(0, successful_validation_); ExpectUMAActionReported(ParentAccessView::UMAAction::kValidationError, 1, 1); // Updating input code (here last digit) should clear error state. auto* generator = GetEventGenerator(); generator->PressKey(ui::KeyboardCode::VKEY_6, ui::EF_NONE); EXPECT_EQ(ParentAccessView::State::kNormal, test_api.state()); login_client_->set_validate_parent_access_code_result(true); EXPECT_CALL(*login_client_, ValidateParentAccessCode_(account_id_, "012346", validation_time_)) .Times(1); SimulateButtonPress(test_api.submit_button()); base::RunLoop().RunUntilIdle(); EXPECT_EQ(1, successful_validation_); ExpectUMAActionReported(ParentAccessView::UMAAction::kValidationError, 1, 2); } // Tests children views traversal with tab key. TEST_F(ParentAccessViewTest, TabKeyTraversal) { StartView(); ParentAccessView::TestApi test_api(view_); EXPECT_TRUE(HasFocusInAnyChildView(test_api.access_code_view())); SimulateFailedValidation(); // Updating input code (here last digit) should clear error state. auto* generator = GetEventGenerator(); generator->PressKey(ui::KeyboardCode::VKEY_6, ui::EF_NONE); base::RunLoop().RunUntilIdle(); EXPECT_EQ(ParentAccessView::State::kNormal, test_api.state()); EXPECT_TRUE(test_api.submit_button()->HasFocus()); generator->PressKey(ui::KeyboardCode::VKEY_TAB, ui::EF_NONE); EXPECT_TRUE(test_api.back_button()->HasFocus()); generator->PressKey(ui::KeyboardCode::VKEY_TAB, ui::EF_NONE); EXPECT_TRUE(test_api.title_label()->HasFocus()); generator->PressKey(ui::KeyboardCode::VKEY_TAB, ui::EF_NONE); EXPECT_TRUE(test_api.description_label()->HasFocus()); generator->PressKey(ui::KeyboardCode::VKEY_TAB, ui::EF_NONE); EXPECT_TRUE(HasFocusInAnyChildView(test_api.access_code_view())); generator->PressKey(ui::KeyboardCode::VKEY_TAB, ui::EF_NONE); EXPECT_TRUE(test_api.help_button()->HasFocus()); } // Tests children views backwards traversal with tab key. TEST_F(ParentAccessViewTest, BackwardTabKeyTraversal) { StartView(); ParentAccessView::TestApi test_api(view_); EXPECT_TRUE(HasFocusInAnyChildView(test_api.access_code_view())); SimulateFailedValidation(); auto* generator = GetEventGenerator(); generator->PressKey(ui::KeyboardCode::VKEY_6, ui::EF_NONE); base::RunLoop().RunUntilIdle(); EXPECT_EQ(ParentAccessView::State::kNormal, test_api.state()); EXPECT_TRUE(test_api.submit_button()->HasFocus()); generator->PressKey(ui::KeyboardCode::VKEY_TAB, ui::EF_SHIFT_DOWN); EXPECT_TRUE(test_api.help_button()->HasFocus()); generator->PressKey(ui::KeyboardCode::VKEY_TAB, ui::EF_SHIFT_DOWN); EXPECT_TRUE(HasFocusInAnyChildView(test_api.access_code_view())); generator->PressKey(ui::KeyboardCode::VKEY_TAB, ui::EF_SHIFT_DOWN); EXPECT_TRUE(test_api.description_label()->HasFocus()); generator->PressKey(ui::KeyboardCode::VKEY_TAB, ui::EF_SHIFT_DOWN); EXPECT_TRUE(test_api.title_label()->HasFocus()); generator->PressKey(ui::KeyboardCode::VKEY_TAB, ui::EF_SHIFT_DOWN); EXPECT_TRUE(test_api.back_button()->HasFocus()); generator->PressKey(ui::KeyboardCode::VKEY_TAB, ui::EF_SHIFT_DOWN); EXPECT_TRUE(test_api.submit_button()->HasFocus()); generator->PressKey(ui::KeyboardCode::VKEY_TAB, ui::EF_SHIFT_DOWN); EXPECT_TRUE(test_api.help_button()->HasFocus()); generator->PressKey(ui::KeyboardCode::VKEY_TAB, ui::EF_SHIFT_DOWN); EXPECT_TRUE(HasFocusInAnyChildView(test_api.access_code_view())); } using ParentAccessWidgetTest = ParentAccessViewTest; // Tests that correct usage metric is reported. TEST_F(ParentAccessWidgetTest, UMAUsageMetric) { ShowWidget(ParentAccessRequestReason::kUnlockTimeLimits); DismissWidget(); histogram_tester_.ExpectBucketCount( ParentAccessView::kUMAParentAccessCodeUsage, ParentAccessView::UMAUsage::kTimeLimits, 1); ShowWidget(ParentAccessRequestReason::kChangeTimezone); DismissWidget(); histogram_tester_.ExpectBucketCount( ParentAccessView::kUMAParentAccessCodeUsage, ParentAccessView::UMAUsage::kTimezoneChange, 1); // The below usage depends on the session state. GetSessionControllerClient()->SetSessionState( session_manager::SessionState::ACTIVE); ShowWidget(ParentAccessRequestReason::kChangeTime); DismissWidget(); histogram_tester_.ExpectBucketCount( ParentAccessView::kUMAParentAccessCodeUsage, ParentAccessView::UMAUsage::kTimeChangeInSession, 1); GetSessionControllerClient()->SetSessionState( session_manager::SessionState::LOGIN_PRIMARY); ShowWidget(ParentAccessRequestReason::kChangeTime); DismissWidget(); histogram_tester_.ExpectBucketCount( ParentAccessView::kUMAParentAccessCodeUsage, ParentAccessView::UMAUsage::kTimeChangeLoginScreen, 1); GetSessionControllerClient()->SetSessionState( session_manager::SessionState::ACTIVE); ShowWidget(ParentAccessRequestReason::kChangeTime); DismissWidget(); histogram_tester_.ExpectBucketCount( ParentAccessView::kUMAParentAccessCodeUsage, ParentAccessView::UMAUsage::kTimeChangeInSession, 2); histogram_tester_.ExpectTotalCount( ParentAccessView::kUMAParentAccessCodeUsage, 5); } // Tests that the widget is properly resized when tablet mode changes. TEST_F(ParentAccessWidgetTest, WidgetResizingInTabletMode) { // Set display large enough to fit preferred view sizes. UpdateDisplay("1200x800"); ShowWidget(ParentAccessRequestReason::kUnlockTimeLimits); ParentAccessWidget* widget = ParentAccessWidget::Get(); ASSERT_TRUE(widget); ParentAccessView* view = ParentAccessWidget::TestApi(widget).parent_access_view(); constexpr auto kClamshellModeSize = gfx::Size(340, 340); constexpr auto kTabletModeSize = gfx::Size(340, 580); const auto widget_size = [&view]() -> gfx::Size { return view->GetWidget()->GetWindowBoundsInScreen().size(); }; const auto widget_center = [&view]() -> gfx::Point { return view->GetWidget()->GetWindowBoundsInScreen().CenterPoint(); }; const auto user_work_area_center = [&view]() -> gfx::Point { return WorkAreaInsets::ForWindow(view->GetWidget()->GetNativeWindow()) ->user_work_area_bounds() .CenterPoint(); }; EXPECT_EQ(kClamshellModeSize, view->size()); EXPECT_EQ(kClamshellModeSize, widget_size()); EXPECT_EQ(user_work_area_center(), widget_center()); Shell::Get()->tablet_mode_controller()->SetEnabledForTest(true); EXPECT_EQ(kTabletModeSize, view->size()); EXPECT_EQ(kTabletModeSize, widget_size()); EXPECT_EQ(user_work_area_center(), widget_center()); Shell::Get()->tablet_mode_controller()->SetEnabledForTest(false); EXPECT_EQ(kClamshellModeSize, view->size()); EXPECT_EQ(kClamshellModeSize, widget_size()); EXPECT_EQ(user_work_area_center(), widget_center()); widget->Destroy(); } TEST_F(ParentAccessViewTest, VirtualKeyboardHidden) { // Enable and show virtual keyboard. auto* keyboard_controller = Shell::Get()->keyboard_controller(); ASSERT_NE(keyboard_controller, nullptr); keyboard_controller->SetEnableFlag( keyboard::KeyboardEnableFlag::kCommandLineEnabled); // Show widget. ShowWidget(ParentAccessRequestReason::kUnlockTimeLimits); auto* view = ParentAccessWidget::TestApi(ParentAccessWidget::Get()) .parent_access_view(); ParentAccessView::TestApi test_api(view); views::Textfield* text_field = test_api.GetInputTextField(0); ui::GestureEvent event( text_field->x(), text_field->y(), 0, base::TimeTicks::Now(), ui::GestureEventDetails(ui::EventType::ET_GESTURE_TAP_DOWN)); text_field->OnGestureEvent(&event); base::RunLoop().RunUntilIdle(); // Even if we have pressed the text input field, virtual keyboard shouldn't // show. EXPECT_FALSE(keyboard_controller->IsKeyboardVisible()); DismissWidget(); } // Tests that spoken feedback keycombo starts screen reader. TEST_F(ParentAccessWidgetTest, SpokenFeedbackKeyCombo) { ShowWidget(ParentAccessRequestReason::kUnlockTimeLimits); AccessibilityControllerImpl* controller = Shell::Get()->accessibility_controller(); EXPECT_FALSE(controller->spoken_feedback_enabled()); ui::test::EventGenerator* generator = GetEventGenerator(); generator->PressKey(ui::KeyboardCode(ui::KeyboardCode::VKEY_Z), ui::EF_ALT_DOWN | ui::EF_CONTROL_DOWN); base::RunLoop().RunUntilIdle(); EXPECT_TRUE(controller->spoken_feedback_enabled()); } } // namespace ash
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
329919d13792e146de2319c2df333a135ccf5619
d217da69dc1df15cb1f3df58a5920d9417073d5c
/4_5_2018_tekma2/pcl_demos/src/cylinder_segmentation.cpp
86cd49c667922cb2533dc5931631169452f91950
[]
no_license
Zanz2/RiS_team_gamma
fcf9f3cad92972ce1300f06af460f1b6edb5a8e4
77fc86a7012e8ba51661687ae000597b361c4bfe
refs/heads/master
2021-01-25T13:17:24.028469
2018-06-13T10:14:36
2018-06-13T10:14:36
123,545,872
0
0
null
null
null
null
UTF-8
C++
false
false
8,677
cpp
#include <iostream> #include <ros/ros.h> #include <math.h> #include <visualization_msgs/Marker.h> #include <sensor_msgs/PointCloud2.h> #include <pcl_conversions/pcl_conversions.h> #include <pcl/ModelCoefficients.h> #include <pcl/io/pcd_io.h> #include <pcl/point_types.h> #include <pcl/filters/extract_indices.h> #include <pcl/filters/passthrough.h> #include <pcl/features/normal_3d.h> #include <pcl/sample_consensus/method_types.h> #include <pcl/sample_consensus/model_types.h> #include <pcl/segmentation/sac_segmentation.h> #include "pcl/point_cloud.h" #include "tf2_ros/transform_listener.h" #include "tf2_geometry_msgs/tf2_geometry_msgs.h" #include "geometry_msgs/PointStamped.h" #include <cmath> ros::Publisher pubx; ros::Publisher puby; ros::Publisher pubm; tf2_ros::Buffer tf2_buffer; typedef pcl::PointXYZ PointT; void cloud_cb (const pcl::PCLPointCloud2ConstPtr& cloud_blob) { // All the objects needed ros::Time time_rec, time_test; time_rec = ros::Time::now(); pcl::PassThrough<PointT> pass; pcl::NormalEstimation<PointT, pcl::Normal> ne; pcl::SACSegmentationFromNormals<PointT, pcl::Normal> seg; pcl::PCDWriter writer; pcl::ExtractIndices<PointT> extract; pcl::ExtractIndices<pcl::Normal> extract_normals; pcl::search::KdTree<PointT>::Ptr tree (new pcl::search::KdTree<PointT> ()); Eigen::Vector4f centroid; // Datasets pcl::PointCloud<PointT>::Ptr cloud (new pcl::PointCloud<PointT>); pcl::PointCloud<PointT>::Ptr cloud_filtered (new pcl::PointCloud<PointT>); pcl::PointCloud<pcl::Normal>::Ptr cloud_normals (new pcl::PointCloud<pcl::Normal>); pcl::PointCloud<PointT>::Ptr cloud_filtered2 (new pcl::PointCloud<PointT>); pcl::PointCloud<pcl::Normal>::Ptr cloud_normals2 (new pcl::PointCloud<pcl::Normal>); pcl::ModelCoefficients::Ptr coefficients_plane (new pcl::ModelCoefficients), coefficients_cylinder (new pcl::ModelCoefficients); pcl::PointIndices::Ptr inliers_plane (new pcl::PointIndices), inliers_cylinder (new pcl::PointIndices); // Read in the cloud data pcl::fromPCLPointCloud2 (*cloud_blob, *cloud); std::cerr << "PointCloud has: " << cloud->points.size () << " data points." << std::endl; // Build a passthrough filter to remove spurious NaNs pass.setInputCloud (cloud); pass.setFilterFieldName ("z"); pass.setFilterLimits (0, 1.5); pass.filter (*cloud_filtered); std::cerr << "PointCloud after filtering has: " << cloud_filtered->points.size () << " data points." << std::endl; // Estimate point normals ne.setSearchMethod (tree); ne.setInputCloud (cloud_filtered); ne.setKSearch (50); ne.compute (*cloud_normals); // Create the segmentation object for the planar model and set all the parameters seg.setOptimizeCoefficients (true); seg.setModelType (pcl::SACMODEL_NORMAL_PLANE); seg.setNormalDistanceWeight (0.1); seg.setMethodType (pcl::SAC_RANSAC); seg.setMaxIterations (100); seg.setDistanceThreshold (0.03); seg.setInputCloud (cloud_filtered); seg.setInputNormals (cloud_normals); // Obtain the plane inliers and coefficients seg.segment (*inliers_plane, *coefficients_plane); std::cerr << "Plane coefficients: " << *coefficients_plane << std::endl; // Extract the planar inliers from the input cloud extract.setInputCloud (cloud_filtered); extract.setIndices (inliers_plane); extract.setNegative (false); // Write the planar inliers to disk pcl::PointCloud<PointT>::Ptr cloud_plane (new pcl::PointCloud<PointT> ()); extract.filter (*cloud_plane); std::cerr << "PointCloud representing the planar component: " << cloud_plane->points.size () << " data points." << std::endl; pcl::PCLPointCloud2 outcloud_plane; pcl::toPCLPointCloud2 (*cloud_plane, outcloud_plane); pubx.publish (outcloud_plane); // Remove the planar inliers, extract the rest extract.setNegative (true); extract.filter (*cloud_filtered2); extract_normals.setNegative (true); extract_normals.setInputCloud (cloud_normals); extract_normals.setIndices (inliers_plane); extract_normals.filter (*cloud_normals2); // Create the segmentation object for cylinder segmentation and set all the parameters seg.setOptimizeCoefficients (true); seg.setModelType (pcl::SACMODEL_CYLINDER); seg.setMethodType (pcl::SAC_RANSAC); seg.setNormalDistanceWeight (0.1); seg.setMaxIterations (10000); seg.setDistanceThreshold (0.05); seg.setRadiusLimits (0.06, 0.2); seg.setInputCloud (cloud_filtered2); seg.setInputNormals (cloud_normals2); // Obtain the cylinder inliers and coefficients seg.segment (*inliers_cylinder, *coefficients_cylinder); std::cerr << "Cylinder coefficients: " << *coefficients_cylinder << std::endl; // Write the cylinder inliers to disk extract.setInputCloud (cloud_filtered2); extract.setIndices (inliers_cylinder); extract.setNegative (false); pcl::PointCloud<PointT>::Ptr cloud_cylinder (new pcl::PointCloud<PointT> ()); extract.filter (*cloud_cylinder); if (cloud_cylinder->points.empty ()) { std::cerr << "Can't find the cylindrical component." << std::endl; ros::shutdown(); } else { std::cerr << "PointCloud representing the cylindrical component: " << cloud_cylinder->points.size () << " data points." << std::endl; pcl::compute3DCentroid (*cloud_cylinder, centroid); std::cerr << "centroid of the cylindrical component: " << centroid[0] << " " << centroid[1] << " " << centroid[2] << " " << centroid[3] << std::endl; //Create a point in the "camera_rgb_optical_frame" geometry_msgs::PointStamped point_camera; geometry_msgs::PointStamped point_map; visualization_msgs::Marker marker; geometry_msgs::TransformStamped tss; point_camera.header.frame_id = "camera_rgb_optical_frame"; point_camera.header.stamp = ros::Time::now(); point_map.header.frame_id = "map"; point_map.header.stamp = ros::Time::now(); point_camera.point.x = centroid[0]; point_camera.point.y = centroid[1]; point_camera.point.z = centroid[2]; try{ time_test = ros::Time::now(); std::cerr << time_rec << std::endl; std::cerr << time_test << std::endl; tss = tf2_buffer.lookupTransform("map","camera_rgb_optical_frame", time_rec); // tf2_buffer.transform(point_camera, point_map, "map", ros::Duration(2)); } catch (tf2::TransformException &ex) { ROS_WARN("Transform warning: %s\n", ex.what()); } std::cerr << tss ; tf2::doTransform(point_camera, point_map, tss); if(std::isnan(point_map.point.x)) return; std::cerr << "point_camera: " << point_camera.point.x << " " << point_camera.point.y << " " << point_camera.point.z << std::endl; std::cerr << "point_map: " << point_map.point.x << " " << point_map.point.y << " " << point_map.point.z << std::endl; marker.header.frame_id = "map"; marker.header.stamp = ros::Time::now(); marker.ns = "cylinder"; marker.id = 0; marker.type = visualization_msgs::Marker::CYLINDER; marker.action = visualization_msgs::Marker::ADD; marker.pose.position.x = point_map.point.x; marker.pose.position.y = point_map.point.y; marker.pose.position.z = point_map.point.z; marker.pose.orientation.x = 0.0; marker.pose.orientation.y = 0.0; marker.pose.orientation.z = 0.0; marker.pose.orientation.w = 1.0; marker.scale.x = 0.1; marker.scale.y = 0.1; marker.scale.z = 0.1; marker.color.r=0.0f; marker.color.g=1.0f; marker.color.b=0.0f; marker.color.a=1.0f; marker.lifetime = ros::Duration(); pubm.publish (marker); pcl::PCLPointCloud2 outcloud_cylinder; pcl::toPCLPointCloud2 (*cloud_cylinder, outcloud_cylinder); puby.publish (outcloud_cylinder); system("python /home/team_gamma/ROS/src/exercise3/src/cylinder_found.py"); ros::shutdown(); } } int main (int argc, char** argv) { // Initialize ROS ros::init (argc, argv, "cylinder_segment"); ros::NodeHandle nh; // For transforming between coordinate frames tf2_ros::TransformListener tf2_listener(tf2_buffer); // Create a ROS subscriber for the input point cloud ros::Subscriber sub = nh.subscribe ("input", 1, cloud_cb); // Create a ROS publisher for the output point cloud pubx = nh.advertise<pcl::PCLPointCloud2> ("planes", 1); puby = nh.advertise<pcl::PCLPointCloud2> ("cylinder", 1); pubm = nh.advertise<visualization_msgs::Marker>("detected_cylinder",1); // Spin ros::spin(); }
[ "zan.zagar@hotmail.com" ]
zan.zagar@hotmail.com
5425cf253d4bec716f86b165ff7917adbce34450
992b75408838c2bd6dfc32e274682b44d61f54d8
/math/main.cpp
9f54e28b4240df46c38eb56536e5a8307cd9cad5
[]
no_license
romandion/Lab
35064447be0a8889729110d51da952855fa63f3d
13f3ce1d1f848c3c3d88719d04c00b80cfc08ecc
refs/heads/master
2020-03-07T09:53:00.539709
2018-08-29T03:02:38
2018-08-29T03:02:38
127,418,080
0
0
null
null
null
null
UTF-8
C++
false
false
245
cpp
#include <windows.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> int main(int argc , char * argv[]) { BOOL v = FALSE; ::printf("__LINE__ = %d \n" , __LINE__) ; return 0 ; }
[ "romandion@163.com" ]
romandion@163.com
12adda6e3a8ca03d62057e14593b3a56e7d45b4d
e3b5d138ae885b847b1df8cbbe7e3e872a13152b
/main/Ir_driver/ir_protocol_cpp/IRutils.cpp
1ff9e2f821753e803709dee569e1cecbaa4f7ba9
[ "MIT" ]
permissive
ductuanhoang/Smart_Ir_Blaster
89287275c7d719ef2a587059f4ba4b52f8e79b06
404f8545ce0f28a5c6cac87e1767264a2a019ddf
refs/heads/main
2023-04-28T13:07:22.163308
2021-05-01T00:27:12
2021-05-01T00:27:12
363,290,287
0
0
null
null
null
null
UTF-8
C++
false
false
16,234
cpp
// Copyright 2017 David Conran #include "IRutils.h" #include <stdint.h> #include <string.h> #include <algorithm> #include "IrSend.h" /// Reverse the order of the requested least significant nr. of bits. /// @param[in] input Bit pattern/integer to reverse. /// @param[in] nbits Nr. of bits to reverse. (LSB -> MSB) /// @return The reversed bit pattern. uint64_t reverseBits(uint64_t input, uint16_t nbits) { if (nbits <= 1) return input; // Reversing <= 1 bits makes no change at all. // Cap the nr. of bits to rotate to the max nr. of bits in the input. nbits = min(nbits, (uint16_t)(sizeof(input) * 8)); uint64_t output = 0; for (uint16_t i = 0; i < nbits; i++) { output <<= 1; output |= (input & 1); input >>= 1; } // Merge any remaining unreversed bits back to the top of the reversed bits. return (input << nbits) | output; } /// Sum all the bytes of an array and return the least significant 8-bits of /// the result. /// @param[in] start A ptr to the start of the byte array to calculate over. /// @param[in] length How many bytes to use in the calculation. /// @param[in] init Starting value of the calculation to use. (Default is 0) /// @return The 8-bit calculated result of all the bytes and init value. uint8_t sumBytes(const uint8_t *const start, const uint16_t length, const uint8_t init) { uint8_t checksum = init; const uint8_t *ptr; for (ptr = start; ptr - start < length; ptr++) checksum += *ptr; return checksum; } /// Calculate a rolling XOR of all the bytes of an array. /// @param[in] start A ptr to the start of the byte array to calculate over. /// @param[in] length How many bytes to use in the calculation. /// @param[in] init Starting value of the calculation to use. (Default is 0) /// @return The 8-bit calculated result of all the bytes and init value. uint8_t xorBytes(const uint8_t *const start, const uint16_t length, const uint8_t init) { uint8_t checksum = init; const uint8_t *ptr; for (ptr = start; ptr - start < length; ptr++) checksum ^= *ptr; return checksum; } /// Count the number of bits of a certain type in an array. /// @param[in] start A ptr to the start of the byte array to calculate over. /// @param[in] length How many bytes to use in the calculation. /// @param[in] ones Count the binary nr of `1` bits. False is count the `0`s. /// @param[in] init Starting value of the calculation to use. (Default is 0) /// @return The nr. of bits found of the given type found in the array. uint16_t countBits(const uint8_t *const start, const uint16_t length, const bool ones, const uint16_t init) { uint16_t count = init; for (uint16_t offset = 0; offset < length; offset++) for (uint8_t currentbyte = *(start + offset); currentbyte; currentbyte >>= 1) if (currentbyte & 1) count++; if (ones || length == 0) return count; else return (length * 8) - count; } /// Count the number of bits of a certain type in an Integer. /// @param[in] data The value you want bits counted for. Starting from the LSB. /// @param[in] length How many bits to use in the calculation? Starts at the LSB /// @param[in] ones Count the binary nr of `1` bits. False is count the `0`s. /// @param[in] init Starting value of the calculation to use. (Default is 0) /// @return The nr. of bits found of the given type found in the Integer. uint16_t countBits(const uint64_t data, const uint8_t length, const bool ones, const uint16_t init) { uint16_t count = init; uint8_t bitsSoFar = length; for (uint64_t remainder = data; remainder && bitsSoFar; remainder >>= 1, bitsSoFar--) if (remainder & 1) count++; if (ones || length == 0) return count; else return length - count; } /// Invert/Flip the bits in an Integer. /// @param[in] data The Integer that will be inverted. /// @param[in] nbits How many bits are to be inverted. Starting from the LSB. /// @return An Integer with the appropriate bits inverted/flipped. uint64_t invertBits(const uint64_t data, const uint16_t nbits) { // No change if we are asked to invert no bits. if (nbits == 0) return data; uint64_t result = ~data; // If we are asked to invert all the bits or more than we have, it's simple. if (nbits >= sizeof(data) * 8) return result; // Mask off any unwanted bits and return the result. return (result & ((1ULL << nbits) - 1)); } /// Convert degrees Celsius to degrees Fahrenheit. float celsiusToFahrenheit(const float deg) { return (deg * 9.0) / 5.0 + 32.0; } /// Convert degrees Fahrenheit to degrees Celsius. float fahrenheitToCelsius(const float deg) { return (deg - 32.0) * 5.0 / 9.0; } namespace irutils { /// Sum all the nibbles together in a series of bytes. /// @param[in] start A ptr to the start of the byte array to calculate over. /// @param[in] length How many bytes to use in the calculation. /// @param[in] init Starting value of the calculation to use. (Default is 0) /// @return The 8-bit calculated result of all the bytes and init value. uint8_t sumNibbles(const uint8_t *const start, const uint16_t length, const uint8_t init) { uint8_t sum = init; const uint8_t *ptr; for (ptr = start; ptr - start < length; ptr++) sum += (*ptr >> 4) + (*ptr & 0xF); return sum; } /// Sum all the nibbles together in an integer. /// @param[in] data The integer to be summed. /// @param[in] count The number of nibbles to sum. Starts from LSB. Max of 16. /// @param[in] init Starting value of the calculation to use. (Default is 0) /// @param[in] nibbleonly true, the result is 4 bits. false, it's 8 bits. /// @return The 4/8-bit calculated result of all the nibbles and init value. uint8_t sumNibbles(const uint64_t data, const uint8_t count, const uint8_t init, const bool nibbleonly) { uint8_t sum = init; uint64_t copy = data; const uint8_t nrofnibbles = (count < 16) ? count : (64 / 4); for (uint8_t i = 0; i < nrofnibbles; i++, copy >>= 4) sum += copy & 0xF; return nibbleonly ? sum & 0xF : sum; } /// Convert a byte of Binary Coded Decimal(BCD) into an Integer. /// @param[in] bcd The BCD value. /// @return A normal Integer value. uint8_t bcdToUint8(const uint8_t bcd) { if (bcd > 0x99) return 255; // Too big. return (bcd >> 4) * 10 + (bcd & 0xF); } /// Convert an Integer into a byte of Binary Coded Decimal(BCD). /// @param[in] integer The number to convert. /// @return An 8-bit BCD value. uint8_t uint8ToBcd(const uint8_t integer) { if (integer > 99) return 255; // Too big. return ((integer / 10) << 4) + (integer % 10); } /// Return the value of `position`th bit of an Integer. /// @param[in] data Value to be examined. /// @param[in] position Nr. of the Nth bit to be examined. `0` is the LSB. /// @param[in] size Nr. of bits in data. /// @return The bit's value. bool getBit(const uint64_t data, const uint8_t position, const uint8_t size) { if (position >= size) return false; // Outside of range. return data & (1ULL << position); } /// Return the value of `position`th bit of an Integer. /// @param[in] data Value to be examined. /// @param[in] position Nr. of the Nth bit to be examined. `0` is the LSB. /// @return The bit's value. bool getBit(const uint8_t data, const uint8_t position) { if (position >= 8) return false; // Outside of range. return data & (1 << position); } /// Return the value of an Integer with the `position`th bit changed. /// @param[in] data Value to be changed. /// @param[in] position Nr. of the bit to be changed. `0` is the LSB. /// @param[in] on Value to set the position'th bit to. /// @param[in] size Nr. of bits in data. /// @return A suitably modified integer. uint64_t setBit(const uint64_t data, const uint8_t position, const bool on, const uint8_t size) { if (position >= size) return data; // Outside of range. uint64_t mask = 1ULL << position; if (on) return data | mask; else return data & ~mask; } /// Return the value of an Integer with the `position`th bit changed. /// @param[in] data Value to be changed. /// @param[in] position Nr. of the bit to be changed. `0` is the LSB. /// @param[in] on Value to set the position'th bit to. /// @return A suitably modified integer. uint8_t setBit(const uint8_t data, const uint8_t position, const bool on) { if (position >= 8) return data; // Outside of range. uint8_t mask = 1 << position; if (on) return data | mask; else return data & ~mask; } /// Alter the value of an Integer with the `position`th bit changed. /// @param[in,out] data A pointer to the 8-bit integer to be changed. /// @param[in] position Nr. of the bit to be changed. `0` is the LSB. /// @param[in] on Value to set the position'th bit to. void setBit(uint8_t *const data, const uint8_t position, const bool on) { uint8_t mask = 1 << position; if (on) *data |= mask; else *data &= ~mask; } /// Alter the value of an Integer with the `position`th bit changed. /// @param[in,out] data A pointer to the 32-bit integer to be changed. /// @param[in] position Nr. of the bit to be changed. `0` is the LSB. /// @param[in] on Value to set the position'th bit to. void setBit(uint32_t *const data, const uint8_t position, const bool on) { uint32_t mask = (uint32_t)1 << position; if (on) *data |= mask; else *data &= ~mask; } /// Alter the value of an Integer with the `position`th bit changed. /// @param[in,out] data A pointer to the 64-bit integer to be changed. /// @param[in] position Nr. of the bit to be changed. `0` is the LSB. /// @param[in] on Value to set the position'th bit to. void setBit(uint64_t *const data, const uint8_t position, const bool on) { uint64_t mask = (uint64_t)1 << position; if (on) *data |= mask; else *data &= ~mask; } /// Alter an uint8_t value by overwriting an arbitrary given number of bits. /// @param[in,out] dst A pointer to the value to be changed. /// @param[in] offset Nr. of bits from the Least Significant Bit to be ignored /// @param[in] nbits Nr of bits of data to be placed into the destination. /// @param[in] data The value to be placed. void setBits(uint8_t *const dst, const uint8_t offset, const uint8_t nbits, const uint8_t data) { if (offset >= 8 || !nbits) return; // Short circuit as it won't change. // Calculate the mask for the supplied value. uint8_t mask = UINT8_MAX >> (8 - ((nbits > 8) ? 8 : nbits)); // Calculate the mask & clear the space for the data. // Clear the destination bits. *dst &= ~(uint8_t)(mask << offset); // Merge in the data. *dst |= ((data & mask) << offset); } /// Alter an uint32_t value by overwriting an arbitrary given number of bits. /// @param[in,out] dst A pointer to the value to be changed. /// @param[in] offset Nr. of bits from the Least Significant Bit to be ignored /// @param[in] nbits Nr of bits of data to be placed into the destination. /// @param[in] data The value to be placed. void setBits(uint32_t *const dst, const uint8_t offset, const uint8_t nbits, const uint32_t data) { if (offset >= 32 || !nbits) return; // Short circuit as it won't change. // Calculate the mask for the supplied value. uint32_t mask = UINT32_MAX >> (32 - ((nbits > 32) ? 32 : nbits)); // Calculate the mask & clear the space for the data. // Clear the destination bits. *dst &= ~(mask << offset); // Merge in the data. *dst |= ((data & mask) << offset); } /// Alter an uint64_t value by overwriting an arbitrary given number of bits. /// @param[in,out] dst A pointer to the value to be changed. /// @param[in] offset Nr. of bits from the Least Significant Bit to be ignored /// @param[in] nbits Nr of bits of data to be placed into the destination. /// @param[in] data The value to be placed. void setBits(uint64_t *const dst, const uint8_t offset, const uint8_t nbits, const uint64_t data) { if (offset >= 64 || !nbits) return; // Short circuit as it won't change. // Calculate the mask for the supplied value. uint64_t mask = UINT64_MAX >> (64 - ((nbits > 64) ? 64 : nbits)); // Calculate the mask & clear the space for the data. // Clear the destination bits. *dst &= ~(mask << offset); // Merge in the data. *dst |= ((data & mask) << offset); } /// Create byte pairs where the second byte of the pair is a bit /// inverted/flipped copy of the first/previous byte of the pair. /// @param[in,out] ptr A pointer to the start of array to modify. /// @param[in] length The byte size of the array. /// @note A length of `<= 1` will do nothing. /// @return A ptr to the modified array. uint8_t *invertBytePairs(uint8_t *ptr, const uint16_t length) { for (uint16_t i = 1; i < length; i += 2) { // Code done this way to avoid a compiler warning bug. uint8_t inv = ~*(ptr + i - 1); *(ptr + i) = inv; } return ptr; } /// Check an array to see if every second byte of a pair is a bit /// inverted/flipped copy of the first/previous byte of the pair. /// @param[in] ptr A pointer to the start of array to check. /// @param[in] length The byte size of the array. /// @note A length of `<= 1` will always return true. /// @return true, if every second byte is inverted. Otherwise false. bool checkInvertedBytePairs(const uint8_t *const ptr, const uint16_t length) { for (uint16_t i = 1; i < length; i += 2) { // Code done this way to avoid a compiler warning bug. uint8_t inv = ~*(ptr + i - 1); if (*(ptr + i) != inv) return false; } return true; } /// Perform a low level bit manipulation sanity check for the given cpu /// architecture and the compiler operation. Calls to this should return /// 0 if everything is as expected, anything else means the library won't work /// as expected. /// @return A bit mask value of potential issues. /// 0: (e.g. 0b00000000) Everything appears okay. /// 0th bit set: (0b1) Unexpected bit field/packing encountered. /// Try a different compiler. /// 1st bit set: (0b10) Unexpected Endianness. Try a different compiler flag /// or use a CPU different architecture. /// e.g. A result of 3 (0b11) would mean both a bit field and an Endianness /// issue has been found. uint8_t lowLevelSanityCheck(void) { const uint64_t kExpectedBitFieldResult = 0x8000012340000039ULL; volatile uint32_t EndianTest = 0x12345678; const uint8_t kBitFieldError = 0b01; const uint8_t kEndiannessError = 0b10; uint8_t result = 0; union bitpackdata { struct { uint64_t lowestbit : 1; // 0th bit uint64_t next7bits : 7; // 1-7th bits uint64_t _unused_1 : 20; // 8-27th bits // Cross the 32 bit boundary. uint64_t crossbits : 16; // 28-43rd bits uint64_t _usused_2 : 18; // 44-61st bits uint64_t highest2bits : 2; // 62-63rd bits }; uint64_t all; }; bitpackdata data; data.lowestbit = true; data.next7bits = 0b0011100; // 0x1C data._unused_1 = 0; data.crossbits = 0x1234; data._usused_2 = 0; data.highest2bits = 0b10; // 2 if (data.all != kExpectedBitFieldResult) result |= kBitFieldError; // Check that we are using Little Endian for integers #if defined(BYTE_ORDER) && defined(LITTLE_ENDIAN) if (BYTE_ORDER != LITTLE_ENDIAN) result |= kEndiannessError; #endif #if defined(__IEEE_BIG_ENDIAN) || defined(__IEEE_BYTES_BIG_ENDIAN) result |= kEndiannessError; #endif // Brute force check for little endian. if (*((uint8_t *)(&EndianTest)) != 0x78) // NOLINT(readability/casting) result |= kEndiannessError; return result; } } // namespace irutils
[ "ductuanhoang820@gmail.com" ]
ductuanhoang820@gmail.com
49455fcd0d0009c562ea985639bdbdd955864931
921c689451ff3b6e472cc6ae6a34774c4f57e68b
/llvm-2.8/tools/clang/include/clang/Basic/TargetInfo.h
40df9ba11da4cdf36a0ee8f71a502ece69704474
[ "NCSA" ]
permissive
xpic-toolchain/xpic_toolchain
36cae905bbf675d26481bee19b420283eff90a79
9e6d4276cc8145a934c31b0d3292a382fc2e5e92
refs/heads/master
2021-01-21T04:37:18.963215
2016-05-19T12:34:11
2016-05-19T12:34:11
29,474,690
4
0
null
null
null
null
UTF-8
C++
false
false
20,403
h
//===--- TargetInfo.h - Expose information about the target -----*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines the TargetInfo interface. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_TARGETINFO_H #define LLVM_CLANG_BASIC_TARGETINFO_H // FIXME: Daniel isn't smart enough to use a prototype for this. #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Triple.h" #include "llvm/System/DataTypes.h" #include <cassert> #include <vector> #include <string> namespace llvm { struct fltSemantics; class StringRef; } namespace clang { class Diagnostic; class LangOptions; class MacroBuilder; class SourceLocation; class SourceManager; class TargetOptions; namespace Builtin { struct Info; } /// TargetCXXABI - The types of C++ ABIs for which we can generate code. enum TargetCXXABI { /// The generic ("Itanium") C++ ABI, documented at: /// http://www.codesourcery.com/public/cxx-abi/ CXXABI_Itanium, /// The ARM C++ ABI, based largely on the Itanium ABI but with /// significant differences. /// http://infocenter.arm.com /// /help/topic/com.arm.doc.ihi0041c/IHI0041C_cppabi.pdf CXXABI_ARM, /// The Visual Studio ABI. Only scattered official documentation exists. CXXABI_Microsoft }; /// TargetInfo - This class exposes information about the current target. /// class TargetInfo { llvm::Triple Triple; protected: // Target values set by the ctor of the actual target implementation. Default // values are specified by the TargetInfo constructor. bool TLSSupported; bool NoAsmVariants; // True if {|} are normal characters. unsigned char PointerWidth, PointerAlign; unsigned char IntWidth, IntAlign; unsigned char FloatWidth, FloatAlign; unsigned char DoubleWidth, DoubleAlign; unsigned char LongDoubleWidth, LongDoubleAlign; unsigned char LargeArrayMinWidth, LargeArrayAlign; unsigned char LongWidth, LongAlign; unsigned char LongLongWidth, LongLongAlign; const char *DescriptionString; const char *UserLabelPrefix; const llvm::fltSemantics *FloatFormat, *DoubleFormat, *LongDoubleFormat; unsigned char RegParmMax, SSERegParmMax; TargetCXXABI CXXABI; unsigned HasAlignMac68kSupport : 1; unsigned RealTypeUsesObjCFPRet : 3; // TargetInfo Constructor. Default initializes all fields. TargetInfo(const std::string &T); public: /// CreateTargetInfo - Construct a target for the given options. /// /// \param Opts - The options to use to initialize the target. The target may /// modify the options to canonicalize the target feature information to match /// what the backend expects. static TargetInfo* CreateTargetInfo(Diagnostic &Diags, TargetOptions &Opts); virtual ~TargetInfo(); ///===---- Target Data Type Query Methods -------------------------------===// enum IntType { NoInt = 0, SignedShort, UnsignedShort, SignedInt, UnsignedInt, SignedLong, UnsignedLong, SignedLongLong, UnsignedLongLong }; enum RealType { Float = 0, Double, LongDouble }; protected: IntType SizeType, IntMaxType, UIntMaxType, PtrDiffType, IntPtrType, WCharType, WIntType, Char16Type, Char32Type, Int64Type, SigAtomicType; /// Control whether the alignment of bit-field types is respected when laying /// out structures. If true, then the alignment of the bit-field type will be /// used to (a) impact the alignment of the containing structure, and (b) /// ensure that the individual bit-field will not straddle an alignment /// boundary. unsigned UseBitFieldTypeAlignment : 1; public: IntType getSizeType() const { return SizeType; } IntType getIntMaxType() const { return IntMaxType; } IntType getUIntMaxType() const { return UIntMaxType; } IntType getPtrDiffType(unsigned AddrSpace) const { return AddrSpace == 0 ? PtrDiffType : getPtrDiffTypeV(AddrSpace); } IntType getIntPtrType() const { return IntPtrType; } IntType getWCharType() const { return WCharType; } IntType getWIntType() const { return WIntType; } IntType getChar16Type() const { return Char16Type; } IntType getChar32Type() const { return Char32Type; } IntType getInt64Type() const { return Int64Type; } IntType getSigAtomicType() const { return SigAtomicType; } /// getTypeWidth - Return the width (in bits) of the specified integer type /// enum. For example, SignedInt -> getIntWidth(). unsigned getTypeWidth(IntType T) const; /// getTypeAlign - Return the alignment (in bits) of the specified integer /// type enum. For example, SignedInt -> getIntAlign(). unsigned getTypeAlign(IntType T) const; /// isTypeSigned - Return whether an integer types is signed. Returns true if /// the type is signed; false otherwise. bool isTypeSigned(IntType T) const; /// getPointerWidth - Return the width of pointers on this target, for the /// specified address space. uint64_t getPointerWidth(unsigned AddrSpace) const { return AddrSpace == 0 ? PointerWidth : getPointerWidthV(AddrSpace); } uint64_t getPointerAlign(unsigned AddrSpace) const { return AddrSpace == 0 ? PointerAlign : getPointerAlignV(AddrSpace); } /// getBoolWidth/Align - Return the size of '_Bool' and C++ 'bool' for this /// target, in bits. unsigned getBoolWidth(bool isWide = false) const { return 8; } // FIXME unsigned getBoolAlign(bool isWide = false) const { return 8; } // FIXME unsigned getCharWidth() const { return 8; } // FIXME unsigned getCharAlign() const { return 8; } // FIXME /// getShortWidth/Align - Return the size of 'signed short' and /// 'unsigned short' for this target, in bits. unsigned getShortWidth() const { return 16; } // FIXME unsigned getShortAlign() const { return 16; } // FIXME /// getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for /// this target, in bits. unsigned getIntWidth() const { return IntWidth; } unsigned getIntAlign() const { return IntAlign; } /// getLongWidth/Align - Return the size of 'signed long' and 'unsigned long' /// for this target, in bits. unsigned getLongWidth() const { return LongWidth; } unsigned getLongAlign() const { return LongAlign; } /// getLongLongWidth/Align - Return the size of 'signed long long' and /// 'unsigned long long' for this target, in bits. unsigned getLongLongWidth() const { return LongLongWidth; } unsigned getLongLongAlign() const { return LongLongAlign; } /// getWCharWidth/Align - Return the size of 'wchar_t' for this target, in /// bits. unsigned getWCharWidth() const { return getTypeWidth(WCharType); } unsigned getWCharAlign() const { return getTypeAlign(WCharType); } /// getChar16Width/Align - Return the size of 'char16_t' for this target, in /// bits. unsigned getChar16Width() const { return getTypeWidth(Char16Type); } unsigned getChar16Align() const { return getTypeAlign(Char16Type); } /// getChar32Width/Align - Return the size of 'char32_t' for this target, in /// bits. unsigned getChar32Width() const { return getTypeWidth(Char32Type); } unsigned getChar32Align() const { return getTypeAlign(Char32Type); } /// getFloatWidth/Align/Format - Return the size/align/format of 'float'. unsigned getFloatWidth() const { return FloatWidth; } unsigned getFloatAlign() const { return FloatAlign; } const llvm::fltSemantics &getFloatFormat() const { return *FloatFormat; } /// getDoubleWidth/Align/Format - Return the size/align/format of 'double'. unsigned getDoubleWidth() const { return DoubleWidth; } unsigned getDoubleAlign() const { return DoubleAlign; } const llvm::fltSemantics &getDoubleFormat() const { return *DoubleFormat; } /// getLongDoubleWidth/Align/Format - Return the size/align/format of 'long /// double'. unsigned getLongDoubleWidth() const { return LongDoubleWidth; } unsigned getLongDoubleAlign() const { return LongDoubleAlign; } const llvm::fltSemantics &getLongDoubleFormat() const { return *LongDoubleFormat; } // getLargeArrayMinWidth/Align - Return the minimum array size that is // 'large' and its alignment. unsigned getLargeArrayMinWidth() const { return LargeArrayMinWidth; } unsigned getLargeArrayAlign() const { return LargeArrayAlign; } /// getIntMaxTWidth - Return the size of intmax_t and uintmax_t for this /// target, in bits. unsigned getIntMaxTWidth() const { return getTypeWidth(IntMaxType); } /// getUserLabelPrefix - This returns the default value of the /// __USER_LABEL_PREFIX__ macro, which is the prefix given to user symbols by /// default. On most platforms this is "_", but it is "" on some, and "." on /// others. const char *getUserLabelPrefix() const { return UserLabelPrefix; } bool useBitFieldTypeAlignment() const { return UseBitFieldTypeAlignment; } /// hasAlignMac68kSupport - Check whether this target support '#pragma options /// align=mac68k'. bool hasAlignMac68kSupport() const { return HasAlignMac68kSupport; } /// getTypeName - Return the user string for the specified integer type enum. /// For example, SignedShort -> "short". static const char *getTypeName(IntType T); /// getTypeConstantSuffix - Return the constant suffix for the specified /// integer type enum. For example, SignedLong -> "L". static const char *getTypeConstantSuffix(IntType T); /// \brief Check whether the given real type should use the "fpret" flavor of /// Obj-C message passing on this target. bool useObjCFPRetForRealType(RealType T) const { return RealTypeUsesObjCFPRet & (1 << T); } ///===---- Other target property query methods --------------------------===// /// getTargetDefines - Appends the target-specific #define values for this /// target set to the specified buffer. virtual void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const = 0; /// getTargetBuiltins - Return information about target-specific builtins for /// the current primary target, and info about which builtins are non-portable /// across the current set of primary and secondary targets. virtual void getTargetBuiltins(const Builtin::Info *&Records, unsigned &NumRecords) const = 0; /// getVAListDeclaration - Return the declaration to use for /// __builtin_va_list, which is target-specific. virtual const char *getVAListDeclaration() const = 0; /// isValidGCCRegisterName - Returns whether the passed in string /// is a valid register name according to GCC. This is used by Sema for /// inline asm statements. bool isValidGCCRegisterName(llvm::StringRef Name) const; // getNormalizedGCCRegisterName - Returns the "normalized" GCC register name. // For example, on x86 it will return "ax" when "eax" is passed in. llvm::StringRef getNormalizedGCCRegisterName(llvm::StringRef Name) const; struct ConstraintInfo { enum { CI_None = 0x00, CI_AllowsMemory = 0x01, CI_AllowsRegister = 0x02, CI_ReadWrite = 0x04, // "+r" output constraint (read and write). CI_HasMatchingInput = 0x08 // This output operand has a matching input. }; unsigned Flags; int TiedOperand; std::string ConstraintStr; // constraint: "=rm" std::string Name; // Operand name: [foo] with no []'s. public: ConstraintInfo(llvm::StringRef ConstraintStr, llvm::StringRef Name) : Flags(0), TiedOperand(-1), ConstraintStr(ConstraintStr.str()), Name(Name.str()) {} const std::string &getConstraintStr() const { return ConstraintStr; } const std::string &getName() const { return Name; } bool isReadWrite() const { return (Flags & CI_ReadWrite) != 0; } bool allowsRegister() const { return (Flags & CI_AllowsRegister) != 0; } bool allowsMemory() const { return (Flags & CI_AllowsMemory) != 0; } /// hasMatchingInput - Return true if this output operand has a matching /// (tied) input operand. bool hasMatchingInput() const { return (Flags & CI_HasMatchingInput) != 0; } /// hasTiedOperand() - Return true if this input operand is a matching /// constraint that ties it to an output operand. If this returns true, /// then getTiedOperand will indicate which output operand this is tied to. bool hasTiedOperand() const { return TiedOperand != -1; } unsigned getTiedOperand() const { assert(hasTiedOperand() && "Has no tied operand!"); return (unsigned)TiedOperand; } void setIsReadWrite() { Flags |= CI_ReadWrite; } void setAllowsMemory() { Flags |= CI_AllowsMemory; } void setAllowsRegister() { Flags |= CI_AllowsRegister; } void setHasMatchingInput() { Flags |= CI_HasMatchingInput; } /// setTiedOperand - Indicate that this is an input operand that is tied to /// the specified output operand. Copy over the various constraint /// information from the output. void setTiedOperand(unsigned N, ConstraintInfo &Output) { Output.setHasMatchingInput(); Flags = Output.Flags; TiedOperand = N; // Don't copy Name or constraint string. } }; // validateOutputConstraint, validateInputConstraint - Checks that // a constraint is valid and provides information about it. // FIXME: These should return a real error instead of just true/false. bool validateOutputConstraint(ConstraintInfo &Info) const; bool validateInputConstraint(ConstraintInfo *OutputConstraints, unsigned NumOutputs, ConstraintInfo &info) const; bool resolveSymbolicName(const char *&Name, ConstraintInfo *OutputConstraints, unsigned NumOutputs, unsigned &Index) const; virtual std::string convertConstraint(const char Constraint) const { return std::string(1, Constraint); } // Returns a string of target-specific clobbers, in LLVM format. virtual const char *getClobbers() const = 0; /// getTriple - Return the target triple of the primary target. const llvm::Triple &getTriple() const { return Triple; } const char *getTargetDescription() const { return DescriptionString; } struct GCCRegAlias { const char * const Aliases[5]; const char * const Register; }; virtual bool useGlobalsForAutomaticVariables() const { return false; } /// getCFStringSection - Return the section to use for CFString /// literals, or 0 if no special section is used. virtual const char *getCFStringSection() const { return "__DATA,__cfstring"; } /// getNSStringSection - Return the section to use for NSString /// literals, or 0 if no special section is used. virtual const char *getNSStringSection() const { return "__OBJC,__cstring_object,regular,no_dead_strip"; } /// getNSStringNonFragileABISection - Return the section to use for /// NSString literals, or 0 if no special section is used (NonFragile ABI). virtual const char *getNSStringNonFragileABISection() const { return "__DATA, __objc_stringobj, regular, no_dead_strip"; } /// isValidSectionSpecifier - This is an optional hook that targets can /// implement to perform semantic checking on attribute((section("foo"))) /// specifiers. In this case, "foo" is passed in to be checked. If the /// section specifier is invalid, the backend should return a non-empty string /// that indicates the problem. /// /// This hook is a simple quality of implementation feature to catch errors /// and give good diagnostics in cases when the assembler or code generator /// would otherwise reject the section specifier. /// virtual std::string isValidSectionSpecifier(llvm::StringRef SR) const { return ""; } /// setForcedLangOptions - Set forced language options. /// Apply changes to the target information with respect to certain /// language options which change the target configuration. virtual void setForcedLangOptions(LangOptions &Opts); /// getDefaultFeatures - Get the default set of target features for /// the \args CPU; this should include all legal feature strings on /// the target. virtual void getDefaultFeatures(const std::string &CPU, llvm::StringMap<bool> &Features) const { } /// getABI - Get the ABI in use. virtual const char *getABI() const { return ""; } /// getCXXABI - Get the C++ ABI in use. virtual TargetCXXABI getCXXABI() const { return CXXABI; } /// setCPU - Target the specific CPU. /// /// \return - False on error (invalid CPU name). // // FIXME: Remove this. virtual bool setCPU(const std::string &Name) { return true; } /// setABI - Use the specific ABI. /// /// \return - False on error (invalid ABI name). virtual bool setABI(const std::string &Name) { return false; } /// setCXXABI - Use this specific C++ ABI. /// /// \return - False on error (invalid C++ ABI name). bool setCXXABI(const std::string &Name) { static const TargetCXXABI Unknown = static_cast<TargetCXXABI>(-1); TargetCXXABI ABI = llvm::StringSwitch<TargetCXXABI>(Name) .Case("arm", CXXABI_ARM) .Case("itanium", CXXABI_Itanium) .Case("microsoft", CXXABI_Microsoft) .Default(Unknown); if (ABI == Unknown) return false; return setCXXABI(ABI); } /// setCXXABI - Set the C++ ABI to be used by this implementation. /// /// \return - False on error (ABI not valid on this target) virtual bool setCXXABI(TargetCXXABI ABI) { CXXABI = ABI; return true; } /// setFeatureEnabled - Enable or disable a specific target feature, /// the feature name must be valid. /// /// \return - False on error (invalid feature name). virtual bool setFeatureEnabled(llvm::StringMap<bool> &Features, const std::string &Name, bool Enabled) const { return false; } /// HandleTargetOptions - Perform initialization based on the user configured /// set of features (e.g., +sse4). The list is guaranteed to have at most one /// entry per feature. /// /// The target may modify the features list, to change which options are /// passed onwards to the backend. virtual void HandleTargetFeatures(std::vector<std::string> &Features) { } // getRegParmMax - Returns maximal number of args passed in registers. unsigned getRegParmMax() const { return RegParmMax; } /// isTLSSupported - Whether the target supports thread-local storage. bool isTLSSupported() const { return TLSSupported; } /// hasNoAsmVariants - Return true if {|} are normal characters in the /// asm string. If this returns false (the default), then {abc|xyz} is syntax /// that says that when compiling for asm variant #0, "abc" should be /// generated, but when compiling for asm variant #1, "xyz" should be /// generated. bool hasNoAsmVariants() const { return NoAsmVariants; } /// getEHDataRegisterNumber - Return the register number that /// __builtin_eh_return_regno would return with the specified argument. virtual int getEHDataRegisterNumber(unsigned RegNo) const { return -1; } /// getStaticInitSectionSpecifier - Return the section to use for C++ static /// initialization functions. virtual const char *getStaticInitSectionSpecifier() const { return 0; } protected: virtual uint64_t getPointerWidthV(unsigned AddrSpace) const { return PointerWidth; } virtual uint64_t getPointerAlignV(unsigned AddrSpace) const { return PointerAlign; } virtual enum IntType getPtrDiffTypeV(unsigned AddrSpace) const { return PtrDiffType; } virtual void getGCCRegNames(const char * const *&Names, unsigned &NumNames) const = 0; virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, unsigned &NumAliases) const = 0; virtual bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &info) const= 0; }; } // end namespace clang #endif
[ "helmutmanck@5227c84a-046b-4545-895e-fca5577db8e1" ]
helmutmanck@5227c84a-046b-4545-895e-fca5577db8e1
490a1aa84342652ba85916a39a35bc97fae2d283
5d83739af703fb400857cecc69aadaf02e07f8d1
/Archive2/b6/6bd1ecbe89a25d/main.cpp
35ab9e999e60c1b59e4b9a962dddfede6c1f4b48
[]
no_license
WhiZTiM/coliru
3a6c4c0bdac566d1aa1c21818118ba70479b0f40
2c72c048846c082f943e6c7f9fa8d94aee76979f
refs/heads/master
2021-01-01T05:10:33.812560
2015-08-24T19:09:22
2015-08-24T19:09:22
56,789,706
3
0
null
null
null
null
UTF-8
C++
false
false
1,205
cpp
#include <memory> #include <iostream> #include <vector> struct dynamic_release { template <typename F> dynamic_release(F&& f) : _f(std::forward<F>(f)) { } template <typename F> dynamic_release& operator=(F&& f) { _f = std::forward<F>(f); return *this; } ~dynamic_release() { _f(); } private: std::function<void()> _f; }; void do_foo() { std::cout << "Foo\n"; } void do_bar() { std::cout << "Bar\n"; } int main(void) { using InterfaceWrapper = std::shared_ptr<dynamic_release>; using Thing = InterfaceWrapper::element_type; { std::vector<InterfaceWrapper> thing_vector; auto thing = std::make_shared<Thing>(do_foo); thing_vector.push_back(thing); thing_vector.push_back(thing); thing_vector.push_back(thing); thing_vector.push_back(thing); } // prints "Foo" once { std::vector<InterfaceWrapper> thing_vector; auto thing = std::make_shared<Thing>(do_foo); thing_vector.push_back(thing); thing_vector.push_back(thing); thing_vector.push_back(thing); *thing = do_bar; // Prints nothing thing_vector.push_back(thing); } // prints "Bar" once }
[ "francis.rammeloo@36614edc-3e3a-acb8-9062-c8ae0e4185df" ]
francis.rammeloo@36614edc-3e3a-acb8-9062-c8ae0e4185df
afac4958cd0d545b66be72527583a601fd4b9cef
7a91985397ce12d98e8e9be79b2ba9053e4089a0
/6.26/main.cpp
53ac99d572652bec46a3f61304452fc16c6d8e1f
[]
no_license
fuzhong123/ma_fuzhong
7ec7ed1b49b649564a952d730af1ca6cd5bde7c8
bbe93dd4e159d0fea61ad7c1fd5a62243be2c864
refs/heads/master
2020-04-03T10:40:59.518494
2019-05-26T09:13:36
2019-05-26T09:13:36
155,199,581
0
0
null
null
null
null
GB18030
C++
false
false
773
cpp
#include<iostream> using namespace std; //华氏温度 = 摄氏温度 * 9.0 / 5.0 + 32 int main() { const unsigned short A = 32; const double R = 9.0 /5.0; double tempIn, tempOut; char typeIn, typeOut; cout<<"请以【xx.x C】或者【xx.x F】这样的格式输入一个温度:\n\n"; cin >> tempIn >> typeIn; cin.ignore(100,'\n'); cout << "\n"; switch( typeIn ) { case 'C':tempOut = tempIn * R +A;typeOut = 'F'; typeIn='C'; break; case 'F':tempOut= (tempIn -A) / R ;typeOut ='C'; typeIn= 'F'; break; default: typeOut = 'E'; break; } if(typeOut !='E') { cout<< tempIn << typeIn<<"="<<tempOut<<typeOut<<"\n\n"; } else { cout << "输入错误!" << "\n\n"; } cout << "请输入任何字符结束程序!\n\n"; cin.get(); return 0; }
[ "863242240@qq.com" ]
863242240@qq.com
7b1adcdf2c1ca26ac0730ce2a9c62aa33cefa597
f9fa279de2294ff483f3d0c9bc08bb052fc5eda2
/lbshell/src/platform/linux/lb_shell/lb_web_view_host.cc
bd9baa5965e4b77bc481f498e70c52ca4140c629
[ "Apache-2.0" ]
permissive
rajeshvv/h5vcc
964d1c2d6ea308413dae1527525f8937ac58808f
1e0b8ac00d494d3ed56513d1e1725a063add7f31
refs/heads/master
2021-01-15T09:38:25.999021
2013-07-22T22:53:30
2013-07-22T22:53:30
null
0
0
null
null
null
null
UTF-8
C++
false
false
18,499
cc
/* * Copyright 2012 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Owns the primary run loop for LBPS3. Updates I/O, sets up graphics, and in // general is the primary contact object between ps3 system SDK and WebKit. #include "lb_web_view_host.h" #include "external/chromium/base/bind.h" #include "external/chromium/base/logging.h" #include "external/chromium/base/stringprintf.h" #include "external/chromium/base/utf_string_conversions.h" #include "external/chromium/third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" #include "external/chromium/third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "external/chromium/third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" #include "external/chromium/third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" #include "external/chromium/third_party/WebKit/Source/WebKit/chromium/public/WebSettings.h" #include "external/chromium/third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "external/chromium/ui/base/keycodes/keyboard_code_conversion_x.h" #include "external/chromium/webkit/glue/webkit_glue.h" // This head file has a weird dependency and it has to be here after the others #include "external/chromium/third_party/WebKit/Source/WebCore/platform/chromium/KeyboardCodes.h" #include "lb_debug_console.h" #include "lb_http_handler.h" #include "lb_memory_manager.h" #include "lb_network_console.h" #include "lb_platform.h" #include "lb_graphics_linux.h" #include "lb_shell.h" #include "lb_shell_constants.h" #include "lb_shell_platform_delegate.h" #include "lb_web_media_player_delegate.h" #include "lb_web_view_delegate.h" #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/keysymdef.h> using base::StringPrintf; using namespace WebKit; using webkit_media::LBWebMediaPlayerDelegate; #if defined(__LB_SHELL__ENABLE_CONSOLE__) // for open() #include <fcntl.h> extern const char *global_screenshot_output_path; #endif static void NavTaskStartupURL(LBWebViewHost *view_host, LBShell *shell); static void NavTask(LBWebViewHost *view_host, LBShell *shell, const GURL& url); LBWebViewHost* LBWebViewHost::web_view_host_ = NULL; // static LBWebViewHost* LBWebViewHost::Create(LBShell* shell, LBWebViewDelegate* delegate, const webkit_glue::WebPreferences& prefs) { DCHECK(!web_view_host_); LBWebViewHost* host = LB_NEW LBWebViewHost(shell); host->webwidget_ = WebView::create(delegate); prefs.Apply(host->webview()); host->webview()->initializeMainFrame(delegate); host->webview()->setFocus(true); // resize WebKit to device dimensions host->webwidget()->resize(WebSize( LBGraphics::GetPtr()->GetDeviceWidth(), LBGraphics::GetPtr()->GetDeviceHeight())); // force accelerated rendering in all cases host->webview()->settings()->setForceCompositingMode(true); // we'd like to composite directly to the screen, please // TODO: the function is not available any more. we need to find it and // double check we need to reimplement or remove this line. //host->webview()->settings()->setCompositeToTextureEnabled(false); host->webview()->settings()->setAccelerated2dCanvasEnabled(true); host->webview()->settings()->setAcceleratedCompositingEnabled(true); host->webview()->settings()->setAcceleratedCompositingFor3DTransformsEnabled( true); host->webview()->settings()->setAcceleratedCompositingForAnimationEnabled( true); host->webview()->settings()->setAcceleratedCompositingForCanvasEnabled(true); host->webview()->settings()->setAcceleratedCompositingForVideoEnabled(true); host->webview()->setCompositorSurfaceReady(); LBGraphics::GetPtr()->SetWebViewHost(host); web_view_host_ = host; return host; } void LBWebViewHost::Destroy() { #if defined(__LB_SHELL__ENABLE_CONSOLE__) console_->Shutdown(); delete console_; #endif if (webwidget_) { webwidget_->close(); webwidget_ = NULL; } web_view_host_ = NULL; } LBWebViewHost::LBWebViewHost(LBShell* shell) : base::SimpleThread("LBWebViewHost Thread", base::SimpleThread::Options(kViewHostThreadStackSize, kViewHostThreadPriority)) , exit_(false) , shell_(shell) #if defined(__LB_SHELL__ENABLE_CONSOLE__) , console_(NULL) , telnet_connection_(NULL) , webkit_wedged_(false) #endif { main_message_loop_ = MessageLoop::current(); DCHECK(main_message_loop_); #if SHUTDOWN_APPLICATION_AFTER NOTIMPLEMENTED(); #endif } #if defined(__LB_SHELL__ENABLE_CONSOLE__) void LBWebViewHost::output(std::string data) { // trim trailing newlines, if present. // the console library will start a new line for every output. while (data.length() && data[data.length() - 1] == '\n') { data.erase(data.length() - 1); } if (telnet_connection_) { data.append("\n"); telnet_connection_->Output(data); } else { DLOG(INFO) << data; } } void LBWebViewHost::output_popup(std::string data) { output(data); } void LBWebViewHost::clearInput() { console_buffer_.clear(); } bool LBWebViewHost::toggleWebKitWedged() { webkit_wedged_ = !webkit_wedged_; SetWebKitPaused(webkit_wedged_); return webkit_wedged_; } // static void LBWebViewHost::MouseEventTask(WebKit::WebInputEvent::Type type, WebKit::WebMouseEvent::Button button, int x, int y, LBWebViewHost* host) { WebKit::WebMouseEvent mouse_event; mouse_event.type = type; mouse_event.button = button; mouse_event.x = x; mouse_event.y = y; if (host->IsExiting()) return; host->webwidget()->handleInputEvent(mouse_event); } void LBWebViewHost::SendMouseClick(WebKit::WebMouseEvent::Button button, int x, int y) { // post a MouseDown event followed by a MouseUp event 100 ms later. main_message_loop_->PostTask(FROM_HERE, base::Bind(MouseEventTask, WebKit::WebInputEvent::MouseDown, button, x, y, this)); main_message_loop_->PostDelayedTask(FROM_HERE, base::Bind(MouseEventTask, WebKit::WebInputEvent::MouseUp, button, x, y, this), base::TimeDelta::FromMilliseconds(100)); } #endif // The owner will be reponsible for deinit therefore Join() is not implemented // in this class (the function from the base class will be called). void LBWebViewHost::Start() { base::SimpleThread::Start(); } // the main graphics thread runs here. this is pretty much the // "game loop" of LB_SHELL, that is the code responsible for calling // the system callback, rendering and swapping buffers, polling and // sending IO off, etc void LBWebViewHost::Run() { #if defined(__LB_SHELL__ENABLE_CONSOLE__) console_ = LB_NEW LBDebugConsole(); console_->Init(shell_); LBNetworkConsole::Initialize(console_); // Create http server for WebInspector scoped_refptr<LBHttpHandler> http_handler = LB_NEW LBHttpHandler(this); #endif // Start loading the main page. main_message_loop_->PostTask(FROM_HERE, base::Bind(NavTaskStartupURL, this, shell_)); while (!exit_) { // set up render of current frame LBGraphics::GetPtr()->UpdateAndDrawFrame(); // update IO UpdateIO(); #if defined(__LB_SHELL__ENABLE_CONSOLE__) LBNetworkConsole::GetInstance()->Poll(); #endif // wait until frame we drew flips to be displayed LBGraphics::GetPtr()->BlockUntilFlip(); } #if defined(__LB_SHELL__ENABLE_CONSOLE__) LBNetworkConsole::Teardown(); #endif } bool LBWebViewHost::FilterKeyEvent( WebKit::WebKeyboardEvent::Type type, int key_code, wchar_t char_code, WebKit::WebKeyboardEvent::Modifiers modifiers, bool is_console_eligible) { #if defined(__LB_SHELL__ENABLE_CONSOLE__) if (is_console_eligible && type == WebKit::WebKeyboardEvent::KeyUp && modifiers == WebKit::WebKeyboardEvent::ControlKey) { // this is a release event for a control-key-combo. switch (key_code) { case 'C': // control-C schedules a JS pause. console_->ParseAndExecuteCommand("js pause"); break; case 'R': // control-R reloads the page console_->ParseAndExecuteCommand("reload"); break; #if defined(__LB_SHELL__ENABLE_SCREENSHOT__) case 'S': // control-S takes a screenshot LBGraphics::GetPtr()->TakeScreenshot(""); break; #endif case 'W': // control-W pauses/unpauses ("wedges") the WebKit thread console_->ParseAndExecuteCommand("wedge"); break; } // do not pass these intercepted keys to the browser. return false; } #endif if (modifiers & ~WebKit::WebKeyboardEvent::ShiftKey) { // We do not pass control and alt combos to the browser so that we don't // activate some unsupported or non-functional (for us) chromium feature. return false; } // the browser may consume this event. return true; } #if defined(__LB_SHELL__ENABLE_CONSOLE__) void LBWebViewHost::RecordKeyInput(const char* file_name) { NOTIMPLEMENTED(); } void LBWebViewHost::PlaybackKeyInput(const char* file_name, bool repeat) { NOTIMPLEMENTED(); } #endif static void KeyInputTask(WebKit::WebKeyboardEvent event, LBWebViewHost *host) { if (host->IsExiting()) return; host->webwidget()->handleInputEvent(event); } void LBWebViewHost::SendKeyEvent( WebKit::WebInputEvent::Type type, int key_code, wchar_t char_code, WebKit::WebInputEvent::Modifiers modifiers, bool is_console_eligible) { #if defined(__LB_SHELL_DEBUG_TASKS__) // This keystroke info is extremely useful in debugging task-related issues. if (!char_code) printf("Sending keycode %d\n", key_code); #endif if (FilterKeyEvent(type, key_code, char_code, modifiers, is_console_eligible) == false) { // caught by filter, do not pass on. return; } WebKit::WebKeyboardEvent key_event; key_event.type = type; key_event.windowsKeyCode = key_code; key_event.text[0] = char_code; key_event.text[1] = 0; key_event.unmodifiedText[0] = char_code; key_event.unmodifiedText[1] = 0; key_event.modifiers = modifiers; key_event.setKeyIdentifierFromWindowsKeyCode(); main_message_loop_->PostTask(FROM_HERE, base::Bind(KeyInputTask, key_event, this)); } void LBWebViewHost::InjectKeystroke( int key_code, wchar_t char_code, WebKit::WebKeyboardEvent::Modifiers modifiers, bool is_console_eligible) { SendKeyEvent(WebKit::WebInputEvent::RawKeyDown, key_code, 0, modifiers, is_console_eligible); if (char_code != 0) { SendKeyEvent(WebKit::WebInputEvent::Char, char_code, char_code, modifiers, is_console_eligible); } SendKeyEvent(WebKit::WebInputEvent::KeyUp, key_code, 0, modifiers, is_console_eligible); } static void InjectJSTask(WebCString codeString, LBWebViewHost *host) { if (host->IsExiting()) return; WebScriptSource source(codeString.utf16()); host->webview()->mainFrame()->executeScript(source); } // NOTE: This is NOT debug functionality! // Invalid or exception-causing JavaScript is neither detected nor handled. void LBWebViewHost::InjectJS(const char * code) { WebCString codeString(code); main_message_loop_->PostTask(FROM_HERE, base::Bind(InjectJSTask, codeString, this)); } static void QuitTask(LBWebViewHost *host) { host->Join(); MessageLoop::current()->Quit(); } void LBWebViewHost::RequestQuit() { // disable WebKit compositing LBGraphics::GetPtr()->SetWebKitCompositeEnable(false); // setup exit flag. viewhost thread exits according to this flag. exit_ = true; // Sync webkit and viewhost threads. main_message_loop_->PostTask(FROM_HERE, base::Bind(QuitTask, this)); } static int XKeyEventToWindowsKeyCode(XKeyEvent* event) { int windows_key_code = ui::KeyboardCodeFromXKeyEvent(reinterpret_cast<XEvent*>(event)); if (windows_key_code == ui::VKEY_SHIFT || windows_key_code == ui::VKEY_CONTROL || windows_key_code == ui::VKEY_MENU) { // To support DOM3 'location' attribute, we need to lookup an X KeySym and // set ui::VKEY_[LR]XXX instead of ui::VKEY_XXX. KeySym keysym = XK_VoidSymbol; XLookupString(event, NULL, 0, &keysym, NULL); switch (keysym) { case XK_Shift_L: return ui::VKEY_LSHIFT; case XK_Shift_R: return ui::VKEY_RSHIFT; case XK_Control_L: return ui::VKEY_LCONTROL; case XK_Control_R: return ui::VKEY_RCONTROL; case XK_Meta_L: case XK_Alt_L: return ui::VKEY_LMENU; case XK_Meta_R: case XK_Alt_R: return ui::VKEY_RMENU; } } return windows_key_code; } // Converts a WebInputEvent::Modifiers bitfield into a // corresponding X modifier state. static WebKit::WebInputEvent::Modifiers EventModifiersFromXState(XKeyEvent* keyEvent) { unsigned int modifiers = keyEvent->state; unsigned int webkit_modifiers = 0; if (modifiers & ControlMask) { webkit_modifiers |= WebKit::WebInputEvent::ControlKey; } if (modifiers & ShiftMask) { webkit_modifiers |= WebKit::WebInputEvent::ShiftKey; } if (modifiers & Mod1Mask) { webkit_modifiers |= WebKit::WebInputEvent::AltKey; } if (modifiers & Button1Mask) { webkit_modifiers |= WebKit::WebInputEvent::LeftButtonDown; } if (modifiers & Button2Mask) { webkit_modifiers |= WebKit::WebInputEvent::MiddleButtonDown; } if (modifiers & Button3Mask) { webkit_modifiers |= WebKit::WebInputEvent::RightButtonDown; } return static_cast<WebKit::WebInputEvent::Modifiers>(webkit_modifiers); } void LBWebViewHost::UpdateIO() { Display* display = LBGraphicsLinux::GetPtr()->GetXDisplay(); while (XPending(display)) { XEvent event; XNextEvent(display, &event); switch (event.type) { case ButtonPress: { } break; case KeyPress: { WebKit::WebInputEvent::Modifiers modifiers = EventModifiersFromXState(reinterpret_cast<XKeyEvent*>(&event)); int windows_key_code = XKeyEventToWindowsKeyCode(reinterpret_cast<XKeyEvent*>(&event)); SendKeyEvent(WebKit::WebInputEvent::RawKeyDown, windows_key_code, 0, modifiers, true); } break; case KeyRelease: { WebKit::WebInputEvent::Modifiers modifiers = EventModifiersFromXState(reinterpret_cast<XKeyEvent*>(&event)); int windows_key_code = XKeyEventToWindowsKeyCode(reinterpret_cast<XKeyEvent*>(&event)); SendKeyEvent(WebKit::WebInputEvent::KeyUp, windows_key_code, 0, modifiers, true); } break; default: break; } } } // TODO: Consider moving this method outside of platform-specific code. // It's here because we create this type in the Create() method // so we have the specific domain knowledge to know that // we can cast this thing. For a simple embedded setup // like LB we may be able to move this into a centralized spot // down the road. WebView* LBWebViewHost::webview() const { return static_cast<WebView*>(webwidget_); } WebWidget* LBWebViewHost::webwidget() const { return webwidget_; } MessageLoop* LBWebViewHost::main_message_loop() const { return main_message_loop_; } static bool PauseApplicationTaskDone = false; static void PauseApplicationTask(LBWebViewHost *host) { if (host->IsExiting()) return; // The purpose of this task is to pause the entire application, // including media players, WebKit, and JavaScriptCore. DCHECK(MessageLoop::current() == host->main_message_loop()); DLOG(INFO) << StringPrintf("Pausing, main loop has %d items in queue.\n", host->main_message_loop()->Size()); // First we pause all media player instances. LBWebMediaPlayerDelegate::Instance()->PauseActivePlayers(); // Poll for unpause or quit while blocking JavaScriptCore and // the rest of WebKit. while (!PauseApplicationTaskDone && !host->IsExiting()) { // sleep for 100 ms and then poll again base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100)); } // Finally, we unpause all media player instances // and return from the task so that WebKit can continue. if (!host->IsExiting()) { LBWebMediaPlayerDelegate::Instance()->ResumeActivePlayers(); } DLOG(INFO) << StringPrintf( "Unpausing, main loop has %d items in queue.\n", host->main_message_loop()->Size()); } void LBWebViewHost::SetWebKitPaused(bool paused) { if (paused) { PauseApplicationTaskDone = false; main_message_loop()->PostTask(FROM_HERE, base::Bind(PauseApplicationTask, this)); } else { PauseApplicationTaskDone = true; } } void LBWebViewHost::SetPlayersPaused(bool paused) { if (paused) { main_message_loop()->PostTask(FROM_HERE, base::Bind(&LBWebMediaPlayerDelegate::PauseActivePlayers, base::Unretained(LBWebMediaPlayerDelegate::Instance()))); } else { main_message_loop()->PostTask(FROM_HERE, base::Bind(&LBWebMediaPlayerDelegate::ResumeActivePlayers, base::Unretained(LBWebMediaPlayerDelegate::Instance()))); } } void LBWebViewHost::TextInputFocusEvent() { } void LBWebViewHost::TextInputBlurEvent() { } static void NavTaskStartupURL(LBWebViewHost *view_host, LBShell *shell) { if (view_host->IsExiting()) { return; } shell->Navigate(GURL(shell->GetStartupURL())); } static void NavTask(LBWebViewHost *view_host, LBShell *shell, const GURL& url) { if (view_host->IsExiting()) { return; } shell->Navigate(url); } void LBWebViewHost::SendNavigateTask(const GURL& url) { main_message_loop_->PostTask(FROM_HERE, base::Bind(NavTask, this, shell_, url)); } void LBWebViewHost::ShowNetworkFailure() { // TODO: Needs to setup Linux local://. SendNavigateTask(GURL("local://network_failure.html")); }
[ "rjogrady@google.com" ]
rjogrady@google.com
a52e5a4afe9fac9c89be7707abf2e9363c0f8b2a
4f4e784edad7b5604737fcf4ca33c3b61943b30c
/atcoder/abc/130b.cpp
7ffb7517636cb74a3bd3f8ee9c0fb59f87540790
[]
no_license
yakan15/procon
4197d834576de28ef41e113188013e281dc0aefc
69272a99d0398d8d5b6efe5b2c10138a8b36ce87
refs/heads/master
2021-08-19T22:46:56.223803
2020-06-01T16:36:49
2020-06-01T16:36:49
189,934,967
0
0
null
null
null
null
UTF-8
C++
false
false
468
cpp
#include <bits/stdc++.h> #define rep(i,n) for(int (i)=0;(i)<(n);(i)++) const bool debug=false; #define DEBUG if(debug==true) using namespace std; typedef long long ll; typedef unsigned long long ull; int main(void) { int n,x; cin >> n >> x; vector<int> l; int ball=0; int res=1; rep(i,n){ int tmp; cin >> tmp; ball += tmp; if(ball<=x)res++; } cout << res << endl; return 0; }
[ "h.m_92e3i1@hotmail.com" ]
h.m_92e3i1@hotmail.com
2355a0e7c21499e231d1b3636d3ffa3a6f8a358e
bef2903ba91cecaeb75a960a8538a769496a40df
/.history/frontend/src/Screens/ass1_20200803122358.cpp
01d5c11d2367c71a942249fa9b0e7d436f63cf2d
[]
no_license
Prrajainn/Project-YourCart
bf83962b3d43604e2803025621aa6ccd64a4771c
d4baaba9c1ebf3d568708c2026f3890fef8ddd2a
refs/heads/master
2022-11-24T22:16:20.738803
2020-08-08T06:27:44
2020-08-08T06:27:44
285,985,671
0
0
null
null
null
null
UTF-8
C++
false
false
104
cpp
#include<bits/stdc++.h> using namespace std; int main(){ int k , m; cin>>k; cin>>m; while }
[ "prrakharjainn@gmail.com" ]
prrakharjainn@gmail.com
7e6bc6162d685e41cf9c4060f8eed42c10f0c58f
e1cef84f11449c5107f79a5f1d10198d39048028
/sources/IPAddress.cpp
d4581bfc850438d5ade6e6b35ea81f0beff15739
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
LukasBanana/MercuriusLib
7e391d019b225a04b4c0c4906e0cc2af8b30cc77
0b80c49b52a166a4a5490f3044c64f4a8895d9ae
refs/heads/master
2021-01-20T00:13:42.433365
2018-09-24T14:12:49
2018-09-24T14:12:49
89,097,810
1
0
null
null
null
null
UTF-8
C++
false
false
3,030
cpp
/* * IPAddress.cpp * * This file is part of the "MercuriusLib" project (Copyright (c) 2017 by Lukas Hermanns) * See "LICENSE.txt" for license information. */ #include <Merc/IPAddress.h> #include "IPv4Address.h" namespace Mc { std::unique_ptr<IPAddress> IPAddress::MakeIPv4(unsigned short port) { return std::unique_ptr<IPAddress> { new IPv4Address(port) }; } std::unique_ptr<IPAddress> IPAddress::MakeIPv4(unsigned short port, unsigned long address) { return std::unique_ptr<IPAddress> { new IPv4Address(port, address) }; } std::unique_ptr<IPAddress> IPAddress::MakeIPv4(unsigned short port, const std::string& addressName) { return std::unique_ptr<IPAddress> { new IPv4Address(port, addressName) }; } std::unique_ptr<IPAddress> IPAddress::MakeIPv4Localhost(unsigned short port) { return MakeIPv4(port, "127.0.0.1"); } std::unique_ptr<IPAddress> IPAddress::Make(const AddressFamily family, unsigned short port) { switch (family) { case AddressFamily::IPv4: return MakeIPv4(port); default: return nullptr; } } std::vector<std::unique_ptr<IPAddress>> IPAddress::QueryAddressesFromHost(const std::string& hostName) { /* Query addresses from host name */ addrinfo* results; if (::getaddrinfo(hostName.c_str(), nullptr, nullptr, &results) != 0) throw std::runtime_error("failed to query addresses from host name: " + hostName); /* Enumerate addresses */ std::vector<std::unique_ptr<IPAddress>> addresses; for (auto ptr = results; ptr != nullptr; ptr = ptr->ai_next) { switch (ptr->ai_family) { case AF_INET: { if (ptr->ai_addr) { addresses.emplace_back( std::unique_ptr<IPv4Address>( new IPv4Address { *reinterpret_cast<const sockaddr_in*>(ptr->ai_addr) } ) ); } } break; case AF_INET6: { //TODO... } break; default: break; } } return addresses; } IPAddress::~IPAddress() { } MC_EXPORT bool operator == (const IPAddress& lhs, const IPAddress& rhs) { return (lhs.CompareSWO(rhs) == 0); } MC_EXPORT bool operator != (const IPAddress& lhs, const IPAddress& rhs) { return (lhs.CompareSWO(rhs) != 0); } MC_EXPORT bool operator < (const IPAddress& lhs, const IPAddress& rhs) { return (lhs.CompareSWO(rhs) < 0); } MC_EXPORT bool operator <= (const IPAddress& lhs, const IPAddress& rhs) { return (lhs.CompareSWO(rhs) <= 0); } MC_EXPORT bool operator > (const IPAddress& lhs, const IPAddress& rhs) { return (lhs.CompareSWO(rhs) > 0); } MC_EXPORT bool operator >= (const IPAddress& lhs, const IPAddress& rhs) { return (lhs.CompareSWO(rhs) >= 0); } } // /namespace Mc // ================================================================================
[ "lukas.hermanns90@gmail.com" ]
lukas.hermanns90@gmail.com
f4ee2d60ba0e70a3fc9605c5f6bf9e4ea67ceb2c
4a0c25841c0e8bfa85710371a3c3f3d4fcda7ee6
/Classes/CharacterListPage.cpp
742cbd5575d3982abc00a4e52840c69367bfe977
[]
no_license
ljl884/KanColle
7735b830cceae7beea57dae6fe46e9cb05e2ef39
4211b9b703f4c68838e8c38417fe65d255d9db5a
refs/heads/master
2016-09-15T16:40:05.574596
2015-06-13T10:35:45
2015-06-13T10:35:45
31,156,933
4
0
null
null
null
null
UTF-8
C++
false
false
7,336
cpp
#include "CharacterListPage.h" #include "Helper.h" #include "PortOrganizeLayer.h" #define SHIPS_PER_PAGE 10 #define FONT_COLOR Color3B::BLACK CharacterListPage::CharacterListPage(PortOrganizeLayer* parent) { this->parent = parent; Hidden = true; menu = Menu::create(NULL); auto bgimg = Sprite::create("OrganizeMain/image 176.png"); this->addChild(bgimg); bgimg->setPosition(654, 195); auto titleBar = Sprite::create("OrganizeMain/image 177.png"); this->addChild(titleBar); titleBar->setPosition(753, 397); auto top_label = Sprite::create("OrganizeMain/image 178.png"); this->addChild(top_label); top_label->setPosition(398, 399); auto category = Sprite::create("OrganizeMain/image 179.png"); this->addChild(category); category->setPosition(595, 370); sortButton = Sprite::create("OrganizeMain/image 189.png"); auto sortMenuItem = MenuItemSprite::create(sortButton, sortButton, CC_CALLBACK_1(CharacterListPage::sortButtonCallback, this)); sortMenuItem->setPosition(773, 370); menu->addChild(sortMenuItem); //list list = Node::create(); this->addChild(list); listMenu = Menu::create(NULL); listMenu->setPosition(Point::ZERO); this->addChild(listMenu); firstRow = makeRow(nullptr); firstRow->setPosition(540, 345); this->addChild(firstRow); for (int i = 0; i < SHIPS_PER_PAGE; i++) { auto node = Node::create(); rows.push_back(node); auto item = Sprite::create("OrganizeMain/image 182.png"); item->setOpacity(0); auto menuitem = MenuItemSprite::create(item, Sprite::create("OrganizeMain/image 182.png"), item, CC_CALLBACK_1(CharacterListPage::exchangeCallback, this, i)); menuitem->setPosition(550, 347 - (i + 1) * 28); menuitem->setScaleY(0.85); listMenu->addChild(menuitem); } currentPage = 0; updateList(currentPage); //bottom button auto firstPage = MenuItemImage::create("commonAssets/image 196.png", "commonAssets/image 196.png"); firstPage->setPosition(430,33); auto previousPage = MenuItemImage::create("commonAssets/image 190.png", "commonAssets/image 190.png"); previousPage->setPosition(465, 33); auto nextPage = MenuItemImage::create("commonAssets/image 187.png", "commonAssets/image 187.png"); nextPage->setPosition(685, 33); auto lastPage = MenuItemImage::create("commonAssets/image 193.png", "commonAssets/image 193.png"); lastPage->setPosition(720, 33); auto Page1 = MenuItemLabel::create(Label::create("1", "fonts/DengXian.ttf", 16),CC_CALLBACK_1(CharacterListPage::setPageCallback,this,0)); Page1->setPosition(502, 33); Page1->setColor(Color3B(0,127,255)); auto Page2 = MenuItemLabel::create(Label::create("2", "fonts/DengXian.ttf", 16), CC_CALLBACK_1(CharacterListPage::setPageCallback, this, 1)); Page2->setPosition(539, 33); Page2->setColor(FONT_COLOR); auto Page3 = MenuItemLabel::create(Label::create("3", "fonts/DengXian.ttf", 16)); Page3->setPosition(576, 33); Page3->setColor(FONT_COLOR); auto Page4 = MenuItemLabel::create(Label::create("4", "fonts/DengXian.ttf", 16)); Page4->setPosition(613, 33); Page4->setColor(FONT_COLOR); auto Page5 = MenuItemLabel::create(Label::create("5", "fonts/DengXian.ttf", 16)); Page5->setPosition(650, 33); Page5->setColor(FONT_COLOR); menu->addChild(firstPage); menu->addChild(previousPage); menu->addChild(nextPage); menu->addChild(lastPage); menu->addChild(Page1); menu->addChild(Page2); menu->addChild(Page3); menu->addChild(Page4); menu->addChild(Page5); this->addChild(menu); menu->setPosition(Point::ZERO); } void CharacterListPage::updateList(int page) { auto gameModel = GameModel::getInstance(); std::vector<CharacterInfo*> ships = gameModel->getAllShips(); //sortByCategory(ships); displayingCharacters.clear(); list->removeAllChildren(); for (int i = 0; i < SHIPS_PER_PAGE; i++) { if ((SHIPS_PER_PAGE*page + i) == ships.size() ) return; auto row = makeRow(ships[SHIPS_PER_PAGE*page + i]); displayingCharacters.push_back(ships[SHIPS_PER_PAGE*page + i]); rows[i] = row; list->addChild(row); row->setPosition(540, 345 - (i + 1) * 28); } } Node* CharacterListPage::makeRow(CharacterInfo* info) { auto node = Node::create(); Color3B fcolor = FONT_COLOR; auto line = Sprite::create("commonAssets/Line.png"); node->addChild(line); line->setPosition(35, -12); if (info == nullptr) { auto firstRow = Label::create(Helper::getString("remove"), "fonts/DengXian.ttf", 13); firstRow->setPosition(-135,0); firstRow->setColor(fcolor); firstRow->setAnchorPoint(Point::ANCHOR_MIDDLE_LEFT); node->addChild(firstRow); return node; } auto fleet = Sprite::create(); node->addChild(fleet); fleet->setPosition(-160,0); if (info->currentFleet == 0) fleet->setTexture("commonAssets/image 70.png"); else if (info->currentFleet == 1) fleet->setTexture("commonAssets/image 79.png"); else if (info->currentFleet == 2) fleet->setTexture("commonAssets/image 91.png"); else if (info->currentFleet == 3) fleet->setTexture("commonAssets/image 98.png"); std::string type = Helper::getShipType(info->type); auto name = Label::create(type+" "+info->nameCH, "fonts/DengXian.ttf", 13); name->setAlignment(TextHAlignment::LEFT); name->setPosition(-135, 0); name->setAnchorPoint(Point::ANCHOR_MIDDLE_LEFT); name->setColor(fcolor); auto level = Label::create(Helper::int2str(info->level), "fonts/DengXian.ttf", 13); level->setPosition(32, 0); level->setAnchorPoint(Point::ANCHOR_MIDDLE_RIGHT); level->setColor(fcolor); auto maxHP = Label::create(Helper::int2str(info->maxHP), "fonts/DengXian.ttf", 13); maxHP->setPosition(70, 0); maxHP->setAnchorPoint(Point::ANCHOR_MIDDLE_RIGHT); maxHP->setColor(fcolor); auto firePower = Label::create(Helper::int2str(info->firePower), "fonts/DengXian.ttf", 13); firePower->setPosition(105, 0); firePower->setAnchorPoint(Point::ANCHOR_MIDDLE_RIGHT); firePower->setColor(fcolor); auto torpedo = Label::create(Helper::int2str(info->torpedo), "fonts/DengXian.ttf", 13); torpedo->setPosition(135, 0); torpedo->setAnchorPoint(Point::ANCHOR_MIDDLE_RIGHT); torpedo->setColor(fcolor); auto antiaircraft = Label::create(Helper::int2str(info->antiaircraft), "fonts/DengXian.ttf", 13); antiaircraft->setPosition(165, 0); antiaircraft->setAnchorPoint(Point::ANCHOR_MIDDLE_RIGHT); antiaircraft->setColor(fcolor); auto speed = Sprite::create(); speed->setPosition(189, 2); if (info->speed == high) speed->setTexture("commonAssets/image 283.png"); else speed->setTexture("commonAssets/image 281.png"); node->addChild(name); node->addChild(level); node->addChild(maxHP); node->addChild(firePower); node->addChild(torpedo); node->addChild(antiaircraft); node->addChild(speed); return node; } void CharacterListPage::moveOut() { if (!Hidden) { this->runAction(MoveBy::create(0.2, ccp(800, 0))); Hidden = true; } } void CharacterListPage::moveIn() { if (Hidden) { this->runAction(MoveBy::create(0.2, ccp(-800, 0))); Hidden = false; } } void CharacterListPage::sortButtonCallback(Ref* pSender) { } void CharacterListPage::exchangeCallback(Ref* pSender, int indexInList) { GameModel::getInstance()->getFleet(0)->switchShip(displayingCharacters[indexInList], parent->getSelectedShipIndex()); this->updateList(currentPage); this->moveOut(); parent->updateContainers(); } void CharacterListPage::setPageCallback(Ref* PSendr, int page) { this->updateList(page); }
[ "wentaol@student.unimelb.edu.au" ]
wentaol@student.unimelb.edu.au
8318c6beeb334675e152e2d74a74a6d18bb11182
e2f71ee757e2ca32e762c2696893be6b6f7c76c3
/TD2-Banque/Banque - Qt/build-BanqueQt-Desktop_Qt_5_11_1_GCC_64bit-Debug/ui_banque.h
3e9b81935e7284e364ac83979055a7126dd2958e
[]
no_license
EzraGagnard/SNIR1-CPP
1077cdecaeb8d88effb53eb41246f209a9985ff7
30620e08b4ee415f23bc421e42d275163f61fee4
refs/heads/master
2020-05-23T23:04:37.492730
2019-05-17T12:17:22
2019-05-17T12:17:22
186,986,495
0
0
null
null
null
null
UTF-8
C++
false
false
12,289
h
/******************************************************************************** ** Form generated from reading UI file 'banque.ui' ** ** Created by: Qt User Interface Compiler version 5.11.1 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef UI_BANQUE_H #define UI_BANQUE_H #include <QtCore/QVariant> #include <QtWidgets/QApplication> #include <QtWidgets/QDoubleSpinBox> #include <QtWidgets/QHBoxLayout> #include <QtWidgets/QLabel> #include <QtWidgets/QLineEdit> #include <QtWidgets/QListWidget> #include <QtWidgets/QPushButton> #include <QtWidgets/QSpinBox> #include <QtWidgets/QVBoxLayout> #include <QtWidgets/QWidget> QT_BEGIN_NAMESPACE class Ui_Banque { public: QWidget *verticalLayoutWidget; QVBoxLayout *verticalLayout; QLabel *label; QLineEdit *lineEditMontant; QPushButton *pushButtonDeposer; QPushButton *pushButtonRetirer; QWidget *horizontalLayoutWidget; QHBoxLayout *horizontalLayout; QLabel *label_2; QLineEdit *lineEditSolde; QWidget *verticalLayoutWidget_2; QVBoxLayout *verticalLayout_2; QLabel *label_3; QListWidget *listWidgetHistorique; QPushButton *pushButtonQuitter; QWidget *verticalLayoutWidget_3; QVBoxLayout *verticalLayout_3; QLabel *label_4; QSpinBox *spinBoxDecouvert; QPushButton *pushButtonChangerDecouvert; QWidget *horizontalLayoutWidget_2; QHBoxLayout *horizontalLayout_2; QLabel *label_5; QLineEdit *lineEditSoldeEpargne; QWidget *verticalLayoutWidget_4; QVBoxLayout *verticalLayout_4; QLabel *label_6; QLineEdit *lineEditMontantEpargne; QPushButton *pushButtonDeposerEpargne; QPushButton *pushButtonRetirerEpargne; QWidget *verticalLayoutWidget_5; QVBoxLayout *verticalLayout_5; QLabel *label_7; QDoubleSpinBox *doubleSpinBoxTaux; QPushButton *pushButtonNvTaux; QPushButton *pushButtonCrediterInteret; void setupUi(QWidget *Banque) { if (Banque->objectName().isEmpty()) Banque->setObjectName(QStringLiteral("Banque")); Banque->setEnabled(true); Banque->setMinimumSize(QSize(0, 0)); Banque->setMaximumSize(QSize(16777215, 16777215)); Banque->setCursor(QCursor(Qt::ArrowCursor)); Banque->setLayoutDirection(Qt::LeftToRight); Banque->setAutoFillBackground(false); verticalLayoutWidget = new QWidget(Banque); verticalLayoutWidget->setObjectName(QStringLiteral("verticalLayoutWidget")); verticalLayoutWidget->setGeometry(QRect(20, 80, 131, 112)); verticalLayout = new QVBoxLayout(verticalLayoutWidget); verticalLayout->setSpacing(6); verticalLayout->setContentsMargins(11, 11, 11, 11); verticalLayout->setObjectName(QStringLiteral("verticalLayout")); verticalLayout->setContentsMargins(0, 0, 0, 0); label = new QLabel(verticalLayoutWidget); label->setObjectName(QStringLiteral("label")); verticalLayout->addWidget(label); lineEditMontant = new QLineEdit(verticalLayoutWidget); lineEditMontant->setObjectName(QStringLiteral("lineEditMontant")); verticalLayout->addWidget(lineEditMontant); pushButtonDeposer = new QPushButton(verticalLayoutWidget); pushButtonDeposer->setObjectName(QStringLiteral("pushButtonDeposer")); verticalLayout->addWidget(pushButtonDeposer); pushButtonRetirer = new QPushButton(verticalLayoutWidget); pushButtonRetirer->setObjectName(QStringLiteral("pushButtonRetirer")); verticalLayout->addWidget(pushButtonRetirer); horizontalLayoutWidget = new QWidget(Banque); horizontalLayoutWidget->setObjectName(QStringLiteral("horizontalLayoutWidget")); horizontalLayoutWidget->setGeometry(QRect(20, 10, 251, 51)); horizontalLayout = new QHBoxLayout(horizontalLayoutWidget); horizontalLayout->setSpacing(6); horizontalLayout->setContentsMargins(11, 11, 11, 11); horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); horizontalLayout->setContentsMargins(0, 0, 0, 0); label_2 = new QLabel(horizontalLayoutWidget); label_2->setObjectName(QStringLiteral("label_2")); horizontalLayout->addWidget(label_2); lineEditSolde = new QLineEdit(horizontalLayoutWidget); lineEditSolde->setObjectName(QStringLiteral("lineEditSolde")); horizontalLayout->addWidget(lineEditSolde); verticalLayoutWidget_2 = new QWidget(Banque); verticalLayoutWidget_2->setObjectName(QStringLiteral("verticalLayoutWidget_2")); verticalLayoutWidget_2->setGeometry(QRect(160, 80, 231, 191)); verticalLayout_2 = new QVBoxLayout(verticalLayoutWidget_2); verticalLayout_2->setSpacing(6); verticalLayout_2->setContentsMargins(11, 11, 11, 11); verticalLayout_2->setObjectName(QStringLiteral("verticalLayout_2")); verticalLayout_2->setContentsMargins(0, 0, 0, 0); label_3 = new QLabel(verticalLayoutWidget_2); label_3->setObjectName(QStringLiteral("label_3")); verticalLayout_2->addWidget(label_3); listWidgetHistorique = new QListWidget(verticalLayoutWidget_2); listWidgetHistorique->setObjectName(QStringLiteral("listWidgetHistorique")); verticalLayout_2->addWidget(listWidgetHistorique); pushButtonQuitter = new QPushButton(Banque); pushButtonQuitter->setObjectName(QStringLiteral("pushButtonQuitter")); pushButtonQuitter->setGeometry(QRect(210, 280, 131, 25)); verticalLayoutWidget_3 = new QWidget(Banque); verticalLayoutWidget_3->setObjectName(QStringLiteral("verticalLayoutWidget_3")); verticalLayoutWidget_3->setGeometry(QRect(20, 200, 131, 82)); verticalLayout_3 = new QVBoxLayout(verticalLayoutWidget_3); verticalLayout_3->setSpacing(6); verticalLayout_3->setContentsMargins(11, 11, 11, 11); verticalLayout_3->setObjectName(QStringLiteral("verticalLayout_3")); verticalLayout_3->setContentsMargins(0, 0, 0, 0); label_4 = new QLabel(verticalLayoutWidget_3); label_4->setObjectName(QStringLiteral("label_4")); verticalLayout_3->addWidget(label_4); spinBoxDecouvert = new QSpinBox(verticalLayoutWidget_3); spinBoxDecouvert->setObjectName(QStringLiteral("spinBoxDecouvert")); verticalLayout_3->addWidget(spinBoxDecouvert); pushButtonChangerDecouvert = new QPushButton(verticalLayoutWidget_3); pushButtonChangerDecouvert->setObjectName(QStringLiteral("pushButtonChangerDecouvert")); verticalLayout_3->addWidget(pushButtonChangerDecouvert); horizontalLayoutWidget_2 = new QWidget(Banque); horizontalLayoutWidget_2->setObjectName(QStringLiteral("horizontalLayoutWidget_2")); horizontalLayoutWidget_2->setGeometry(QRect(290, 10, 231, 51)); horizontalLayout_2 = new QHBoxLayout(horizontalLayoutWidget_2); horizontalLayout_2->setSpacing(6); horizontalLayout_2->setContentsMargins(11, 11, 11, 11); horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2")); horizontalLayout_2->setContentsMargins(0, 0, 0, 0); label_5 = new QLabel(horizontalLayoutWidget_2); label_5->setObjectName(QStringLiteral("label_5")); horizontalLayout_2->addWidget(label_5); lineEditSoldeEpargne = new QLineEdit(horizontalLayoutWidget_2); lineEditSoldeEpargne->setObjectName(QStringLiteral("lineEditSoldeEpargne")); horizontalLayout_2->addWidget(lineEditSoldeEpargne); verticalLayoutWidget_4 = new QWidget(Banque); verticalLayoutWidget_4->setObjectName(QStringLiteral("verticalLayoutWidget_4")); verticalLayoutWidget_4->setGeometry(QRect(400, 80, 141, 112)); verticalLayout_4 = new QVBoxLayout(verticalLayoutWidget_4); verticalLayout_4->setSpacing(6); verticalLayout_4->setContentsMargins(11, 11, 11, 11); verticalLayout_4->setObjectName(QStringLiteral("verticalLayout_4")); verticalLayout_4->setContentsMargins(0, 0, 0, 0); label_6 = new QLabel(verticalLayoutWidget_4); label_6->setObjectName(QStringLiteral("label_6")); verticalLayout_4->addWidget(label_6); lineEditMontantEpargne = new QLineEdit(verticalLayoutWidget_4); lineEditMontantEpargne->setObjectName(QStringLiteral("lineEditMontantEpargne")); verticalLayout_4->addWidget(lineEditMontantEpargne); pushButtonDeposerEpargne = new QPushButton(verticalLayoutWidget_4); pushButtonDeposerEpargne->setObjectName(QStringLiteral("pushButtonDeposerEpargne")); verticalLayout_4->addWidget(pushButtonDeposerEpargne); pushButtonRetirerEpargne = new QPushButton(verticalLayoutWidget_4); pushButtonRetirerEpargne->setObjectName(QStringLiteral("pushButtonRetirerEpargne")); verticalLayout_4->addWidget(pushButtonRetirerEpargne); verticalLayoutWidget_5 = new QWidget(Banque); verticalLayoutWidget_5->setObjectName(QStringLiteral("verticalLayoutWidget_5")); verticalLayoutWidget_5->setGeometry(QRect(400, 200, 146, 113)); verticalLayout_5 = new QVBoxLayout(verticalLayoutWidget_5); verticalLayout_5->setSpacing(6); verticalLayout_5->setContentsMargins(11, 11, 11, 11); verticalLayout_5->setObjectName(QStringLiteral("verticalLayout_5")); verticalLayout_5->setContentsMargins(0, 0, 0, 0); label_7 = new QLabel(verticalLayoutWidget_5); label_7->setObjectName(QStringLiteral("label_7")); verticalLayout_5->addWidget(label_7); doubleSpinBoxTaux = new QDoubleSpinBox(verticalLayoutWidget_5); doubleSpinBoxTaux->setObjectName(QStringLiteral("doubleSpinBoxTaux")); verticalLayout_5->addWidget(doubleSpinBoxTaux); pushButtonNvTaux = new QPushButton(verticalLayoutWidget_5); pushButtonNvTaux->setObjectName(QStringLiteral("pushButtonNvTaux")); verticalLayout_5->addWidget(pushButtonNvTaux); pushButtonCrediterInteret = new QPushButton(verticalLayoutWidget_5); pushButtonCrediterInteret->setObjectName(QStringLiteral("pushButtonCrediterInteret")); verticalLayout_5->addWidget(pushButtonCrediterInteret); retranslateUi(Banque); QObject::connect(pushButtonQuitter, SIGNAL(clicked()), Banque, SLOT(close())); QMetaObject::connectSlotsByName(Banque); } // setupUi void retranslateUi(QWidget *Banque) { Banque->setWindowTitle(QApplication::translate("Banque", "Banque", nullptr)); label->setText(QApplication::translate("Banque", "Montant:", nullptr)); pushButtonDeposer->setText(QApplication::translate("Banque", "Deposer", nullptr)); pushButtonRetirer->setText(QApplication::translate("Banque", "Retirer", nullptr)); label_2->setText(QApplication::translate("Banque", "Compte Courant:", nullptr)); label_3->setText(QApplication::translate("Banque", "Historique:", nullptr)); pushButtonQuitter->setText(QApplication::translate("Banque", "Quitter", nullptr)); label_4->setText(QApplication::translate("Banque", "Changer le d\303\251couvert:", nullptr)); pushButtonChangerDecouvert->setText(QApplication::translate("Banque", "Changer", nullptr)); label_5->setText(QApplication::translate("Banque", "Compte Epargne:", nullptr)); label_6->setText(QApplication::translate("Banque", "Montant Epargne:", nullptr)); pushButtonDeposerEpargne->setText(QApplication::translate("Banque", "Deposer", nullptr)); pushButtonRetirerEpargne->setText(QApplication::translate("Banque", "Retirer", nullptr)); label_7->setText(QApplication::translate("Banque", "Changer le taux d'interet:", nullptr)); pushButtonNvTaux->setText(QApplication::translate("Banque", "Nouveau taux d'int\303\251rets", nullptr)); pushButtonCrediterInteret->setText(QApplication::translate("Banque", "Crediter interets", nullptr)); } // retranslateUi }; namespace Ui { class Banque: public Ui_Banque {}; } // namespace Ui QT_END_NAMESPACE #endif // UI_BANQUE_H
[ "gmgagnard@gmail.com" ]
gmgagnard@gmail.com
afd995a8202505b7cf0e04c93fd0e3176e1c08a1
a56252fda5c9e42eff04792c6e16e413ad51ba1a
/resources/home/dnanexus/root/include/TRefTable.h
947bec6db8f46b7a314b882dac73ff2d8a43da49
[ "LGPL-2.1-or-later", "LGPL-2.1-only", "Apache-2.0" ]
permissive
edawson/parliament2
4231e692565dbecf99d09148e75c00750e6797c4
2632aa3484ef64c9539c4885026b705b737f6d1e
refs/heads/master
2021-06-21T23:13:29.482239
2020-12-07T21:10:08
2020-12-07T21:10:08
150,246,745
0
0
Apache-2.0
2019-09-11T03:22:55
2018-09-25T10:21:03
Python
UTF-8
C++
false
false
4,399
h
// @(#)root/cont:$Id$ // Author: Rene Brun 17/08/2004 /************************************************************************* * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #ifndef ROOT_TRefTable #define ROOT_TRefTable ////////////////////////////////////////////////////////////////////////// // // // TRefTable // // // // A TRefTable maintains the association between a referenced object // // and the parent object supporting this referenced object. // // The parent object is typically a branch of a TTree. // // // ////////////////////////////////////////////////////////////////////////// #include "TObject.h" #include <string> #include <vector> class TObjArray; class TProcessID; class TRefTable : public TObject { protected: Int_t fNumPIDs; //!number of known ProcessIDs Int_t *fAllocSize; //![fNumPIDs] allocated size of array fParentIDs for each ProcessID Int_t *fN; //![fNumPIDs] current maximum number of IDs in array fParentIDs for each ProcessID Int_t **fParentIDs; //![fNumPIDs][fAllocSize] array of Parent IDs Int_t fParentID; //!current parent ID in fParents (latest call to SetParent) Int_t fDefaultSize;//!default size for a new PID array UInt_t fUID; //!Current uid (set by TRef::GetObject) TProcessID *fUIDContext; //!TProcessID the current uid is referring to Int_t fSize; //dummy for backward compatibility TObjArray *fParents; //array of Parent objects (eg TTree branch) holding the referenced objects TObject *fOwner; //Object owning this TRefTable std::vector<std::string> fProcessGUIDs; // UUIDs of TProcessIDs used in fParentIDs std::vector<Int_t> fMapPIDtoInternal; //! cache of pid to index in fProcessGUIDs static TRefTable *fgRefTable; //Pointer to current TRefTable Int_t AddInternalIdxForPID(TProcessID* procid); virtual Int_t ExpandForIID(Int_t iid, Int_t newsize); void ExpandPIDs(Int_t numpids); Int_t FindPIDGUID(const char* guid) const; Int_t GetInternalIdxForPID(TProcessID* procid) const; Int_t GetInternalIdxForPID(Int_t pid) const; public: enum EStatusBits { kHaveWarnedReadingOld = BIT(14) }; TRefTable(); TRefTable(TObject *owner, Int_t size); virtual ~TRefTable(); virtual Int_t Add(Int_t uid, TProcessID* context = 0); virtual void Clear(Option_t * /*option*/ =""); virtual Int_t Expand(Int_t pid, Int_t newsize); virtual void FillBuffer(TBuffer &b); static TRefTable *GetRefTable(); Int_t GetNumPIDs() const {return fNumPIDs;} Int_t GetSize(Int_t pid) const {return fAllocSize[GetInternalIdxForPID(pid)];} Int_t GetN(Int_t pid) const {return fN[GetInternalIdxForPID(pid)];} TObject *GetOwner() const {return fOwner;} TObject *GetParent(Int_t uid, TProcessID* context = 0) const; TObjArray *GetParents() const {return fParents;} UInt_t GetUID() const {return fUID;} TProcessID *GetUIDContext() const {return fUIDContext;} virtual Bool_t Notify(); virtual void ReadBuffer(TBuffer &b); virtual void Reset(Option_t * /* option */ =""); virtual Int_t SetParent(const TObject* parent, Int_t branchID); static void SetRefTable(TRefTable *table); virtual void SetUID(UInt_t uid, TProcessID* context = 0) {fUID=uid; fUIDContext = context;} ClassDef(TRefTable,3) //Table of referenced objects during an I/O operation }; #endif
[ "slzarate96@gmail.com" ]
slzarate96@gmail.com
5f4d0ff5caed593c9d3718887fa7bf72806b0a52
a590f039107aaab0980d7ded36b6f79cd47e541d
/OpenFOAM/elliot-7/Dissertation/NOTCH/H/Initial Cases/scalarTransportH/0.065/T
00c8afdfba10f11c6d7378bba0b311645599d258
[]
no_license
etenno/uni
3f85179768ae5a5d77dd21879f84323278a7a2f6
bb62570182ea239c123df954eb0893e2d681fe8d
refs/heads/master
2023-03-04T08:30:00.034753
2021-02-14T12:54:03
2021-02-14T12:54:03
338,678,729
0
0
null
null
null
null
UTF-8
C++
false
false
72,469
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 6 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0.065"; object T; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 0 1 0 0 0]; internalField nonuniform List<scalar> 7000 ( 97.6992 97.6991 97.699 97.6989 97.6989 97.6989 97.6989 97.6989 97.699 97.6991 97.6991 97.6989 97.6988 97.6987 97.6987 97.6987 97.6987 97.6988 97.6988 97.6989 97.699 97.6988 97.6987 97.6986 97.6986 97.6986 97.6986 97.6987 97.6987 97.6988 97.6989 97.6987 97.6986 97.6985 97.6985 97.6985 97.6985 97.6986 97.6987 97.6988 97.6989 97.6987 97.6986 97.6985 97.6985 97.6985 97.6985 97.6986 97.6987 97.6988 97.6989 97.6987 97.6986 97.6985 97.6985 97.6985 97.6985 97.6986 97.6987 97.6988 97.6989 97.6987 97.6986 97.6985 97.6985 97.6985 97.6986 97.6986 97.6987 97.6988 97.6989 97.6988 97.6987 97.6986 97.6986 97.6986 97.6986 97.6987 97.6988 97.6989 97.699 97.6988 97.6987 97.6987 97.6987 97.6987 97.6987 97.6988 97.6989 97.699 97.6991 97.6989 97.6988 97.6988 97.6988 97.6988 97.6988 97.6989 97.699 97.6991 74.0659 74.0655 74.0652 74.0651 74.065 74.065 74.0651 74.0652 74.0654 74.0656 74.0655 74.0651 74.0648 74.0647 74.0646 74.0646 74.0647 74.0648 74.065 74.0653 74.0652 74.0648 74.0645 74.0644 74.0643 74.0643 74.0644 74.0645 74.0648 74.0651 74.0651 74.0647 74.0644 74.0642 74.0642 74.0642 74.0642 74.0644 74.0646 74.0649 74.065 74.0646 74.0643 74.0642 74.0641 74.0641 74.0642 74.0643 74.0646 74.0649 74.065 74.0646 74.0643 74.0642 74.0641 74.0641 74.0642 74.0644 74.0646 74.0649 74.0651 74.0647 74.0644 74.0642 74.0642 74.0642 74.0643 74.0645 74.0647 74.065 74.0652 74.0648 74.0645 74.0644 74.0643 74.0644 74.0645 74.0646 74.0649 74.0652 74.0654 74.065 74.0648 74.0646 74.0646 74.0646 74.0647 74.0649 74.0651 74.0654 74.0656 74.0653 74.0651 74.0649 74.0649 74.0649 74.065 74.0652 74.0654 74.0657 53.1081 53.1075 53.1071 53.1069 53.1068 53.1068 53.1069 53.1071 53.1074 53.1077 53.1075 53.107 53.1066 53.1064 53.1063 53.1063 53.1064 53.1066 53.1069 53.1073 53.1071 53.1066 53.1062 53.106 53.1059 53.1059 53.106 53.1063 53.1066 53.1071 53.1069 53.1064 53.106 53.1058 53.1057 53.1057 53.1058 53.1061 53.1064 53.1069 53.1068 53.1063 53.1059 53.1057 53.1056 53.1056 53.1058 53.106 53.1064 53.1068 53.1068 53.1063 53.1059 53.1057 53.1056 53.1057 53.1058 53.106 53.1064 53.1069 53.1069 53.1064 53.106 53.1058 53.1058 53.1058 53.1059 53.1062 53.1065 53.107 53.1071 53.1066 53.1063 53.1061 53.106 53.106 53.1062 53.1064 53.1068 53.1073 53.1074 53.1069 53.1066 53.1064 53.1064 53.1064 53.1065 53.1068 53.1072 53.1077 53.1077 53.1074 53.1071 53.1069 53.1069 53.1069 53.107 53.1073 53.1077 53.1081 35.936 35.9354 35.935 35.9348 35.9347 35.9347 35.9348 35.9351 35.9354 35.9358 35.9354 35.9349 35.9345 35.9342 35.9341 35.9342 35.9343 35.9345 35.9349 35.9354 35.935 35.9345 35.9341 35.9339 35.9338 35.9338 35.9339 35.9342 35.9346 35.9351 35.9348 35.9342 35.9339 35.9336 35.9336 35.9336 35.9337 35.934 35.9344 35.935 35.9347 35.9342 35.9338 35.9336 35.9335 35.9335 35.9336 35.9339 35.9343 35.9349 35.9347 35.9342 35.9338 35.9336 35.9335 35.9335 35.9337 35.934 35.9344 35.9349 35.9348 35.9343 35.9339 35.9337 35.9336 35.9337 35.9338 35.9341 35.9345 35.9351 35.9351 35.9345 35.9342 35.934 35.9339 35.934 35.9341 35.9344 35.9348 35.9354 35.9354 35.9349 35.9346 35.9344 35.9343 35.9344 35.9346 35.9348 35.9353 35.9358 35.9358 35.9354 35.9352 35.935 35.9349 35.935 35.9351 35.9354 35.9358 35.9364 22.917 22.9165 22.9161 22.9159 22.9159 22.9159 22.916 22.9162 22.9165 22.9169 22.9165 22.916 22.9157 22.9155 22.9154 22.9154 22.9155 22.9157 22.9161 22.9166 22.9161 22.9157 22.9153 22.9151 22.915 22.9151 22.9152 22.9154 22.9158 22.9163 22.9159 22.9155 22.9151 22.9149 22.9148 22.9149 22.915 22.9152 22.9156 22.9162 22.9159 22.9154 22.915 22.9148 22.9148 22.9148 22.9149 22.9152 22.9156 22.9161 22.9159 22.9154 22.9151 22.9149 22.9148 22.9148 22.915 22.9152 22.9156 22.9162 22.916 22.9155 22.9152 22.915 22.9149 22.915 22.9151 22.9154 22.9158 22.9163 22.9162 22.9158 22.9155 22.9153 22.9152 22.9153 22.9154 22.9157 22.9161 22.9166 22.9166 22.9161 22.9159 22.9157 22.9156 22.9157 22.9158 22.9161 22.9165 22.9171 22.917 22.9167 22.9164 22.9163 22.9162 22.9163 22.9164 22.9167 22.9171 22.9176 13.7668 13.7664 13.7662 13.766 13.7659 13.7659 13.766 13.7661 13.7663 13.7666 13.7664 13.766 13.7658 13.7656 13.7655 13.7655 13.7656 13.7657 13.766 13.7663 13.7662 13.7658 13.7655 13.7653 13.7653 13.7653 13.7654 13.7655 13.7657 13.7661 13.766 13.7656 13.7654 13.7652 13.7651 13.7651 13.7652 13.7654 13.7656 13.766 13.7659 13.7655 13.7653 13.7651 13.7651 13.7651 13.7652 13.7653 13.7656 13.766 13.766 13.7656 13.7653 13.7652 13.7651 13.7651 13.7652 13.7654 13.7656 13.7661 13.7661 13.7657 13.7654 13.7653 13.7652 13.7653 13.7653 13.7655 13.7658 13.7662 13.7663 13.7659 13.7657 13.7655 13.7655 13.7655 13.7656 13.7658 13.766 13.7664 13.7666 13.7662 13.766 13.7659 13.7658 13.7659 13.766 13.7661 13.7664 13.7668 13.7669 13.7667 13.7665 13.7664 13.7663 13.7664 13.7665 13.7666 13.7669 13.7673 7.79177 7.79149 7.7913 7.79118 7.79112 7.79108 7.79104 7.79096 7.79085 7.79082 7.7915 7.79122 7.79103 7.79091 7.79084 7.79081 7.79078 7.79071 7.79061 7.79065 7.79131 7.79103 7.79084 7.79073 7.79066 7.79063 7.7906 7.79054 7.79046 7.79052 7.7912 7.79092 7.79073 7.79062 7.79055 7.79052 7.7905 7.79044 7.79037 7.79044 7.79115 7.79088 7.79069 7.79058 7.79052 7.79049 7.79047 7.79041 7.79035 7.79042 7.79117 7.7909 7.79072 7.79061 7.79055 7.79052 7.7905 7.79045 7.79039 7.79046 7.79126 7.791 7.79082 7.79071 7.79065 7.79063 7.79061 7.79056 7.7905 7.79057 7.79142 7.79117 7.79099 7.79089 7.79084 7.79082 7.7908 7.79076 7.7907 7.79077 7.79166 7.79142 7.79127 7.79117 7.79112 7.79111 7.79109 7.79105 7.79099 7.79106 7.79196 7.79179 7.79165 7.79157 7.79152 7.79151 7.79149 7.79145 7.79139 7.79146 4.15786 4.15768 4.15755 4.15746 4.15738 4.15726 4.15701 4.15645 4.15551 4.15453 4.15768 4.1575 4.15737 4.15728 4.15721 4.15709 4.15683 4.15629 4.15536 4.15443 4.15756 4.15738 4.15725 4.15717 4.15709 4.15697 4.15672 4.15618 4.15526 4.15434 4.15749 4.15731 4.15718 4.1571 4.15702 4.15691 4.15666 4.15612 4.1552 4.15429 4.15746 4.15728 4.15716 4.15707 4.157 4.15689 4.15664 4.1561 4.15519 4.15428 4.15748 4.1573 4.15718 4.15709 4.15702 4.15691 4.15666 4.15613 4.15522 4.15432 4.15754 4.15737 4.15725 4.15717 4.1571 4.15699 4.15674 4.15621 4.1553 4.1544 4.15766 4.15749 4.15738 4.1573 4.15723 4.15712 4.15688 4.15635 4.15544 4.15453 4.15783 4.15767 4.15757 4.1575 4.15743 4.15733 4.15708 4.15655 4.15565 4.15474 4.15804 4.15793 4.15784 4.15778 4.15771 4.15761 4.15737 4.15684 4.15593 4.15503 2.09414 2.09403 2.09394 2.09387 2.09375 2.09348 2.09279 2.09116 2.08796 2.08372 2.09403 2.09392 2.09384 2.09376 2.09365 2.09338 2.09269 2.09107 2.08787 2.08366 2.09396 2.09385 2.09377 2.09369 2.09358 2.09331 2.09262 2.091 2.08781 2.08361 2.09391 2.09381 2.09372 2.09365 2.09354 2.09327 2.09259 2.09097 2.08778 2.08358 2.0939 2.09379 2.09371 2.09364 2.09352 2.09326 2.09258 2.09096 2.08777 2.08358 2.09391 2.09381 2.09373 2.09365 2.09354 2.09328 2.0926 2.09098 2.08779 2.0836 2.09396 2.09385 2.09377 2.0937 2.09359 2.09333 2.09265 2.09103 2.08784 2.08365 2.09403 2.09393 2.09385 2.09379 2.09368 2.09342 2.09273 2.09112 2.08793 2.08374 2.09414 2.09405 2.09398 2.09391 2.09381 2.09355 2.09287 2.09125 2.08807 2.08387 2.09428 2.09422 2.09416 2.0941 2.09399 2.09373 2.09305 2.09144 2.08825 2.08406 0.996848 0.996785 0.99673 0.996656 0.996487 0.996007 0.994631 0.99092 0.981974 0.965535 0.99679 0.996727 0.996672 0.996598 0.996429 0.99595 0.994575 0.990867 0.981926 0.965504 0.99675 0.996687 0.996632 0.996559 0.99639 0.995912 0.994538 0.990832 0.981896 0.965478 0.996727 0.996664 0.99661 0.996536 0.996368 0.99589 0.994518 0.990813 0.981879 0.965464 0.996719 0.996657 0.996603 0.99653 0.996362 0.995885 0.994514 0.990809 0.981876 0.965462 0.996728 0.996667 0.996613 0.99654 0.996373 0.995896 0.994525 0.990822 0.981889 0.965475 0.996754 0.996693 0.996641 0.996569 0.996403 0.995926 0.994556 0.990852 0.98192 0.965505 0.9968 0.996741 0.99669 0.99662 0.996455 0.995979 0.994609 0.990905 0.981972 0.965556 0.996866 0.996813 0.996766 0.996698 0.996533 0.996058 0.994688 0.990984 0.98205 0.965633 0.996952 0.996914 0.996872 0.996806 0.996642 0.996167 0.994797 0.991093 0.982158 0.96574 0.449169 0.449133 0.449095 0.44902 0.448812 0.448165 0.446145 0.439873 0.420176 0.355558 0.449138 0.449103 0.449065 0.44899 0.448783 0.448136 0.446116 0.439846 0.420154 0.355544 0.449118 0.449083 0.449044 0.44897 0.448763 0.448116 0.446097 0.439829 0.420139 0.355533 0.449106 0.449071 0.449033 0.448959 0.448752 0.448106 0.446087 0.43982 0.420131 0.355527 0.449103 0.449068 0.44903 0.448956 0.448749 0.448103 0.446085 0.439818 0.42013 0.355527 0.449108 0.449074 0.449036 0.448962 0.448755 0.44811 0.446092 0.439825 0.420137 0.355533 0.449123 0.449089 0.449051 0.448979 0.448772 0.448127 0.446109 0.439842 0.420153 0.355546 0.449148 0.449115 0.449079 0.449007 0.448801 0.448156 0.446138 0.439871 0.42018 0.355569 0.449186 0.449155 0.449121 0.44905 0.448844 0.4482 0.446182 0.439914 0.420221 0.355604 0.449234 0.449212 0.44918 0.44911 0.448905 0.44826 0.446242 0.439973 0.420279 0.355655 0.191893 0.191874 0.191847 0.191783 0.191594 0.191012 0.189267 0.184243 0.170522 0.136167 0.191879 0.191859 0.191832 0.191769 0.191579 0.190998 0.189254 0.18423 0.170512 0.136161 0.191869 0.19185 0.191823 0.191759 0.19157 0.190989 0.189245 0.184222 0.170505 0.136156 0.191863 0.191844 0.191817 0.191754 0.191565 0.190983 0.18924 0.184218 0.170502 0.136153 0.191862 0.191843 0.191816 0.191753 0.191564 0.190983 0.189239 0.184217 0.170502 0.136153 0.191865 0.191846 0.191819 0.191756 0.191567 0.190986 0.189243 0.184221 0.170505 0.136156 0.191872 0.191854 0.191827 0.191764 0.191576 0.190995 0.189252 0.18423 0.170513 0.136163 0.191886 0.191868 0.191842 0.191779 0.191591 0.19101 0.189267 0.184244 0.170526 0.136173 0.191905 0.191888 0.191863 0.191801 0.191613 0.191032 0.189289 0.184266 0.170547 0.13619 0.19193 0.191917 0.191894 0.191832 0.191644 0.191064 0.18932 0.184296 0.170575 0.136213 0.0778603 0.0778501 0.0778326 0.0777872 0.0776529 0.0772574 0.076148 0.0732399 0.0662928 0.0519318 0.0778537 0.0778436 0.0778261 0.0777807 0.0776464 0.0772511 0.076142 0.0732344 0.0662884 0.0519287 0.0778493 0.0778392 0.0778217 0.0777764 0.0776422 0.0772469 0.0761381 0.0732308 0.0662854 0.0519266 0.0778468 0.0778368 0.0778193 0.077774 0.0776399 0.0772447 0.076136 0.073229 0.0662839 0.0519256 0.0778463 0.0778363 0.0778189 0.0777736 0.0776395 0.0772444 0.0761358 0.0732289 0.0662839 0.0519256 0.0778478 0.0778378 0.0778205 0.0777753 0.0776412 0.0772462 0.0761376 0.0732307 0.0662856 0.051927 0.0778516 0.0778417 0.0778245 0.0777795 0.0776455 0.0772505 0.0761418 0.0732347 0.0662893 0.05193 0.0778581 0.0778484 0.0778315 0.0777866 0.0776527 0.0772577 0.076149 0.0732417 0.0662955 0.051935 0.0778675 0.0778585 0.077842 0.0777973 0.0776635 0.0772686 0.0761597 0.073252 0.066305 0.0519425 0.0778798 0.0778726 0.0778567 0.0778122 0.0776785 0.0772836 0.0761745 0.0732663 0.0663182 0.0519533 0.0300555 0.0300504 0.0300401 0.0300127 0.0299336 0.0297123 0.0291315 0.0277332 0.0247342 0.0193046 0.0300527 0.0300476 0.0300374 0.03001 0.0299309 0.0297096 0.029129 0.0277309 0.0247323 0.0193033 0.0300508 0.0300457 0.0300355 0.0300081 0.0299291 0.0297079 0.0291273 0.0277294 0.0247311 0.0193025 0.0300498 0.0300447 0.0300345 0.0300071 0.0299281 0.029707 0.0291265 0.0277287 0.0247305 0.0193021 0.0300496 0.0300445 0.0300344 0.030007 0.029928 0.0297069 0.0291264 0.0277287 0.0247305 0.0193021 0.0300503 0.0300453 0.0300351 0.0300078 0.0299288 0.0297077 0.0291273 0.0277295 0.0247313 0.0193027 0.0300521 0.0300471 0.030037 0.0300097 0.0299308 0.0297097 0.0291292 0.0277313 0.0247329 0.0193041 0.030055 0.0300501 0.0300402 0.0300129 0.0299341 0.0297129 0.0291324 0.0277344 0.0247357 0.0193063 0.0300594 0.0300547 0.0300449 0.0300178 0.029939 0.0297178 0.0291372 0.027739 0.0247398 0.0193096 0.030065 0.0300611 0.0300516 0.0300246 0.0299458 0.0297246 0.0291439 0.0277454 0.0247456 0.0193143 0.0110566 0.0110541 0.0110488 0.0110343 0.010994 0.0108867 0.0106215 0.0100276 0.00885737 0.00692794 0.0110555 0.011053 0.0110477 0.0110332 0.0109929 0.0108856 0.0106205 0.0100267 0.00885664 0.00692742 0.0110547 0.0110523 0.0110469 0.0110325 0.0109922 0.0108849 0.0106198 0.0100261 0.00885617 0.00692708 0.0110543 0.0110519 0.0110465 0.0110321 0.0109918 0.0108845 0.0106195 0.0100258 0.00885594 0.00692691 0.0110542 0.0110518 0.0110465 0.0110321 0.0109918 0.0108845 0.0106195 0.0100258 0.00885596 0.00692695 0.0110546 0.0110521 0.0110468 0.0110324 0.0109922 0.0108849 0.0106198 0.0100262 0.00885629 0.00692721 0.0110553 0.0110529 0.0110476 0.0110332 0.010993 0.0108857 0.0106207 0.0100269 0.00885698 0.00692777 0.0110566 0.0110542 0.011049 0.0110346 0.0109944 0.0108871 0.010622 0.0100282 0.00885814 0.0069287 0.0110585 0.0110562 0.011051 0.0110367 0.0109965 0.0108892 0.0106241 0.0100302 0.00885987 0.00693009 0.0110609 0.011059 0.0110539 0.0110396 0.0109994 0.0108921 0.0106269 0.0100329 0.00886229 0.00693205 0.00388267 0.00388158 0.00387904 0.00387225 0.00385394 0.00380734 0.0036982 0.00346818 0.00304429 0.00239096 0.00388224 0.00388115 0.00387862 0.00387183 0.00385353 0.00380694 0.00369783 0.00346784 0.00304402 0.00239076 0.00388196 0.00388087 0.00387834 0.00387155 0.00385325 0.00380667 0.00369758 0.00346763 0.00304384 0.00239063 0.00388181 0.00388072 0.00387819 0.0038714 0.00385311 0.00380654 0.00369746 0.00346752 0.00304376 0.00239057 0.00388179 0.00388071 0.00387818 0.0038714 0.00385311 0.00380654 0.00369747 0.00346753 0.00304377 0.00239059 0.00388193 0.00388084 0.00387833 0.00387155 0.00385326 0.0038067 0.00369762 0.00346768 0.0030439 0.0023907 0.00388224 0.00388116 0.00387865 0.00387188 0.0038536 0.00380703 0.00369795 0.00346799 0.00304418 0.00239092 0.00388276 0.0038817 0.0038792 0.00387244 0.00385417 0.0038076 0.0036985 0.00346851 0.00304464 0.00239129 0.00388351 0.0038825 0.00388003 0.00387329 0.00385502 0.00380844 0.00369932 0.00346928 0.00304533 0.00239185 0.0038845 0.00388361 0.00388119 0.00387446 0.00385619 0.00380961 0.00370046 0.00347036 0.00304629 0.00239262 0.00130363 0.00130318 0.00130208 0.00129918 0.00129162 0.00127315 0.00123185 0.0011491 0.00100453 0.000792559 0.00130348 0.00130302 0.00130193 0.00129903 0.00129147 0.001273 0.00123171 0.00114898 0.00100444 0.000792488 0.00130338 0.00130292 0.00130182 0.00129893 0.00129137 0.00127291 0.00123162 0.00114891 0.00100437 0.000792442 0.00130332 0.00130287 0.00130177 0.00129888 0.00129132 0.00127286 0.00123158 0.00114887 0.00100434 0.000792421 0.00130332 0.00130287 0.00130177 0.00129888 0.00129132 0.00127287 0.00123159 0.00114888 0.00100435 0.000792429 0.00130337 0.00130292 0.00130183 0.00129893 0.00129138 0.00127293 0.00123165 0.00114893 0.0010044 0.000792471 0.00130349 0.00130304 0.00130196 0.00129906 0.00129151 0.00127306 0.00123177 0.00114905 0.00100451 0.000792556 0.00130369 0.00130325 0.00130217 0.00129928 0.00129173 0.00127327 0.00123198 0.00114925 0.00100468 0.000792697 0.00130399 0.00130356 0.00130249 0.0012996 0.00129206 0.00127359 0.0012323 0.00114954 0.00100494 0.000792908 0.00130437 0.00130399 0.00130293 0.00130005 0.00129251 0.00127404 0.00123273 0.00114995 0.0010053 0.000793201 0.000419155 0.000418976 0.000418538 0.000417399 0.000414521 0.000407741 0.000393176 0.000365218 0.000318431 0.0002524 0.000419101 0.000418923 0.000418485 0.000417346 0.000414469 0.000407691 0.00039313 0.000365177 0.000318398 0.000252375 0.000419066 0.000418888 0.00041845 0.000417312 0.000414436 0.000407659 0.0003931 0.000365151 0.000318377 0.000252359 0.000419048 0.00041887 0.000418432 0.000417295 0.000414419 0.000407643 0.000393086 0.000365139 0.000318368 0.000252353 0.000419048 0.00041887 0.000418433 0.000417296 0.000414421 0.000407645 0.000393089 0.000365142 0.000318371 0.000252356 0.000419068 0.000418891 0.000418454 0.000417318 0.000414443 0.000407668 0.000393111 0.000365163 0.00031839 0.000252371 0.000419113 0.000418936 0.000418501 0.000417365 0.000414491 0.000407715 0.000393157 0.000365206 0.000318428 0.000252402 0.000419186 0.000419012 0.000418578 0.000417444 0.00041457 0.000407794 0.000393233 0.000365277 0.00031849 0.000252453 0.000419293 0.000419124 0.000418694 0.000417562 0.000414688 0.00040791 0.000393346 0.000365383 0.000318584 0.000252529 0.000419433 0.00041928 0.000418856 0.000417725 0.000414851 0.000408072 0.000393502 0.000365529 0.000318713 0.000252635 0.000129253 0.000129187 0.000129024 0.000128608 0.000127587 0.00012526 0.000120433 0.000111503 9.71037e-05 7.7477e-05 0.000129235 0.000129169 0.000129006 0.000128591 0.000127571 0.000125244 0.000120418 0.00011149 9.70929e-05 7.74688e-05 0.000129223 0.000129158 0.000128995 0.00012858 0.00012756 0.000125233 0.000120408 0.000111481 9.7086e-05 7.74637e-05 0.000129217 0.000129152 0.000128989 0.000128574 0.000127554 0.000125228 0.000120404 0.000111477 9.7083e-05 7.74616e-05 0.000129218 0.000129152 0.00012899 0.000128575 0.000127555 0.000125229 0.000120405 0.000111479 9.70843e-05 7.74629e-05 0.000129225 0.00012916 0.000128997 0.000128583 0.000127563 0.000125237 0.000120413 0.000111486 9.70909e-05 7.74683e-05 0.000129241 0.000129176 0.000129014 0.000128599 0.00012758 0.000125254 0.000120429 0.000111501 9.7104e-05 7.74791e-05 0.000129266 0.000129202 0.000129041 0.000128626 0.000127607 0.000125281 0.000120455 0.000111525 9.71256e-05 7.74967e-05 0.000129303 0.000129241 0.000129081 0.000128667 0.000127648 0.000125321 0.000120494 0.000111562 9.71577e-05 7.7523e-05 0.000129352 0.000129295 0.000129137 0.000128724 0.000127704 0.000125377 0.000120548 0.000111612 9.72021e-05 7.75593e-05 3.828e-05 3.82573e-05 3.82005e-05 3.80585e-05 3.77187e-05 3.69665e-05 3.54564e-05 3.2762e-05 2.86153e-05 2.34628e-05 3.82744e-05 3.82518e-05 3.8195e-05 3.8053e-05 3.77134e-05 3.69614e-05 3.54517e-05 3.27579e-05 2.86119e-05 2.34601e-05 3.82708e-05 3.82481e-05 3.81914e-05 3.80495e-05 3.77099e-05 3.69582e-05 3.54487e-05 3.27552e-05 2.86097e-05 2.34585e-05 3.82691e-05 3.82464e-05 3.81897e-05 3.80478e-05 3.77083e-05 3.69567e-05 3.54474e-05 3.27541e-05 2.86089e-05 2.34578e-05 3.82693e-05 3.82466e-05 3.819e-05 3.80482e-05 3.77087e-05 3.69571e-05 3.54478e-05 3.27546e-05 2.86094e-05 2.34583e-05 3.82717e-05 3.82491e-05 3.81926e-05 3.80508e-05 3.77114e-05 3.69598e-05 3.54504e-05 3.2757e-05 2.86116e-05 2.34602e-05 3.82769e-05 3.82544e-05 3.8198e-05 3.80563e-05 3.77169e-05 3.69652e-05 3.54557e-05 3.2762e-05 2.86159e-05 2.34639e-05 3.82854e-05 3.82632e-05 3.82069e-05 3.80653e-05 3.7726e-05 3.69742e-05 3.54644e-05 3.277e-05 2.86231e-05 2.34699e-05 3.82978e-05 3.82761e-05 3.82203e-05 3.80789e-05 3.77395e-05 3.69875e-05 3.54772e-05 3.2782e-05 2.86336e-05 2.34788e-05 3.8314e-05 3.82941e-05 3.82388e-05 3.80976e-05 3.77582e-05 3.70059e-05 3.54949e-05 3.27985e-05 2.86482e-05 2.3491e-05 0.125096 0.0439502 0.0153381 0.0057203 0.00368352 0.00689736 0.0196481 0.057911 0.167608 0.477542 0.12509 0.0439477 0.0153371 0.00571974 0.00368279 0.00689567 0.0196438 0.0579002 0.167582 0.477482 0.125086 0.0439462 0.0153365 0.00571939 0.00368235 0.00689467 0.0196412 0.057894 0.167568 0.477448 0.125084 0.0439454 0.0153362 0.00571923 0.00368212 0.00689414 0.0196399 0.0578908 0.16756 0.477431 0.125084 0.0439455 0.0153362 0.00571924 0.00368207 0.00689398 0.0196395 0.0578899 0.167558 0.477426 0.125087 0.0439467 0.0153367 0.00571945 0.00368218 0.0068941 0.0196398 0.0578907 0.16756 0.477432 0.125093 0.0439491 0.0153377 0.00571988 0.00368244 0.00689449 0.0196408 0.0578933 0.167567 0.477449 0.125103 0.0439532 0.0153394 0.00572058 0.00368286 0.0068951 0.0196423 0.0578974 0.167578 0.477478 0.125117 0.0439592 0.0153418 0.00572158 0.00368342 0.00689585 0.0196442 0.0579026 0.167592 0.477515 0.125137 0.0439671 0.015345 0.00572284 0.00368406 0.0068966 0.0196459 0.0579074 0.167606 0.477554 0.0663291 0.0276091 0.0106604 0.00426929 0.00288462 0.00532499 0.0145182 0.0401565 0.10523 0.253137 0.0663257 0.0276076 0.0106597 0.00426886 0.00288405 0.00532371 0.0145151 0.0401492 0.105214 0.253106 0.0663233 0.0276065 0.0106593 0.0042686 0.0028837 0.00532292 0.0145132 0.0401447 0.105204 0.253087 0.0663221 0.027606 0.0106591 0.00426847 0.00288352 0.00532251 0.0145122 0.0401424 0.105199 0.253076 0.0663222 0.0276061 0.0106591 0.00426848 0.00288348 0.00532238 0.0145119 0.0401417 0.105198 0.253074 0.0663238 0.0276069 0.0106595 0.00426864 0.00288357 0.00532248 0.0145121 0.0401423 0.105199 0.253077 0.0663274 0.0276086 0.0106602 0.00426899 0.00288379 0.0053228 0.0145129 0.0401443 0.105204 0.253087 0.0663334 0.0276115 0.0106615 0.00426955 0.00288413 0.00532331 0.0145141 0.0401474 0.105211 0.253105 0.0663424 0.0276158 0.0106634 0.00427037 0.00288462 0.00532399 0.0145157 0.0401516 0.105222 0.253128 0.0663552 0.0276218 0.010666 0.0042715 0.00288526 0.00532481 0.0145176 0.0401566 0.105235 0.253158 0.0294597 0.0139241 0.00593057 0.00258225 0.00185522 0.00335645 0.00865097 0.0222608 0.0530292 0.112402 0.029458 0.0139233 0.00593015 0.00258198 0.00185485 0.00335564 0.00864909 0.0222567 0.0530209 0.112387 0.0294568 0.0139227 0.00592989 0.00258181 0.00185462 0.00335514 0.00864792 0.0222541 0.0530158 0.112378 0.0294563 0.0139225 0.00592976 0.00258173 0.0018545 0.00335487 0.00864729 0.0222527 0.053013 0.112373 0.0294564 0.0139225 0.0059298 0.00258174 0.00185447 0.00335479 0.0086471 0.0222523 0.0530122 0.112371 0.0294572 0.013923 0.00593003 0.00258185 0.00185453 0.00335486 0.00864726 0.0222527 0.0530131 0.112373 0.0294591 0.013924 0.00593051 0.00258207 0.00185468 0.00335508 0.00864776 0.0222539 0.0530158 0.112379 0.0294622 0.0139256 0.00593129 0.00258245 0.00185493 0.00335544 0.00864858 0.0222559 0.0530202 0.112387 0.0294669 0.0139281 0.00593247 0.002583 0.00185528 0.00335593 0.00864972 0.0222586 0.0530265 0.1124 0.0294735 0.0139316 0.00593414 0.00258378 0.00185576 0.00335657 0.00865118 0.0222622 0.0530347 0.112418 0.0119034 0.00615727 0.00284606 0.00134101 0.00102268 0.001811 0.00441557 0.0106359 0.0234264 0.0454035 0.0119027 0.00615685 0.00284585 0.00134086 0.00102248 0.00181056 0.00441459 0.0106338 0.0234226 0.0453974 0.0119021 0.00615659 0.00284571 0.00134076 0.00102234 0.00181028 0.00441397 0.0106326 0.0234202 0.0453933 0.0119019 0.00615646 0.00284565 0.00134072 0.00102228 0.00181013 0.00441364 0.0106319 0.0234188 0.0453911 0.011902 0.00615651 0.00284567 0.00134072 0.00102226 0.00181008 0.00441353 0.0106317 0.0234184 0.0453904 0.0119024 0.00615675 0.0028458 0.00134079 0.0010223 0.00181012 0.00441362 0.0106319 0.0234189 0.0453913 0.0119032 0.00615725 0.00284605 0.00134092 0.00102239 0.00181026 0.00441391 0.0106325 0.0234203 0.0453938 0.0119047 0.00615808 0.00284648 0.00134113 0.00102254 0.00181047 0.00441439 0.0106336 0.0234225 0.045398 0.0119069 0.00615933 0.00284712 0.00134145 0.00102276 0.00181078 0.00441507 0.0106352 0.0234258 0.0454043 0.01191 0.00616111 0.00284802 0.0013419 0.00102305 0.0018112 0.00441597 0.0106372 0.0234303 0.0454129 0.00449552 0.00248195 0.00122612 0.00061973 0.000498399 0.000864475 0.00200373 0.00455892 0.00943174 0.0171414 0.0044952 0.00248177 0.00122602 0.000619657 0.000498295 0.000864261 0.00200328 0.00455803 0.00943016 0.0171389 0.00449499 0.00248166 0.00122596 0.00061961 0.000498228 0.000864124 0.00200299 0.00455745 0.00942912 0.0171373 0.00449489 0.00248161 0.00122593 0.000619588 0.000498193 0.000864049 0.00200283 0.00455713 0.00942855 0.0171364 0.00449492 0.00248163 0.00122594 0.000619592 0.000498186 0.000864026 0.00200278 0.00455703 0.00942838 0.0171361 0.00449511 0.00248174 0.00122601 0.000619624 0.000498206 0.00086405 0.00200283 0.00455714 0.00942861 0.0171365 0.00449549 0.00248197 0.00122613 0.000619691 0.000498255 0.00086412 0.00200297 0.00455746 0.00942923 0.0171376 0.00449613 0.00248236 0.00122634 0.000619802 0.000498337 0.000864238 0.00200322 0.00455799 0.00943028 0.0171395 0.0044971 0.00248293 0.00122665 0.000619967 0.000498456 0.000864408 0.00200358 0.00455877 0.00943184 0.0171422 0.00449845 0.00248374 0.00122708 0.000620198 0.000498619 0.000864637 0.00200406 0.00455983 0.009434 0.0171461 0.00160531 0.000930304 0.000485198 0.000260717 0.000219465 0.000373409 0.000827626 0.00179406 0.00353037 0.00611853 0.00160519 0.000930231 0.000485156 0.000260684 0.000219418 0.000373314 0.000827433 0.0017937 0.00352975 0.00611759 0.00160511 0.000930184 0.000485129 0.000260663 0.000219387 0.000373252 0.000827307 0.00179346 0.00352934 0.00611696 0.00160507 0.000930164 0.000485118 0.000260653 0.000219371 0.000373219 0.000827237 0.00179332 0.00352911 0.0061166 0.00160509 0.000930176 0.000485124 0.000260655 0.000219368 0.000373209 0.000827216 0.00179329 0.00352905 0.00611651 0.00160516 0.000930225 0.000485152 0.00026067 0.000219378 0.000373221 0.00082724 0.00179334 0.00352915 0.00611668 0.00160532 0.000930323 0.000485208 0.000260701 0.000219402 0.000373255 0.000827308 0.00179348 0.00352941 0.00611713 0.00160558 0.000930486 0.0004853 0.000260753 0.000219442 0.000373312 0.000827424 0.00179372 0.00352987 0.00611791 0.00160598 0.000930731 0.000485437 0.00026083 0.000219501 0.000373396 0.000827595 0.00179407 0.00353055 0.00611907 0.00160653 0.000931075 0.000485631 0.000260938 0.000219581 0.00037351 0.000827826 0.00179456 0.00353149 0.0061207 0.000545303 0.000327994 0.0001789 0.000101375 8.87028e-05 0.000148298 0.000316065 0.000657609 0.00124275 0.00207739 0.000545256 0.000327966 0.000178883 0.000101362 8.86829e-05 0.000148259 0.000315989 0.000657469 0.00124252 0.00207705 0.000545226 0.000327948 0.000178872 0.000101353 8.867e-05 0.000148234 0.000315938 0.000657377 0.00124237 0.00207682 0.000545213 0.000327941 0.000178868 0.000101349 8.86632e-05 0.00014822 0.000315911 0.000657326 0.00124228 0.00207669 0.00054522 0.000327946 0.000178871 0.00010135 8.86621e-05 0.000148216 0.000315903 0.000657312 0.00124226 0.00207666 0.000545251 0.000327966 0.000178883 0.000101356 8.86665e-05 0.000148222 0.000315913 0.000657333 0.0012423 0.00207673 0.000545312 0.000328005 0.000178906 0.00010137 8.86772e-05 0.000148237 0.000315942 0.000657391 0.00124241 0.0020769 0.000545414 0.00032807 0.000178944 0.000101392 8.86951e-05 0.000148262 0.000315993 0.000657491 0.00124259 0.00207721 0.000545566 0.000328168 0.000179 0.000101425 8.87215e-05 0.0001483 0.000316067 0.000657641 0.00124287 0.00207766 0.000545778 0.000328304 0.00017908 0.000101472 8.87578e-05 0.000148352 0.000316169 0.000657846 0.00124325 0.00207831 0.000176995 0.000109688 6.2137e-05 3.68867e-05 3.33554e-05 5.48809e-05 0.000113008 0.000227002 0.000414885 0.000673916 0.000176979 0.000109678 6.21306e-05 3.68813e-05 3.33476e-05 5.48661e-05 0.000112979 0.000226951 0.000414804 0.0006738 0.000176969 0.000109672 6.21267e-05 3.68779e-05 3.33425e-05 5.48564e-05 0.000112961 0.000226917 0.000414749 0.000673721 0.000176964 0.000109669 6.21252e-05 3.68764e-05 3.33399e-05 5.48511e-05 0.00011295 0.000226899 0.000414719 0.000673676 0.000176967 0.000109671 6.21263e-05 3.68768e-05 3.33395e-05 5.48497e-05 0.000112947 0.000226894 0.000414712 0.000673667 0.000176979 0.000109679 6.21309e-05 3.68794e-05 3.33414e-05 5.4852e-05 0.000112952 0.000226903 0.000414727 0.000673693 0.000177001 0.000109694 6.21399e-05 3.68849e-05 3.33458e-05 5.48582e-05 0.000112964 0.000226925 0.000414768 0.000673758 0.000177038 0.000109718 6.21546e-05 3.68939e-05 3.33533e-05 5.48689e-05 0.000112984 0.000226965 0.000414838 0.00067387 0.000177094 0.000109754 6.21766e-05 3.69073e-05 3.33643e-05 5.48847e-05 0.000113014 0.000227023 0.000414943 0.00067404 0.000177171 0.000109805 6.22071e-05 3.69258e-05 3.33795e-05 5.49062e-05 0.000113056 0.000227104 0.00041509 0.000674278 5.56506e-05 3.55167e-05 2.08437e-05 1.29192e-05 1.203e-05 1.94951e-05 3.88867e-05 7.56401e-05 0.000134073 0.000211755 5.5645e-05 3.55131e-05 2.08414e-05 1.29172e-05 1.20271e-05 1.94896e-05 3.88765e-05 7.56224e-05 0.000134045 0.000211716 5.56415e-05 3.55109e-05 2.084e-05 1.29159e-05 1.20252e-05 1.9486e-05 3.88698e-05 7.56106e-05 0.000134027 0.00021169 5.56402e-05 3.55101e-05 2.08395e-05 1.29153e-05 1.20242e-05 1.94841e-05 3.8866e-05 7.56041e-05 0.000134016 0.000211675 5.56413e-05 3.55109e-05 2.08399e-05 1.29155e-05 1.2024e-05 1.94836e-05 3.88651e-05 7.56025e-05 0.000134014 0.000211672 5.56454e-05 3.55137e-05 2.08417e-05 1.29165e-05 1.20248e-05 1.94845e-05 3.88668e-05 7.56058e-05 0.00013402 0.000211682 5.56535e-05 3.55192e-05 2.0845e-05 1.29187e-05 1.20266e-05 1.9487e-05 3.88714e-05 7.56145e-05 0.000134035 0.000211705 5.56666e-05 3.5528e-05 2.08505e-05 1.29222e-05 1.20296e-05 1.94913e-05 3.88793e-05 7.56293e-05 0.000134061 0.000211746 5.56863e-05 3.55412e-05 2.08587e-05 1.29273e-05 1.2034e-05 1.94976e-05 3.8891e-05 7.56514e-05 0.000134099 0.000211806 5.57134e-05 3.55595e-05 2.087e-05 1.29344e-05 1.204e-05 1.95061e-05 3.89071e-05 7.56819e-05 0.000134153 0.000211891 1.96816e-05 1.3334e-05 8.16816e-06 5.29106e-06 5.06506e-06 8.08676e-06 1.56354e-05 2.94184e-05 5.02122e-05 7.48256e-05 1.96797e-05 1.33327e-05 8.16728e-06 5.29023e-06 5.06383e-06 8.08451e-06 1.56313e-05 2.94116e-05 5.02019e-05 7.48119e-05 1.96784e-05 1.33319e-05 8.1667e-06 5.28968e-06 5.063e-06 8.08298e-06 1.56285e-05 2.94068e-05 5.01946e-05 7.48021e-05 1.96779e-05 1.33316e-05 8.16649e-06 5.28944e-06 5.06257e-06 8.08214e-06 1.5627e-05 2.94042e-05 5.01906e-05 7.47967e-05 1.96784e-05 1.33319e-05 8.16671e-06 5.28953e-06 5.06253e-06 8.08195e-06 1.56266e-05 2.94036e-05 5.01898e-05 7.47958e-05 1.968e-05 1.33331e-05 8.16748e-06 5.29001e-06 5.0629e-06 8.08241e-06 1.56274e-05 2.94051e-05 5.01924e-05 7.47996e-05 1.96833e-05 1.33354e-05 8.16896e-06 5.29097e-06 5.06373e-06 8.08357e-06 1.56295e-05 2.94089e-05 5.01988e-05 7.48091e-05 1.96885e-05 1.33392e-05 8.17137e-06 5.29255e-06 5.06513e-06 8.08555e-06 1.56331e-05 2.94154e-05 5.02097e-05 7.48252e-05 1.96962e-05 1.33446e-05 8.17489e-06 5.29487e-06 5.06716e-06 8.08844e-06 1.56383e-05 2.94251e-05 5.02259e-05 7.48493e-05 1.97066e-05 1.3352e-05 8.17962e-06 5.29796e-06 5.06986e-06 8.09225e-06 1.56453e-05 2.94379e-05 5.02478e-05 7.48823e-05 1.35744 1.60418 1.67942 1.7034 1.71115 1.71366 1.7145 1.71483 1.71503 1.71518 1.35731 1.60402 1.67926 1.70324 1.71099 1.7135 1.71434 1.71467 1.71488 1.71506 1.35723 1.60394 1.67917 1.70315 1.7109 1.71341 1.71425 1.71459 1.7148 1.715 1.3572 1.60389 1.67912 1.7031 1.71085 1.71336 1.71421 1.71455 1.71477 1.71497 1.35718 1.60388 1.67911 1.70309 1.71084 1.71335 1.7142 1.71454 1.71476 1.71496 1.3572 1.6039 1.67913 1.70311 1.71087 1.71338 1.71422 1.71457 1.71479 1.71499 1.35724 1.60395 1.67918 1.70317 1.71093 1.71344 1.71429 1.71463 1.71486 1.71506 1.35731 1.60404 1.67928 1.70327 1.71103 1.71355 1.71439 1.71474 1.71496 1.71517 1.35741 1.60417 1.67942 1.70342 1.71118 1.7137 1.71455 1.71489 1.71512 1.71532 1.35753 1.60432 1.67959 1.7036 1.71136 1.71388 1.71473 1.71508 1.7153 1.7155 0.519741 0.650913 0.703314 0.722517 0.729198 0.73144 0.732185 0.732454 0.732586 0.732684 0.519689 0.650851 0.703248 0.72245 0.72913 0.731372 0.732118 0.732389 0.732526 0.73264 0.519656 0.65081 0.703205 0.722406 0.729086 0.731329 0.732075 0.732348 0.732489 0.732608 0.519638 0.650789 0.703182 0.722382 0.729063 0.731306 0.732053 0.732327 0.73247 0.732591 0.519633 0.650783 0.703175 0.722376 0.729057 0.731301 0.732049 0.732324 0.732468 0.73259 0.51964 0.650792 0.703186 0.722388 0.729069 0.731313 0.732062 0.732338 0.732482 0.732604 0.519659 0.650817 0.703214 0.722418 0.729101 0.731345 0.732094 0.732371 0.732515 0.732638 0.519692 0.65086 0.703263 0.722469 0.729154 0.731399 0.732149 0.732425 0.73257 0.732693 0.519739 0.650923 0.703334 0.722544 0.729231 0.731477 0.732227 0.732504 0.732649 0.732772 0.519802 0.651007 0.70343 0.722645 0.729334 0.731581 0.732332 0.732609 0.732754 0.732878 0.198199 0.253033 0.279565 0.290678 0.294924 0.296444 0.296968 0.297154 0.297237 0.297293 0.198177 0.253007 0.279537 0.29065 0.294895 0.296415 0.296939 0.297127 0.297212 0.297275 0.198163 0.25299 0.279518 0.29063 0.294875 0.296396 0.29692 0.297109 0.297195 0.297261 0.198155 0.25298 0.279508 0.29062 0.294865 0.296385 0.29691 0.297099 0.297187 0.297253 0.198153 0.252978 0.279505 0.290617 0.294862 0.296383 0.296909 0.297098 0.297186 0.297253 0.198156 0.252982 0.27951 0.290623 0.294868 0.296389 0.296915 0.297105 0.297193 0.29726 0.198165 0.252994 0.279524 0.290637 0.294883 0.296404 0.296931 0.297121 0.297209 0.297276 0.19818 0.253013 0.279547 0.290661 0.294909 0.29643 0.296957 0.297147 0.297235 0.297302 0.198203 0.253043 0.279581 0.290698 0.294946 0.296468 0.296995 0.297185 0.297274 0.297341 0.198234 0.253085 0.279628 0.290749 0.294998 0.296521 0.297048 0.297239 0.297327 0.297395 0.073667 0.0943996 0.105854 0.111197 0.11342 0.114269 0.114577 0.114688 0.114735 0.114764 0.0736585 0.0943894 0.105843 0.111186 0.113408 0.114258 0.114565 0.114677 0.114725 0.114757 0.0736526 0.0943822 0.105835 0.111178 0.1134 0.11425 0.114557 0.114669 0.114718 0.114751 0.0736493 0.0943783 0.105831 0.111173 0.113395 0.114245 0.114553 0.114665 0.114714 0.114748 0.0736485 0.0943773 0.10583 0.111172 0.113394 0.114244 0.114552 0.114665 0.114714 0.114748 0.0736499 0.0943792 0.105832 0.111175 0.113397 0.114247 0.114555 0.114668 0.114717 0.114751 0.0736538 0.0943843 0.105838 0.111181 0.113404 0.114254 0.114562 0.114675 0.114724 0.114758 0.0736605 0.0943931 0.105848 0.111192 0.113415 0.114266 0.114574 0.114687 0.114736 0.11477 0.0736706 0.0944064 0.105864 0.111209 0.113432 0.114283 0.114592 0.114705 0.114754 0.114788 0.0736848 0.0944252 0.105885 0.111232 0.113457 0.114308 0.114617 0.114729 0.114779 0.114813 0.0264331 0.0338014 0.0382711 0.0405407 0.0415554 0.0419674 0.0421237 0.0421819 0.042206 0.0422199 0.0264298 0.0337975 0.0382668 0.0405362 0.0415508 0.0419629 0.0421192 0.0421775 0.0422021 0.0422172 0.0264275 0.0337947 0.0382637 0.040533 0.0415476 0.0419597 0.0421161 0.0421745 0.0421994 0.0422149 0.0264262 0.0337931 0.038262 0.0405313 0.0415458 0.0419579 0.0421144 0.042173 0.042198 0.0422137 0.0264259 0.0337928 0.0382616 0.0405309 0.0415454 0.0419576 0.0421142 0.0421728 0.0421979 0.0422137 0.0264265 0.0337936 0.0382626 0.040532 0.0415466 0.0419588 0.0421155 0.0421741 0.0421993 0.0422151 0.0264281 0.0337958 0.0382651 0.0405347 0.0415495 0.0419618 0.0421185 0.0421772 0.0422024 0.0422182 0.026431 0.0337995 0.0382694 0.0405394 0.0415544 0.0419668 0.0421235 0.0421823 0.0422075 0.0422234 0.0264353 0.0338051 0.038276 0.0405465 0.0415618 0.0419744 0.0421312 0.04219 0.0422152 0.0422311 0.0264414 0.0338131 0.0382853 0.0405566 0.0415723 0.041985 0.0421419 0.0422008 0.042226 0.042242 0.00912089 0.0116163 0.0132355 0.0141147 0.0145323 0.0147111 0.014782 0.0148092 0.0148205 0.0148267 0.00911965 0.0116148 0.0132339 0.014113 0.0145305 0.0147094 0.0147803 0.0148076 0.014819 0.0148257 0.00911879 0.0116138 0.0132328 0.0141118 0.0145293 0.0147082 0.0147791 0.0148065 0.014818 0.0148248 0.00911831 0.0116132 0.0132322 0.0141111 0.0145287 0.0147075 0.0147785 0.0148059 0.0148175 0.0148244 0.0091182 0.0116131 0.013232 0.014111 0.0145286 0.0147074 0.0147784 0.0148058 0.0148175 0.0148244 0.00911845 0.0116134 0.0132324 0.0141115 0.014529 0.0147079 0.014779 0.0148064 0.0148181 0.014825 0.00911912 0.0116143 0.0132334 0.0141126 0.0145302 0.0147091 0.0147802 0.0148076 0.0148193 0.0148263 0.00912027 0.0116158 0.0132352 0.0141145 0.0145322 0.0147112 0.0147822 0.0148097 0.0148214 0.0148284 0.00912201 0.011618 0.0132378 0.0141174 0.0145352 0.0147142 0.0147854 0.0148128 0.0148246 0.0148315 0.00912447 0.0116212 0.0132416 0.0141214 0.0145395 0.0147186 0.0147897 0.0148172 0.014829 0.0148359 0.00302278 0.00383258 0.00438489 0.00470118 0.00485923 0.00493011 0.00495938 0.00497096 0.00497582 0.00497838 0.00302234 0.00383205 0.00438432 0.00470057 0.00485861 0.0049295 0.00495877 0.00497038 0.00497529 0.00497803 0.00302204 0.00383169 0.00438392 0.00470015 0.00485818 0.00492907 0.00495835 0.00496998 0.00497494 0.00497774 0.00302187 0.00383149 0.00438369 0.00469992 0.00485795 0.00492884 0.00495813 0.00496978 0.00497476 0.00497758 0.00302183 0.00383145 0.00438365 0.00469988 0.00485791 0.00492881 0.00495812 0.00496977 0.00497476 0.0049776 0.00302193 0.00383158 0.00438381 0.00470006 0.0048581 0.00492901 0.00495832 0.00496999 0.00497498 0.00497782 0.00302218 0.00383191 0.0043842 0.00470048 0.00485855 0.00492947 0.00495879 0.00497046 0.00497547 0.00497831 0.00302262 0.00383247 0.00438486 0.00470121 0.00485932 0.00493025 0.00495959 0.00497127 0.00497627 0.00497912 0.00302329 0.00383334 0.00438587 0.00470231 0.00486047 0.00493144 0.00496079 0.00497247 0.00497748 0.00498033 0.00302423 0.00383456 0.0043873 0.00470387 0.0048621 0.0049331 0.00496247 0.00497416 0.00497918 0.00498204 0.000962413 0.00121473 0.00139351 0.00150039 0.00155613 0.00158215 0.0015933 0.00159784 0.00159977 0.00160077 0.000962263 0.00121456 0.00139331 0.00150018 0.00155592 0.00158194 0.00159309 0.00159764 0.00159959 0.00160065 0.000962159 0.00121443 0.00139317 0.00150004 0.00155577 0.0015818 0.00159295 0.00159751 0.00159947 0.00160055 0.000962102 0.00121436 0.0013931 0.00149996 0.00155569 0.00158172 0.00159287 0.00159744 0.00159941 0.0016005 0.00096209 0.00121435 0.00139309 0.00149995 0.00155569 0.00158171 0.00159287 0.00159744 0.00159942 0.00160051 0.000962128 0.0012144 0.00139315 0.00150002 0.00155576 0.00158179 0.00159295 0.00159752 0.0015995 0.00160059 0.000962221 0.00121452 0.00139329 0.00150017 0.00155592 0.00158196 0.00159312 0.00159769 0.00159968 0.00160077 0.000962382 0.00121473 0.00139353 0.00150044 0.0015562 0.00158224 0.00159341 0.00159799 0.00159997 0.00160107 0.000962625 0.00121504 0.00139389 0.00150084 0.00155662 0.00158268 0.00159385 0.00159843 0.00160041 0.00160151 0.000962969 0.00121548 0.00139441 0.0015014 0.00155721 0.00158328 0.00159446 0.00159905 0.00160103 0.00160214 0.000295343 0.000370366 0.000425396 0.000459541 0.000478019 0.000486956 0.000490909 0.000492567 0.000493281 0.000493647 0.000295294 0.000370308 0.000425332 0.000459474 0.000477951 0.000486887 0.000490841 0.000492501 0.000493223 0.000493609 0.00029526 0.000370269 0.000425288 0.000459428 0.000477903 0.000486839 0.000490795 0.000492458 0.000493184 0.000493578 0.000295241 0.000370247 0.000425264 0.000459402 0.000477878 0.000486814 0.000490771 0.000492436 0.000493165 0.000493561 0.000295238 0.000370243 0.000425261 0.0004594 0.000477876 0.000486814 0.000490771 0.000492437 0.000493168 0.000493565 0.000295251 0.000370261 0.000425282 0.000459423 0.000477901 0.00048684 0.000490798 0.000492465 0.000493197 0.000493595 0.000295284 0.000370302 0.000425331 0.000459477 0.000477958 0.000486899 0.000490858 0.000492526 0.000493259 0.000493657 0.00029534 0.000370374 0.000425414 0.000459569 0.000478055 0.000486998 0.00049096 0.000492628 0.000493361 0.00049376 0.000295425 0.000370482 0.00042554 0.000459708 0.000478201 0.000487149 0.000491112 0.000492782 0.000493516 0.000493915 0.000295544 0.000370634 0.000425718 0.000459903 0.000478407 0.00048736 0.000491326 0.000492997 0.000493732 0.000494133 8.94095e-05 0.000109123 0.000124975 0.00013528 0.000141062 0.000143951 0.000145268 0.000145835 0.000146083 0.00014621 8.93937e-05 0.000109105 0.000124956 0.000135259 0.000141041 0.00014393 0.000145246 0.000145814 0.000146065 0.000146198 8.93829e-05 0.000109092 0.000124942 0.000135245 0.000141026 0.000143915 0.000145232 0.0001458 0.000146053 0.000146188 8.93769e-05 0.000109085 0.000124934 0.000135237 0.000141018 0.000143907 0.000145225 0.000145794 0.000146047 0.000146183 8.93761e-05 0.000109085 0.000124934 0.000135237 0.000141018 0.000143907 0.000145225 0.000145795 0.000146048 0.000146185 8.93808e-05 0.000109091 0.000124941 0.000135244 0.000141027 0.000143916 0.000145234 0.000145804 0.000146058 0.000146195 8.9392e-05 0.000109104 0.000124957 0.000135262 0.000141046 0.000143936 0.000145255 0.000145824 0.000146079 0.000146216 8.94113e-05 0.000109128 0.000124985 0.000135293 0.000141078 0.000143969 0.000145288 0.000145858 0.000146113 0.00014625 8.94403e-05 0.000109164 0.000125026 0.000135339 0.000141126 0.000144019 0.000145339 0.000145909 0.000146164 0.000146301 8.9481e-05 0.000109214 0.000125085 0.000135403 0.000141194 0.000144089 0.00014541 0.000145981 0.000146236 0.000146374 373.033 373.033 373.032 373.032 373.032 373.032 373.032 373.032 373.033 373.033 373.033 373.032 373.032 373.031 373.031 373.031 373.031 373.032 373.032 373.032 373.032 373.032 373.031 373.031 373.031 373.031 373.031 373.031 373.032 373.032 373.032 373.031 373.031 373.031 373.031 373.031 373.031 373.031 373.031 373.032 373.032 373.031 373.031 373.031 373.031 373.031 373.031 373.031 373.031 373.032 373.032 373.031 373.031 373.031 373.031 373.031 373.031 373.031 373.031 373.032 373.032 373.031 373.031 373.031 373.031 373.031 373.031 373.031 373.031 373.032 373.032 373.032 373.031 373.031 373.031 373.031 373.031 373.031 373.032 373.032 373.033 373.032 373.032 373.031 373.031 373.031 373.031 373.032 373.032 373.032 373.033 373.032 373.032 373.032 373.032 373.032 373.032 373.032 373.032 373.033 282.797 282.796 282.795 282.794 282.794 282.794 282.794 282.794 282.795 282.796 282.796 282.794 282.793 282.792 282.792 282.792 282.792 282.793 282.794 282.795 282.795 282.793 282.792 282.791 282.791 282.791 282.791 282.792 282.793 282.794 282.794 282.792 282.791 282.791 282.79 282.79 282.791 282.791 282.792 282.793 282.794 282.792 282.791 282.79 282.79 282.79 282.791 282.791 282.792 282.793 282.794 282.792 282.791 282.79 282.79 282.79 282.791 282.791 282.792 282.793 282.794 282.792 282.791 282.791 282.791 282.791 282.791 282.792 282.792 282.794 282.794 282.793 282.792 282.791 282.791 282.791 282.792 282.792 282.793 282.794 282.795 282.794 282.793 282.792 282.792 282.792 282.792 282.793 282.794 282.795 282.796 282.795 282.794 282.793 282.793 282.793 282.794 282.794 282.795 282.796 202.776 202.774 202.773 202.772 202.771 202.772 202.772 202.773 202.774 202.775 202.774 202.772 202.771 202.77 202.769 202.769 202.77 202.771 202.772 202.774 202.773 202.771 202.769 202.768 202.768 202.768 202.769 202.769 202.771 202.772 202.772 202.77 202.768 202.768 202.767 202.767 202.768 202.769 202.77 202.772 202.771 202.769 202.768 202.767 202.767 202.767 202.767 202.768 202.77 202.772 202.771 202.769 202.768 202.767 202.767 202.767 202.768 202.769 202.77 202.772 202.772 202.77 202.769 202.768 202.767 202.768 202.768 202.769 202.77 202.772 202.773 202.771 202.769 202.769 202.768 202.769 202.769 202.77 202.771 202.773 202.774 202.772 202.771 202.77 202.77 202.77 202.77 202.771 202.773 202.775 202.775 202.774 202.772 202.772 202.772 202.772 202.772 202.773 202.775 202.777 137.21 137.208 137.206 137.206 137.205 137.205 137.206 137.207 137.208 137.209 137.208 137.206 137.204 137.203 137.203 137.203 137.204 137.205 137.206 137.208 137.206 137.204 137.203 137.202 137.202 137.202 137.202 137.203 137.205 137.207 137.205 137.203 137.202 137.201 137.201 137.201 137.202 137.203 137.204 137.206 137.205 137.203 137.202 137.201 137.2 137.201 137.201 137.202 137.204 137.206 137.205 137.203 137.202 137.201 137.201 137.201 137.201 137.202 137.204 137.206 137.206 137.204 137.202 137.201 137.201 137.201 137.202 137.203 137.205 137.207 137.207 137.205 137.203 137.203 137.202 137.202 137.203 137.204 137.206 137.208 137.208 137.206 137.205 137.204 137.204 137.204 137.205 137.206 137.207 137.21 137.209 137.208 137.207 137.206 137.206 137.206 137.207 137.208 137.21 137.212 87.5008 87.499 87.4978 87.4971 87.4969 87.497 87.4975 87.4983 87.4996 87.5012 87.4989 87.4971 87.4959 87.4953 87.495 87.4951 87.4956 87.4966 87.498 87.5 87.4976 87.4958 87.4947 87.494 87.4937 87.4939 87.4944 87.4954 87.4969 87.4991 87.4968 87.495 87.4939 87.4932 87.493 87.4931 87.4937 87.4947 87.4963 87.4985 87.4965 87.4947 87.4936 87.4929 87.4927 87.4929 87.4934 87.4945 87.4961 87.4983 87.4966 87.4948 87.4937 87.493 87.4928 87.493 87.4936 87.4947 87.4963 87.4985 87.497 87.4953 87.4942 87.4936 87.4934 87.4936 87.4942 87.4953 87.4969 87.4992 87.4979 87.4962 87.4952 87.4946 87.4945 87.4947 87.4953 87.4964 87.498 87.5003 87.4992 87.4977 87.4967 87.4962 87.4961 87.4963 87.4969 87.498 87.4997 87.5019 87.5008 87.4997 87.4989 87.4984 87.4983 87.4985 87.4992 87.5003 87.5019 87.5042 52.5628 52.5617 52.5611 52.5608 52.5607 52.5609 52.5613 52.5621 52.5633 52.5647 52.5613 52.5602 52.5596 52.5593 52.5592 52.5594 52.5599 52.5607 52.562 52.5637 52.5603 52.5592 52.5586 52.5583 52.5582 52.5584 52.5589 52.5598 52.5612 52.563 52.5597 52.5586 52.558 52.5577 52.5576 52.5579 52.5584 52.5593 52.5607 52.5626 52.5595 52.5583 52.5578 52.5575 52.5574 52.5577 52.5582 52.5591 52.5605 52.5625 52.5595 52.5584 52.5579 52.5576 52.5576 52.5578 52.5584 52.5593 52.5607 52.5627 52.56 52.5589 52.5583 52.5581 52.5581 52.5583 52.5589 52.5598 52.5613 52.5632 52.5607 52.5597 52.5592 52.559 52.559 52.5592 52.5598 52.5608 52.5622 52.5642 52.5619 52.561 52.5605 52.5604 52.5604 52.5607 52.5612 52.5622 52.5636 52.5656 52.5633 52.5627 52.5624 52.5623 52.5623 52.5626 52.5632 52.5642 52.5656 52.5676 29.746 29.7462 29.7469 29.7474 29.7477 29.748 29.7484 29.7491 29.75 29.7511 29.745 29.7452 29.7458 29.7463 29.7466 29.7469 29.7474 29.7481 29.7491 29.7505 29.7443 29.7445 29.7451 29.7456 29.7459 29.7463 29.7467 29.7474 29.7485 29.75 29.7438 29.7441 29.7447 29.7452 29.7455 29.7459 29.7463 29.7471 29.7482 29.7497 29.7437 29.7439 29.7445 29.745 29.7454 29.7457 29.7462 29.747 29.7481 29.7496 29.7438 29.744 29.7446 29.7451 29.7455 29.7458 29.7463 29.7471 29.7482 29.7497 29.7441 29.7443 29.745 29.7455 29.7459 29.7463 29.7468 29.7475 29.7486 29.7502 29.7447 29.745 29.7457 29.7462 29.7466 29.747 29.7475 29.7483 29.7494 29.7509 29.7456 29.746 29.7467 29.7473 29.7477 29.7481 29.7486 29.7494 29.7505 29.752 29.7467 29.7474 29.7482 29.7488 29.7492 29.7496 29.7501 29.7509 29.752 29.7536 15.8621 15.8659 15.8697 15.872 15.8731 15.8737 15.8741 15.8747 15.8753 15.8761 15.8614 15.8652 15.869 15.8713 15.8724 15.873 15.8735 15.874 15.8747 15.8757 15.8609 15.8648 15.8686 15.8709 15.872 15.8726 15.8731 15.8736 15.8744 15.8754 15.8606 15.8645 15.8683 15.8706 15.8717 15.8723 15.8728 15.8734 15.8742 15.8752 15.8605 15.8644 15.8682 15.8705 15.8716 15.8723 15.8727 15.8733 15.8741 15.8752 15.8606 15.8645 15.8683 15.8706 15.8717 15.8724 15.8728 15.8734 15.8742 15.8753 15.8609 15.8647 15.8686 15.8709 15.872 15.8726 15.8731 15.8737 15.8745 15.8756 15.8613 15.8652 15.869 15.8714 15.8725 15.8732 15.8737 15.8743 15.8751 15.8761 15.8619 15.8659 15.8698 15.8721 15.8733 15.8739 15.8744 15.875 15.8758 15.8769 15.8628 15.8669 15.8708 15.8732 15.8744 15.875 15.8755 15.8761 15.8769 15.878 7.95544 7.97175 7.98414 7.99049 7.99323 7.99435 7.9949 7.99531 7.99577 7.99632 7.95504 7.97135 7.98375 7.99009 7.99283 7.99396 7.99451 7.99494 7.99543 7.99609 7.95477 7.97108 7.98347 7.98982 7.99256 7.99369 7.99425 7.99469 7.99521 7.9959 7.95461 7.97092 7.98332 7.98966 7.99241 7.99354 7.99411 7.99456 7.99509 7.9958 7.95455 7.97087 7.98326 7.98961 7.99236 7.9935 7.99407 7.99453 7.99507 7.99578 7.9546 7.97092 7.98332 7.98967 7.99242 7.99357 7.99414 7.9946 7.99515 7.99586 7.95476 7.97109 7.9835 7.98986 7.99261 7.99376 7.99433 7.9948 7.99535 7.99606 7.95505 7.97139 7.98381 7.99018 7.99294 7.99409 7.99467 7.99514 7.99569 7.9964 7.95546 7.97184 7.98429 7.99067 7.99344 7.9946 7.99518 7.99565 7.9962 7.99691 7.956 7.97248 7.98497 7.99136 7.99414 7.9953 7.99588 7.99635 7.9969 7.99762 3.68615 3.74902 3.78327 3.79752 3.80284 3.80473 3.80545 3.80582 3.80613 3.80648 3.68595 3.74882 3.78306 3.79731 3.80263 3.80453 3.80525 3.80562 3.80595 3.80637 3.6858 3.74867 3.78291 3.79716 3.80248 3.80438 3.8051 3.80549 3.80583 3.80627 3.68572 3.74858 3.78283 3.79707 3.8024 3.8043 3.80502 3.80541 3.80577 3.80621 3.68569 3.74855 3.7828 3.79705 3.80237 3.80428 3.80501 3.8054 3.80576 3.8062 3.68572 3.74859 3.78284 3.79709 3.80241 3.80432 3.80505 3.80545 3.80581 3.80625 3.68581 3.74869 3.78294 3.7972 3.80253 3.80443 3.80517 3.80556 3.80592 3.80637 3.68598 3.74886 3.78313 3.79739 3.80272 3.80463 3.80537 3.80576 3.80613 3.80657 3.68622 3.74913 3.78341 3.79768 3.80302 3.80493 3.80567 3.80607 3.80643 3.80688 3.68655 3.74952 3.78382 3.79811 3.80345 3.80536 3.8061 3.8065 3.80686 3.80731 1.09036e-05 1.08961e-05 1.08775e-05 1.08318e-05 1.07251e-05 1.04953e-05 1.00484e-05 9.28239e-06 8.17848e-06 7.03148e-06 1.09019e-05 1.08945e-05 1.08759e-05 1.08302e-05 1.07235e-05 1.04938e-05 1.0047e-05 9.28114e-06 8.17745e-06 7.03077e-06 1.09008e-05 1.08934e-05 1.08748e-05 1.08291e-05 1.07224e-05 1.04928e-05 1.00461e-05 9.28036e-06 8.1768e-06 7.03027e-06 1.09003e-05 1.08929e-05 1.08743e-05 1.08286e-05 1.0722e-05 1.04924e-05 1.00457e-05 9.28003e-06 8.17654e-06 7.03007e-06 1.09004e-05 1.0893e-05 1.08744e-05 1.08287e-05 1.07221e-05 1.04925e-05 1.00459e-05 9.28021e-06 8.17672e-06 7.03025e-06 1.09012e-05 1.08938e-05 1.08752e-05 1.08296e-05 1.0723e-05 1.04934e-05 1.00467e-05 9.28099e-06 8.17743e-06 7.03088e-06 1.09029e-05 1.08955e-05 1.0877e-05 1.08313e-05 1.07247e-05 1.04951e-05 1.00484e-05 9.28255e-06 8.17883e-06 7.03211e-06 1.09056e-05 1.08983e-05 1.08798e-05 1.08342e-05 1.07276e-05 1.04979e-05 1.00511e-05 9.2851e-06 8.1811e-06 7.03411e-06 1.09095e-05 1.09024e-05 1.0884e-05 1.08385e-05 1.07319e-05 1.05021e-05 1.00552e-05 9.28886e-06 8.18447e-06 7.03705e-06 1.09147e-05 1.09081e-05 1.08899e-05 1.08444e-05 1.07378e-05 1.05079e-05 1.00607e-05 9.29405e-06 8.18908e-06 7.04107e-06 2.99088e-06 2.98856e-06 2.98279e-06 2.96885e-06 2.93708e-06 2.87048e-06 2.74496e-06 2.53847e-06 2.25942e-06 2.00358e-06 2.99039e-06 2.98808e-06 2.98231e-06 2.96838e-06 2.93662e-06 2.87004e-06 2.74455e-06 2.53811e-06 2.25912e-06 2.00339e-06 2.99007e-06 2.98777e-06 2.982e-06 2.96808e-06 2.93632e-06 2.86976e-06 2.74429e-06 2.53788e-06 2.25894e-06 2.00325e-06 2.98993e-06 2.98762e-06 2.98186e-06 2.96794e-06 2.93619e-06 2.86964e-06 2.74419e-06 2.53779e-06 2.25887e-06 2.00319e-06 2.98997e-06 2.98766e-06 2.9819e-06 2.96799e-06 2.93624e-06 2.86969e-06 2.74424e-06 2.53785e-06 2.25893e-06 2.00325e-06 2.99021e-06 2.98791e-06 2.98216e-06 2.96825e-06 2.93651e-06 2.86995e-06 2.7445e-06 2.53809e-06 2.25915e-06 2.00345e-06 2.99072e-06 2.98843e-06 2.98269e-06 2.96878e-06 2.93704e-06 2.87048e-06 2.74501e-06 2.53857e-06 2.25957e-06 2.00384e-06 2.99154e-06 2.98927e-06 2.98355e-06 2.96965e-06 2.93791e-06 2.87134e-06 2.74583e-06 2.53934e-06 2.26027e-06 2.00447e-06 2.99274e-06 2.99052e-06 2.98483e-06 2.97095e-06 2.93921e-06 2.87261e-06 2.74706e-06 2.54048e-06 2.2613e-06 2.00539e-06 2.99432e-06 2.99226e-06 2.98662e-06 2.97275e-06 2.94099e-06 2.87436e-06 2.74874e-06 2.54205e-06 2.26271e-06 2.00665e-06 7.9104e-07 7.90356e-07 7.88655e-07 7.8462e-07 7.75623e-07 7.57242e-07 7.23646e-07 6.70527e-07 6.02732e-07 5.45925e-07 7.90904e-07 7.90222e-07 7.88522e-07 7.84489e-07 7.75495e-07 7.57119e-07 7.23533e-07 6.70427e-07 6.02649e-07 5.45874e-07 7.90817e-07 7.90135e-07 7.88437e-07 7.84405e-07 7.75413e-07 7.57042e-07 7.23462e-07 6.70365e-07 6.02598e-07 5.45835e-07 7.90778e-07 7.90097e-07 7.88399e-07 7.84369e-07 7.75379e-07 7.5701e-07 7.23433e-07 6.70341e-07 6.02579e-07 5.45821e-07 7.90791e-07 7.9011e-07 7.88414e-07 7.84384e-07 7.75395e-07 7.57028e-07 7.23452e-07 6.7036e-07 6.02598e-07 5.45839e-07 7.90864e-07 7.90185e-07 7.8849e-07 7.84462e-07 7.75473e-07 7.57105e-07 7.23527e-07 6.70431e-07 6.02664e-07 5.459e-07 7.91013e-07 7.90336e-07 7.88643e-07 7.84617e-07 7.75629e-07 7.57258e-07 7.23675e-07 6.70569e-07 6.0279e-07 5.46017e-07 7.91254e-07 7.90582e-07 7.88895e-07 7.84872e-07 7.75883e-07 7.57509e-07 7.23915e-07 6.70794e-07 6.02995e-07 5.46205e-07 7.91604e-07 7.90947e-07 7.89269e-07 7.8525e-07 7.7626e-07 7.57878e-07 7.2427e-07 6.71126e-07 6.03296e-07 5.46481e-07 7.92065e-07 7.91452e-07 7.89788e-07 7.85772e-07 7.76779e-07 7.58387e-07 7.24758e-07 6.71581e-07 6.03708e-07 5.46857e-07 2.01968e-07 2.01775e-07 2.01298e-07 2.00184e-07 1.97753e-07 1.92907e-07 1.84305e-07 1.71198e-07 1.55272e-07 1.42786e-07 2.01932e-07 2.01739e-07 2.01262e-07 2.00149e-07 1.97719e-07 1.92874e-07 1.84275e-07 1.71171e-07 1.55249e-07 1.42772e-07 2.01909e-07 2.01716e-07 2.0124e-07 2.00127e-07 1.97697e-07 1.92854e-07 1.84256e-07 1.71154e-07 1.55236e-07 1.42762e-07 2.01899e-07 2.01706e-07 2.0123e-07 2.00118e-07 1.97688e-07 1.92846e-07 1.84249e-07 1.71148e-07 1.55231e-07 1.42758e-07 2.01903e-07 2.01711e-07 2.01235e-07 2.00122e-07 1.97693e-07 1.92851e-07 1.84254e-07 1.71154e-07 1.55237e-07 1.42764e-07 2.01924e-07 2.01732e-07 2.01256e-07 2.00144e-07 1.97716e-07 1.92873e-07 1.84276e-07 1.71174e-07 1.55256e-07 1.42782e-07 2.01966e-07 2.01774e-07 2.01299e-07 2.00188e-07 1.97759e-07 1.92916e-07 1.84317e-07 1.71213e-07 1.55291e-07 1.42815e-07 2.02033e-07 2.01844e-07 2.0137e-07 2.00259e-07 1.97831e-07 1.92986e-07 1.84384e-07 1.71276e-07 1.55349e-07 1.42869e-07 2.02132e-07 2.01946e-07 2.01475e-07 2.00365e-07 1.97936e-07 1.93089e-07 1.84484e-07 1.71369e-07 1.55434e-07 1.42948e-07 2.02261e-07 2.02087e-07 2.0162e-07 2.00511e-07 1.98081e-07 1.93231e-07 1.8462e-07 1.71496e-07 1.5555e-07 1.43056e-07 4.98358e-08 4.97837e-08 4.96557e-08 4.93618e-08 4.87331e-08 4.75089e-08 4.53951e-08 4.22804e-08 3.86514e-08 3.5946e-08 4.98264e-08 4.97744e-08 4.96465e-08 4.93527e-08 4.87243e-08 4.75005e-08 4.53873e-08 4.22735e-08 3.86456e-08 3.59426e-08 4.98204e-08 4.97685e-08 4.96407e-08 4.9347e-08 4.87187e-08 4.74952e-08 4.53825e-08 4.22693e-08 3.86422e-08 3.594e-08 4.98179e-08 4.9766e-08 4.96382e-08 4.93447e-08 4.87165e-08 4.74932e-08 4.53807e-08 4.22678e-08 3.8641e-08 3.59391e-08 4.98192e-08 4.97673e-08 4.96396e-08 4.93461e-08 4.8718e-08 4.74948e-08 4.53823e-08 4.22694e-08 3.86427e-08 3.59408e-08 4.98249e-08 4.97731e-08 4.96455e-08 4.93521e-08 4.87241e-08 4.75008e-08 4.53881e-08 4.2275e-08 3.86478e-08 3.59457e-08 4.98362e-08 4.97846e-08 4.96572e-08 4.9364e-08 4.87359e-08 4.75124e-08 4.53993e-08 4.22855e-08 3.86576e-08 3.59549e-08 4.98545e-08 4.98034e-08 4.96763e-08 4.93832e-08 4.8755e-08 4.75312e-08 4.54174e-08 4.23025e-08 3.86733e-08 3.59697e-08 4.98811e-08 4.98309e-08 4.97045e-08 4.94117e-08 4.87834e-08 4.7559e-08 4.54441e-08 4.23275e-08 3.86964e-08 3.59913e-08 4.99161e-08 4.98691e-08 4.97436e-08 4.9451e-08 4.88224e-08 4.75971e-08 4.54806e-08 4.23617e-08 3.87279e-08 3.60208e-08 1.1897e-08 1.18835e-08 1.18506e-08 1.17763e-08 1.16203e-08 1.13232e-08 1.08232e-08 1.01084e-08 9.3048e-09 8.72868e-09 1.18946e-08 1.18812e-08 1.18483e-08 1.1774e-08 1.16181e-08 1.13211e-08 1.08212e-08 1.01067e-08 9.30336e-09 8.72784e-09 1.18931e-08 1.18797e-08 1.18469e-08 1.17726e-08 1.16167e-08 1.13198e-08 1.08201e-08 1.01057e-08 9.3025e-09 8.7272e-09 1.18925e-08 1.18791e-08 1.18463e-08 1.1772e-08 1.16162e-08 1.13193e-08 1.08196e-08 1.01053e-08 9.30225e-09 8.72702e-09 1.18929e-08 1.18795e-08 1.18467e-08 1.17724e-08 1.16166e-08 1.13197e-08 1.08201e-08 1.01058e-08 9.3027e-09 8.72747e-09 1.18944e-08 1.1881e-08 1.18482e-08 1.1774e-08 1.16182e-08 1.13213e-08 1.08216e-08 1.01072e-08 9.30406e-09 8.72878e-09 1.18974e-08 1.1884e-08 1.18513e-08 1.17771e-08 1.16213e-08 1.13243e-08 1.08245e-08 1.011e-08 9.30663e-09 8.73121e-09 1.19021e-08 1.18889e-08 1.18562e-08 1.17821e-08 1.16262e-08 1.13292e-08 1.08292e-08 1.01144e-08 9.31075e-09 8.73511e-09 1.19091e-08 1.18961e-08 1.18636e-08 1.17895e-08 1.16336e-08 1.13364e-08 1.08361e-08 1.01209e-08 9.31678e-09 8.74082e-09 1.19182e-08 1.1906e-08 1.18737e-08 1.17997e-08 1.16437e-08 1.13463e-08 1.08456e-08 1.01298e-08 9.32501e-09 8.74859e-09 2.75052e-09 2.74717e-09 2.73906e-09 2.72099e-09 2.68377e-09 2.61434e-09 2.50023e-09 2.34149e-09 2.16834e-09 2.04801e-09 2.74996e-09 2.74662e-09 2.73851e-09 2.72045e-09 2.68324e-09 2.61383e-09 2.49976e-09 2.34107e-09 2.16799e-09 2.04781e-09 2.7496e-09 2.74627e-09 2.73816e-09 2.72011e-09 2.68291e-09 2.61353e-09 2.49948e-09 2.34082e-09 2.16778e-09 2.04766e-09 2.74946e-09 2.74613e-09 2.73803e-09 2.71998e-09 2.68279e-09 2.61342e-09 2.49938e-09 2.34074e-09 2.16773e-09 2.04762e-09 2.74956e-09 2.74623e-09 2.73813e-09 2.72009e-09 2.68291e-09 2.61353e-09 2.4995e-09 2.34086e-09 2.16785e-09 2.04774e-09 2.74995e-09 2.74662e-09 2.73853e-09 2.72049e-09 2.68331e-09 2.61393e-09 2.49989e-09 2.34123e-09 2.1682e-09 2.04807e-09 2.75069e-09 2.74738e-09 2.7393e-09 2.72127e-09 2.68408e-09 2.61469e-09 2.50062e-09 2.34192e-09 2.16885e-09 2.0487e-09 2.75189e-09 2.7486e-09 2.74054e-09 2.72252e-09 2.68533e-09 2.61591e-09 2.5018e-09 2.34304e-09 2.16989e-09 2.04969e-09 2.75363e-09 2.7504e-09 2.74238e-09 2.72437e-09 2.68717e-09 2.61771e-09 2.50353e-09 2.34467e-09 2.17141e-09 2.05113e-09 2.75593e-09 2.75289e-09 2.74492e-09 2.72693e-09 2.6897e-09 2.62019e-09 2.5059e-09 2.3469e-09 2.17349e-09 2.05311e-09 6.16647e-10 6.15846e-10 6.13919e-10 6.0969e-10 6.01127e-10 5.85465e-10 5.60282e-10 5.26089e-10 4.89755e-10 4.65136e-10 6.16515e-10 6.15716e-10 6.1379e-10 6.09564e-10 6.01004e-10 5.85348e-10 5.60173e-10 5.25991e-10 4.89673e-10 4.6509e-10 6.16433e-10 6.15635e-10 6.13711e-10 6.09486e-10 6.00929e-10 5.85276e-10 5.60107e-10 5.25934e-10 4.89626e-10 4.65055e-10 6.16402e-10 6.15604e-10 6.13681e-10 6.09457e-10 6.00902e-10 5.85252e-10 5.60086e-10 5.25917e-10 4.89614e-10 4.65048e-10 6.16428e-10 6.15631e-10 6.13708e-10 6.09485e-10 6.00931e-10 5.85282e-10 5.60116e-10 5.25948e-10 4.89645e-10 4.65078e-10 6.16522e-10 6.15726e-10 6.13805e-10 6.09583e-10 6.01029e-10 5.85379e-10 5.60211e-10 5.26038e-10 4.8973e-10 4.65161e-10 6.16704e-10 6.1591e-10 6.13992e-10 6.09772e-10 6.01217e-10 5.85563e-10 5.60389e-10 5.26207e-10 4.89889e-10 4.65314e-10 6.16996e-10 6.16207e-10 6.14294e-10 6.10076e-10 6.0152e-10 5.8586e-10 5.60674e-10 5.26477e-10 4.90144e-10 4.65557e-10 6.17417e-10 6.16644e-10 6.14739e-10 6.10524e-10 6.01965e-10 5.86296e-10 5.61094e-10 5.26873e-10 4.90515e-10 4.65912e-10 6.17976e-10 6.17247e-10 6.15356e-10 6.11142e-10 6.02577e-10 5.86894e-10 5.61668e-10 5.27414e-10 4.91021e-10 4.66395e-10 1.35204e-10 1.35017e-10 1.34572e-10 1.33609e-10 1.31692e-10 1.28249e-10 1.22827e-10 1.15625e-10 1.08146e-10 1.03185e-10 1.35174e-10 1.34987e-10 1.34543e-10 1.3358e-10 1.31664e-10 1.28223e-10 1.22802e-10 1.15603e-10 1.08127e-10 1.03175e-10 1.35155e-10 1.34969e-10 1.34525e-10 1.33563e-10 1.31647e-10 1.28206e-10 1.22787e-10 1.1559e-10 1.08117e-10 1.03167e-10 1.35148e-10 1.34963e-10 1.34518e-10 1.33557e-10 1.31641e-10 1.28201e-10 1.22782e-10 1.15586e-10 1.08114e-10 1.03166e-10 1.35155e-10 1.34969e-10 1.34525e-10 1.33564e-10 1.31648e-10 1.28209e-10 1.2279e-10 1.15594e-10 1.08122e-10 1.03173e-10 1.35178e-10 1.34992e-10 1.34548e-10 1.33587e-10 1.31672e-10 1.28232e-10 1.22812e-10 1.15616e-10 1.08143e-10 1.03193e-10 1.35221e-10 1.35036e-10 1.34593e-10 1.33632e-10 1.31716e-10 1.28276e-10 1.22855e-10 1.15656e-10 1.08181e-10 1.0323e-10 1.3529e-10 1.35106e-10 1.34664e-10 1.33704e-10 1.31788e-10 1.28346e-10 1.22922e-10 1.1572e-10 1.08241e-10 1.03288e-10 1.3539e-10 1.3521e-10 1.3477e-10 1.3381e-10 1.31893e-10 1.28449e-10 1.23021e-10 1.15814e-10 1.08329e-10 1.03373e-10 1.35522e-10 1.35352e-10 1.34915e-10 1.33955e-10 1.32037e-10 1.2859e-10 1.23157e-10 1.15942e-10 1.0845e-10 1.03488e-10 3.41204e-11 3.40708e-11 3.39526e-11 3.37007e-11 3.32078e-11 3.23398e-11 3.10008e-11 2.92614e-11 2.74943e-11 2.63446e-11 3.41128e-11 3.40633e-11 3.39452e-11 3.36934e-11 3.32007e-11 3.23331e-11 3.09945e-11 2.92558e-11 2.74896e-11 2.63421e-11 3.41081e-11 3.40586e-11 3.39406e-11 3.36889e-11 3.31963e-11 3.23289e-11 3.09907e-11 2.92524e-11 2.74869e-11 2.63401e-11 3.41064e-11 3.40569e-11 3.3939e-11 3.36873e-11 3.31949e-11 3.23276e-11 3.09896e-11 2.92516e-11 2.74863e-11 2.63399e-11 3.41083e-11 3.40588e-11 3.3941e-11 3.36894e-11 3.3197e-11 3.23298e-11 3.09918e-11 2.92538e-11 2.74885e-11 2.63421e-11 3.41146e-11 3.40652e-11 3.39474e-11 3.36959e-11 3.32035e-11 3.23362e-11 3.0998e-11 2.92598e-11 2.74942e-11 2.63476e-11 3.41265e-11 3.40772e-11 3.39596e-11 3.37082e-11 3.32157e-11 3.23482e-11 3.10096e-11 2.92708e-11 2.75047e-11 2.63578e-11 3.41455e-11 3.40965e-11 3.39792e-11 3.37279e-11 3.32353e-11 3.23674e-11 3.10281e-11 2.92884e-11 2.75214e-11 2.63739e-11 3.41727e-11 3.41247e-11 3.40079e-11 3.37567e-11 3.32639e-11 3.23954e-11 3.10551e-11 2.9314e-11 2.75456e-11 2.63971e-11 3.42077e-11 3.41624e-11 3.40464e-11 3.37953e-11 3.33022e-11 3.24328e-11 3.1091e-11 2.93481e-11 2.75777e-11 2.64281e-11 2.67979e-05 3.11838e-05 3.54045e-05 3.83348e-05 4.00465e-05 4.09293e-05 4.13432e-05 4.15258e-05 4.16072e-05 4.16487e-05 2.67929e-05 3.11783e-05 3.53985e-05 3.83285e-05 4.004e-05 4.09228e-05 4.13367e-05 4.15196e-05 4.16017e-05 4.16452e-05 2.67895e-05 3.11746e-05 3.53945e-05 3.83242e-05 4.00356e-05 4.09184e-05 4.13325e-05 4.15156e-05 4.15982e-05 4.16424e-05 2.67877e-05 3.11725e-05 3.53923e-05 3.83219e-05 4.00333e-05 4.09162e-05 4.13303e-05 4.15136e-05 4.15965e-05 4.1641e-05 2.67875e-05 3.11724e-05 3.53922e-05 3.83219e-05 4.00334e-05 4.09163e-05 4.13306e-05 4.1514e-05 4.1597e-05 4.16416e-05 2.67892e-05 3.11743e-05 3.53945e-05 3.83244e-05 4.00361e-05 4.09192e-05 4.13335e-05 4.1517e-05 4.16002e-05 4.16448e-05 2.6793e-05 3.11788e-05 3.53996e-05 3.83301e-05 4.00421e-05 4.09254e-05 4.13399e-05 4.15235e-05 4.16067e-05 4.16514e-05 2.67994e-05 3.11864e-05 3.54083e-05 3.83397e-05 4.00523e-05 4.09359e-05 4.13506e-05 4.15343e-05 4.16176e-05 4.16623e-05 2.68091e-05 3.11978e-05 3.54216e-05 3.83542e-05 4.00676e-05 4.09517e-05 4.13667e-05 4.15505e-05 4.16339e-05 4.16787e-05 2.68221e-05 3.12139e-05 3.54401e-05 3.83746e-05 4.00891e-05 4.09738e-05 4.13891e-05 4.15731e-05 4.16566e-05 4.17015e-05 7.63507e-06 8.61372e-06 9.68085e-06 1.04709e-05 1.09519e-05 1.12079e-05 1.13312e-05 1.13869e-05 1.14122e-05 1.14251e-05 7.63361e-06 8.61213e-06 9.67913e-06 1.04691e-05 1.095e-05 1.1206e-05 1.13293e-05 1.13851e-05 1.14106e-05 1.14241e-05 7.63261e-06 8.61105e-06 9.67795e-06 1.04679e-05 1.09487e-05 1.12048e-05 1.13281e-05 1.1384e-05 1.14096e-05 1.14233e-05 7.63207e-06 8.61047e-06 9.67734e-06 1.04672e-05 1.09481e-05 1.12041e-05 1.13275e-05 1.13834e-05 1.14091e-05 1.14229e-05 7.63204e-06 8.61045e-06 9.67733e-06 1.04673e-05 1.09481e-05 1.12042e-05 1.13276e-05 1.13836e-05 1.14093e-05 1.14231e-05 7.63257e-06 8.61106e-06 9.67804e-06 1.04681e-05 1.0949e-05 1.12051e-05 1.13285e-05 1.13845e-05 1.14103e-05 1.14241e-05 7.63379e-06 8.61244e-06 9.67961e-06 1.04698e-05 1.09508e-05 1.1207e-05 1.13305e-05 1.13865e-05 1.14123e-05 1.14262e-05 7.63584e-06 8.61478e-06 9.68227e-06 1.04727e-05 1.09539e-05 1.12102e-05 1.13337e-05 1.13898e-05 1.14156e-05 1.14295e-05 7.63888e-06 8.61829e-06 9.68629e-06 1.04771e-05 1.09586e-05 1.1215e-05 1.13386e-05 1.13947e-05 1.14206e-05 1.14344e-05 7.64292e-06 8.62318e-06 9.69189e-06 1.04832e-05 1.09651e-05 1.12217e-05 1.13454e-05 1.14016e-05 1.14274e-05 1.14414e-05 2.08003e-06 2.29747e-06 2.55681e-06 2.76011e-06 2.88889e-06 2.95959e-06 2.99454e-06 3.01069e-06 3.01816e-06 3.02199e-06 2.07962e-06 2.29703e-06 2.55633e-06 2.75961e-06 2.88837e-06 2.95907e-06 2.99403e-06 3.0102e-06 3.01772e-06 3.02172e-06 2.07933e-06 2.29672e-06 2.556e-06 2.75927e-06 2.88803e-06 2.95872e-06 2.99369e-06 3.00988e-06 3.01744e-06 3.0215e-06 2.07918e-06 2.29657e-06 2.55584e-06 2.7591e-06 2.88785e-06 2.95855e-06 2.99353e-06 3.00974e-06 3.01732e-06 3.0214e-06 2.07918e-06 2.29657e-06 2.55584e-06 2.75911e-06 2.88787e-06 2.95858e-06 2.99356e-06 3.00978e-06 3.01738e-06 3.02147e-06 2.07935e-06 2.29675e-06 2.55605e-06 2.75935e-06 2.88812e-06 2.95885e-06 2.99384e-06 3.01006e-06 3.01767e-06 3.02177e-06 2.07971e-06 2.29716e-06 2.55652e-06 2.75985e-06 2.88866e-06 2.9594e-06 2.99441e-06 3.01064e-06 3.01825e-06 3.02235e-06 2.08033e-06 2.29785e-06 2.55729e-06 2.7607e-06 2.88956e-06 2.96034e-06 2.99536e-06 3.0116e-06 3.01922e-06 3.02332e-06 2.08124e-06 2.29889e-06 2.55846e-06 2.76198e-06 2.89091e-06 2.96173e-06 2.99678e-06 3.01304e-06 3.02066e-06 3.02477e-06 2.08245e-06 2.30032e-06 2.5601e-06 2.76377e-06 2.8928e-06 2.96368e-06 2.99876e-06 3.01503e-06 3.02267e-06 3.0268e-06 5.43921e-07 5.91758e-07 6.52703e-07 7.0289e-07 7.35876e-07 7.54528e-07 7.63982e-07 7.68448e-07 7.7055e-07 7.71638e-07 5.43808e-07 5.91638e-07 6.52575e-07 7.02755e-07 7.35738e-07 7.54389e-07 7.63844e-07 7.68316e-07 7.70433e-07 7.71567e-07 5.43731e-07 5.91557e-07 6.52489e-07 7.02665e-07 7.35645e-07 7.54297e-07 7.63755e-07 7.68232e-07 7.7036e-07 7.71509e-07 5.43692e-07 5.91515e-07 6.52445e-07 7.0262e-07 7.356e-07 7.54253e-07 7.63713e-07 7.68195e-07 7.70328e-07 7.71483e-07 5.43693e-07 5.91518e-07 6.52449e-07 7.02626e-07 7.35608e-07 7.54263e-07 7.63725e-07 7.6821e-07 7.70347e-07 7.71504e-07 5.43741e-07 5.91571e-07 6.5251e-07 7.02693e-07 7.3568e-07 7.54338e-07 7.63803e-07 7.6829e-07 7.70429e-07 7.71588e-07 5.43848e-07 5.91688e-07 6.5264e-07 7.02835e-07 7.35831e-07 7.54495e-07 7.63964e-07 7.68453e-07 7.70594e-07 7.71754e-07 5.44025e-07 5.91883e-07 6.52858e-07 7.03073e-07 7.36083e-07 7.54756e-07 7.6423e-07 7.68722e-07 7.70865e-07 7.72026e-07 5.44286e-07 5.92176e-07 6.53187e-07 7.03431e-07 7.36462e-07 7.55147e-07 7.64628e-07 7.69124e-07 7.7127e-07 7.72433e-07 5.44632e-07 5.92582e-07 6.53645e-07 7.0393e-07 7.36989e-07 7.55691e-07 7.65181e-07 7.69683e-07 7.71832e-07 7.72999e-07 1.369e-07 1.47277e-07 1.61172e-07 1.73103e-07 1.81213e-07 1.85928e-07 1.88376e-07 1.89557e-07 1.90123e-07 1.90418e-07 1.36871e-07 1.47246e-07 1.61139e-07 1.73068e-07 1.81177e-07 1.85892e-07 1.8834e-07 1.89523e-07 1.90093e-07 1.904e-07 1.36851e-07 1.47225e-07 1.61117e-07 1.73045e-07 1.81154e-07 1.85869e-07 1.88317e-07 1.89501e-07 1.90074e-07 1.90385e-07 1.36841e-07 1.47215e-07 1.61106e-07 1.73034e-07 1.81142e-07 1.85858e-07 1.88307e-07 1.89492e-07 1.90066e-07 1.90379e-07 1.36841e-07 1.47216e-07 1.61108e-07 1.73036e-07 1.81145e-07 1.85861e-07 1.88311e-07 1.89497e-07 1.90072e-07 1.90386e-07 1.36855e-07 1.47231e-07 1.61124e-07 1.73054e-07 1.81165e-07 1.85881e-07 1.88332e-07 1.89519e-07 1.90094e-07 1.90408e-07 1.36885e-07 1.47263e-07 1.6116e-07 1.73093e-07 1.81206e-07 1.85924e-07 1.88376e-07 1.89563e-07 1.90139e-07 1.90453e-07 1.36933e-07 1.47316e-07 1.61219e-07 1.73157e-07 1.81274e-07 1.85994e-07 1.88447e-07 1.89636e-07 1.90212e-07 1.90527e-07 1.37005e-07 1.47396e-07 1.61308e-07 1.73253e-07 1.81376e-07 1.861e-07 1.88555e-07 1.89744e-07 1.90321e-07 1.90637e-07 1.371e-07 1.47506e-07 1.61431e-07 1.73388e-07 1.81517e-07 1.86246e-07 1.88704e-07 1.89894e-07 1.90473e-07 1.90789e-07 3.32349e-08 3.5448e-08 3.8527e-08 4.12661e-08 4.31855e-08 4.43307e-08 4.49388e-08 4.52384e-08 4.53843e-08 4.54614e-08 3.32275e-08 3.54402e-08 3.85187e-08 4.12575e-08 4.31766e-08 4.43218e-08 4.493e-08 4.52299e-08 4.53769e-08 4.5457e-08 3.32225e-08 3.5435e-08 3.85132e-08 4.12517e-08 4.31708e-08 4.4316e-08 4.49244e-08 4.52246e-08 4.53723e-08 4.54534e-08 3.322e-08 3.54324e-08 3.85106e-08 4.1249e-08 4.31681e-08 4.43133e-08 4.49219e-08 4.52224e-08 4.53705e-08 4.5452e-08 3.32204e-08 3.54328e-08 3.85111e-08 4.12497e-08 4.31689e-08 4.43143e-08 4.4923e-08 4.52237e-08 4.5372e-08 4.54537e-08 3.3224e-08 3.54368e-08 3.85155e-08 4.12545e-08 4.31741e-08 4.43197e-08 4.49286e-08 4.52295e-08 4.5378e-08 4.54597e-08 3.32319e-08 3.54452e-08 3.85248e-08 4.12646e-08 4.31847e-08 4.43308e-08 4.494e-08 4.5241e-08 4.53896e-08 4.54714e-08 3.32448e-08 3.54593e-08 3.85402e-08 4.12813e-08 4.32024e-08 4.43491e-08 4.49587e-08 4.52599e-08 4.54087e-08 4.54906e-08 3.32638e-08 3.54801e-08 3.85634e-08 4.13064e-08 4.32289e-08 4.43765e-08 4.49865e-08 4.52881e-08 4.5437e-08 4.55191e-08 3.3289e-08 3.55091e-08 3.85956e-08 4.13413e-08 4.32657e-08 4.44145e-08 4.50252e-08 4.53272e-08 4.54763e-08 4.55587e-08 7.79583e-09 8.25884e-09 8.92273e-09 9.53144e-09 9.96975e-09 1.02376e-08 1.0383e-08 1.04559e-08 1.04921e-08 1.05115e-08 7.79403e-09 8.25696e-09 8.92074e-09 9.52937e-09 9.96763e-09 1.02355e-08 1.03808e-08 1.04539e-08 1.04904e-08 1.05104e-08 7.79282e-09 8.2557e-09 8.91942e-09 9.528e-09 9.96623e-09 1.02341e-08 1.03795e-08 1.04526e-08 1.04893e-08 1.05096e-08 7.79223e-09 8.2551e-09 8.9188e-09 9.52736e-09 9.9656e-09 1.02335e-08 1.03789e-08 1.04521e-08 1.04888e-08 1.05093e-08 7.79234e-09 8.25523e-09 8.91896e-09 9.52756e-09 9.96584e-09 1.02338e-08 1.03792e-08 1.04525e-08 1.04893e-08 1.05097e-08 7.7933e-09 8.25625e-09 8.92009e-09 9.52879e-09 9.96715e-09 1.02351e-08 1.03807e-08 1.0454e-08 1.04908e-08 1.05112e-08 7.7953e-09 8.2584e-09 8.92243e-09 9.53133e-09 9.96984e-09 1.02379e-08 1.03835e-08 1.04569e-08 1.04937e-08 1.05142e-08 7.79861e-09 8.26195e-09 8.92633e-09 9.53554e-09 9.97428e-09 1.02425e-08 1.03882e-08 1.04616e-08 1.04985e-08 1.0519e-08 7.80344e-09 8.26723e-09 8.93214e-09 9.54182e-09 9.98091e-09 1.02494e-08 1.03952e-08 1.04687e-08 1.05056e-08 1.05262e-08 7.80986e-09 8.27457e-09 8.94024e-09 9.55056e-09 9.99012e-09 1.02589e-08 1.04049e-08 1.04785e-08 1.05155e-08 1.05361e-08 1.77006e-09 1.86497e-09 2.00441e-09 2.13561e-09 2.23241e-09 2.2929e-09 2.32638e-09 2.34352e-09 2.35216e-09 2.35684e-09 1.76963e-09 1.86454e-09 2.00395e-09 2.13513e-09 2.23192e-09 2.2924e-09 2.32589e-09 2.34305e-09 2.35175e-09 2.35659e-09 1.76935e-09 1.86424e-09 2.00364e-09 2.13481e-09 2.23159e-09 2.29208e-09 2.32558e-09 2.34275e-09 2.35149e-09 2.3564e-09 1.76922e-09 1.8641e-09 2.0035e-09 2.13467e-09 2.23145e-09 2.29194e-09 2.32545e-09 2.34264e-09 2.3514e-09 2.35633e-09 1.76925e-09 1.86414e-09 2.00355e-09 2.13472e-09 2.23152e-09 2.29201e-09 2.32553e-09 2.34274e-09 2.35151e-09 2.35645e-09 1.76949e-09 1.8644e-09 2.00383e-09 2.13502e-09 2.23184e-09 2.29235e-09 2.32588e-09 2.3431e-09 2.35188e-09 2.35682e-09 1.76998e-09 1.86492e-09 2.0044e-09 2.13564e-09 2.23249e-09 2.29303e-09 2.32658e-09 2.3438e-09 2.35259e-09 2.35754e-09 1.7708e-09 1.86579e-09 2.00535e-09 2.13666e-09 2.23357e-09 2.29415e-09 2.32772e-09 2.34496e-09 2.35376e-09 2.35871e-09 1.77199e-09 1.86709e-09 2.00676e-09 2.13819e-09 2.23518e-09 2.29581e-09 2.32941e-09 2.34667e-09 2.35548e-09 2.36045e-09 1.77357e-09 1.86888e-09 2.00873e-09 2.14031e-09 2.23741e-09 2.29811e-09 2.33176e-09 2.34904e-09 2.35787e-09 2.36285e-09 3.9255e-10 4.11719e-10 4.4045e-10 4.68103e-10 4.88964e-10 5.02272e-10 5.09784e-10 5.13698e-10 5.15706e-10 5.16806e-10 3.92452e-10 4.11618e-10 4.40344e-10 4.67992e-10 4.88851e-10 5.02158e-10 5.09671e-10 5.1359e-10 5.15611e-10 5.1675e-10 3.92388e-10 4.11551e-10 4.40274e-10 4.6792e-10 4.88778e-10 5.02085e-10 5.096e-10 5.13524e-10 5.15554e-10 5.16707e-10 3.92358e-10 4.11521e-10 4.40243e-10 4.67889e-10 4.88746e-10 5.02055e-10 5.09572e-10 5.135e-10 5.15535e-10 5.16693e-10 3.92367e-10 4.11531e-10 4.40256e-10 4.67904e-10 4.88763e-10 5.02074e-10 5.09593e-10 5.13524e-10 5.15563e-10 5.16722e-10 3.92426e-10 4.11593e-10 4.40323e-10 4.67976e-10 4.88841e-10 5.02156e-10 5.09677e-10 5.1361e-10 5.15651e-10 5.16812e-10 3.92545e-10 4.11719e-10 4.4046e-10 4.68123e-10 4.88996e-10 5.02317e-10 5.09842e-10 5.13778e-10 5.1582e-10 5.16983e-10 3.9274e-10 4.11927e-10 4.40685e-10 4.68366e-10 4.89252e-10 5.02581e-10 5.10112e-10 5.14051e-10 5.16096e-10 5.1726e-10 3.93025e-10 4.12235e-10 4.41021e-10 4.68727e-10 4.89632e-10 5.02974e-10 5.10513e-10 5.14457e-10 5.16505e-10 5.17671e-10 3.93403e-10 4.12662e-10 4.41487e-10 4.69227e-10 4.90158e-10 5.03517e-10 5.11067e-10 5.15016e-10 5.17068e-10 5.18239e-10 1.0019e-10 1.04643e-10 1.1144e-10 1.18126e-10 1.23282e-10 1.26642e-10 1.28576e-10 1.29605e-10 1.30141e-10 1.30435e-10 1.00165e-10 1.04618e-10 1.11413e-10 1.18098e-10 1.23253e-10 1.26613e-10 1.28548e-10 1.29577e-10 1.30117e-10 1.30422e-10 1.00149e-10 1.046e-10 1.11395e-10 1.18079e-10 1.23234e-10 1.26594e-10 1.2853e-10 1.2956e-10 1.30103e-10 1.30411e-10 1.00141e-10 1.04593e-10 1.11388e-10 1.18071e-10 1.23226e-10 1.26586e-10 1.28523e-10 1.29554e-10 1.30098e-10 1.30408e-10 1.00144e-10 1.04596e-10 1.11392e-10 1.18076e-10 1.23232e-10 1.26592e-10 1.28529e-10 1.29562e-10 1.30106e-10 1.30416e-10 1.00161e-10 1.04613e-10 1.1141e-10 1.18096e-10 1.23253e-10 1.26615e-10 1.28553e-10 1.29586e-10 1.30131e-10 1.30441e-10 1.00194e-10 1.04648e-10 1.11448e-10 1.18137e-10 1.23296e-10 1.26659e-10 1.28598e-10 1.29632e-10 1.30177e-10 1.30488e-10 1.00248e-10 1.04706e-10 1.1151e-10 1.18203e-10 1.23366e-10 1.26731e-10 1.28672e-10 1.29707e-10 1.30253e-10 1.30564e-10 1.00326e-10 1.0479e-10 1.11602e-10 1.18301e-10 1.23469e-10 1.26838e-10 1.28781e-10 1.29817e-10 1.30364e-10 1.30676e-10 1.00428e-10 1.04904e-10 1.11726e-10 1.18434e-10 1.23609e-10 1.26982e-10 1.28928e-10 1.29965e-10 1.30513e-10 1.30827e-10 ) ; boundaryField { inlet1 { type fixedValue; value uniform 10; } inlet2 { type fixedValue; value uniform 20; } outlet1 { type zeroGradient; } outlet2 { type zeroGradient; } fixedWalls { type zeroGradient; } } // ************************************************************************* //
[ "elliot.s.tennison@gmail.com" ]
elliot.s.tennison@gmail.com
7723f6b2c21f8414f74b7e9f94152090f3468949
2021a4467ef792337c3975ad26c2f9415544a62f
/Source/Hunter/HT_LoginWidget.cpp
bf3496dc5b6583f2e83d48e76c7bfc143bce0880
[]
no_license
blackCatx/Unreal-Portfolio
72f01c09753b79c8c69a2a5e713f161d60f497b3
a9ac90e00e2c06c0f2cc24c1ee7c921b5d4bad4e
refs/heads/master
2020-08-03T07:17:06.689709
2018-04-26T09:25:35
2018-04-26T09:25:35
null
0
0
null
null
null
null
UHC
C++
false
false
2,200
cpp
// Fill out your copyright notice in the Description page of Project Settings. #include "Hunter.h" #include "HT_LoginWidget.h" #include "HT_GameInstance.h" #include "EditableTextBox.h" #include "HT_LoginThread.h" #include "HT_MessageBoxWidget.h" #include "Runtime/Sockets/Public/Sockets.h" void UHT_LoginWidget::OnLoginButton() { UEditableTextBox* ID_Input = Cast<UEditableTextBox>(this->GetWidgetFromName("ID_Input")); UEditableTextBox* PW_Input = Cast<UEditableTextBox>(this->GetWidgetFromName("PW_Input")); FString ID = ID_Input->GetText().ToString(); FString PW = PW_Input->GetText().ToString(); UHT_GameInstance* GameInstance = Cast<UHT_GameInstance>(GetWorld()->GetGameInstance()); if (ID.Len() > 0 && PW.Len() > 0) { GameInstance->Init_Network(ID, PW); IsLoginChaking = true; } else if (ID.Len() == 0) { UHT_MessageBoxWidget* NewWidget = CreateWidget<UHT_MessageBoxWidget>(GetWorld(), GameInstance->MessageBoxWidgetClass); NewWidget->SetMessageText(TEXT("ID를 입력하세요.")); NewWidget->AddToViewport(); } else if (PW.Len() == 0) { UHT_MessageBoxWidget* NewWidget = CreateWidget<UHT_MessageBoxWidget>(GetWorld(), GameInstance->MessageBoxWidgetClass); NewWidget->SetMessageText(TEXT("PW를 입력하세요.")); NewWidget->AddToViewport(); } } void UHT_LoginWidget::OnCencelButton() { //FHT_LoginThread::JoyInit()->Shutdown(); } void UHT_LoginWidget::NativeTick(const FGeometry& MyGeometry, float InDeltaTime) { if (IsLoginChaking) { if (FHT_LoginThread::GetInstance()->IsComplete) { UHT_GameInstance* GameInstance = Cast<UHT_GameInstance>(GetWorld()->GetGameInstance()); UHT_MessageBoxWidget* NewWidget = CreateWidget<UHT_MessageBoxWidget>(GetWorld(), GameInstance->MessageBoxWidgetClass); if (FHT_LoginThread::GetInstance()->IsSuccess) { NewWidget->SetMessageText(TEXT("인증 성공!")); NewWidget->IsLogin = true; } else { NewWidget->SetMessageText(TEXT("인증 실패!")); //인증 실패 NewWidget->IsLogin = false; GameInstance->ChattingSocket->Close(); GameInstance->ChattingSocket = NULL; } NewWidget->AddToViewport(); FHT_LoginThread::GetInstance()->Shutdown(); } } }
[ "iso5930@naver.com" ]
iso5930@naver.com
2ae89233c0bd79c6b87c010f5d190709a049f1ea
6fd9a785cd59f1673e2bb13e6308dfee7dd5141e
/c++stl/myvec.cpp
34648b522b17a25046d5ca1eb441e49583bd3aba
[]
no_license
debnathsinha/scratch
d68fb3e8a3fdf8c19dfb86a37a7c64e6919739d0
2154061d3e926b52cfd9ffdbb6761ba6ff6bd64e
refs/heads/master
2021-01-01T17:04:43.211081
2013-07-11T18:06:02
2013-07-11T18:06:02
1,557,888
0
0
null
null
null
null
UTF-8
C++
false
false
424
cpp
#include <iostream> #include <vector> #include <list> int main() { std::cout << "Hello World" << std::endl; const int N = 3; std::vector<int> region1(N); std::list<int> region2; region2.push_back(1); region2.push_back(0); region2.push_back(3); std::copy(region2.begin(), region2.end(), region1.begin()); for( int i = 0; i < N; i++ ) std::cout << region1[i] << " "; std::cout << std::endl; }
[ "debnathsinha@gmail.com" ]
debnathsinha@gmail.com
bfce13612e490827ab03e3a6eb732b6eb08efb07
64c395a9925516d909b20df3f322ae92877a73b4
/src/projects/error_correction/error_correction.hpp
db1b9734e8560e33f7b91d02424918f87a6f6f59
[ "BSD-3-Clause" ]
permissive
AntonBankevich/DR
8fbef7455c34d18e7501e92b49f5b916b266abdd
057795fdb75c3b8fe4984845dc9e0ddb2f3dd765
refs/heads/master
2022-02-09T22:37:26.179203
2022-02-01T18:53:52
2022-02-01T18:53:52
248,891,874
3
0
NOASSERTION
2020-12-21T05:35:26
2020-03-21T02:23:55
C++
UTF-8
C++
false
false
16,374
hpp
// // Created by anton on 8/26/20. // #pragma once #include "dbg/sparse_dbg.hpp" #include "common/hash_utils.hpp" #include "common/output_utils.hpp" #include "common/simple_computation.hpp" #include <queue> #include <functional> namespace error_correction { inline std::ostream& operator<<(std::ostream& out, const unsigned __int128& item) { std::vector<char> res; unsigned __int128 tmp = item; while(tmp != 0) { res.push_back(char((tmp % 10) + '0')); tmp /= 10; } return out << std::string(res.rbegin(), res.rend()); } struct State { State() = default; State(size_t lastMatch, size_t diff, Vertex *graphPosition, bool match) : last_match(lastMatch), diff(diff), graph_position(graphPosition), match(match) {} size_t last_match; size_t diff; Vertex *graph_position; bool match; bool operator==(const State &other) const { return last_match == other.last_match && diff == other.diff && graph_position == other.graph_position && match == other.match; } size_t hash() const { return std::hash<size_t>()(last_match) ^ std::hash<size_t>()(diff) ^ std::hash<void *>()(graph_position) ^ std::hash<bool>()(match); } }; std::ostream& operator<<(std::ostream& out, const State & item) { return out << "(" << item.last_match << " " << item.diff << " " << item.graph_position->hash() << " " << item.match << ")"; } } namespace std { template <> struct hash<error_correction::State> { std::size_t operator()(const error_correction::State &state) const { return std::hash<size_t>()(state.last_match) ^ std::hash<size_t>()(state.diff) ^ std::hash<void *>()(state.graph_position) ^ std::hash<bool>()(state.match); } }; } namespace error_correction { struct ResRecord { ResRecord(ResRecord *prev, Edge *lastEdge, bool goodmatch) : prev(prev), last_edge(lastEdge), good_match(goodmatch) {} ResRecord *prev; Edge *last_edge; bool good_match; }; struct ScoredState { State state; ResRecord resRecord; size_t score; ScoredState(const State &state, const ResRecord &resRecord, size_t score) : state(state), resRecord(resRecord), score(score) {} bool operator<(const ScoredState &other) const { return score > other.score; } }; struct CorrectionResult { CorrectionResult(const Path &path, size_t score, size_t iterations) : path(path), score(score), iterations( iterations) {} Path path; size_t score; size_t iterations; }; struct ScoreScheme { size_t cov_threshold = 8; size_t alternative_penalty = 2; size_t diff_penalty = 20; size_t max_diff = 10; size_t low_coverage_penalty = 10; size_t very_bad_coverage = 3; size_t very_bad_covereage_penalty = 50; size_t high_coverage_penalty = 50; size_t match_to_freeze = 100; size_t scoreMatchingEdge(const Edge &edge) const { if (edge.getCoverage() <= very_bad_coverage) { return very_bad_covereage_penalty * edge.size(); } else if (edge.getCoverage() < cov_threshold) { return low_coverage_penalty * edge.size(); } else { return 0; } } size_t scoreAlternativeEdge(const Edge &edge) const { if (edge.getCoverage() <= very_bad_coverage) { return (very_bad_covereage_penalty + alternative_penalty) * edge.size(); } else if (edge.getCoverage() < cov_threshold) { return (low_coverage_penalty + alternative_penalty) * edge.size(); } else { return alternative_penalty * edge.size(); } } size_t scoreRemovedEdge(const Edge &edge) const { if (edge.getCoverage() > cov_threshold) { return high_coverage_penalty * edge.size(); } else { return 0; } } }; std::vector<Edge*> restoreResult(const std::unordered_map<State, ResRecord> stateMap, ResRecord *resRecord) { std::vector<Edge*> res; while(resRecord->prev != nullptr) { if (resRecord->last_edge != nullptr) { res.push_back(resRecord->last_edge); } resRecord = resRecord->prev; } return {res.rbegin(), res.rend()}; } size_t checkPerfect(const std::unordered_map<State, ResRecord> stateMap, ResRecord *resRecord, size_t length) { size_t len = 0; size_t cnt = 0; while(resRecord->prev != nullptr) { if (!resRecord->good_match) { return size_t(-1); } len += resRecord->last_edge->size(); cnt += 1; if(len >= length) return cnt; resRecord = resRecord->prev; } return size_t(-1); } CorrectionResult correct(Path & initial_path, ScoreScheme scores = {}) { // std::cout << "New read " << path.size() << std::endl; // for (size_t i = 0; i < path.size(); i++) { // std::cout << " " << path[i].end()->hash() << " " << path[i].getCoverage() << " " << path[i].size(); // } // std::cout << std::endl; size_t from = 0; size_t cut_len_start = 0; size_t to = initial_path.size(); while(from < to && initial_path[from].getCoverage() < scores.cov_threshold && cut_len_start < 1000) { cut_len_start +=initial_path[from].size(); from += 1; } size_t cut_len_end = 0; while(from < to && initial_path[to - 1].getCoverage() < scores.cov_threshold && cut_len_end < 1000) { cut_len_end += initial_path[to - 1].size(); to -= 1; } if (from == to || cut_len_end + cut_len_start > 1500) { // std::cout << "Finished fail " << (size_t(-1) >> 1u) << std::endl; return {initial_path, size_t(-1) >> 1u, size_t(-1) >> 1u}; } Path path = initial_path.subPath(from, to); std::priority_queue<ScoredState> queue; queue.emplace(State(0, 0, &path.start(), true), ResRecord(nullptr, nullptr, false), 0); std::unordered_map<State, ResRecord> res; size_t cnt = 0; size_t frozen = 0; while(!queue.empty()) { ScoredState next = queue.top(); queue.pop(); if(next.state.last_match == path.size()) { VERIFY(next.state.match); // std::cout << "Finished " << next.score << " " << cnt << std::endl; return {Path(path.start(), restoreResult(res, &next.resRecord)), next.score, cnt}; } // std::cout<< "New state " << next.state << " " << next.score << " " << next.state.graph_position->outDeg(); // for(size_t i = 0; i < next.state.graph_position->outDeg(); i++) { // std::cout << " " << next.state.graph_position->getOutgoing()[i].getCoverage(); // } // if (next.resRecord.last_edge != nullptr) // std::cout << " " << next.resRecord.last_edge->getCoverage() << " " << next.resRecord.last_edge->seq; // std::cout << std::endl; if(res.find(next.state) != res.end() || next.state.last_match < frozen) continue; ResRecord &prev = res.emplace(next.state, next.resRecord).first->second; State &state = next.state; if(next.state.match && !prev.good_match) { size_t perfect_len = 0; size_t right = state.last_match; while(right < path.size() && path[right].getCoverage() >= scores.cov_threshold) { right += 1; } size_t left = right; while(left > state.last_match && perfect_len + path[left - 1].size() < scores.match_to_freeze) { perfect_len += path[left - 1].size(); left -= 1; } if (left > state.last_match) { // std::cout << "Skip to " << left << " " << &path.getVertex(left) << std::endl; frozen = left; ResRecord *prev_ptr = &prev; for(size_t i = state.last_match; i + 1 < left; i++) { prev_ptr = &res.emplace(State(i + 1, 0, &path.getVertex(i + 1), true), ResRecord(prev_ptr, &path[i], true)).first->second; } queue.emplace(State(left, 0, &path.getVertex(left), true), ResRecord(prev_ptr, &path[left - 1], true), next.score); continue; } } if(next.state.match) { queue.emplace(State(next.state.last_match + 1, 0, &path.getVertex(next.state.last_match + 1), true), ResRecord(&prev, &path[next.state.last_match], path[next.state.last_match].getCoverage() > scores.cov_threshold), next.score + scores.scoreMatchingEdge(path[next.state.last_match])); // std::cout << "Add perfect " << next.score + scores.scoreMatchingEdge(path[next.state.last_match]) << std::endl; } else { size_t path_dist = 0; size_t extra_score = 0; for(size_t i = next.state.last_match; i < path.size(); i++) { path_dist += path[i].size(); extra_score += scores.scoreRemovedEdge(path[i]); if(path_dist > next.state.diff + scores.max_diff) { break; } if(path_dist > next.state.diff - scores.max_diff && &path.getVertex(i + 1) == next.state.graph_position) { size_t diff = std::min<size_t>(path_dist - next.state.diff, next.state.diff - path_dist); queue.emplace(State(i + 1, 0, next.state.graph_position, true), ResRecord(&prev, nullptr, false), next.score + extra_score + diff * scores.diff_penalty); // std::cout << "Add back to good " << next.score + extra_score + diff * scores.diff_penalty << std::endl; } } } for(size_t i = 0; i < next.state.graph_position->outDeg(); i++) { Edge &edge = next.state.graph_position->operator[](i); if (!next.state.match || edge.seq != path[next.state.last_match].seq) { queue.emplace(State(next.state.last_match, next.state.diff + edge.size(), edge.end(), false), ResRecord(&prev, &edge, false), next.score + scores.scoreAlternativeEdge(edge)); // std::cout << "Add bad " << next.score + scores.scoreAlternativeEdge(edge) << std::endl; } } cnt += 1; if (cnt >= 100000) { break; } } // std::cout << "Finished fail " << cnt << std::endl; return {initial_path, size_t(-1) >> 1u, cnt}; } template<class Iterator> void correctSequences(SparseDBG &sdbg, logging::Logger &logger, Iterator begin, Iterator end, const std::experimental::filesystem::path& output_file, const std::experimental::filesystem::path& bad_file, size_t threads, const size_t min_read_size) { // threads = 1; // omp_set_num_threads(1); typedef typename Iterator::value_type ContigType; logger.info() << "Starting to correct reads" << std::endl; ParallelRecordCollector<size_t> times(threads); ParallelRecordCollector<size_t> scores(threads); ParallelRecordCollector<Contig> result(threads); ParallelRecordCollector<Contig> prev_result(threads); ParallelRecordCollector<std::pair<Contig, size_t>> bad_reads(threads); std::unordered_map<std::string, size_t> read_order; std::unordered_map<std::string, size_t> prev_read_order; std::ofstream os; os.open(output_file); std::function<void(size_t, ContigType &)> task = [&sdbg, &times, &scores, min_read_size, &result, &bad_reads](size_t num, ContigType & contig) { Sequence seq = contig.makeSequence(); if(seq.size() >= min_read_size) { Path path = GraphAligner(sdbg).align(seq).path(); CorrectionResult res = correct(path); times.emplace_back(res.iterations); scores.emplace_back(res.score); result.emplace_back(res.path.Seq(), contig.id + " " + std::to_string(res.score)); if(res.score > 25000) bad_reads.emplace_back(Contig(contig.makeSequence(), contig.id + " " + std::to_string(res.score)), res.score); } else { result.emplace_back(seq, contig.id + " 0"); } }; ParallelProcessor<StringContig> processor(task, logger, threads); processor.doInOneThread = [&read_order](ContigType & contig) { size_t val = read_order.size(); read_order[split(contig.id)[0]] = val; }; processor.doAfter = [&read_order, &prev_read_order, &result, &prev_result]() { std::swap(read_order, prev_read_order); std::swap(result, prev_result); read_order.clear(); result.clear(); }; processor.doInParallel = [&prev_read_order, &prev_result, &os]() { VERIFY(prev_read_order.size() == prev_result.size()); std::vector<Contig> res(prev_read_order.size()); for(Contig &contig : prev_result) { res[prev_read_order[split(contig.id)[0]]] = std::move(contig); } for(Contig &contig : res) { os << ">" << contig.id << "\n" << contig.seq << "\n"; } }; processor.doInTheEnd = processor.doInParallel; processor.processRecords(begin, end); os.close(); std::vector<size_t> time_hist = histogram(times.begin(), times.end(), 100000, 1000); std::vector<size_t> score_hist = histogram(scores.begin(), scores.end(), 100000, 1000); logger.info() << "Reader corrected" << std::endl; logger.info() << "Iterations" << std::endl; for(size_t i = 0; i < time_hist.size(); i++) { logger << i * 1000 << " " << time_hist[i] << std::endl; } logger.info() << "Scores" << std::endl; for(size_t i = 0; i < score_hist.size(); i++) { logger << i * 1000 << " " << score_hist[i] << std::endl; } logger.info() << "Printed corrected reads to " << output_file << std::endl; logger.info() << "Found " << bad_reads.size() << " bad reads" << std::endl; std::ofstream bados; bados.open(bad_file); for(auto & contig : bad_reads) { bados << ">" << contig.first.id << " " << contig.second << "\n" << contig.first.seq << "\n"; } bados.clear(); logger.info() << "Printed bad reads to " << bad_file << std::endl; } }
[ "anton.bankevich@gmail.com" ]
anton.bankevich@gmail.com
18b3188ebbc7d543c18cfe876526203be2798078
d83ffa98b2a2c4fa96d2ce59f7b986e407437f09
/src/client/net/BinaryClientTransport.h
5acc81d7d5c409b04cb1e45bbeb048bf275e53c1
[]
no_license
maumyrtille/VoxelGameClient
2e01f26f53fada98de6381121ff2a85f469ffc3a
48b91efc443d41e73f2985976d70a9ebf3251978
refs/heads/master
2023-06-19T12:15:42.103194
2021-07-16T20:24:04
2021-07-16T20:24:04
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,246
h
#pragma once #include <vector> #include <mutex> #include <bitsery/bitsery.h> #include <bitsery/adapter/buffer.h> #include <bitsery/traits/string.h> #include "ClientTransport.h" class GameEngine; class BinaryClientTransport: public ClientTransport { VoxelTypeSerializationContext m_voxelTypeSerializationContext; protected: template<typename T> static void deserialize(const std::string &data, T& message) { bitsery::quickDeserialization<bitsery::InputBufferAdapter<std::string>>( {data.begin(), data.size()}, message ); } template<typename T> void serializeAndSendMessage(const T &message) { std::string buffer; auto count = bitsery::quickSerialization<bitsery::OutputBufferAdapter<std::string>>(buffer, message); sendMessage(buffer.data(), count); } void handleMessage(const std::string &payload); virtual void sendMessage(const void *data, size_t dataSize) = 0; using ClientTransport::sendPlayerPosition; void sendPlayerPosition(const glm::vec3 &position, float yaw, float pitch, int viewRadius) override; void sendHello(); public: explicit BinaryClientTransport(GameEngine &engine); void updateActiveInventoryItem(int index) override; void digVoxel() override; void placeVoxel() override; };
[ "kiv.apple@gmail.com" ]
kiv.apple@gmail.com
670743b329dbf67591a8a55085a811a5129960db
45ee32435c345790cae1f10111e37f860395f1ea
/art-extension/runtime/elf_file.h
c3616f7290c6cc6806b0aeb42ec8136e6ff81728
[ "Apache-2.0", "NCSA", "LicenseRef-scancode-unknown-license-reference" ]
permissive
android-art-intel/Nougat
b93eb0bc947088ba55d03e62324af88d332c5e93
ea41b6bfe5c6b62a3163437438b21568cc783a24
refs/heads/master
2020-07-05T18:53:19.370466
2016-12-16T04:23:40
2016-12-16T04:23:40
73,984,816
9
1
null
null
null
null
UTF-8
C++
false
false
3,537
h
/* * Copyright (C) 2012 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. */ #ifndef ART_RUNTIME_ELF_FILE_H_ #define ART_RUNTIME_ELF_FILE_H_ #include <memory> #include <string> #include "base/macros.h" // Explicitly include our own elf.h to avoid Linux and other dependencies. #include "./elf.h" #include "os.h" namespace art { template <typename ElfTypes> class ElfFileImpl; // Explicitly instantiated in elf_file.cc typedef ElfFileImpl<ElfTypes32> ElfFileImpl32; typedef ElfFileImpl<ElfTypes64> ElfFileImpl64; // Used for compile time and runtime for ElfFile access. Because of // the need for use at runtime, cannot directly use LLVM classes such as // ELFObjectFile. class ElfFile { public: static ElfFile* Open(File* file, bool writable, bool program_header_only, bool low_4gb, std::string* error_msg, uint8_t* requested_base = nullptr); // TODO: move arg to before error_msg. // Open with specific mmap flags, Always maps in the whole file, not just the // program header sections. static ElfFile* Open(File* file, int mmap_prot, int mmap_flags, std::string* error_msg); ~ElfFile(); // Load segments into memory based on PT_LOAD program headers bool Load(bool executable, bool low_4gb, std::string* error_msg); const uint8_t* FindDynamicSymbolAddress(const std::string& symbol_name) const; size_t Size() const; // The start of the memory map address range for this ELF file. uint8_t* Begin() const; // The end of the memory map address range for this ELF file. uint8_t* End() const; const File& GetFile() const; bool GetSectionOffsetAndSize(const char* section_name, uint64_t* offset, uint64_t* size) const; bool HasSection(const std::string& name) const; uint64_t FindSymbolAddress(unsigned section_type, const std::string& symbol_name, bool build_map); bool GetLoadedSize(size_t* size, std::string* error_msg) const; // Strip an ELF file of unneeded debugging information. // Returns true on success, false on failure. static bool Strip(File* file, std::string* error_msg); // Fixup an ELF file so that that oat header will be loaded at oat_begin. // Returns true on success, false on failure. static bool Fixup(File* file, uint64_t oat_data_begin); bool Fixup(uint64_t base_address); bool Is64Bit() const { return elf64_.get() != nullptr; } ElfFileImpl32* GetImpl32() const { return elf32_.get(); } ElfFileImpl64* GetImpl64() const { return elf64_.get(); } private: explicit ElfFile(ElfFileImpl32* elf32); explicit ElfFile(ElfFileImpl64* elf64); const std::unique_ptr<ElfFileImpl32> elf32_; const std::unique_ptr<ElfFileImpl64> elf64_; DISALLOW_COPY_AND_ASSIGN(ElfFile); }; } // namespace art #endif // ART_RUNTIME_ELF_FILE_H_
[ "aleksey.v.ignatenko@intel.com" ]
aleksey.v.ignatenko@intel.com
dd5f32f5d2cea9a7fbd39f35c49f9a04c8e5534f
83ac6cbdf70e6ffaed06184e4803377563c3fc88
/condition_parser.h
731991b366a58e76031711d55219645e393a2df2
[]
no_license
jBuly4/Yandex_Art_of_modern_Cpp_developing_Yellow_belt
36405c1a65163042b1d3fd8d2200ff21a21e6dba
f2a1dc5291e5f314b027bee0db37f38e44379e49
refs/heads/main
2023-08-26T14:42:03.119289
2021-10-30T10:15:41
2021-10-30T10:15:41
null
0
0
null
null
null
null
UTF-8
C++
false
false
352
h
// // condition_parser.h // yellow_course_poject // // Created by research on 09.03.2021. // #ifndef condition_parser_h #define condition_parser_h #pragma once #include "node.h" #include <memory> #include <iostream> using namespace std; shared_ptr<Node> ParseCondition(istream& is); void TestParseCondition(); #endif /* condition_parser_h */
[ "ibuly4@gmail.com" ]
ibuly4@gmail.com
144d159ccf554f44b369957c3098264590a36d9b
86a493c7e48bb37fddf081bcd7c8cb0e10e01219
/pattern7.cpp
1207810131087ee9c344d03b46f50e5d8ac74e30
[]
no_license
dsprajput/apnacollege
aa5640ca29df161d66c027c0222d79895df96d74
84128142c9b52549f7c738c3834a906bd12b5654
refs/heads/main
2023-02-07T18:24:38.405214
2020-12-30T09:27:13
2020-12-30T09:27:13
311,663,453
0
0
null
null
null
null
UTF-8
C++
false
false
538
cpp
#include<iostream> using namespace std; int main() { for(int i=0; i<4; i++) { for(int j=0; j<4+i; j++) { if(i+j>=3) { cout<<"*"; } else cout<<" "; } cout<<endl; } for(int i=4; i>0; i--) { for(int j=0; j<=2+i; j++) { if(i+j<4) { cout<<" "; } else cout<<"*"; } cout<<endl; } return 0; }
[ "dsprajput.2801@gmail.com" ]
dsprajput.2801@gmail.com
70f00cbbcd02a64611c42d869a4a7ea7b7aa2884
0eff74b05b60098333ad66cf801bdd93becc9ea4
/second/download/xgboost/xgboost-gumtree/dmlc_xgboost_old_new_new_log_360.cpp
d85b5ca5a79bdc14d8c371888e2013c6630e95f4
[]
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
58
cpp
utils::Assert(rmax >= rmin + wmin, "relation constraint");
[ "993273596@qq.com" ]
993273596@qq.com
db3de6533283136709337fe769321790ca3d218d
5175bd24b43d8db699341997df5fecf21cc7afc1
/libs/leaf/test/accumulate_basic_test.cpp
94b88608b937d8b8c2b46e39011b24efa536bbc9
[ "BSL-1.0", "LicenseRef-scancode-proprietary-license" ]
permissive
quinoacomputing/Boost
59d1dc5ce41f94bbd9575a5f5d7a05e2b0c957bf
8b552d32489ff6a236bc21a5cf2c83a2b933e8f1
refs/heads/master
2023-07-13T08:03:53.949858
2023-06-28T20:18:05
2023-06-28T20:18:05
38,334,936
0
0
BSL-1.0
2018-04-02T14:17:23
2015-06-30T21:50:37
C++
UTF-8
C++
false
false
1,195
cpp
// Copyright (c) 2018-2021 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifdef BOOST_LEAF_TEST_SINGLE_HEADER # include "leaf.hpp" #else # include <boost/leaf/on_error.hpp> # include <boost/leaf/handle_errors.hpp> # include <boost/leaf/result.hpp> #endif #include "lightweight_test.hpp" namespace leaf = boost::leaf; template <int> struct info { int value; }; leaf::error_id g() { auto load = leaf::on_error( [](info<1> & x) {++x.value;} ); return leaf::new_error(); } leaf::error_id f() { auto load = leaf::on_error( [](info<1> & x) {++x.value;}, [](info<2> & x) {++x.value;} ); return g(); } int main() { int r = leaf::try_handle_all( []() -> leaf::result<int> { return f(); }, []( info<1> const & a, info<2> const & b ) { BOOST_TEST_EQ(a.value, 2); BOOST_TEST_EQ(b.value, 1); return 1; }, [] { return 2; } ); BOOST_TEST_EQ(r, 1); return boost::report_errors(); }
[ "apandare@lanl.gov" ]
apandare@lanl.gov
a3b5ad2b5c9750dd4625ffd1115900481b9449cd
68cf71d51d1ec73432eac938d61300b2705bceb2
/src/nstl/hash/testLinearProbingHashTime.cc
6f7dda2ec606a5d7bc0d049bd9f0db2f4e685385
[]
no_license
ciklon-z/v4abs
ed72583475d1a818b830572b074b2fcf938b2a6d
6ef899eafc1f7df98d7d7cf9bf454e907be5a898
refs/heads/master
2021-01-14T08:32:08.419868
2014-09-15T08:27:56
2014-09-15T08:27:56
null
0
0
null
null
null
null
UTF-8
C++
false
false
561
cc
#include "test/UnitTest.h" #include "HashTable.h" #include "Random.h" #include "Config.h" #define DEBUG_EXPR(expr) do { std::cerr << #expr << " : " << (expr) << " @ (" << __FILE__ << " : "<< __LINE__ << ")" << std::endl; } while(0) void test_linear_probing_hash_time() { HashTable<int> hash; // const size_t valSize = 1000; const size_t valSize = kVariableSize; for (size_t i = 0; i < valSize; ++i) hash.insert(Random<int>::get()); UNIT_TEST_FUNCTION_END_FUNCTION_TEST(); } int main() { test_linear_probing_hash_time(); }
[ "chiahsun0814@gmail.com" ]
chiahsun0814@gmail.com
6b49a2c7d2dca92bc2a0e185a6f2f7d10533d3cc
9acaa2118fb9315d0c2ce59db5a51ee1d3f5ed40
/include/Gaffer/Private/IECorePreview/LRUCache.h
cf6e0f85d9481e82fbc8c22bd82adea6ae6a7c6d
[ "BSD-3-Clause" ]
permissive
medubelko/gaffer
9f65e70c29e340e4d0b74c92c878f7b6d234ebdd
12c5994c21dcfb8b13b5b86efbcecdcb29202b33
refs/heads/master
2021-06-07T16:29:54.862429
2020-05-22T11:55:16
2020-05-22T11:55:16
129,820,571
1
0
NOASSERTION
2019-06-14T18:53:40
2018-04-16T23:59:50
C++
UTF-8
C++
false
false
8,459
h
////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2007-2014, Image Engine Design Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // * Neither the name of Image Engine Design nor the names of any // other contributors to this software may be used to endorse or // promote products derived from this software without specific prior // written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // ////////////////////////////////////////////////////////////////////////// #ifndef IECOREPREVIEW_LRUCACHE_H #define IECOREPREVIEW_LRUCACHE_H #include "boost/function.hpp" #include "boost/noncopyable.hpp" #include "boost/variant.hpp" namespace IECorePreview { namespace LRUCachePolicy { /// Not threadsafe. Either use from only a single thread /// or protect with an external mutex. Key type must have /// a `hash_value` implementation as described in the boost /// documentation. template<typename LRUCache> class Serial; /// Threadsafe, `get()` blocks if another thread is already /// computing the value. Key type must have a `hash_value` /// implementation as described in the boost documentation. template<typename LRUCache> class Parallel; /// Threadsafe, `get()` collaborates on TBB tasks if another /// thread is already computing the value. Key type must have /// a `hash_value` implementation as described in the boost /// documentation. /// /// > Note : There is measurable overhead in the task collaboration /// > mechanism, so if it is known that tasks will not be spawned for /// > `GetterFunction( getterKey )` you may define a `bool spawnsTasks( const GetterKey & )` /// > function that will be used to avoid the overhead. template<typename LRUCache> class TaskParallel; } // namespace LRUCachePolicy /// A mapping from keys to values, where values are computed from keys using a user /// supplied function. Recently computed values are stored in the cache to accelerate /// subsequent lookups. Each value has a cost associated with it, and the cache has /// a maximum total cost above which it will remove the least recently accessed items. /// /// The Value type must be default constructible, copy constructible and assignable. /// Note that Values are returned by value, and erased by assigning a default constructed /// value. In practice this means that a smart pointer is the best choice of Value. /// /// The Policy determines the thread safety, eviction and performance characteristics /// of the cache. See the documentation for each individual policy in the LRUCachePolicy /// namespace. /// /// The GetterKey may be used where the GetterFunction requires some auxiliary information /// in addition to the Key. It must be implicitly castable to Key, and all GetterKeys /// which yield the same Key must also yield the same results from the GetterFunction. /// /// \ingroup utilityGroup template<typename Key, typename Value, template <typename> class Policy=LRUCachePolicy::Parallel, typename GetterKey=Key> class LRUCache : private boost::noncopyable { public: typedef size_t Cost; typedef Key KeyType; /// The GetterFunction is responsible for computing the value and cost for a cache entry /// when given the key. It should throw a descriptive exception if it can't get the data for /// any reason. typedef boost::function<Value ( const GetterKey &key, Cost &cost )> GetterFunction; /// The optional RemovalCallback is called whenever an item is discarded from the cache. typedef boost::function<void ( const Key &key, const Value &data )> RemovalCallback; LRUCache( GetterFunction getter ); LRUCache( GetterFunction getter, Cost maxCost ); LRUCache( GetterFunction getter, RemovalCallback removalCallback, Cost maxCost ); virtual ~LRUCache(); /// Retrieves an item from the cache, computing it if necessary. /// The item is returned by value, as it may be removed from the /// cache at any time by operations on another thread, or may not /// even be stored in the cache if it exceeds the maximum cost. /// Throws if the item can not be computed. Value get( const GetterKey &key ); /// Adds an item to the cache directly, bypassing the GetterFunction. /// Returns true for success and false on failure - failure can occur /// if the cost exceeds the maximum cost for the cache. Note that even /// when true is returned, the item may be removed from the cache by a /// subsequent (or concurrent) operation. bool set( const Key &key, const Value &value, Cost cost ); /// Returns true if the object is in the cache. Note that the /// return value may be invalidated immediately by operations performed /// by another thread. bool cached( const Key &key ) const; /// Erases the item if it was cached. Returns true if it was cached /// and false if it wasn't cached and therefore wasn't removed. bool erase( const Key &key ); /// Erases all cached items. Note that when this returns, the cache /// may have been repopulated with items if other threads have called /// set() or get() concurrently. void clear(); /// Sets the maximum cost of the items held in the cache, discarding any /// items if necessary to meet the new limit. void setMaxCost( Cost maxCost ); /// Returns the maximum cost. Cost getMaxCost() const; /// Returns the current cost of all cached items. Cost currentCost() const; private : // Data ////////////////////////////////////////////////////////////////////////// // Give Policy access to CacheEntry definitions. friend class Policy<LRUCache>; // A function for computing values, and one for notifying of removals. GetterFunction m_getter; RemovalCallback m_removalCallback; // Status of each item in the cache. enum Status { Uncached, // entry without valid value Cached, // entry with valid value Failed // m_getter failed when computing entry }; // The type used to store a single cached item. struct CacheEntry { CacheEntry(); // We use a boost::variant to compactly store // a union of the data needed for each Status. // // - Uncached : A boost::blank instance // - Cached : The Value itself // - Failed ; The exception thrown by the GetterFn typedef boost::variant<boost::blank, Value, std::exception_ptr> State; State state; Cost cost; // the cost for this item Status status() const; }; // Policy. This is responsible for // the internal storage for the cache. Policy<LRUCache> m_policy; Cost m_maxCost; // Methods // ======= // Updates the cached value and updates the current // total cost. bool setInternal( const Key &key, CacheEntry &cacheEntry, const Value &value, Cost cost ); // Removes any cached value and updates the current total // cost. bool eraseInternal( const Key &key, CacheEntry &cacheEntry ); // Removes items from the cache until the current cost is // at or below the specified limit. void limitCost( Cost cost ); static void nullRemovalCallback( const Key &key, const Value &value ); }; } // namespace IECorePreview #include "Gaffer/Private/IECorePreview/LRUCache.inl" #endif // IECOREPREVIEW_LRUCACHE_H
[ "thehaddonyoof@gmail.com" ]
thehaddonyoof@gmail.com
d22ee4325cfce2ab6c13b38ec383111e837ffe01
447cd9de29b2455aa097d465088ff132668cf9ce
/riscv_scml/vp/src/platform/multicore/mc_main.cpp
f44b1180510404a377ed67e76ad7d15bdc3ef85c
[ "MIT" ]
permissive
yangdunan/riscv_vp
892a3e216805deb42cb1f8d1c79a588cb860b5c1
5db8f38ee35cb872ed7155299a2b9cab1644da7e
refs/heads/master
2021-04-17T18:31:30.025459
2020-03-25T16:22:27
2020-03-25T16:22:27
249,466,241
0
0
null
null
null
null
UTF-8
C++
false
false
4,681
cpp
#include <cstdlib> #include <ctime> #include "core/common/clint.h" #include "elf_loader.h" #include "iss.h" #include "mem.h" #include "memory.h" #include "syscall.h" #include <boost/io/ios_state.hpp> #include <boost/program_options.hpp> #include <iomanip> #include <iostream> using namespace rv32; struct Options { typedef unsigned int addr_t; Options &check_and_post_process() { return *this; } std::string input_program; addr_t mem_size = 1024 * 1024 * 32; // 32 MB ram, to place it before the CLINT and run the base examples (assume // memory start at zero) without modifications addr_t mem_start_addr = 0x00000000; addr_t mem_end_addr = mem_start_addr + mem_size - 1; addr_t clint_start_addr = 0x02000000; addr_t clint_end_addr = 0x0200ffff; addr_t sys_start_addr = 0x02010000; addr_t sys_end_addr = 0x020103ff; bool use_instr_dmi = false; bool use_data_dmi = false; bool trace_mode = false; unsigned int tlm_global_quantum = 10; }; Options parse_command_line_arguments(int argc, char **argv) { // Note: first check for *help* argument then run *notify*, see: // https://stackoverflow.com/questions/5395503/required-and-optional-arguments-using-boost-library-program-options try { Options opt; namespace po = boost::program_options; po::options_description desc("Options"); // clang-format off desc.add_options() ("help", "produce help message") ("memory-start", po::value<unsigned int>(&opt.mem_start_addr),"set memory start address") ("trace-mode", po::bool_switch(&opt.trace_mode), "enable instruction tracing") ("tlm-global-quantum", po::value<unsigned int>(&opt.tlm_global_quantum), "set global tlm quantum (in NS)") ("use-instr-dmi", po::bool_switch(&opt.use_instr_dmi), "use dmi to fetch instructions") ("use-data-dmi", po::bool_switch(&opt.use_data_dmi), "use dmi to execute load/store operations") ("use-dmi", po::bool_switch(), "use instr and data dmi") ("input-file", po::value<std::string>(&opt.input_program)->required(), "input file to use for execution"); // clang-format on po::positional_options_description pos; pos.add("input-file", 1); po::variables_map vm; po::store(po::command_line_parser(argc, argv).options(desc).positional(pos).run(), vm); if (vm.count("help")) { std::cout << desc << std::endl; exit(0); } po::notify(vm); if (vm["use-dmi"].as<bool>()) { opt.use_data_dmi = true; opt.use_instr_dmi = true; } return opt.check_and_post_process(); } catch (boost::program_options::error &e) { std::cerr << "Error parsing command line options: " << e.what() << std::endl; exit(-1); } } int sc_main(int argc, char **argv) { Options opt = parse_command_line_arguments(argc, argv); std::srand(std::time(nullptr)); // use current time as seed for random generator tlm::tlm_global_quantum::instance().set(sc_core::sc_time(opt.tlm_global_quantum, sc_core::SC_NS)); ISS core0(0); ISS core1(1); CombinedMemoryInterface core0_mem_if("MemoryInterface0", core0); CombinedMemoryInterface core1_mem_if("MemoryInterface1", core1); SimpleMemory mem("SimpleMemory", opt.mem_size); ELFLoader loader(opt.input_program.c_str()); SimpleBus<2, 3> bus("SimpleBus"); SyscallHandler sys("SyscallHandler"); CLINT<2> clint("CLINT"); std::shared_ptr<BusLock> bus_lock = std::make_shared<BusLock>(); core0_mem_if.bus_lock = bus_lock; core1_mem_if.bus_lock = bus_lock; bus.ports[0] = new PortMapping(opt.mem_start_addr, opt.mem_end_addr); bus.ports[1] = new PortMapping(opt.clint_start_addr, opt.clint_end_addr); bus.ports[2] = new PortMapping(opt.sys_start_addr, opt.sys_end_addr); loader.load_executable_image(mem.data, mem.size, opt.mem_start_addr); core0.init(&core0_mem_if, &core0_mem_if, &clint, loader.get_entrypoint(), opt.mem_end_addr - 3); // -3 to not overlap with the next region and stay 32 bit aligned core1.init(&core1_mem_if, &core1_mem_if, &clint, loader.get_entrypoint(), opt.mem_end_addr - 32767); sys.init(mem.data, opt.mem_start_addr, loader.get_heap_addr()); sys.register_core(&core0); sys.register_core(&core1); // connect TLM sockets core0_mem_if.isock.bind(bus.tsocks[0]); core1_mem_if.isock.bind(bus.tsocks[1]); bus.isocks[0].bind(mem.tsock); bus.isocks[1].bind(clint.tsock); bus.isocks[2].bind(sys.tsock); // connect interrupt signals/communication clint.target_harts[0] = &core0; clint.target_harts[1] = &core1; // switch for printing instructions core0.trace = opt.trace_mode; core1.trace = opt.trace_mode; new DirectCoreRunner(core0); new DirectCoreRunner(core1); sc_core::sc_start(); core0.show(); core1.show(); return 0; }
[ "juliany922@gmail.com" ]
juliany922@gmail.com
8adc9b7cf1ec69be388ec6b6ac028251e82e755a
a7e3f6b805cabe1c906fb94430a8aadd9b3eab7c
/BloggerProxyModel.cpp
7fdc19414ca801119e54b6a52842ffd9904cb231
[]
no_license
luisfilipegoncalves/bloggerQml
5d4be3b4d9e01611f20a8f8e6d762028515b4cb0
c5476b03532215c48c8328679df918462ba2644a
refs/heads/master
2020-12-24T15:32:39.051595
2013-11-04T23:28:07
2013-11-04T23:28:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,101
cpp
#include "BloggerProxyModel.h" #include "BlogModel.h" #include "BloggerLoader.h" #include <QDate> #include <QDebug> #include <QUuid> BloggerProxyModel::BloggerProxyModel(QObject *parent) : QSortFilterProxyModel(parent) { } void BloggerProxyModel::search(const QString &text) { setFilterWildcard(text); } bool BloggerProxyModel::tryAddBlog(QString name, QString url, int rating, QString lastDateStr, QString note) { BlogModel *model = qobject_cast<BlogModel*>(sourceModel()); if(!model) return false; qDebug() << "try to add new blog..."; qDebug() << "name: " << name; qDebug() << "url: " << url; qDebug() << "rating: " << rating; qDebug() << "lastDate: " << lastDateStr; qDebug() << "note: " << note; QDate lastDate = QDate::fromString(lastDateStr, "dd-MM-yyyy"); QDate nextdate; if(!lastDate.isNull()) nextdate = BloggerLoader::nextDate(lastDate, rating); QString id = QUuid::createUuid().toString(); model->addBlog(name, url, rating, lastDateStr, nextdate.toString("dd-MM-yyyy"), note, id); return true; } QString BloggerProxyModel::deleteBlog(int row) { qDebug() << "Delete blog row: " << row; QModelIndex sourceIndex = mapToSource(index(row, 0)); QString name = sourceIndex.data(Qt::DisplayRole).toString(); qDebug() << "Delete blog source index: " << sourceIndex << name; bool deleted = sourceModel()->removeRow(sourceIndex.row()); qDebug() << "Deleted ? " << deleted; if(deleted) return name; else return QString(); // false or failled to remove } bool BloggerProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const { QModelIndex index = sourceModel()->index(source_row, 0, source_parent); QString url = index.data(Qt::UserRole+1).toString(); QString note = index.data(Qt::UserRole+5).toString(); QRegExp regE = filterRegExp(); if(url.contains(regE)) return true; else if(note.contains(regE)) return true; return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent); }
[ "exnlesi@gmail.com" ]
exnlesi@gmail.com
5a5e1a5fd44f384b715f4d5b9586cada29845623
f969f027e98c3d5106c423e57ea4fc7d2903a8fb
/AddTwoNumbers.cpp
c59385aec5c0ad6f1359dd4bf9b64a35fb3728cb
[]
no_license
BenQuickDeNN/LeetCodeSolutions
eb2e1e3d2f13621f4d603e26f28a0fce2af75f1b
4165aca74114e9841a312b27ccc4a807a9fd65e5
refs/heads/master
2023-09-04T12:02:24.846562
2021-11-13T03:44:11
2021-11-13T03:44:11
255,344,497
0
0
null
null
null
null
UTF-8
C++
false
false
3,856
cpp
/***************************************************************************************************** * 给出两个 非空 的链表用来表示两个非负的整数。其中,它们各自的位数是按照 逆序 的方式存储的,并且它们的每个节点只能存储 * 一位 数字。 * 如果,我们将这两个数相加起来,则会返回一个新的链表来表示它们的和。 * 您可以假设除了数字 0 之外,这两个数都不会以 0 开头。 * 示例: * ---------------------------------------- * 输入:(2 -> 4 -> 3) + (5 -> 6 -> 4) * 输出:7 -> 0 -> 8 * 原因:342 + 465 = 807 * --------------------------------------- * Algorithm: * 就像你在纸上计算两个数字的和那样,我们首先从最低有效位也就是列表 l1l1l1 和 l2l2l2 的表头开始相加。由于每位数字都应当 * 处于 0…90 \ldots 90…9 的范围内,我们计算两个数字的和时可能会出现 “溢出”。例如,5+7=125 + 7 = 125+7=12。在这种情 * 况下,我们会将当前位的数值设置为 222,并将进位 carry=1carry = 1carry=1 带入下一次迭代。进位 carrycarrycarry 必 * 定是 000 或 111,这是因为两个数字相加(考虑到进位)可能出现的最大和为 9+9+1=199 + 9 + 1 = 199+9+1=19。 * 作者:LeetCode * 链接:https://leetcode-cn.com/problems/add-two-numbers/solution/liang-shu-xiang-jia-by-leetcode/ * 来源:力扣(LeetCode) * 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。 *****************************************************************************************************/ #include <cstdio> /// Definition for singly-linked list. struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(NULL) {} }; class Solution { public: static ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) { if (l1 != NULL && l2 == NULL) return l1; else if (l1 == NULL && l2 != NULL) return l2; else if (l1 == NULL && l2 == NULL) return NULL; bool carry = false; bool flag_l1_end = false; bool flag_l2_end = false; ListNode *l1_sIdx = l1; // recording the address of l1 while (true) { if (carry) // flag_l1_end must be false { if (!flag_l2_end) l1->val += l2->val + 1; else l1->val++; } else { if (!flag_l1_end && !flag_l2_end) l1->val += l2->val; else if (flag_l1_end && !flag_l2_end) l1->next = l2; } if (l1->val < 10) carry = false; else { l1->val %= 10; // carry carry = true; if (l1->next == NULL) l1->next = new ListNode(0); } if (l1->next == NULL && l2->next == NULL) break; if (l1->next != NULL) l1 = l1->next; else flag_l1_end = true; if (l2->next != NULL) l2 = l2->next; else flag_l2_end = true; } return l1_sIdx; } }; int main() { ListNode *p_l1 = new ListNode(0); ListNode *p_l2 = new ListNode(7); //p_l1->next = new ListNode(9); //p_l1->next->next = new ListNode(9); p_l2->next = new ListNode(3); //p_l2->next->next = new ListNode(4); ListNode *result = Solution::addTwoNumbers(p_l1, p_l2); while (true) { printf("%d, ", result->val); if (result->next != NULL) result = result->next; else break; } printf("\r\n"); }
[ "benquickdenn@foxmail.com" ]
benquickdenn@foxmail.com
5329782712fbde3e49a23d45c3b25195b0f0995a
4ba0b403637e7aa3e18c9bafae32034e3c394fe4
/cplusplus/wrencc2/utility.hh
4dd3102f2ccbd03b7bc6bcba741e7a3e592f8af1
[]
no_license
ASMlover/study
3767868ddae63ac996e91b73700d40595dd1450f
1331c8861fcefbef2813a2bdd1ee09c1f1ee46d6
refs/heads/master
2023-09-06T06:45:45.596981
2023-09-01T08:19:49
2023-09-01T08:19:49
7,519,677
23
6
null
null
null
null
UTF-8
C++
false
false
2,833
hh
// Copyright (c) 2019 ASMlover. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // * Redistributions of source code must retain the above copyright // notice, this list ofconditions and the following disclaimer. // // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in // the documentation and/or other materialsprovided with the // distribution. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE // COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. #pragma once #include <functional> #include "common.hh" #include "./container/string.hh" #include "./container/array_list.hh" namespace wrencc { template <typename T> using CompareFn = std::function<bool (const T&, const T&)>; template <typename T> inline bool __compare(const T& x, const T& y) { return x == y; } template <typename T, typename Function = CompareFn<T>> class DynamicTable final : private UnCopyable { Function compare_{}; ArrayList<T> datas_; public: DynamicTable(Function&& fn = __compare<T>) noexcept : compare_(std::move(fn)) { } inline int count() const noexcept { return Xt::as_type<int>(datas_.size()); } inline void clear() noexcept { datas_.clear(); } inline T& operator[](int i) noexcept { return datas_[i]; } inline const T& operator[](int i) const noexcept { return datas_[i]; } inline T& at(int i) noexcept { return datas_[i]; } inline const T& at(int i) const noexcept { return datas_[i]; } inline int append(const T& x) { datas_.append(x); return count() - 1; } inline int ensure(const T& x) { if (int existing = find(x); existing != -1) return existing; return append(x); } inline int find(const T& x) { for (int i = 0; i < count(); ++i) { if (compare_(datas_[i], x)) return i; } return -1; } template <typename Function> inline void for_each(Function&& fn) { datas_.for_each(fn); } }; using SymbolTable = DynamicTable<String>; }
[ "asmlover@126.com" ]
asmlover@126.com
ba234220c3f041b427529742e3ac9f3871cdbe6e
9381784914cff5dcb9d168fde6401757bd4b55f8
/DSU on trees/D. Distance in Tree.cpp
0c40fc2f5a3357ac5e7b895e54e5d9715fa2508c
[]
no_license
AhmedMorgan/morganslib
d4aa4cda2d2a83376910548faa83c5fd334f4005
3322bcfc1f543596e9e8659324bbcdf8a8b66db7
refs/heads/master
2020-08-06T03:01:15.600413
2019-10-04T12:29:40
2019-10-04T12:29:40
212,809,537
0
0
null
null
null
null
UTF-8
C++
false
false
1,876
cpp
#include <bits/stdc++.h> #define ll long long #define mp make_pair #define PI 3.1415926535897932384626433832 #define MOD 1000000007 #define MOD2 1000000009 #define bas 29 #define bas2 19 using namespace std; const int len = 5e4 + 9; int n, k, x, y; vector<int> *vec[len]; int cnt[len * 2]; int cnt1[len * 2]; int lev[len]; int siz[len]; ll res = 0; vector<vector<int> > g(len, vector<int>()); void dfsForLevel(int v, int p, int level){ lev[v] = level; for(auto u: g[v]){ if(u != p) dfsForLevel(u, v, level + 1); } } int dfssz(int v, int p){ int sum = 1; for(auto u : g[v]){ if(u != p) sum += dfssz(u, v); } siz[v] = sum; return sum; } void dfs(int v, int p, bool keep){ int sz = -1, mx = -1; for(auto u : g[v]){ if(u != p && siz[u] > sz){ sz = siz[u]; mx = u; } } for(auto u : g[v]){ if(u != p && u != mx){ dfs(u, v, 0); } } if(mx != -1) dfs(mx, v, 1), vec[v] = vec[mx]; else vec[v] = new vector<int>(); vec[v]->push_back(v); cnt[ lev[v] ]++; for(auto u : g[v]){ if(u == mx || u == p)continue; for(auto x : *vec[u]){ cnt1[ lev[x] ]++; vec[v]->push_back(x); } for(int i = 1; i <= k; i++){ res += cnt[ lev[v] + i ] * cnt1[ lev[v] + k - i ]; } for(auto x : *vec[u]){ cnt1[ lev[x] ]--; cnt[lev[x]]++; } } res += cnt[lev[v] + k]; if(!keep){ for(auto u : *vec[v]){ cnt[ lev[u] ]--; } } } int main(){ scanf("%d%d", &n, &k); for(int i = 1; i < n; i++){ scanf("%d%d", &x, &y); g[x].push_back(y); g[y].push_back(x); } dfsForLevel(1, -1, 0); dfssz(1, -1); dfs(1, -1, 1); printf("%lld", res); }
[ "medo.morgan22@gmail.com" ]
medo.morgan22@gmail.com
682e44a22c19cba9efb45e4d7f48c2f939a1197f
3394ee144825b7875c4294c496274809823900fb
/Album.hpp
c9e59a9e7e747ab61af3babf372c1f8774c5a6c7
[]
no_license
road-cycling/jsonp5
e58941be32ebd94fee51cda3d4299ad68b2e4b7a
9519f4ce7160547c684891d5eb40e806ea1d11c5
refs/heads/master
2021-08-23T03:20:31.146426
2017-12-02T21:25:05
2017-12-02T21:25:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,364
hpp
#ifndef _album_hpp #define _album_hpp //class Tracks; class Artist; #include "JSONDataObject.hpp" #include "AlbumImage.hpp" #include "AlbumImages.hpp" #include "Tracks.hpp" //#include "Artist.hpp" #include <iostream> #include <memory> #include <fstream> #include <algorithm> class Album: public JSONDataObject { public: Album(); ~Album(); std::string title(); std::string genres(); int albumID(); int artistID(); int numImages(); int numTracks(); std::string year(); void setTracks(Tracks *tracks); void setArtist(Artist *artist); Artist *artist() { return _artist; } Tracks *tracks() { return _tracks; } void setAlbumImages(AlbumImages *ai); AlbumImage *&primaryImage() { return _primaryAlbumImage; } AlbumImage *&secondaryImage() { return _secondaryAlbumImage; } void print(); std::string htmlString(); void createFile(); private: std::string _title{""}, _genres{""}, _year{""}; int _albumID{0}, _artistID{0}, _numImages{0}, _numTracks{0}; bool cachedtitle{false}, cachedgenre{false}, cachedyear{false}, cachedalbumid{false}, cachedartistid{false}, cachednumimages{false}, cachednumtracks{false}; AlbumImage *_primaryAlbumImage{nullptr}, *_secondaryAlbumImage{nullptr}; //unused Tracks *_tracks{nullptr}; Artist *_artist{nullptr}; }; #endif
[ "eathotlead@gmail.com" ]
eathotlead@gmail.com
81c80881b40c61f507a904273914b4d675750768
998720baa128c629e00d44482201a0a6b52be1fd
/src/cg/framebuffer_object.h
61d81fef7fcf6186e34f10054cb450c6d5e7b5dd
[]
no_license
hpsoar/axle
b3037fd972f7f387641e0746b0c3938bb7a4a09e
1a88f49e5253d0f48c2882f174b04fd52f2bab70
refs/heads/master
2021-01-20T09:12:33.463095
2013-10-28T14:54:34
2013-10-28T14:54:34
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,522
h
#ifndef AXLE_CG_FRAMEBUFFER_OBJECT_H #define AXLE_CG_FRAMEBUFFER_OBJECT_H #include "../core/settings.h" #include <GL/glew.h> namespace ax { class FramebufferObject { public: FramebufferObject(); ~FramebufferObject(); /// Bind this FBO as current render target void Bind() const; /// Bind a texture to the "attachment" point of this FBO void AttachTexture(GLenum tex_target, GLuint tex_id, GLenum attachment = GL_COLOR_ATTACHMENT0_EXT, int mip_level = 0, int zslice = 0); /// Bind an array of textures to multiple "attachment" points of this FBO /// - By default, the first 'numTextures' attachments are used, /// starting with GL_COLOR_ATTACHMENT0_EXT void AttachTextures(int tex_count, GLenum tex_target[], GLuint tex_id[], GLenum attachment[] = NULL, int mip_level[] = NULL, int zslice[] = NULL); /// Bind a render buffer to the "attachment" point of this FBO void AttachRenderBuffer(GLuint buffId, GLenum attachment = GL_COLOR_ATTACHMENT0_EXT); /// Bind an array of render buffers to corresponding "attachment" points /// of this FBO. /// - By default, the first 'numBuffers' attachments are used, /// starting with GL_COLOR_ATTACHMENT0_EXT void AttachRenderBuffers(int buffer_count, GLuint buffer_id[], GLenum attachment[] = NULL); /// Free any resource bound to the "attachment" point of this FBO void Unattach(GLenum attachment); /// Free any resources bound to any attachment points of this FBO void UnattachAll(); void UnattachAllColorAttachement(); /// BEGIN : Accessors /// Is attached type GL_RENDERBUFFER_EXT or GL_TEXTURE? GLenum GetAttachedType(GLenum attachment); /// What is the Id of Renderbuffer/texture currently /// attached to "attachement?" GLuint GetAttachedId(GLenum attachment); /// Which mipmap level is currently attached to "attachement?" GLint GetAttachedMipLevel(GLenum attachment); /// Which cube face is currently attached to "attachment?" GLint GetAttachedCubeFace(GLenum attachment); /// Which z-slice is currently attached to "attachment?" GLint GetAttachedZSlice(GLenum attachment); /// END : Accessors /// BEGIN : Static methods global to all FBOs /// Return number of color attachments permitted static int GetMaxColorAttachments(); /// Disable all FBO rendering and return to traditional, /// windowing-system controlled framebuffer /// NOTE: /// This is NOT an "unbind" for this specific FBO, but rather /// disables all FBO rendering. This call is intentionally "static" /// and named "Disable" instead of "Unbind" for this reason. The /// motivation for this strange semantic is performance. Providing /// "Unbind" would likely lead to a large number of unnecessary /// FBO enablings/disabling. static void Disable(); /// END : Static methods global to all FBOs bool IsValid() { return CheckBufferStatus(); } bool CheckBufferStatus(); protected: bool CheckRedundancy(GLenum attachment, GLuint tex_id, int mip_level, int z_slice); void GuardedBind(); void GuardedUnbind(); void FramebufferTextureND(GLenum attachment, GLenum tex_target, GLuint tex_id, int mip_level, int z_slice); static GLuint GenerateFboId(); private: GLuint fbo_id_; GLint saved_fbo_id_; }; } // ax #endif // AXLE_CG_FRAMEBUFFER_OBJECT_H
[ "hpsoar@gmail.com" ]
hpsoar@gmail.com
e9184190cb114af611343297ae5a083184297aa0
81e71315f2f9e78704b29a5688ba2889928483bb
/include/crutil/crCollectOccludersVisitor.h
30bca079bf43d4da4a73334068212273a6c33e52
[]
no_license
Creature3D/Creature3DApi
2c95c1c0089e75ad4a8e760366d0dd2d11564389
b284e6db7e0d8e957295fb9207e39623529cdb4d
refs/heads/master
2022-11-13T07:19:58.678696
2019-07-06T05:48:10
2019-07-06T05:48:10
274,064,341
0
1
null
null
null
null
UTF-8
C++
false
false
4,976
h
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ //Modified by Wucaihua #ifndef CRUTIL_CRCOLLECTOCCLUDERSVISITOR_H #define CRUTIL_CRCOLLECTOCCLUDERSVISITOR_H 1 #include <CRUtil/crExport.h> #include <CRCore/crNodeVisitor.h> #include <CRCore/crCullStack.h> #include <set> namespace CRUtil { class CRUTIL_EXPORT crCollectOccludersVisitor : public CRCore::crNodeVisitor, public CRCore::crCullStack { public: typedef std::set<CRCore::crShadowVolumeOccluder> ShadowVolumeOccluderSet; crCollectOccludersVisitor(); virtual ~crCollectOccludersVisitor(); virtual crCollectOccludersVisitor* cloneType() const { return new crCollectOccludersVisitor(); } virtual void reset(); virtual float getDistanceToEyePoint(const CRCore::crVector3& pos, bool withLODScale) const; virtual float getDistanceFromEyePoint(const CRCore::crVector3& pos, bool withLODScale) const; virtual void apply(CRCore::crNode&); //virtual void apply(CRCore::crObject&); //virtual void apply(CRCore::crDrawable&); virtual void apply(CRCore::crTransform& node); virtual void apply(CRCore::crProjection& node); virtual void apply(CRCore::crSwitch& node); virtual void apply(CRCore::crLod& node); virtual void apply(CRCore::crOccluderNode& node); /** Set the minimum shadow occluder volume that an active occluder must have. * volume is units relative the clip space volume where 1.0 is the whole clip space.*/ void setMinimumShadowOccluderVolume(float vol) { m_minShadowOccluderVolume = vol; } float getMinimumShadowOccluderVolume() const { return m_minShadowOccluderVolume; } /** Set the maximum number of occluders to have active for culling purposes.*/ void setMaximumNumberOfActiveOccluders(unsigned int num) { m_maxNumberOfActiveOccluders = num; } unsigned int getMaximumNumberOfActiveOccluders() const { return m_maxNumberOfActiveOccluders; } // void setMaximumNumberOfCollectOccluders(unsigned int num) { m_maxNumberOfCollectOccluders = num; } void setCreateDrawablesOnOccludeNodes(bool flag) { m_createDrawables=flag; } bool getCreateDrawablesOnOccludeNodes() const { return m_createDrawables; } void setCollectedOcculderList(const ShadowVolumeOccluderSet& svol) { m_occluderSet = svol; } ShadowVolumeOccluderSet& getCollectedOccluderSet() { return m_occluderSet; } const ShadowVolumeOccluderSet& getCollectedOccluderSet() const { return m_occluderSet; } /** remove occluded occluders for the collected occluders list, * and then discard of all but MaximumNumberOfActiveOccluders of occluders, * discarding the occluders with the lowests shadow occluder volume .*/ void removeOccludedOccluders(); //void creatOccluder(const crVector3& v1,const crVector3& v2,const crVector3& v3,const crVector3& v4); protected: /** prevent unwanted copy construction.*/ //crCollectOccludersVisitor(const crCollectOccludersVisitor&):CRCore::crNodeVisitor(),CRCore::crCullStack() {} /** prevent unwanted copy operator.*/ crCollectOccludersVisitor& operator = (const crCollectOccludersVisitor&) { return *this; } inline void handle_cull_callbacks_and_traverse(CRCore::crNode& node) { /*CRCore::crNodeCallback* callback = node.getCullCallback(); if (callback) (*callback)(&node,this); else*/ if (node.getNumChildrenWithOccluderNodes()>0) traverse(node); } inline void handle_cull_callbacks_and_accept(CRCore::crNode& node,CRCore::crNode* acceptNode) { /*CRCore::crNodeCallback* callback = node.getCullCallback(); if (callback) (*callback)(&node,this); else*/ if (node.getNumChildrenWithOccluderNodes()>0) acceptNode->accept(*this); } //float m_minCalculateValue; float m_minShadowOccluderVolume; unsigned int m_maxNumberOfActiveOccluders; //unsigned int m_maxNumberOfCollectOccluders; bool m_createDrawables; ShadowVolumeOccluderSet m_occluderSet; }; } #endif
[ "wucaihua@86aba9cf-fb85-4101-ade8-2f98c1f5b361" ]
wucaihua@86aba9cf-fb85-4101-ade8-2f98c1f5b361
476aa8997fc3ad92c2471657b2330fb91eb6ab6f
4deeef97bd5346899c463bc92c564990cb56fc9c
/lab1/sketch_part3/sketch_part3.ino
70a12d9b7ecbd73addc32d4bd6cbb35a1e3d0b2f
[]
no_license
daveyproctor/Arduino
f5bd73ab2292e8cf931fdce5881e30a1a578a04e
45d51524c149ed61a22be1585e6b0ef8808b60a2
refs/heads/master
2020-04-21T10:25:17.114535
2019-05-03T20:03:33
2019-05-03T20:03:33
169,485,836
0
0
null
null
null
null
UTF-8
C++
false
false
708
ino
#include "testasm.h" void setup() { // put your setup code here, to run once Serial.begin(9600); Serial.print("The third Fibonacci number is "); Serial.println(testasm(3)); Serial.print("The fifth Fibonacci number is "); Serial.println(testasm(5)); Serial.print("The seventh Fibonacci number is "); Serial.println(testasm(7)); Serial.print("The tenth Fibonacci number is "); Serial.println(testasm(10)); Serial.print("The sixteenth Fibonacci number is "); Serial.println(testasm(16)); pinMode (13, OUTPUT); } void loop() { // put your main code here, to run repeatedly: digitalWrite (13, HIGH); delay(400); digitalWrite (13, LOW); delay(400); }
[ "david.proctor@yale.edu" ]
david.proctor@yale.edu
9d7ea7ede7ee53228e266ff35c7208ad8c026737
6e790b19299272268806f8808d759a80401f8825
/DX/DX/src/Include/GameplayLayer/Components/transform.h
aed2dd78f56f6d7c391504cd43dc11424bb07f7e
[]
no_license
SilvanVR/DX
8e80703e7ce015d287ba3ebc2fc0d78085d312f1
0fd7ec94e8d868c7a087f95f9dda60e97df38682
refs/heads/master
2023-07-16T01:42:48.306869
2021-08-28T02:36:32
2021-08-28T02:36:32
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,998
h
#pragma once /********************************************************************** class: Transform (transform.h) author: S. Hau date: December 17, 2017 **********************************************************************/ #include "i_component.h" namespace Components { //********************************************************************** class Transform : public IComponent { public: Transform() {} Math::Vec3 position = Math::Vec3( 0.0f, 0.0f, 0.0f ); Math::Vec3 scale = Math::Vec3( 1.0f, 1.0f, 1.0f ); Math::Quat rotation = Math::Quat( 0.0f, 0.0f, 0.0f, 1.0f ); const ArrayList<Transform*>& getChildren() const { return m_pChildren; } const Transform* getParent() const { return m_pParent; } Math::Vec3 getWorldPosition() const; Math::Vec3 getWorldScale() const; Math::Quat getWorldRotation() const; void getWorldTransform(Math::Vec3* pos, Math::Vec3* scale, Math::Quat* quat); //---------------------------------------------------------------------- // Rotates this transform to look at the given target. // (P.S. This might be incorrect if the target has the opposite direction from the world up vector i.e. looking straight down) //---------------------------------------------------------------------- void lookAt(const Math::Vec3& target); //---------------------------------------------------------------------- // Set the parent for this transform component. // @Params: // "t": This transform becomes the new parent transform. // "keepWorldTransform": If true, this component will keep the current world transform. //---------------------------------------------------------------------- void setParent(Transform* t, bool keepWorldTransform = true); //---------------------------------------------------------------------- // Add a child to this transform. // @Params: // "t": This transform becomes the new child. // "keepWorldTransform": If true, the child will keep his current world transform. //---------------------------------------------------------------------- void addChild(Transform* t, bool keepWorldTransform = true); //---------------------------------------------------------------------- // Returns the final composited world transformation matrix. //---------------------------------------------------------------------- DirectX::XMMATRIX getWorldMatrix() const; private: Transform* m_pParent = nullptr; ArrayList<Transform*> m_pChildren; inline void _RemoveFromParent(); inline DirectX::XMMATRIX _GetLocalTransformationMatrix() const; NULL_COPY_AND_ASSIGN(Transform) }; }
[ "silvan-hau@web.de" ]
silvan-hau@web.de
4f63ee106f489751690222d8a58da8470a2ba0cd
daf6dd0d2db12106bfc1202586781ef9f658fe42
/Basic Codes/DhakaSim-qt/qt/qt/userinterface-build-Desktop_Qt_5_0_1_MinGW_32bit-Debug/ui_plot.h
9b4bce504e8c06a8af9acd51e0b3966c13e4b0af
[]
no_license
bejon028/DhakaTrafficeSimulator
359e89afe5c590c821441aea44e4b0bce98b4b00
ff9d38d9cdb42ce45c8fc0542c705e55b2215fe7
refs/heads/master
2021-01-22T04:18:08.987528
2017-02-10T05:28:23
2017-02-10T05:28:23
81,529,918
0
0
null
null
null
null
UTF-8
C++
false
false
2,030
h
/******************************************************************************** ** Form generated from reading UI file 'plot.ui' ** ** Created by: Qt User Interface Compiler version 5.0.1 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef UI_PLOT_H #define UI_PLOT_H #include <QtCore/QVariant> #include <QtWidgets/QAction> #include <QtWidgets/QApplication> #include <QtWidgets/QButtonGroup> #include <QtWidgets/QHeaderView> #include <QtWidgets/QMainWindow> #include <QtWidgets/QMenuBar> #include <QtWidgets/QStatusBar> #include <QtWidgets/QWidget> #include "qcustomplot.h" QT_BEGIN_NAMESPACE class Ui_plot { public: QWidget *centralwidget; QCustomPlot *widget; QMenuBar *menubar; QStatusBar *statusbar; void setupUi(QMainWindow *plot) { if (plot->objectName().isEmpty()) plot->setObjectName(QStringLiteral("plot")); plot->resize(555, 431); centralwidget = new QWidget(plot); centralwidget->setObjectName(QStringLiteral("centralwidget")); widget = new QCustomPlot(centralwidget); widget->setObjectName(QStringLiteral("widget")); widget->setGeometry(QRect(30, 20, 491, 361)); plot->setCentralWidget(centralwidget); menubar = new QMenuBar(plot); menubar->setObjectName(QStringLiteral("menubar")); menubar->setGeometry(QRect(0, 0, 555, 21)); plot->setMenuBar(menubar); statusbar = new QStatusBar(plot); statusbar->setObjectName(QStringLiteral("statusbar")); plot->setStatusBar(statusbar); retranslateUi(plot); QMetaObject::connectSlotsByName(plot); } // setupUi void retranslateUi(QMainWindow *plot) { plot->setWindowTitle(QApplication::translate("plot", "MainWindow", 0)); } // retranslateUi }; namespace Ui { class plot: public Ui_plot {}; } // namespace Ui QT_END_NAMESPACE #endif // UI_PLOT_H
[ "bejon.sarker@konasl.com" ]
bejon.sarker@konasl.com
d1eaf1461e2358231f532f8f747215576411a295
66476eb7b8a452a8bd4e1e8a57dd272e8971cf45
/main/editeng/source/accessibility/AccessibleHyperlink.cxx
82ebffded5e39fdf62d64f154d2862eac0b967dc
[ "Apache-2.0", "LGPL-2.0-or-later", "HPND-sell-variant", "ICU", "LicenseRef-scancode-warranty-disclaimer", "PSF-2.0", "BSD-3-Clause", "LicenseRef-scancode-free-unknown", "IJG", "Zlib", "NTP", "W3C", "GPL-1.0-or-later", "LicenseRef-scancode-python-cwi", "Bitstream-Vera", "LicenseRef-scan...
permissive
ECSE437-Fall2019/OpenOffice
36d6fb9830ceadc2f48ebab617b38b33c09cfd14
b420a30da4cb79c4d772ac2797aefce603e3a17b
refs/heads/master
2020-09-16T15:30:56.625335
2019-11-25T03:44:52
2019-11-25T03:44:52
223,813,824
0
5
Apache-2.0
2019-11-25T04:52:31
2019-11-24T21:37:39
C++
UTF-8
C++
false
false
13,536
cxx
/************************************************************** * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * *************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_editeng.hxx" #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Reference.hxx> #include <comphelper/accessiblekeybindinghelper.hxx> #include "AccessibleHyperlink.hxx" #include "editeng/unoedprx.hxx" #include <editeng/flditem.hxx> #include <vcl/keycodes.hxx> using namespace ::com::sun::star; //------------------------------------------------------------------------ // // AccessibleHyperlink implementation // //------------------------------------------------------------------------ namespace accessibility { AccessibleHyperlink::AccessibleHyperlink( SvxAccessibleTextAdapter& r, SvxFieldItem* p, sal_uInt16 nP, sal_uInt16 nR, sal_Int32 nStt, sal_Int32 nEnd, const ::rtl::OUString& rD ) : rTA( r ) { pFld = p; nPara = nP; nRealIdx = nR; nStartIdx = nStt; nEndIdx = nEnd; aDescription = rD; } AccessibleHyperlink::~AccessibleHyperlink() { delete pFld; } // XAccessibleAction sal_Int32 SAL_CALL AccessibleHyperlink::getAccessibleActionCount() throw (uno::RuntimeException) { return isValid() ? 1 : 0; } sal_Bool SAL_CALL AccessibleHyperlink::doAccessibleAction( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { sal_Bool bRet = sal_False; if ( isValid() && ( nIndex == 0 ) ) { rTA.FieldClicked( *pFld, nPara, nRealIdx ); bRet = sal_True; } return bRet; } ::rtl::OUString SAL_CALL AccessibleHyperlink::getAccessibleActionDescription( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { ::rtl::OUString aDesc; if ( isValid() && ( nIndex == 0 ) ) aDesc = aDescription; return aDesc; } uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL AccessibleHyperlink::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > xKeyBinding; if( isValid() && ( nIndex == 0 ) ) { ::comphelper::OAccessibleKeyBindingHelper* pKeyBindingHelper = new ::comphelper::OAccessibleKeyBindingHelper(); xKeyBinding = pKeyBindingHelper; awt::KeyStroke aKeyStroke; aKeyStroke.Modifiers = 0; aKeyStroke.KeyCode = KEY_RETURN; aKeyStroke.KeyChar = 0; aKeyStroke.KeyFunc = 0; pKeyBindingHelper->AddKeyBinding( aKeyStroke ); } return xKeyBinding; } // XAccessibleHyperlink uno::Any SAL_CALL AccessibleHyperlink::getAccessibleActionAnchor( sal_Int32 /*nIndex*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { return uno::Any(); } uno::Any SAL_CALL AccessibleHyperlink::getAccessibleActionObject( sal_Int32 /*nIndex*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { return uno::Any(); } sal_Int32 SAL_CALL AccessibleHyperlink::getStartIndex() throw (uno::RuntimeException) { return nStartIdx; } sal_Int32 SAL_CALL AccessibleHyperlink::getEndIndex() throw (uno::RuntimeException) { return nEndIdx; } sal_Bool SAL_CALL AccessibleHyperlink::isValid( ) throw (uno::RuntimeException) { return rTA.IsValid(); } } // end of namespace accessibility //------------------------------------------------------------------------ // MT IA2: Accessiblehyperlink.hxx from IA2 CWS - meanwhile we also introduced one in DEV300 (above) // Keeping this for reference - we probably should get support for image maps in our implementation... /* class SVX_DLLPUBLIC SvxAccessibleHyperlink : public ::cppu::WeakImplHelper1< ::com::sun::star::accessibility::XAccessibleHyperlink > { SvxURLField* mpField; sal_Int32 nStartIdx; sal_Int32 nEndIdx; ImageMap* mpImageMap; SdrObject* m_pShape; ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > shapeParent; public: SvxAccessibleHyperlink(){}; //SvxAccessibleHyperlink(::rtl::OUString name, const Imagemap* pImageMap); SvxAccessibleHyperlink(const SvxURLField* p, sal_Int32 nStt, sal_Int32 nEnd); SvxAccessibleHyperlink(SdrObject* p, ::accessibility::AccessibleShape* pAcc); virtual ~SvxAccessibleHyperlink(); //void setImageMap(ImageMap* pMap); //void setXAccessibleImage(::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > parent); ::rtl::OUString GetHyperlinkURL(sal_Int32 nIndex) throw (::com::sun::star::lang::IndexOutOfBoundsException); sal_Bool IsValidHyperlink(); // XAccessibleAction virtual sal_Int32 SAL_CALL getAccessibleActionCount() throw (::com::sun::star::uno::RuntimeException); virtual sal_Bool SAL_CALL doAccessibleAction( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); // XAccessibleHyperlink virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleActionAnchor( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleActionObject( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual sal_Int32 SAL_CALL getStartIndex() throw (::com::sun::star::uno::RuntimeException); virtual sal_Int32 SAL_CALL getEndIndex() throw (::com::sun::star::uno::RuntimeException); virtual sal_Bool SAL_CALL isValid( ) throw (::com::sun::star::uno::RuntimeException); }; SvxAccessibleHyperlink::SvxAccessibleHyperlink( const SvxURLField *p, sal_Int32 nStt, sal_Int32 nEnd ) : nStartIdx( nStt ), nEndIdx( nEnd ), m_pShape(NULL), shapeParent(NULL) { if(p) mpField = (SvxURLField*)p->Clone(); else mpField = NULL; } SvxAccessibleHyperlink::SvxAccessibleHyperlink(SdrObject* p, ::accessibility::AccessibleShape* pAcc) : nStartIdx( -1 ), nEndIdx( -1 ), mpField(NULL), m_pShape(p) { mpImageMap = m_pShape->GetModel()->GetImageMapForObject(m_pShape); shapeParent = dynamic_cast< XAccessible* >(pAcc); } SvxAccessibleHyperlink::~SvxAccessibleHyperlink() { if(mpField) delete mpField; } ::rtl::OUString SvxAccessibleHyperlink::GetHyperlinkURL(sal_Int32 nIndex) throw (::com::sun::star::lang::IndexOutOfBoundsException) { if( mpField ) { if (nIndex != 0) throw ::com::sun::star::lang::IndexOutOfBoundsException(); return ::rtl::OUString( mpField->GetURL() ); } else if (mpImageMap) { if (nIndex < 0 || nIndex >=mpImageMap->GetIMapObjectCount()) throw IndexOutOfBoundsException(); IMapObject* pMapObj = mpImageMap->GetIMapObject(sal_uInt16(nIndex)); if (pMapObj->GetURL().Len()) return ::rtl::OUString( pMapObj->GetURL() ); } else { if (nIndex != 0) throw ::com::sun::star::lang::IndexOutOfBoundsException(); SdrUnoObj* pUnoCtrl = dynamic_cast< SdrUnoObj* >( m_pShape ); if(pUnoCtrl) { try { uno::Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel(), uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySetInfo > xPropInfo( xPropSet->getPropertySetInfo(), uno::UNO_QUERY_THROW ); form::FormButtonType eButtonType = form::FormButtonType_URL; const ::rtl::OUString sButtonType( RTL_CONSTASCII_USTRINGPARAM( "ButtonType" ) ); if(xPropInfo->hasPropertyByName( sButtonType ) && (xPropSet->getPropertyValue( sButtonType ) >>= eButtonType ) ) { ::rtl::OUString aString; // URL const ::rtl::OUString sTargetURL(RTL_CONSTASCII_USTRINGPARAM( "TargetURL" )); if(xPropInfo->hasPropertyByName(sTargetURL)) { if( xPropSet->getPropertyValue(sTargetURL) >>= aString ) return aString; } } } catch( uno::Exception& ) { } } // If hyperlink can't be got from sdrobject, query the corresponding document to retrieve the link info uno::Reference< XAccessibleGroupPosition > xGroupPosition (shapeParent, uno::UNO_QUERY); if (xGroupPosition.is()) return xGroupPosition->getObjectLink( uno::makeAny( shapeParent ) ); } return ::rtl::OUString(); } // Just check whether the first hyperlink is valid sal_Bool SvxAccessibleHyperlink::IsValidHyperlink() { ::rtl::OUString url = GetHyperlinkURL(0); if (url.getLength() > 0) return sal_True; else return sal_False; } // XAccessibleAction sal_Int32 SAL_CALL SvxAccessibleHyperlink::getAccessibleActionCount() throw (RuntimeException) { if (mpImageMap) return mpImageMap->GetIMapObjectCount(); else return 1; // only shape link or url field //return mpField ? 1 : (mpImageMap ? mpImageMap->GetIMapObjectCount() : 0); } sal_Bool SAL_CALL SvxAccessibleHyperlink::doAccessibleAction( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); sal_Bool bRet = sal_False; OUString url = GetHyperlinkURL(nIndex); if( url.getLength() > 0 ) { SfxStringItem aStrItem(SID_FILE_NAME, url); const SfxObjectShell* pDocSh = SfxObjectShell::Current(); if( pDocSh ) { SfxMedium* pSfxMedium = pDocSh->GetMedium(); if( pSfxMedium) { SfxStringItem aReferer(SID_REFERER, pSfxMedium->GetName()); SfxBoolItem aBrowseItem( SID_BROWSE, TRUE ); SfxViewFrame* pFrame = SfxViewFrame::Current(); if( pFrame ) { pFrame->GetDispatcher()->Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aStrItem, &aBrowseItem, &aReferer, 0L); bRet = sal_True; } } } } return bRet; } OUString SAL_CALL SvxAccessibleHyperlink::getAccessibleActionDescription( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) { return GetHyperlinkURL(nIndex); } ::com::sun::star::uno::Reference< XAccessibleKeyBinding > SAL_CALL SvxAccessibleHyperlink::getAccessibleActionKeyBinding( sal_Int32 ) throw (IndexOutOfBoundsException, RuntimeException) { ::com::sun::star::uno::Reference< XAccessibleKeyBinding > xKeyBinding; if( mpField || m_pShape) { ::comphelper::OAccessibleKeyBindingHelper* pKeyBindingHelper = new ::comphelper::OAccessibleKeyBindingHelper(); xKeyBinding = pKeyBindingHelper; ::com::sun::star::awt::KeyStroke aKeyStroke; aKeyStroke.Modifiers = 0; aKeyStroke.KeyCode = KEY_RETURN; aKeyStroke.KeyChar = 0; aKeyStroke.KeyFunc = 0; pKeyBindingHelper->AddKeyBinding( aKeyStroke ); } return xKeyBinding; } // XAccessibleHyperlink Any SAL_CALL SvxAccessibleHyperlink::getAccessibleActionAnchor( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) { Any aRet; ::rtl::OUString retText; if(mpField && nIndex == 0) { retText = mpField->GetRepresentation(); aRet <<= retText; return aRet; } else if(mpImageMap) { IMapObject* pMapObj = mpImageMap->GetIMapObject(sal_uInt16(nIndex)); if(pMapObj && pMapObj->GetURL().Len()) aRet <<= shapeParent; return aRet; } else if (nIndex == 0) { aRet <<= shapeParent; return aRet; } return aRet; } Any SAL_CALL SvxAccessibleHyperlink::getAccessibleActionObject( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) { ::rtl::OUString retText = GetHyperlinkURL(nIndex); Any aRet; aRet <<= retText; return aRet; } sal_Int32 SAL_CALL SvxAccessibleHyperlink::getStartIndex() throw (RuntimeException) { return nStartIdx; } sal_Int32 SAL_CALL SvxAccessibleHyperlink::getEndIndex() throw (RuntimeException) { return nEndIdx; } sal_Bool SAL_CALL SvxAccessibleHyperlink::isValid( ) throw (RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); //return mpField ? sal_True: ( mpImageMap ? sal_True : sal_False ); if (mpField || m_pShape) return sal_True; else return sal_False; } */
[ "boury.mbodj@mail.mcgill.ca" ]
boury.mbodj@mail.mcgill.ca
76bd00982fc1a77ecaa4bc4535e658b408c17ebc
69b9cb379b4da73fa9f62ab4b51613c11c29bb6b
/submissions/agc015_b/main.cpp
2bc19333e5075673a0b5fff7dd5c92c9d72fbcbc
[]
no_license
tatt61880/atcoder
459163aa3dbbe7cea7352d84cbc5b1b4d9853360
923ec4d5d4ae5454bc6da2ac877946672ff807e7
refs/heads/main
2023-07-16T16:19:22.404571
2021-08-15T20:54:24
2021-08-15T20:54:24
118,358,608
0
0
null
null
null
null
UTF-8
C++
false
false
514
cpp
#include <iostream> #include <cstring> using namespace std; typedef long long ll; typedef unsigned long long ull; #define PrintLn(X) cout << X << endl #define Rep(i, n) for(int i = 0; i < (int)(n); ++i) #define For(i, a, b) for(int i = a; i < (int)(b); ++i) int main(void) { char S[100001]; cin >> S; ll ans = 0; int len = strlen(S); Rep(i, len){ if(S[i] == 'U'){ ans += 1 * (len - i - 1); ans += 2 * (i); }else{ ans += 2 * (len - i - 1); ans += 1 * (i); } } PrintLn(ans); return 0; }
[ "tatt61880@gmail.com" ]
tatt61880@gmail.com
93c96235718204222ae41cd86e0baf3e790cc49e
f4e4d657944eae561d009cd29650219539a2333b
/src/Core/Input.h
1e738903f28612eb87bdb3bfe6f00e8558041df9
[]
no_license
antopilo/OpenGLSandbox
bbada90d31f86c0c3d28f7aa50876c9fcc49fdc0
2a80d069c0ab36b8e0fc28c87091e9a7cac28e9d
refs/heads/master
2023-04-08T02:29:18.839751
2021-04-13T17:10:26
2021-04-13T17:10:26
324,453,168
0
0
null
null
null
null
UTF-8
C++
false
false
511
h
#pragma once #include <utility> class Input { public: static bool IsKeyPressed(int keycode); static bool IsKeyPress(int keycode); static bool IsKeyReleased(int keycode); static bool IsMouseButtonPressed(int button); static void HideMouse(); static void ShowMouse(); static bool IsMouseHidden(); static float GetMouseX(); static float GetMouseY(); static std::pair<float, float> GetMousePosition(); static bool Init(); Input* Get() { return s_Instance; } private: static Input* s_Instance; };
[ "antoinepilote1@hotmail.com" ]
antoinepilote1@hotmail.com
0244e5ed51a4daf96358bf4affbd487f86f934dc
9eaf9c37dda16a2861a354b928acf3f63973aa34
/include/obvi/util/camera3.hpp
270b9c9802ec5860f74a573fe62d2581548037fa
[ "MIT" ]
permissive
stephen-sorley/obvi
5d9eb9799f66cd44c160024ea5b923ae6b292f79
ead96e23dfd9ffba35590b3a035556eeb093d9a8
refs/heads/master
2020-04-22T23:22:33.818191
2020-03-03T23:10:06
2020-03-03T23:10:06
170,739,476
0
0
null
null
null
null
UTF-8
C++
false
false
16,411
hpp
/* Header-only class to manage a camera in 3D space. * * This includes both the camera's position/orientation in world space, and the projection * transformation used to model the camera's lens. * * Projection matrix math taken from here: * https://www.glprogramming.com/red/appendixf.html (frustum only - the ortho matrix has a typo) * https://en.wikipedia.org/wiki/Orthographic_projection * http://www.songho.ca/opengl/gl_transform.html * * [point in clip coords] = Projection * View * Model * [point in object coordinates] * * To go from clip coords (4d vector) to normalized device coordinates (3d vector), divide * [x,y,z] components by w (fourth component). * * Normalized device coordinates (NDC) are just the window coordinates normalized to range [-1, 1]. * Note that in OpenGL NDC (-1,-1) is the lower-left corner of the screen and (1,1) is the * upper-right. * * This differs from standard convention in windowing systems like Qt, where (0,0) is the upper-left * corner of the window, and (width,height) is the lower-right. You'll need to factor that in when * converting NDC coords to window coords, or vice-versa. * * Inverse (convert point in clip coords to a ray in object coords): * [point in object coords] = Model^-1 * View^-1 * Projection^-1 * [point in clip coords] * * * * * * * * * * * * * * The MIT License (MIT) * * Copyright (c) 2019 Stephen Sorley * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * * * * * * * * * * * */ #ifndef OBVI_CAMERA3_HPP #define OBVI_CAMERA3_HPP #include <cmath> #include <obvi/util/affine3.hpp> #include <obvi/util/math.hpp> namespace obvi { enum class camera_type { ORTHOGRAPHIC, // Orthographic projection (objects do not get smaller with distance) PERSPECTIVE // Perspective projection (real-world view) }; template<typename real> struct camera3 { // Easiest way to set the camera's orientation and position (view transformation). // // camera_pos = location of camera in world coordinates // target_pos = point camera should be aimed at, in world coordinates // up = direction in world coordinates that will represent "up" in the camera's image void look_at(const vec3<real>& camera_pos, const vec3<real>& target_pos, const vec3<real>& up) { // Rotate axes so that -z points from camera to target. Set +x to be perpendicular to up // vector and +z, in direction to obey right-hand rule. Set +y to be perpendicular to +x // and +z. Store result in 'view' as affine transform. mat3<real> rot; vec3<real> look_dir = target_pos - camera_pos; rot.rows[0] = (look_dir.cross(up)).normalized(); // new +x, expressed in old coords rot.rows[1] = (rot.rows[0].cross(look_dir)).normalized(); // new +y, expressed in old coords rot.rows[2] = -look_dir.normalized(); // new +z, expressed in old coords view = rot; // Translate coordinate system so that camera is at (0,0,0). view *= affine3<real>(-camera_pos); // Store the inverse of the transformation, too. invview = view.inv(); } // Set the view transformation directly. // Use look_at() instead of this function, if possible (it's easier to do correctly). void set_view(const affine3<real>& new_view) { view = new_view; invview = new_view.inv(); } // Return this camera's current view transform (inverse of camera position and orientation). const affine3<real>& get_view() const { return view; } // Return inverse of this camera's current view transform (camera position and orientation). const affine3<real>& get_inverse_view() const { return invview; } // Return camera's position, in world coordinates. const vec3<real>& get_position() const { return invview.translation(); } // Return camera's look direction vector, in world coordinates. vec3<real> get_look_dir() const { //invview.rotation() * <0,0,-1> return -invview.rotation().col(2); } // Return camera's up direction vector, in world coordinates. vec3<real> get_up_dir() const { //invview.rotation() * <0,1,0> return invview.rotation().col(1); } // Set the camera's projection matrix (basially, this describes the camera's lens). // For typical scenes, just use set_perspective(). This function is only useful if you // need an orthographic projection, or an off-axis perspective projection. // // left: location of left clipping plane // right: location of right clipping plane (left + right = 0 if on-axis) // bottom: location of bottom clipping plane // top: location of top clipping plane (bottom + top = 0 if on-axis) // near: distance to near clipping plane (must always be POSITIVE) // far: distance to far clipping plane (must always be POSITIVE) bool set_projection(camera_type proj, real left, real right, real bottom, real top, real near_clip, real far_clip) { if(near_clip <= real(0) || far_clip <= real(0) || left == right || bottom == top) { return false; } proj_type = proj; switch(proj_type) { case camera_type::ORTHOGRAPHIC: recalc_orthographic(left, right, bottom, top, near_clip, far_clip); break; case camera_type::PERSPECTIVE: recalc_perspective(left, right, bottom, top, near_clip, far_clip); break; } return true; } /* Shortcut for common case - perspective projection centered on viewing axis, defined by vertical field-of-view angle in radians (fovy_rad) and aspect ratio (width / height). See: https://stackoverflow.com/a/12943456 */ bool set_perspective(real fovy_rad, real aspect_ratio, real near_clip, real far_clip) { if(fovy_rad <= real(0) || aspect_ratio <= real(0)) { return false; } real fH = std::tan(fovy_rad * real(0.5)) * near_clip; real fW = fH * aspect_ratio; return set_projection(camera_type::PERSPECTIVE, -fW, fW, -fH, fH, near_clip, far_clip); } // Construct (projection * view) matrix, save in opengl format. template<typename GLreal> void to_gl(std::array<GLreal, 16>& arr) const { to_gl_internal(arr, view); } // Construct (projection * view * model) matrix, save in opengl format. template<typename GLreal> void to_gl(std::array<GLreal, 16>& arr, const affine3<real>& model) const { to_gl_internal(arr, view * model); } // Reverse the camera transform - convert vector in clip coords back to world coords. vec3<real> unproject(const vec3<real>& vec) const { vec3<real> res = vec; // Reverse the projection transformation, to go from clip coords back to eye coords. switch(proj_type) { case camera_type::ORTHOGRAPHIC: res = unproject_orthographic(vec); break; case camera_type::PERSPECTIVE: res = unproject_perspective(vec); break; } // Reverse the view transformation, to go from eye coords back to world coords. // Note: caller will still need to multiply by inverse of each object's transform matrix // before using the returned vector to interrogate the object. return invview * res; } private: // Inverse of camera position and orientation (view matrix). affine3<real> view; affine3<real> invview; // calculate this once and save, to avoid recalc on calls to unproject(). // Camera projection matrix (think of it as the lens of the camera). // Initialize to orthographic type camera, with identity matrices for the projection matrix // and its inverse. camera_type proj_type = camera_type::ORTHOGRAPHIC; real p[6] = {1, 1, 1, 0, 0, 0}; // projection matrix (sparse, only store non-const values) real invp[6] = {1, 1, 1, 0, 0, 0}; // inverse of projection matrix // Private helper functions. void recalc_orthographic(real left, real right, real bottom, real top, real near_clip, real far_clip) { real w = right - left; real h = top - bottom; real nd = near_clip - far_clip; /* Orthographic: |p[0] 0 0 p[4]| | 0 p[1] 0 p[5]| | 0 0 p[2] p[3]| | 0 0 0 1 | */ p[0] = real(2) / w; p[1] = real(2) / h; p[2] = real(2) / nd; p[3] = (near_clip + far_clip) / nd; p[4] = (left + right) / -w; p[5] = (bottom + top) / -h; /* Orthographic (Inverse): |invp[0] 0 0 invp[4]| | 0 invp[1] 0 invp[5]| | 0 0 invp[2] invp[3]| | 0 0 0 1 | */ invp[0] = w / real(2); invp[1] = h / real(2); invp[2] = nd / real(2); invp[3] = (near_clip + far_clip) / real(-2); invp[4] = (left + right) / real(2); invp[5] = (bottom + top) / real(2); } void recalc_perspective(real left, real right, real bottom, real top, real near_clip, real far_clip) { real w = right - left; real h = top - bottom; real nd = near_clip - far_clip; real n2 = real(2) * near_clip; real nf2 = n2 * far_clip; /* Perspective: |p[0] 0 p[4] 0 | | 0 p[1] p[5] 0 | | 0 0 p[2] p[3]| | 0 0 -1 0 | */ p[0] = n2 / w; p[1] = n2 / h; p[2] = (near_clip + far_clip) / nd; p[3] = nf2 / nd; p[4] = (right + left) / w; p[5] = (bottom + top) / h; /* Perspective (Inverse): |invp[0] 0 0 invp[4]| | 0 invp[1] 0 invp[5]| | 0 0 0 -1 | | 0 0 invp[2] invp[3]| */ invp[0] = w / n2; invp[1] = h / n2; invp[2] = nd / nf2; invp[3] = (near_clip + far_clip) / nf2; invp[4] = (right + left) / n2; invp[5] = (bottom + top) / n2; } // Reverse the orthographic projection - go from NDC back to eye coords. vec3<real> unproject_orthographic(const vec3<real>& vec) const { vec3<real> res; // Note: for orthographic, value of 'w' is implicilty always 1. res.x() = invp[0]*vec.x() + invp[4]; res.y() = invp[1]*vec.y() + invp[5]; res.z() = invp[2]*vec.z() + invp[3]; return res; } // Reverse the perspective projection - go from NDC back to eye coords. vec3<real> unproject_perspective(const vec3<real>& vec) const { vec3<real> res; res.x() = invp[0]*vec.x() + invp[4]; res.y() = invp[1]*vec.y() + invp[5]; res.z() = -vec.z(); /* Since 'res' is a 3D vector (w is assumed to be 1), but the result of an inverse perspective projection will have a value other than '1' for the w component, we need to calculate the w component and then divide all the vector components by it so that (x,y,z) have the proper values for w=1. */ res /= invp[2]*vec.z() + invp[3]; return res; } static size_t colmajor(size_t row, size_t col) { return col * 4 + row; } template<typename GLreal> void to_gl_internal(std::array<GLreal, 16>& arr, const affine3<real>& aff) const { switch(proj_type) { case camera_type::ORTHOGRAPHIC: to_gl_internal_orthographic(arr, aff); break; case camera_type::PERSPECTIVE: to_gl_internal_perspective(arr, aff); break; } } // Compute (ortho projection * aff), store column-wise in arr for export to OpenGL. template<typename GLreal> void to_gl_internal_orthographic(std::array<GLreal, 16>& arr, const affine3<real>& aff) const { const mat3<real>& rot = aff.rotation(); const vec3<real>& tr = aff.translation(); // Initialize with all zeros. arr.fill(GLreal(0)); // Combine scale with rotation matrix, then compute upper-left 3x3 of result. real s00 = rot(0,0) * aff.scale(); real s11 = rot(1,1) * aff.scale(); real s22 = rot(2,2) * aff.scale(); arr[colmajor(0,0)] = GLreal( p[0]*s00 ); arr[colmajor(0,1)] = GLreal( p[0]*rot(0,1) ); arr[colmajor(0,2)] = GLreal( p[0]*rot(0,2) ); arr[colmajor(1,0)] = GLreal( p[1]*rot(1,0) ); arr[colmajor(1,1)] = GLreal( p[1]*s11 ); arr[colmajor(1,2)] = GLreal( p[1]*rot(1,2) ); arr[colmajor(2,0)] = GLreal( p[2]*rot(2,0) ); arr[colmajor(2,1)] = GLreal( p[2]*rot(2,1) ); arr[colmajor(2,2)] = GLreal( p[2]*s22 ); // Compute upper-right 3x1 of result. arr[colmajor(0,3)] = GLreal( p[0]*tr.x() + p[4] ); arr[colmajor(1,3)] = GLreal( p[1]*tr.y() + p[5] ); arr[colmajor(2,3)] = GLreal( p[2]*tr.z() + p[3] ); arr[colmajor(3,3)] = GLreal( 1 ); } // Compute (perspective projection * aff), store column-wise in arr for export to OpenGL. template<typename GLreal> void to_gl_internal_perspective(std::array<GLreal, 16>& arr, const affine3<real>& aff) const { const mat3<real>& rot = aff.rotation(); const vec3<real>& tr = aff.translation(); // Initialize with all zeros. arr.fill(GLreal(0)); // Combine scale with rotation matrix, then compute upper-left 3x3 of result. real s00 = rot(0,0) * aff.scale(); real s11 = rot(1,1) * aff.scale(); real s22 = rot(2,2) * aff.scale(); arr[colmajor(0,0)] = GLreal( p[0]*s00 + p[4]*rot(2,0) ); arr[colmajor(0,1)] = GLreal( p[0]*rot(0,1) + p[4]*rot(2,1) ); arr[colmajor(0,2)] = GLreal( p[0]*rot(0,2) + p[4]*s22 ); arr[colmajor(1,0)] = GLreal( p[1]*rot(1,0) + p[5]*rot(2,0) ); arr[colmajor(1,1)] = GLreal( p[1]*s11 + p[5]*rot(2,1) ); arr[colmajor(1,2)] = GLreal( p[1]*rot(1,2) + p[5]*s22 ); arr[colmajor(2,0)] = GLreal( p[2]*rot(2,0) ); arr[colmajor(2,1)] = GLreal( p[2]*rot(2,1) ); arr[colmajor(2,2)] = GLreal( p[2]*s22 ); // Compute upper-right 3x1 of result. arr[colmajor(0,3)] = GLreal( p[0]*tr.x() + p[4]*tr.z() ); arr[colmajor(1,3)] = GLreal( p[1]*tr.y() + p[5]*tr.z() ); arr[colmajor(2,3)] = GLreal( p[2]*tr.z() + p[3] ); // Compute bottom row (1x4) of result. arr[colmajor(3,0)] = GLreal( -rot(2,0) ); arr[colmajor(3,1)] = GLreal( -rot(2,1) ); arr[colmajor(3,2)] = GLreal( -s22 ); arr[colmajor(3,3)] = GLreal( -tr.z() ); } }; using camera3f = camera3<float>; using camera3d = camera3<double>; } // END namespace obvi #endif // OBVI_CAMERA3_HPP
[ "stephen.sorley@gmail.com" ]
stephen.sorley@gmail.com
0d43252d8907b5ff2c44660ec56cbe21568d0d75
f2339e85157027dada17fadd67c163ecb8627909
/Server/Spell/Include/ISpell.h
80d3e4b089a3bd94830a24166fd658f399152cc7
[]
no_license
fynbntl/Titan
7ed8869377676b4c5b96df953570d9b4c4b9b102
b069b7a2d90f4d67c072e7c96fe341a18fedcfe7
refs/heads/master
2021-09-01T22:52:37.516407
2017-12-29T01:59:29
2017-12-29T01:59:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
9,101
h
/******************************************************************* ** 文件名: ISpell.h ** 版 权: (C) 深圳冰川网络技术有限公司 2008 - All Rights Reserved ** 创建人: 陈涛 (Carl Chen) ** 日 期: 1/8/2015 ** 版 本: 1.0 ** 描 述: 技能系统接口 ********************************************************************/ #pragma once #include "IEntity.h" #include "SpellDef.h" using namespace SPELL; struct ATTACK_DATA; struct IAttackObject; struct SPELL_CONTEXT; // ================================================================================// /** 技能接口: 1.单个技能接口,负责维护技能施放逻辑,及技能相关的天赋数据 */ // ================================================================================// struct ISpell : public IEventExecuteSink { // 载入技能 // @param pEntity: 技能实体指针(属于某实体,同步方便) virtual void onLoad(__IEntity *pEntity, SLOT_TYPE nSlotType, int nSlotIndex, int nAddCoolTime) = 0; // 取得技能ID virtual int getID() = 0; // 克隆一个技能对象,因为每个玩家都需要一个 virtual ISpell * clone() = 0; // 获取状态标志,例如攻击计数,是否在吟唱状态 virtual int getFlag(int nIndex) = 0; // 设置状态标志: 这个状态标志可以有很多功能,例如攻击计数 virtual void setFlag( int nIndex, int nFlag ) = 0; // 获取某个技能数值 virtual int getSpellData( SPELL_DATA_ID nIndex ) = 0; // 获取某个技能数值 virtual const char * getSpellDataStr( SPELL_DATA_ID nIndex ) = 0; virtual bool addTalent(int nTalentID) = 0; // 添加天赋数据: 天赋数据可对技能数值进行影响 // @param nTalentID : 天赋ID,可以用这个ID查到天赋说明,同一个天赋ID是不能重复添加的 // @param isAdd : 是增加数值还是直接设置数值 // @param nIndex: 技能数值索引 // @param nValue: 数值大小 // @param nToken: 令牌(删除时传入同样令牌可移除天赋) //virtual bool addTalent( int nTalentID,bool isAdd,SPELL_DATA_ID nIndex,int nValue) = 0; // 添加天赋数据: 天赋数据可对技能数值进行影响,同一个天赋ID是不能重复添加的 // @param nTalentID : 天赋ID,可以用这个ID查到天赋说明 // @param nIndex: 技能数值索引 // @param nValue: 数值大小 // @param nToken: 令牌(删除时传入同样令牌可移除天赋) //virtual bool addTalent( int nTalentID,SPELL_DATA_ID nIndex,const char * szValue ) = 0; // 移除天赋数据 // @param nToken : 添加时传入的令牌 virtual bool removeTalent( int nTalentID ) = 0; // 更新技能数据 // @param pData : 除技能ID外,其他都可改变,连招用时,目前只支持同类型的技能连招 virtual void updateSpellData( SPELL_DATA * pData ) = 0; // 处理施法事件: virtual bool onSpellEvent( SPELL_EVENT nEventID,SPELL_CONTEXT * context ) = 0; // 该技能是否已经发动 virtual bool isWorking() = 0; // 取得天赋数量 virtual int getTalentCount(void) = 0; // 取得天赋数据 // @param nIndex : 天赋索引位置 virtual SPELL_TALENT *getTalentData(int nIndex) = 0; // 更新技能现场 // @param uidTarget : 目标ID // @param ptTargetTile : 目标点 virtual void updateSpellContext(UID uidTarget, Vector3 ptTargetTile) = 0; // 增加实体(需要管理的对象实体,调用此接口保存) // 因为lol中有道具有召唤怪物功能,所以此放到技能里面,对应技能管理召唤对象(一个英雄可能多个这种技能) // @param uidEntity : 实体UID // @param nMaxCount : 最大实体数量 virtual void addEntity(UID uidEntity, int nMaxCount) = 0; // 移除实体(移除管理的对象实体) // @param uidEntity : 实体UID virtual void removeEntity(UID uidEntity) = 0; // 取得槽位类型 virtual SLOT_TYPE getSlotType(void) = 0; // 取得槽位索引 virtual int getSlotIndex(void) = 0; // 获得技能数据 virtual SPELL_DATA *getSpellData(void) = 0; // 设置某个技能数值 virtual void setSpellData(SPELL_DATA_ID nIndex, int nIndexData, const char* pData) = 0; // 获取当前技能上下文 virtual SPELL_CONTEXT* getCurSpellContext() = 0; // 获取技能状态 virtual int getState() = 0; // 设置Key值 virtual void setKey(DWORD dwKey) = 0; // 获取Key值 virtual DWORD getKey(void) = 0; // 销毁技能 virtual void release() = 0; }; // ================================================================================// /** 实体部件接口,继承该接口可以挂接到实体上 注意::::::::::::::::::::::::::::::::::: 1.每个玩家都是一个独立协程,所以Part的实现中如果需要访问全局数据,一定要注意线程安全 2.一个玩家的多个Part直接互相调用是线程安全的,可以放心使用 */ // ================================================================================// struct __ISpellPart : public __IEntityPart { // 取得技能数量 virtual int getSpellCount() = 0; // 取得第一个技能 virtual ISpell *getFirstSpell(void) = 0; // 取得下一个技能 virtual ISpell *getNextSpell(void) = 0; // 查找技能 virtual ISpell * findSpell( int nSpellID ) = 0; // 添加技能 // @param nSpellID : 技能ID // @param nSlotType : 槽位类型 // @param nSlotIndex: 槽位索引 // @param nAddCoolTime: 增加冷却,有些技能技能上次升级技能冷却 virtual bool addSpell(int nSpellID, SLOT_TYPE nSlotType=SLOT_TYPE_SKILL, int nSlotIndex=SPELL_SLOT_MAX_COUNT, int nAddCoolTime = 0) = 0; // 移除技能 virtual bool removeSpell(int nSpellID) = 0; // 施法技能 virtual bool castSpell( SPELL_CONTEXT * context ) = 0; // 升级技能 // @param nSlotIndex : 槽位索引 virtual bool upgradeSpell( int nSlotIndex ) = 0; // 取得最后施法时间 virtual DWORD getLastCastTime(void) = 0; // 设置僵直时间 virtual void setRigidityTime( int nTime,int nSpellEffectType, int nCastFlag ) = 0; // 取得是否已创建实体(此函数用来知道技能和天赋改变是否需要同步客户, // 未创建实体时改变了技能和天赋通过deSerialize打包技能和天赋数据) virtual bool getCreateEntity(void) = 0; // 激活天赋(用作外部接口时,作为临时天赋 并不会判断激活条件,直接激活) // bCost需要消耗点数,有些天赋是需要金钱激活的,但用户断线重连进来,已激活的不消耗 virtual bool activeTalent(int nTalentID, bool bCost = true) = 0; // 取消天赋 virtual void deActiveTalent(int nTalentID) = 0; // 创建一个攻击对象 // @param type : 攻击类型 // @param pAttack : 攻击数据 // @param pContext: 攻击现场 // @return : 返回攻击对象序号 virtual DWORD createAttackObject( ATTACK_TYPE type,ATTACK_DATA * pAttack,SPELL_CONTEXT * pContext ) = 0; // 取得攻击对象 // @param dwSerialID : 对象序列号 // @return : 攻击对象 virtual IAttackObject *getAttackObject(DWORD dwSerialID) = 0; // 关闭攻击对象 // @param dwSerialID : 对象序列号 virtual void closeAttackObject(DWORD dwSerialID) = 0; // 增加技能点数 // @param nPoint : 技能点数 virtual void addSpellPoint(int nPoint) = 0; // 获得技能点数 // @return : 获得技能点数 virtual int getSpellPoint() = 0; // 取得技能槽等级 virtual int getSpellSlotLevel(int nSlotIndex) = 0; // 设置技能槽位 virtual void setSpellSlotLevel(int nSlotIndex, int nLevel) = 0; // 创建攻击对象序列号 virtual DWORD CreateAttackObjectSerialID(void) = 0; }; // ================================================================================// /** 技能工厂: 加载技能模版,并创建技能 */ // ================================================================================// struct ISpellFactory { // 装载脚本 // @param szDataFile : 技能数据脚本 // @param szLogicFile: 技能逻辑脚本 virtual bool Load(const char * szDataFile,const char * szLogicFile) = 0; // 获取技能配置数据 virtual SPELL_DATA * getSpellData( int nSpellID ) = 0; // 创建一个技能 virtual ISpell * createSpell( int nSpellID ) = 0; // 创建一个技能部件 virtual __ISpellPart * createSpellPart() = 0; // 执行Service的on_stop virtual void onStop(void) = 0; virtual void release() = 0; }; /////////////////////////////////////////////////////////////////////////////////////////////////////// #include "LoadLib.h" #if defined(_LIB) || defined(SPELL_STATIC_LIB) /// 静态库版本 # pragma comment(lib, MAKE_LIB_NAME(Spell)) extern "C" ISpellFactory * CreateSpellFactory(); # define CreateSpellFactoryProc CreateSpellFactory #else /// 动态库版本 typedef ISpellFactory * (RKT_CDECL * procCreateSpellFactory)(); # define CreateSpellFactoryProc DllApi<procCreateSpellFactory>::load(MAKE_DLL_NAME(Spell), "CreateSpellFactory") #endif
[ "85789685@qq.com" ]
85789685@qq.com
aa7caff6a9ce929f4bb0dab6dd7e33c811df6177
8a4f5627b58aa54fd6a549f90b3c79b6e285c638
/C++/Longest Common Subsequence/print_shortest_common_supersequence.cpp
5fc26a24d862665a8807756088ceef6beff88a03
[]
no_license
MrChepe09/Dynamic-Programming-Series
334f24af4f834f88840bf5222746d2b7452a33ee
d49e5bd7cb329b0b0f1382eb8627ba0427383499
refs/heads/master
2022-11-29T09:40:01.065561
2020-08-07T05:15:21
2020-08-07T05:15:21
283,384,811
1
0
null
null
null
null
UTF-8
C++
false
false
1,224
cpp
#include<bits/stdc++.h> using namespace std; void printscs(string a, string b){ int m = a.length(); int n = b.length(); int dp[n+1][m+1]; for(int i=0; i<=m; i++){ for(int j=0; j<=n; j++){ if(i==0 || j==0){ dp[i][j] = 0; } else if(a[i-1]==b[j-1]){ dp[i][j] = 1 + dp[i-1][j-1]; } else{ dp[i][j] = max(dp[i-1][j], dp[i][j-1]); } } } int i, j; string res = ""; //dp = lcs(a, b); i = a.length(); j = b.length(); while(i>0 && j>0){ if(a[i-1] == b[j-1]){ res += a[i-1]; i = i-1; j = j-1; } else { if(dp[i-1][j]>dp[i][j-1]){ res += a[i-1]; i = i-1; } else { res += b[j-1]; j = j-1; } } } while(i>0){ res += a[i-1]; i--; } while(j>0){ res += b[j-1]; j--; } reverse(res.begin(), res.end()); cout<<res<<'\n'; } int main(){ int test; string a, b; cin>>test; while(test--){ cin>>a; cin>>b; printscs(a, b); } }
[ "khanujabhupinder09@gmail.com" ]
khanujabhupinder09@gmail.com
35f45a1edbf9a8ad8529413e5ade2792d65c8776
52dc9080af88c00222cc9b37aa08c35ff3cafe86
/1100/40/1148a.cpp
6cae6296c8c1d1ba0b79df37e0a6adf9aff697a6
[ "Unlicense" ]
permissive
shivral/cf
1c1acde25fc6af775acaeeb6b5fe5aa9bbcfd4d2
d7be128c3a9adb014a231a399f1c5f19e1ab2a38
refs/heads/master
2023-03-20T01:29:25.559828
2021-03-05T08:30:30
2021-03-05T08:30:30
null
0
0
null
null
null
null
UTF-8
C++
false
false
326
cpp
#include <iostream> void answer(size_t v) { std::cout << v << '\n'; } void solve(size_t a, size_t b, size_t c) { const size_t d = std::min(a, b); a -= d, b -= d; answer((b > 0) + (c + d) * 2 + (a > 0)); } int main() { size_t a, b, c; std::cin >> a >> b >> c; solve(a, b, c); return 0; }
[ "5691735+actium@users.noreply.github.com" ]
5691735+actium@users.noreply.github.com
0100bc3677aa5a07ed95c1dedb295fa0b7e086be
6f8db19fbc8f1f0d14251d47c6cec03fee6b21d7
/LetterEditor/main.cpp
9bb2ed669c6c937b1240651778e298e99bd26e1f
[]
no_license
sebastienbrg/ReadLearnWrite
348b121d16240b802607e88beec3680e30013202
661508a52fbb2f39ba370406cc6c41f7ed03f623
refs/heads/master
2020-04-02T06:07:41.975409
2018-11-20T12:33:21
2018-11-20T12:33:21
154,130,694
0
0
null
null
null
null
UTF-8
C++
false
false
445
cpp
#include <QGuiApplication> #include <QQmlApplicationEngine> #include "pathmodel.h" int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication app(argc, argv); QQmlApplicationEngine engine; qmlRegisterType<PathModel>("pathmodel", 1, 0, "PathModel"); engine.load(QUrl("./main.qml")); if (engine.rootObjects().isEmpty()) return -1; return app.exec(); }
[ "sebastien.berge@vossloh.com" ]
sebastien.berge@vossloh.com
fefd48271de7b2f16a32bedbbcaaf52d7397254c
7e5603e4fa6df95506eb7ab25b934c3922281d0b
/src/Tweener.cpp
7383c19a5f32bb6b28101c5559e31d359af8c0d3
[ "MIT" ]
permissive
johndpope/GIRenderer
344168021ccae09800a3f43943f2036c5d948dd2
3856c2455b668d16c0bf41d453be895a39053217
refs/heads/master
2021-06-10T01:30:02.117024
2016-09-26T14:47:30
2016-09-26T14:47:30
null
0
0
null
null
null
null
UTF-8
C++
false
false
335
cpp
// // Created by inosphe on 2016. 9. 21.. // #include "Tweener.h" Tweener::Tweener(glm::vec3 v0, glm::vec3 v1, float time):m_v0(v0), m_v1(v1), m_time(time) { } void Tweener::Update(float dt) { m_t += dt; if(m_t >= m_time) m_t -= m_time; } glm::vec3 Tweener::GetValue() { float t = m_t/m_time; return m_v0 + (m_v1-m_v0)*t; }
[ "inosphe@gmail.com" ]
inosphe@gmail.com
e85b29e4903ff033afb4e6cd76144d1a0228c1c8
4500e857477f7f763f17c0fa0f59450457f3a46c
/src/math/lp/nla_order_lemmas.h
24b7b2cb4df4fec2688ab436c6a985c88ae5dc28
[ "MIT" ]
permissive
copumpkin/z3
1cc2c8977c9a7692d01a2598632870d73dba4c3b
785c9a18cab28b9adfc71ec981f7452fd65279fd
refs/heads/master
2022-04-22T19:32:53.727110
2020-04-24T18:58:48
2020-04-24T18:58:48
258,669,037
1
1
NOASSERTION
2020-04-25T02:20:48
2020-04-25T02:20:48
null
UTF-8
C++
false
false
3,170
h
/*++ Copyright (c) 2017 Microsoft Corporation Module Name: <name> Abstract: <abstract> Author: Nikolaj Bjorner (nbjorner) Lev Nachmanson (levnach) Revision History: --*/ #pragma once #include "math/lp/factorization.h" #include "math/lp/nla_common.h" namespace nla { class core; class order: common { public: order(core *c) : common(c) {} void order_lemma(); private: bool order_lemma_on_ac_and_bc_and_factors(const monic& ac, const factor& a, const factor& c, const monic& bc, const factor& b); // a >< b && c > 0 => ac >< bc // a >< b && c < 0 => ac <> bc // ac[k] plays the role of c bool order_lemma_on_ac_and_bc(const monic& rm_ac, const factorization& ac_f, bool k, const monic& rm_bd); bool order_lemma_on_ac_explore(const monic& rm, const factorization& ac, bool k); void order_lemma_on_factorization(const monic& rm, const factorization& ab); /** \brief Add lemma: a > 0 & b <= value(b) => sign*ab <= value(b)*a if value(a) > 0 a < 0 & b >= value(b) => sign*ab <= value(b)*a if value(a) < 0 */ void order_lemma_on_ab_gt(const monic& m, const rational& sign, lpvar a, lpvar b); // we need to deduce ab >= val(b)*a /** \brief Add lemma: a > 0 & b >= value(b) => sign*ab >= value(b)*a if value(a) > 0 a < 0 & b <= value(b) => sign*ab >= value(b)*a if value(a) < 0 */ void order_lemma_on_ab_lt(const monic& m, const rational& sign, lpvar a, lpvar b); void order_lemma_on_ab(const monic& m, const rational& sign, lpvar a, lpvar b, bool gt); void order_lemma_on_factor_binomial_explore(const monic& m, bool k); void order_lemma_on_factor_binomial_rm(const monic& ac, bool k, const monic& bd); void order_lemma_on_binomial_ac_bd(const monic& ac, bool k, const monic& bd, const factor& b, lpvar d); void order_lemma_on_binomial_sign(const monic& ac, lpvar x, lpvar y, int sign); void order_lemma_on_binomial(const monic& ac); void order_lemma_on_monic(const monic& rm); void generate_ol(const monic& ac, const factor& a, const factor& c, const monic& bc, const factor& b); void generate_ol_eq(const monic& ac, const factor& a, const factor& c, const monic& bc, const factor& b); void generate_mon_ol(const monic& ac, lpvar a, const rational& c_sign, lpvar c, const monic& bd, const factor& b, const rational& d_sign, lpvar d, llc ab_cmp); }; }
[ "levnach@hotmail.com" ]
levnach@hotmail.com
d38ee4f55861e8f318fb3a029766703563e1d828
5b31026105843fc6a6a0c542f3dd4e59ca3a27e1
/ddimon/DdiMon/inject.cpp
04fe6ccc465adaa0e741eb1201ec14cbbb0ec484
[ "MIT" ]
permissive
fIappy/Syscall-Monitor
a7e35444e1fc1e23f1d881b4dc3cf080b33ea646
fb391fbc2ac09daeb9bf35317565ef36da4c38c6
refs/heads/master
2021-06-18T03:27:16.821143
2021-06-15T16:27:08
2021-06-15T16:27:08
260,613,717
1
0
null
2020-05-02T04:30:52
2020-05-02T04:30:51
null
UTF-8
C++
false
false
24,354
cpp
#include <ntifs.h> #include <Ntstrsafe.h> #include "NativeEnums.h" #include "NativeStructs.h" #include "PEStructs.h" #include "main.h" #pragma warning(disable : 4311) #pragma warning(disable : 4302) EXTERN_C{ UNICODE_STRING m_GlobalInject = { 0 }; #ifdef AMD64 UNICODE_STRING m_GlobalInject64 = { 0 }; #endif extern DYNAMIC_DATA dynData; typedef NTSTATUS(*fnNtTerminateThread)(HANDLE ProcessHandle, NTSTATUS ExitStatus); typedef NTSTATUS(*fnNtProtectVirtualMemory)(HANDLE ProcessHandle, PVOID* BaseAddress, SIZE_T* NumberOfBytesToProtect, ULONG NewAccessProtection, PULONG OldAccessProtection); typedef NTSTATUS(*fnNtWriteVirtualMemory)(HANDLE ProcessHandle, PVOID BaseAddress, PVOID Buffer, ULONG BufferLength, PULONG ReturnLength); typedef NTSTATUS(*fnNtReadVirtualMemory)(HANDLE ProcessHandle, PVOID BaseAddress, PVOID Buffer, ULONG BufferLength, PULONG ReturnLength); typedef NTSTATUS(*fnNtQueryVirtualMemory)(HANDLE ProcessHandle, PVOID BaseAddress, MEMORY_INFORMATION_CLASS_EX MemoryInformationClass, PVOID MemoryInformation, SIZE_T MemoryInformationLength, PSIZE_T ReturnLength); typedef NTSTATUS(*fnNtCreateThreadEx)(OUT PHANDLE hThread, IN ACCESS_MASK DesiredAccess, IN PVOID ObjectAttributes, IN HANDLE ProcessHandle, IN PVOID lpStartAddress, IN PVOID lpParameter, IN ULONG Flags, IN SIZE_T StackZeroBits, IN SIZE_T SizeOfStackCommit, IN SIZE_T SizeOfStackReserve, OUT PVOID lpBytesBuffer); NTKERNELAPI PVOID NTAPI PsGetProcessPeb(PEPROCESS Process); #ifdef AMD64 NTKERNELAPI PVOID NTAPI PsGetProcessWow64Process(PEPROCESS Process); #endif typedef struct _INJECT_BUFFER { UCHAR code[0x200]; UCHAR original_code[8]; PVOID hook_func; union { UNICODE_STRING path; UNICODE_STRING32 path32; }; wchar_t buffer[488]; PVOID module; } INJECT_BUFFER, *PINJECT_BUFFER; PVOID GetSSDTEntry(IN ULONG index); static PVOID PsNtDllBase = NULL; static PVOID fnLdrLoadDll = NULL; static PVOID fnProtectVirtualMemory = NULL; static PVOID fnHookFunc = NULL; #ifdef AMD64 static PVOID PsNtDllBase64 = NULL; static PVOID fnLdrLoadDll64 = NULL; static PVOID fnProtectVirtualMemory64 = NULL; static PVOID fnHookFunc64 = NULL; #endif PINJECT_BUFFER GetInlineHookCode(IN HANDLE hProcess, IN PUNICODE_STRING pDllPath); PINJECT_BUFFER GetInlineHookCode64(IN HANDLE hProcess, IN PUNICODE_STRING pDllPath); PVOID GetModuleExport(IN PVOID pBase, IN PCCHAR name_ord); #pragma alloc_text(PAGE, GetInlineHookCode) #pragma alloc_text(PAGE, GetInlineHookCode64) #pragma alloc_text(PAGE, GetModuleExport) NTSTATUS NTAPI NewZwTerminateThread(_In_opt_ HANDLE ThreadHandle, _In_ NTSTATUS ExitStatus) { NTSTATUS status = STATUS_SUCCESS; fnNtTerminateThread pfnNtTerminateThread; if (dynData.NtTermThrdIndex == 0) return STATUS_NOT_FOUND; pfnNtTerminateThread = (fnNtTerminateThread)(ULONG_PTR)GetSSDTEntry(dynData.NtTermThrdIndex); if (pfnNtTerminateThread) { PUCHAR pPrevMode = (PUCHAR)PsGetCurrentThread() + dynData.PrevMode; UCHAR prevMode = *pPrevMode; *pPrevMode = KernelMode; status = pfnNtTerminateThread(ThreadHandle, ExitStatus); *pPrevMode = prevMode; } else status = STATUS_NOT_FOUND; return status; } NTSTATUS NTAPI NewZwQueryVirtualMemory(HANDLE ProcessHandle, PVOID BaseAddress, MEMORY_INFORMATION_CLASS_EX MemoryInformationClass, PVOID MemoryInformation, SIZE_T MemoryInformationLength, PSIZE_T ReturnLength) { NTSTATUS status = STATUS_SUCCESS; fnNtQueryVirtualMemory pfnNtQueryVirtualMemory; if (dynData.NtQueryIndex == 0) return STATUS_NOT_FOUND; pfnNtQueryVirtualMemory = (fnNtQueryVirtualMemory)(ULONG_PTR)GetSSDTEntry(dynData.NtQueryIndex); if (pfnNtQueryVirtualMemory) { PUCHAR pPrevMode = (PUCHAR)PsGetCurrentThread() + dynData.PrevMode; UCHAR prevMode = *pPrevMode; *pPrevMode = KernelMode; status = pfnNtQueryVirtualMemory(ProcessHandle, BaseAddress, MemoryInformationClass, MemoryInformation, MemoryInformationLength, ReturnLength); *pPrevMode = prevMode; } else status = STATUS_NOT_FOUND; return status; } NTSTATUS NTAPI NewNtReadVirtualMemory(IN HANDLE ProcessHandle, IN PVOID BaseAddress, IN PVOID Buffer, IN ULONG BufferLength, OUT PULONG ReturnLength OPTIONAL) { NTSTATUS status = STATUS_SUCCESS; fnNtReadVirtualMemory pfnNtReadVirtualMemory; if (dynData.NtReadIndex == 0) return STATUS_NOT_FOUND; pfnNtReadVirtualMemory = (fnNtReadVirtualMemory)(ULONG_PTR)GetSSDTEntry(dynData.NtReadIndex); if (pfnNtReadVirtualMemory) { PUCHAR pPrevMode = (PUCHAR)PsGetCurrentThread() + dynData.PrevMode; UCHAR prevMode = *pPrevMode; *pPrevMode = KernelMode; status = pfnNtReadVirtualMemory(ProcessHandle, BaseAddress, Buffer, BufferLength, ReturnLength); *pPrevMode = prevMode; } else status = STATUS_NOT_FOUND; return status; } NTSTATUS NTAPI NewNtWriteVirtualMemory(IN HANDLE ProcessHandle, IN PVOID BaseAddress, IN PVOID Buffer, IN ULONG BufferLength, OUT PULONG ReturnLength OPTIONAL) { NTSTATUS status = STATUS_SUCCESS; fnNtWriteVirtualMemory pfnNtWriteVirtualMemory; if (dynData.NtWriteIndex == 0) return STATUS_NOT_FOUND; pfnNtWriteVirtualMemory = (fnNtWriteVirtualMemory)(ULONG_PTR)GetSSDTEntry(dynData.NtWriteIndex); if (pfnNtWriteVirtualMemory) { PUCHAR pPrevMode = (PUCHAR)PsGetCurrentThread() + dynData.PrevMode; UCHAR prevMode = *pPrevMode; *pPrevMode = KernelMode; status = pfnNtWriteVirtualMemory(ProcessHandle, BaseAddress, Buffer, BufferLength, ReturnLength); *pPrevMode = prevMode; } else status = STATUS_NOT_FOUND; return status; } NTSTATUS NTAPI NewNtProtectVirtualMemory(IN HANDLE ProcessHandle, IN PVOID* BaseAddress, IN SIZE_T* NumberOfBytesToProtect, IN ULONG NewAccessProtection, OUT PULONG OldAccessProtection) { NTSTATUS status = STATUS_SUCCESS; fnNtProtectVirtualMemory pfnNtProtectVirtualMemory; if (dynData.NtProtectIndex == 0) return STATUS_NOT_FOUND; pfnNtProtectVirtualMemory = (fnNtProtectVirtualMemory)(ULONG_PTR)GetSSDTEntry(dynData.NtProtectIndex); if (pfnNtProtectVirtualMemory) { PUCHAR pPrevMode = (PUCHAR)PsGetCurrentThread() + dynData.PrevMode; UCHAR prevMode = *pPrevMode; *pPrevMode = KernelMode; status = pfnNtProtectVirtualMemory(ProcessHandle, BaseAddress, NumberOfBytesToProtect, NewAccessProtection, OldAccessProtection); *pPrevMode = prevMode; } else status = STATUS_NOT_FOUND; return status; } /* PVOID AllocateInjectMemory(IN HANDLE ProcessHandle, IN PVOID DesiredAddress, IN SIZE_T DesiredSize) { MEMORY_BASIC_INFORMATION mbi; SIZE_T AllocateSize = DesiredSize; if ((ULONG_PTR)DesiredAddress >= 0x70000000 && (ULONG_PTR)DesiredAddress < 0x80000000) DesiredAddress = (PVOID)0x70000000; while (1) { if (!NT_SUCCESS(NewZwQueryVirtualMemory(ProcessHandle, DesiredAddress, MemoryBasicInformationEx, &mbi, sizeof(mbi), NULL))) return NULL; if (DesiredAddress != mbi.AllocationBase) { DesiredAddress = mbi.AllocationBase; } else { DesiredAddress = (PVOID)((ULONG_PTR)mbi.AllocationBase - 0x10000); } if (mbi.State == MEM_FREE) { if (NT_SUCCESS(ZwAllocateVirtualMemory(ProcessHandle, &mbi.BaseAddress, 0, &AllocateSize, MEM_RESERVE, PAGE_EXECUTE_READWRITE))) { if (NT_SUCCESS(ZwAllocateVirtualMemory(ProcessHandle, &mbi.BaseAddress, 0, &AllocateSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE))) { return mbi.BaseAddress; } } } } return NULL; } const UCHAR HookCode[] = { 0x55, // push ebp 0x8B, 0xEC, // mov ebp,esp 0x83, 0xEC, 0x0C, // sub esp,0Ch 0xA1, 0, 0, 0, 0, // mov eax,dword ptr[fnHookFunc] //offset +7 0x89, 0x45, 0xF4, // mov dword ptr[ebp-0Ch],eax 0x8D, 0x45, 0xFC, // lea eax,[ebp - 4] 0x50, // push eax 0x6A, 0x40, // push 40h 0x8D, 0x45, 0xF8, // lea eax,[ebp - 8] 0xC7, 0x45, 0xF8, 5, 0, 0, 0, // mov dword ptr[ebp - 8],5 0x50, // push eax 0x8D, 0x45, 0xF4, // lea eax,[ebp - 0Ch] 0x50, // push eax 0x6A, 0xFF, // push 0FFFFFFFFh 0xE8, 0, 0, 0, 0, // call NtProtectVirtualMemory //offset +38 0x8B, 0x0D, 0, 0, 0, 0, // mov ecx,dword ptr ds : [fnHookFunc] //offset + 44 0xA1, 0, 0, 0, 0, // mov eax,dword ptr ds : [fnOriCode] //offset + 49 0x89, 0x01, // mov dword ptr[ecx],eax 0xA0, 0, 0, 0, 0, // mov al,byte ptr ds : [fnOriCode+4] //offset +56 0x88, 0x41, 0x04, // mov byte ptr[ecx + 4],al 0x8D, 0x45, 0xFC, // lea eax,[ebp-4] 0x50, // push eax 0xFF, 0x75, 0xFC, // push dword ptr[ebp-4] 0x8D, 0x45, 0xF8, // lea eax,[ebp - 8] 0x50, // push eax 0x8D, 0x45, 0xF4, // lea eax,[ebp - 0Ch] 0x50, // push eax 0x6A, 0xFF, // push 0FFFFFFFFh 0xE8, 0, 0, 0, 0, // call NtProtectVirtualMemory //offset +81 0x68, 0, 0, 0, 0, // push ModuleHandle //offset +86 0x68, 0, 0, 0, 0, // push ModuleFileName //offset +91 0x6A, 0, // push 0 0x6A, 0, // push 0 0xE8, 0, 0, 0, 0, // call LdrLoadDll //offset +100 0x8B, 0xE5, // mov esp,ebp 0x5D, // pop ebp 0xE9, 0, 0, 0, 0, // jmp //offset+108 0xCC, // padding }; PINJECT_BUFFER GetInlineHookCode(IN HANDLE ProcessHandle, IN PUNICODE_STRING pDllPath) { NTSTATUS status = STATUS_UNSUCCESSFUL; PINJECT_BUFFER pBuffer = NULL; INJECT_BUFFER Buffer = { 0 }; //Try to allocate before ntdll.dll pBuffer = (PINJECT_BUFFER)AllocateInjectMemory(ProcessHandle, (PVOID)PsNtDllBase, PAGE_SIZE); if (pBuffer != NULL) { status = NewNtReadVirtualMemory(ProcessHandle, fnHookFunc, Buffer.original_code, sizeof(Buffer.original_code), NULL); if (NT_SUCCESS(status)) { // Fill data Buffer.path32.Length = min(pDllPath->Length, sizeof(Buffer.buffer)); Buffer.path32.MaximumLength = min(pDllPath->MaximumLength, sizeof(Buffer.buffer)); Buffer.path32.Buffer = (ULONG)pBuffer->buffer; Buffer.hook_func = fnHookFunc; memcpy(Buffer.buffer, pDllPath->Buffer, Buffer.path32.Length); memcpy(Buffer.code, HookCode, sizeof(HookCode)); // Fill code *(DWORD*)((PUCHAR)Buffer.code + 7) = (DWORD)&pBuffer->hook_func; *(DWORD*)((PUCHAR)Buffer.code + 38) = (DWORD)((DWORD)fnProtectVirtualMemory - ((DWORD)pBuffer + 42)); *(DWORD*)((PUCHAR)Buffer.code + 44) = (DWORD)&pBuffer->hook_func; *(DWORD*)((PUCHAR)Buffer.code + 49) = (DWORD)pBuffer->original_code; *(DWORD*)((PUCHAR)Buffer.code + 56) = (DWORD)pBuffer->original_code + 4; *(DWORD*)((PUCHAR)Buffer.code + 81) = (DWORD)((DWORD)fnProtectVirtualMemory - ((DWORD)pBuffer + 85)); *(DWORD*)((PUCHAR)Buffer.code + 86) = (DWORD)&pBuffer->module; *(DWORD*)((PUCHAR)Buffer.code + 91) = (DWORD)&pBuffer->path32; *(DWORD*)((PUCHAR)Buffer.code + 100) = (DWORD)((DWORD)fnLdrLoadDll - ((DWORD)pBuffer + 104)); *(DWORD*)((PUCHAR)Buffer.code + 108) = (DWORD)((DWORD)fnHookFunc - ((DWORD)pBuffer + 112)); // Copy all NewNtWriteVirtualMemory(ProcessHandle, pBuffer, &Buffer, sizeof(Buffer), NULL); return pBuffer; } else { DbgPrint("%s: Failed to read original code %X\n", __FUNCTION__, status); } } else { DbgPrint("%s: Failed to allocate memory\n", __FUNCTION__); } return NULL; } #ifdef AMD64 const UCHAR HookCode64[] = { 0x50, // push rax 0x51, // push rcx 0x52, // push rdx 0x41, 0x50, // push r8 0x41, 0x51, // push r9 0x41, 0x53, // push r11 0x48, 0x83, 0xEC, 0x38, // sub rsp,38h 0x48, 0x8B, 0x05, 0, 0, 0, 0, // mov rax,qword ptr [fnHookPort] offset+16 0x4C, 0x8D, 0x44, 0x24, 0x48, // lea r8,[rsp + 48h] 0x48, 0x89, 0x44, 0x24, 0x50, // mov qword ptr [rsp+50h],rax 0x48, 0x8D, 0x54, 0x24, 0x50, // lea rdx,[rsp + 50h] 0x48, 0x8D, 0x44, 0x24, 0x40, // lea rax,[rsp + 40h] 0x48, 0xC7, 0x44, 0x24, 0x48, // mov qword ptr[rsp + 48h],5 5, 0, 0, 0, 0x41, 0xB9, 0x40, 0, 0, 0, // mov r9d,40h 0x48, 0x89, 0x44, 0x24, 0x20, // mov qword ptr[rsp + 20h],rax 0x48, 0x83, 0xC9, 0xFF, // or rcx, 0FFFFFFFFFFFFFFFFh 0xE8, 0, 0, 0, 0, // call fnProtectVirtualMemory offset +65 0x8B, 0x05, 0, 0, 0, 0, // mov eax,dword ptr[fnOriCode] offset+71 0x4C, 0x8D, 0x44, 0x24, 0x48, // lea r8,[rsp + 48h] 0x48, 0x8B, 0x15, 0, 0, 0, 0, // mov rdx,qword ptr[fnHookPort] offset+83 0x48, 0x83, 0xC9, 0xFF, // or rcx, 0FFFFFFFFFFFFFFFFh 0x89, 0x02, // mov dword ptr[rdx],eax 0x0F, 0xB6, 0x05, 0, 0, 0, 0, // movzx eax,byte ptr[fnOriCode+4] offset+96 0x88, 0x42, 0x04, // mov byte ptr[rdx + 4],al 0x48, 0x8D, 0x44, 0x24, 0x40, // lea rax,[rsp + 40h] 0x44, 0x8B, 0x4C, 0x24, 0x40, // mov r9d,dword ptr[rsp + 40h] 0x48, 0x8D, 0x54, 0x24, 0x50, // lea rdx,[rsp + 50h] 0x48, 0x89, 0x44, 0x24, 0x20, // mov qword ptr [rsp+20h],rax 0xE8, 0, 0, 0, 0, // call fnProtectVirtualMemory offset +124 0x4C, 0x8D, 0x0D, 0, 0, 0, 0, // lea r9,qword ptr [pModuleHandle] offset+131 0x33, 0xD2, // xor edx,edx 0x4C, 0x8D, 0x05, 0, 0, 0, 0, // lea r8,qword ptr [pModuleName] offset+140 0x33, 0xC9, // xor ecx,ecx 0xE8, 0, 0, 0, 0, // call fnLdrLoadDll offset +147 0x48, 0x83, 0xC4, 0x38, // add rsp,38h 0x41, 0x5B, // pop r11 0x41, 0x59, // pop r9 0x41, 0x58, // pop r8 0x5A, // pop rdx 0x59, // pop rcx 0x58, // pop rax 0xE9, 0, 0, 0, 0, // jmp OriFunc offset+165 0xCC, // padding }; PINJECT_BUFFER GetInlineHookCode64(IN HANDLE ProcessHandle, IN PUNICODE_STRING pDllPath) { NTSTATUS status = STATUS_UNSUCCESSFUL; PINJECT_BUFFER pBuffer = NULL; INJECT_BUFFER Buffer = { 0 }; //Try to allocate before ntdll.dll pBuffer = (PINJECT_BUFFER)AllocateInjectMemory(ProcessHandle, (PVOID)PsNtDllBase64, PAGE_SIZE); if (pBuffer != NULL) { status = NewNtReadVirtualMemory(ProcessHandle, fnHookFunc64, Buffer.original_code, sizeof(Buffer.original_code), NULL); if (NT_SUCCESS(status)) { // Fill data Buffer.path.Length = min(pDllPath->Length, sizeof(Buffer.buffer)); Buffer.path.MaximumLength = min(pDllPath->MaximumLength, sizeof(Buffer.buffer)); Buffer.path.Buffer = (PWCH)pBuffer->buffer; Buffer.hook_func = fnHookFunc64; memcpy(Buffer.buffer, pDllPath->Buffer, Buffer.path.Length); memcpy(Buffer.code, HookCode64, sizeof(HookCode64)); // Fill code *(ULONG*)((PUCHAR)Buffer.code + 16) = (ULONG)((ULONGLONG)&pBuffer->hook_func - ((ULONGLONG)pBuffer + 20)); *(ULONG*)((PUCHAR)Buffer.code + 65) = (ULONG)((ULONGLONG)fnProtectVirtualMemory64 - ((ULONGLONG)pBuffer + 69)); *(ULONG*)((PUCHAR)Buffer.code + 71) = (ULONG)((ULONGLONG)pBuffer->original_code - ((ULONGLONG)pBuffer + 75)); *(ULONG*)((PUCHAR)Buffer.code + 83) = (ULONG)((ULONGLONG)&pBuffer->hook_func - ((ULONGLONG)pBuffer + 87)); *(ULONG*)((PUCHAR)Buffer.code + 96) = (ULONG)((ULONGLONG)(pBuffer->original_code + 4) - ((ULONGLONG)pBuffer + 100)); *(ULONG*)((PUCHAR)Buffer.code + 124) = (ULONG)((ULONGLONG)fnProtectVirtualMemory64 - ((ULONGLONG)pBuffer + 128)); *(ULONG*)((PUCHAR)Buffer.code + 131) = (ULONG)((ULONGLONG)&pBuffer->module - ((ULONGLONG)pBuffer + 135)); *(ULONG*)((PUCHAR)Buffer.code + 140) = (ULONG)((ULONGLONG)&pBuffer->path - ((ULONGLONG)pBuffer + 144)); *(ULONG*)((PUCHAR)Buffer.code + 147) = (ULONG)((ULONGLONG)fnLdrLoadDll64 - ((ULONGLONG)pBuffer + 151)); *(ULONG*)((PUCHAR)Buffer.code + 165) = (ULONG)((ULONGLONG)fnHookFunc64 - ((ULONGLONG)pBuffer + 169)); //Write all NewNtWriteVirtualMemory(ProcessHandle, pBuffer, &Buffer, sizeof(Buffer), NULL); return pBuffer; } else { DbgPrint("%s: Failed to read original code %X\n", __FUNCTION__, status); } } else { DbgPrint("%s: Failed to allocate memory\n", __FUNCTION__); } return NULL; } #endif PVOID GetModuleExport(IN PVOID pBase, IN PCCHAR name_ord) { PIMAGE_DOS_HEADER pDosHdr = (PIMAGE_DOS_HEADER)pBase; PIMAGE_NT_HEADERS32 pNtHdr32 = NULL; PIMAGE_NT_HEADERS64 pNtHdr64 = NULL; PIMAGE_EXPORT_DIRECTORY pExport = NULL; ULONG expSize = 0; ULONG_PTR pAddress = 0; PUSHORT pAddressOfOrds; PULONG pAddressOfNames; PULONG pAddressOfFuncs; ULONG i; ASSERT(pBase != NULL); if (pBase == NULL) return NULL; /// Not a PE file if (pDosHdr->e_magic != IMAGE_DOS_SIGNATURE) return NULL; pNtHdr32 = (PIMAGE_NT_HEADERS32)((PUCHAR)pBase + pDosHdr->e_lfanew); pNtHdr64 = (PIMAGE_NT_HEADERS64)((PUCHAR)pBase + pDosHdr->e_lfanew); // Not a PE file if (pNtHdr32->Signature != IMAGE_NT_SIGNATURE) return NULL; // 64 bit image if (pNtHdr32->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC) { pExport = (PIMAGE_EXPORT_DIRECTORY)(pNtHdr64->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress + (ULONG_PTR)pBase); expSize = pNtHdr64->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size; } // 32 bit image else { pExport = (PIMAGE_EXPORT_DIRECTORY)(pNtHdr32->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress + (ULONG_PTR)pBase); expSize = pNtHdr32->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size; } pAddressOfOrds = (PUSHORT)(pExport->AddressOfNameOrdinals + (ULONG_PTR)pBase); pAddressOfNames = (PULONG)(pExport->AddressOfNames + (ULONG_PTR)pBase); pAddressOfFuncs = (PULONG)(pExport->AddressOfFunctions + (ULONG_PTR)pBase); for (i = 0; i < pExport->NumberOfFunctions; ++i) { USHORT OrdIndex = 0xFFFF; PCHAR pName = NULL; // Find by index if ((ULONG_PTR)name_ord <= 0xFFFF) { OrdIndex = (USHORT)i; } // Find by name else if ((ULONG_PTR)name_ord > 0xFFFF && i < pExport->NumberOfNames) { pName = (PCHAR)(pAddressOfNames[i] + (ULONG_PTR)pBase); OrdIndex = pAddressOfOrds[i]; } // Weird params else return NULL; if (((ULONG_PTR)name_ord <= 0xFFFF && (USHORT)((ULONG_PTR)name_ord) == OrdIndex + pExport->Base) || ((ULONG_PTR)name_ord > 0xFFFF && strcmp(pName, name_ord) == 0)) { pAddress = pAddressOfFuncs[OrdIndex] + (ULONG_PTR)pBase; // Check forwarded export if (pAddress >= (ULONG_PTR)pExport && pAddress <= (ULONG_PTR)pExport + expSize) { return NULL; } break; } } return (PVOID)pAddress; } NTSTATUS InjectByHook(HANDLE ProcessId, PVOID ImageBase, PUNICODE_STRING pDllPath) { ULONG ReturnLength; NTSTATUS status = STATUS_UNSUCCESSFUL; PEPROCESS Process = NULL; HANDLE ProcessHandle = NULL; if (!PsNtDllBase) PsNtDllBase = ImageBase; status = PsLookupProcessByProcessId((HANDLE)ProcessId, &Process); if (NT_SUCCESS(status)) { status = ObOpenObjectByPointer(Process, OBJ_KERNEL_HANDLE, NULL, PROCESS_ALL_ACCESS, NULL, KernelMode, &ProcessHandle); if (NT_SUCCESS(status)) { status = STATUS_UNSUCCESSFUL; if (!fnLdrLoadDll || !fnHookFunc || !fnProtectVirtualMemory) { KAPC_STATE kApc; KeStackAttachProcess(Process, &kApc); fnProtectVirtualMemory = GetModuleExport(ImageBase, "ZwProtectVirtualMemory"); fnLdrLoadDll = GetModuleExport(ImageBase, "LdrLoadDll"); fnHookFunc = GetModuleExport(ImageBase, "ZwTestAlert"); KeUnstackDetachProcess(&kApc); } if (fnLdrLoadDll && fnHookFunc && fnProtectVirtualMemory) { PINJECT_BUFFER pBuffer = GetInlineHookCode(ProcessHandle, pDllPath); if (pBuffer) { UCHAR trampo[] = { 0xE9, 0, 0, 0, 0 }; ULONG OldProtect = 0; PVOID ProtectAddress = fnHookFunc; SIZE_T ProtectSize = sizeof(trampo); *(DWORD *)(trampo + 1) = (DWORD)((DWORD)pBuffer->code - ((DWORD)fnHookFunc + 5)); status = NewNtProtectVirtualMemory(ProcessHandle, &ProtectAddress, &ProtectSize, PAGE_EXECUTE_READWRITE, &OldProtect); if (NT_SUCCESS(status)) { NewNtWriteVirtualMemory(ProcessHandle, fnHookFunc, trampo, sizeof(trampo), &ReturnLength); NewNtProtectVirtualMemory(ProcessHandle, &ProtectAddress, &ProtectSize, OldProtect, &OldProtect); } } } ZwClose(ProcessHandle); } ObDereferenceObject(Process); } return status; } #ifdef AMD64 NTSTATUS InjectByHook64(HANDLE ProcessId, PVOID ImageBase, PUNICODE_STRING pDllPath) { ULONG ReturnLength; NTSTATUS status = STATUS_UNSUCCESSFUL; PEPROCESS Process = NULL; HANDLE ProcessHandle = NULL; if (!PsNtDllBase64) PsNtDllBase64 = ImageBase; status = PsLookupProcessByProcessId((HANDLE)ProcessId, &Process); if (NT_SUCCESS(status)) { //Do not inject WOW64 process status = STATUS_UNSUCCESSFUL; if (PsGetProcessWow64Process(Process) == NULL) { status = ObOpenObjectByPointer(Process, OBJ_KERNEL_HANDLE, NULL, PROCESS_ALL_ACCESS, NULL, KernelMode, &ProcessHandle); if (NT_SUCCESS(status)) { KAPC_STATE kApc; if (!fnLdrLoadDll64 || !fnHookFunc64 || !fnProtectVirtualMemory64) { KeStackAttachProcess(Process, &kApc); fnProtectVirtualMemory64 = GetModuleExport(ImageBase, "ZwProtectVirtualMemory"); fnLdrLoadDll64 = GetModuleExport(ImageBase, "LdrLoadDll"); fnHookFunc64 = GetModuleExport(ImageBase, "ZwTestAlert"); KeUnstackDetachProcess(&kApc); } status = STATUS_UNSUCCESSFUL; if (fnLdrLoadDll64 && fnHookFunc64 && fnProtectVirtualMemory64) { PINJECT_BUFFER pBuffer = GetInlineHookCode64(ProcessHandle, pDllPath); if (pBuffer) { UCHAR trampo[] = { 0xE9, 0, 0, 0, 0 }; ULONG OldProtect = 0; PVOID ProtectAddress = fnHookFunc64; SIZE_T ProtectSize = sizeof(trampo); *(DWORD *)(trampo + 1) = (DWORD)((ULONG_PTR)pBuffer->code - ((ULONG_PTR)fnHookFunc64 + 5)); status = NewNtProtectVirtualMemory(ProcessHandle, &ProtectAddress, &ProtectSize, PAGE_EXECUTE_READWRITE, &OldProtect); if (NT_SUCCESS(status)) { NewNtWriteVirtualMemory(ProcessHandle, fnHookFunc64, trampo, sizeof(trampo), &ReturnLength); NewNtProtectVirtualMemory(ProcessHandle, &ProtectAddress, &ProtectSize, OldProtect, &OldProtect); } } } ZwClose(ProcessHandle); } } ObDereferenceObject(Process); } return status; } #endif BOOLEAN ReadKernelMemory(PVOID pDestination, PVOID pSourceAddress, SIZE_T SizeOfCopy) { PMDL pMdl = NULL; PVOID pSafeAddress = NULL; pMdl = IoAllocateMdl(pSourceAddress, (ULONG)SizeOfCopy, FALSE, FALSE, NULL); if (!pMdl) return FALSE; __try { MmProbeAndLockPages(pMdl, KernelMode, IoReadAccess); } __except (EXCEPTION_EXECUTE_HANDLER) { IoFreeMdl(pMdl); return FALSE; } pSafeAddress = MmGetSystemAddressForMdlSafe(pMdl, NormalPagePriority); if (!pSafeAddress) return FALSE; RtlCopyMemory(pDestination, pSafeAddress, SizeOfCopy); MmUnlockPages(pMdl); IoFreeMdl(pMdl); return TRUE; } BOOLEAN WriteKernelMemory(PVOID pDestination, PVOID pSourceAddress, SIZE_T SizeOfCopy) { PMDL pMdl = NULL; PVOID pSafeAddress = NULL; pMdl = IoAllocateMdl(pDestination, (ULONG)SizeOfCopy, FALSE, FALSE, NULL); if (!pMdl) return FALSE; __try { MmProbeAndLockPages(pMdl, KernelMode, IoReadAccess); } __except (EXCEPTION_EXECUTE_HANDLER) { IoFreeMdl(pMdl); return FALSE; } pSafeAddress = MmGetSystemAddressForMdlSafe(pMdl, NormalPagePriority); if (!pSafeAddress) return FALSE; RtlCopyMemory(pSafeAddress, pSourceAddress, SizeOfCopy); MmUnlockPages(pMdl); IoFreeMdl(pMdl); return TRUE; } */ }//EXTERN C
[ "113660872@qq.com" ]
113660872@qq.com
6cce342ed727a6b37c7867687a316a5f5a9c1c5a
f0ceef11d730b63337fa5485309bcff898aee5d1
/Actor/Timer.h
47a970ceaa45f6e2f682480ce177676485895cc3
[ "MIT" ]
permissive
ahwayakchih/Medo
ec222efbbbfa22a6b2b1ae2982a1157d459b86b1
acc34c189676544c092fbc6800c27a25d05de6dd
refs/heads/main
2023-02-02T14:57:46.884655
2020-12-22T23:49:55
2020-12-22T23:49:55
323,804,986
0
0
MIT
2020-12-23T04:47:34
2020-12-23T04:47:33
null
UTF-8
C++
false
false
1,551
h
/* PROJECT: Yarra Actor Model AUTHORS: Zenja Solaja, Melbourne Australia COPYRIGHT: 2017-2018, ZenYes Pty Ltd DESCRIPTION: Timer */ #ifndef _YARRA_TIMER_H_ #define _YARRA_TIMER_H_ #ifndef _YARRA_ACTOR_H_ #include "Actor.h" #endif #include <deque> namespace Platform { class Thread; class Semaphore; }; namespace yarra { /****************************** yarra::Timer *******************************/ class Timer : public Actor { public: Timer(); ~Timer(); /* Schedule timer message: Prefer to use yarra::ActorManager::GetInstance()->AddTimer(milliseconds, target, std::bind(&Actor::Behaviour, target, ...)); */ void AddTimer(const int64_t milliseconds, Actor *target, std::function<void()> behaviour); void CancelTimersLocked(Actor *target); private: struct TimerObject { int64_t milliseconds; Actor *target; std::function<void()> behaviour; #if ACTOR_DEBUG double timestamp; #endif TimerObject(int64_t ms, Actor *t, std::function<void()> b) : milliseconds(ms), target(t), behaviour(b) { #if ACTOR_DEBUG timestamp = Platform::GetElapsedTime(); #endif } }; std::deque<TimerObject> fTimerQueue; double fTimeStamp; void TimerTickLocked(); Platform::Thread *fTimerThread; Platform::Semaphore fQueueLock; Platform::Semaphore fThreadSemaphore; static int TimerThread(void *); bool fKeepAlive; friend class ActorManager; const bool IsBusy(); }; }; //namespace yarra #endif //#ifndef _YARRA_TIMER_H_
[ "solaja@gmail.com" ]
solaja@gmail.com
eba9212ff5d92a3c75e93be92466ddda25ecadd0
a6d9b0f30f38bb7c3e777cb4befd4bc675935fa8
/src/Common/localdata/GetExistingTrackImportJobQuery.cpp
270984ceb8c4baf958884fe32a0bc80b811410eb
[]
no_license
asdlei99/Tidal-Unofficial-Win10
2cb41ed8478078bc02ea26c74234de1e1075c526
37dbfde89c8e346dd09526adc6144e3699c943c0
refs/heads/master
2021-06-09T12:48:17.904735
2016-08-25T11:07:56
2016-08-25T11:07:56
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,041
cpp
#include "pch.h" #include "GetExistingTrackImportJobQuery.h" using namespace localdata; std::string localdata::GetExistingTrackImportJobQuery::identifier() { return "GetExistingTrackImportJobQuery"; } std::string localdata::GetExistingTrackImportJobQuery::sql(int statementIndex) { return "select " + track_import_job::getOrderedColumnsForSelect() + " from track_import_job where id = @id"; } track_import_job localdata::GetExistingTrackImportJobQuery::materialize(sqlite3 * db, sqlite3_stmt * statement) { return track_import_job::createFromSqlRecord(statement); } void localdata::GetExistingTrackImportJobQuery::bindParameters(int statementIndex, sqlite3 * db, sqlite3_stmt * statement) { sqlite3_bind_int64(statement, sqlite3_bind_parameter_index(statement, "@id"), _id); } std::string localdata::CountExistingTrackImportJobsQuery::identifier() { return "CountExistingTrackImportJobsQuery"; } std::string localdata::CountExistingTrackImportJobsQuery::sql(int statementIndex) { return "select count(*) from track_import_job"; }
[ "sferquel@infinitesquare.com" ]
sferquel@infinitesquare.com
76547add7d701de9dcb3608df82392ea9c5fad6a
d41ebea78a3f0d717c482e9f3ef677b27a64a2d7
/ENGINE_/FeaServer.Engine.Cpu/src/System/cpuFalloc.h
412f2ee3228169316969bc8cc75305af49f79483
[]
no_license
JiujiangZhu/feaserver
c8b89b2c66bf27cecf7afa7775a5f3c466e482d5
864077bb3103cbde78a2b51e8e2536b5d87e6712
refs/heads/master
2020-05-18T00:58:56.385143
2012-09-14T14:28:41
2012-09-14T14:28:41
39,262,812
1
1
null
null
null
null
UTF-8
C++
false
false
4,622
h
#pragma region License /* The MIT License Copyright (c) 2009 Sky Morey Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma endregion #ifndef CPUFALLOC_H #define CPUFALLOC_H /* * This is the header file supporting cpuFalloc.c and defining both the host and device-side interfaces. See that file for some more * explanation and sample use code. See also below for details of the host-side interfaces. * * Quick sample code: * #include "cpuFalloc.c" int main() { cpuFallocHeap heap = cpuFallocInit(); fallocInit(heap.deviceHeap); // create/free heap void* obj = fallocGetChunk(heap.deviceHeap); fallocFreeChunk(heap.deviceHeap, obj); // create/free alloc fallocContext* ctx = fallocCreateCtx(heap.deviceHeap); char* testString = (char*)falloc(ctx, 10); int* testInteger = falloc<int>(ctx); fallocDisposeCtx(ctx); // free and exit cpuFallocEnd(heap); return 0; } */ /////////////////////////////////////////////////////////////////////////////// // DEVICE SIDE // External function definitions for device-side code typedef struct _cpuFallocDeviceHeap fallocDeviceHeap; void fallocInit(fallocDeviceHeap* deviceHeap); void* fallocGetChunk(fallocDeviceHeap* deviceHeap); void* fallocGetChunks(fallocDeviceHeap* deviceHeap, size_t length, size_t* allocLength = nullptr); void fallocFreeChunk(fallocDeviceHeap* deviceHeap, void* obj); void fallocFreeChunks(fallocDeviceHeap* deviceHeap, void* obj); // ALLOC typedef struct _cpuFallocContext fallocContext; fallocContext* fallocCreateCtx(fallocDeviceHeap* deviceHeap); void fallocDisposeCtx(fallocContext* ctx); void* falloc(fallocContext* ctx, unsigned short bytes, bool alloc = true); void* fallocRetract(fallocContext* ctx, unsigned short bytes); void fallocMark(fallocContext* ctx, void* &mark, unsigned short &mark2); bool fallocAtMark(fallocContext* ctx, void* mark, unsigned short mark2); template <typename T> T* falloc(fallocContext* ctx) { return (T*)falloc(ctx, sizeof(T), true); } template <typename T> void fallocPush(fallocContext* ctx, T t) { *((T*)falloc(ctx, sizeof(T), false)) = t; } template <typename T> T fallocPop(fallocContext* ctx) { return *((T*)fallocRetract(ctx, sizeof(T))); } // ATOMIC typedef struct _cpuFallocAutomic fallocAutomic; fallocAutomic* fallocCreateAtom(fallocDeviceHeap* deviceHeap, unsigned short pitch, size_t length); void fallocDisposeAtom(fallocAutomic* atom); void* fallocAtomNext(fallocAutomic* atom, unsigned short bytes); /////////////////////////////////////////////////////////////////////////////// // HOST SIDE // External function definitions for host-side code typedef struct { fallocDeviceHeap* deviceHeap; int length; void* reserved; } cpuFallocHeap; // // cpuFallocInit // // Call this to initialise a falloc heap. If the buffer size needs to be changed, call cudaFallocEnd() // before re-calling cudaFallocInit(). // // The default size for the buffer is 1 megabyte. For CUDA // architecture 1.1 and above, the buffer is filled linearly and // is completely used. // // Arguments: // length - Length, in bytes, of total space to reserve (in device global memory) for output. // // Returns: // cudaSuccess if all is well. // extern "C" cpuFallocHeap cpuFallocInit(size_t length=1048576, void* reserved=nullptr); // 1-meg // // cpuFallocEnd // // Cleans up all memories allocated by cudaFallocInit() for a heap. // Call this at exit, or before calling cudaFallocInit() again. // extern "C" void cpuFallocEnd(cpuFallocHeap &heap); #endif // CPUFALLOC_H
[ "Moreys@MOREYS01.gateway.2wire.net" ]
Moreys@MOREYS01.gateway.2wire.net
d2dbc4eff802e6133b9134acea2263f9d13b7d11
7b4c786d4258ce4421b1e7bcca9011d4eeb50083
/_统计专用/C++Primer中文版(第4版)/第一次-代码集合-20090414/第四章 数组和指针/20090321_习题4.33_把int型vector对象复制给int型数组.cpp
34d2f7c15f3d670793fbd37093933f52a6fc303f
[]
no_license
lzq123218/guoyishi-works
dbfa42a3e2d3bd4a984a5681e4335814657551ef
4e78c8f2e902589c3f06387374024225f52e5a92
refs/heads/master
2021-12-04T11:11:32.639076
2011-05-30T14:12:43
2011-05-30T14:12:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
570
cpp
//20090321 Care of DELETE #include <iostream> #include <vector> using namespace std; int main() { int ival; vector<int> ivec; cout << "Enter some integers(Ctrl+Z to end):" << endl; while (cin >> ival) { ivec.push_back(ival); } cin.clear(); int *parr = new int[ivec.size()]; size_t ix; vector<int>::iterator iter = ivec.begin(); for (ix = 0; ix != ivec.size(); ++ix) { parr[ix] = *iter++; cout << parr[ix] << " "; if ((ix + 1) % 10 == 0) cout << endl; } cout << endl; delete [] parr; //IMPORTANT return 0; }
[ "baicaibang@70501136-4834-11de-8855-c187e5f49513" ]
baicaibang@70501136-4834-11de-8855-c187e5f49513
5cb455cc22176dd7e57005baa18bf7577fc03b90
db707fe41a0f41bdb633ab003b8d64f71e3d4e1b
/stack.hpp
d521b5d807cba4b6b5a0663e0cba6d0d20f01eb5
[]
no_license
mle-moni/ft_containers
5bf0924cc1c79b1183c2e95e279d0bc6b3dfba3c
2467947948d5fd181017ca2b1527662024f14904
refs/heads/master
2022-12-30T04:45:32.707297
2020-10-19T17:55:06
2020-10-19T17:55:06
293,537,366
1
1
null
null
null
null
UTF-8
C++
false
false
2,618
hpp
#ifndef STACK_H #define STACK_H #include "vector.hpp" #include "shared_functions.hpp" namespace ft { template <class T, class Container = ft::vector<T> > class stack { public: typedef T value_type; typedef Container container_type; typedef size_t size_type; protected: Container c; public: // constructors stack (const container_type& ctnr = container_type()): c(ctnr) {} stack (const stack& other): c(other.c) {} virtual ~stack() {} // operator= stack& operator= (const stack& other) { c = other.c; return (*this); } // member functions bool empty() const { return (c.empty()); } size_type size() const { return (c.size()); } value_type& top() { return (c.back()); } const value_type& top() const { return (c.back()); } void push (const value_type& val) { c.push_back(val); } void pop() { c.pop_back(); } // Non-member (but friend) function overloads template <class Tp, class Cntnr> friend bool operator== (const stack<Tp,Cntnr>& lhs, const stack<Tp,Cntnr>& rhs); template <class Tp, class Cntnr> friend bool operator!= (const stack<Tp,Cntnr>& lhs, const stack<Tp,Cntnr>& rhs); template <class Tp, class Cntnr> friend bool operator< (const stack<Tp,Cntnr>& lhs, const stack<Tp,Cntnr>& rhs); template <class Tp, class Cntnr> friend bool operator<= (const stack<Tp,Cntnr>& lhs, const stack<Tp,Cntnr>& rhs); template <class Tp, class Cntnr> friend bool operator> (const stack<Tp,Cntnr>& lhs, const stack<Tp,Cntnr>& rhs); template <class Tp, class Cntnr> friend bool operator>= (const stack<Tp,Cntnr>& lhs, const stack<Tp,Cntnr>& rhs); }; // Non-member (but friend) function overloads template <class Tp, class Cntnr> bool operator== (const stack<Tp,Cntnr>& lhs, const stack<Tp,Cntnr>& rhs) { return (lhs.c == rhs.c); } template <class Tp, class Cntnr> bool operator!= (const stack<Tp,Cntnr>& lhs, const stack<Tp,Cntnr>& rhs) { return (lhs.c != rhs.c); } template <class Tp, class Cntnr> bool operator< (const stack<Tp,Cntnr>& lhs, const stack<Tp,Cntnr>& rhs) { return (lhs.c < rhs.c); } template <class Tp, class Cntnr> bool operator<= (const stack<Tp,Cntnr>& lhs, const stack<Tp,Cntnr>& rhs) { return (lhs.c <= rhs.c); } template <class Tp, class Cntnr> bool operator> (const stack<Tp,Cntnr>& lhs, const stack<Tp,Cntnr>& rhs) { return (lhs.c > rhs.c); } template <class Tp, class Cntnr> bool operator>= (const stack<Tp,Cntnr>& lhs, const stack<Tp,Cntnr>& rhs) { return (lhs.c >= rhs.c); } } #endif
[ "m.lemoniesdesagazan@gmail.com" ]
m.lemoniesdesagazan@gmail.com
0a3b91e75f8f88b3389e7d9ef737063b568d234e
2f396d9c1cff7136f652f05dd3dea2e780ecc56e
/tools/tracer/wrappers/mfx_video_core.cpp
0b032a0ca6183977cbc10a99874bb08a13cb9dff
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Intel" ]
permissive
Intel-Media-SDK/MediaSDK
d90c84f37fd93afc9f0a0b98ac20109d322c3337
7a72de33a15d6e7cdb842b12b901a003f7154f0a
refs/heads/master
2023-08-24T09:19:16.315839
2023-05-17T16:55:38
2023-05-17T16:55:38
87,199,173
957
595
MIT
2023-05-17T16:55:40
2017-04-04T14:52:06
C++
UTF-8
C++
false
false
20,201
cpp
/* ****************************************************************************** *\ Copyright (C) 2012-2020 Intel Corporation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of Intel Corporation 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 INTEL CORPORATION "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 INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. File Name: mfx_video_core.cpp \* ****************************************************************************** */ #include <exception> #include <iostream> #include "../loggers/timer.h" #include "../tracer/functions_table.h" #include "mfx_structures.h" #if TRACE_CALLBACKS mfxStatus mfxFrameAllocator_Alloc(mfxHDL _pthis, mfxFrameAllocRequest *request, mfxFrameAllocResponse *response) { try { DumpContext context; context.context = DUMPCONTEXT_MFX; mfxLoader *loader = (mfxLoader*)_pthis; if (!loader) return MFX_ERR_INVALID_HANDLE; mfxHDL pthis = loader->callbacks[emfxFrameAllocator_Alloc_tracer][1]; Log::WriteLog("callback: mfxFrameAllocator::Alloc(mfxHDL pthis=" + ToString(pthis) + ", mfxFrameAllocRequest *request=" + ToString(request) + ", mfxFrameAllocResponse *response=" + ToString(response) + ") +"); if (!loader) return MFX_ERR_INVALID_HANDLE; fmfxFrameAllocator_Alloc proc = (fmfxFrameAllocator_Alloc)loader->callbacks[emfxFrameAllocator_Alloc_tracer][0]; if (!proc) return MFX_ERR_INVALID_HANDLE; Log::WriteLog(context.dump("pthis", pthis)); if (request) Log::WriteLog(context.dump("request", *request)); if (response) Log::WriteLog(context.dump("response", *response)); Timer t; mfxStatus status = (*proc) (pthis, request, response); std::string elapsed = TimeToString(t.GetTime()); Log::WriteLog(">> callback: mfxFrameAllocator::Alloc called"); if (response) Log::WriteLog(context.dump("response", *response)); Log::WriteLog("callback: mfxFrameAllocator::Alloc(" + elapsed + ", " + context.dump_mfxStatus("status", status) + ") - \n\n"); return status; } catch (std::exception& e) { std::cerr << "Exception: " << e.what() << '\n'; return MFX_ERR_ABORTED; } } mfxStatus mfxFrameAllocator_Lock(mfxHDL _pthis, mfxMemId mid, mfxFrameData *ptr) { try { DumpContext context; context.context = DUMPCONTEXT_MFX; mfxLoader *loader = (mfxLoader*)_pthis; if (!loader) return MFX_ERR_INVALID_HANDLE; mfxHDL pthis = loader->callbacks[emfxFrameAllocator_Lock_tracer][1]; Log::WriteLog("callback: mfxFrameAllocator::Lock(mfxHDL pthis=" + ToString(pthis) + ", mfxMemId mid=" + ToString(mid) + ", mfxFrameData *ptr=" + ToString(ptr) + ") +"); fmfxFrameAllocator_Lock proc = (fmfxFrameAllocator_Lock)loader->callbacks[emfxFrameAllocator_Lock_tracer][0]; if (!proc) return MFX_ERR_INVALID_HANDLE; Log::WriteLog(context.dump("pthis", pthis)); if (ptr) Log::WriteLog(context.dump("ptr", *ptr)); Timer t; mfxStatus status = (*proc) (pthis, mid, ptr); std::string elapsed = TimeToString(t.GetTime()); Log::WriteLog(">> callback: mfxFrameAllocator::Lock called"); if (ptr) Log::WriteLog(context.dump("ptr", *ptr)); Log::WriteLog("callback: mfxFrameAllocator::Lock(" + elapsed + ", " + context.dump_mfxStatus("status", status) + ") - \n\n"); return status; } catch (std::exception& e) { std::cerr << "Exception: " << e.what() << '\n'; return MFX_ERR_ABORTED; } } mfxStatus mfxFrameAllocator_Unlock(mfxHDL _pthis, mfxMemId mid, mfxFrameData *ptr) { try { DumpContext context; context.context = DUMPCONTEXT_MFX; mfxLoader *loader = (mfxLoader*)_pthis; if (!loader) return MFX_ERR_INVALID_HANDLE; mfxHDL pthis = loader->callbacks[emfxFrameAllocator_Unlock_tracer][1]; Log::WriteLog("callback: mfxFrameAllocator::Unlock(mfxHDL pthis=" + ToString(pthis) + ", mfxMemId mid=" + ToString(mid) + ", mfxFrameData *ptr=" + ToString(ptr) + ") +"); fmfxFrameAllocator_Unlock proc = (fmfxFrameAllocator_Unlock)loader->callbacks[emfxFrameAllocator_Unlock_tracer][0]; if (!proc) return MFX_ERR_INVALID_HANDLE; Log::WriteLog(context.dump("pthis", pthis)); if (ptr) Log::WriteLog(context.dump("ptr", *ptr)); Timer t; mfxStatus status = (*proc) (pthis, mid, ptr); std::string elapsed = TimeToString(t.GetTime()); Log::WriteLog(">> callback: mfxFrameAllocator::Unlock called"); if (ptr) Log::WriteLog(context.dump("ptr", *ptr)); Log::WriteLog("callback: mfxFrameAllocator::Unlock(" + elapsed + ", " + context.dump_mfxStatus("status", status) + ") - \n\n"); return status; } catch (std::exception& e) { std::cerr << "Exception: " << e.what() << '\n'; return MFX_ERR_ABORTED; } } mfxStatus mfxFrameAllocator_GetHDL(mfxHDL _pthis, mfxMemId mid, mfxHDL *handle) { try { DumpContext context; context.context = DUMPCONTEXT_MFX; mfxLoader *loader = (mfxLoader*)_pthis; if (!loader) return MFX_ERR_INVALID_HANDLE; mfxHDL pthis = loader->callbacks[emfxFrameAllocator_GetHDL_tracer][1]; Log::WriteLog("callback: mfxFrameAllocator::GetHDL(mfxHDL pthis=" + ToString(pthis) + ", mfxMemId mid=" + ToString(mid) + ", mfxHDL *handle=" + ToString(handle) + ") +"); fmfxFrameAllocator_GetHDL proc = (fmfxFrameAllocator_GetHDL)loader->callbacks[emfxFrameAllocator_GetHDL_tracer][0]; if (!proc) return MFX_ERR_INVALID_HANDLE; Log::WriteLog(context.dump("pthis", pthis)); if (handle) Log::WriteLog(context.dump("handle", *handle)); Timer t; mfxStatus status = (*proc) (pthis, mid, handle); std::string elapsed = TimeToString(t.GetTime()); Log::WriteLog(">> callback: mfxFrameAllocator::GetHDL called"); if (handle) Log::WriteLog(context.dump("handle", *handle)); Log::WriteLog("callback: mfxFrameAllocator::GetHDL(" + elapsed + ", " + context.dump_mfxStatus("status", status) + ") - \n\n"); return status; } catch (std::exception& e) { std::cerr << "Exception: " << e.what() << '\n'; return MFX_ERR_ABORTED; } } mfxStatus mfxFrameAllocator_Free(mfxHDL _pthis, mfxFrameAllocResponse *response) { try { DumpContext context; context.context = DUMPCONTEXT_MFX; mfxLoader *loader = (mfxLoader*)_pthis; if (!loader) return MFX_ERR_INVALID_HANDLE; mfxHDL pthis = loader->callbacks[emfxFrameAllocator_Free_tracer][1]; Log::WriteLog("callback: mfxFrameAllocator::Free(mfxHDL pthis=" + ToString(pthis) + ", mfxFrameAllocResponse *response=" + ToString(response) + ") +"); fmfxFrameAllocator_Free proc = (fmfxFrameAllocator_Free)loader->callbacks[emfxFrameAllocator_Free_tracer][0]; if (!proc) return MFX_ERR_INVALID_HANDLE; Log::WriteLog(context.dump("pthis", pthis)); if (response) Log::WriteLog(context.dump("response", *response)); Timer t; mfxStatus status = (*proc) (pthis, response); std::string elapsed = TimeToString(t.GetTime()); Log::WriteLog(">> callback: mfxFrameAllocator::Free called"); if (response) Log::WriteLog(context.dump("response", *response)); Log::WriteLog("callback: mfxFrameAllocator::Free(" + elapsed + ", " + context.dump_mfxStatus("status", status) + ") - \n\n"); return status; } catch (std::exception& e) { std::cerr << "Exception: " << e.what() << '\n'; return MFX_ERR_ABORTED; } } #endif //TRACE_CALLBACKS // CORE interface functions mfxStatus MFXVideoCORE_SetBufferAllocator(mfxSession session, mfxBufferAllocator *allocator) { try{ DumpContext context; context.context = DUMPCONTEXT_MFX; Log::WriteLog("function: MFXVideoCORE_SetBufferAllocator(mfxSession session=" + ToString(session) + ", mfxBufferAllocator *allocator=" + ToString(allocator) + ") +"); mfxLoader *loader = (mfxLoader*) session; if (!loader) return MFX_ERR_INVALID_HANDLE; mfxFunctionPointer proc = loader->table[eMFXVideoCORE_SetBufferAllocator_tracer]; if (!proc) return MFX_ERR_INVALID_HANDLE; session = loader->session; Log::WriteLog(context.dump("session", session)); if(allocator) Log::WriteLog(context.dump("allocator", *allocator)); Timer t; mfxStatus status = (*(fMFXVideoCORE_SetBufferAllocator) proc) (session, allocator); std::string elapsed = TimeToString(t.GetTime()); Log::WriteLog(">> MFXVideoCORE_SetBufferAllocator called"); Log::WriteLog(context.dump("session", session)); if(allocator) Log::WriteLog(context.dump("allocator", *allocator)); Log::WriteLog("function: MFXVideoCORE_SetBufferAllocator(" + elapsed + ", " + context.dump_mfxStatus("status", status) + ") - \n\n"); return status; } catch (std::exception& e){ std::cerr << "Exception: " << e.what() << '\n'; return MFX_ERR_ABORTED; } } mfxStatus MFXVideoCORE_SetFrameAllocator(mfxSession session, mfxFrameAllocator *allocator) { try{ DumpContext context; context.context = DUMPCONTEXT_MFX; Log::WriteLog("function: MFXVideoCORE_SetFrameAllocator(mfxSession session=" + ToString(session) + ", mfxFrameAllocator *allocator=" + ToString(allocator) + ") +"); mfxLoader *loader = (mfxLoader*) session; if (!loader) return MFX_ERR_INVALID_HANDLE; mfxFunctionPointer proc = loader->table[eMFXVideoCORE_SetFrameAllocator_tracer]; if (!proc) return MFX_ERR_INVALID_HANDLE; session = loader->session; Log::WriteLog(context.dump("session", session)); if(allocator) Log::WriteLog(context.dump("allocator", *allocator)); #if TRACE_CALLBACKS INIT_CALLBACK_BACKUP(loader->callbacks); mfxFrameAllocator proxyAllocator; if (allocator) { proxyAllocator = *allocator; allocator = &proxyAllocator; SET_CALLBACK(mfxFrameAllocator, allocator->, Alloc, allocator->pthis); SET_CALLBACK(mfxFrameAllocator, allocator->, Lock, allocator->pthis); SET_CALLBACK(mfxFrameAllocator, allocator->, Unlock, allocator->pthis); SET_CALLBACK(mfxFrameAllocator, allocator->, GetHDL, allocator->pthis); SET_CALLBACK(mfxFrameAllocator, allocator->, Free, allocator->pthis); if (allocator->pthis) allocator->pthis = loader; } #endif //TRACE_CALLBACKS Timer t; mfxStatus status = (*(fMFXVideoCORE_SetFrameAllocator) proc) (session, allocator); std::string elapsed = TimeToString(t.GetTime()); Log::WriteLog(">> MFXVideoCORE_SetFrameAllocator called"); //No need to dump input-only parameters twice!!! //Log::WriteLog(context.dump("session", session)); //if(allocator) Log::WriteLog(context.dump("allocator", *allocator)); Log::WriteLog("function: MFXVideoCORE_SetFrameAllocator(" + elapsed + ", " + context.dump_mfxStatus("status", status) + ") - \n\n"); #if TRACE_CALLBACKS if (status != MFX_ERR_NONE) callbacks.RevertAll(); #endif //TRACE_CALLBACKS return status; } catch (std::exception& e){ std::cerr << "Exception: " << e.what() << '\n'; return MFX_ERR_ABORTED; } } mfxStatus MFXVideoCORE_SetHandle(mfxSession session, mfxHandleType type, mfxHDL hdl) { try{ DumpContext context; context.context = DUMPCONTEXT_MFX; Log::WriteLog("function: MFXVideoCORE_SetHandle(mfxSession session=" + ToString(session) + ", mfxHandleType type=" + ToString(type) + ", mfxHDL hdl=" + ToString(hdl) + ") +"); mfxLoader *loader = (mfxLoader*) session; if (!loader) return MFX_ERR_INVALID_HANDLE; mfxFunctionPointer proc = loader->table[eMFXVideoCORE_SetHandle_tracer]; if (!proc) return MFX_ERR_INVALID_HANDLE; session = loader->session; Log::WriteLog(context.dump("session", session)); Log::WriteLog(context.dump("type", type)); Log::WriteLog(context.dump_mfxHDL("hdl", &hdl)); Timer t; mfxStatus status = (*(fMFXVideoCORE_SetHandle) proc) (session, type, hdl); std::string elapsed = TimeToString(t.GetTime()); Log::WriteLog(">> MFXVideoCORE_SetHandle called"); Log::WriteLog(context.dump("session", session)); Log::WriteLog(context.dump("type", type)); Log::WriteLog(context.dump_mfxHDL("hdl", &hdl)); Log::WriteLog("function: MFXVideoCORE_SetHandle(" + elapsed + ", " + context.dump_mfxStatus("status", status) + ") - \n\n"); return status; } catch (std::exception& e){ std::cerr << "Exception: " << e.what() << '\n'; return MFX_ERR_ABORTED; } } mfxStatus MFXVideoCORE_GetHandle(mfxSession session, mfxHandleType type, mfxHDL *hdl) { try{ DumpContext context; context.context = DUMPCONTEXT_MFX; Log::WriteLog("function: MFXVideoCORE_GetHandle(mfxSession session=" + ToString(session) + ", mfxHandleType type=" + ToString(type) + ", mfxHDL *hdl=" + ToString(hdl) + ") +"); mfxLoader *loader = (mfxLoader*) session; if (!loader) return MFX_ERR_INVALID_HANDLE; mfxFunctionPointer proc = loader->table[eMFXVideoCORE_GetHandle_tracer]; if (!proc) return MFX_ERR_INVALID_HANDLE; session = loader->session; Log::WriteLog(context.dump("session", session)); Log::WriteLog(context.dump("type", type)); Log::WriteLog(context.dump_mfxHDL("hdl", hdl)); Timer t; mfxStatus status = (*(fMFXVideoCORE_GetHandle) proc) (session, type, hdl); std::string elapsed = TimeToString(t.GetTime()); Log::WriteLog(">> MFXVideoCORE_GetHandle called"); Log::WriteLog(context.dump("session", session)); Log::WriteLog(context.dump("type", type)); Log::WriteLog(context.dump_mfxHDL("hdl", hdl)); Log::WriteLog("function: MFXVideoCORE_GetHandle(" + elapsed + ", " + context.dump_mfxStatus("status", status) + ") - \n\n"); return status; } catch (std::exception& e){ std::cerr << "Exception: " << e.what() << '\n'; return MFX_ERR_ABORTED; } } mfxStatus MFXVideoCORE_QueryPlatform(mfxSession session, mfxPlatform* platform) { try{ DumpContext context; context.context = DUMPCONTEXT_MFX; Log::WriteLog("function: MFXVideoCORE_QueryPlatform(mfxSession session=" + ToString(session) + ", mfxPlatform* platform=" + ToString(platform) + ") +"); mfxLoader *loader = (mfxLoader*) session; if (!loader) return MFX_ERR_INVALID_HANDLE; mfxFunctionPointer proc = loader->table[eMFXVideoCORE_QueryPlatform_tracer]; if (!proc) return MFX_ERR_INVALID_HANDLE; session = loader->session; Log::WriteLog(context.dump("session", session)); Log::WriteLog(context.dump("platform", platform)); Timer t; mfxStatus status = (*(fMFXVideoCORE_QueryPlatform) proc) (session, platform); std::string elapsed = TimeToString(t.GetTime()); Log::WriteLog(">> MFXVideoCORE_QueryPlatform called"); Log::WriteLog(context.dump("session", session)); Log::WriteLog(context.dump("platform", platform)); Log::WriteLog("function: MFXVideoCORE_QueryPlatform(" + elapsed + ", " + context.dump_mfxStatus("status", status) + ") - \n\n"); return status; } catch (std::exception& e){ std::cerr << "Exception: " << e.what() << '\n'; return MFX_ERR_ABORTED; } } mfxStatus MFXVideoCORE_SyncOperation(mfxSession session, mfxSyncPoint syncp, mfxU32 wait) { try{ if (Log::GetLogLevel() >= LOG_LEVEL_FULL) //call function with logging { DumpContext context; context.context = DUMPCONTEXT_MFX; TracerSyncPoint sp; if (syncp) { sp.syncPoint = syncp; Log::WriteLog("function: MFXVideoCORE_SyncOperation(mfxSession session=" + ToString(session) + ", mfxSyncPoint syncp=" + ToString(syncp) + ", mfxU32 wait=" + ToString(wait) + ") +"); //sp.component == ENCODE ? Log::WriteLog("SyncOperation(ENCODE," + TimeToString(sp.timer.GetTime()) + ")") : (sp.component == DECODE ? Log::WriteLog("SyncOperation(DECODE, " + ToString(sp.timer.GetTime()) + " sec)") : Log::WriteLog("SyncOperation(VPP, " + ToString(sp.timer.GetTime()) + " sec)")); } else { // already synced Log::WriteLog("Already synced"); return MFX_ERR_NONE; } mfxLoader *loader = (mfxLoader*) session; if (!loader) return MFX_ERR_INVALID_HANDLE; mfxFunctionPointer proc = loader->table[eMFXVideoCORE_SyncOperation_tracer]; if (!proc) return MFX_ERR_INVALID_HANDLE; session = loader->session; Log::WriteLog(context.dump("session", session)); Log::WriteLog(context.dump("syncp", syncp)); Log::WriteLog(context.dump_mfxU32("wait", wait)); Timer t; mfxStatus status = (*(fMFXVideoCORE_SyncOperation) proc) (session, sp.syncPoint, wait); std::string elapsed = TimeToString(t.GetTime()); Log::WriteLog(">> MFXVideoCORE_SyncOperation called"); Log::WriteLog(context.dump("session", session)); Log::WriteLog(context.dump("syncp", sp.syncPoint)); Log::WriteLog(context.dump_mfxU32("wait", wait)); Log::WriteLog("function: MFXVideoCORE_SyncOperation(" + elapsed + ", " + context.dump_mfxStatus("status", status) + ") - \n\n"); return status; } else // call function without logging { DumpContext context; context.context = DUMPCONTEXT_MFX; TracerSyncPoint sp; if (syncp) { sp.syncPoint = syncp; } else { // already synced return MFX_ERR_NONE; } mfxLoader *loader = (mfxLoader*) session; if (!loader) return MFX_ERR_INVALID_HANDLE; mfxFunctionPointer proc = loader->table[eMFXVideoCORE_SyncOperation_tracer]; if (!proc) return MFX_ERR_INVALID_HANDLE; session = loader->session; mfxStatus status = (*(fMFXVideoCORE_SyncOperation) proc) (session, sp.syncPoint, wait); return status; } } catch (std::exception& e){ std::cerr << "Exception: " << e.what() << '\n'; return MFX_ERR_ABORTED; } }
[ "oleg.nabiullin@intel.com" ]
oleg.nabiullin@intel.com
c4e0e560df8f7592022550e0817a8e04d164227e
e436914385170e37c3a2caf483a7422f1da3affb
/src/qt/bitcoinunits.cpp
bfdcf68b2c07afca63fda0f35ea4d2453c8a279c
[ "MIT" ]
permissive
pereirasilv/plasma
4dea2533d06be4fbf1fb35eaa07b6acd8191c112
e1375bd11f92391ab8d37ca046b0d1920f6b8f27
refs/heads/master
2021-06-19T01:24:35.486746
2017-06-07T20:18:13
2017-06-07T20:18:13
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,289
cpp
#include "bitcoinunits.h" #include <QStringList> BitcoinUnits::BitcoinUnits(QObject *parent): QAbstractListModel(parent), unitlist(availableUnits()) { } QList<BitcoinUnits::Unit> BitcoinUnits::availableUnits() { QList<BitcoinUnits::Unit> unitlist; unitlist.append(BTC); unitlist.append(mBTC); unitlist.append(uBTC); return unitlist; } bool BitcoinUnits::valid(int unit) { switch(unit) { case BTC: case mBTC: case uBTC: return true; default: return false; } } QString BitcoinUnits::name(int unit) { switch(unit) { case BTC: return QString("XPZ"); case mBTC: return QString("XPZ"); case uBTC: return QString::fromUtf8("μXPZ"); default: return QString("???"); } } QString BitcoinUnits::description(int unit) { switch(unit) { case BTC: return QString("plasmacoins"); case mBTC: return QString("Milli-plasmacoins (1 / 1,000)"); case uBTC: return QString("Micro-plasmacoins (1 / 1,000,000)"); default: return QString("???"); } } qint64 BitcoinUnits::factor(int unit) { switch(unit) { case BTC: return 100000000; case mBTC: return 100000; case uBTC: return 100; default: return 100000000; } } int BitcoinUnits::amountDigits(int unit) { switch(unit) { case BTC: return 9; // 21,000,000 (# digits, without commas) case mBTC: return 11; // 21,000,000,000 case uBTC: return 14; // 21,000,000,000,000 default: return 0; } } int BitcoinUnits::decimals(int unit) { switch(unit) { case BTC: return 8; case mBTC: return 5; case uBTC: return 2; default: return 0; } } QString BitcoinUnits::format(int unit, qint64 n, bool fPlus) { // Note: not using straight sprintf here because we do NOT want // localized number formatting. if(!valid(unit)) return QString(); // Refuse to format invalid unit qint64 coin = factor(unit); int num_decimals = decimals(unit); qint64 n_abs = (n > 0 ? n : -n); qint64 quotient = n_abs / coin; qint64 remainder = n_abs % coin; QString quotient_str = QString::number(quotient); QString remainder_str = QString::number(remainder).rightJustified(num_decimals, '0'); // Right-trim excess zeros after the decimal point int nTrim = 0; for (int i = remainder_str.size()-1; i>=2 && (remainder_str.at(i) == '0'); --i) ++nTrim; remainder_str.chop(nTrim); if (n < 0) quotient_str.insert(0, '-'); else if (fPlus && n > 0) quotient_str.insert(0, '+'); return quotient_str + QString(".") + remainder_str; } QString BitcoinUnits::formatWithUnit(int unit, qint64 amount, bool plussign) { return format(unit, amount, plussign) + QString(" ") + name(unit); } bool BitcoinUnits::parse(int unit, const QString &value, qint64 *val_out) { if(!valid(unit) || value.isEmpty()) return false; // Refuse to parse invalid unit or empty string int num_decimals = decimals(unit); QStringList parts = value.split("."); if(parts.size() > 2) { return false; // More than one dot } QString whole = parts[0]; QString decimals; if(parts.size() > 1) { decimals = parts[1]; } if(decimals.size() > num_decimals) { return false; // Exceeds max precision } bool ok = false; QString str = whole + decimals.leftJustified(num_decimals, '0'); if(str.size() > 18) { return false; // Longer numbers will exceed 63 bits } qint64 retvalue = str.toLongLong(&ok); if(val_out) { *val_out = retvalue; } return ok; } int BitcoinUnits::rowCount(const QModelIndex &parent) const { Q_UNUSED(parent); return unitlist.size(); } QVariant BitcoinUnits::data(const QModelIndex &index, int role) const { int row = index.row(); if(row >= 0 && row < unitlist.size()) { Unit unit = unitlist.at(row); switch(role) { case Qt::EditRole: case Qt::DisplayRole: return QVariant(name(unit)); case Qt::ToolTipRole: return QVariant(description(unit)); case UnitRole: return QVariant(static_cast<int>(unit)); } } return QVariant(); }
[ "plasmacoin@scryptmail.com" ]
plasmacoin@scryptmail.com
675e9ba4175b5589e3eb4a53aa776dca7ed1914c
544fbe639a4d1f5bdf91c6bbf8568a37233e8546
/aws-cpp-sdk-auditmanager/include/aws/auditmanager/model/AssessmentFramework.h
c6e98dee903788002f10261e92727c21dfa5d562
[ "MIT", "Apache-2.0", "JSON" ]
permissive
jweinst1/aws-sdk-cpp
833dbed4871a576cee3d7e37d93ce49e8d649ed5
fef0f65a49f08171cf6ebc8fbd357731d961ab0f
refs/heads/main
2023-07-14T03:42:55.080906
2021-08-29T04:07:48
2021-08-29T04:07:48
300,541,857
0
0
Apache-2.0
2020-10-02T07:53:42
2020-10-02T07:53:41
null
UTF-8
C++
false
false
6,581
h
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/auditmanager/AuditManager_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <aws/auditmanager/model/FrameworkMetadata.h> #include <aws/core/utils/memory/stl/AWSVector.h> #include <aws/auditmanager/model/AssessmentControlSet.h> #include <utility> namespace Aws { namespace Utils { namespace Json { class JsonValue; class JsonView; } // namespace Json } // namespace Utils namespace AuditManager { namespace Model { /** * <p> The file used to structure and automate Audit Manager assessments for a * given compliance standard. </p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/auditmanager-2017-07-25/AssessmentFramework">AWS * API Reference</a></p> */ class AWS_AUDITMANAGER_API AssessmentFramework { public: AssessmentFramework(); AssessmentFramework(Aws::Utils::Json::JsonView jsonValue); AssessmentFramework& operator=(Aws::Utils::Json::JsonView jsonValue); Aws::Utils::Json::JsonValue Jsonize() const; /** * <p> The unique identifier for the framework. </p> */ inline const Aws::String& GetId() const{ return m_id; } /** * <p> The unique identifier for the framework. </p> */ inline bool IdHasBeenSet() const { return m_idHasBeenSet; } /** * <p> The unique identifier for the framework. </p> */ inline void SetId(const Aws::String& value) { m_idHasBeenSet = true; m_id = value; } /** * <p> The unique identifier for the framework. </p> */ inline void SetId(Aws::String&& value) { m_idHasBeenSet = true; m_id = std::move(value); } /** * <p> The unique identifier for the framework. </p> */ inline void SetId(const char* value) { m_idHasBeenSet = true; m_id.assign(value); } /** * <p> The unique identifier for the framework. </p> */ inline AssessmentFramework& WithId(const Aws::String& value) { SetId(value); return *this;} /** * <p> The unique identifier for the framework. </p> */ inline AssessmentFramework& WithId(Aws::String&& value) { SetId(std::move(value)); return *this;} /** * <p> The unique identifier for the framework. </p> */ inline AssessmentFramework& WithId(const char* value) { SetId(value); return *this;} /** * <p> The Amazon Resource Name (ARN) of the specified framework. </p> */ inline const Aws::String& GetArn() const{ return m_arn; } /** * <p> The Amazon Resource Name (ARN) of the specified framework. </p> */ inline bool ArnHasBeenSet() const { return m_arnHasBeenSet; } /** * <p> The Amazon Resource Name (ARN) of the specified framework. </p> */ inline void SetArn(const Aws::String& value) { m_arnHasBeenSet = true; m_arn = value; } /** * <p> The Amazon Resource Name (ARN) of the specified framework. </p> */ inline void SetArn(Aws::String&& value) { m_arnHasBeenSet = true; m_arn = std::move(value); } /** * <p> The Amazon Resource Name (ARN) of the specified framework. </p> */ inline void SetArn(const char* value) { m_arnHasBeenSet = true; m_arn.assign(value); } /** * <p> The Amazon Resource Name (ARN) of the specified framework. </p> */ inline AssessmentFramework& WithArn(const Aws::String& value) { SetArn(value); return *this;} /** * <p> The Amazon Resource Name (ARN) of the specified framework. </p> */ inline AssessmentFramework& WithArn(Aws::String&& value) { SetArn(std::move(value)); return *this;} /** * <p> The Amazon Resource Name (ARN) of the specified framework. </p> */ inline AssessmentFramework& WithArn(const char* value) { SetArn(value); return *this;} inline const FrameworkMetadata& GetMetadata() const{ return m_metadata; } inline bool MetadataHasBeenSet() const { return m_metadataHasBeenSet; } inline void SetMetadata(const FrameworkMetadata& value) { m_metadataHasBeenSet = true; m_metadata = value; } inline void SetMetadata(FrameworkMetadata&& value) { m_metadataHasBeenSet = true; m_metadata = std::move(value); } inline AssessmentFramework& WithMetadata(const FrameworkMetadata& value) { SetMetadata(value); return *this;} inline AssessmentFramework& WithMetadata(FrameworkMetadata&& value) { SetMetadata(std::move(value)); return *this;} /** * <p> The control sets associated with the framework. </p> */ inline const Aws::Vector<AssessmentControlSet>& GetControlSets() const{ return m_controlSets; } /** * <p> The control sets associated with the framework. </p> */ inline bool ControlSetsHasBeenSet() const { return m_controlSetsHasBeenSet; } /** * <p> The control sets associated with the framework. </p> */ inline void SetControlSets(const Aws::Vector<AssessmentControlSet>& value) { m_controlSetsHasBeenSet = true; m_controlSets = value; } /** * <p> The control sets associated with the framework. </p> */ inline void SetControlSets(Aws::Vector<AssessmentControlSet>&& value) { m_controlSetsHasBeenSet = true; m_controlSets = std::move(value); } /** * <p> The control sets associated with the framework. </p> */ inline AssessmentFramework& WithControlSets(const Aws::Vector<AssessmentControlSet>& value) { SetControlSets(value); return *this;} /** * <p> The control sets associated with the framework. </p> */ inline AssessmentFramework& WithControlSets(Aws::Vector<AssessmentControlSet>&& value) { SetControlSets(std::move(value)); return *this;} /** * <p> The control sets associated with the framework. </p> */ inline AssessmentFramework& AddControlSets(const AssessmentControlSet& value) { m_controlSetsHasBeenSet = true; m_controlSets.push_back(value); return *this; } /** * <p> The control sets associated with the framework. </p> */ inline AssessmentFramework& AddControlSets(AssessmentControlSet&& value) { m_controlSetsHasBeenSet = true; m_controlSets.push_back(std::move(value)); return *this; } private: Aws::String m_id; bool m_idHasBeenSet; Aws::String m_arn; bool m_arnHasBeenSet; FrameworkMetadata m_metadata; bool m_metadataHasBeenSet; Aws::Vector<AssessmentControlSet> m_controlSets; bool m_controlSetsHasBeenSet; }; } // namespace Model } // namespace AuditManager } // namespace Aws
[ "aws-sdk-cpp-automation@github.com" ]
aws-sdk-cpp-automation@github.com
d9b2cea8e7465fb1e60da6ab3740c1bc9c7a2c3f
6680f8d317de48876d4176d443bfd580ec7a5aef
/Header/ProjectConfig/ISettingStorageEditor.h
dee65ed0086c6e32e07d15031675d8831498affa
[]
no_license
AlirezaMojtabavi/misInteractiveSegmentation
1b51b0babb0c6f9601330fafc5c15ca560d6af31
4630a8c614f6421042636a2adc47ed6b5d960a2b
refs/heads/master
2020-12-10T11:09:19.345393
2020-03-04T11:34:26
2020-03-04T11:34:26
233,574,482
3
0
null
null
null
null
UTF-8
C++
false
false
679
h
#pragma once #include "ISettingsContainer.h" // The ISettingStorageEditor class provides an abstract interface for opening, editing, and saving a settings storage file. class ISettingStorageEditor { public: // Loads the user preferences from the file specified. virtual void LoadFromFile(const std::string& preferences) = 0; // Saves the user preferences to the file specified. virtual void SaveToFile(const std::string& preferences) = 0; // Gets the Preferences loaded from the registry. virtual std::shared_ptr<ISettingsContainer> GetPreferences() const = 0; virtual void SetRootNodePath(const std::string& path) = 0; virtual ~ISettingStorageEditor(void) { } };
[ "alireza_mojtabavi@yahoo.com" ]
alireza_mojtabavi@yahoo.com
340b4cf7a452d0030168667f1cf44b6e8d37e677
d38fc517d34598d7f2f8a32de9c29e90f12c6d2f
/unittests/test_protocol.hpp
35af737db9f4652bec1f561eb030cf8e8a37022d
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
EOSIO/history-tools
3a1455e54b0c58075ff97d14751eb6754fd01be6
4f1052dabdf88b1497db06718c31b4594175c1c8
refs/heads/master
2022-08-04T21:50:54.682181
2022-01-13T18:10:57
2022-01-13T18:10:57
159,573,050
59
55
MIT
2022-06-01T05:45:19
2018-11-28T22:20:21
C++
UTF-8
C++
false
false
35,928
hpp
#pragma once #include <eosio/check.hpp> #include <eosio/crypto.hpp> #include <eosio/fixed_bytes.hpp> #include <eosio/float.hpp> #include <eosio/name.hpp> #include <eosio/opaque.hpp> #include <eosio/stream.hpp> #include <eosio/time.hpp> #include <eosio/varint.hpp> namespace test_protocol { typedef __uint128_t uint128_t; #ifdef __eosio_cdt__ # pragma clang diagnostic push # pragma clang diagnostic ignored "-Winvalid-noreturn" [[noreturn]] inline void report_error(const std::string& s) { eosio::check(false, s); } # pragma clang diagnostic pop #else [[noreturn]] inline void report_error(const std::string& s) { throw std::runtime_error(s); } #endif struct extension { uint16_t type = {}; eosio::input_stream data = {}; }; EOSIO_REFLECT(extension, type, data) enum class transaction_status : uint8_t { executed = 0, // succeed, no error handler executed soft_fail = 1, // objectively failed (not executed), error handler executed hard_fail = 2, // objectively failed and error handler objectively failed thus no state change delayed = 3, // transaction delayed/deferred/scheduled for future execution expired = 4, // transaction expired and storage space refunded to user }; // todo: switch to eosio::result. switch to new serializer string support. inline std::string to_string(transaction_status status) { switch (status) { case transaction_status::executed: return "executed"; case transaction_status::soft_fail: return "soft_fail"; case transaction_status::hard_fail: return "hard_fail"; case transaction_status::delayed: return "delayed"; case transaction_status::expired: return "expired"; } report_error("unknown status: " + std::to_string((uint8_t)status)); } // todo: switch to eosio::result. switch to new serializer string support. inline transaction_status get_transaction_status(const std::string& s) { if (s == "executed") return transaction_status::executed; if (s == "soft_fail") return transaction_status::soft_fail; if (s == "hard_fail") return transaction_status::hard_fail; if (s == "delayed") return transaction_status::delayed; if (s == "expired") return transaction_status::expired; report_error("unknown status: " + s); } struct get_status_request_v0 {}; EOSIO_REFLECT(get_status_request_v0) struct block_position { uint32_t block_num = {}; eosio::checksum256 block_id = {}; }; EOSIO_REFLECT(block_position, block_num, block_id) struct get_status_result_v0 { block_position head = {}; block_position last_irreversible = {}; uint32_t trace_begin_block = {}; uint32_t trace_end_block = {}; uint32_t chain_state_begin_block = {}; uint32_t chain_state_end_block = {}; eosio::checksum256 chain_id = {}; // todo: switch to binary extension }; EOSIO_REFLECT(get_status_result_v0, head, last_irreversible, trace_begin_block, trace_end_block, chain_state_begin_block, chain_state_end_block, chain_id) struct get_blocks_request_v0 { uint32_t start_block_num = {}; uint32_t end_block_num = {}; uint32_t max_messages_in_flight = {}; std::vector<block_position> have_positions = {}; bool irreversible_only = {}; bool fetch_block = {}; bool fetch_traces = {}; bool fetch_deltas = {}; }; EOSIO_REFLECT(get_blocks_request_v0, start_block_num, end_block_num, max_messages_in_flight, have_positions, irreversible_only, fetch_block, fetch_traces, fetch_deltas) struct get_blocks_ack_request_v0 { uint32_t num_messages = {}; }; EOSIO_REFLECT(get_blocks_ack_request_v0, num_messages) using request = std::variant<get_status_request_v0, get_blocks_request_v0, get_blocks_ack_request_v0>; struct get_blocks_result_base { block_position head = {}; block_position last_irreversible = {}; std::optional<block_position> this_block = {}; std::optional<block_position> prev_block = {}; }; EOSIO_REFLECT(get_blocks_result_base, head, last_irreversible, this_block, prev_block) struct get_blocks_result_v0 : get_blocks_result_base { std::optional<eosio::input_stream> block = {}; std::optional<eosio::input_stream> traces = {}; std::optional<eosio::input_stream> deltas = {}; }; EOSIO_REFLECT(get_blocks_result_v0, base get_blocks_result_base, block, traces, deltas) struct row_v0 { bool present = {}; // false (not present), true (present, old / new) eosio::input_stream data = {}; }; EOSIO_REFLECT(row_v0, present, data) struct table_delta_v0 { std::string name = {}; std::vector<row_v0> rows = {}; }; EOSIO_REFLECT(table_delta_v0, name, rows) struct row_v1 { uint8_t present = {}; // 0 (not present), 1 (present, old), 2 (present, new) eosio::input_stream data = {}; }; EOSIO_REFLECT(row_v1, present, data) struct table_delta_v1 { std::string name = {}; std::vector<row_v1> rows = {}; }; EOSIO_REFLECT(table_delta_v1, name, rows) using table_delta = std::variant<table_delta_v0, table_delta_v1>; struct permission_level { eosio::name actor = {}; eosio::name permission = {}; }; EOSIO_REFLECT(permission_level, actor, permission) struct action { eosio::name account = {}; eosio::name name = {}; std::vector<permission_level> authorization = {}; eosio::input_stream data = {}; }; EOSIO_REFLECT(action, account, name, authorization, data) struct account_auth_sequence { eosio::name account = {}; uint64_t sequence = {}; }; EOSIO_REFLECT(account_auth_sequence, account, sequence) EOSIO_COMPARE(account_auth_sequence); struct action_receipt_v0 { eosio::name receiver = {}; eosio::checksum256 act_digest = {}; uint64_t global_sequence = {}; uint64_t recv_sequence = {}; std::vector<account_auth_sequence> auth_sequence = {}; eosio::varuint32 code_sequence = {}; eosio::varuint32 abi_sequence = {}; }; EOSIO_REFLECT(action_receipt_v0, receiver, act_digest, global_sequence, recv_sequence, auth_sequence, code_sequence, abi_sequence) using action_receipt = std::variant<action_receipt_v0>; struct account_delta { eosio::name account = {}; int64_t delta = {}; }; EOSIO_REFLECT(account_delta, account, delta) EOSIO_COMPARE(account_delta); struct action_trace_v0 { eosio::varuint32 action_ordinal = {}; eosio::varuint32 creator_action_ordinal = {}; std::optional<action_receipt> receipt = {}; eosio::name receiver = {}; action act = {}; bool context_free = {}; int64_t elapsed = {}; std::string console = {}; std::vector<account_delta> account_ram_deltas = {}; std::optional<std::string> except = {}; std::optional<uint64_t> error_code = {}; }; EOSIO_REFLECT(action_trace_v0, action_ordinal, creator_action_ordinal, receipt, receiver, act, context_free, elapsed, console, account_ram_deltas, except, error_code) struct action_trace_v1 { eosio::varuint32 action_ordinal = {}; eosio::varuint32 creator_action_ordinal = {}; std::optional<action_receipt> receipt = {}; eosio::name receiver = {}; action act = {}; bool context_free = {}; int64_t elapsed = {}; std::string console = {}; std::vector<account_delta> account_ram_deltas = {}; std::vector<account_delta> account_disk_deltas = {}; std::optional<std::string> except = {}; std::optional<uint64_t> error_code = {}; eosio::input_stream return_value = {}; }; EOSIO_REFLECT(action_trace_v1, action_ordinal, creator_action_ordinal, receipt, receiver, act, context_free, elapsed, console, account_ram_deltas, account_disk_deltas, except, error_code, return_value) using action_trace = std::variant<action_trace_v0, action_trace_v1>; struct prunable_data_none { eosio::checksum256 prunable_digest; }; using segment_type = std::variant<eosio::checksum256, eosio::input_stream>; constexpr const char* get_typ_name(segment_type*){ return "segment_type"; } struct prunable_data_partial { std::vector<eosio::signature> signatures; std::vector<segment_type> context_free_segments; }; struct prunable_data_full { std::vector<eosio::signature> signatures; std::vector<eosio::input_stream> context_free_segments; }; struct prunable_data_full_legacy { std::vector<eosio::signature> signatures; eosio::input_stream packed_context_free_data; }; using prunable_data_t = std::variant<prunable_data_full_legacy, prunable_data_none, prunable_data_partial, prunable_data_full>; constexpr const char* get_typ_name(prunable_data_t*){ return "prunable_data_t"; } struct prunable_data_type { prunable_data_t prunable_data; }; EOSIO_REFLECT(prunable_data_type, prunable_data) EOSIO_REFLECT(prunable_data_none, prunable_digest) EOSIO_REFLECT(prunable_data_partial, signatures, context_free_segments) EOSIO_REFLECT(prunable_data_full, signatures, context_free_segments) EOSIO_REFLECT(prunable_data_full_legacy, signatures, packed_context_free_data) struct partial_transaction_v0 { eosio::time_point_sec expiration = {}; uint16_t ref_block_num = {}; uint32_t ref_block_prefix = {}; eosio::varuint32 max_net_usage_words = {}; uint8_t max_cpu_usage_ms = {}; eosio::varuint32 delay_sec = {}; std::vector<extension> transaction_extensions = {}; std::vector<eosio::signature> signatures = {}; std::vector<eosio::input_stream> context_free_data = {}; }; EOSIO_REFLECT(partial_transaction_v0, expiration, ref_block_num, ref_block_prefix, max_net_usage_words, max_cpu_usage_ms, delay_sec, transaction_extensions, signatures, context_free_data) struct partial_transaction_v1 { eosio::time_point_sec expiration = {}; uint16_t ref_block_num = {}; uint32_t ref_block_prefix = {}; eosio::varuint32 max_net_usage_words = {}; uint8_t max_cpu_usage_ms = {}; eosio::varuint32 delay_sec = {}; std::vector<extension> transaction_extensions = {}; std::optional<prunable_data_type> prunable_data = {}; }; EOSIO_REFLECT(partial_transaction_v1, expiration, ref_block_num, ref_block_prefix, max_net_usage_words, max_cpu_usage_ms, delay_sec, transaction_extensions, prunable_data) using partial_transaction = std::variant<partial_transaction_v0, partial_transaction_v1>; struct recurse_transaction_trace; struct transaction_trace_v0 { eosio::checksum256 id = {}; transaction_status status = {}; uint32_t cpu_usage_us = {}; eosio::varuint32 net_usage_words = {}; int64_t elapsed = {}; uint64_t net_usage = {}; bool scheduled = {}; std::vector<action_trace> action_traces = {}; std::optional<account_delta> account_ram_delta = {}; std::optional<std::string> except = {}; std::optional<uint64_t> error_code = {}; // semantically, this should be std::optional<transaction_trace>; // optional serializes as bool[,transaction_trace] // vector serializes as size[,transaction_trace..] but vector will only ever have 0 or 1 transaction trace // This assumes that bool and size for false/true serializes to same as size 0/1 std::vector<recurse_transaction_trace> failed_dtrx_trace = {}; std::optional<partial_transaction> partial = {}; }; EOSIO_REFLECT(transaction_trace_v0, id, status, cpu_usage_us, net_usage_words, elapsed, net_usage, scheduled, action_traces, account_ram_delta, except, error_code, failed_dtrx_trace, partial) using transaction_trace = std::variant<transaction_trace_v0>; struct recurse_transaction_trace { transaction_trace recurse = {}; }; EOSIO_REFLECT(recurse_transaction_trace, recurse) struct producer_key { eosio::name producer_name = {}; eosio::public_key block_signing_key = {}; }; EOSIO_REFLECT(producer_key, producer_name, block_signing_key) struct producer_schedule { uint32_t version = {}; std::vector<producer_key> producers = {}; }; EOSIO_REFLECT(producer_schedule, version, producers) struct transaction_receipt_header { transaction_status status = {}; uint32_t cpu_usage_us = {}; eosio::varuint32 net_usage_words = {}; }; EOSIO_REFLECT(transaction_receipt_header, status, cpu_usage_us, net_usage_words) struct packed_transaction_v0 { std::vector<eosio::signature> signatures = {}; uint8_t compression = {}; eosio::input_stream packed_context_free_data = {}; eosio::input_stream packed_trx = {}; }; EOSIO_REFLECT(packed_transaction_v0, signatures, compression, packed_context_free_data, packed_trx) struct packed_transaction { uint8_t compression = {}; prunable_data_type prunable_data = {}; eosio::input_stream packed_trx = {}; }; EOSIO_REFLECT(packed_transaction, compression, prunable_data, packed_trx) using transaction_variant_v0 = std::variant<eosio::checksum256, packed_transaction_v0>; struct transaction_receipt_v0 : transaction_receipt_header { transaction_variant_v0 trx = {}; }; EOSIO_REFLECT(transaction_receipt_v0, base transaction_receipt_header, trx) using transaction_variant = std::variant<eosio::checksum256, packed_transaction>; struct transaction_receipt : transaction_receipt_header { transaction_variant trx = {}; }; EOSIO_REFLECT(transaction_receipt, base transaction_receipt_header, trx) struct block_header { eosio::block_timestamp timestamp{}; eosio::name producer = {}; uint16_t confirmed = {}; eosio::checksum256 previous = {}; eosio::checksum256 transaction_mroot = {}; eosio::checksum256 action_mroot = {}; uint32_t schedule_version = {}; std::optional<producer_schedule> new_producers = {}; std::vector<extension> header_extensions = {}; }; EOSIO_REFLECT(block_header, timestamp, producer, confirmed, previous, transaction_mroot, action_mroot, schedule_version, new_producers, header_extensions) struct signed_block_header : block_header { eosio::signature producer_signature = {}; }; EOSIO_REFLECT(signed_block_header, base block_header, producer_signature) struct signed_block_v0 : signed_block_header { std::vector<transaction_receipt_v0> transactions = {}; std::vector<extension> block_extensions = {}; }; EOSIO_REFLECT(signed_block_v0, base signed_block_header, transactions, block_extensions) struct signed_block_v1 : signed_block_header { uint8_t prune_state = {}; std::vector<transaction_receipt> transactions = {}; std::vector<extension> block_extensions = {}; }; EOSIO_REFLECT(signed_block_v1, base signed_block_header, prune_state, transactions, block_extensions) using signed_block_variant = std::variant<signed_block_v0, signed_block_v1>; struct get_blocks_result_v1 : get_blocks_result_base { std::optional<signed_block_variant> block = {}; eosio::opaque<std::vector<transaction_trace>> traces = {}; eosio::opaque<std::vector<table_delta>> deltas = {}; }; EOSIO_REFLECT(get_blocks_result_v1, base get_blocks_result_base, block, traces, deltas) using result = std::variant<get_status_result_v0, get_blocks_result_v0, get_blocks_result_v1>; struct transaction_header { eosio::time_point_sec expiration = {}; uint16_t ref_block_num = {}; uint32_t ref_block_prefix = {}; eosio::varuint32 max_net_usage_words = {}; uint8_t max_cpu_usage_ms = {}; eosio::varuint32 delay_sec = {}; }; EOSIO_REFLECT(transaction_header, expiration, ref_block_num, ref_block_prefix, max_net_usage_words, max_cpu_usage_ms, delay_sec) struct transaction : transaction_header { std::vector<action> context_free_actions = {}; std::vector<action> actions = {}; std::vector<extension> transaction_extensions = {}; }; EOSIO_REFLECT(transaction, base transaction_header, context_free_actions, actions, transaction_extensions) struct code_id { uint8_t vm_type = {}; uint8_t vm_version = {}; eosio::checksum256 code_hash = {}; }; EOSIO_REFLECT(code_id, vm_type, vm_version, code_hash) struct account_v0 { eosio::name name = {}; eosio::block_timestamp creation_date = {}; eosio::input_stream abi = {}; }; EOSIO_REFLECT(account_v0, name, creation_date, abi) using account = std::variant<account_v0>; struct account_metadata_v0 { eosio::name name = {}; bool privileged = {}; eosio::time_point last_code_update = {}; std::optional<code_id> code = {}; }; EOSIO_REFLECT(account_metadata_v0, name, privileged, last_code_update, code) using account_metadata = std::variant<account_metadata_v0>; struct code_v0 { uint8_t vm_type = {}; uint8_t vm_version = {}; eosio::checksum256 code_hash = {}; eosio::input_stream code = {}; }; EOSIO_REFLECT(code_v0, vm_type, vm_version, code_hash, code) using code = std::variant<code_v0>; struct contract_table_v0 { eosio::name code = {}; eosio::name scope = {}; eosio::name table = {}; eosio::name payer = {}; }; EOSIO_REFLECT(contract_table_v0, code, scope, table, payer) using contract_table = std::variant<contract_table_v0>; struct contract_row_v0 { eosio::name code = {}; eosio::name scope = {}; eosio::name table = {}; uint64_t primary_key = {}; eosio::name payer = {}; eosio::input_stream value = {}; }; EOSIO_REFLECT(contract_row_v0, code, scope, table, primary_key, payer, value) using contract_row = std::variant<contract_row_v0>; struct contract_index64_v0 { eosio::name code = {}; eosio::name scope = {}; eosio::name table = {}; uint64_t primary_key = {}; eosio::name payer = {}; uint64_t secondary_key = {}; }; EOSIO_REFLECT(contract_index64_v0, code, scope, table, primary_key, payer, secondary_key) using contract_index64 = std::variant<contract_index64_v0>; struct contract_index128_v0 { eosio::name code = {}; eosio::name scope = {}; eosio::name table = {}; uint64_t primary_key = {}; eosio::name payer = {}; uint128_t secondary_key = {}; }; EOSIO_REFLECT(contract_index128_v0, code, scope, table, primary_key, payer, secondary_key) using contract_index128 = std::variant<contract_index128_v0>; struct contract_index256_v0 { eosio::name code = {}; eosio::name scope = {}; eosio::name table = {}; uint64_t primary_key = {}; eosio::name payer = {}; eosio::checksum256 secondary_key = {}; }; EOSIO_REFLECT(contract_index256_v0, code, scope, table, primary_key, payer, secondary_key) using contract_index256 = std::variant<contract_index256_v0>; struct contract_index_double_v0 { eosio::name code = {}; eosio::name scope = {}; eosio::name table = {}; uint64_t primary_key = {}; eosio::name payer = {}; double secondary_key = {}; }; EOSIO_REFLECT(contract_index_double_v0, code, scope, table, primary_key, payer, secondary_key) using contract_index_double = std::variant<contract_index_double_v0>; struct contract_index_long_double_v0 { eosio::name code = {}; eosio::name scope = {}; eosio::name table = {}; uint64_t primary_key = {}; eosio::name payer = {}; eosio::float128 secondary_key = {}; }; EOSIO_REFLECT(contract_index_long_double_v0, code, scope, table, primary_key, payer, secondary_key) using contract_index_long_double = std::variant<contract_index_long_double_v0>; struct key_value_v0 { eosio::name contract = {}; eosio::input_stream key = {}; eosio::input_stream value = {}; eosio::name payer = {}; }; EOSIO_REFLECT(key_value_v0, contract, key, value, payer) using key_value = std::variant<key_value_v0>; struct key_weight { eosio::public_key key = {}; uint16_t weight = {}; }; EOSIO_REFLECT(key_weight, key, weight) struct block_signing_authority_v0 { uint32_t threshold = {}; std::vector<key_weight> keys = {}; }; EOSIO_REFLECT(block_signing_authority_v0, threshold, keys) using block_signing_authority = std::variant<block_signing_authority_v0>; struct producer_authority { eosio::name producer_name = {}; block_signing_authority authority = {}; }; EOSIO_REFLECT(producer_authority, producer_name, authority) struct producer_authority_schedule { uint32_t version = {}; std::vector<producer_authority> producers = {}; }; EOSIO_REFLECT(producer_authority_schedule, version, producers) struct chain_config_v0 { uint64_t max_block_net_usage = {}; uint32_t target_block_net_usage_pct = {}; uint32_t max_transaction_net_usage = {}; uint32_t base_per_transaction_net_usage = {}; uint32_t net_usage_leeway = {}; uint32_t context_free_discount_net_usage_num = {}; uint32_t context_free_discount_net_usage_den = {}; uint32_t max_block_cpu_usage = {}; uint32_t target_block_cpu_usage_pct = {}; uint32_t max_transaction_cpu_usage = {}; uint32_t min_transaction_cpu_usage = {}; uint32_t max_transaction_lifetime = {}; uint32_t deferred_trx_expiration_window = {}; uint32_t max_transaction_delay = {}; uint32_t max_inline_action_size = {}; uint16_t max_inline_action_depth = {}; uint16_t max_authority_depth = {}; }; EOSIO_REFLECT(chain_config_v0, max_block_net_usage, target_block_net_usage_pct, max_transaction_net_usage, base_per_transaction_net_usage, net_usage_leeway, context_free_discount_net_usage_num, context_free_discount_net_usage_den, max_block_cpu_usage, target_block_cpu_usage_pct, max_transaction_cpu_usage, min_transaction_cpu_usage, max_transaction_lifetime, deferred_trx_expiration_window, max_transaction_delay, max_inline_action_size, max_inline_action_depth, max_authority_depth) struct chain_config_v1 { uint64_t max_block_net_usage = {}; uint32_t target_block_net_usage_pct = {}; uint32_t max_transaction_net_usage = {}; uint32_t base_per_transaction_net_usage = {}; uint32_t net_usage_leeway = {}; uint32_t context_free_discount_net_usage_num = {}; uint32_t context_free_discount_net_usage_den = {}; uint32_t max_block_cpu_usage = {}; uint32_t target_block_cpu_usage_pct = {}; uint32_t max_transaction_cpu_usage = {}; uint32_t min_transaction_cpu_usage = {}; uint32_t max_transaction_lifetime = {}; uint32_t deferred_trx_expiration_window = {}; uint32_t max_transaction_delay = {}; uint32_t max_inline_action_size = {}; uint16_t max_inline_action_depth = {}; uint16_t max_authority_depth = {}; uint32_t max_action_return_value_size = {}; }; EOSIO_REFLECT(chain_config_v1, max_block_net_usage, target_block_net_usage_pct, max_transaction_net_usage, base_per_transaction_net_usage, net_usage_leeway, context_free_discount_net_usage_num, context_free_discount_net_usage_den, max_block_cpu_usage, target_block_cpu_usage_pct, max_transaction_cpu_usage, min_transaction_cpu_usage, max_transaction_lifetime, deferred_trx_expiration_window, max_transaction_delay, max_inline_action_size, max_inline_action_depth, max_authority_depth, max_action_return_value_size) using chain_config = std::variant<chain_config_v0, chain_config_v1>; struct global_property_v0 { std::optional<uint32_t> proposed_schedule_block_num = {}; producer_schedule proposed_schedule = {}; chain_config configuration = {}; }; EOSIO_REFLECT(global_property_v0, proposed_schedule_block_num, proposed_schedule, configuration) struct global_property_v1 { std::optional<uint32_t> proposed_schedule_block_num = {}; producer_authority_schedule proposed_schedule = {}; chain_config configuration = {}; eosio::checksum256 chain_id = {}; }; EOSIO_REFLECT(global_property_v1, proposed_schedule_block_num, proposed_schedule, configuration, chain_id) struct kv_database_config { uint32_t max_key_size = 0; ///< the maximum size in bytes of a key uint32_t max_value_size = 0; ///< the maximum size in bytes of a value uint32_t max_iterators = 0; ///< the maximum number of iterators that a contract can have simultaneously. }; EOSIO_REFLECT(kv_database_config, max_key_size, max_value_size, max_iterators) struct wasm_config { uint32_t max_mutable_global_bytes; uint32_t max_table_elements; uint32_t max_section_elements; uint32_t max_linear_memory_init; uint32_t max_func_local_bytes; uint32_t max_nested_structures; uint32_t max_symbol_bytes; uint32_t max_module_bytes; uint32_t max_code_bytes; uint32_t max_pages; uint32_t max_call_depth; }; EOSIO_REFLECT(wasm_config, max_mutable_global_bytes, max_table_elements, max_section_elements, max_linear_memory_init, max_func_local_bytes, max_nested_structures, max_symbol_bytes, max_module_bytes, max_code_bytes, max_pages, max_call_depth) struct transaction_hook { uint32_t type; eosio::name contract; eosio::name action; }; EOSIO_REFLECT(transaction_hook, type, contract, action) struct global_property_extension_v0 { uint32_t proposed_security_group_block_num = 0; std::vector<eosio::name> proposed_security_group_participants; std::vector<transaction_hook> transaction_hooks; }; EOSIO_REFLECT(global_property_extension_v0, proposed_security_group_block_num, proposed_security_group_participants, transaction_hooks) struct global_property_v2 : global_property_v1 { kv_database_config kv_configuration; wasm_config wasm_configuration; std::variant<global_property_extension_v0> extension; }; EOSIO_REFLECT(global_property_v2, base global_property_v1, kv_configuration, wasm_configuration, extension) using global_property = std::variant<global_property_v0, global_property_v1, global_property_v2>; struct generated_transaction_v0 { eosio::name sender = {}; uint128_t sender_id = {}; eosio::name payer = {}; eosio::checksum256 trx_id = {}; eosio::input_stream packed_trx = {}; }; EOSIO_REFLECT(generated_transaction_v0, sender, sender_id, payer, trx_id, packed_trx) using generated_transaction = std::variant<generated_transaction_v0>; struct activated_protocol_feature_v0 { eosio::checksum256 feature_digest = {}; uint32_t activation_block_num = {}; }; EOSIO_REFLECT(activated_protocol_feature_v0, feature_digest, activation_block_num) using activated_protocol_feature = std::variant<activated_protocol_feature_v0>; struct protocol_state_v0 { std::vector<activated_protocol_feature> activated_protocol_features = {}; }; EOSIO_REFLECT(protocol_state_v0, activated_protocol_features) using protocol_state = std::variant<protocol_state_v0>; struct permission_level_weight { permission_level permission = {}; uint16_t weight = {}; }; EOSIO_REFLECT(permission_level_weight, permission, weight) struct wait_weight { uint32_t wait_sec = {}; uint16_t weight = {}; }; EOSIO_REFLECT(wait_weight, wait_sec, weight) struct authority { uint32_t threshold = {}; std::vector<key_weight> keys = {}; std::vector<permission_level_weight> accounts = {}; std::vector<wait_weight> waits = {}; }; EOSIO_REFLECT(authority, threshold, keys, accounts, waits) struct permission_v0 { eosio::name owner = {}; eosio::name name = {}; eosio::name parent = {}; eosio::time_point last_updated = {}; authority auth = {}; }; EOSIO_REFLECT(permission_v0, owner, name, parent, last_updated, auth) using permission = std::variant<permission_v0>; struct permission_link_v0 { eosio::name account = {}; eosio::name code = {}; eosio::name message_type = {}; eosio::name required_permission = {}; }; EOSIO_REFLECT(permission_link_v0, account, code, message_type, required_permission) using permission_link = std::variant<permission_link_v0>; struct resource_limits_v0 { eosio::name owner = {}; int64_t net_weight = {}; int64_t cpu_weight = {}; int64_t ram_bytes = {}; }; EOSIO_REFLECT(resource_limits_v0, owner, net_weight, cpu_weight, ram_bytes) using resource_limits = std::variant<resource_limits_v0>; struct usage_accumulator_v0 { uint32_t last_ordinal = {}; uint64_t value_ex = {}; uint64_t consumed = {}; }; EOSIO_REFLECT(usage_accumulator_v0, last_ordinal, value_ex, consumed) using usage_accumulator = std::variant<usage_accumulator_v0>; struct resource_usage_v0 { eosio::name owner = {}; usage_accumulator net_usage = {}; usage_accumulator cpu_usage = {}; uint64_t ram_usage = {}; }; EOSIO_REFLECT(resource_usage_v0, owner, net_usage, cpu_usage, ram_usage) using resource_usage = std::variant<resource_usage_v0>; struct resource_limits_state_v0 { usage_accumulator average_block_net_usage = {}; usage_accumulator average_block_cpu_usage = {}; uint64_t total_net_weight = {}; uint64_t total_cpu_weight = {}; uint64_t total_ram_bytes = {}; uint64_t virtual_net_limit = {}; uint64_t virtual_cpu_limit = {}; }; EOSIO_REFLECT(resource_limits_state_v0, average_block_net_usage, average_block_cpu_usage, total_net_weight, total_cpu_weight, total_ram_bytes, virtual_net_limit, virtual_cpu_limit) using resource_limits_state = std::variant<resource_limits_state_v0>; struct resource_limits_ratio_v0 { uint64_t numerator = {}; uint64_t denominator = {}; }; EOSIO_REFLECT(resource_limits_ratio_v0, numerator, denominator) using resource_limits_ratio = std::variant<resource_limits_ratio_v0>; struct elastic_limit_parameters_v0 { uint64_t target = {}; uint64_t max = {}; uint32_t periods = {}; uint32_t max_multiplier = {}; resource_limits_ratio contract_rate = {}; resource_limits_ratio expand_rate = {}; }; EOSIO_REFLECT(elastic_limit_parameters_v0, target, max, periods, max_multiplier, contract_rate, expand_rate) using elastic_limit_parameters = std::variant<elastic_limit_parameters_v0>; struct resource_limits_config_v0 { elastic_limit_parameters cpu_limit_parameters = {}; elastic_limit_parameters net_limit_parameters = {}; uint32_t account_cpu_usage_average_window = {}; uint32_t account_net_usage_average_window = {}; }; EOSIO_REFLECT(resource_limits_config_v0, cpu_limit_parameters, net_limit_parameters, account_cpu_usage_average_window, account_net_usage_average_window) using resource_limits_config = std::variant<resource_limits_config_v0>; } // namespace test_protocol
[ "huangh@objectcomputing.com" ]
huangh@objectcomputing.com
90c20498c7c14076e4ac1a24a831286a07a3d6de
bffe69fcd11a8d34a0a18078e9b4c277269ea6ab
/Workshop7/Workshop7/Workshop7/Q2.cpp
8260049c86511c5dd3461f9b69cf6438ba3a5c77
[]
no_license
m-kojic/cplusplus-exercises
8da379431f26066008efca7003a53e996b06bd73
9f1bd01edee61960f29d140935e94b2218be5a75
refs/heads/master
2020-12-29T23:40:15.385601
2020-03-27T13:06:27
2020-03-27T13:06:27
238,780,211
0
0
null
null
null
null
UTF-8
C++
false
false
506
cpp
//Q2(only 5.41 % correct) //#include <iostream> //using namespace std; // //int main() //{ // std::cout << "Q2\n"; // // // A) i is declared before the loop so we can use it after the loop // int i; // for (i = 0; i < 5; i++) { // // B) multiply i by 2 and store it to i // i = 2 * i; // cout << "i: " << i << endl; // } // cout << "i after the loop: " << i << endl; // // // OUTPUT: // // i : 0 // // i : 2 // // i : 6 // // i after the loop : 7 //}
[ "m.kojic@live.com" ]
m.kojic@live.com
4c852c8ba5b1e4b4ca5cf28ecc77c542f3a7cf32
24d75ffa3af1b85325b39dc909343a8d945e9171
/Avocado/AvocadoActiveXCtrl/AvocadoActiveXCtrl.cpp
fb0650af4fc184469d8caed734a7ad4c88482b18
[]
no_license
assafyariv/PSG
0c2bf874166c7a7df18e8537ae5841bf8805f166
ce932ca9a72a5553f8d1826f3058e186619a4ec8
refs/heads/master
2016-08-12T02:57:17.021428
2015-09-24T17:14:51
2015-09-24T17:14:51
43,080,715
0
0
null
null
null
null
UTF-8
C++
false
false
3,302
cpp
// AvocadoActiveXCtrl.cpp : Implementation of CAvocadoActiveXCtrlApp and DLL registration. #include "stdafx.h" #include "AvocadoActiveXCtrl.h" #include "../AvocadoEngine/AvocadoAppInterface.h" #include "Cathelp.h" #ifdef _DEBUG #define new DEBUG_NEW #endif CAvocadoActiveXCtrlApp theApp; const GUID CDECL _tlid = { 0x1D49C79F, 0x2D78, 0x417F, { 0x91, 0x23, 0x8D, 0xF5, 0xC1, 0x8E, 0xA, 0x7F } }; const WORD _wVerMajor = 1; const WORD _wVerMinor = 0; // CLSID_SafeItem - Necessary for safe ActiveX control // The value is taken from IMPLEMENT_OLECREATE_EX in MFCSafeActiveXCtrl.cpp. // It is actually the CLSID of the ActiveX control. const CATID CLSID_SafeItem = { 0x1ebae592, 0x7515, 0x43c2,{ 0xa6, 0xf1, 0xcd, 0xee, 0xdf, 0x3f, 0xd8, 0x2b}}; // CAvocadoActiveXCtrlApp::InitInstance - DLL initialization BOOL CAvocadoActiveXCtrlApp::InitInstance() { BOOL bInit = COleControlModule::InitInstance(); if (bInit) { // TODO: Add your own module initialization code here. avocado::AvocadoInit (); } return bInit; } // CAvocadoActiveXCtrlApp::ExitInstance - DLL termination int CAvocadoActiveXCtrlApp::ExitInstance() { // TODO: Add your own module termination code here. avocado::AvocadoTerminate(); return COleControlModule::ExitInstance(); } // DllRegisterServer - Adds entries to the system registry STDAPI DllRegisterServer(void) { AFX_MANAGE_STATE(_afxModuleAddrThis); if (!AfxOleRegisterTypeLib(AfxGetInstanceHandle(), _tlid)) return ResultFromScode(SELFREG_E_TYPELIB); if (!COleObjectFactoryEx::UpdateRegistryAll(TRUE)) return ResultFromScode(SELFREG_E_CLASS); // Mark the control as safe for initializing. (Added) HRESULT hr = CreateComponentCategory(CATID_SafeForInitializing, L"Controls safely initializable from persistent data!"); if (FAILED(hr)) return hr; hr = RegisterCLSIDInCategory(CLSID_SafeItem, CATID_SafeForInitializing); if (FAILED(hr)) return hr; // Mark the control as safe for scripting. (Added) hr = CreateComponentCategory(CATID_SafeForScripting, L"Controls safely scriptable!"); if (FAILED(hr)) return hr; hr = RegisterCLSIDInCategory(CLSID_SafeItem, CATID_SafeForScripting); if (FAILED(hr)) return hr; hr = RegisterCLSIDInCategory(CLSID_SafeItem, CATID_PersistsToFile); if (FAILED(hr)) return hr; hr = RegisterCLSIDInCategory(CLSID_SafeItem, CATID_DesignTimeUIActivatableControl); if (FAILED(hr)) return hr; return NOERROR; } // DllUnregisterServer - Removes entries from the system registry STDAPI DllUnregisterServer(void) { AFX_MANAGE_STATE(_afxModuleAddrThis); if (!AfxOleUnregisterTypeLib(_tlid, _wVerMajor, _wVerMinor)) return ResultFromScode(SELFREG_E_TYPELIB); if (!COleObjectFactoryEx::UpdateRegistryAll(FALSE)) return ResultFromScode(SELFREG_E_CLASS); // Remove entries from the registry. // safe stuff .. HRESULT hr = UnRegisterCLSIDInCategory(CLSID_SafeItem, CATID_SafeForInitializing); if (FAILED(hr)) return hr; hr = UnRegisterCLSIDInCategory(CLSID_SafeItem, CATID_SafeForScripting); if (FAILED(hr)) return hr; hr = UnRegisterCLSIDInCategory(CLSID_SafeItem, CATID_PersistsToFile); if (FAILED(hr)) return hr; hr = UnRegisterCLSIDInCategory(CLSID_SafeItem, CATID_DesignTimeUIActivatableControl); if (FAILED(hr)) return hr; return NOERROR; }
[ "assafyariv@gmail.com" ]
assafyariv@gmail.com
b7dd1c96678fa245994f9d5e9c2008e55f487bf3
5fa0e32ee5bf534e4a187870985d62d55eb3d5c6
/humble-crap/humble-network.hpp
7a8dd9461cbe2464425c6e4962bc2879b7e4f343
[ "Unlicense" ]
permissive
lukesalisbury/humble-crap
271ce3b6df1dfa9f1e7a8d710509e4e82bb1629c
814c551cfdfa2687d531b50d350a0d2a6f5cf832
refs/heads/master
2021-01-18T17:14:59.234310
2019-10-28T05:30:37
2019-10-28T05:30:37
12,215,398
2
0
null
null
null
null
UTF-8
C++
false
false
2,395
hpp
/**************************************************************************** * Copyright © Luke Salisbury * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgement in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. ****************************************************************************/ #ifndef HUMBLENETWORK_HPP #define HUMBLENETWORK_HPP #include <QObject> #include <QtNetwork/QNetworkAccessManager> #include <QtNetwork/QNetworkRequest> #include <QtNetwork/QNetworkReply> #include <QtCore> #include <QNetworkCookieJar> #include <QNetworkCookie> #include "local-cookie-jar.hpp" class HumbleNetworkRequest : public QObject { Q_OBJECT public: explicit HumbleNetworkRequest( ); QByteArray retrieveContent(); bool writeContent( QString outputFile ); void appendPost( QString key, QString value ); bool makeRequest(QUrl url, QString requester = "XMLHttpRequest"); QNetworkCookieJar * getCookies(); bool setCookies(QNetworkCookieJar * cookies_jar); void printCookies(); signals: void requestError( QString errorMessage, QByteArray content, qint16 httpCode ); void requestSuccessful( QByteArray content ); void requestProgress( qint64 bytesReceived, qint64 bytesTotal ); public slots: void finishRequest( QNetworkReply* pReply ); void sslError( QNetworkReply* pReply, const QList<QSslError> & errors ); void downloadProgress ( qint64 bytesReceived, qint64 bytesTotal ); private: QNetworkReply * reply; QNetworkAccessManager * webManager; QByteArray downloadData; QString errorMessage; QByteArray postData; public: bool sslMissing; QString csrfPreventionToken = ""; }; #endif // HUMBLENETWORK_HPP
[ "dev@lukesalisbury.name" ]
dev@lukesalisbury.name
241780398d88347a6b3ee93da70d9b060fe61b52
86a9081a05b837ad0f0feaf6e003a1cbb276993f
/cg_exercises-cg_exercise_01/cg_exercise_01/cglib/lib/glm/glm/detail/_features.hpp
e5a1a54321277df72b7b3f9e8c6b3bb711862e51
[ "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-happy-bunny", "LicenseRef-scancode-unknown-license-reference" ]
permissive
flex3r/cg_exercises
e2defd27427c251d5f0f567a8d192af8d87bca3c
7c4b699a8211ba66710ac2137f0d460933069331
refs/heads/master
2020-12-11T14:06:15.052585
2018-02-11T13:58:23
2018-02-11T13:58:23
null
0
0
null
null
null
null
UTF-8
C++
false
false
11,967
hpp
/// @ref core /// @file glm/detail/_features.hpp #pragma once // #define GLM_CXX98_EXCEPTIONS // #define GLM_CXX98_RTTI // #define GLM_CXX11_RVALUE_REFERENCES // Rvalue references - GCC 4.3 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2118.html // GLM_CXX11_TRAILING_RETURN // Rvalue references for *this - GCC not supported // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2439.htm // GLM_CXX11_NONSTATIC_MEMBER_INIT // Initialization of class objects by rvalues - GCC any // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1610.html // GLM_CXX11_NONSTATIC_MEMBER_INIT // Non-static data member initializers - GCC 4.7 // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2008/n2756.htm // #define GLM_CXX11_VARIADIC_TEMPLATE // Variadic templates - GCC 4.3 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2242.pdf // // Extending variadic template template parameters - GCC 4.4 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2555.pdf // #define GLM_CXX11_GENERALIZED_INITIALIZERS // Initializer lists - GCC 4.4 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm // #define GLM_CXX11_STATIC_ASSERT // Static assertions - GCC 4.3 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1720.html // #define GLM_CXX11_AUTO_TYPE // auto-typed variables - GCC 4.4 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1984.pdf // #define GLM_CXX11_AUTO_TYPE // Multi-declarator auto - GCC 4.4 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1737.pdf // #define GLM_CXX11_AUTO_TYPE // Removal of auto as a storage-class specifier - GCC 4.4 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2546.htm // #define GLM_CXX11_AUTO_TYPE // New function declarator syntax - GCC 4.4 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2541.htm // #define GLM_CXX11_LAMBDAS // New wording for C++0x lambdas - GCC 4.5 // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2927.pdf // #define GLM_CXX11_DECLTYPE // Declared type of an expression - GCC 4.3 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2343.pdf // // Right angle brackets - GCC 4.3 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1757.html // // Default template arguments for function templates DR226 GCC 4.3 // http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#226 // // Solving the SFINAE problem for expressions DR339 GCC 4.4 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2634.html // #define GLM_CXX11_ALIAS_TEMPLATE // Template aliases N2258 GCC 4.7 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf // // Extern templates N1987 Yes // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1987.htm // #define GLM_CXX11_NULLPTR // Null pointer constant N2431 GCC 4.6 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf // #define GLM_CXX11_STRONG_ENUMS // Strongly-typed enums N2347 GCC 4.4 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf // // Forward declarations for enums N2764 GCC 4.6 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2764.pdf // // Generalized attributes N2761 GCC 4.8 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2761.pdf // // Generalized constant expressions N2235 GCC 4.6 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf // // Alignment support N2341 GCC 4.8 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf // #define GLM_CXX11_DELEGATING_CONSTRUCTORS // Delegating constructors N1986 GCC 4.7 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1986.pdf // // Inheriting constructors N2540 GCC 4.8 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2540.htm // #define GLM_CXX11_EXPLICIT_CONVERSIONS // Explicit conversion operators N2437 GCC 4.5 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf // // New character types N2249 GCC 4.4 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2249.html // // Unicode string literals N2442 GCC 4.5 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm // // Raw string literals N2442 GCC 4.5 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm // // Universal character name literals N2170 GCC 4.5 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2170.html // #define GLM_CXX11_USER_LITERALS // User-defined literals N2765 GCC 4.7 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2765.pdf // // Standard Layout Types N2342 GCC 4.5 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2342.htm // #define GLM_CXX11_DEFAULTED_FUNCTIONS // #define GLM_CXX11_DELETED_FUNCTIONS // Defaulted and deleted functions N2346 GCC 4.4 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2346.htm // // Extended friend declarations N1791 GCC 4.7 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1791.pdf // // Extending sizeof N2253 GCC 4.4 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2253.html // #define GLM_CXX11_INLINE_NAMESPACES // Inline namespaces N2535 GCC 4.4 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2535.htm // #define GLM_CXX11_UNRESTRICTED_UNIONS // Unrestricted unions N2544 GCC 4.6 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf // #define GLM_CXX11_LOCAL_TYPE_TEMPLATE_ARGS // Local and unnamed types as template arguments N2657 GCC 4.5 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm // #define GLM_CXX11_RANGE_FOR // Range-based for N2930 GCC 4.6 // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2930.html // #define GLM_CXX11_OVERRIDE_CONTROL // Explicit virtual overrides N2928 N3206 N3272 GCC 4.7 // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2928.htm // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3206.htm // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3272.htm // // Minimal support for garbage collection and reachability-based leak detection N2670 No // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2670.htm // #define GLM_CXX11_NOEXCEPT // Allowing move constructors to throw [noexcept] N3050 GCC 4.6 (core language only) // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3050.html // // Defining move special member functions N3053 GCC 4.6 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3053.html // // Sequence points N2239 Yes // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2239.html // // Atomic operations N2427 GCC 4.4 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2239.html // // Strong Compare and Exchange N2748 GCC 4.5 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2427.html // // Bidirectional Fences N2752 GCC 4.8 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2752.htm // // Memory model N2429 GCC 4.8 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2429.htm // // Data-dependency ordering: atomics and memory model N2664 GCC 4.4 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2664.htm // // Propagating exceptions N2179 GCC 4.4 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html // // Abandoning a process and at_quick_exit N2440 GCC 4.8 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2440.htm // // Allow atomics use in signal handlers N2547 Yes // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2547.htm // // Thread-local storage N2659 GCC 4.8 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2659.htm // // Dynamic initialization and destruction with concurrency N2660 GCC 4.3 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2660.htm // // __func__ predefined identifier N2340 GCC 4.3 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2340.htm // // C99 preprocessor N1653 GCC 4.3 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1653.htm // // long long N1811 GCC 4.3 // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1811.pdf // // Extended integral types N1988 Yes // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1988.pdf #if(GLM_COMPILER & GLM_COMPILER_GCC) # if(GLM_COMPILER >= GLM_COMPILER_GCC43) # define GLM_CXX11_STATIC_ASSERT # endif #elif(GLM_COMPILER & GLM_COMPILER_CLANG) # if(__has_feature(cxx_exceptions)) # define GLM_CXX98_EXCEPTIONS # endif # if(__has_feature(cxx_rtti)) # define GLM_CXX98_RTTI # endif # if(__has_feature(cxx_access_control_sfinae)) # define GLM_CXX11_ACCESS_CONTROL_SFINAE # endif # if(__has_feature(cxx_alias_templates)) # define GLM_CXX11_ALIAS_TEMPLATE # endif # if(__has_feature(cxx_alignas)) # define GLM_CXX11_ALIGNAS # endif # if(__has_feature(cxx_attributes)) # define GLM_CXX11_ATTRIBUTES # endif # if(__has_feature(cxx_constexpr)) # define GLM_CXX11_CONSTEXPR # endif # if(__has_feature(cxx_decltype)) # define GLM_CXX11_DECLTYPE # endif # if(__has_feature(cxx_default_function_template_args)) # define GLM_CXX11_DEFAULT_FUNCTION_TEMPLATE_ARGS # endif # if(__has_feature(cxx_defaulted_functions)) # define GLM_CXX11_DEFAULTED_FUNCTIONS # endif # if(__has_feature(cxx_delegating_constructors)) # define GLM_CXX11_DELEGATING_CONSTRUCTORS # endif # if(__has_feature(cxx_deleted_functions)) # define GLM_CXX11_DELETED_FUNCTIONS # endif # if(__has_feature(cxx_explicit_conversions)) # define GLM_CXX11_EXPLICIT_CONVERSIONS # endif # if(__has_feature(cxx_generalized_initializers)) # define GLM_CXX11_GENERALIZED_INITIALIZERS # endif # if(__has_feature(cxx_implicit_moves)) # define GLM_CXX11_IMPLICIT_MOVES # endif # if(__has_feature(cxx_inheriting_constructors)) # define GLM_CXX11_INHERITING_CONSTRUCTORS # endif # if(__has_feature(cxx_inline_namespaces)) # define GLM_CXX11_INLINE_NAMESPACES # endif # if(__has_feature(cxx_lambdas)) # define GLM_CXX11_LAMBDAS # endif # if(__has_feature(cxx_local_type_template_args)) # define GLM_CXX11_LOCAL_TYPE_TEMPLATE_ARGS # endif # if(__has_feature(cxx_noexcept)) # define GLM_CXX11_NOEXCEPT # endif # if(__has_feature(cxx_nonstatic_member_init)) # define GLM_CXX11_NONSTATIC_MEMBER_INIT # endif # if(__has_feature(cxx_nullptr)) # define GLM_CXX11_NULLPTR # endif # if(__has_feature(cxx_override_control)) # define GLM_CXX11_OVERRIDE_CONTROL # endif # if(__has_feature(cxx_reference_qualified_functions)) # define GLM_CXX11_REFERENCE_QUALIFIED_FUNCTIONS # endif # if(__has_feature(cxx_range_for)) # define GLM_CXX11_RANGE_FOR # endif # if(__has_feature(cxx_raw_string_literals)) # define GLM_CXX11_RAW_STRING_LITERALS # endif # if(__has_feature(cxx_rvalue_references)) # define GLM_CXX11_RVALUE_REFERENCES # endif # if(__has_feature(cxx_static_assert)) # define GLM_CXX11_STATIC_ASSERT # endif # if(__has_feature(cxx_auto_type)) # define GLM_CXX11_AUTO_TYPE # endif # if(__has_feature(cxx_strong_enums)) # define GLM_CXX11_STRONG_ENUMS # endif # if(__has_feature(cxx_trailing_return)) # define GLM_CXX11_TRAILING_RETURN # endif # if(__has_feature(cxx_unicode_literals)) # define GLM_CXX11_UNICODE_LITERALS # endif # if(__has_feature(cxx_unrestricted_unions)) # define GLM_CXX11_UNRESTRICTED_UNIONS # endif # if(__has_feature(cxx_user_literals)) # define GLM_CXX11_USER_LITERALS # endif # if(__has_feature(cxx_variadic_templates)) # define GLM_CXX11_VARIADIC_TEMPLATES # endif #endif//(GLM_COMPILER & GLM_COMPILER_CLANG) // CG_REVISION 1d384085f04ade0a730db0ed88bbd9f2df80dad9
[ "n1085633848@outlook.com" ]
n1085633848@outlook.com
be7f6fe3a60582528685480ff7b7819358e16898
6dfb27b6b6c5addd0bdb28c56e32174a7b9e079c
/637-Average of Levels in Binary Tree /main.cpp
4149ebee479601ce75c473780f261d2be38505a8
[]
no_license
wondervictor/LeetCode-Solutions
cb4313a6c2e9290627fb362b72bf2ad6106f8e58
3f20837739595481e6a5e5b0ba869a406ec0607e
refs/heads/master
2021-01-13T13:44:06.178067
2020-04-23T12:47:22
2020-04-23T12:47:22
76,328,898
7
1
null
null
null
null
UTF-8
C++
false
false
1,144
cpp
#include <iostream> #include <vector> #include <queue> using namespace std; /** * Definition for a binary tree node. */ struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) {} }; class Solution { public: vector<double> averageOfLevels(TreeNode* root) { vector<double> result; if (root == nullptr) { return result; } queue<TreeNode* > nodes; nodes.push(root); while(nodes.size()) { int size = (int)nodes.size(); double currentSum = 0; for(int i = 0; i < size; i ++) { TreeNode* curNode = nodes.front(); nodes.pop(); currentSum += curNode->val; if (curNode->left) nodes.push(curNode->left); if (curNode->right) nodes.push(curNode->right); } double avg = currentSum/size; result.push_back(avg); } return result; } }; int main() { std::cout << "Hello, World!" << std::endl; return 0; }
[ "victorchanchina@gmail.com" ]
victorchanchina@gmail.com
91a25e27dd1335999f48452da1dfbc07c823bf1e
e36128cfc5a6ef0cef1da54e536c99250fc6fd43
/Libs/include/YXC_Sys/YXC_NCMClient.hpp
75e89d0018c019785534de92847d9563897f870d
[]
no_license
yuanqs86/native
f53cb48bae133976c89189e1ea879ab6854a9004
0a46999537260620b683296d53140e1873442514
refs/heads/master
2021-08-31T14:50:41.572622
2017-12-21T19:20:10
2017-12-21T19:20:10
114,990,467
0
1
null
null
null
null
UTF-8
C++
false
false
2,245
hpp
/* ****************************************************************************** *\ Author : Qiushi Yuan Copyright(c) 2008-2015 Qiushi Yuan. All Rights Reserved. This software is supplied under the terms, you cannot copy or disclose except agreement with the author. \* ****************************************************************************** */ #ifndef __INC_YXC_BASEEX_NET_CSMODEL_CLIENT_HPP__ #define __INC_YXC_BASEEX_NET_CSMODEL_CLIENT_HPP__ #include <YXC_Sys/YXC_NetSModelClient.h> #include <YXC_Sys/YXC_Locker.hpp> namespace YXCLib { class YXC_CLASS NCMClient { public: NCMClient(); virtual ~NCMClient(); YXC_Status SendPackage(const YXC_NetPackage* pPackage, yuint32_t stTimeout); void Close(ybool_t bWaitForClosed); ybool_t IsConnected() const; YXC_Status ConnectAndCreateW(YXC_NetSModelClientMgr cliMgr, const wchar_t* cszIp, yuint32_t uPort, yuint32_t uTimeout); YXC_Status ConnectAndCreate(YXC_NetSModelClientMgr cliMgr, const ychar* cszIp, yuint32_t uPort, yuint32_t uTimeout); YXC_Status ConnectAndCreateA(YXC_NetSModelClientMgr cliMgr, const char* cwszIp, yuint32_t uPort, yuint32_t uTimeout); YXC_Status AttachSocket(YXC_NetSModelClientMgr cliMgr, YXC_Socket sock); YXC_Status GetSocketOpt(YXC_SocketOption option, YXC_SocketOptValue* pOptVal); YXC_Status SetSocketOpt(YXC_SocketOption option, const YXC_SocketOptValue* pOptVal); void NotifyClose(); protected: virtual YXC_Status _OnInitSockAttr(YXC_Socket sock); virtual void _OnClose(ybool_t bClosedActively, const YXC_Error* pClosedReason); virtual void _OnReceive(const YXC_NetPackage* pPackage); private: NCMClient(const NCMClient& rhs); NCMClient& operator =(const NCMClient& rhs); YXC_Status _AttachSocket(YXC_NetSModelClientMgr cliMgr, YXC_Socket sock); private: static void OnClientClose(YXC_NetSModelClientMgr mgr, YXC_NetSModelClient client, void* pExtData, void* pClientExt, ybool_t bClosedActively); static void OnClientRecv(YXC_NetSModelClientMgr mgr, YXC_NetSModelClient client, const YXC_NetPackage* pPackage, void* pExtData, void* pClientExt); private: YXC_NetSModelClient _client; YXC_NetSModelClientMgr _mgr; }; } #endif /* __INC_YXC_BASEEX_NET_CSMODEL_CLIENT_HPP__ */
[ "34738843+yuanqs86@users.noreply.github.com" ]
34738843+yuanqs86@users.noreply.github.com
e1616ce9bab8b4bf5796ead03be1bc7f7e15f8d9
1c8bca2e8234e0b6e8a70db91b1d4749d13783f2
/Linux/FFP/12_TexturePyramidAndCube/TexturePyramidAndCube.cpp
5aac4ed0b084ebd6395a35b33ca5c21b24f0a8e6
[]
no_license
jayshreegandhi/RTR
206e6e307dc9d3bfef85492b2f0efdcb7e429881
88d49f1e1f2b6ad58e29b5aaf279ffdfe7f53201
refs/heads/master
2023-01-05T01:47:18.935907
2020-11-09T06:36:20
2020-11-09T06:36:20
311,237,656
0
0
null
null
null
null
UTF-8
C++
false
false
11,513
cpp
#include<iostream> #include<stdio.h> #include<stdlib.h> #include<memory.h> #include<X11/Xlib.h> #include<X11/Xutil.h> #include<X11/XKBlib.h> #include<X11/keysym.h> #include<GL/gl.h> #include<GL/glx.h> #include<GL/glu.h> #include<SOIL/SOIL.h> using namespace std; bool bFullscreen = false; Display *gpDisplay = NULL; XVisualInfo *gpXVisualInfo = NULL; Colormap gColormap; Window gWindow; int gWindowWidth = 800; int gWindowHeight = 600; FILE *gpFile = NULL; //function prototypes void CreateWindow(void); void ToggleFullscreen(void); void uninitialize(void); GLXContext gGLXContext; void initialize(void); void resize(int,int); void display(void); void update(void); bool bDone = false; bool loadTexture(GLuint *, const char *); void DrawPyramid(void); void DrawCube(void); GLfloat pyramidSpinningAngle = 0.0f; GLuint texture_stone; GLfloat cubeRotationAngle = 0.0f; GLuint texture_kundali; int main(void) { int winWidth = gWindowWidth; int winHeight = gWindowHeight; gpFile = fopen("Log.txt", "w"); if (!(gpFile)) { printf("Log file can not be created\n"); exit(0); } else { fprintf(gpFile, "Log file created successfully...\n"); } CreateWindow(); initialize(); XEvent event; KeySym keysym; while(bDone == false) { while(XPending(gpDisplay)) { XNextEvent(gpDisplay,&event); switch(event.type) { case MapNotify: break; case KeyPress: keysym = XkbKeycodeToKeysym(gpDisplay, event.xkey.keycode, 0, 0); switch(keysym) { case XK_Escape: bDone = true; break; case XK_F: case XK_f: if(bFullscreen == false) { ToggleFullscreen(); bFullscreen = true; } else { ToggleFullscreen(); bFullscreen = false; } break; default: break; } break; case ButtonPress: switch(event.xbutton.button) { case 1: break; case 2: break; case 3: break; default: break; } break; case MotionNotify: break; case ConfigureNotify: winWidth = event.xconfigure.width; winHeight = event.xconfigure.height; resize(winWidth,winHeight); break; case Expose: break; case DestroyNotify: break; case 33: bDone = true; break; default: break; } } update(); display(); } uninitialize(); return(0); } void CreateWindow(void) { XSetWindowAttributes winAttribs; int defaultScreen; //int defaultDepth; int styleMask; //though not necessary in our opengl practices , it(static) is done by many SDKs ex: Imagination,Unreal static int frameBufferAttribute[] = { GLX_RGBA, GLX_DOUBLEBUFFER,True, GLX_RED_SIZE, 8, GLX_GREEN_SIZE, 8, GLX_BLUE_SIZE, 8, GLX_ALPHA_SIZE, 8, GLX_DEPTH_SIZE,24, None }; gpDisplay = XOpenDisplay(NULL); if(gpDisplay == NULL) { fprintf(gpFile, "\nERROR : Unable to open XDisplay.Exitting now..\n"); printf("\nERROR : Unable to open XDisplay.\nExitting now..\n"); uninitialize(); exit(1); } defaultScreen = XDefaultScreen(gpDisplay); //defaultDepth = DefaultDepth(gpDisplay,defaultScreen); //Bridging API gives you visual in opengl code gpXVisualInfo = glXChooseVisual(gpDisplay, defaultScreen, frameBufferAttribute); if(gpXVisualInfo == NULL) { fprintf(gpFile, "\nERROR : Unable to get XVisualInfo .Exitting now..\n"); printf("\nERROR : Unable to get XVisualInfo.\nExitting now..\n"); uninitialize(); exit(1); } winAttribs.border_pixel = 0; winAttribs.border_pixmap = 0; winAttribs.colormap = XCreateColormap(gpDisplay, RootWindow(gpDisplay, gpXVisualInfo->screen), gpXVisualInfo->visual, AllocNone); winAttribs.background_pixel = BlackPixel(gpDisplay, defaultScreen); winAttribs.background_pixmap = 0; winAttribs.event_mask = ExposureMask | VisibilityChangeMask | ButtonPressMask | KeyPressMask | PointerMotionMask | StructureNotifyMask; styleMask = CWBorderPixel | CWBackPixel | CWEventMask | CWColormap; gWindow = XCreateWindow(gpDisplay, RootWindow(gpDisplay, gpXVisualInfo->screen), 0, 0, gWindowWidth, gWindowHeight, 0, gpXVisualInfo->depth, InputOutput, gpXVisualInfo->visual, styleMask, &winAttribs); if(!gWindow) { fprintf(gpFile, "\nERROR : Failed to create main window.Exitting now..\n"); printf("\nERROR : Failed to create main window.\nExitting now..\n"); uninitialize(); exit(1); } XStoreName(gpDisplay, gWindow, "My First XWindows Window - Jayshree Gandhi"); Atom windowManagerDelete = XInternAtom(gpDisplay, "WM_DELETE_WINDOW",True); XSetWMProtocols(gpDisplay, gWindow, &windowManagerDelete, 1); XMapWindow(gpDisplay, gWindow); } void ToggleFullscreen(void) { Atom wm_state; Atom fullscreen; XEvent xev = {0}; wm_state = XInternAtom(gpDisplay, "_NET_WM_STATE", False); memset(&xev, 0, sizeof(xev)); xev.type = ClientMessage; xev.xclient.window = gWindow; xev.xclient.message_type = wm_state; xev.xclient.format = 32; xev.xclient.data.l[0] = bFullscreen ? 0 : 1; fullscreen = XInternAtom(gpDisplay, "_NET_WM_STATE_FULLSCREEN", False); xev.xclient.data.l[1] = fullscreen; XSendEvent(gpDisplay, RootWindow(gpDisplay, gpXVisualInfo->screen), False, StructureNotifyMask, &xev); } bool loadTexture(GLuint *texture, const char* path) { bool bResult = false; int imageWidth; int imageHeight; unsigned char* imageData = NULL; imageData = SOIL_load_image(path, &imageWidth, &imageHeight, 0, SOIL_LOAD_RGB); if(imageData == NULL) { bResult = false; return(bResult); } else { bResult = true; } glPixelStorei(GL_UNPACK_ALIGNMENT, 4); glGenTextures(1, texture); glBindTexture(GL_TEXTURE_2D, *texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); gluBuild2DMipmaps(GL_TEXTURE_2D, 3, imageWidth, imageHeight, GL_BGR_EXT, GL_UNSIGNED_BYTE, imageData); SOIL_free_image_data(imageData); return(bResult); } void initialize(void) { //get the rendering context gGLXContext = glXCreateContext(gpDisplay,gpXVisualInfo,NULL,GL_TRUE); if(gGLXContext == NULL) { //return(-1); fprintf(gpFile, "\nERROR : glXCreateContext() Failed\n"); printf("\nERROR : glXCreateContext() Failed\nExitting now..\n"); uninitialize(); exit(1); } glXMakeCurrent(gpDisplay,gWindow,gGLXContext); //usual opengl initialization code: glShadeModel(GL_SMOOTH); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClearDepth(1.0f); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); loadTexture(&texture_stone,"Stone.bmp"); loadTexture(&texture_kundali,"Kundali.bmp"); resize(gWindowWidth,gWindowHeight); } void resize(int width, int height) { //usual resize code if(height == 0) { height = 1; } glViewport(0, 0, (GLsizei)width, (GLsizei)height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f, (GLfloat)width / (GLfloat)height, 0.1f, 100.0f); } void display(void) { //usual display code - last line only in double buffering //but in single buffering, whole code is same glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glEnable(GL_TEXTURE_2D); glLoadIdentity(); glTranslatef(-1.5f, 0.0f, -5.0f); glRotatef(pyramidSpinningAngle, 0.0f, 1.0f, 0.0f); glBindTexture(GL_TEXTURE_2D,texture_stone); DrawPyramid(); glDisable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D); glLoadIdentity(); glTranslatef(1.5f, 0.0f, -5.0f); glScalef(0.75f, 0.75f, 0.75f); glRotatef(cubeRotationAngle,1.0f, 1.0f, 1.0f); glBindTexture(GL_TEXTURE_2D, texture_kundali); DrawCube(); glDisable(GL_TEXTURE_2D); glXSwapBuffers(gpDisplay, gWindow); } void update(void) { pyramidSpinningAngle = pyramidSpinningAngle + 1.0f; if (pyramidSpinningAngle >= 360.0f) { pyramidSpinningAngle = 0.0f; } cubeRotationAngle = cubeRotationAngle - 1.0f; if (cubeRotationAngle <= -360.0f) { cubeRotationAngle = 0.0f; } } void uninitialize(void) { GLXContext currentGLXContext = glXGetCurrentContext(); if(currentGLXContext != NULL && currentGLXContext == gGLXContext) { glXMakeCurrent(gpDisplay, 0,0); } if(gGLXContext) { glXDestroyContext(gpDisplay,gGLXContext); } if(gWindow) { XDestroyWindow(gpDisplay, gWindow); gWindow = 0; } if(gColormap) { XFreeColormap(gpDisplay, gColormap); gColormap = 0; } if(gpXVisualInfo) { free(gpXVisualInfo); gpXVisualInfo = NULL; } if(gpDisplay) { XCloseDisplay(gpDisplay); gpDisplay = NULL; } if (texture_stone) { glDeleteTextures(1,&texture_stone); } if (texture_kundali) { glDeleteTextures(1, &texture_kundali); } if (gpFile) { fprintf(gpFile, "Log file closed successfully\n"); fclose(gpFile); gpFile = NULL; } } void DrawPyramid(void) { glBegin(GL_TRIANGLES); //front face glTexCoord2f(0.5f, 1.0f); glVertex3f(0.0f, 1.0f, 0.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(1.0f, -1.0f, 1.0f); //right face glTexCoord2f(0.5f, 1.0f); glVertex3f(0.0f, 1.0f, 0.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(1.0f, -1.0f, 1.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(1.0f, -1.0f, -1.0f); //back face glTexCoord2f(0.5f, 1.0f); glVertex3f(0.0f, 1.0f, 0.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(1.0f, -1.0f, -1.0f); //left face glTexCoord2f(0.5f, 1.0f); glVertex3f(0.0f, 1.0f, 0.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); glEnd(); } void DrawCube(void) { glBegin(GL_QUADS); //top face glTexCoord2f(0.0f, 0.0f); glVertex3f(1.0f, 1.0f, -1.0f);//rt glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, 1.0f, -1.0f);//lt glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f);//lb glTexCoord2f(0.0f, 1.0f); glVertex3f(1.0f, 1.0f, 1.0f);//rb glEnd(); glBegin(GL_QUADS); //bottom face glTexCoord2f(0.0f, 0.0f); glVertex3f(1.0f, -1.0f, -1.0f);//rt glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);//lt glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, 1.0f);//lb glTexCoord2f(0.0f, 1.0f); glVertex3f(1.0f, -1.0f, 1.0f);//rb glEnd(); glBegin(GL_QUADS); //front face glTexCoord2f(0.0f, 0.0f); glVertex3f(1.0f, 1.0f, 1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, 1.0f, 1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, 1.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(1.0f, -1.0f, 1.0f); glEnd(); glBegin(GL_QUADS); //back face glTexCoord2f(0.0f, 0.0f); glVertex3f(1.0f, 1.0f, -1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, 1.0f, -1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, -1.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(1.0f, -1.0f, -1.0f); glEnd(); glBegin(GL_QUADS); //right face glTexCoord2f(0.0f, 0.0f); glVertex3f(1.0f, 1.0f, -1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(1.0f, 1.0f, 1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f(1.0f, -1.0f, 1.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(1.0f, -1.0f, -1.0f); glEnd(); glBegin(GL_QUADS); //left face glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, 1.0f, -1.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, 1.0f, 1.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, 1.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, -1.0f, -1.0f); glEnd(); }
[ "jayshreeggandhi@gmail.com" ]
jayshreeggandhi@gmail.com
2ec9049741ca704138179e45c8d67b27fca2d607
ecf0bc675b4225da23f1ea36c0eda737912ef8a9
/Reco_Csrc/Engine/Terrain/TRGenerate.cpp
12ce3ad9767bb608c2373a33eebcb7b6d675a233
[]
no_license
Artarex/MysteryV2
6015af1b501ce5b970fdc9f5b28c80a065fbcfed
2fa5608a4e48be36f56339db685ae5530107a520
refs/heads/master
2022-01-04T17:00:05.899039
2019-03-11T19:41:19
2019-03-11T19:41:19
175,065,496
0
0
null
null
null
null
UTF-8
C++
false
false
130
cpp
version https://git-lfs.github.com/spec/v1 oid sha256:0ad34741e40313c160df19708a9b0062ed5e535b5452518b9ebcb84946562262 size 93885
[ "artarex@web.de" ]
artarex@web.de
ebd338a5a2a3c5eaddaeac3f02b8c59e7790ffa7
808d73dd23af6376527c420348695aa01df2a79c
/src/LAB10.ino
ab0be575949a4137b4d8645d41c3c1d89e955870
[]
no_license
Yusufalsomali/LAB10
76b2c8352c9fd972b7fedf1dfb1747a2b65d2e8b
754320252db38bac123eaa3ae5d6cf009199dde3
refs/heads/master
2023-06-15T21:44:43.478833
2021-07-07T17:49:06
2021-07-07T17:49:06
383,881,280
0
0
null
null
null
null
UTF-8
C++
false
false
846
ino
/* * Project LAB10 * Description: * Author: * Date: */ SYSTEM_MODE(MANUAL); SYSTEM_THREAD(ENABLED); #include <Wire.h> void setup() { //set up wire, and serial Serial.begin(9600); Wire.begin(); } void loop() { while (!Serial.isConnected()); //dont start until Serial is connected if (Serial.available()) { //char x = '?'; char x = Serial.read(); Serial.println(x); //transmit value of light to slave bus if (x == '0' || x == '1') { Wire.beginTransmission(0x2A); // transmit to slave device Wire.write((char) x); // sends one byte Wire.endTransmission(); // stop transmitting } //receive transmission else if (x == '?') { //read request and print to serial Wire.requestFrom(0x2a, 1); char state = Wire.read(); Serial.print(state); } } }
[ "yusufalsomali5@gmail.com" ]
yusufalsomali5@gmail.com
8776dc495f656d8f37afb30993e1870272eba0dc
c3aa9ecb1d49a3949260ae48571de2be2484eaea
/src/TerrainRange.h
541262c08cc15e3c1520c5592bea32c681eef675
[]
no_license
skryvokhizhyn/TransportMania
0f628b47c87d3bce71d8aa5f0997e3e748602f29
3033a82a5115ef56275a31bd5c81b031e7d481be
refs/heads/master
2021-05-16T02:14:31.979601
2017-03-11T15:18:36
2017-03-11T15:18:36
18,496,320
0
0
null
null
null
null
UTF-8
C++
false
false
712
h
#ifndef _TERRAINRANGE_H_ #define _TERRAINRANGE_H_ //#include "Point2d.h" #include <boost/noncopyable.hpp> #include <utility> #include <vector> #include <ostream> namespace trm { struct Point2d; class TerrainRange { public: struct Range { int y; int xBegin; int xEnd; Range(); Range(const int a, const int b, const int c); }; typedef std::vector<Range> Ranges; public: virtual ~TerrainRange(); const Ranges & GetRanges() const; protected: void Init(const size_t sz); void PutRange(const Range & r); private: Ranges ranges_; }; std::ostream & operator << (std::ostream & ostr, const trm::TerrainRange::Range & r); } // namespace trm #endif // _TERRAINRANGE_H_
[ "vv1ld@ua.fm" ]
vv1ld@ua.fm
b505d642325edca96e09c2cff976b204e92b15c6
7c9b4968c3a7c20eb0811a6275c4fb3b0ba8fda2
/WaterLevel/ABP/ABP.ino
4efdf98a46223e02184aea5b6b4bb42a4d86b017
[]
no_license
Ellerbach/LoRaGPSTrackerWaterLevel
c98119592af96ff759227daecbf7cb0ec1b87dd8
830af1e6f0fae0793666fdba846f7694e1083621
refs/heads/master
2020-04-11T21:21:56.248218
2018-12-17T09:24:59
2018-12-17T09:24:59
162,103,261
1
0
null
null
null
null
UTF-8
C++
false
false
5,707
ino
#include <LoRaWan.h> #include <Seeed_vl53l0x.h> Seeed_vl53l0x VL53L0X; //set to true to send confirmed data up messages bool confirmed=true; //application information, should be similar to what was provisiionned in the device twins char * deviceId ="5555ABCDEF123456"; char * devAddr ="55555555"; char * appSKey ="55551234567890ABCDEF1234567890AB"; char * nwkSKey ="55551234567890ABCDEF1234567890AB"; #define PIN_SOIL_HUMID PIN_A2 #define PIN_WATER_LEVEL PIN_A0 #define PIN_BATTERY PIN_A4 #define PIN_CHARGING PIN_A5 /* iot hub ABP tags for deviceid: 46AAC86800430028 "desired": { "AppSKey": "0A501524F8EA5FCBF9BDB5AD7D126F75", "NwkSKey": "99D58493D1205B43EFF938F0F66C339E", "DevAddr": "55555555", "GatewayID" :"", "SensorDecoder" :"DecoderValueSensor" }, */ //set initial datarate and physical information for the device _data_rate_t dr=DR6; _physical_type_t physicalType =EU868 ; //internal variables #define DATA_LENGTH 4 byte data[DATA_LENGTH]; char buffer[256]; int i=0; int lastCall=0; void setup(void) { SerialUSB.begin(115200); while(!SerialUSB); lora.init(); lora.setId(devAddr, deviceId, NULL); lora.setKey(nwkSKey, appSKey, NULL); lora.setDeciveMode(LWABP); lora.setDataRate(dr, physicalType); lora.setChannel(0, 868.1); lora.setChannel(1, 868.3); lora.setChannel(2, 868.5); lora.setReceiceWindowFirst(0, 868.1); lora.setAdaptiveDataRate(false); lora.setDutyCycle(false); lora.setJoinDutyCycle(false); lora.setPower(14); pinMode(PIN_SOIL_HUMID, INPUT); pinMode(PIN_WATER_LEVEL, INPUT); pinMode(PIN_BATTERY, INPUT); pinMode(PIN_CHARGING, INPUT); VL53L0X_Error Status = VL53L0X_ERROR_NONE; Status=VL53L0X.VL53L0X_common_init(); if(VL53L0X_ERROR_NONE!=Status) { SerialUSB.println("start vl53l0x mesurement failed!"); VL53L0X.print_pal_error(Status); while(1); } VL53L0X.VL53L0X_high_accuracy_ranging_init(); if(VL53L0X_ERROR_NONE!=Status) { SerialUSB.println("start vl53l0x mesurement failed!"); VL53L0X.print_pal_error(Status); while(1); } } void loop(void) { if((millis()-lastCall)>5000){ lastCall=millis(); bool result = false; String packetString = "12"; packetString=String(i); SerialUSB.println(packetString); int distance = MeasureDistance(); int waterLevel = MeasureWaterLevel(); int soilHumid = MeasureSoilHumid(); int battery = MeasureBattery(); int charging = MeasureCharging(); SerialUSB.print("Distance: "); SerialUSB.print(distance); SerialUSB.print(" waterLevel: "); SerialUSB.print(waterLevel); SerialUSB.print(" soilHumid: "); SerialUSB.print(soilHumid); SerialUSB.print(" battery: "); SerialUSB.println(battery); SerialUSB.print(" charge: "); SerialUSB.println(charging); EncodeData(distance, waterLevel, soilHumid, battery, charging); if(confirmed) result = lora.transferPacketWithConfirmed(data, DATA_LENGTH); else result = lora.transferPacket(data, DATA_LENGTH); i++; if(result) { short length; short rssi; memset(buffer, 0, 256); length = lora.receivePacket(buffer, 256, &rssi); if(length) { SerialUSB.print("Length is: "); SerialUSB.println(length); SerialUSB.print("RSSI is: "); SerialUSB.println(rssi); SerialUSB.print("Data is: "); for(unsigned char i = 0; i < length; i ++) { SerialUSB.print( char(buffer[i])); } SerialUSB.println(); } } } } int MeasureDistance() { VL53L0X_RangingMeasurementData_t RangingMeasurementData; VL53L0X_Error Status = VL53L0X_ERROR_NONE; memset(&RangingMeasurementData,0,sizeof(VL53L0X_RangingMeasurementData_t)); Status=VL53L0X.PerformSingleRangingMeasurement(&RangingMeasurementData); if(VL53L0X_ERROR_NONE==Status) { if(RangingMeasurementData.RangeMilliMeter>=2000) { SerialUSB.println("out of range!!"); return 0; } else { SerialUSB.print("Measured distance:"); SerialUSB.print(RangingMeasurementData.RangeMilliMeter); SerialUSB.println(" mm"); } } else { SerialUSB.print("mesurement failed !! Status code ="); SerialUSB.println(Status); return 0; } return RangingMeasurementData.RangeMilliMeter; } int MeasureWaterLevel() { return analogRead(PIN_WATER_LEVEL)/2; } int MeasureSoilHumid() { return analogRead(PIN_SOIL_HUMID)/2; } int MeasureBattery() { int bat = analogRead(PIN_BATTERY); //bat stops working at 2.5V so 70 //3.7V is 105 if (bat > 96) bat = 3; else if (bat > 87) bat = 2; else if (bat > 78) bat = 1; else bat = 0; return bat; } int MeasureCharging() { int ch = digitalRead(PIN_CHARGING); if (ch==LOW) return 1; return 0; } void EncodeData(int distance, int waterLevel, int soilHumid, int battery, int charging) { /* Min Max Number of bits Time to Flight 10 2000 11 Water Sensor 0 511 9 Soil Humid 0 511 9 Battery Level 0 3 2 Charging 0 1 1 Total 32 bits TF 0->10 WS 11->19 SH 20->28 BA 29->30 CH 30->31 */ data[0] = distance & 0xFF; data[1] = (distance >> 8) & 0x07; data[1] = data[1] | ((waterLevel & 0x1F) << 3); data[2] = (waterLevel >> 3) & 0x0F; data[2] = data[2] | ((soilHumid & 0x0F) << 4); data[3] = (soilHumid >> 4) & 0x1F; data[3] = data[3] | ((battery & 0x03) << 5); data[3] = data[3] | ((charging & 0x01) << 7); }
[ "laurelle@microsoft.com" ]
laurelle@microsoft.com
a8f2d00ce0d777937bf428f669a0f650aa41c23e
a1df96e81a37b702ede4b8d8d68fb752ab864c48
/src/qt/bitcoingui.cpp
7d3ead241db96271e589a50bcab834430dbc0ca6
[ "MIT" ]
permissive
underline-project/underline-success-build
83fd0f552088cfa4a4c5ec1e9032cde5355fa7eb
420ea9d83204e6e79a14c57a85881bef88735c60
refs/heads/master
2021-04-15T14:47:51.034232
2018-03-23T09:23:51
2018-03-23T09:23:51
null
0
0
null
null
null
null
UTF-8
C++
false
false
45,320
cpp
// Copyright (c) 2011-2016 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #if defined(HAVE_CONFIG_H) #include "config/bitcoin-config.h" #endif #include "bitcoingui.h" #include "bitcoinunits.h" #include "clientmodel.h" #include "guiconstants.h" #include "guiutil.h" #include "modaloverlay.h" #include "networkstyle.h" #include "notificator.h" #include "openuridialog.h" #include "optionsdialog.h" #include "optionsmodel.h" #include "platformstyle.h" #include "rpcconsole.h" #include "utilitydialog.h" #ifdef ENABLE_WALLET #include "walletframe.h" #include "walletmodel.h" #endif // ENABLE_WALLET #ifdef Q_OS_MAC #include "macdockiconhandler.h" #endif #include "chainparams.h" #include "init.h" #include "ui_interface.h" #include "util.h" #include <iostream> #include <QAction> #include <QApplication> #include <QDateTime> #include <QDesktopWidget> #include <QDragEnterEvent> #include <QListWidget> #include <QMenuBar> #include <QMessageBox> #include <QMimeData> #include <QProgressDialog> #include <QSettings> #include <QShortcut> #include <QStackedWidget> #include <QStatusBar> #include <QStyle> #include <QTimer> #include <QToolBar> #include <QVBoxLayout> #if QT_VERSION < 0x050000 #include <QTextDocument> #include <QUrl> #else #include <QUrlQuery> #endif const std::string BitcoinGUI::DEFAULT_UIPLATFORM = #if defined(Q_OS_MAC) "macosx" #elif defined(Q_OS_WIN) "windows" #else "other" #endif ; /** Display name for default wallet name. Uses tilde to avoid name * collisions in the future with additional wallets */ const QString BitcoinGUI::DEFAULT_WALLET = "~Default"; BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle *networkStyle, QWidget *parent) : QMainWindow(parent), enableWallet(false), clientModel(0), walletFrame(0), unitDisplayControl(0), labelWalletEncryptionIcon(0), labelWalletHDStatusIcon(0), connectionsControl(0), labelBlocksIcon(0), progressBarLabel(0), progressBar(0), progressDialog(0), appMenuBar(0), overviewAction(0), historyAction(0), quitAction(0), sendCoinsAction(0), sendCoinsMenuAction(0), usedSendingAddressesAction(0), usedReceivingAddressesAction(0), signMessageAction(0), verifyMessageAction(0), aboutAction(0), receiveCoinsAction(0), receiveCoinsMenuAction(0), optionsAction(0), toggleHideAction(0), encryptWalletAction(0), backupWalletAction(0), changePassphraseAction(0), aboutQtAction(0), openRPCConsoleAction(0), openAction(0), showHelpMessageAction(0), trayIcon(0), trayIconMenu(0), notificator(0), rpcConsole(0), helpMessageDialog(0), modalOverlay(0), prevBlocks(0), spinnerFrame(0), platformStyle(_platformStyle) { QSettings settings; if (!restoreGeometry(settings.value("MainWindowGeometry").toByteArray())) { // Restore failed (perhaps missing setting), center the window move(QApplication::desktop()->availableGeometry().center() - frameGeometry().center()); } QString windowTitle = tr(PACKAGE_NAME) + " - "; #ifdef ENABLE_WALLET enableWallet = WalletModel::isWalletEnabled(); #endif // ENABLE_WALLET if(enableWallet) { windowTitle += tr("Wallet"); } else { windowTitle += tr("Node"); } windowTitle += " " + networkStyle->getTitleAddText(); #ifndef Q_OS_MAC QApplication::setWindowIcon(networkStyle->getTrayAndWindowIcon()); setWindowIcon(networkStyle->getTrayAndWindowIcon()); #else MacDockIconHandler::instance()->setIcon(networkStyle->getAppIcon()); #endif setWindowTitle(windowTitle); #if defined(Q_OS_MAC) && QT_VERSION < 0x050000 // This property is not implemented in Qt 5. Setting it has no effect. // A replacement API (QtMacUnifiedToolBar) is available in QtMacExtras. setUnifiedTitleAndToolBarOnMac(true); #endif rpcConsole = new RPCConsole(_platformStyle, 0); helpMessageDialog = new HelpMessageDialog(this, false); #ifdef ENABLE_WALLET if(enableWallet) { /** Create wallet frame and make it the central widget */ walletFrame = new WalletFrame(_platformStyle, this); setCentralWidget(walletFrame); } else #endif // ENABLE_WALLET { /* When compiled without wallet or -disablewallet is provided, * the central widget is the rpc console. */ setCentralWidget(rpcConsole); } // Accept D&D of URIs setAcceptDrops(true); // Create actions for the toolbar, menu bar and tray/dock icon // Needs walletFrame to be initialized createActions(); // Create application menu bar createMenuBar(); // Create the toolbars createToolBars(); // Create system tray icon and notification createTrayIcon(networkStyle); // Create status bar statusBar(); // Disable size grip because it looks ugly and nobody needs it statusBar()->setSizeGripEnabled(false); // Status bar notification icons QFrame *frameBlocks = new QFrame(); frameBlocks->setContentsMargins(0,0,0,0); frameBlocks->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks); frameBlocksLayout->setContentsMargins(3,0,3,0); frameBlocksLayout->setSpacing(3); unitDisplayControl = new UnitDisplayStatusBarControl(platformStyle); labelWalletEncryptionIcon = new QLabel(); labelWalletHDStatusIcon = new QLabel(); connectionsControl = new GUIUtil::ClickableLabel(); labelBlocksIcon = new GUIUtil::ClickableLabel(); if(enableWallet) { frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(unitDisplayControl); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelWalletEncryptionIcon); frameBlocksLayout->addWidget(labelWalletHDStatusIcon); } frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(connectionsControl); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelBlocksIcon); frameBlocksLayout->addStretch(); // Progress bar and label for blocks download progressBarLabel = new QLabel(); progressBarLabel->setVisible(false); progressBar = new GUIUtil::ProgressBar(); progressBar->setAlignment(Qt::AlignCenter); progressBar->setVisible(false); // Override style sheet for progress bar for styles that have a segmented progress bar, // as they make the text unreadable (workaround for issue #1071) // See https://qt-project.org/doc/qt-4.8/gallery.html QString curStyle = QApplication::style()->metaObject()->className(); if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle") { progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #FF8000, stop: 1 orange); border-radius: 7px; margin: 0px; }"); } statusBar()->addWidget(progressBarLabel); statusBar()->addWidget(progressBar); statusBar()->addPermanentWidget(frameBlocks); // Install event filter to be able to catch status tip events (QEvent::StatusTip) this->installEventFilter(this); // Initially wallet actions should be disabled setWalletActionsEnabled(false); // Subscribe to notifications from core subscribeToCoreSignals(); connect(connectionsControl, SIGNAL(clicked(QPoint)), this, SLOT(toggleNetworkActive())); modalOverlay = new ModalOverlay(this->centralWidget()); #ifdef ENABLE_WALLET if(enableWallet) { connect(walletFrame, SIGNAL(requestedSyncWarningInfo()), this, SLOT(showModalOverlay())); connect(labelBlocksIcon, SIGNAL(clicked(QPoint)), this, SLOT(showModalOverlay())); connect(progressBar, SIGNAL(clicked(QPoint)), this, SLOT(showModalOverlay())); } #endif } BitcoinGUI::~BitcoinGUI() { // Unsubscribe from notifications from core unsubscribeFromCoreSignals(); QSettings settings; settings.setValue("MainWindowGeometry", saveGeometry()); if(trayIcon) // Hide tray icon, as deleting will let it linger until quit (on Ubuntu) trayIcon->hide(); #ifdef Q_OS_MAC delete appMenuBar; MacDockIconHandler::cleanup(); #endif delete rpcConsole; } void BitcoinGUI::createActions() { QActionGroup *tabGroup = new QActionGroup(this); overviewAction = new QAction(platformStyle->SingleColorIcon(":/icons/overview"), tr("&Overview"), this); overviewAction->setStatusTip(tr("Show general overview of wallet")); overviewAction->setToolTip(overviewAction->statusTip()); overviewAction->setCheckable(true); overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1)); tabGroup->addAction(overviewAction); sendCoinsAction = new QAction(platformStyle->SingleColorIcon(":/icons/send"), tr("&Send"), this); sendCoinsAction->setStatusTip(tr("Send coins to a Underline address")); sendCoinsAction->setToolTip(sendCoinsAction->statusTip()); sendCoinsAction->setCheckable(true); sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2)); tabGroup->addAction(sendCoinsAction); sendCoinsMenuAction = new QAction(platformStyle->TextColorIcon(":/icons/send"), sendCoinsAction->text(), this); sendCoinsMenuAction->setStatusTip(sendCoinsAction->statusTip()); sendCoinsMenuAction->setToolTip(sendCoinsMenuAction->statusTip()); receiveCoinsAction = new QAction(platformStyle->SingleColorIcon(":/icons/receiving_addresses"), tr("&Receive"), this); receiveCoinsAction->setStatusTip(tr("Request payments (generates QR codes and underline: URIs)")); receiveCoinsAction->setToolTip(receiveCoinsAction->statusTip()); receiveCoinsAction->setCheckable(true); receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3)); tabGroup->addAction(receiveCoinsAction); receiveCoinsMenuAction = new QAction(platformStyle->TextColorIcon(":/icons/receiving_addresses"), receiveCoinsAction->text(), this); receiveCoinsMenuAction->setStatusTip(receiveCoinsAction->statusTip()); receiveCoinsMenuAction->setToolTip(receiveCoinsMenuAction->statusTip()); historyAction = new QAction(platformStyle->SingleColorIcon(":/icons/history"), tr("&Transactions"), this); historyAction->setStatusTip(tr("Browse transaction history")); historyAction->setToolTip(historyAction->statusTip()); historyAction->setCheckable(true); historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4)); tabGroup->addAction(historyAction); #ifdef ENABLE_WALLET // These showNormalIfMinimized are needed because Send Coins and Receive Coins // can be triggered from the tray menu, and need to show the GUI to be useful. connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage())); connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage())); connect(sendCoinsMenuAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(sendCoinsMenuAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage())); connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage())); connect(receiveCoinsMenuAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(receiveCoinsMenuAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage())); connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage())); #endif // ENABLE_WALLET quitAction = new QAction(platformStyle->TextColorIcon(":/icons/quit"), tr("E&xit"), this); quitAction->setStatusTip(tr("Quit application")); quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); quitAction->setMenuRole(QAction::QuitRole); aboutAction = new QAction(platformStyle->TextColorIcon(":/icons/about"), tr("&About %1").arg(tr(PACKAGE_NAME)), this); aboutAction->setStatusTip(tr("Show information about %1").arg(tr(PACKAGE_NAME))); aboutAction->setMenuRole(QAction::AboutRole); aboutAction->setEnabled(false); aboutQtAction = new QAction(platformStyle->TextColorIcon(":/icons/about_qt"), tr("About &Qt"), this); aboutQtAction->setStatusTip(tr("Show information about Qt")); aboutQtAction->setMenuRole(QAction::AboutQtRole); optionsAction = new QAction(platformStyle->TextColorIcon(":/icons/options"), tr("&Options..."), this); optionsAction->setStatusTip(tr("Modify configuration options for %1").arg(tr(PACKAGE_NAME))); optionsAction->setMenuRole(QAction::PreferencesRole); optionsAction->setEnabled(false); toggleHideAction = new QAction(platformStyle->TextColorIcon(":/icons/about"), tr("&Show / Hide"), this); toggleHideAction->setStatusTip(tr("Show or hide the main Window")); encryptWalletAction = new QAction(platformStyle->TextColorIcon(":/icons/lock_closed"), tr("&Encrypt Wallet..."), this); encryptWalletAction->setStatusTip(tr("Encrypt the private keys that belong to your wallet")); encryptWalletAction->setCheckable(true); backupWalletAction = new QAction(platformStyle->TextColorIcon(":/icons/filesave"), tr("&Backup Wallet..."), this); backupWalletAction->setStatusTip(tr("Backup wallet to another location")); changePassphraseAction = new QAction(platformStyle->TextColorIcon(":/icons/key"), tr("&Change Passphrase..."), this); changePassphraseAction->setStatusTip(tr("Change the passphrase used for wallet encryption")); signMessageAction = new QAction(platformStyle->TextColorIcon(":/icons/edit"), tr("Sign &message..."), this); signMessageAction->setStatusTip(tr("Sign messages with your Underline addresses to prove you own them")); verifyMessageAction = new QAction(platformStyle->TextColorIcon(":/icons/verify"), tr("&Verify message..."), this); verifyMessageAction->setStatusTip(tr("Verify messages to ensure they were signed with specified Underline addresses")); openRPCConsoleAction = new QAction(platformStyle->TextColorIcon(":/icons/debugwindow"), tr("&Debug window"), this); openRPCConsoleAction->setStatusTip(tr("Open debugging and diagnostic console")); // initially disable the debug window menu item openRPCConsoleAction->setEnabled(false); usedSendingAddressesAction = new QAction(platformStyle->TextColorIcon(":/icons/address-book"), tr("&Sending addresses..."), this); usedSendingAddressesAction->setStatusTip(tr("Show the list of used sending addresses and labels")); usedReceivingAddressesAction = new QAction(platformStyle->TextColorIcon(":/icons/address-book"), tr("&Receiving addresses..."), this); usedReceivingAddressesAction->setStatusTip(tr("Show the list of used receiving addresses and labels")); openAction = new QAction(platformStyle->TextColorIcon(":/icons/open"), tr("Open &URI..."), this); openAction->setStatusTip(tr("Open a underline: URI or payment request")); showHelpMessageAction = new QAction(platformStyle->TextColorIcon(":/icons/info"), tr("&Command-line options"), this); showHelpMessageAction->setMenuRole(QAction::NoRole); showHelpMessageAction->setStatusTip(tr("Show the %1 help message to get a list with possible Underline command-line options").arg(tr(PACKAGE_NAME))); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked())); connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked())); connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden())); connect(showHelpMessageAction, SIGNAL(triggered()), this, SLOT(showHelpMessageClicked())); connect(openRPCConsoleAction, SIGNAL(triggered()), this, SLOT(showDebugWindow())); // prevents an open debug window from becoming stuck/unusable on client shutdown connect(quitAction, SIGNAL(triggered()), rpcConsole, SLOT(hide())); #ifdef ENABLE_WALLET if(walletFrame) { connect(encryptWalletAction, SIGNAL(triggered(bool)), walletFrame, SLOT(encryptWallet(bool))); connect(backupWalletAction, SIGNAL(triggered()), walletFrame, SLOT(backupWallet())); connect(changePassphraseAction, SIGNAL(triggered()), walletFrame, SLOT(changePassphrase())); connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab())); connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab())); connect(usedSendingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedSendingAddresses())); connect(usedReceivingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedReceivingAddresses())); connect(openAction, SIGNAL(triggered()), this, SLOT(openClicked())); } #endif // ENABLE_WALLET new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C), this, SLOT(showDebugWindowActivateConsole())); new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_D), this, SLOT(showDebugWindow())); } void BitcoinGUI::createMenuBar() { #ifdef Q_OS_MAC // Create a decoupled menu bar on Mac which stays even if the window is closed appMenuBar = new QMenuBar(); #else // Get the main window's menu bar on other platforms appMenuBar = menuBar(); #endif // Configure the menus QMenu *file = appMenuBar->addMenu(tr("&File")); if(walletFrame) { file->addAction(openAction); file->addAction(backupWalletAction); file->addAction(signMessageAction); file->addAction(verifyMessageAction); file->addSeparator(); file->addAction(usedSendingAddressesAction); file->addAction(usedReceivingAddressesAction); file->addSeparator(); } file->addAction(quitAction); QMenu *settings = appMenuBar->addMenu(tr("&Settings")); if(walletFrame) { settings->addAction(encryptWalletAction); settings->addAction(changePassphraseAction); settings->addSeparator(); } settings->addAction(optionsAction); QMenu *help = appMenuBar->addMenu(tr("&Help")); if(walletFrame) { help->addAction(openRPCConsoleAction); } help->addAction(showHelpMessageAction); help->addSeparator(); help->addAction(aboutAction); help->addAction(aboutQtAction); } void BitcoinGUI::createToolBars() { if(walletFrame) { QToolBar *toolbar = addToolBar(tr("Tabs toolbar")); toolbar->setMovable(false); toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar->addAction(overviewAction); toolbar->addAction(sendCoinsAction); toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); overviewAction->setChecked(true); } } void BitcoinGUI::setClientModel(ClientModel *_clientModel) { this->clientModel = _clientModel; if(_clientModel) { // Create system tray menu (or setup the dock menu) that late to prevent users from calling actions, // while the client has not yet fully loaded createTrayIconMenu(); // Keep up to date with client updateNetworkState(); connect(_clientModel, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int))); connect(_clientModel, SIGNAL(networkActiveChanged(bool)), this, SLOT(setNetworkActive(bool))); modalOverlay->setKnownBestHeight(_clientModel->getHeaderTipHeight(), QDateTime::fromTime_t(_clientModel->getHeaderTipTime())); setNumBlocks(_clientModel->getNumBlocks(), _clientModel->getLastBlockDate(), _clientModel->getVerificationProgress(nullptr), false); connect(_clientModel, SIGNAL(numBlocksChanged(int,QDateTime,double,bool)), this, SLOT(setNumBlocks(int,QDateTime,double,bool))); // Receive and report messages from client model connect(_clientModel, SIGNAL(message(QString,QString,unsigned int)), this, SLOT(message(QString,QString,unsigned int))); // Show progress dialog connect(_clientModel, SIGNAL(showProgress(QString,int)), this, SLOT(showProgress(QString,int))); rpcConsole->setClientModel(_clientModel); #ifdef ENABLE_WALLET if(walletFrame) { walletFrame->setClientModel(_clientModel); } #endif // ENABLE_WALLET unitDisplayControl->setOptionsModel(_clientModel->getOptionsModel()); OptionsModel* optionsModel = _clientModel->getOptionsModel(); if(optionsModel) { // be aware of the tray icon disable state change reported by the OptionsModel object. connect(optionsModel,SIGNAL(hideTrayIconChanged(bool)),this,SLOT(setTrayIconVisible(bool))); // initialize the disable state of the tray icon with the current value in the model. setTrayIconVisible(optionsModel->getHideTrayIcon()); } } else { // Disable possibility to show main window via action toggleHideAction->setEnabled(false); if(trayIconMenu) { // Disable context menu on tray icon trayIconMenu->clear(); } // Propagate cleared model to child objects rpcConsole->setClientModel(nullptr); #ifdef ENABLE_WALLET if (walletFrame) { walletFrame->setClientModel(nullptr); } #endif // ENABLE_WALLET unitDisplayControl->setOptionsModel(nullptr); } } #ifdef ENABLE_WALLET bool BitcoinGUI::addWallet(const QString& name, WalletModel *walletModel) { if(!walletFrame) return false; setWalletActionsEnabled(true); return walletFrame->addWallet(name, walletModel); } bool BitcoinGUI::setCurrentWallet(const QString& name) { if(!walletFrame) return false; return walletFrame->setCurrentWallet(name); } void BitcoinGUI::removeAllWallets() { if(!walletFrame) return; setWalletActionsEnabled(false); walletFrame->removeAllWallets(); } #endif // ENABLE_WALLET void BitcoinGUI::setWalletActionsEnabled(bool enabled) { overviewAction->setEnabled(enabled); sendCoinsAction->setEnabled(enabled); sendCoinsMenuAction->setEnabled(enabled); receiveCoinsAction->setEnabled(enabled); receiveCoinsMenuAction->setEnabled(enabled); historyAction->setEnabled(enabled); encryptWalletAction->setEnabled(enabled); backupWalletAction->setEnabled(enabled); changePassphraseAction->setEnabled(enabled); signMessageAction->setEnabled(enabled); verifyMessageAction->setEnabled(enabled); usedSendingAddressesAction->setEnabled(enabled); usedReceivingAddressesAction->setEnabled(enabled); openAction->setEnabled(enabled); } void BitcoinGUI::createTrayIcon(const NetworkStyle *networkStyle) { #ifndef Q_OS_MAC trayIcon = new QSystemTrayIcon(this); QString toolTip = tr("%1 client").arg(tr(PACKAGE_NAME)) + " " + networkStyle->getTitleAddText(); trayIcon->setToolTip(toolTip); trayIcon->setIcon(networkStyle->getTrayAndWindowIcon()); trayIcon->hide(); #endif notificator = new Notificator(QApplication::applicationName(), trayIcon, this); } void BitcoinGUI::createTrayIconMenu() { #ifndef Q_OS_MAC // return if trayIcon is unset (only on non-Mac OSes) if (!trayIcon) return; trayIconMenu = new QMenu(this); trayIcon->setContextMenu(trayIconMenu); connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason))); #else // Note: On Mac, the dock icon is used to provide the tray's functionality. MacDockIconHandler *dockIconHandler = MacDockIconHandler::instance(); dockIconHandler->setMainWindow((QMainWindow *)this); trayIconMenu = dockIconHandler->dockMenu(); #endif // Configuration of the tray icon (or dock icon) icon menu trayIconMenu->addAction(toggleHideAction); trayIconMenu->addSeparator(); trayIconMenu->addAction(sendCoinsMenuAction); trayIconMenu->addAction(receiveCoinsMenuAction); trayIconMenu->addSeparator(); trayIconMenu->addAction(signMessageAction); trayIconMenu->addAction(verifyMessageAction); trayIconMenu->addSeparator(); trayIconMenu->addAction(optionsAction); trayIconMenu->addAction(openRPCConsoleAction); #ifndef Q_OS_MAC // This is built-in on Mac trayIconMenu->addSeparator(); trayIconMenu->addAction(quitAction); #endif } #ifndef Q_OS_MAC void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason) { if(reason == QSystemTrayIcon::Trigger) { // Click on system tray icon triggers show/hide of the main window toggleHidden(); } } #endif void BitcoinGUI::optionsClicked() { if(!clientModel || !clientModel->getOptionsModel()) return; OptionsDialog dlg(this, enableWallet); dlg.setModel(clientModel->getOptionsModel()); dlg.exec(); } void BitcoinGUI::aboutClicked() { if(!clientModel) return; HelpMessageDialog dlg(this, true); dlg.exec(); } void BitcoinGUI::showDebugWindow() { rpcConsole->showNormal(); rpcConsole->show(); rpcConsole->raise(); rpcConsole->activateWindow(); } void BitcoinGUI::showDebugWindowActivateConsole() { rpcConsole->setTabFocus(RPCConsole::TAB_CONSOLE); showDebugWindow(); } void BitcoinGUI::showHelpMessageClicked() { helpMessageDialog->show(); } #ifdef ENABLE_WALLET void BitcoinGUI::openClicked() { OpenURIDialog dlg(this); if(dlg.exec()) { Q_EMIT receivedURI(dlg.getURI()); } } void BitcoinGUI::gotoOverviewPage() { overviewAction->setChecked(true); if (walletFrame) walletFrame->gotoOverviewPage(); } void BitcoinGUI::gotoHistoryPage() { historyAction->setChecked(true); if (walletFrame) walletFrame->gotoHistoryPage(); } void BitcoinGUI::gotoReceiveCoinsPage() { receiveCoinsAction->setChecked(true); if (walletFrame) walletFrame->gotoReceiveCoinsPage(); } void BitcoinGUI::gotoSendCoinsPage(QString addr) { sendCoinsAction->setChecked(true); if (walletFrame) walletFrame->gotoSendCoinsPage(addr); } void BitcoinGUI::gotoSignMessageTab(QString addr) { if (walletFrame) walletFrame->gotoSignMessageTab(addr); } void BitcoinGUI::gotoVerifyMessageTab(QString addr) { if (walletFrame) walletFrame->gotoVerifyMessageTab(addr); } #endif // ENABLE_WALLET void BitcoinGUI::updateNetworkState() { int count = clientModel->getNumConnections(); QString icon; switch(count) { case 0: icon = ":/icons/connect_0"; break; case 1: case 2: case 3: icon = ":/icons/connect_1"; break; case 4: case 5: case 6: icon = ":/icons/connect_2"; break; case 7: case 8: case 9: icon = ":/icons/connect_3"; break; default: icon = ":/icons/connect_4"; break; } QString tooltip; if (clientModel->getNetworkActive()) { tooltip = tr("%n active connection(s) to Underline network", "", count) + QString(".<br>") + tr("Click to disable network activity."); } else { tooltip = tr("Network activity disabled.") + QString("<br>") + tr("Click to enable network activity again."); icon = ":/icons/network_disabled"; } // Don't word-wrap this (fixed-width) tooltip tooltip = QString("<nobr>") + tooltip + QString("</nobr>"); connectionsControl->setToolTip(tooltip); connectionsControl->setPixmap(platformStyle->SingleColorIcon(icon).pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); } void BitcoinGUI::setNumConnections(int count) { updateNetworkState(); } void BitcoinGUI::setNetworkActive(bool networkActive) { updateNetworkState(); } void BitcoinGUI::updateHeadersSyncProgressLabel() { int64_t headersTipTime = clientModel->getHeaderTipTime(); int headersTipHeight = clientModel->getHeaderTipHeight(); int estHeadersLeft = (GetTime() - headersTipTime) / Params().GetConsensus().nPowTargetSpacing; if (estHeadersLeft > HEADER_HEIGHT_DELTA_SYNC) progressBarLabel->setText(tr("Syncing Headers (%1%)...").arg(QString::number(100.0 / (headersTipHeight+estHeadersLeft)*headersTipHeight, 'f', 1))); } void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool header) { if (modalOverlay) { if (header) modalOverlay->setKnownBestHeight(count, blockDate); else modalOverlay->tipUpdate(count, blockDate, nVerificationProgress); } if (!clientModel) return; // Prevent orphan statusbar messages (e.g. hover Quit in main menu, wait until chain-sync starts -> garbled text) statusBar()->clearMessage(); // Acquire current block source enum BlockSource blockSource = clientModel->getBlockSource(); switch (blockSource) { case BLOCK_SOURCE_NETWORK: if (header) { updateHeadersSyncProgressLabel(); return; } progressBarLabel->setText(tr("Synchronizing with network...")); updateHeadersSyncProgressLabel(); break; case BLOCK_SOURCE_DISK: if (header) { progressBarLabel->setText(tr("Indexing blocks on disk...")); } else { progressBarLabel->setText(tr("Processing blocks on disk...")); } break; case BLOCK_SOURCE_REINDEX: progressBarLabel->setText(tr("Reindexing blocks on disk...")); break; case BLOCK_SOURCE_NONE: if (header) { return; } progressBarLabel->setText(tr("Connecting to peers...")); break; } QString tooltip; QDateTime currentDate = QDateTime::currentDateTime(); qint64 secs = blockDate.secsTo(currentDate); tooltip = tr("Processed %n block(s) of transaction history.", "", count); // Set icon state: spinning if catching up, tick otherwise if(secs < 90*60) { tooltip = tr("Up to date") + QString(".<br>") + tooltip; labelBlocksIcon->setPixmap(platformStyle->SingleColorIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); #ifdef ENABLE_WALLET if(walletFrame) { walletFrame->showOutOfSyncWarning(false); modalOverlay->showHide(true, true); } #endif // ENABLE_WALLET progressBarLabel->setVisible(false); progressBar->setVisible(false); } else { QString timeBehindText = GUIUtil::formatNiceTimeOffset(secs); progressBarLabel->setVisible(true); progressBar->setFormat(tr("%1 behind").arg(timeBehindText)); progressBar->setMaximum(1000000000); progressBar->setValue(nVerificationProgress * 1000000000.0 + 0.5); progressBar->setVisible(true); tooltip = tr("Catching up...") + QString("<br>") + tooltip; if(count != prevBlocks) { labelBlocksIcon->setPixmap(platformStyle->SingleColorIcon(QString( ":/movies/spinner-%1").arg(spinnerFrame, 3, 10, QChar('0'))) .pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); spinnerFrame = (spinnerFrame + 1) % SPINNER_FRAMES; } prevBlocks = count; #ifdef ENABLE_WALLET if(walletFrame) { walletFrame->showOutOfSyncWarning(true); modalOverlay->showHide(); } #endif // ENABLE_WALLET tooltip += QString("<br>"); tooltip += tr("Last received block was generated %1 ago.").arg(timeBehindText); tooltip += QString("<br>"); tooltip += tr("Transactions after this will not yet be visible."); } // Don't word-wrap this (fixed-width) tooltip tooltip = QString("<nobr>") + tooltip + QString("</nobr>"); labelBlocksIcon->setToolTip(tooltip); progressBarLabel->setToolTip(tooltip); progressBar->setToolTip(tooltip); } void BitcoinGUI::message(const QString &title, const QString &message, unsigned int style, bool *ret) { QString strTitle = tr("Underline"); // default title // Default to information icon int nMBoxIcon = QMessageBox::Information; int nNotifyIcon = Notificator::Information; QString msgType; // Prefer supplied title over style based title if (!title.isEmpty()) { msgType = title; } else { switch (style) { case CClientUIInterface::MSG_ERROR: msgType = tr("Error"); break; case CClientUIInterface::MSG_WARNING: msgType = tr("Warning"); break; case CClientUIInterface::MSG_INFORMATION: msgType = tr("Information"); break; default: break; } } // Append title to "Bitcoin - " if (!msgType.isEmpty()) strTitle += " - " + msgType; // Check for error/warning icon if (style & CClientUIInterface::ICON_ERROR) { nMBoxIcon = QMessageBox::Critical; nNotifyIcon = Notificator::Critical; } else if (style & CClientUIInterface::ICON_WARNING) { nMBoxIcon = QMessageBox::Warning; nNotifyIcon = Notificator::Warning; } // Display message if (style & CClientUIInterface::MODAL) { // Check for buttons, use OK as default, if none was supplied QMessageBox::StandardButton buttons; if (!(buttons = (QMessageBox::StandardButton)(style & CClientUIInterface::BTN_MASK))) buttons = QMessageBox::Ok; showNormalIfMinimized(); QMessageBox mBox((QMessageBox::Icon)nMBoxIcon, strTitle, message, buttons, this); int r = mBox.exec(); if (ret != nullptr) *ret = r == QMessageBox::Ok; } else notificator->notify((Notificator::Class)nNotifyIcon, strTitle, message); } void BitcoinGUI::changeEvent(QEvent *e) { QMainWindow::changeEvent(e); #ifndef Q_OS_MAC // Ignored on Mac if(e->type() == QEvent::WindowStateChange) { if(clientModel && clientModel->getOptionsModel() && clientModel->getOptionsModel()->getMinimizeToTray()) { QWindowStateChangeEvent *wsevt = static_cast<QWindowStateChangeEvent*>(e); if(!(wsevt->oldState() & Qt::WindowMinimized) && isMinimized()) { QTimer::singleShot(0, this, SLOT(hide())); e->ignore(); } } } #endif } void BitcoinGUI::closeEvent(QCloseEvent *event) { #ifndef Q_OS_MAC // Ignored on Mac if(clientModel && clientModel->getOptionsModel()) { if(!clientModel->getOptionsModel()->getMinimizeOnClose()) { // close rpcConsole in case it was open to make some space for the shutdown window rpcConsole->close(); QApplication::quit(); } else { QMainWindow::showMinimized(); event->ignore(); } } #else QMainWindow::closeEvent(event); #endif } void BitcoinGUI::showEvent(QShowEvent *event) { // enable the debug window when the main window shows up openRPCConsoleAction->setEnabled(true); aboutAction->setEnabled(true); optionsAction->setEnabled(true); } #ifdef ENABLE_WALLET void BitcoinGUI::incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address, const QString& label) { // On new transaction, make an info balloon QString msg = tr("Date: %1\n").arg(date) + tr("Amount: %1\n").arg(BitcoinUnits::formatWithUnit(unit, amount, true)) + tr("Type: %1\n").arg(type); if (!label.isEmpty()) msg += tr("Label: %1\n").arg(label); else if (!address.isEmpty()) msg += tr("Address: %1\n").arg(address); message((amount)<0 ? tr("Sent transaction") : tr("Incoming transaction"), msg, CClientUIInterface::MSG_INFORMATION); } #endif // ENABLE_WALLET void BitcoinGUI::dragEnterEvent(QDragEnterEvent *event) { // Accept only URIs if(event->mimeData()->hasUrls()) event->acceptProposedAction(); } void BitcoinGUI::dropEvent(QDropEvent *event) { if(event->mimeData()->hasUrls()) { for (const QUrl &uri : event->mimeData()->urls()) { Q_EMIT receivedURI(uri.toString()); } } event->acceptProposedAction(); } bool BitcoinGUI::eventFilter(QObject *object, QEvent *event) { // Catch status tip events if (event->type() == QEvent::StatusTip) { // Prevent adding text from setStatusTip(), if we currently use the status bar for displaying other stuff if (progressBarLabel->isVisible() || progressBar->isVisible()) return true; } return QMainWindow::eventFilter(object, event); } #ifdef ENABLE_WALLET bool BitcoinGUI::handlePaymentRequest(const SendCoinsRecipient& recipient) { // URI has to be valid if (walletFrame && walletFrame->handlePaymentRequest(recipient)) { showNormalIfMinimized(); gotoSendCoinsPage(); return true; } return false; } void BitcoinGUI::setHDStatus(int hdEnabled) { labelWalletHDStatusIcon->setPixmap(platformStyle->SingleColorIcon(hdEnabled ? ":/icons/hd_enabled" : ":/icons/hd_disabled").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); labelWalletHDStatusIcon->setToolTip(hdEnabled ? tr("HD key generation is <b>enabled</b>") : tr("HD key generation is <b>disabled</b>")); // eventually disable the QLabel to set its opacity to 50% labelWalletHDStatusIcon->setEnabled(hdEnabled); } void BitcoinGUI::setEncryptionStatus(int status) { switch(status) { case WalletModel::Unencrypted: labelWalletEncryptionIcon->hide(); encryptWalletAction->setChecked(false); changePassphraseAction->setEnabled(false); encryptWalletAction->setEnabled(true); break; case WalletModel::Unlocked: labelWalletEncryptionIcon->show(); labelWalletEncryptionIcon->setPixmap(platformStyle->SingleColorIcon(":/icons/lock_open").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); labelWalletEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>unlocked</b>")); encryptWalletAction->setChecked(true); changePassphraseAction->setEnabled(true); encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported break; case WalletModel::Locked: labelWalletEncryptionIcon->show(); labelWalletEncryptionIcon->setPixmap(platformStyle->SingleColorIcon(":/icons/lock_closed").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); labelWalletEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>locked</b>")); encryptWalletAction->setChecked(true); changePassphraseAction->setEnabled(true); encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported break; } } #endif // ENABLE_WALLET void BitcoinGUI::showNormalIfMinimized(bool fToggleHidden) { if(!clientModel) return; // activateWindow() (sometimes) helps with keyboard focus on Windows if (isHidden()) { show(); activateWindow(); } else if (isMinimized()) { showNormal(); activateWindow(); } else if (GUIUtil::isObscured(this)) { raise(); activateWindow(); } else if(fToggleHidden) hide(); } void BitcoinGUI::toggleHidden() { showNormalIfMinimized(true); } void BitcoinGUI::detectShutdown() { if (ShutdownRequested()) { if(rpcConsole) rpcConsole->hide(); qApp->quit(); } } void BitcoinGUI::showProgress(const QString &title, int nProgress) { if (nProgress == 0) { progressDialog = new QProgressDialog(title, "", 0, 100); progressDialog->setWindowModality(Qt::ApplicationModal); progressDialog->setMinimumDuration(0); progressDialog->setCancelButton(0); progressDialog->setAutoClose(false); progressDialog->setValue(0); } else if (nProgress == 100) { if (progressDialog) { progressDialog->close(); progressDialog->deleteLater(); } } else if (progressDialog) progressDialog->setValue(nProgress); } void BitcoinGUI::setTrayIconVisible(bool fHideTrayIcon) { if (trayIcon) { trayIcon->setVisible(!fHideTrayIcon); } } void BitcoinGUI::showModalOverlay() { if (modalOverlay && (progressBar->isVisible() || modalOverlay->isLayerVisible())) modalOverlay->toggleVisibility(); } static bool ThreadSafeMessageBox(BitcoinGUI *gui, const std::string& message, const std::string& caption, unsigned int style) { bool modal = (style & CClientUIInterface::MODAL); // The SECURE flag has no effect in the Qt GUI. // bool secure = (style & CClientUIInterface::SECURE); style &= ~CClientUIInterface::SECURE; bool ret = false; // In case of modal message, use blocking connection to wait for user to click a button QMetaObject::invokeMethod(gui, "message", modal ? GUIUtil::blockingGUIThreadConnection() : Qt::QueuedConnection, Q_ARG(QString, QString::fromStdString(caption)), Q_ARG(QString, QString::fromStdString(message)), Q_ARG(unsigned int, style), Q_ARG(bool*, &ret)); return ret; } void BitcoinGUI::subscribeToCoreSignals() { // Connect signals to client uiInterface.ThreadSafeMessageBox.connect(boost::bind(ThreadSafeMessageBox, this, _1, _2, _3)); uiInterface.ThreadSafeQuestion.connect(boost::bind(ThreadSafeMessageBox, this, _1, _3, _4)); } void BitcoinGUI::unsubscribeFromCoreSignals() { // Disconnect signals from client uiInterface.ThreadSafeMessageBox.disconnect(boost::bind(ThreadSafeMessageBox, this, _1, _2, _3)); uiInterface.ThreadSafeQuestion.disconnect(boost::bind(ThreadSafeMessageBox, this, _1, _3, _4)); } void BitcoinGUI::toggleNetworkActive() { if (clientModel) { clientModel->setNetworkActive(!clientModel->getNetworkActive()); } } UnitDisplayStatusBarControl::UnitDisplayStatusBarControl(const PlatformStyle *platformStyle) : optionsModel(0), menu(0) { createContextMenu(); setToolTip(tr("Unit to show amounts in. Click to select another unit.")); QList<BitcoinUnits::Unit> units = BitcoinUnits::availableUnits(); int max_width = 0; const QFontMetrics fm(font()); for (const BitcoinUnits::Unit unit : units) { max_width = qMax(max_width, fm.width(BitcoinUnits::name(unit))); } setMinimumSize(max_width, 0); setAlignment(Qt::AlignRight | Qt::AlignVCenter); setStyleSheet(QString("QLabel { color : %1 }").arg(platformStyle->SingleColor().name())); } /** So that it responds to button clicks */ void UnitDisplayStatusBarControl::mousePressEvent(QMouseEvent *event) { onDisplayUnitsClicked(event->pos()); } /** Creates context menu, its actions, and wires up all the relevant signals for mouse events. */ void UnitDisplayStatusBarControl::createContextMenu() { menu = new QMenu(this); for (BitcoinUnits::Unit u : BitcoinUnits::availableUnits()) { QAction *menuAction = new QAction(QString(BitcoinUnits::name(u)), this); menuAction->setData(QVariant(u)); menu->addAction(menuAction); } connect(menu,SIGNAL(triggered(QAction*)),this,SLOT(onMenuSelection(QAction*))); } /** Lets the control know about the Options Model (and its signals) */ void UnitDisplayStatusBarControl::setOptionsModel(OptionsModel *_optionsModel) { if (_optionsModel) { this->optionsModel = _optionsModel; // be aware of a display unit change reported by the OptionsModel object. connect(_optionsModel,SIGNAL(displayUnitChanged(int)),this,SLOT(updateDisplayUnit(int))); // initialize the display units label with the current value in the model. updateDisplayUnit(_optionsModel->getDisplayUnit()); } } /** When Display Units are changed on OptionsModel it will refresh the display text of the control on the status bar */ void UnitDisplayStatusBarControl::updateDisplayUnit(int newUnits) { setText(BitcoinUnits::name(newUnits)); } /** Shows context menu with Display Unit options by the mouse coordinates */ void UnitDisplayStatusBarControl::onDisplayUnitsClicked(const QPoint& point) { QPoint globalPos = mapToGlobal(point); menu->exec(globalPos); } /** Tells underlying optionsModel to update its current display unit. */ void UnitDisplayStatusBarControl::onMenuSelection(QAction* action) { if (action) { optionsModel->setDisplayUnit(action->data()); } }
[ "xmrpoolmine@gmail.com" ]
xmrpoolmine@gmail.com
e33bbb02857d810cb936870fa62ab52868b8acf5
8e9221ca3e521f2a46444b6e1627fdcfc1f02ea8
/src/core/include/capsaicin.h
5385331e5dd86cb71349c1e0cc493a7fe4d87f35
[]
no_license
yozhijk/capsaicin
2d5e72d348daae7f5afcb47c86c40784a0ae0263
b79fe2029666aff7371019deb712cd0b4bbb2d0f
refs/heads/master
2021-03-02T16:05:43.358395
2020-09-21T14:13:55
2020-09-21T14:13:55
245,882,382
7
2
null
2020-08-21T07:50:42
2020-03-08T20:24:09
C
UTF-8
C++
false
false
572
h
#pragma once #include <cstdint> #include <string> // Backend specific stuff #ifdef WIN32 #define NOMINMAX #include <Windows.h> struct RenderSessionParams { HWND hwnd; }; struct Input { UINT message; LPARAM lparam; WPARAM wparam; }; #endif using std::uint32_t; namespace capsaicin { void Init(); void InitRenderSession(void* params); void LoadSceneFromOBJ(const std::string& file_name); void ProcessInput(void* input); void Update(float time_ms); void Render(); void SetOption(); void ShutdownRenderSession(); void Shutdown(); } // namespace capsaicin
[ "dmitry.a.kozlov@gmail.com" ]
dmitry.a.kozlov@gmail.com
3bcd8766270c82975b5c889c468ab20dc8830444
2c47e7983a01c9ddb0627353c53686fdec6ef930
/source/aafile/localWriter.h
da18120a071ca042480328e5e0c2323a2047ec57
[]
no_license
16in/yatools
1ca4005def8b1abe3bf245931803da1785e1b96a
b023cbc67c89c9691c40d8762089152c53e9e8ff
refs/heads/master
2021-07-07T18:25:54.938089
2019-04-01T21:12:57
2019-04-01T21:12:57
169,947,699
2
1
null
null
null
null
SHIFT_JIS
C++
false
false
4,705
h
/*---------------------------------------------------------------------- * * AA関連ファイルライタから参照するローカル関数 * * Copyright (c) 2012-2019 _16in/◆7N5y1wtOn2 * *----------------------------------------------------------------------*/ #pragma once #include <aafile/AAFileAccessor.h> #include "types.h" namespace aafile { /** * ページ内容のみ書き出す * @param[in] page ページデータ * @param[out] writeString 書き出し先 * @param[in] length 書き出し先の文字数 * @return uint_t 書き出した文字数 */ static uint_t WritePageValue( AAFilePage* page, wchar_t* writeString, uint_t length ); /** * TXTファイルの書き出し * @param[in] page ページデータ * @param[out] writeString 書き出し先 * @param[in] length 書き出し先の文字数 * @param[in] lastPage 最終ページなら真 * @return uint_t 書き出した文字数 */ static uint_t WritePageTXT( AAFilePage* page, wchar_t* writeString, uint_t length, bool lastPage ); /** * MLTファイルの書き出し * @param[in] page ページデータ * @param[out] writeString 書き出し先 * @param[in] length 書き出し先の文字数 * @param[in] lastPage 最終ページなら真 * @return uint_t 書き出した文字数 */ static uint_t WritePageMLT( AAFilePage* page, wchar_t* writeString, uint_t length, bool lastPage ); /** * ASTファイルの書き出し * @param[in] page ページデータ * @param[out] writeString 書き出し先 * @param[in] length 書き出し先の文字数 * @param[in] lastPage 最終ページなら真 * @return uint_t 書き出した文字数 */ static uint_t WritePageAST( AAFilePage* page, wchar_t* writeString, uint_t length, bool lastPage ); /** * ASDファイルの書き出し * @param[in] page ページデータ * @param[out] writeString 書き出し先 * @param[in] length 書き出し先の文字数 * @param[in] lastPage 最終ページなら真 * @return uint_t 書き出した文字数 */ static uint_t WritePageASD( AAFilePage* page, wchar_t* writeString, uint_t length, bool lastPage ); /** * AADataファイルの書き出し * @param[in] page ページデータ * @param[out] writeString 書き出し先 * @param[in] length 書き出し先の文字数 * @param[in] lastPage 最終ページなら真 * @return uint_t 書き出した文字数 */ static uint_t WritePageAADATA( AAFilePage* page, wchar_t* writeString, uint_t length, bool lastPage ); /** * AAListファイルの書き出し * @param[in] page ページデータ * @param[out] writeString 書き出し先 * @param[in] length 書き出し先の文字数 * @param[in] lastPage 最終ページなら真 * @return uint_t 書き出した文字数 */ static uint_t WritePageAALIST( AAFilePage* page, wchar_t* writeString, uint_t length, bool lastPage ); /** * AADataファイルの書き出し * @param[in] split 分割文字列 * @param[in] end 終端分割文字列 * @param[in] page ページデータ * @param[out] writeString 書き出し先 * @param[in] length 書き出し先の文字数 * @param[in] lastPage 最終ページなら真 * @return uint_t 書き出した文字数 */ static uint_t WritePageAADataList( const wchar_t* split, const wchar_t* end, AAFilePage* page, wchar_t* writeString, uint_t length, bool lastPage ); } /*---------------------------------------------------------------------- * License * * AAFileAccessor * * Copyright (c) 2012-2019 _16in/◆7N5y1wtOn2 * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO * THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * *----------------------------------------------------------------------*/
[ "kmp.16in@gmail.com" ]
kmp.16in@gmail.com
771972d3037644b1160cadcaab472e9831227457
554881e86cedef1e63d322d46dfdb40f41abbc6b
/UrlTitleCollector/net/httpconnection.h
5efa1182315f8efad1a6db057d0a4d494cb2d436
[ "MIT" ]
permissive
SteaveP/UrlTitleCollector
07839e7463063c3aecd1a90e328da1e60566e9c2
ea5f0bf57b9469d30c536df4b62a08ac7e1a58d7
refs/heads/master
2021-01-22T20:55:34.574333
2017-03-24T17:21:56
2017-03-24T17:21:56
85,379,029
0
0
null
null
null
null
UTF-8
C++
false
false
1,619
h
#pragma once #include "../data/iconnection.h" #include <boost/asio.hpp> #include <boost/enable_shared_from_this.hpp> namespace nc { namespace net { // TODO remove code duplication (merge with HttpsConnection) class HttpConnection : public IConnection, public boost::enable_shared_from_this<HttpConnection> { public: HttpConnection( boost::asio::io_service& io_service, boost::asio::ip::tcp::resolver::iterator endpoint_iterator ); virtual ~HttpConnection(); virtual void connect(TConnectionCallback connectionCallback, TAnyPtr data = TAnyPtr()) override; virtual void close() override; virtual void setData(TAnyPtr data) override { data_ = data; } virtual TAnyPtr getData() const override { return data_; } virtual void async_read(TReadCallback callback) override; virtual void async_write(const char* message, size_t message_size, TWriteCallback callback) override; private: void handle_connect(TConnectionCallback connectionCallback, const boost::system::error_code& error); void handle_write(TWriteCallback writeCallback, const boost::system::error_code& error, size_t bytes_transferred); void handle_read(TReadCallback readCallback, const boost::system::error_code& error, size_t bytes_transferred); boost::shared_ptr<HttpConnection> getptr() { return shared_from_this(); } private: boost::asio::ip::tcp::socket socket_; boost::asio::streambuf buffer_request_; boost::asio::streambuf buffer_reply_; // use strand to prevent concurrent callbacks boost::asio::strand strand_; boost::asio::ip::tcp::resolver::iterator connection_point_; bool connected_; TAnyPtr data_; }; } }
[ "Swoo2n@gmail.com" ]
Swoo2n@gmail.com
71fafa6c4f603bf6b6da4eb52d7387e2869b399d
39e0b454c34bd992e6f5b2f3486f9c599e61e046
/demo/input.cxx
bb2fa0e389765e78129bb1e4f492ab6f3d97cc85
[]
no_license
sashagoebbels/SpeX
26c734ad6d7f78654b0b243afc961e55b9b319aa
d542340c15377fe050a475972896170a6c9e7d36
refs/heads/master
2022-11-12T05:24:50.270868
2017-08-17T19:22:25
2017-08-17T19:22:25
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,963
cxx
// // "$Id: input.cxx,v 1.4 1998/11/08 15:05:47 mike Exp $" // // Input field test program for the Fast Light Tool Kit (FLTK). // // Copyright 1998 by Bill Spitzak and others. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Library General Public License for more details. // // You should have received a copy of the GNU Library General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 // USA. // // Please report all bugs and problems to "fltk-bugs@easysw.com". // #include <stdio.h> #include <FL/Fl.H> #include <FL/Fl_Window.H> #include <FL/Fl_Input.H> #include <FL/Fl_Float_Input.H> #include <FL/Fl_Int_Input.H> #include <FL/Fl_Secret_Input.H> #include <FL/Fl_Multiline_Input.H> #include <FL/Fl_Button.H> #include <FL/Fl_Toggle_Button.H> #include <FL/Fl_Color_Chooser.H> void cb(Fl_Widget *ob) { printf("Callback for %s '%s'\n",ob->label(),((Fl_Input*)ob)->value()); } int when = 0; Fl_Input *input[5]; void toggle_cb(Fl_Widget *o, long v) { if (((Fl_Toggle_Button*)o)->value()) when |= v; else when &= ~v; for (int i=0; i<5; i++) input[i]->when(when); } void test(Fl_Input *i) { if (i->changed()) { i->clear_changed(); printf("%s '%s'\n",i->label(),i->value()); } } void button_cb(Fl_Widget *,void *) { for (int i=0; i<5; i++) test(input[i]); } void color_cb(Fl_Widget* button, void* v) { Fl_Color c; switch ((int)v) { case 0: c = FL_WHITE; break; case 1: c = FL_SELECTION_COLOR; break; default: c = FL_BLACK; break; } uchar r,g,b; Fl::get_color(c, r,g,b); if (fl_color_chooser(0,r,g,b)) { Fl::set_color(c,r,g,b); Fl::redraw(); button->labelcolor(contrast(FL_BLACK,c)); button->redraw(); } } int main(int argc, char **argv) { Fl_Window *window = new Fl_Window(400,400); int y = 10; input[0] = new Fl_Input(70,y,300,30,"Normal:"); y += 35; // input[0]->cursor_color(FL_SELECTION_COLOR); // input[0]->maximum_size(20); // input[0]->static_value("this is a testgarbage"); input[1] = new Fl_Float_Input(70,y,300,30,"Float:"); y += 35; input[2] = new Fl_Int_Input(70,y,300,30,"Int:"); y += 35; input[3] = new Fl_Secret_Input(70,y,300,30,"Secret:"); y += 35; input[4] = new Fl_Multiline_Input(70,y,300,100,"Multiline:"); y += 105; for (int i = 0; i < 4; i++) { input[i]->when(0); input[i]->callback(cb); } int y1 = y; Fl_Button *b; b = new Fl_Toggle_Button(10,y,200,25,"FL_WHEN_&CHANGED"); b->callback(toggle_cb, FL_WHEN_CHANGED); y += 25; b = new Fl_Toggle_Button(10,y,200,25,"FL_WHEN_&RELEASE"); b->callback(toggle_cb, FL_WHEN_RELEASE); y += 25; b = new Fl_Toggle_Button(10,y,200,25,"FL_WHEN_&ENTER_KEY"); b->callback(toggle_cb, FL_WHEN_ENTER_KEY); y += 25; b = new Fl_Toggle_Button(10,y,200,25,"FL_WHEN_&NOT_CHANGED"); b->callback(toggle_cb, FL_WHEN_NOT_CHANGED); y += 25; y += 5; b = new Fl_Button(10,y,200,25,"&print changed()"); b->callback(button_cb); b = new Fl_Button(220,y1,100,25,"color"); y1 += 25; b->color(input[0]->color()); b->callback(color_cb, (void*)0); b = new Fl_Button(220,y1,100,25,"selection_color"); y1 += 25; b->color(input[0]->selection_color()); b->callback(color_cb, (void*)1); b = new Fl_Button(220,y1,100,25,"textcolor"); y1 += 25; b->color(input[0]->textcolor()); b->callback(color_cb, (void*)2); b->labelcolor(contrast(FL_BLACK,b->color())); window->end(); window->show(argc,argv); return Fl::run(); } // // End of "$Id: input.cxx,v 1.4 1998/11/08 15:05:47 mike Exp $". //
[ "vmg@arachnion.de" ]
vmg@arachnion.de
fd104c2c78a87aa33f47dbbc64d380084bfcf507
785df77400157c058a934069298568e47950e40b
/TnbHydrostatic/TnbLib/Hydrostatic/Entities/Functions/rArm/HydStatic_StbFun_rArm.cxx
065b8133fe137c103510a9475dd117fce590a94b
[]
no_license
amir5200fx/Tonb
cb108de09bf59c5c7e139435e0be008a888d99d5
ed679923dc4b2e69b12ffe621fc5a6c8e3652465
refs/heads/master
2023-08-31T08:59:00.366903
2023-08-31T07:42:24
2023-08-31T07:42:24
230,028,961
9
3
null
2023-07-20T16:53:31
2019-12-25T02:29:32
C++
UTF-8
C++
false
false
515
cxx
#include <HydStatic_StbFun_rArm.hxx> #include <HydStatic_rArmCurve.hxx> #include <TnbError.hxx> #include <OSstream.hxx> Standard_Real tnbLib::hydStcLib::StbFun_rArm::MinHeel() const { Debug_Null_Pointer(Arm()); return Arm()->MinHeel(); } Standard_Real tnbLib::hydStcLib::StbFun_rArm::MaxHeel() const { Debug_Null_Pointer(Arm()); return Arm()->MaxHeel(); } Standard_Real tnbLib::hydStcLib::StbFun_rArm::Value ( const Standard_Real thePhi ) const { Debug_Null_Pointer(Arm()); return Arm()->Value(thePhi); }
[ "aasoleimani86@gmail.com" ]
aasoleimani86@gmail.com
ccd4f1658b43c6a8cfd4d3b6164559ddaed19b33
d05383f9f471b4e0691a7735aa1ca50654704c8b
/CPP2MIssues/SampleClass678.cpp
fca93b7a7beb1690cc1bec5e5d6d66e4ff62e715
[]
no_license
KetkiT/CPP2MIssues
d2186a78beeb36312cc1a756a005d08043e27246
82664377d0f0047d84e6c47e9380d1bafa840d19
refs/heads/master
2021-08-26T07:27:00.804769
2017-11-22T07:29:45
2017-11-22T07:29:45
null
0
0
null
null
null
null
UTF-8
C++
false
false
50,048
cpp
class SampleClass678{ public: void m1() { int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); int *ptr = new int (10); } };
[ "ketki.thosar@acellere.com" ]
ketki.thosar@acellere.com
9750590c48d3567ce1bc9cf26da3030e841f4e9b
261edff1dddb9b4087a73e0bf0ab13ea9e084c2e
/Constructors.cpp
e80d81eb2cca45ef57f87336f16d65cb831408fa
[ "Apache-2.0" ]
permissive
Rohit-Anand/Constructors
b3fa97f5c86789f0dd7dcc61cbaa5ec2be9ed9fb
45b37d860910f61b57486769a4ee3ccdd36fc943
refs/heads/master
2020-03-23T13:12:02.826342
2018-07-19T16:40:58
2018-07-19T16:47:35
141,605,292
0
0
null
null
null
null
UTF-8
C++
false
false
1,434
cpp
// // Constructors.cpp // Learning_cpp // // Created by Rohit Anand on 23/06/18. // Copyright © 2018 Rohit Anand. All rights reserved. // // This file is dummy, just to print and monitor the c'Tors, may be used later to introduce // C'Tors and D'Tors to others #include <iostream> using namespace std; class Base { public: Base() { cout << "Base default c'tor" << endl; a = 10; } Base (const Base& b) { cout << "Base Copy Const c'tor" << endl; } Base (Base& b) { cout << "Base Copy c'tor" << endl; } Base(Base&& b) { cout << "Base Move c'tor" << endl; a = b.a; b.a = 0; } Base& operator= (Base& b) { cout << "operator = Base" << endl; return b; } virtual void fun() const { cout << "Base Fun: " << a << endl; } int a; Base(const Base&& b) { cout << "Base const Move c'tor" << endl; a = b.a; } }; class Derived : public Base { public: void fun() const { cout << "Derived Fun" << endl; } }; int main() { const Base b; cout << " -- --- " << endl; Base b1(b); cout << " -- --- " << endl; Base b2(std::move(b)); cout << " -- --- " << endl; b.fun(); b2.fun(); Derived d; d.fun(); cout << " -- bD --- " << endl; Base* b3 = new Derived(); b3->fun(); return 0; }
[ "rohitanand28@gmail.com" ]
rohitanand28@gmail.com
313888bfb388f06478a711307a78ae612bebe121
a86bccfd580eb97dcf4f485a2eadb0b773194cdc
/AsterRebotador/stdafx.cpp
d6cacac76b4e60f0b034d7b7effeb1c52b3d9f1c
[ "Apache-2.0" ]
permissive
AaronRebel09/AsteroidSimpleRebounder
1a76585cd0daf1aad4dcca80dcbb74556249ae4e
461a17ef9964d16973a50969824ef91111a784d9
refs/heads/master
2021-01-22T06:06:33.327043
2017-09-03T19:09:40
2017-09-03T19:09:40
102,283,617
0
0
null
null
null
null
ISO-8859-1
C++
false
false
327
cpp
// stdafx.cpp: archivo de código fuente que contiene sólo las inclusiones estándar // AsterRebotador.pch será el encabezado precompilado // stdafx.obj contiene la información de tipos precompilada #include "stdafx.h" // TODO: mencionar los encabezados adicionales que se necesitan en STDAFX.H // pero no en este archivo
[ "aron_rebel@comunidad.unam.mx" ]
aron_rebel@comunidad.unam.mx
325ab60666ad3500c0ffcce467ef0de47e50131e
c251c69949132212bf15432136104380719cbbfd
/SQF/dayz_code/Configs/CfgMagazines/Crafting/equip_part_camo.hpp
6d83b997ee4d4a750de7533f646361dea6f0e7e0
[]
no_license
DayZMod/DayZ
fc7c27ab4ceb9501229b0b952e6d0894fe6af57a
42368d7bbf0c85e51ddc75074a82196a21db9a55
refs/heads/Development
2021-01-23T16:26:17.696800
2019-01-26T16:24:58
2019-01-26T16:24:58
10,610,876
173
176
null
2020-03-26T14:26:53
2013-06-10T22:31:23
C++
UTF-8
C++
false
false
255
hpp
class equip_part_camo : CA_Magazine { scope = public; count = 1; displayName = $STR_ITEM_NAME_equip_part_camo; descriptionShort = $STR_ITEM_DESC_equip_part_camo; picture = "\z\addons\dayz_communityassets\textures\equip_part_camo.paa"; type = 256; };
[ "R4Z0R49@gmail.com" ]
R4Z0R49@gmail.com
71163e81681a14261a671036b66767aa81251daa
f9376571d54d2d3aa54505aa863ed452a0140558
/sparseRRT/src/quadrotor_sst_search.cpp
9b82eca9e2ba451b4ac27e0e5f41e79ad60c1d64
[]
no_license
gnunoe/Cf_ROS
f63ddc45655caa5d332a4a61e789aa23399d000a
7299bef22bd853d41326f7e45865782f2fb549f9
refs/heads/master
2021-01-21T14:01:17.355897
2015-06-26T18:59:09
2015-06-26T18:59:09
38,109,928
0
1
null
null
null
null
UTF-8
C++
false
false
11,097
cpp
#include <ros/ros.h> #include <ros/package.h> #include "sparseRRT/utilities/parameter_reader.hpp" #include "sparseRRT/utilities/condition_check.hpp" #include "sparseRRT/utilities/random.hpp" #include "sparseRRT/utilities/timer.hpp" #include "sparseRRT/systems/point.hpp" #include "sparseRRT/systems/quadrotor.hpp" #include "sparseRRT/motion_planners/sst.hpp" #include "sparseRRT/motion_planners/rrt.hpp" #include <iostream> #include <cstdlib> #include <ctime> #include <stdlib.h> #include <stdio.h> //SRV test #include "sparseRRT/sparse_search.h" #include "std_msgs/String.h" using namespace std; //Call ROS nodes to visualize result in RVIZ void visualize_path() { std::string command = "roslaunch sparseRRT disp_obst_traj.launch map:=" + params::map + " file_name:=trajectory_sst_search.csv"; //command.append(params::map); system(command.c_str()); } class tree{ public: //=================================// // VARIABLES // //=================================// //Pointer to hold the quadrotor system system_t* system; //Pointer to hold the planner (sst) planner_t* planner; //Service to process the requests ros::ServiceServer sparse_search; //Ros Node Handle ros::NodeHandle n; //bool to check the tree has been built bool tree_built; //=================================// // METHODS // //=================================// //Constructor tree(std::string path_file, std::string map, int iter_time, double start[3], double goal[3]) { ROS_INFO_STREAM("creating tree object ..."); //Initializate variables sparse_search = n.advertiseService("sparse_tree_search",&tree::search_nodes_in_tree, this); tree_built = false; //Read default paramentes and complete them with //the args received read_parameters(); params::path_file = path_file; params::map = map; params::stopping_check = iter_time; params::start_state[0] = start[0]; params::start_state[1] = start[1]; params::start_state[2] = start[2]; params::goal_state[0] = goal[0]; params::goal_state[1] = goal[1]; params::goal_state[2] = goal[2]; //Create the system and the planner desired init_random(std::time(NULL));//params::random_seed); if(params::system=="quadrotor_cf") { system = new quadrotor_cf_t(); } if(params::planner=="rrt") { planner = new rrt_t(system); } else if(params::planner=="sst") { planner = new sst_t(system); } //Change the limits of the map if the selected //is a only simulation map if (params::map == "Map2_3D" || params::map == "Map3_3D" || params::map == "Map4_3D") { system->change_Map_Limits(5.0, 6.0, 0.5, 2.5); } if (params::map == "Map5_3D") { system->change_Map_Limits(5.0, 6.0, 0.5, 4.0); } if (params::map == "Map5" || params::map == "Map6") { system->change_Map_Limits(2.0, 2.5, 0.5, 2.4); } } //Service for search two nodes in the tree //Return code message // -> 1 = Success // -> 2 = Start in collision // -> 3 = Goal in collision // -> 4 = Path not found // -> 5 = Start exceeds map limits // -> 6 = Goal exceeds map limits bool search_nodes_in_tree(sparseRRT::sparse_search::Request &req, sparseRRT::sparse_search::Response &res) { //space map limits double mocap_limits[4]= {2.0, 2.5, 0.5, 1.5}; std::string answer; bool smooth = false; while(true) { ROS_INFO_STREAM("Apply smoothing to the trajectory? (y/n)"); std::cin >> answer; if (answer == "y" || answer == "Y") { smooth = true; break; } else if (answer == "n" || answer == "N") { smooth = false; break; } } double sec = ros::Time::now().toSec(); ROS_INFO_STREAM("Processing request"); double start[3]={req.x_s, req.y_s, req.z_s}; double goal[3] ={req.x_g, req.y_g, req.z_g}; //if the big maps for simulation were selected, //change the mocap limits if (params::map == "Map2_3D" || params::map == "Map3_3D" || params::map == "Map4_3D") { mocap_limits[0] = 5.0; mocap_limits[1] = 6.0; mocap_limits[2] = 0.5; mocap_limits[3] = 2.5; } if (params::map == "Map5_3D") { mocap_limits[0] = 5.0; mocap_limits[1] = 6.0; mocap_limits[2] = 0.5; mocap_limits[3] = 4.0; } if (params::map == "Map5" || params::map == "Map6") { mocap_limits[0] = 2.0; mocap_limits[1] = 2.5; mocap_limits[2] = 0.5; mocap_limits[3] = 2.4; } if (abs(start[0])>mocap_limits[0] | abs(start[1])>mocap_limits[1] | start[2]<mocap_limits[2] | start[2]>mocap_limits[3]) { ROS_ERROR_STREAM("Start exceeded map limits"); ROS_ERROR_STREAM("X--> -" << mocap_limits[0] << " < X < " << mocap_limits[0]); ROS_ERROR_STREAM("Y--> -" << mocap_limits[1] << " < Y < " << mocap_limits[1]); ROS_ERROR_STREAM("Z--> " << mocap_limits[2] << " < Z < " << mocap_limits[3]); res.done = 5; return true; } if (abs(goal[0])>mocap_limits[0] | abs(goal[1])>mocap_limits[1] | goal[2]<mocap_limits[2] | goal[2]>mocap_limits[3]) { ROS_ERROR_STREAM("Goal exceeded map limits"); ROS_ERROR_STREAM("X--> -" << mocap_limits[0] << " < X < " << mocap_limits[0]); ROS_ERROR_STREAM("Y--> -" << mocap_limits[1] << " < Y < " << mocap_limits[1]); ROS_ERROR_STREAM("Z--> " << mocap_limits[2] << " < Z < " << mocap_limits[3]); res.done = 6; return true; } bool start_ok = system->obstacles_in_start(start[0],start[1],start[2]); if(start_ok) { res.done = 2; return true; } bool goal_ok = system->obstacles_in_start(goal[0],goal[1],goal[2]); if(goal_ok) { res.done = 3; return true; } bool found_path = planner->path_between_nodes(start[0], start[1], start[2], goal[0], goal[1], goal[2], smooth); if (!found_path) { res.done = 4; return true; } ROS_INFO_STREAM("Processed in: " << ros::Time::now().toSec() - sec << " seconds"); ROS_INFO_STREAM("Visualizing in RVIZ..."); visualize_path(); res.done = 1; return true; } /* bool search(double x_s, double y_s, double z_s, double x_g, double y_g, double z_g) { bool start_ok = system->obstacles_in_start(x_s, y_s,z_s); if(start_ok) { return false; } bool goal_ok = system->obstacles_in_start(x_g, y_g, z_g); if(goal_ok) { return false; } bool found_path = planner->path_between_nodes(x_s, y_s, z_s, x_g, y_g, z_g); if (!found_path) { return false; } //ROS_INFO_STREAM(ros::Time::now().toSec() - sec); return true; } */ //Create the tree void create_tree() { planner->set_start_state(params::start_state); planner->set_goal_state(params::goal_state,params::goal_radius); planner->setup_planning(); condition_check_t checker(params::stopping_type,params::stopping_check); condition_check_t* stats_check=NULL; if(params::stats_check!=0) { stats_check = new condition_check_t(params::stats_type,params::stats_check); } checker.reset(); std::cout<<"Building the tree for the planner: "<<params::planner<<" for the system: "<<params::system<<" in: "<< params::map <<std::endl; if(stats_check==NULL) { do { planner->step(); } while(!checker.check()); std::cout<<"Time: "<<checker.time()<<" Iterations: "<<checker.iterations()<<" Nodes: "<<planner->number_of_nodes<< "\n"; } else { int count = 0; bool execution_done = false; bool stats_print = false; while(true && ros::ok()) { do { planner->step(); execution_done = checker.check(); stats_print = stats_check->check(); } while(!execution_done && !stats_print); if(stats_print) { std::cout<<"Time: "<<checker.time()<<" Iterations: "<<checker.iterations()<<" Nodes: "<<planner->number_of_nodes<< "\n"; stats_print = false; stats_check->reset(); } if (execution_done) { std::cout<<"Time: "<<checker.time()<<" Iterations: "<<checker.iterations()<<" Nodes: "<<planner->number_of_nodes<<"\n"; break; } } } ROS_INFO_STREAM("Tree built, waiting for request"); tree_built = true; n.setParam("available_sparse_service", 1); infinite_loop(); } //Infinite loop to keep the node alive and process client requests void infinite_loop() { while(ros::ok()) { /* //std::cout << "."; double start[3]; double goal[3]; std::cin >> start[0]; std::cin >> start[1]; std::cin >> start[2]; std::cin >> goal[0]; std::cin >> goal[1]; std::cin >> goal[2]; bool done = search(start[0], start[1], start[2], goal[0], goal[1], goal[2]); std::cout << done << "\n"; */ ros::spinOnce(); } } }; int main( int argc, char** argv ) { ros::init(argc, argv, "quadrotor_SST_tree_service"); std::string path_file =""; std::string map_name = ""; int iter_time = 0; double sparse_start[3]={0,0,0}; double sparse_goal[3]={0,0,0}; if (argc !=10) { ROS_INFO_STREAM("Usage: quadrotor_SST <Map> <Iteration Time> <startX> <startY> <startZ> <goalX> <goalY> <goalZ>"); ROS_INFO_STREAM("Supported Maps: Map1, Map2, Map3, Map4"); return 1; } else { path_file = argv[1]; map_name = argv[2]; iter_time = atoi(argv[3]); //fill start position sparse_start[0] = atof(argv[4]); sparse_start[1] = atof(argv[5]); sparse_start[2] = atof(argv[6]); //and goal position sparse_goal[0] = atof(argv[7]); sparse_goal[1] = atof(argv[8]); sparse_goal[2] = atof(argv[9]); if (map_name != "Map1" && map_name != "Map2" && map_name != "Map3" && map_name != "Map4" && map_name != "Map5" && map_name != "Map6" && map_name != "Map1_3D" && map_name != "Map2_3D" && map_name != "Map3_3D" && map_name != "Map4_3D" && map_name != "Map5_3D") { ROS_INFO_STREAM(map_name << " is not a supported map"); return 1; } } ros::NodeHandle n; tree *t = new tree(path_file, map_name, iter_time, sparse_start, sparse_goal); //Check if there is obstacles in goal or start bool goal_in_obstacle = t->system->obstacles_in_goal(); if (goal_in_obstacle) { ROS_ERROR_STREAM("Abort planning, obstacles in goal"); } bool start_in_obstacle = t->system->obstacles_in_start(); if (start_in_obstacle) { ROS_ERROR_STREAM("Abort planning, obstacles in start"); } if(start_in_obstacle || goal_in_obstacle) { ROS_ERROR_STREAM("Closing tree server..."); n.setParam("available_sparse_service", 2); } else { //n.setParam("available_sparse_service", 1); t->create_tree(); } return 1; }
[ "estevez@brixx.informatik.uni-freiburg.de" ]
estevez@brixx.informatik.uni-freiburg.de
0e4d8dea6315ff7fe40e9b94baaf168a79943a8b
05f580305dd6aaef48afc1ad2bfbb2646015a674
/expressions/scalar/ScalarSharedExpression.hpp
d5dddbced3255619b3958611e3fd7b4738ed47da
[ "Apache-2.0", "MIT", "BSD-3-Clause" ]
permissive
udippant/incubator-quickstep
637b6d24c5783dab5d38c26ef4b5fb8525c1711c
8169306c2923d68235ba3c0c8df4c53f5eee9a68
refs/heads/master
2021-01-20T00:45:37.576857
2017-04-20T20:28:12
2017-04-23T19:57:02
89,181,659
1
0
null
2017-04-24T00:24:48
2017-04-24T00:24:48
null
UTF-8
C++
false
false
3,943
hpp
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. **/ #ifndef QUICKSTEP_EXPRESSIONS_SCALAR_SCALAR_SHARED_EXPRESSION_HPP_ #define QUICKSTEP_EXPRESSIONS_SCALAR_SCALAR_SHARED_EXPRESSION_HPP_ #include <memory> #include <string> #include <utility> #include <vector> #include "catalog/CatalogTypedefs.hpp" #include "expressions/Expressions.pb.h" #include "expressions/scalar/Scalar.hpp" #include "storage/StorageBlockInfo.hpp" #include "types/TypedValue.hpp" #include "types/containers/ColumnVector.hpp" #include "utility/Macros.hpp" namespace quickstep { class ColumnVectorCache; class ValueAccessor; struct SubBlocksReference; /** \addtogroup Expressions * @{ */ /** * @brief Scalars that represent common subexpressions whose results are cached * and shared. **/ class ScalarSharedExpression : public Scalar { public: /** * @brief Constructor. * * @param share_id The unique integer identifier for each equivalence class of * common subexpressions. * @param operand The underlying scalar subexpression. **/ ScalarSharedExpression(const int share_id, Scalar *operand); /** * @brief Destructor. **/ ~ScalarSharedExpression() override { } serialization::Scalar getProto() const override; Scalar* clone() const override; ScalarDataSource getDataSource() const override { return kSharedExpression; } TypedValue getValueForSingleTuple(const ValueAccessor &accessor, const tuple_id tuple) const override; TypedValue getValueForJoinedTuples( const ValueAccessor &left_accessor, const relation_id left_relation_id, const tuple_id left_tuple_id, const ValueAccessor &right_accessor, const relation_id right_relation_id, const tuple_id right_tuple_id) const override; bool hasStaticValue() const override { return operand_->hasStaticValue(); } const TypedValue& getStaticValue() const override { return operand_->getStaticValue(); } ColumnVectorPtr getAllValues(ValueAccessor *accessor, const SubBlocksReference *sub_blocks_ref, ColumnVectorCache *cv_cache) const override; ColumnVectorPtr getAllValuesForJoin( const relation_id left_relation_id, ValueAccessor *left_accessor, const relation_id right_relation_id, ValueAccessor *right_accessor, const std::vector<std::pair<tuple_id, tuple_id>> &joined_tuple_ids, ColumnVectorCache *cv_cache) const override; protected: void getFieldStringItems( std::vector<std::string> *inline_field_names, std::vector<std::string> *inline_field_values, std::vector<std::string> *non_container_child_field_names, std::vector<const Expression*> *non_container_child_fields, std::vector<std::string> *container_child_field_names, std::vector<std::vector<const Expression*>> *container_child_fields) const override; private: const int share_id_; std::unique_ptr<Scalar> operand_; DISALLOW_COPY_AND_ASSIGN(ScalarSharedExpression); }; /** @} */ } // namespace quickstep #endif // QUICKSTEP_EXPRESSIONS_SCALAR_SCALAR_SHARED_EXPRESSION_HPP_
[ "jianqiao@cs.wisc.edu" ]
jianqiao@cs.wisc.edu
083beb8e16f1aac1fc3af4f818e8e9f450448af1
d2847848e1decbb8076345ebcc71223edf47ac80
/tests/fitting/ComplexDiffTest.h
15db961e46a694be9b8113cd7f6410298378fe5f
[ "MIT" ]
permissive
lao19881213/base-scimath
fd274a76ea386fb3f659666812b1ab522ad3bc65
bfbe6b01be130d83f116c11f48189062782ced35
refs/heads/main
2023-05-31T03:23:03.407735
2021-06-12T06:38:52
2021-06-12T06:38:52
376,219,225
0
1
null
null
null
null
UTF-8
C++
false
false
6,900
h
/// @file /// /// @brief Tests of ComplexDiff autodifferentiation class /// @details See ComplexDiff for description of what this class /// is supposed to do. This file contains appropriate unit tests. /// /// @copyright (c) 2007 CSIRO /// Australia Telescope National Facility (ATNF) /// Commonwealth Scientific and Industrial Research Organisation (CSIRO) /// PO Box 76, Epping NSW 1710, Australia /// atnf-enquiries@csiro.au /// /// This file is part of the ASKAP software distribution. /// /// The ASKAP software distribution is free software: you can redistribute it /// and/or modify it under the terms of the GNU General Public License as /// published by the Free Software Foundation; either version 2 of the License, /// or (at your option) any later version. /// /// This program is distributed in the hope that it will be useful, /// but WITHOUT ANY WARRANTY; without even the implied warranty of /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /// GNU General Public License for more details. /// /// You should have received a copy of the GNU General Public License /// along with this program; if not, write to the Free Software /// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /// /// @author Max Voronkov <maxim.voronkov@csiro.au> #ifndef COMPLEX_DIFF_TEST #define COMPLEX_DIFF_TEST #include <askap/scimath/fitting/ComplexDiff.h> #include <askap/scimath/fitting/ComplexDiffMatrix.h> #include <cppunit/extensions/HelperMacros.h> #include <askap/askap/AskapError.h> #include <algorithm> #include <set> namespace askap { namespace scimath { class ComplexDiffTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(ComplexDiffTest); CPPUNIT_TEST(testAdd); CPPUNIT_TEST(testMultiply); CPPUNIT_TEST(testMultiplyVector); CPPUNIT_TEST(testConjugate); CPPUNIT_TEST(testParameterList); CPPUNIT_TEST(testParameterType); CPPUNIT_TEST_SUITE_END(); private: ComplexDiff f,g; public: void setUp(); void testAdd(); void testMultiply(); void testMultiplyVector(); void testConjugate(); void testParameterList(); void testParameterType(); }; void ComplexDiffTest::setUp() { f = ComplexDiff("g1",casa::Complex(35.,-15.)); g = ComplexDiff("g2",casa::Complex(-35.,15.)); } void ComplexDiffTest::testAdd() { f+=g; CPPUNIT_ASSERT(abs(f.value())<1e-7); CPPUNIT_ASSERT(abs(f.derivRe("g1")-casa::Complex(1.,0.))<1e-7); CPPUNIT_ASSERT(abs(f.derivRe("g2")-casa::Complex(1.,0.))<1e-7); CPPUNIT_ASSERT(abs(f.derivIm("g1")-casa::Complex(0.,1.))<1e-7); CPPUNIT_ASSERT(abs(f.derivIm("g2")-casa::Complex(0.,1.))<1e-7); g+=f; CPPUNIT_ASSERT(abs(g.value()-casa::Complex(-35.,15.))<1e-7); CPPUNIT_ASSERT(abs(g.derivRe("g1")-casa::Complex(1.,0.))<1e-7); CPPUNIT_ASSERT(abs(g.derivIm("g1")-casa::Complex(0.,1.))<1e-7); CPPUNIT_ASSERT(abs(g.derivRe("g2")-casa::Complex(2.,0.))<1e-7); CPPUNIT_ASSERT(abs(g.derivIm("g2")-casa::Complex(0.,2.))<1e-7); ComplexDiff d = g+f+1+casa::Complex(0.,-2.); CPPUNIT_ASSERT(abs(d.value()-casa::Complex(-34.,13.))<1e-7); CPPUNIT_ASSERT(abs(d.derivRe("g1")-casa::Complex(2.,0.))<1e-7); CPPUNIT_ASSERT(abs(d.derivIm("g1")-casa::Complex(0.,2.))<1e-7); CPPUNIT_ASSERT(abs(d.derivRe("g2")-casa::Complex(3.,0.))<1e-7); CPPUNIT_ASSERT(abs(d.derivIm("g2")-casa::Complex(0.,3.))<1e-7); } void ComplexDiffTest::testMultiply() { ComplexDiff d = g*f; CPPUNIT_ASSERT(abs(d.value()-casa::Complex(-1000.,1050.))<1e-7); CPPUNIT_ASSERT(abs(d.derivRe("g1")-casa::Complex(-35.,15.))<1e-7); CPPUNIT_ASSERT(abs(d.derivIm("g1")-casa::Complex(-15.,-35.))<1e-7); CPPUNIT_ASSERT(abs(d.derivRe("g2")-casa::Complex(35.,-15.))<1e-7); CPPUNIT_ASSERT(abs(d.derivIm("g2")-casa::Complex(15.,35.))<1e-7); g*=f; CPPUNIT_ASSERT(abs(g.value()-casa::Complex(-1000.,1050.))<1e-7); CPPUNIT_ASSERT(abs(g.derivRe("g1")-casa::Complex(-35.,15.))<1e-7); CPPUNIT_ASSERT(abs(g.derivIm("g1")-casa::Complex(-15.,-35.))<1e-7); CPPUNIT_ASSERT(abs(g.derivRe("g2")-casa::Complex(35.,-15.))<1e-7); CPPUNIT_ASSERT(abs(g.derivIm("g2")-casa::Complex(15.,35.))<1e-7); d = g*casa::Complex(0.,1.); CPPUNIT_ASSERT(abs(d.value()-casa::Complex(-1050.,-1000.))<1e-7); CPPUNIT_ASSERT(abs(d.derivRe("g1")-casa::Complex(-15,-35.))<1e-7); CPPUNIT_ASSERT(abs(d.derivIm("g1")-casa::Complex(35.,-15.))<1e-7); CPPUNIT_ASSERT(abs(d.derivRe("g2")-casa::Complex(15,35.))<1e-7); CPPUNIT_ASSERT(abs(d.derivIm("g2")-casa::Complex(-35.,15.))<1e-7); } void ComplexDiffTest::testMultiplyVector() { casa::Vector<casa::Complex> vec(10,casa::Complex(0.,-2.)); ComplexDiffMatrix cdVec = vec * f; for (casa::uInt i = 0; i< vec.nelements(); ++i) { ASKAPASSERT(i < cdVec.nElements()); const ComplexDiff &d = cdVec[i]; CPPUNIT_ASSERT(abs(d.value()-casa::Complex(-30.,-70.))<1e-7); CPPUNIT_ASSERT(abs(d.derivRe("g1")-casa::Complex(0,-2.))<1e-7); CPPUNIT_ASSERT(abs(d.derivIm("g1")-casa::Complex(2.,0.))<1e-7); } ComplexDiff g1(g); cdVec = g1 * vec; for (casa::uInt i = 0; i< vec.nelements(); ++i) { ASKAPASSERT(i < cdVec.nElements()); const ComplexDiff &d = cdVec[i]; CPPUNIT_ASSERT(abs(d.value()-casa::Complex(30.,70.))<1e-7); CPPUNIT_ASSERT(abs(d.derivRe("g2")-casa::Complex(0,-2.))<1e-7); CPPUNIT_ASSERT(abs(d.derivIm("g2")-casa::Complex(2.,0.))<1e-7); } cdVec*= f; for (casa::uInt i = 0; i< vec.nelements(); ++i) { ASKAPASSERT(i < cdVec.nElements()); const ComplexDiff &d = cdVec[i]; CPPUNIT_ASSERT(abs(d.value()-casa::Complex(2100.,2000))<1e-7); CPPUNIT_ASSERT(abs(d.derivRe("g1")-casa::Complex(30.,70.))<1e-7); CPPUNIT_ASSERT(abs(d.derivIm("g1")-casa::Complex(-70.,30.))<1e-7); CPPUNIT_ASSERT(abs(d.derivRe("g2")-casa::Complex(-30.,-70.))<1e-7); CPPUNIT_ASSERT(abs(d.derivIm("g2")-casa::Complex(70.,-30.))<1e-7); } } void ComplexDiffTest::testConjugate() { ComplexDiff d = conj(g); CPPUNIT_ASSERT(abs(d.value()-casa::Complex(-35.,-15.))<1e-7); CPPUNIT_ASSERT(abs(d.derivRe("g2")-casa::Complex(1.,0.))<1e-7); CPPUNIT_ASSERT(abs(d.derivIm("g2")-casa::Complex(0.,-1.))<1e-7); } void ComplexDiffTest::testParameterList() { ComplexDiff d = g*f+1+casa::Complex(0.,-2.); std::vector<std::string> buf; std::copy(d.begin(),d.end(),std::back_insert_iterator<std::vector<std::string> >(buf)); CPPUNIT_ASSERT(buf[0] == "g1"); CPPUNIT_ASSERT(buf[1] == "g2"); CPPUNIT_ASSERT(buf.size() == 2); } void ComplexDiffTest::testParameterType() { ComplexDiff d("real",5); CPPUNIT_ASSERT(!g.isReal("g2")); CPPUNIT_ASSERT(!f.isReal("g1")); CPPUNIT_ASSERT(d.isReal("real")); ComplexDiff product = g*f*d; CPPUNIT_ASSERT(!product.isReal("g2")); CPPUNIT_ASSERT(!product.isReal("g1")); CPPUNIT_ASSERT(product.isReal("real")); } } // namespace scimath } // namespace askap #endif // #ifndef COMPLEX_DIFF_TEST
[ "lbq@shao.ac.cn" ]
lbq@shao.ac.cn
468ee2847bbf416e9394ea8bdc974dd77e1056bc
329e9d7fef75150f01d3faf355dd1f7c33e5f994
/BouncingBallOpenGL/BouncingBall/src/GameplayState.cpp
1181e01164e97679505fee3abfadc84336bfda54
[ "MIT" ]
permissive
09pawel0898/BouncingBall
6c138c2f56d74d1fd6f4c76975b9a7b0b5481730
dc3b7a6e73d838d03c60d315d833c90707007105
refs/heads/master
2023-08-16T03:54:53.124551
2021-09-30T21:07:47
2021-09-30T21:07:47
409,669,094
2
0
null
null
null
null
UTF-8
C++
false
false
3,018
cpp
#include "GameplayState.h" #include "Utility.h" GameplayState::GameplayState(En::States::StateManager& stateManager, Context context) : State(stateManager, context), m_FrameCounter(0), m_LastJumpFrame(0) { InitTextures(); InitSprites(); InitBall(); } void GameplayState::OnRender(void) const { En::Renderer::Draw(m_Background); En::Renderer::Draw(m_Ball); En::Renderer::Draw(m_BackButton); } bool GameplayState::OnUpdate(double deltaTime) { if (IsButtonCovered<ButtonType::Round>(m_BackButton, 30)) m_BackButton.SetScale(0.64f); else m_BackButton.SetScale(0.55f); if (m_Ball.m_IsJumping && (m_LastJumpFrame == m_FrameCounter - 30)) m_Ball.m_IsJumping = false; //this->jc = std::to_string(this->ball.jump_counter); /* if (this->jc.size() == 1) this->shift = 25; else if (this->jc.size() > 1) { if (this->jc.size() == 2) this->shift = 47; else this->shift = 69; } */ if (m_Ball.GetPosition().y - 1000 > App->GetWindow()->GetHeight()) { m_GameLost = true; App->GetStateManager()->PushState("GameLost"); } /* this->COUNTER.setPosition(this->window->getSize().x / 2.0f - this->shift, 138); this->COUNTER.setString(this->jc); */ static RectangleShape leftWall{ {0,0}, {2,600} }; static RectangleShape rightWall{ {448,0}, {2,600} }; m_Ball.Update(leftWall, rightWall); m_FrameCounter++; return true; } bool GameplayState::OnEvent(En::Event& event) { En::EventDispatcher dispatcher(event); dispatcher.Dipatch<En::MouseButtonPressedEvent>(BIND_EVENT_FN(GameplayState::OnMouseButtonPressed)); return true; } void GameplayState::OnAwake(void) { m_GameLost = false; m_Ball.Reset(); } bool GameplayState::OnMouseButtonPressed(En::MouseButtonPressedEvent& event) { if (m_Ball.IsBallClicked()) { if (!m_Ball.m_IsJumping) { m_Ball.m_JumpCounter++; m_Ball.Jump(); m_LastJumpFrame = m_FrameCounter; m_Ball.m_IsJumping = true; return true; } } if (IsButtonCovered<ButtonType::Round>(m_BackButton, 48)) GoToMainMenu(); return true; } void GameplayState::InitTextures(void) { const auto& texManager = App->GetTextureManager(); texManager->LoadResource("ball", "res/textures/ball.png"); texManager->LoadResource("backButton", "res/textures/buttonback.png"); //texManager->LoadResource("tile", "res/textures/tile.png"); //texManager->LoadResource("ballicon", "res/textures/ballicon.png"); } void GameplayState::InitSprites(void) { const auto& texManager = App->GetTextureManager(); m_Background.SetTexture(texManager->GetResource("background")); m_BackButton.SetTexture(texManager->GetResource("backButton")); m_BackButton.SetOrigin({48,48}); m_BackButton.SetScale(0.6f); m_BackButton.SetPosition({400,50}); } void GameplayState::InitBall(void) { const auto& texManager = App->GetTextureManager(); m_Ball.SetTexture(texManager->GetResource("ball")); m_Ball.SetPosition({App->GetWindow()->GetWidth() /2,150}); m_Ball.SetOrigin({ 43,43 }); } void GameplayState::GoToMainMenu(void) { App->GetStateManager()->PopState(); }
[ "pawel_2014@interia.eu" ]
pawel_2014@interia.eu
7f66d90e54c63c97886a87606a6d0f129daa65d0
8dc84558f0058d90dfc4955e905dab1b22d12c08
/third_party/blink/renderer/core/layout/line/line_breaker.cc
c0362d86c75bcb69a7772b2fabb4d444489dd53f
[ "LGPL-2.0-only", "BSD-2-Clause", "LGPL-2.1-only", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0" ]
permissive
meniossin/src
42a95cc6c4a9c71d43d62bc4311224ca1fd61e03
44f73f7e76119e5ab415d4593ac66485e65d700a
refs/heads/master
2022-12-16T20:17:03.747113
2020-09-03T10:43:12
2020-09-03T10:43:12
263,710,168
1
0
BSD-3-Clause
2020-05-13T18:20:09
2020-05-13T18:20:08
null
UTF-8
C++
false
false
4,545
cc
/* * Copyright (C) 2000 Lars Knoll (knoll@kde.org) * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. * All right reserved. * Copyright (C) 2010 Google Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * */ #include "third_party/blink/renderer/core/layout/line/line_breaker.h" #include "third_party/blink/renderer/core/layout/line/breaking_context_inline_headers.h" namespace blink { void LineBreaker::SkipLeadingWhitespace(InlineBidiResolver& resolver, LineInfo& line_info, LineWidth& width) { while ( !resolver.GetPosition().AtEnd() && !RequiresLineBox(resolver.GetPosition(), line_info, kLeadingWhitespace)) { LineLayoutItem line_layout_item = resolver.GetPosition().GetLineLayoutItem(); if (line_layout_item.IsOutOfFlowPositioned()) { SetStaticPositions(block_, LineLayoutBox(line_layout_item), width.IndentText()); if (line_layout_item.Style()->IsOriginalDisplayInlineType()) { resolver.Runs().AddRun( CreateRun(0, 1, LineLayoutItem(line_layout_item), resolver)); line_info.IncrementRunsFromLeadingWhitespace(); } } else if (line_layout_item.IsFloating()) { block_.InsertFloatingObject(LineLayoutBox(line_layout_item)); block_.PlaceNewFloats(block_.LogicalHeight(), &width); } resolver.GetPosition().Increment(&resolver); } resolver.CommitExplicitEmbedding(resolver.Runs()); } void LineBreaker::Reset() { positioned_objects_.clear(); hyphenated_ = false; clear_ = EClear::kNone; } InlineIterator LineBreaker::NextLineBreak(InlineBidiResolver& resolver, LineInfo& line_info, LayoutTextInfo& layout_text_info, WordMeasurements& word_measurements) { Reset(); DCHECK(resolver.GetPosition().Root() == block_); bool applied_start_width = resolver.GetPosition().Offset() > 0; bool is_first_formatted_line = line_info.IsFirstLine() && block_.CanContainFirstFormattedLine(); LineWidth width( block_, line_info.IsFirstLine(), RequiresIndent(is_first_formatted_line, line_info.PreviousLineBrokeCleanly(), block_.StyleRef())); SkipLeadingWhitespace(resolver, line_info, width); if (resolver.GetPosition().AtEnd()) return resolver.GetPosition(); BreakingContext context(resolver, line_info, width, layout_text_info, applied_start_width, block_); while (context.CurrentItem()) { context.InitializeForCurrentObject(); if (context.CurrentItem().IsBR()) { context.HandleBR(clear_); } else if (context.CurrentItem().IsOutOfFlowPositioned()) { context.HandleOutOfFlowPositioned(positioned_objects_); } else if (context.CurrentItem().IsFloating()) { context.HandleFloat(); } else if (context.CurrentItem().IsLayoutInline()) { context.HandleEmptyInline(); } else if (context.CurrentItem().IsAtomicInlineLevel()) { context.HandleReplaced(); } else if (context.CurrentItem().IsText()) { if (context.HandleText(word_measurements, hyphenated_)) { // We've hit a hard text line break. Our line break iterator is updated, // so go ahead and early return. return context.LineBreak(); } } else { NOTREACHED(); } if (context.AtEnd()) return context.HandleEndOfLine(); context.CommitAndUpdateLineBreakIfNeeded(); if (context.AtEnd()) return context.HandleEndOfLine(); context.Increment(); } context.ClearLineBreakIfFitsOnLine(); return context.HandleEndOfLine(); } } // namespace blink
[ "arnaud@geometry.ee" ]
arnaud@geometry.ee
e16e51f28d5876255b968ed719cccf955f5c74a6
eb95af611f23b7cc6311035de44475bdcaecc2c5
/cf/999/c1.cpp
6b74ec8b84c91b9461f75d9ff2d798abafc11777
[]
no_license
biswanaths/competition
a0f0dc1781a9cf5354f9c26932015bf1d22c8992
1a46f12be90c5b6866a9347bb79dc91a240b5b48
refs/heads/master
2023-03-07T11:56:55.485722
2023-02-24T09:05:44
2023-02-24T09:05:44
31,366,626
0
0
null
null
null
null
UTF-8
C++
false
false
1,369
cpp
#include <vector> #include <list> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <ctime> #include <cstring> using namespace std; typedef long long LL; typedef pair<int, int> PII; #define lld long long int #define EOL '\0' #define PEL cout<<endl; #define N 100002 #define rep(n) for(int i =0;(i)<(int)(n);(i)++) #define repij(n,m) for(int i =0;(i)<(int)(n);(i)++) for(int j =0;(j)<(int)(m);(j)++) #define SSTR( x ) dynamic_cast< std::ostringstream & >( \ std::ostringstream() << std::dec << x ).str() #define For(iterable) for(__typeof__((iterable).begin()) it = (iterable).begin(); it != (iterable).end(); ++it) int main() { ios::sync_with_stdio(false); #ifndef ONLINE_JUDGE freopen("test.in", "r",stdin); //freopen("test.out", "w",stdout); #endif int n,k; string s; cin>>n>>k>>s; vector<pair<char,int> > c(n); rep(n) c[i] = make_pair(s[i],i); sort(c.begin(), c.end()); sort(c.begin()+k, c.end(), [&] (const pair<char, int> &a, const pair<char, int> &b) { return a.second < b. second; }); for(int i=k;i<n;i++) cout<<c[i].first; return 0; }
[ "biswanaths@gmail.com" ]
biswanaths@gmail.com