blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
2
247
content_id
stringlengths
40
40
detected_licenses
listlengths
0
57
license_type
stringclasses
2 values
repo_name
stringlengths
4
111
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
58
visit_date
timestamp[ns]date
2015-07-25 18:16:41
2023-09-06 10:45:08
revision_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
committer_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
github_id
int64
3.89k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
25 values
gha_event_created_at
timestamp[ns]date
2012-06-07 00:51:45
2023-09-14 21:58:52
gha_created_at
timestamp[ns]date
2008-03-27 23:40:48
2023-08-24 19:49:39
gha_language
stringclasses
159 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
10.5M
extension
stringclasses
111 values
filename
stringlengths
1
195
text
stringlengths
7
10.5M
678ab2173d67b344a179f97db831e69ad51b09bd
1e4170a74c90959e157eda69d4ebb778dc17af96
/DataStructureProject/Testers/SortingTester.hpp
cf74bb281bee18fa59dc76f9cf9b28b41e35c478
[]
no_license
shujaetdin/DataStructureProject
0a6fc7b20c1d9b43e66e225cfdb1980dbc7383f2
787fe368e37501a6ebe43176ba378647809ed74c
refs/heads/master
2021-05-08T23:25:46.695605
2018-05-21T13:34:57
2018-05-21T13:34:57
119,705,498
0
0
null
null
null
null
UTF-8
C++
false
false
614
hpp
SortingTester.hpp
// // SortingTester.hpp // DataStructureProject // // Created by Din, Shujaet on 3/15/18. // Copyright © 2018 Din, Shujaet. All rights reserved. // #ifndef SortingTester_hpp #define SortingTester_hpp #include <iostream> #include "../Controller/FileController.hpp" #include"../Controller/Tools/Timer.hpp" class SortingTester { private: void quickSort(vector<CrimeData> data, int low, int high); int partition(vector<CrimeData> data, int low, int high); void swap(vector<CrimeData> info, int small, int large ); int swapCount; public: void testSorts(); }; #endif /* SortingTester_hpp */
282f203d7499ebdbb957b2719cf0e28af03285ec
c5e19eb41f6e4aafb6fc7e7ae062ea5e774a27e1
/Classes/myBT/Conditions/AlwaysFalse.h
096e14bfb292301ae0a4684ffd975993655879e9
[]
no_license
makiolo/plague-defense
95e2ba91bff511f51ae1c7e5cdb0121765520c59
3ffab0199a4781ef664e89c0d964ba839e776f0c
refs/heads/master
2021-07-02T04:50:21.279609
2020-11-01T00:35:16
2020-11-01T00:35:16
191,056,664
0
0
null
null
null
null
UTF-8
C++
false
false
418
h
AlwaysFalse.h
#pragma once #include "../Condition.h" namespace myBT { class AlwaysFalse : public Condition { public: explicit AlwaysFalse(const std::string& what) : Condition(what) {} ~AlwaysFalse() override { ; } Type get_type() const override { return TYPE_FALSE; } std::string get_typename() const override {return "False";} bool check(myBT::Context& context, double deltatime) override { return false; } }; }
f129c4e970ed7740d2c6f9720483c637d3898f6c
4bea57e631734f8cb1c230f521fd523a63c1ff23
/projects/openfoam/rarefied-flows/impingment/sims/templates/wedge15Ma5/1.08/rho
b2b828fcadfa07bc3e4de02bf0213984f1d3ae63
[]
no_license
andytorrestb/cfal
76217f77dd43474f6b0a7eb430887e8775b78d7f
730fb66a3070ccb3e0c52c03417e3b09140f3605
refs/heads/master
2023-07-04T01:22:01.990628
2021-08-01T15:36:17
2021-08-01T15:36:17
294,183,829
1
0
null
null
null
null
UTF-8
C++
false
false
44,672
rho
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v1912 | | \\ / A nd | Website: www.openfoam.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "1.08"; object rho; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [1 -3 0 0 0 0 0]; internalField nonuniform List<scalar> 4800 ( 116.284 2.91224 0.95897 0.913808 0.888144 0.913247 0.965697 1.03918 1.11096 1.16618 1.1962 1.19962 1.18666 1.16393 1.13425 1.10503 1.06263 0.940966 0.732474 0.654823 0.653155 0.665192 0.682973 0.696526 0.703815 0.706134 0.705524 0.704454 0.704229 0.70584 0.71188 0.725316 0.745959 0.769 0.78792 0.795569 0.794677 0.790319 0.789324 0.796228 116.269 2.94141 0.958828 0.925206 0.896528 0.923753 0.974824 1.04354 1.10929 1.1611 1.19156 1.19762 1.1854 1.16167 1.1305 1.10183 1.06309 0.943635 0.734871 0.657596 0.654936 0.665804 0.681937 0.694459 0.701373 0.703961 0.70483 0.705819 0.707682 0.712142 0.719729 0.730454 0.744603 0.761008 0.777331 0.78783 0.789941 0.787279 0.786253 0.792048 116.258 2.96201 0.963582 0.939274 0.911283 0.940679 0.986819 1.04553 1.10408 1.15343 1.18506 1.19487 1.18366 1.15822 1.12507 1.09852 1.0652 0.94868 0.739548 0.660966 0.656161 0.665411 0.679328 0.690511 0.697378 0.701374 0.704568 0.708222 0.713526 0.721017 0.728954 0.73523 0.740557 0.748621 0.761728 0.776517 0.786346 0.787996 0.788796 0.793977 116.318 2.90633 0.970849 0.95226 0.929552 0.960404 1.00009 1.0485 1.09794 1.14381 1.17638 1.18976 1.17906 1.15293 1.11995 1.09576 1.06924 0.956205 0.74641 0.665935 0.657679 0.664955 0.676009 0.685629 0.692756 0.69875 0.705136 0.712295 0.721461 0.730848 0.736634 0.738409 0.738172 0.739294 0.747564 0.76337 0.780328 0.787125 0.788457 0.792095 116.46 2.76834 0.979549 0.964948 0.947015 0.977727 1.01191 1.05296 1.09419 1.13325 1.16415 1.17953 1.17289 1.14801 1.1171 1.09524 1.07465 0.966653 0.754505 0.670579 0.658159 0.663081 0.672286 0.680824 0.688477 0.696752 0.70607 0.717369 0.729725 0.738676 0.740995 0.738916 0.73504 0.733662 0.739126 0.75415 0.772562 0.783171 0.785356 0.787774 116.624 2.6221 0.989433 0.976334 0.959459 0.988697 1.01998 1.05798 1.09369 1.12507 1.14992 1.16426 1.16338 1.14379 1.117 1.09764 1.08272 0.978641 0.762347 0.674495 0.658997 0.662073 0.669413 0.677093 0.685695 0.696116 0.708729 0.723592 0.736898 0.743045 0.743086 0.739485 0.733956 0.731834 0.735564 0.747301 0.762982 0.774969 0.778747 0.780798 116.459 2.87964 0.999862 0.984737 0.964809 0.991511 1.02241 1.06118 1.09464 1.12119 1.13914 1.14978 1.15198 1.13893 1.11817 1.10216 1.09253 0.990719 0.768886 0.676846 0.659342 0.661835 0.668158 0.675649 0.685301 0.698124 0.71411 0.730354 0.740957 0.744368 0.74381 0.739825 0.734439 0.732107 0.732977 0.740399 0.752382 0.764503 0.770279 0.772151 116.253 3.15101 1.00742 0.987378 0.96317 0.987647 1.02054 1.06216 1.0966 1.12146 1.13553 1.14136 1.14063 1.13142 1.11702 1.10551 1.10235 1.00167 0.773516 0.677718 0.659186 0.662185 0.669088 0.677647 0.689014 0.704461 0.721822 0.735228 0.741495 0.743309 0.742558 0.739603 0.735288 0.731074 0.728378 0.731267 0.740272 0.752747 0.760769 0.763014 115.989 3.4592 1.0125 0.985286 0.955679 0.97848 1.01503 1.06057 1.09839 1.12475 1.13732 1.13946 1.13445 1.12344 1.11144 1.10361 1.10761 1.00847 0.776008 0.677228 0.658316 0.662769 0.671877 0.68288 0.696984 0.713794 0.728471 0.736006 0.739065 0.739638 0.739441 0.737797 0.733456 0.726112 0.719043 0.717903 0.726283 0.739697 0.750856 0.75439 115.755 3.7221 1.0144 0.97988 0.944098 0.965591 1.00528 1.05589 1.09969 1.1304 1.14289 1.1428 1.13395 1.11705 1.10219 1.09519 1.10422 1.0101 0.776989 0.675907 0.657548 0.66358 0.675253 0.689962 0.706612 0.722266 0.731158 0.733782 0.734232 0.734426 0.73446 0.732828 0.726906 0.716322 0.706857 0.704243 0.712691 0.727005 0.741101 0.746458 115.554 3.92775 1.0141 0.972933 0.932175 0.953274 0.994731 1.05013 1.10016 1.13622 1.15131 1.15024 1.13773 1.11524 1.0943 1.07978 1.08996 1.00513 0.775781 0.674 0.657553 0.664779 0.67981 0.696913 0.713395 0.72567 0.72971 0.729883 0.729022 0.728505 0.72782 0.724633 0.716538 0.704909 0.695239 0.692465 0.700526 0.715179 0.731014 0.738274 115.384 4.06491 1.01191 0.966018 0.922834 0.943854 0.986871 1.04492 1.09917 1.1401 1.15908 1.15924 1.14527 1.11855 1.0912 1.06365 1.0652 0.990305 0.771798 0.671279 0.660394 0.667862 0.68386 0.699927 0.713634 0.722348 0.724753 0.724446 0.723792 0.722699 0.720305 0.714936 0.70593 0.694977 0.686002 0.683168 0.690009 0.703771 0.71993 0.728541 115.303 4.07661 1.00911 0.962326 0.919043 0.939934 0.98262 1.0414 1.0973 1.14095 1.16274 1.16553 1.15262 1.12337 1.09117 1.05429 1.03877 0.967265 0.763593 0.668416 0.665493 0.671101 0.685131 0.697986 0.707941 0.71464 0.718292 0.71901 0.718739 0.716972 0.712723 0.706019 0.697234 0.687544 0.679517 0.676685 0.680825 0.692472 0.707601 0.71748 115.314 4.01169 1.00812 0.9651 0.924062 0.94372 0.983918 1.04024 1.09522 1.13865 1.16168 1.16661 1.15622 1.12828 1.09254 1.05276 1.02171 0.942225 0.750661 0.664407 0.667203 0.673867 0.684244 0.692331 0.699179 0.705141 0.709977 0.713177 0.713879 0.711616 0.706338 0.699022 0.691028 0.682944 0.675938 0.672558 0.673173 0.681572 0.694198 0.705663 115.416 3.81762 1.00793 0.974027 0.936877 0.954056 0.990412 1.04203 1.09358 1.13384 1.15679 1.16326 1.15686 1.13303 1.09669 1.05657 1.0157 0.922628 0.734294 0.657621 0.663335 0.674931 0.681262 0.684839 0.689025 0.695014 0.701563 0.706044 0.707094 0.705678 0.700779 0.693917 0.68728 0.681017 0.674875 0.669959 0.66715 0.670959 0.680309 0.693272 115.627 3.53878 1.00751 0.985408 0.954804 0.969337 1.00126 1.04634 1.09173 1.12736 1.14893 1.15733 1.15706 1.13748 1.10367 1.06456 1.01474 0.910751 0.719713 0.6475 0.654626 0.672257 0.676029 0.676946 0.679247 0.6848 0.692322 0.698106 0.699549 0.697741 0.694397 0.690006 0.685528 0.680931 0.675149 0.668177 0.66192 0.660629 0.66775 0.681408 115.924 3.16874 1.00475 0.99509 0.9761 0.987916 1.01574 1.05269 1.0905 1.12081 1.13972 1.1498 1.1566 1.14177 1.1128 1.07397 1.01555 0.906257 0.711635 0.637602 0.64409 0.66468 0.668946 0.669169 0.670658 0.675242 0.681977 0.687565 0.689372 0.688281 0.686567 0.685314 0.684309 0.681348 0.67536 0.666294 0.656797 0.651895 0.65711 0.670269 116.318 2.69001 0.996275 1.00008 1.00051 1.00843 1.03104 1.05964 1.08997 1.11479 1.13148 1.14474 1.15697 1.14634 1.121 1.08123 1.01666 0.90725 0.711178 0.632829 0.636252 0.653531 0.659562 0.661067 0.662904 0.66668 0.671388 0.67502 0.676394 0.676512 0.677465 0.679715 0.681745 0.680597 0.67466 0.664119 0.652839 0.646282 0.648852 0.660967 116.836 2.08872 0.983013 0.99935 1.02096 1.02722 1.04436 1.06628 1.08969 1.11075 1.12773 1.14492 1.15879 1.15092 1.12561 1.08511 1.01801 0.911024 0.714352 0.632419 0.633961 0.644996 0.650081 0.652712 0.655402 0.658924 0.661601 0.66238 0.662155 0.662687 0.665978 0.67174 0.676452 0.677439 0.672679 0.662357 0.651168 0.643625 0.643386 0.65357 117.399 1.47763 0.967392 0.995977 1.02894 1.04222 1.05348 1.07171 1.08969 1.10933 1.12775 1.14816 1.16173 1.15434 1.12594 1.0868 1.02071 0.916846 0.719554 0.632965 0.632786 0.640178 0.644486 0.646471 0.648908 0.651708 0.652851 0.65117 0.648893 0.648895 0.652905 0.660688 0.668797 0.672103 0.669703 0.661397 0.651083 0.643119 0.640778 0.647352 117.797 1.0665 0.951792 0.983797 1.02315 1.04973 1.05786 1.07519 1.09132 1.11219 1.1337 1.15549 1.16629 1.15666 1.12339 1.08611 1.02393 0.922671 0.724709 0.634258 0.632748 0.637922 0.642233 0.643844 0.644693 0.645644 0.645203 0.642265 0.63859 0.637416 0.640244 0.647485 0.657161 0.663795 0.664712 0.660474 0.651698 0.643773 0.64 0.642562 117.749 1.15941 0.940439 0.962344 1.00205 1.04294 1.05852 1.07769 1.09612 1.12076 1.14589 1.16703 1.17098 1.15642 1.12093 1.08419 1.02743 0.927838 0.72902 0.635819 0.633567 0.637898 0.642166 0.642655 0.641895 0.640568 0.638363 0.635168 0.631678 0.629623 0.630084 0.634457 0.642611 0.651671 0.656969 0.657223 0.652227 0.64461 0.64 0.640888 117.584 1.38912 0.932494 0.937955 0.969693 1.02219 1.0551 1.07984 1.10484 1.13334 1.16131 1.18092 1.17808 1.1563 1.11964 1.08288 1.03214 0.933535 0.73291 0.636758 0.634034 0.639016 0.643782 0.64327 0.640037 0.636052 0.632664 0.629799 0.62711 0.624782 0.623652 0.624523 0.62894 0.637389 0.646579 0.650886 0.649895 0.644269 0.640265 0.642342 117.258 1.81666 0.923135 0.918488 0.933585 0.991622 1.04333 1.08102 1.11652 1.14976 1.17997 1.1979 1.18777 1.15722 1.12002 1.08239 1.03805 0.940267 0.737664 0.636859 0.633577 0.640168 0.645988 0.6449 0.639353 0.632804 0.628473 0.626036 0.624212 0.62208 0.620115 0.618865 0.619507 0.624212 0.632941 0.641122 0.643595 0.641752 0.640769 0.647457 116.894 2.31619 0.911294 0.902725 0.906691 0.960606 1.02405 1.07987 1.12824 1.16788 1.20065 1.21525 1.19851 1.16069 1.12152 1.08148 1.04341 0.947786 0.744552 0.636726 0.632176 0.640243 0.647661 0.647162 0.639899 0.631173 0.625933 0.623815 0.622822 0.621245 0.618942 0.616734 0.615495 0.615748 0.619415 0.626387 0.632589 0.635813 0.64043 0.654249 116.649 2.72554 0.904017 0.893635 0.888666 0.936439 1.00414 1.074 1.13417 1.18315 1.22197 1.23299 1.21004 1.16492 1.12287 1.08084 1.0481 0.95625 0.754315 0.637398 0.629792 0.638869 0.648338 0.649246 0.641344 0.631184 0.624999 0.622883 0.622537 0.621897 0.620283 0.617745 0.615119 0.612734 0.611395 0.612819 0.618458 0.628314 0.643577 0.663022 116.503 3.0323 0.902316 0.889171 0.878629 0.922251 0.989939 1.06571 1.13459 1.19437 1.24 1.24821 1.21973 1.16805 1.12152 1.0823 1.05326 0.966244 0.765944 0.639633 0.626817 0.636299 0.647864 0.650775 0.642996 0.63206 0.62522 0.623064 0.623372 0.62383 0.623457 0.621062 0.617142 0.612741 0.608489 0.606612 0.609728 0.622461 0.64489 0.669236 116.454 3.19718 0.904346 0.889849 0.876694 0.91765 0.983543 1.05911 1.13198 1.19794 1.24763 1.25503 1.22356 1.16833 1.11866 1.084 1.06025 0.978721 0.779248 0.64278 0.624248 0.633226 0.646489 0.651302 0.644692 0.633814 0.62651 0.624482 0.625641 0.627591 0.628571 0.626563 0.621478 0.614773 0.609279 0.607005 0.611949 0.626764 0.650847 0.674272 116.426 3.31511 0.911316 0.89761 0.883662 0.922961 0.984171 1.05576 1.12645 1.1927 1.24263 1.25121 1.21918 1.16438 1.1156 1.08728 1.07013 0.993554 0.794012 0.6465 0.622887 0.631032 0.645004 0.651539 0.647291 0.637133 0.629583 0.627781 0.629973 0.633732 0.636085 0.634502 0.628764 0.620542 0.614886 0.614627 0.624466 0.642371 0.664188 0.680957 116.401 3.41472 0.922352 0.910078 0.896106 0.933595 0.988244 1.05396 1.11953 1.18114 1.22503 1.23353 1.20564 1.15786 1.11427 1.09337 1.08316 1.00993 0.809558 0.651133 0.623474 0.630392 0.644386 0.652046 0.650217 0.642226 0.635235 0.633771 0.637022 0.642593 0.646205 0.645122 0.639471 0.631445 0.627479 0.63211 0.647007 0.668145 0.684661 0.692253 116.411 3.43 0.940855 0.926247 0.909124 0.942665 0.990956 1.05243 1.11318 1.16595 1.19903 1.20333 1.18288 1.14936 1.11636 1.10324 1.09779 1.02611 0.825782 0.657692 0.626757 0.631637 0.645111 0.654052 0.654832 0.649673 0.644159 0.643201 0.647482 0.654586 0.659432 0.659114 0.654641 0.649258 0.64907 0.660335 0.681347 0.702348 0.711068 0.708918 116.442 3.39747 0.964252 0.942209 0.919735 0.94752 0.989938 1.04872 1.10472 1.14794 1.16982 1.17 1.15729 1.14215 1.12166 1.11543 1.11181 1.04163 0.843135 0.666876 0.63377 0.635936 0.648077 0.658092 0.66162 0.659865 0.65702 0.657012 0.662154 0.670244 0.67618 0.677158 0.675456 0.674752 0.682024 0.700895 0.724459 0.740799 0.74186 0.732755 116.533 3.22946 0.984444 0.956413 0.926558 0.945662 0.984659 1.04033 1.09229 1.12664 1.14041 1.13925 1.13524 1.1369 1.12937 1.12803 1.1231 1.05646 0.862428 0.679041 0.645007 0.643959 0.653895 0.663853 0.669928 0.672399 0.673253 0.675537 0.681786 0.690238 0.69694 0.699953 0.702343 0.709596 0.726993 0.751029 0.770066 0.778007 0.774928 0.765996 116.549 3.09866 1.00394 0.968179 0.928883 0.93978 0.974322 1.02693 1.07555 1.10438 1.11487 1.117 1.1225 1.13504 1.13707 1.13767 1.12797 1.06805 0.882308 0.694798 0.660395 0.655634 0.662852 0.671219 0.678331 0.685314 0.692321 0.698887 0.706886 0.7155 0.722267 0.727663 0.736148 0.753078 0.777422 0.800121 0.811018 0.81203 0.808916 0.805459 116.357 3.08987 1.02078 0.974811 0.92884 0.935044 0.963245 1.00983 1.05501 1.08322 1.09674 1.10636 1.11885 1.13743 1.14455 1.14346 1.12818 1.07494 0.900445 0.712402 0.678995 0.670631 0.674743 0.680639 0.687141 0.697807 0.712224 0.726689 0.737742 0.745662 0.752019 0.760238 0.775748 0.798765 0.82293 0.838986 0.843185 0.842044 0.842031 0.84491 115.74 3.82825 1.03525 0.976828 0.927838 0.93024 0.952681 0.99135 1.03281 1.06561 1.08724 1.10597 1.12425 1.14453 1.15244 1.14479 1.12656 1.07862 0.915993 0.729829 0.696742 0.687954 0.689434 0.693078 0.69889 0.711207 0.731151 0.753878 0.771194 0.7795 0.785851 0.797004 0.815813 0.839288 0.858455 0.865776 0.866243 0.867181 0.871874 0.877795 115.15 4.49058 1.04389 0.975653 0.926342 0.925867 0.94267 0.973733 1.01182 1.0506 1.08475 1.11352 1.13688 1.15407 1.15673 1.14606 1.1249 1.08137 0.929104 0.743814 0.708349 0.703633 0.706739 0.710527 0.716412 0.729128 0.752414 0.780252 0.801588 0.812914 0.821419 0.833992 0.850889 0.869025 0.880657 0.88176 0.880341 0.884572 0.894017 0.900414 114.775 4.9471 1.04661 0.975179 0.92618 0.923096 0.933371 0.957124 0.992917 1.03851 1.08532 1.12593 1.15251 1.1621 1.15723 1.14736 1.12661 1.08558 0.939603 0.751685 0.71378 0.712184 0.719819 0.729834 0.739757 0.754546 0.775611 0.799711 0.822955 0.840622 0.853856 0.866022 0.877155 0.886023 0.889568 0.889313 0.888981 0.895002 0.906237 0.911403 114.568 5.22958 1.04461 0.978108 0.929197 0.923106 0.927274 0.944167 0.97828 1.03015 1.09032 1.14018 1.16735 1.16671 1.15598 1.14751 1.12959 1.09013 0.945574 0.754033 0.712378 0.714728 0.730972 0.750204 0.766053 0.779504 0.792942 0.809554 0.831426 0.856949 0.877805 0.88885 0.892037 0.892162 0.890016 0.889326 0.892225 0.901254 0.912854 0.916157 114.464 5.3574 1.04784 0.980568 0.931812 0.92355 0.924741 0.937864 0.968892 1.02414 1.09238 1.14854 1.17645 1.17036 1.15593 1.1469 1.13118 1.09355 0.950408 0.755521 0.709332 0.713371 0.735812 0.763452 0.784429 0.797426 0.807312 0.819992 0.839647 0.865675 0.890945 0.902542 0.902906 0.895902 0.888607 0.886589 0.890896 0.901195 0.913142 0.91565 0.805073 0.759015 0.648245 0.532417 0.513348 0.517536 0.526343 0.534012 0.537244 0.538412 0.538744 0.538822 0.538982 0.539889 0.542544 0.546902 0.55179 0.555759 0.558506 0.561004 0.568 0.584243 0.607174 0.630795 0.647289 0.655858 0.661867 0.667217 0.675103 0.670484 0.652511 0.588895 0.531461 0.526201 0.53436 0.542213 0.546435 0.546355 0.545861 0.547169 0.551274 0.557722 0.565295 0.573728 0.582995 0.592496 0.600147 0.604766 0.608839 0.61421 0.622694 0.633761 0.644224 0.649597 0.650309 0.648473 0.631852 0.589291 0.557727 0.545709 0.540514 0.546126 0.560203 0.583893 0.605829 0.620236 0.623554 0.617985 0.611801 0.60941 0.610822 0.614585 0.619093 0.62362 0.630575 0.644156 0.664587 0.689787 0.707379 0.697731 0.780381 0.736161 0.630786 0.532528 0.518767 0.522322 0.529507 0.535342 0.537801 0.538596 0.538835 0.539253 0.540552 0.543307 0.547322 0.551392 0.554907 0.558014 0.561296 0.566639 0.576879 0.594273 0.615823 0.634841 0.647634 0.656255 0.66495 0.669789 0.673268 0.66375 0.636856 0.570904 0.529151 0.528468 0.535379 0.542193 0.545628 0.546046 0.546753 0.549613 0.554759 0.561649 0.569791 0.578965 0.588186 0.596249 0.601667 0.605329 0.61029 0.616853 0.626809 0.638118 0.647391 0.650781 0.648935 0.641847 0.617889 0.57441 0.550147 0.54561 0.544723 0.551572 0.566597 0.583175 0.600432 0.611886 0.61603 0.61467 0.61183 0.610532 0.611752 0.615011 0.619756 0.625076 0.63222 0.64489 0.66214 0.680678 0.687115 0.675037 0.77826 0.736599 0.629256 0.534535 0.521642 0.523587 0.529071 0.533536 0.535339 0.536237 0.537355 0.539211 0.542655 0.547225 0.551283 0.554378 0.557328 0.561103 0.567074 0.57664 0.589582 0.605252 0.620984 0.6338 0.644811 0.653853 0.666452 0.676031 0.675476 0.667289 0.632593 0.559791 0.527546 0.529192 0.534431 0.5414 0.545544 0.547227 0.549403 0.552723 0.55793 0.565134 0.573963 0.583582 0.592141 0.598483 0.602615 0.60708 0.613035 0.620172 0.629655 0.640076 0.647518 0.650037 0.647556 0.636145 0.60421 0.562227 0.546612 0.548404 0.552906 0.561614 0.571568 0.580114 0.588102 0.598634 0.608105 0.615352 0.618081 0.616779 0.617654 0.619815 0.623982 0.629634 0.63672 0.64613 0.658727 0.671674 0.674571 0.660073 0.774214 0.734996 0.63111 0.536529 0.522721 0.523397 0.5279 0.530954 0.531452 0.532292 0.53511 0.539911 0.545369 0.550127 0.553809 0.556181 0.559789 0.566488 0.577645 0.591484 0.604305 0.615092 0.625135 0.634493 0.643791 0.655149 0.672496 0.684207 0.67953 0.670481 0.621778 0.547937 0.527635 0.528685 0.533354 0.540317 0.545493 0.548623 0.551775 0.556044 0.561948 0.569741 0.578841 0.588165 0.595456 0.600322 0.604514 0.609909 0.616864 0.624239 0.632381 0.639436 0.645798 0.647518 0.642693 0.624797 0.588937 0.55245 0.545928 0.552739 0.566977 0.577337 0.579442 0.578917 0.579887 0.587708 0.602265 0.61571 0.623547 0.62701 0.628357 0.631166 0.635006 0.639156 0.642969 0.648855 0.65854 0.66893 0.669738 0.654723 0.770448 0.734335 0.634451 0.53736 0.521645 0.521083 0.524466 0.527055 0.527517 0.528728 0.532349 0.539119 0.545926 0.550924 0.554089 0.557893 0.564119 0.575747 0.591663 0.607006 0.616866 0.62216 0.626698 0.634106 0.643918 0.658841 0.679632 0.69305 0.688132 0.673799 0.608252 0.539549 0.527274 0.527038 0.532448 0.540016 0.546195 0.55066 0.554634 0.559499 0.565868 0.574047 0.58304 0.591337 0.597594 0.602375 0.607826 0.613814 0.621312 0.627971 0.631847 0.635884 0.640131 0.642023 0.636496 0.617039 0.57907 0.547965 0.550546 0.568422 0.58714 0.593591 0.589831 0.583173 0.580736 0.584871 0.599568 0.621064 0.64016 0.652697 0.658117 0.662395 0.664899 0.666416 0.666052 0.665064 0.668897 0.675847 0.675504 0.658893 0.765637 0.732844 0.63835 0.537889 0.51809 0.516094 0.519382 0.522826 0.524432 0.52637 0.530657 0.536997 0.543975 0.549527 0.554715 0.561176 0.571842 0.587967 0.605959 0.619348 0.62588 0.629277 0.632044 0.637731 0.648029 0.665983 0.690076 0.702597 0.699925 0.672225 0.591382 0.53572 0.52721 0.527657 0.53389 0.541617 0.548419 0.554126 0.55897 0.5642 0.570658 0.578462 0.586468 0.593351 0.599179 0.605604 0.61441 0.622768 0.627973 0.631489 0.631375 0.631757 0.634896 0.638461 0.634125 0.614498 0.575873 0.555752 0.567991 0.587322 0.601093 0.604389 0.60067 0.592861 0.589054 0.591917 0.603095 0.625885 0.654687 0.676421 0.684833 0.685785 0.686764 0.687278 0.690459 0.697913 0.709324 0.7189 0.716475 0.696242 0.759601 0.729963 0.64096 0.536976 0.513006 0.510712 0.514702 0.519679 0.522793 0.525479 0.52935 0.534347 0.53992 0.547075 0.555902 0.567094 0.581929 0.599865 0.615979 0.627594 0.634751 0.638155 0.640703 0.645715 0.656115 0.675078 0.701003 0.713482 0.70965 0.664551 0.575669 0.53602 0.528691 0.530978 0.537646 0.545279 0.552375 0.559114 0.565045 0.570892 0.577206 0.58366 0.589695 0.595306 0.602034 0.612477 0.627706 0.640829 0.644565 0.638483 0.633364 0.631569 0.633431 0.638461 0.637692 0.618933 0.58543 0.576456 0.582473 0.594732 0.604982 0.610171 0.609755 0.604453 0.60033 0.601058 0.609281 0.627755 0.653645 0.679819 0.695565 0.699288 0.697074 0.696265 0.703504 0.720744 0.742503 0.756628 0.754335 0.731662 0.753167 0.725654 0.642867 0.536475 0.507727 0.505825 0.511096 0.517939 0.522416 0.525329 0.527757 0.530805 0.536409 0.545597 0.558668 0.57499 0.592668 0.60807 0.620208 0.632521 0.642812 0.648484 0.651688 0.656546 0.667475 0.686414 0.711847 0.724791 0.714526 0.650752 0.565049 0.53888 0.532523 0.536306 0.543308 0.550868 0.558471 0.566335 0.57374 0.580079 0.585022 0.589132 0.593319 0.599099 0.608844 0.624286 0.643213 0.660761 0.669317 0.664421 0.64951 0.641125 0.638876 0.642658 0.649281 0.636388 0.605201 0.589626 0.587755 0.592561 0.601566 0.609631 0.614356 0.614268 0.611892 0.612881 0.616553 0.625554 0.640848 0.664342 0.685072 0.696638 0.700025 0.702963 0.713037 0.731324 0.753973 0.767706 0.765439 0.739365 0.747093 0.719891 0.644063 0.536883 0.503058 0.501822 0.508787 0.517496 0.522788 0.52515 0.526606 0.529602 0.53633 0.547657 0.564022 0.583331 0.599487 0.609536 0.619877 0.631634 0.645041 0.657911 0.664685 0.669635 0.681362 0.700476 0.720841 0.733503 0.712881 0.634169 0.560116 0.543143 0.538918 0.543703 0.551113 0.55928 0.567776 0.576479 0.584128 0.589183 0.591919 0.594242 0.597974 0.605636 0.619066 0.637047 0.655119 0.670936 0.685652 0.697608 0.700029 0.691929 0.679724 0.673421 0.675862 0.651356 0.610874 0.595396 0.588457 0.588695 0.593911 0.602666 0.612206 0.619246 0.62031 0.620251 0.621948 0.624951 0.633425 0.645397 0.665052 0.685085 0.699919 0.707609 0.71846 0.734579 0.75532 0.766455 0.763257 0.734555 0.741065 0.712274 0.644533 0.538718 0.499773 0.499016 0.507467 0.517641 0.523422 0.525579 0.527399 0.531422 0.539699 0.553607 0.571882 0.589654 0.60028 0.608226 0.616561 0.628266 0.643831 0.660552 0.675255 0.684305 0.697067 0.714521 0.727283 0.736793 0.705748 0.619911 0.560875 0.548668 0.547421 0.553322 0.561673 0.570317 0.578878 0.586808 0.592623 0.595517 0.596971 0.599108 0.60426 0.614615 0.630275 0.647775 0.662774 0.676124 0.691952 0.713962 0.739118 0.749215 0.748911 0.732583 0.698844 0.65126 0.609794 0.596651 0.585412 0.582513 0.585131 0.592913 0.604922 0.617715 0.625601 0.626543 0.624516 0.622316 0.622263 0.62842 0.644762 0.670313 0.69381 0.710692 0.721123 0.730002 0.743434 0.748586 0.744143 0.712267 0.734229 0.703431 0.644876 0.542188 0.498244 0.497382 0.506432 0.517491 0.52414 0.527326 0.530714 0.536788 0.547639 0.563307 0.58015 0.593005 0.599877 0.605713 0.612958 0.624131 0.640401 0.660239 0.679105 0.695185 0.712432 0.724738 0.730387 0.735188 0.696368 0.612652 0.566614 0.556572 0.557209 0.564412 0.573664 0.582143 0.589157 0.594343 0.597561 0.599203 0.60082 0.604448 0.612206 0.624863 0.64053 0.655573 0.667702 0.679967 0.696093 0.72021 0.751722 0.771633 0.778095 0.765599 0.712777 0.643152 0.605037 0.593831 0.582489 0.57897 0.579947 0.585375 0.596561 0.612262 0.626253 0.630185 0.626318 0.621116 0.618391 0.620414 0.632817 0.655982 0.686365 0.709036 0.719373 0.725561 0.734357 0.735299 0.731134 0.698409 0.725946 0.696317 0.64553 0.547274 0.498315 0.496657 0.504956 0.516514 0.525379 0.531387 0.537251 0.546283 0.559419 0.574004 0.58668 0.593703 0.599406 0.605085 0.611724 0.621086 0.635627 0.656057 0.679411 0.701853 0.722491 0.730667 0.730759 0.726179 0.683568 0.610624 0.574533 0.567322 0.568026 0.575596 0.585039 0.592286 0.596478 0.59846 0.599633 0.601056 0.60426 0.610962 0.621551 0.635251 0.649082 0.660994 0.671081 0.682768 0.698305 0.721819 0.754719 0.779656 0.788679 0.771905 0.713292 0.632081 0.597622 0.589398 0.58189 0.579576 0.579648 0.582699 0.591195 0.605749 0.621518 0.629843 0.627349 0.622792 0.620571 0.622503 0.631138 0.648981 0.674472 0.699132 0.714087 0.722577 0.732894 0.733049 0.729138 0.695915 0.717155 0.691699 0.646978 0.553544 0.49978 0.496339 0.50321 0.515466 0.527742 0.537766 0.547296 0.559228 0.571717 0.582292 0.588878 0.594582 0.600751 0.607418 0.614427 0.62247 0.634021 0.652227 0.67708 0.703397 0.724886 0.732239 0.725004 0.709061 0.670073 0.611256 0.582326 0.579109 0.578809 0.585874 0.594188 0.599167 0.600272 0.599753 0.599739 0.602253 0.608695 0.618946 0.631546 0.644149 0.655089 0.664402 0.673556 0.684177 0.697281 0.716868 0.746483 0.775025 0.785005 0.770922 0.70912 0.622204 0.591413 0.58784 0.585792 0.584381 0.584112 0.58525 0.590592 0.599825 0.61287 0.624938 0.629523 0.628029 0.62767 0.630677 0.637353 0.650783 0.665425 0.682494 0.700124 0.714977 0.729882 0.733196 0.728083 0.693783 0.709022 0.689416 0.649349 0.560704 0.502162 0.495979 0.502122 0.515547 0.530949 0.5456 0.560364 0.572543 0.581037 0.58614 0.590889 0.597092 0.605209 0.613592 0.621167 0.628294 0.637074 0.651225 0.672321 0.696459 0.716374 0.721227 0.707867 0.687392 0.659012 0.612384 0.588657 0.587145 0.589658 0.594484 0.600026 0.60233 0.600773 0.5989 0.599922 0.605234 0.615244 0.628178 0.640955 0.650651 0.659071 0.66744 0.676526 0.685243 0.694281 0.707603 0.732517 0.762854 0.774416 0.763157 0.699353 0.612601 0.587724 0.587273 0.591061 0.593201 0.592908 0.591813 0.592971 0.596965 0.603618 0.615457 0.628703 0.637327 0.640285 0.64346 0.647729 0.652163 0.657309 0.667273 0.685293 0.706018 0.723964 0.730132 0.726609 0.690843 0.700885 0.689066 0.65189 0.567714 0.504778 0.496036 0.502427 0.517642 0.536289 0.556475 0.572701 0.582462 0.585931 0.589028 0.594323 0.60251 0.612572 0.62245 0.62997 0.636507 0.644425 0.655429 0.667616 0.683782 0.695816 0.695739 0.683676 0.668078 0.649119 0.608908 0.590038 0.590309 0.598781 0.601577 0.603013 0.601656 0.599524 0.599065 0.602087 0.610449 0.623291 0.637361 0.648519 0.65574 0.663152 0.671053 0.678951 0.685247 0.690507 0.700888 0.722711 0.751475 0.761608 0.751115 0.688468 0.606119 0.585673 0.587729 0.597018 0.603565 0.604684 0.601953 0.598377 0.596037 0.597853 0.607184 0.624222 0.641164 0.654327 0.657658 0.656502 0.653142 0.652587 0.659506 0.674788 0.695677 0.717106 0.727009 0.724173 0.684787 0.69198 0.690008 0.653846 0.574267 0.508043 0.497986 0.505366 0.523516 0.545691 0.566129 0.580635 0.586897 0.589339 0.593074 0.600013 0.610086 0.621495 0.631558 0.638901 0.645591 0.651118 0.659448 0.665062 0.670302 0.673621 0.671135 0.6651 0.65239 0.635687 0.598116 0.585696 0.58917 0.600665 0.60565 0.604596 0.600951 0.59931 0.601578 0.607761 0.618716 0.632651 0.645374 0.654347 0.661135 0.667605 0.67356 0.678942 0.683701 0.688749 0.69879 0.719373 0.745785 0.7524 0.742972 0.679437 0.60115 0.585419 0.589004 0.603344 0.615996 0.619176 0.613726 0.604859 0.598139 0.597184 0.604084 0.621245 0.644972 0.661722 0.666744 0.662444 0.656749 0.65539 0.661335 0.674405 0.693314 0.711868 0.718937 0.711642 0.668743 0.68386 0.690215 0.656653 0.58114 0.512572 0.503228 0.512928 0.53322 0.555191 0.572318 0.582856 0.588312 0.592741 0.59884 0.607578 0.61855 0.629747 0.638956 0.645894 0.650874 0.655302 0.658385 0.658959 0.657869 0.659442 0.659366 0.655148 0.643878 0.623209 0.583099 0.573109 0.583089 0.596778 0.603153 0.602586 0.601492 0.602591 0.607918 0.617599 0.629943 0.641825 0.651125 0.658666 0.664976 0.669878 0.672797 0.676159 0.68178 0.689352 0.70075 0.720873 0.744917 0.746806 0.736086 0.670828 0.598827 0.586867 0.591507 0.607222 0.622782 0.628631 0.624056 0.613008 0.604991 0.602679 0.608326 0.622638 0.641998 0.658485 0.665741 0.664908 0.663611 0.664304 0.670876 0.682246 0.697466 0.710532 0.713355 0.70262 0.655514 0.675389 0.686021 0.660133 0.589349 0.519494 0.51268 0.524179 0.543553 0.562317 0.574085 0.581835 0.589094 0.596936 0.605902 0.615926 0.62615 0.635139 0.64246 0.648388 0.652294 0.654005 0.652824 0.648967 0.647811 0.650035 0.650092 0.648084 0.639638 0.618807 0.572691 0.555309 0.566873 0.583974 0.595221 0.600916 0.604376 0.609662 0.618921 0.630992 0.641628 0.649295 0.655073 0.660758 0.664957 0.667317 0.669411 0.673203 0.680794 0.690658 0.70461 0.725201 0.743822 0.740777 0.726947 0.661898 0.59903 0.590504 0.594574 0.608876 0.622868 0.630677 0.630395 0.623057 0.616297 0.614342 0.618427 0.626557 0.636443 0.647569 0.658144 0.667212 0.673782 0.679619 0.686397 0.694236 0.704079 0.710579 0.708682 0.695452 0.647479 0.665601 0.678074 0.66251 0.599673 0.531953 0.526089 0.536382 0.552078 0.564784 0.573074 0.581196 0.590761 0.60188 0.613025 0.622931 0.630426 0.635999 0.641286 0.646423 0.649142 0.648448 0.644122 0.640044 0.639174 0.640738 0.645137 0.646082 0.640711 0.619674 0.57156 0.54555 0.547934 0.561818 0.579632 0.593797 0.605522 0.617061 0.631729 0.64501 0.652977 0.655695 0.657631 0.659761 0.661165 0.662533 0.665386 0.671068 0.680918 0.693246 0.70949 0.730917 0.741938 0.734308 0.716251 0.652172 0.600965 0.595332 0.598566 0.60889 0.62089 0.628145 0.633262 0.633024 0.631121 0.630994 0.631212 0.631373 0.630875 0.636369 0.648901 0.664465 0.680277 0.693556 0.701572 0.706287 0.712079 0.714505 0.712328 0.69894 0.647681 0.656562 0.669722 0.666042 0.612772 0.549326 0.539012 0.545436 0.556024 0.564764 0.572579 0.581702 0.593372 0.606591 0.618017 0.625677 0.62981 0.632546 0.635758 0.639467 0.640644 0.639717 0.63726 0.634332 0.631233 0.634307 0.642738 0.647745 0.645912 0.623852 0.5726 0.540562 0.535381 0.541537 0.560512 0.584828 0.606153 0.624814 0.641154 0.655349 0.663448 0.662804 0.660439 0.658275 0.657442 0.65855 0.662735 0.670239 0.681719 0.696558 0.714374 0.73364 0.738885 0.728007 0.706121 0.64313 0.60273 0.599884 0.602539 0.607745 0.614976 0.62313 0.633352 0.643071 0.648439 0.647769 0.642718 0.633211 0.628092 0.631029 0.643146 0.66414 0.686433 0.701573 0.709371 0.713491 0.720413 0.722368 0.721206 0.706115 0.65123 0.65056 0.664 0.670652 0.626283 0.563666 0.549753 0.549953 0.556646 0.56466 0.573013 0.5833 0.596058 0.608935 0.618583 0.622919 0.623653 0.623959 0.625578 0.627719 0.631361 0.634325 0.633295 0.629237 0.626135 0.63045 0.641431 0.651369 0.653785 0.628432 0.571919 0.536029 0.526617 0.530861 0.546418 0.572333 0.603548 0.627107 0.643534 0.657065 0.66595 0.668358 0.664518 0.658549 0.655801 0.656747 0.662111 0.671586 0.684518 0.700308 0.717371 0.732251 0.735231 0.72283 0.69852 0.636871 0.603988 0.602766 0.604992 0.606247 0.610982 0.62009 0.633761 0.651326 0.660877 0.659841 0.648969 0.637107 0.631399 0.634179 0.645247 0.665026 0.685918 0.700334 0.708125 0.715242 0.725847 0.72984 0.728238 0.709228 0.651071 0.64869 0.663375 0.677755 0.635763 0.571448 0.55725 0.553409 0.557768 0.56507 0.573823 0.584628 0.596725 0.607597 0.61293 0.613701 0.612803 0.611621 0.6123 0.617515 0.626061 0.631693 0.629133 0.62551 0.623388 0.628787 0.641116 0.655584 0.661437 0.63176 0.571949 0.533677 0.522754 0.528807 0.54511 0.569678 0.597935 0.620464 0.637219 0.649901 0.661701 0.670104 0.669172 0.662552 0.658068 0.659508 0.665654 0.676267 0.689081 0.703141 0.717357 0.72815 0.730274 0.719734 0.693564 0.634394 0.604385 0.602606 0.603976 0.60543 0.610751 0.620522 0.635928 0.654034 0.665112 0.664766 0.654791 0.644447 0.642046 0.645632 0.655217 0.668036 0.680262 0.69073 0.700381 0.711087 0.723827 0.728378 0.72621 0.703123 0.643251 0.65207 0.668842 0.683782 0.638333 0.571748 0.557682 0.553094 0.557926 0.5658 0.574215 0.584166 0.594113 0.599965 0.601374 0.600318 0.598508 0.59808 0.602509 0.612171 0.623143 0.626876 0.625651 0.622946 0.622634 0.629902 0.642953 0.658295 0.664687 0.633488 0.572284 0.533876 0.524451 0.532083 0.550948 0.574412 0.593435 0.609046 0.622297 0.635853 0.650643 0.664257 0.671738 0.669373 0.666388 0.667081 0.673136 0.683718 0.694523 0.705312 0.716025 0.723127 0.724119 0.717823 0.690979 0.634245 0.602649 0.599203 0.601926 0.607938 0.614944 0.624652 0.638482 0.651598 0.661047 0.663329 0.660385 0.657292 0.659686 0.664323 0.669842 0.674522 0.677357 0.681629 0.68947 0.704617 0.71857 0.720811 0.712376 0.680644 0.624487 0.659873 0.679267 0.685387 0.634231 0.566285 0.552769 0.550715 0.556862 0.56509 0.573567 0.581155 0.585999 0.587313 0.5869 0.585967 0.585992 0.589415 0.597712 0.609184 0.618561 0.621771 0.622355 0.62177 0.624076 0.632542 0.646612 0.658279 0.661895 0.632064 0.572888 0.536442 0.530942 0.540647 0.560606 0.580343 0.594432 0.602354 0.608523 0.617268 0.63068 0.647768 0.663642 0.675239 0.679647 0.681274 0.685464 0.692898 0.699659 0.706946 0.714028 0.719723 0.719331 0.715178 0.688956 0.635425 0.599837 0.594097 0.598678 0.609834 0.621446 0.631549 0.639863 0.644443 0.650532 0.658255 0.666851 0.674791 0.681449 0.686719 0.685854 0.682294 0.678563 0.677212 0.681693 0.691419 0.697779 0.692504 0.67605 0.645704 0.598519 0.671606 0.690114 0.682834 0.623537 0.555431 0.544858 0.546707 0.555072 0.563784 0.570212 0.57364 0.574554 0.574753 0.574824 0.575627 0.578886 0.585843 0.595922 0.606429 0.612637 0.616359 0.619202 0.621893 0.62715 0.636551 0.649521 0.655267 0.65372 0.629009 0.574714 0.541867 0.541396 0.552724 0.569463 0.583708 0.591965 0.597395 0.600922 0.604616 0.610856 0.6243 0.646286 0.668547 0.686785 0.700699 0.703162 0.704426 0.70638 0.70944 0.712959 0.717687 0.717261 0.711156 0.68515 0.635583 0.598069 0.590466 0.59622 0.611615 0.628173 0.636804 0.636686 0.636597 0.641746 0.655033 0.674228 0.693007 0.702758 0.704134 0.700543 0.693402 0.684959 0.678858 0.676975 0.675383 0.671162 0.662281 0.650787 0.628656 0.584035 0.681831 0.69625 0.67602 0.609553 0.542207 0.535426 0.542777 0.552245 0.560178 0.564067 0.56487 0.565011 0.565252 0.566484 0.570057 0.576726 0.585584 0.594866 0.602146 0.606582 0.611089 0.616556 0.623143 0.631181 0.640557 0.64892 0.648659 0.644444 0.626327 0.57852 0.551254 0.553422 0.563174 0.573971 0.582054 0.589675 0.595907 0.59841 0.598729 0.600306 0.605379 0.621093 0.652608 0.684929 0.707678 0.71933 0.718299 0.715504 0.712817 0.713676 0.716641 0.716274 0.706382 0.680589 0.635918 0.598585 0.590391 0.597073 0.614392 0.631955 0.636685 0.634314 0.632958 0.640486 0.658421 0.684895 0.707566 0.717485 0.717187 0.709854 0.698063 0.687331 0.678786 0.669099 0.661585 0.659014 0.653236 0.644288 0.623344 0.579619 0.686679 0.694062 0.666109 0.594413 0.530448 0.526919 0.537303 0.54822 0.555558 0.5583 0.558532 0.558319 0.559127 0.562343 0.568876 0.577484 0.586462 0.593461 0.597589 0.601025 0.606764 0.615208 0.625185 0.63452 0.64201 0.644253 0.642212 0.638134 0.626231 0.585997 0.5636 0.562992 0.568003 0.572574 0.578919 0.586659 0.594623 0.598605 0.597541 0.59672 0.599033 0.608682 0.631086 0.67144 0.705073 0.72209 0.724564 0.722475 0.717186 0.715306 0.71693 0.715003 0.701719 0.676691 0.638015 0.602121 0.595455 0.603129 0.61859 0.629796 0.634045 0.633718 0.636144 0.646601 0.6668 0.692678 0.713859 0.723152 0.721091 0.711382 0.699496 0.686702 0.670511 0.657167 0.653423 0.6556 0.653327 0.646901 0.625342 0.582108 0.686374 0.685661 0.657025 0.580977 0.523393 0.521448 0.53326 0.546359 0.554027 0.555384 0.554596 0.554566 0.556386 0.561611 0.569934 0.579451 0.587746 0.592236 0.594302 0.597251 0.604426 0.615181 0.627044 0.636004 0.641105 0.639188 0.638204 0.636857 0.630471 0.596929 0.571397 0.568684 0.567866 0.570509 0.57578 0.583514 0.592116 0.598398 0.59902 0.598572 0.600879 0.608967 0.624909 0.651837 0.688908 0.712916 0.722314 0.7261 0.722006 0.718654 0.717546 0.712902 0.699688 0.678228 0.645609 0.61127 0.605185 0.611649 0.619674 0.625818 0.631263 0.63719 0.646444 0.659995 0.678313 0.696189 0.709639 0.715031 0.716191 0.710018 0.694792 0.674145 0.656886 0.649646 0.652169 0.659163 0.65995 0.654719 0.63089 0.587922 0.686146 0.676056 0.647885 0.5686 0.51881 0.518233 0.531818 0.547114 0.554369 0.554489 0.55333 0.553288 0.555705 0.56219 0.57172 0.581802 0.588968 0.591683 0.592845 0.596029 0.60414 0.615876 0.627382 0.634085 0.637183 0.636558 0.638491 0.642084 0.640344 0.604882 0.574152 0.569621 0.566492 0.56858 0.573855 0.580881 0.588485 0.595552 0.600606 0.60432 0.608641 0.615969 0.628861 0.644734 0.663196 0.689541 0.709405 0.719286 0.722054 0.720648 0.716481 0.710835 0.700889 0.687383 0.661788 0.629085 0.618812 0.620632 0.620353 0.624476 0.632432 0.644888 0.659928 0.675074 0.685677 0.69268 0.696388 0.700614 0.700973 0.692439 0.676579 0.660938 0.652347 0.651391 0.657143 0.666741 0.669509 0.662406 0.634882 0.592836 0.691635 0.6742 0.641239 0.558086 0.514851 0.516255 0.531195 0.547687 0.556053 0.556456 0.555143 0.554927 0.557794 0.564374 0.573734 0.583157 0.589082 0.591437 0.593175 0.597211 0.605539 0.616364 0.624716 0.628707 0.632406 0.637471 0.643796 0.654178 0.65039 0.608271 0.572344 0.566295 0.564184 0.56807 0.573816 0.579253 0.584695 0.591559 0.600686 0.611378 0.620918 0.629287 0.636418 0.643266 0.650479 0.661307 0.68531 0.705718 0.715218 0.716322 0.712093 0.707595 0.702982 0.69817 0.680736 0.650116 0.635635 0.629894 0.625477 0.628791 0.638356 0.653617 0.671259 0.682893 0.684412 0.680121 0.67619 0.672985 0.669953 0.666923 0.663472 0.659923 0.656901 0.659448 0.667491 0.674809 0.675019 0.665419 0.634237 0.593615 0.704733 0.681691 0.640073 0.550888 0.512134 0.515212 0.530031 0.547186 0.55811 0.56141 0.560415 0.559961 0.562659 0.568721 0.577074 0.584761 0.58929 0.59157 0.594267 0.599595 0.607435 0.615609 0.619681 0.622751 0.630891 0.64276 0.654124 0.666455 0.655047 0.606364 0.565707 0.56029 0.563294 0.569403 0.574664 0.578087 0.581324 0.588044 0.600346 0.616654 0.633756 0.644956 0.649226 0.647804 0.644523 0.647442 0.656858 0.680912 0.698339 0.704399 0.70326 0.70296 0.703291 0.703216 0.690025 0.658835 0.640337 0.632872 0.631222 0.63688 0.64653 0.661925 0.675368 0.678255 0.671696 0.663087 0.653885 0.651353 0.653024 0.656812 0.661687 0.665121 0.66746 0.671268 0.677297 0.678607 0.674112 0.661039 0.625113 0.587031 0.723623 0.698615 0.642627 0.547226 0.512286 0.516083 0.529011 0.545653 0.558448 0.565239 0.568129 0.569186 0.571142 0.575668 0.581523 0.586763 0.589977 0.592638 0.596861 0.602906 0.608287 0.612542 0.61501 0.619927 0.632638 0.651095 0.667169 0.674929 0.653972 0.600154 0.556479 0.554963 0.564417 0.57166 0.57562 0.576848 0.578665 0.585753 0.60029 0.620848 0.641722 0.656327 0.659204 0.654211 0.644555 0.641734 0.643105 0.65169 0.672185 0.686553 0.692407 0.697433 0.701778 0.706173 0.693067 0.655849 0.633183 0.626888 0.62976 0.638425 0.653155 0.666509 0.670096 0.664195 0.653948 0.646374 0.644579 0.646166 0.650358 0.655732 0.663381 0.671914 0.677546 0.680652 0.682194 0.676357 0.665835 0.64763 0.611435 0.576737 0.75177 0.721197 0.649221 0.548172 0.517262 0.520932 0.530789 0.544279 0.556157 0.565856 0.573697 0.580332 0.583733 0.586486 0.589245 0.591188 0.592659 0.595525 0.599824 0.604067 0.606312 0.607957 0.612534 0.621712 0.640673 0.665759 0.680289 0.679086 0.65087 0.594123 0.549265 0.55089 0.563902 0.573623 0.576124 0.575886 0.577098 0.5851 0.601057 0.623224 0.643708 0.655516 0.658274 0.655665 0.64906 0.641066 0.636063 0.632754 0.643126 0.66402 0.680353 0.692585 0.699659 0.69785 0.678808 0.63936 0.616926 0.613613 0.622785 0.639511 0.655204 0.661533 0.658192 0.649951 0.644575 0.642648 0.644254 0.646202 0.650345 0.657263 0.66592 0.674435 0.680427 0.682123 0.678087 0.668454 0.656506 0.638534 0.602515 0.571908 0.78748 0.748375 0.658691 0.555056 0.529222 0.530874 0.538372 0.547164 0.554612 0.563475 0.575239 0.587515 0.597652 0.601189 0.600374 0.599213 0.598502 0.599501 0.601316 0.602427 0.60299 0.605136 0.613334 0.63107 0.658339 0.683145 0.692527 0.680616 0.650335 0.591803 0.545674 0.546653 0.560348 0.572811 0.576091 0.57557 0.576965 0.585971 0.602401 0.623632 0.641207 0.649388 0.651204 0.649986 0.645308 0.639076 0.6297 0.622312 0.625098 0.639721 0.663531 0.682889 0.691162 0.678438 0.647729 0.604857 0.58618 0.586192 0.599663 0.62299 0.640202 0.645774 0.644365 0.643779 0.645333 0.64697 0.646508 0.647799 0.651963 0.658558 0.664715 0.670788 0.674291 0.673201 0.669733 0.664308 0.655271 0.6364 0.600821 0.574521 0.825218 0.77773 0.669348 0.567026 0.545895 0.545349 0.550893 0.555345 0.557253 0.561569 0.572362 0.589828 0.605795 0.615398 0.615329 0.610002 0.605299 0.602521 0.600666 0.599911 0.602024 0.608202 0.622865 0.649565 0.676328 0.696264 0.699795 0.685588 0.657138 0.596057 0.545654 0.543919 0.555724 0.569284 0.575934 0.576424 0.579156 0.587896 0.603545 0.62115 0.633418 0.637904 0.638454 0.638222 0.635765 0.630459 0.623212 0.61702 0.615777 0.624052 0.644514 0.668163 0.677246 0.661138 0.624055 0.58166 0.559903 0.562066 0.578746 0.597855 0.613381 0.623976 0.633533 0.642584 0.652034 0.656212 0.655712 0.654695 0.655027 0.656986 0.659566 0.661254 0.662497 0.664663 0.664564 0.661465 0.655559 0.638621 0.604585 0.582392 0.858833 0.804191 0.679395 0.58188 0.563577 0.561584 0.565245 0.566913 0.56558 0.564702 0.570455 0.585602 0.606931 0.62192 0.62622 0.621917 0.614195 0.606245 0.601717 0.601972 0.607546 0.62173 0.644205 0.666654 0.683299 0.700402 0.704434 0.695058 0.673037 0.610688 0.552203 0.545641 0.553609 0.56554 0.57554 0.580426 0.584289 0.592328 0.604218 0.615734 0.621342 0.621844 0.620803 0.618491 0.617765 0.618438 0.618043 0.614857 0.61277 0.617467 0.631387 0.653755 0.663623 0.65129 0.614603 0.575614 0.556975 0.562406 0.576072 0.588426 0.597175 0.607733 0.624617 0.641729 0.653461 0.659881 0.662466 0.661932 0.659406 0.656204 0.65389 0.653141 0.654766 0.659974 0.664948 0.669597 0.668216 0.651537 0.620254 0.603045 0.883273 0.823128 0.687891 0.596954 0.579997 0.576326 0.577795 0.577603 0.575642 0.573771 0.574784 0.581928 0.598068 0.616554 0.626523 0.627673 0.622905 0.614655 0.610258 0.61369 0.625221 0.64374 0.661525 0.674417 0.682347 0.696816 0.707514 0.70673 0.692974 0.634932 0.566768 0.55424 0.556858 0.565934 0.577449 0.587608 0.593003 0.598597 0.60428 0.607498 0.607138 0.603726 0.600106 0.598487 0.602054 0.61003 0.615422 0.615521 0.614225 0.616578 0.627254 0.640814 0.650553 0.642311 0.613409 0.579613 0.565173 0.570744 0.581348 0.588848 0.593623 0.600334 0.612355 0.629762 0.643153 0.65254 0.659615 0.662109 0.661171 0.658938 0.655055 0.655437 0.662012 0.670181 0.682099 0.690052 0.685276 0.661846 0.628163 0.612596 0.894809 0.832335 0.694112 0.609708 0.592923 0.586982 0.585848 0.584431 0.583042 0.582553 0.58287 0.585388 0.590112 0.599577 0.612698 0.621784 0.625937 0.628284 0.629743 0.637848 0.651806 0.662655 0.670831 0.676456 0.679884 0.691331 0.711711 0.718291 0.711502 0.658418 0.583398 0.565464 0.565385 0.573333 0.584792 0.594487 0.601469 0.603825 0.601781 0.597447 0.591298 0.58593 0.585479 0.589361 0.596904 0.605928 0.613902 0.61829 0.618512 0.619043 0.625426 0.630497 0.6346 0.634918 0.619991 0.592207 0.579293 0.581179 0.587102 0.589887 0.593509 0.598251 0.602934 0.608691 0.61882 0.630914 0.642563 0.6541 0.662452 0.665871 0.670766 0.676671 0.68823 0.701796 0.7085 0.705941 0.691415 0.660578 0.623933 0.609725 0.897862 0.834711 0.697152 0.617931 0.601013 0.592149 0.588454 0.586593 0.58641 0.588753 0.590453 0.589787 0.587898 0.586298 0.590635 0.604531 0.62037 0.635649 0.655093 0.669385 0.675983 0.67714 0.674623 0.67239 0.674615 0.687375 0.71427 0.727601 0.726327 0.674358 0.595682 0.573268 0.571848 0.583258 0.596944 0.609278 0.613284 0.610002 0.598289 0.585252 0.57598 0.573756 0.578672 0.587545 0.596084 0.603963 0.61225 0.620543 0.624794 0.624331 0.622936 0.619464 0.620084 0.62735 0.624002 0.606235 0.592268 0.590063 0.591135 0.593906 0.595349 0.595144 0.593132 0.59165 0.594172 0.604209 0.62073 0.637351 0.65185 0.669121 0.689255 0.710879 0.722883 0.726522 0.722925 0.711037 0.690258 0.657227 0.619584 0.605448 0.896134 0.833403 0.697524 0.621644 0.605207 0.594308 0.588788 0.586335 0.586827 0.590958 0.595268 0.594035 0.586798 0.579128 0.576999 0.58466 0.608601 0.646125 0.676798 0.694318 0.695092 0.687729 0.677154 0.670083 0.671419 0.684254 0.712567 0.732503 0.736897 0.687707 0.607537 0.582206 0.579128 0.591562 0.606172 0.620912 0.623961 0.616008 0.595866 0.574425 0.563749 0.565761 0.574504 0.586879 0.59614 0.603032 0.610834 0.62139 0.629245 0.630174 0.622361 0.612497 0.610276 0.619637 0.626129 0.615542 0.601438 0.59798 0.594918 0.597355 0.59829 0.593943 0.586293 0.580402 0.579624 0.583052 0.592773 0.613977 0.646904 0.685472 0.721742 0.747055 0.756574 0.753556 0.741259 0.71649 0.687385 0.649773 0.610741 0.597123 ) ; boundaryField { inlet { type calculated; value uniform 0.140001; } outlet { type calculated; value nonuniform List<scalar> 40 ( 0.697731 0.675037 0.660073 0.654723 0.658893 0.696242 0.731662 0.739365 0.734555 0.712267 0.698409 0.695915 0.693783 0.690843 0.684787 0.668743 0.655514 0.647479 0.647681 0.65123 0.651071 0.643251 0.624487 0.598519 0.584035 0.579619 0.582108 0.587922 0.592836 0.593615 0.587031 0.576737 0.571908 0.574521 0.582392 0.603045 0.612596 0.609725 0.605448 0.597123 ) ; } bottom { type symmetryPlane; } top { type symmetryPlane; } obstacle { type calculated; value nonuniform List<scalar> 80 ( 0.805073 0.759015 0.648245 0.532417 0.513348 0.517536 0.526343 0.534012 0.537244 0.538412 0.538744 0.538822 0.538982 0.539889 0.542544 0.546902 0.55179 0.555759 0.558506 0.561004 0.568 0.584243 0.607174 0.630795 0.647289 0.655858 0.661867 0.667217 0.675103 0.670484 0.652511 0.588895 0.531461 0.526201 0.53436 0.542213 0.546435 0.546355 0.545861 0.547169 0.551274 0.557722 0.565295 0.573728 0.582995 0.592496 0.600147 0.604766 0.608839 0.61421 0.622694 0.633761 0.644224 0.649597 0.650309 0.648473 0.631852 0.589291 0.557727 0.545709 0.540514 0.546126 0.560203 0.583893 0.605829 0.620236 0.623554 0.617985 0.611801 0.60941 0.610822 0.614585 0.619093 0.62362 0.630575 0.644156 0.664587 0.689787 0.707379 0.697731 ) ; } defaultFaces { type empty; } } // ************************************************************************* //
0b86a8d8968b96df6a23ecb21672b4a39f00b61c
01bbb800b4966bbeb8b5878af547527aea009e88
/SmartViewConnector/Bup/RegOperator.cpp
2b0d76bd092d6baeb587e36b66ab73e28e371657
[]
no_license
yuxrone/SmartViewConnector
8e122fe32960908e89a2fdeab68c73c6f89442dd
d0218ad6946cac8aa5407b6ad8f37796c1f53a02
refs/heads/master
2020-09-11T11:05:17.340599
2017-11-02T20:45:10
2017-11-02T20:45:10
94,454,407
0
0
null
null
null
null
UTF-8
C++
false
false
4,681
cpp
RegOperator.cpp
/** * Author: Rajib Chandra Das * Topic: Windows Registry Key Processor(Create, Insert, Read, Update and Delete) * Date: 8_July_2015 */ //Create C++ Win32 Project in Visual Studio //Project -> "project" Properties->Configuration Properties->C/C++->Advanced->Show Includes : YES(/ showIncludes) //Project -> "project" Properties->Configuration Properties->General->Project Defaults->Use of MFC : Use MFC in a shared DLL #include <iostream> //#include <afx.h> #include "stdafx.h" #include "RegOperator.h" using namespace std; namespace RegOperate { RegOperator::RegOperator() : mKeyPath(kDefaultKeyPath) , mSubKey(kSubKey) { } RegOperator::RegOperator(HKEY hKey) { // ASSERT(hKey != NULL); mKeyPath = hKey; } RegOperator::RegOperator(HKEY hKey, wstring szSubKey) { // ASSERT(hKey != NULL && !szSubKey.empty()); mKeyPath = hKey; mSubKey = szSubKey; } RegOperator::~RegOperator() { RegCloseKey(mKeyPath); mKeyPath = 0; } RegOperator * RegOperator::CreateKey(HKEY hBaseKey, wstring szSubKey) { // ASSERT(hBaseKey != NULL && !szSubKey.empty()); HKEY hKey; if (RegCreateKeyEx(hBaseKey, szSubKey.c_str(), 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hKey, NULL) != ERROR_SUCCESS) { return NULL; } return new RegOperator(hKey); } RegOperator * RegOperator::OpenKey(HKEY hBaseKey, wstring szSubKey) { // ASSERT(hBaseKey != NULL && !szSubKey.empty()); HKEY hKey; if (RegOpenKeyEx(hBaseKey, szSubKey.c_str(), 0, KEY_READ, &hKey) != ERROR_SUCCESS) { return NULL; } return new RegOperator(hKey); } RegOperator * RegOperator::OpenKey() { // ASSERT(mKeyPath != NULL && !mSubKey.empty()); HKEY hKey; if (RegOpenKeyEx(mKeyPath, mSubKey.c_str(), 0, KEY_READ, &hKey) != ERROR_SUCCESS) { return NULL; } return new RegOperator(hKey); } BOOL RegOperator::CloseKey() { RegCloseKey(mKeyPath); return TRUE; } BOOL RegOperator::GetValue(wstring szName, wstring & szResult) const { DWORD dwType; DWORD dwSize; if (RegQueryValueEx(mKeyPath, szName.c_str(), NULL, &dwType, NULL, &dwSize) != ERROR_SUCCESS) { return FALSE; } if (dwType != REG_SZ && dwType != REG_EXPAND_SZ && dwType != REG_MULTI_SZ) { return FALSE; } LPWSTR szBuffer = (LPWSTR)malloc(dwSize); if (RegQueryValueEx(mKeyPath, szName.c_str(), NULL, &dwType, (LPBYTE)szBuffer, &dwSize) == ERROR_SUCCESS) { szResult = szBuffer; } free(szBuffer); return TRUE; } BOOL RegOperator::SetValue(wstring szName, wstring szValue) { DWORD dwType = szValue.find(L'\n') == wstring::npos ? REG_SZ : REG_MULTI_SZ; return RegSetValueEx(mKeyPath, szName.c_str(), 0, dwType, (LPBYTE)szValue.c_str(), sizeof(WCHAR) * (szValue.size() + 1)) == ERROR_SUCCESS; } BOOL RegOperator::GetValue(wstring szName, DWORD & dwResult) const { DWORD dwType; DWORD dwSize; dwSize = 4; return RegQueryValueEx(mKeyPath, szName.c_str(), NULL, &dwType, (LPBYTE)&dwResult, &dwSize) == ERROR_SUCCESS && dwType == REG_DWORD; } BOOL RegOperator::SetValue(wstring szName, DWORD dwValue) { return RegSetValueEx(mKeyPath, szName.c_str(), 0, REG_DWORD, (LPBYTE)&dwValue, sizeof(DWORD)) == ERROR_SUCCESS; } BOOL RegOperator::GetValue(wstring szName, BOOL & fResult) const { DWORD dwTmp; if (GetValue(szName, dwTmp)) { fResult = dwTmp != 0; return TRUE; } return FALSE; } BOOL RegOperator::SetValue(wstring szName, BOOL fResult) { return SetValue(szName, (DWORD)(fResult ? 1 : 0)); } BOOL RegOperator::GetSubKeys(TStringVector & vKeys) const { DWORD dwLength = 0; LONG lStatus = RegQueryInfoKey( mKeyPath, NULL, NULL, NULL, NULL, &dwLength, NULL, NULL, NULL, NULL, NULL, NULL ); if (lStatus != ERROR_SUCCESS) { return FALSE; } LPWSTR szBuffer = (LPWSTR)malloc((dwLength + 1) * sizeof(WCHAR)); DWORD dwIndex = 0; BOOL fSuccess = FALSE; vKeys.clear(); for (;;) { lStatus = RegEnumKey(mKeyPath, dwIndex, szBuffer, dwLength + 1); switch (lStatus) { case ERROR_SUCCESS: vKeys.push_back(szBuffer); break; case ERROR_NO_MORE_ITEMS: fSuccess = TRUE; // Fall through default: goto __end; } dwIndex++; } __end: free(szBuffer); return fSuccess; } BOOL RegOperator::DeleteValue(wstring szName) { // ASSERT(!szName.empty()); return RegDeleteValue(mKeyPath, szName.c_str()) == ERROR_SUCCESS; } BOOL RegOperator::DeleteKey(wstring szName) { // ASSERT(!szName.empty()); int lReturn = RegDeleteKey(mKeyPath, szName.c_str()); return lReturn; } void RegOperator::setKeyPath(const HKEY& keyPath) { mKeyPath = keyPath; } const HKEY& RegOperator::getKeyPath() const { return mKeyPath; } }
dde28fa238b6130d6832e9141c0fc779c92b42e9
0412ff2682f1f4d595600948d05dc0d00786b173
/mfcc/termPro_demo.cpp
85ea5de2c43fe96d42400cf112cfd7e1fa87cf2b
[ "MIT" ]
permissive
ShushanChen/cuda-mfcc-gmm
4e8265fc854ae02d41b8f23ee7339652212f9465
fbcb545dcbe59850eedc7b7b066387abd4864cea
refs/heads/master
2020-06-04T14:46:03.775454
2015-04-23T12:26:14
2015-04-23T12:26:14
34,454,999
3
0
null
2015-04-23T12:30:48
2015-04-23T12:30:48
null
UTF-8
C++
false
false
3,850
cpp
termPro_demo.cpp
#include "resource.h" #include "srs.h" #include <cstdio> #include <iostream> #include <fstream> #include "FeatureExtractor.h" #include <unistd.h> #include <cstring> using namespace std; int threadNum = DEFAULT_THREAD_NUM; bool isCapture; char wavFileName[1024] = "\0"; void reportMatlab(FeatureExtractor &extractor); bool dealOpts(int argc, char **argv); //FEATURE_DATA maxEmpData[MAX_BUFFER_SIZE]; int main(int argc, char **argv) { if(! dealOpts(argc, argv)) return 0; //cudaDeviceSynchronize(); FeatureExtractor extractor(threadNum); RawData data; // capture mode if(isCapture) capture(wavFileName, data, false); else load_wav_file(wavFileName, data); extractor.exFeatures(&data); reportMatlab(extractor); return 0; } bool dealOpts(int argc, char **argv) { int c; while((c = getopt(argc, argv, "c:C:l:L:hj:J")) != -1) { switch(c) { case 'h': printf("usage: \n \ filename example: abc\n \ Capture Mode: ./pro2_demo -c filename\n \ Load Mode: ./pro2_demo -l filename\n"); return false; break; case 'c': case 'C': isCapture = true; strcpy(wavFileName, optarg); break; case 'l': case 'L': isCapture = false; strcpy(wavFileName, optarg); break; case 'j': case 'J': threadNum = atoi(optarg); default: break; } } if(wavFileName[0] == '\0') return false; return true; } template <class T> void storeVector(const vector<T> &data, const char *filename) { ofstream out(filename); for(int i = 0;i < data.size(); i++) out << data[i] << endl; out.close(); } void storeBareVector(const FEATURE_DATA *data, int size, const char *filename){ ofstream out(filename); for(int i=0; i<size; i++) out << data[i] << endl; out.close(); } void storeBareMatrix(FEATURE_DATA **data, int size1, int size2, const char *filename){ ofstream out(filename); for(int i=0; i<size1; i++){ for(int j=0; j<size2; j++){ out << data[i][j] << " "; } out << endl; } out.close(); } template <class T> void storeMatrix(const Matrix<T> &data, const char *filename) { ofstream out(filename); /* if(data.size()) out << data[0].size() << endl; */ for(int i = 0;i < data.size(); i++) { int M = data[i].size(); for(int j = 0;j < M;j++) out << data[i][j] << " "; out << endl; } out.close(); } void storeFeas(const std::vector<Feature> & data, const char *filename) { ofstream out(filename); /* if(data.size()) out << data[0].size() << endl; */ for(int i = 0;i < data.size(); i++) { int M = data[i].size(); for(int j = 0;j < M;j++) out << data[i][j] << " "; out << endl; } out.close(); } void reportMatlab(FeatureExtractor &extractor) { const vector<double> &empData = extractor.getEmpData(); storeVector(empData, "emp.txt"); const Matrix<double> &windows = extractor.getWindows(); storeMatrix(windows, "windows.txt"); const Matrix<double> &powSpec = extractor.getPowSpectrum(); storeMatrix(powSpec, "powSpec.txt"); const Matrix<double> &melLog = extractor.getMelLogSpec(); storeMatrix(melLog, "melLogSpec.txt"); const vector<Feature> & featrues = extractor.getMelCepstrum(); storeFeas(featrues, "melCeps.txt"); const vector<Feature> & normals = extractor.getNormalMelCepstrum(); storeFeas(normals , "normalMelCeps.txt"); }
663242151b6c4b33f32c0978f4dc458492b4749e
78c97e020247c43a3af53bfb2ce7d8f1fb0e615c
/Trees/Problem-4.cpp
3572ff71fcc475e2b103f8b203d65ee9b3f5f619
[]
no_license
G1Joshi/DataStructuresAndAlgorithmsMadeEasy
b9f3dfa6ac36492ef22fe176acbe3e6301e0f301
230697a9a2b60195440f768c97e026eab6d5f732
refs/heads/main
2023-07-30T00:24:17.090458
2021-07-04T15:10:52
2021-07-04T15:10:52
317,386,480
3
0
null
null
null
null
UTF-8
C++
false
false
860
cpp
Problem-4.cpp
#include <bits/stdc++.h> using namespace std; struct Node { int data; struct Node *left; struct Node *right; Node(int data = 0) { this->data = data; left = right = NULL; } }; int search(Node *root, int key) { queue<Node *> q; q.push(root); while (!q.empty()) { Node *temp = q.front(); q.pop(); if (temp->data == key) return 1; if (temp->left) q.push(temp->left); if (temp->right) q.push(temp->right); } return 0; } int main() { Node *root = new Node(8); root->left = new Node(2); root->right = new Node(32); root->left->left = new Node(1); root->left->right = new Node(4); root->right->left = new Node(16); root->right->right = new Node(64); cout << search(root, 32); return 0; }
e908d2e62ce02f9fb3928abd863ea8b9e157f6ff
4c5d17bf6c0d4901f972e88aac459088a270b301
/gd/storage/adapter_config_test.cc
e3c3791c67b762fad683c4831d3930aa0e51d718
[ "Apache-2.0" ]
permissive
LineageOS/android_system_bt
87e40748871e6aa6911cd691f98d957251d01919
7d057c89ab62916a31934f6e9a6f527fe7fc87fb
refs/heads/lineage-19.1
2023-08-31T13:31:22.112619
2023-03-28T18:40:51
2023-07-07T13:02:57
75,635,542
22
245
NOASSERTION
2022-10-02T20:22:16
2016-12-05T14:59:35
C++
UTF-8
C++
false
false
2,398
cc
adapter_config_test.cc
/* * Copyright 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <gmock/gmock.h> #include <gtest/gtest.h> #include "storage/adapter_config.h" #include "storage/mutation.h" using bluetooth::common::ByteArray; using bluetooth::hci::Address; using bluetooth::hci::DeviceType; using bluetooth::storage::AdapterConfig; using bluetooth::storage::ConfigCache; using bluetooth::storage::Device; using bluetooth::storage::Mutation; using ::testing::Eq; using ::testing::Optional; TEST(AdapterConfigTest, create_new_adapter_config) { ConfigCache config(10, Device::kLinkKeyProperties); ConfigCache memory_only_config(10, {}); AdapterConfig adapter_config(&config, &memory_only_config, "Adapter"); ASSERT_FALSE(adapter_config.GetAddress()); } TEST(AdapterConfigTest, set_property) { ConfigCache config(10, Device::kLinkKeyProperties); ConfigCache memory_only_config(10, {}); Address address = {{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}; AdapterConfig adapter_config(&config, &memory_only_config, "Adapter"); ASSERT_FALSE(adapter_config.GetAddress()); Mutation mutation(&config, &memory_only_config); mutation.Add(adapter_config.SetAddress(address)); mutation.Commit(); ASSERT_THAT(adapter_config.GetAddress(), Optional(Eq(address))); } TEST(AdapterConfigTest, equality_test) { ConfigCache config(10, Device::kLinkKeyProperties); ConfigCache memory_only_config(10, {}); bluetooth::hci::Address address = {{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}; AdapterConfig adapter_config_1(&config, &memory_only_config, "Adapter"); AdapterConfig adapter_config_2(&config, &memory_only_config, "Adapter"); ASSERT_EQ(adapter_config_1, adapter_config_2); ConfigCache memory_only_config_2(10, {}); AdapterConfig adapter_config_3(&config, &memory_only_config_2, "Adapter"); ASSERT_NE(adapter_config_1, adapter_config_3); }
2a73e1647036d5b8601d6a9d7b23ac5affd80a50
7877b1ac8c96819b8b6dba695b6c97aec07eb376
/src/MultiOrb_SpinFermion/Observables_MultiOrbSF.cpp
cd0a6e5f8706fc802686ea6f039b986e2ca6907b
[]
no_license
nkphys/Spin_dynamics_time_evolution
9bef7f008d7d99263b14591b3f71c2ac55534c4a
5d035de227704744e926bee33c4cb92a8cdbe8c4
refs/heads/master
2022-06-02T22:42:47.199139
2022-05-23T07:42:36
2022-05-23T07:42:36
144,104,413
0
0
null
null
null
null
UTF-8
C++
false
false
9,814
cpp
Observables_MultiOrbSF.cpp
#include "Observables_MultiOrbSF.h" /* * *********** * Functions in Class Observables ------ * *********** */ void Observables_MultiOrbSF::Get_red_den_mat(Mat_4_Complex_doub &Red_Den_mat, double mu){ double Beta=Parameters_.beta; //Red_Den_mat; //c^dagger[j][orb+n_orb*spin]c[l][orb+n_orb*spin2] int c1, c2; int jx,jy, lx,ly; for (int j=0;j<Parameters_.ns;j++){ jx = Coordinates_.indx_cellwise(j); jy = Coordinates_.indy_cellwise(j); for (int l=0;l<Parameters_.ns;l++){ lx = Coordinates_.indx_cellwise(l); ly = Coordinates_.indy_cellwise(l); for (int orb=0;orb<Parameters_.n_orbs;orb++){ for (int orb2=0;orb2<Parameters_.n_orbs;orb2++){ for (int s=0;s<2;s++){ for (int s2=0;s2<2;s2++){ Red_Den_mat[j][orb+Parameters_.n_orbs*s][l][orb2+Parameters_.n_orbs*s2]=zero_complex; for (int n=0;n<Hamiltonian_.eigs_.size();n++){ c1 = Coordinates_.Nbasis_[jx][jy][orb] + s*(Coordinates_.nbasis_); c2 = Coordinates_.Nbasis_[lx][ly][orb2] + + s2*(Coordinates_.nbasis_); //remember psi goes with anhilation //Red_Den_mat[j][s][l][s2] = <C_{l,s2}^{dagger} C_{j,s}> Red_Den_mat[j][orb+Parameters_.n_orbs*s][l][orb2+Parameters_.n_orbs*s2] += conj(Hamiltonian_.Ham_(c2,n))*(Hamiltonian_.Ham_(c1,n))*(1.0/(1.0 + exp(Beta*(Hamiltonian_.eigs_[n] - mu)))); } } } } } } } } void Observables_MultiOrbSF::Get_Non_Interacting_dispersion() { } double Observables_MultiOrbSF::Lorentzian(double x, double brd) { double temp; temp = (1.0 / PI) * ((brd / 2.0) / ((x * x) + ((brd * brd) / 4.0))); return temp; } void Observables_MultiOrbSF::DensityOfStates() { //-----------Calculate Bandwidth------// BandWidth = 2.0; //-----------------------------------// } // ---------- void Observables_MultiOrbSF::OccDensity() { } // ---------- void Observables_MultiOrbSF::TotalOccDensity() { } // ---------- complex<double> Observables_MultiOrbSF::SiSjQ(int i, int j) { return SiSjQ_(i, j); } double Observables_MultiOrbSF::SiSj(int i, int j) { return SiSj_(i, j); } complex<double> Observables_MultiOrbSF::SiSjQ_Mean(int i, int j) { return SiSjQ_Mean_(i, j); } complex<double> Observables_MultiOrbSF::SiSjQ_square_Mean(int i, int j) { return SiSjQ_square_Mean_(i, j); } double Observables_MultiOrbSF::SiSj_Mean(int i, int j) { return SiSj_Mean_(i, j); } double Observables_MultiOrbSF::SiSj_square_Mean(int i, int j) { return SiSj_square_Mean_(i, j); } double Observables_MultiOrbSF::fermi_function(int n) { double value; value = 1.0 / (exp(Parameters_.beta * (Hamiltonian_.eigs_[n] - Parameters_.mus)) + 1.0); return value; } void Observables_MultiOrbSF::calculate_quantum_SiSj() { /* Matrix<complex<double>> F_u_u; Matrix<complex<double>> F_d_d; Matrix<complex<double>> F_u_d; Matrix<complex<double>> F_d_u; Matrix<complex<double>> omF_u_u; Matrix<complex<double>> omF_d_d; Matrix<complex<double>> omF_u_d; Matrix<complex<double>> omF_d_u; int nx, ny; int jx, jy; F_u_u.resize(ns_, ns_); F_d_d.resize(ns_, ns_); F_u_d.resize(ns_, ns_); F_d_u.resize(ns_, ns_); omF_u_u.resize(ns_, ns_); omF_d_d.resize(ns_, ns_); omF_u_d.resize(ns_, ns_); omF_d_u.resize(ns_, ns_); for (int i = 0; i < ns_; i++) { for (int j = 0; j < ns_; j++) { for (int n = 0; n < Hamiltonian_.eigs_.size(); n++) { F_u_u(i, j) += (conj(Hamiltonian_.Ham_(i, n)) * Hamiltonian_.Ham_(j, n) * fermi_function(n)); F_d_d(i, j) += (conj(Hamiltonian_.Ham_(i + ns_, n)) * Hamiltonian_.Ham_(j + ns_, n) * fermi_function(n)); F_u_d(i, j) += (conj(Hamiltonian_.Ham_(i, n)) * Hamiltonian_.Ham_(j + ns_, n) * fermi_function(n)); F_d_u(i, j) += (conj(Hamiltonian_.Ham_(i + ns_, n)) * Hamiltonian_.Ham_(j, n) * fermi_function(n)); omF_u_u(i, j) += (conj(Hamiltonian_.Ham_(i, n)) * Hamiltonian_.Ham_(j, n) * (1.0 - fermi_function(n))); omF_d_d(i, j) += (conj(Hamiltonian_.Ham_(i + ns_, n)) * Hamiltonian_.Ham_(j + ns_, n) * (1.0 - fermi_function(n))); omF_u_d(i, j) += (conj(Hamiltonian_.Ham_(i, n)) * Hamiltonian_.Ham_(j + ns_, n) * (1.0 - fermi_function(n))); omF_d_u(i, j) += (conj(Hamiltonian_.Ham_(i + ns_, n)) * Hamiltonian_.Ham_(j, n) * (1.0 - fermi_function(n))); } } } int i_; for (int ix = 0; ix < lx_; ix++) { for (int iy = 0; iy < ly_; iy++) { // i = Coordinates_.Nc(ix, iy); quantum_SiSj_(ix, iy) = 0.0; for (int j = 0; j < ns_; j++) { jx = Coordinates_.indx(j); jy = Coordinates_.indy(j); nx = (jx + ix) % lx_; ny = (jy + iy) % ly_; i_ = Coordinates_.Nc(nx, ny); quantum_SiSj_(ix, iy) += ( 0.25*(F_u_u(i_, i_) * F_u_u(j, j) + F_u_u(i_, j) * omF_u_u(j, i_) - ( F_u_u(i_, i_) * F_d_d(j, j) + F_u_d(i_, j) * omF_d_u(j, i_) ) - ( F_d_d(i_, i_) * F_u_u(j, j) + F_d_u(i_, j) * omF_u_d(j, i_) ) + F_d_d(i_, i_) * F_d_d(j, j) + F_d_d(i_, j) * omF_d_d(j, i_)) + 0.5 * (F_u_d(i_, i_) * F_d_u(j, j) + F_u_u(i_, j) * omF_d_d(j, i_)) + 0.5 * (F_d_u(i_, i_) * F_u_d(j, j) + F_d_d(i_, j) * omF_u_u(j, i_)) ).real(); } quantum_SiSj_(ix, iy) /= (ns_ * 1.0); } } //Fourier transform double phase, Cos_ij, Sin_ij; for (int qx = 0; qx < lx_; qx++) { for (int qy = 0; qy < ly_; qy++) { quantum_SiSjQ_(qx, qy) = complex<double>(0.0, 0.0); for (int xr = 0; xr < lx_; xr++) { for (int yr = 0; yr < ly_; yr++) { phase = 2.0 * Parameters_.pi * (double(qx * xr) / double(lx_) + double(qy * yr) / double(ly_)); Cos_ij = cos(phase); Sin_ij = sin(phase); quantum_SiSjQ_(qx, qy) += quantum_SiSj_(xr, yr) * complex<double>(Cos_ij, Sin_ij); } } quantum_SiSjQ_(qx, qy) *= double(1.0 / (lx_ * ly_)); //cout << qx << " "<< qy<< " "<< SiSjQ_(qx,qy) << endl; } } */ } void Observables_MultiOrbSF::calculate_local_density() { int c1; complex<double> value = zero_complex; // cout <<"Parameter mus="<< Parameters_.mus<<endl; for (int i = 0; i < nbasis_; i++) { for (int sigma = 0; sigma < 2; sigma++) { local_density[i][sigma] = 0.0; c1 = i + (sigma * nbasis_); for (int n = 0; n < Hamiltonian_.eigs_.size(); n++) { local_density[i][sigma] += (conj(Hamiltonian_.Ham_(c1, n)) * Hamiltonian_.Ham_(c1, n) * fermi_function(n)).real(); } // value += (conj(Hamiltonian_.Ham_(c1, 1)) * Hamiltonian_.Ham_(c1, 1)); } } } void Observables_MultiOrbSF::SiSjFULL() { } // ---------- void Observables_MultiOrbSF::SiSjQ_Average() { } // ---------- void Observables_MultiOrbSF::quantum_SiSjQ_Average() { } void Observables_MultiOrbSF::SiSj_Average() { } // ---------- void Observables_MultiOrbSF::quantum_SiSj_Average() { } // ---------- void Observables_MultiOrbSF::local_density_average() { for (int i = 0; i < nbasis_; i++) { for (int sigma = 0; sigma < 2; sigma++) { local_density_Mean[i][sigma] += local_density[i][sigma]; local_density_square_Mean[i][sigma] += pow(local_density[i][sigma], 2); } } } void Observables_MultiOrbSF::Total_Energy_Average(double Curr_QuantE, double CurrE) { AVG_Total_Energy += Curr_QuantE + CurrE; AVG_Total_Energy_sqr += (Curr_QuantE + CurrE) * (Curr_QuantE + CurrE); } void Observables_MultiOrbSF::OccDensity(int tlabel) { } // ---------- void Observables_MultiOrbSF::DOSprint(int tlabel) { } // ---------- void Observables_MultiOrbSF::Initialize() { complex<double> zero(0.0, 0.0); int space = 2 * ncells_ * n_orbs_; sx_.resize(space); sy_.resize(space); sz_.resize(space); local_density.resize(nbasis_); local_density_Mean.resize(nbasis_); local_density_square_Mean.resize(nbasis_); for (int i = 0; i < local_density.size(); i++) { local_density[i].resize(2); local_density_Mean[i].resize(2); local_density_square_Mean[i].resize(2); } Nematic_order_mean_ = 0.0; Nematic_order_square_mean_ = 0.0; SiSj_.resize(lx_, ly_); SiSj_Mean_.resize(lx_, ly_); SiSj_square_Mean_.resize(lx_, ly_); SiSjQ_Mean_.resize(lx_, ly_); SiSjQ_square_Mean_.resize(lx_, ly_); SiSjQ_.resize(lx_, ly_); quantum_SiSj_.resize(lx_, ly_); quantum_SiSj_Mean_.resize(lx_, ly_); quantum_SiSj_square_Mean_.resize(lx_, ly_); quantum_SiSjQ_Mean_.resize(lx_, ly_); quantum_SiSjQ_square_Mean_.resize(lx_, ly_); quantum_SiSjQ_.resize(lx_, ly_); for (int ix = 0; ix < lx_; ix++) { for (int iy = 0; iy < ly_; iy++) { SiSjQ_Mean_(ix, iy) = zero; SiSjQ_square_Mean_(ix, iy) = zero; } } } // ---------- double Observables_MultiOrbSF::Omega(int i) { return -20.0 + double(i) * dosincr_; } // ----------
e773d7d5ffce09c4b178c16098e2824c36e50511
3a65eb739caf862c6cb72b420f5849b87e607f52
/examples/facebookexternalinterceptordemo/webwindow.h
f87a503e48f278d5f71c48a47801cf5f07344a62
[ "BSD-2-Clause" ]
permissive
pipacs/o2
bc8cc25fa106a2df9dbc0c97f0d9a693c8afd532
99902cc37e083a8311c1f8eee918e93c93cbc937
refs/heads/master
2023-08-23T15:31:36.119457
2022-01-01T19:23:12
2022-01-01T19:23:12
4,351,646
275
160
BSD-2-Clause
2023-02-27T12:16:36
2012-05-16T20:42:59
C++
UTF-8
C++
false
false
953
h
webwindow.h
#pragma once #include <QDialog> #include <QWebEngineView> namespace Ui { class WebWindow; } class WebWindow : public QDialog { Q_OBJECT public: explicit WebWindow(QSize inWindowSize, QUrl inLoginURL, QString inRedirectURLString, bool inAutoclose); ~WebWindow(); QString resultStr; QWebEnginePage *GetWebEnginePage() { return mWebEnginePage; } protected: void closeEvent(QCloseEvent *); signals: void windowClosed(); void callbackCalled(const QString &inURLString); private slots: void onCallbackCatched(const QString &inURLString); void onCallbackCatchedSafe(); private: Ui::WebWindow *ui; // Profile to not store cookies and cache data to the disk QWebEngineProfile *mWebEngineProfile; // Webengine page using the Off-the-record profile QWebEnginePage *mWebEnginePage; // Webview QWebEngineView* mWebView; QString mCatchedOAuthURL; bool mAutoclose; };
1cd96d0570d7bd6ed0f603333307583d160bc5b2
b22588340d7925b614a735bbbde1b351ad657ffc
/athena/Trigger/TrigAlgorithms/TrigT2CaloCosmic/src/T2CaloCosmic.cxx
284af0189fd4e938de7e1a59838a5372c09c27b1
[]
no_license
rushioda/PIXELVALID_athena
90befe12042c1249cbb3655dde1428bb9b9a42ce
22df23187ef85e9c3120122c8375ea0e7d8ea440
refs/heads/master
2020-12-14T22:01:15.365949
2020-01-19T03:59:35
2020-01-19T03:59:35
234,836,993
1
0
null
null
null
null
UTF-8
C++
false
false
8,925
cxx
T2CaloCosmic.cxx
/* Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ // ******************************************************************** // // NAME: T2CaloCosmic.cxx // PACKAGE: Trigger/TrigAlgorithms/TrigT2CaloCosmic // // AUTHOR: D.O. Damazio // // - Add variables for job option controlled region limits, set defaults // to most likely values. // - Add function EtaPhiRange to return the maximum and minimum eta or phi // values to use when calculating energy sums over a region - R. Soluk // ******************************************************************** #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/IToolSvc.h" #include "GaudiKernel/StatusCode.h" #include "TrigT1Interfaces/RecEmTauRoI.h" #include "TrigSteeringEvent/TrigRoiDescriptor.h" #include "TrigSteeringEvent/PhiHelper.h" #include "TrigCaloEvent/TrigEMClusterContainer.h" #include "TrigT2CaloCosmic/T2CaloCosmic.h" //#include "TrigT2CaloCosmic/T2CaloCosmicMon.h" #include "TrigT2CaloCommon/IAlgToolCalo.h" class ISvcLocator; T2CaloCosmic::T2CaloCosmic(const std::string & name, ISvcLocator* pSvcLocator) : T2CaloBase(name, pSvcLocator), m_log(0) { declareProperty("TrigEMClusterKey",m_trigEmClusterKey = "T2CaloTrigEMCluster"); declareProperty("L1ForceEta",m_l1eta = -10.0); declareProperty("L1ForcePhi",m_l1phi = -10.0); declareProperty("EtaMin",m_etamin); declareProperty("EtaMax",m_etamax); declareProperty("PhiMin",m_phimin); declareProperty("PhiMax",m_phimax); } T2CaloCosmic::~T2CaloCosmic() { delete m_log; } HLT::ErrorCode T2CaloCosmic::hltInitialize() { if (!m_log) m_log = new MsgStream(messageService(), name()); // Support for new monitoring declareMonitoredObject("Eta", m_monitoredCluster,&TrigEMCluster::eta); declareMonitoredObject("Phi", m_monitoredCluster,&TrigEMCluster::phi); declareMonitoredObject("Et", m_monitoredCluster,&TrigEMCluster::et); declareMonitoredObject("Had1Et", m_monitoredCluster,&TrigEMCluster::ehad1); declareMonitoredObject("weta2", m_monitoredCluster,&TrigEMCluster::weta2); // More complicated variables to be monitored declareMonitoredVariable("Rcore", m_rCore ); declareMonitoredVariable("Eratio",m_eRatio); return HLT::OK; } HLT::ErrorCode T2CaloCosmic::hltExecute(const HLT::TriggerElement* inputTE, HLT::TriggerElement* outputTE) { // Time total T2CaloCosmic execution time. if ( m_timersvc ) m_timer[0]->start(); if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("in execute()"); //bool status = false; // Some debug output: if (msgLvl(MSG::DEBUG)) { msg (MSG::DEBUG) << "outputTE->getId(): " << outputTE->getId() << endreq; msg(MSG::DEBUG) << "inputTE->getId(): " << inputTE->getId() << endreq; } const TrigRoiDescriptor* roiDescriptor = 0; HLT::ErrorCode hltStatus = getFeature(inputTE, roiDescriptor); if ( hltStatus == HLT::OK ) { if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << *roiDescriptor << endreq; } else { msg(MSG::WARNING) << " Failed to find RoiDescriptor " << endreq; return hltStatus; } // Some debug output: msg(MSG::DEBUG) << "Message to count events. LVL1 phi=" << roiDescriptor->phi() << " & LVL1 eta=" << roiDescriptor->eta() << endreq; // End LVL1 part double etamin, etamax, phimin, phimax; double _eta, _phi; int roiword = roiDescriptor->roiWord(); // if ( !m_trustRoiLimits ) { if ( (m_l1eta<-9.9)&&(m_l1phi<-9.9)){ _eta = roiDescriptor->eta(); _phi = roiDescriptor->phi(); } else { _eta = m_l1eta; _phi = HLT::wrapPhi(m_l1phi); } etamin = std::max(-2.5, _eta - m_etaWidth); etamax = std::min( 2.5, _eta + m_etaWidth); phimin = HLT::wrapPhi( _phi - m_phiWidth); phimax = HLT::wrapPhi( _phi + m_phiWidth); TrigRoiDescriptor* newroi = new TrigRoiDescriptor( _eta, etamin, etamax, _phi, phimin, phimax ); attachFeature( outputTE, newroi, "T2CaloCosmic" ); roiDescriptor = newroi; // } if (msgLvl(MSG::DEBUG)) { msg(MSG::DEBUG) << " etamin = "<< *roiDescriptor << endreq; // (*m_log) << MSG::DEBUG << " etamin = "<< etamin << endreq; // (*m_log) << MSG::DEBUG << " etamax = "<< etamax << endreq; // (*m_log) << MSG::DEBUG << " phimin = "<< phimin << endreq; // (*m_log) << MSG::DEBUG << " phimax = "<< phimax << endreq; } if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " Making TrigEMCluster "<< endreq; std::vector<xAOD::TrigEMCluster*> m_vec_clus; std::cout << "m_emAlgTools.size() = " << m_emAlgTools.size() << std::endl; // Ok, ignoring LVL1 and forcing a position int counter=0; ToolHandleArray<IAlgToolCalo>::iterator it = m_emAlgTools.begin(); if ( m_timersvc ) m_timer[1]->start(); for (; it < m_emAlgTools.end(); it++) { xAOD::TrigEMCluster* ptrigEmCluster = new xAOD::TrigEMCluster(); // It is a good idea to clear the energies for(int i=0;i<MAXSIZE;i++) ptrigEmCluster->setEnergy((CaloSampling::CaloSample )i,0.); // Add RoI word to TrigEMCluster (*ptrigEmCluster).setRoIword(roiword); (*ptrigEmCluster).setEta1(10+counter); etamin=m_etamin[counter]; etamax=m_etamax[counter]; phimin=m_phimin[counter]; phimax=m_phimax[counter]; // if ((*it)->execute(*ptrigEmCluster,etamin,etamax,phimin,phimax).isFailure() ) { if ((*it)->execute(*ptrigEmCluster,*roiDescriptor).isFailure() ) { ATH_MSG_WARNING("T2Calo AlgToolCosmic returned Failure"); return HLT::TOOL_FAILURE; } // If you do not have any hot cell in top or bottom, stop algo if ( (counter==0 || counter==1) && (*ptrigEmCluster).energy()==0) return HLT::OK; counter++; m_vec_clus.push_back(ptrigEmCluster); } // support to new monitoring m_rCore=0; m_eRatio=0; /* if ( ptrigEmCluster->e277()!=0 ) m_rCore = ptrigEmCluster->e237()/ptrigEmCluster->e277(); if ( ptrigEmCluster->emaxs1()+ptrigEmCluster->e2tsts1() !=0){ m_eRatio = ptrigEmCluster->emaxs1()-ptrigEmCluster->e2tsts1(); m_eRatio /= ptrigEmCluster->emaxs1()+ptrigEmCluster->e2tsts1(); } */ if ( m_timersvc ) m_timer[1]->stop(); for(size_t i=0;i<m_vec_clus.size();i++){ xAOD::TrigEMCluster* ptrigEmCluster=m_vec_clus[i]; // Print out Cluster produced msg(MSG::DEBUG) << " Values of Cluster produced: "<< endreq; msg(MSG::DEBUG) << " REGTEST: emEnergy = "<< (*ptrigEmCluster).energy() << endreq; msg(MSG::DEBUG) << " REGTEST: hadEnergy = "<< (*ptrigEmCluster).ehad1() << endreq; msg(MSG::DEBUG) << " REGTEST: rCore = " << ((*ptrigEmCluster).e237() )/ ((*ptrigEmCluster).e277()) << endreq; msg(MSG::DEBUG) << " REGTEST: energyRatio = " << (((*ptrigEmCluster).emaxs1()-(*ptrigEmCluster).e2tsts1())/ ((*ptrigEmCluster).emaxs1()+(*ptrigEmCluster).e2tsts1())) << endreq; msg(MSG::DEBUG) << " REGTEST: clusterWidth = " << (*ptrigEmCluster).weta2() << endreq; msg(MSG::DEBUG) << " REGTEST: frac73 = " << (*ptrigEmCluster).fracs1() << endreq; msg(MSG::DEBUG) << " REGTEST: eta = "<< (*ptrigEmCluster).eta() << endreq; msg(MSG::DEBUG) << " REGTEST: phi = "<< (*ptrigEmCluster).phi() << endreq; msg(MSG::DEBUG) << " REGTEST: roiWord = " << (*ptrigEmCluster).RoIword() << endreq; // Fill monitoring hists: /* if (m_mon) if ( m_monitoring->fillT2CaloCosmicHists(ptrigEmCluster).isFailure() ) (*m_log) << MSG::DEBUG << " Failled to Monitor" << endreq; */ std::string key = ""; hltStatus = recordAndAttachFeature(outputTE, ptrigEmCluster, key, "TrigT2CaloCosmic"); if (hltStatus != HLT::OK){ if(msgLvl(MSG::DEBUG)) ATH_MSG_ERROR("Write of TrigEMCluster into outputTE failed"); return hltStatus; } } // Create a new RoiDescriptor with updated eta and phi. // Note that the steering will propagate l1Id and roiId automatically // so no need to set them. /* TrigEMCluster* ptrigEmCluster = m_vec_clus[0]; TrigRoiDescriptor* newRoiDescriptor = new TrigRoiDescriptor(roiDescriptor->l1Id(), roiDescriptor->roiId(), ptrigEmCluster->eta(), ptrigEmCluster->phi()); hltStatus = attachFeature(outputTE,newRoiDescriptor,"TrigT2CaloCosmic"); if ( hltStatus != HLT::OK ) { (*m_log) << MSG::ERROR << "Write of update TrigRoiDescriptor into outputTE failed" << endreq; return hltStatus; } */ //#ifndef NDEBUG // (*m_log) << MSG::DEBUG << "Recorded an RoiDescriptor " // << " phi " << newRoiDescriptor->phi0() // << " eta " << newRoiDescriptor->eta0() << endreq; //#endif // Some debug output: if (msgLvl(MSG::DEBUG)) { msg(MSG::DEBUG) << "We assume success, set TE with Id " << outputTE->getId() << " active to signal positive result." << endreq; } // Time total T2CaloCosmic execution time. if ( m_timersvc ) m_timer[0]->stop(); return HLT::OK; } HLT::ErrorCode T2CaloCosmic::hltFinalize(){ // if ( msgLvl() <= MSG::INFO ) if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG("in finalize()"); return HLT::OK; }
2ba191c4c99ae2743e87fa15f056dc353a92eb7a
cc95a4db4695ddf4e132231bd782d9b31e3655f6
/class/app/generador/parser_salas.cpp
b32e0adb81db5aa0fae7d0cb4aaa02b82d72b83d
[]
no_license
TheMarlboroMan/navigator
98c2bf1516cd40bc1bf11d123873dda2b19ed80c
c0a0a42b50d9f0a0274c1d41d2b2a1caafd314c0
refs/heads/master
2020-05-17T09:16:42.236088
2015-12-10T20:54:20
2015-12-10T20:54:20
39,912,720
0
1
null
null
null
null
UTF-8
C++
false
false
6,988
cpp
parser_salas.cpp
#include "parser_salas.h" #include "../lectores/info_obstaculos_genericos.h" using namespace App_Generador; const std::string Parser_salas::TIPO_ESTRUCTURA="[ESTRUCTURA]"; const std::string Parser_salas::TIPO_FIN_ESTRUCTURA="[/ESTRUCTURA]"; const std::string Parser_salas::TIPO_INFO="[INFO]"; const std::string Parser_salas::TIPO_REJILLA="[REJILLA]"; const std::string Parser_salas::TIPO_CELDAS="[CELDAS]"; const std::string Parser_salas::TIPO_CAMARA="[CAMARA]"; const std::string Parser_salas::TIPO_LOGICA="[LOGICA]"; const std::string Parser_salas::TIPO_OBJETOS="[OBJETOS]"; Parser_salas::Parser_salas() :d_celdas(destino_celdas::nada), estado(t_estados::nada), sala(1,1,0,0) { } void Parser_salas::parsear_fichero(const std::string& ruta, const App_Lectores::Info_obstaculos_genericos& iog) { DLibH::Lector_txt L(ruta, '#'); if(!L) { LOG<<"ERROR: Imposible localizar nivel en fichero "<<ruta<<std::endl; throw std::runtime_error("Imposible localizar nivel en fichero"); } else { std::string linea; //La factoría contendrá los objetos de juego hasta que finalmente //se implanten en la sala. App_Juego_Factorias::Factoria_objetos_juego factoria(iog); while(true) { linea=L.leer_linea(); if(!L) break; if(interpretar_estado(linea, factoria)) { switch(estado) { case t_estados::nada: case t_estados::estructura: case t_estados::info: case t_estados::logica: case t_estados::fin: break; case t_estados::rejilla: interpretar_linea_como_rejilla(linea); break; case t_estados::celdas: interpretar_linea_como_celdas(linea); break; case t_estados::objetos: interpretar_linea_como_objeto(linea, factoria); break; } } } } } bool Parser_salas::interpretar_estado(const std::string& linea, App_Juego_Factorias::Factoria_objetos_juego& factoria) { if(linea==TIPO_ESTRUCTURA) estado=t_estados::estructura; else if(linea==TIPO_INFO) estado=t_estados::info; else if(linea==TIPO_REJILLA) estado=t_estados::rejilla; else if(linea==TIPO_CELDAS) { //Cada vez que encuentre una, aumentamos el destino. switch(d_celdas) { case destino_celdas::nada: d_celdas=destino_celdas::logica; break; case destino_celdas::logica: d_celdas=destino_celdas::decoracion; break; case destino_celdas::decoracion: throw std::runtime_error("Demasiadas secciones de celda en sala."); break; } estado=t_estados::celdas; } else if(linea==TIPO_LOGICA) estado=t_estados::logica; else if(linea==TIPO_OBJETOS) { //Por cada vez que se encuentre esta tag, añadimos un contenedor al final. contenedores.push_back(App_Juego_Contenedores::Contenedor_objetos()); auto& c=contenedores.back(); factoria.establecer_contenedor(c); estado=t_estados::objetos; } else if(linea==TIPO_FIN_ESTRUCTURA) { estado=t_estados::fin; return true; //Hay que ejecutar una acción al cerrar la estructura. } else return true; return false; } void Parser_salas::interpretar_linea_como_rejilla(const std::string& linea) { std::vector<std::string> valores=Herramientas::explotar(linea, ','); if(valores.size() < 2) { throw std::runtime_error("ERROR: Al interpretar línea como rejilla hay menos de 2 parámetros"); } const auto w=toi(valores[0]), h=toi(valores[1]); sala.modificar_dimensiones(w, h); } void Parser_salas::interpretar_linea_como_celdas(const std::string& linea) { std::vector<std::string> valores=Herramientas::explotar(linea, ' '); for(const auto& v : valores) { const auto& partes=Herramientas::explotar(v, ','); if(partes.size() != 3) { throw std::runtime_error("ERROR: Al interpretar línea "+v+" como celda hay debe haber 3 parámetros."); } const int x=toi(partes[0]), y=toi(partes[1])/*, tipo=toi(partes[2])*/; switch(d_celdas) { case destino_celdas::nada: break; case destino_celdas::logica: sala.insertar_celda(x, y, App_Niveles::Celda::tipo_celda::solida); break; case destino_celdas::decoracion: sala.insertar_celda_decorativa(x, y, toi(partes[2])); break; } } } void Parser_salas::interpretar_linea_como_objeto(const std::string& linea, App_Juego_Factorias::Factoria_objetos_juego& factoria) { factoria.interpretar_linea(linea); } /** * Se comprueba que la sala se ha creado de acuerdo con las siguientes normas: * - Tiene al menos el contenedor principal una variante. * - El contenedor principal contiene inicio, fin y entradas. * - Las variantes no tienen inicio, fin ni entradas. */ bool Parser_salas::comprobar_validez_sala() const { //TODO: Separar el contenedor principal del resto de contenedores. Está //ensuciando mucho el código. if(contenedores.size() <= 1) { LOG<<"Se detecta que no hay variantes para la sala."<<std::endl; return false; } auto& primero=contenedores.front(); if(primero.posicion_inicial == nullptr) { LOG<<"Se detecta que no hay posición inicial en contenedor principal."<<std::endl; return false; } else if(primero.salida == nullptr) { LOG<<"Se detecta que no hay posición de salida en contenedor principal."<<std::endl; return false; } else if(!primero.entradas.size()) { LOG<<"Se detecta que no hay entradas en contenedor principal."<<std::endl; return false; } auto it=contenedores.begin()+1; while(it < contenedores.end()) { if(it->entradas.size()) { LOG<<"Se detectan entradas en variación de sala."<<std::endl; return false; } if(it->posicion_inicial != nullptr) { LOG<<"Se detecta una posición inicial en variación de sala."<<std::endl; return false; } if(it->salida != nullptr) { LOG<<"Se detecta una salida en variación de sala."<<std::endl; return false; } ++it; } return true; } /** * @param size_t v : La variante que vamos a usar empezando por 0. * @param tipo_sala t : El tipo de sala, que indicará * Compone un nuevo contenedor a partir del contenedor[0] con las cosas comunes * y los valores de la variante escogida. Ese contenedor luego se asigna a la * sala. */ void Parser_salas::generar_variante_sala(size_t v, tipo_sala t) { if(v==0) throw std::runtime_error("ERROR: Se intenta generar la variante 0"); //Copia del contenedor original. auto c=contenedores.front(); /** * Esto tiene su historia: si vamos a borrar la salida hay que tener * en cuenta que hay referencias a la misma en los contenedores de * interfaces, luego hay que marcarlos para borrar, limpiar y después * elimianr la referencia. */ auto eliminar_fin=[&c]() { c.salida->mut_borrar(true); c.limpiar_para_borrar(); c.salida.reset(); }; switch(t) { case tipo_sala::normal: eliminar_fin(); c.posicion_inicial.reset(); break; case tipo_sala::inicio: eliminar_fin(); break; case tipo_sala::fin: c.posicion_inicial.reset(); break; } //Finalmente, generar la variante e implantar. El +1 es porque el cero son las salidas y entradas. c.sumar_variante(contenedores[v]); sala.implantar_objetos_juego(std::move(c)); }
4b21bd55c386ddb2e3d6122e63733d3ebdc734f4
8a2294f61781b158990697a0fcca010ecdf9f684
/src/nes/mapper/mapper065.cpp
c547c83cb3c8b70a15499039128044261731bab9
[]
no_license
ruedigergad/emumaster
dce5bbfc096da9ad2d4d1127c3db41fa4ef92bae
9ab6e8d2bc3966fcb80f6a085346fb0e509bd9e0
refs/heads/master
2021-01-10T20:44:34.525335
2017-12-29T20:04:13
2017-12-29T20:04:13
15,937,202
6
3
null
null
null
null
UTF-8
C++
false
false
2,962
cpp
mapper065.cpp
/* * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "mapper065.h" #include "disk.h" static u8 patch; static u8 irq_enable; static s32 irq_counter; static s32 irq_latch; static void writeHigh(u16 addr, u8 data) { switch (addr) { case 0x8000: nesSetRom8KBank(4, data); break; case 0x9000: if (!patch) nesSetMirroring(static_cast<NesMirroring>(((data & 0x40)^0x40) >> 6)); break; case 0x9001: if (patch) nesSetMirroring(static_cast<NesMirroring>((data & 0x80) >> 7)); break; case 0x9003: if (!patch) { irq_enable = data & 0x80; nesMapperSetIrqSignalOut(false); } break; case 0x9004: if (!patch) { irq_counter = irq_latch; } break; case 0x9005: if (patch) { irq_counter = (u8)(data<<1); irq_enable = data; nesMapperSetIrqSignalOut(false); } else { irq_latch = (irq_latch & 0x00FF)|(data<<8); } break; case 0x9006: if (patch) { irq_enable = 1; } else { irq_latch = (irq_latch & 0xFF00)|data; } break; case 0xB000: case 0xB001: case 0xB002: case 0xB003: case 0xB004: case 0xB005: case 0xB006: case 0xB007: nesSetVrom1KBank(addr & 0x0007, data); break; case 0xA000: nesSetRom8KBank(5, data); break; case 0xC000: nesSetRom8KBank(6, data); break; } } static void clock(int cycles) { Q_ASSERT(!patch); if (irq_enable) { if (irq_counter <= 0) { nesMapperSetIrqSignalOut(true); } else { irq_counter -= cycles; } } } static void horizontalSync() { Q_ASSERT(patch); if (irq_enable) { if (irq_counter == 0) { nesMapperSetIrqSignalOut(true); } else { irq_counter--; } } } void Mapper065::reset() { NesMapper::reset(); writeHigh = ::writeHigh; patch = 0; // Kaiketsu Yanchamaru 3(J) if (nesDiskCrc == 0xe30b7f64) patch = 1; nesSetRom8KBanks(0, 1, nesRomSize8KB-2, nesRomSize8KB-1); if (nesVromSize1KB) nesSetVrom8KBank(0); irq_enable = 0; irq_counter = 0; irq_latch = 0; if (patch) horizontalSync = ::horizontalSync; else clock = ::clock; } void Mapper065::extSl() { emsl.var("irq_enable", irq_enable); emsl.var("irq_counter", irq_counter); emsl.var("irq_latch", irq_latch); }
502f7e0c2517a897c4a53f5b2a26b533e74726ac
6b0268259c9de463254ca603e84b889d764fc0a1
/include/wave/writer.hpp
8f0c323e5687d218dab238711178cbc82a765fbf
[]
no_license
hcab14/HFMonitor
2950744d078d5125cbd0a5ac04d45c96a92e2943
5d328d6ec704994caa253bdbe4a286bb695ed81b
refs/heads/master
2020-12-09T06:13:16.757132
2017-10-22T10:59:39
2017-10-22T10:59:39
55,221,843
1
0
null
null
null
null
UTF-8
C++
false
false
6,253
hpp
writer.hpp
// -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- // $Id$ // // Copyright 2010-2014 Christoph Mayer // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // #ifndef _WAVE_WRITER_HPP_cm121217_ #define _WAVE_WRITER_HPP_cm121217_ #include <iostream> #include <fstream> #include <complex> #include <vector> #include <boost/noncopyable.hpp> #include <boost/shared_ptr.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/filesystem/operations.hpp> #include "gen_filename.hpp" #include "processor.hpp" #include "network/protocol.hpp" #include "wave/definitions.hpp" /*! \addtogroup processors * @{ * \addtogroup wave_writer wave_writer * WAV writer processor * * @{ */ namespace wave { namespace detail { template<typename T> std::ostream& writeT(std::ostream& os, const T& data) { return os.write((char *)(&data), sizeof(T)); } // void write_real_sample(std::ostream& os, boost::uint16_t bitsPerSample, double s) { // // we assume abs(s)<=1 // boost::uint32_t si= boost::uint32_t(std::abs(s) * (1L << (bitsPerSample-1))); // if (s < 0.) si= 1L + (0xFFFFFFFFL ^ si); // for (size_t u(0); u<bitsPerSample; u+=8) { // const boost::uint8_t c((si >> u) & 0xFF); // writeT(os, c); // } // } // for performance reasons this version is avoiding streams std::string::iterator write_real_sample(std::string::iterator i, boost::uint16_t bitsPerSample, double s) { // we assume abs(s)<1 boost::uint32_t si= boost::uint32_t(std::abs(s) * (1L << (bitsPerSample-1))); if (s < 0.) si= 1L + (0xFFFFFFFFL ^ si); for (size_t u(0); u<bitsPerSample; u+=8) { const boost::uint8_t c((si >> u) & 0xFF); *i++ = c; } return i; } class wave_header { public: wave_header(boost::uint32_t sampleRate, boost::uint16_t bitsPerSample, boost::uint16_t numChannels) : format_(sampleRate, bitsPerSample, numChannels) {} wave_header& change_sample_rate(boost::uint32_t new_sample_rate) { format_.changeSampleRate(new_sample_rate); data_.size() = 0; return *this; } wave_header& add_samples(size_t number_of_samples) { data_.size() += number_of_samples * format_.numChannels() * format_.bitsPerSample()/8; riff_.size() = 4 + (8 + format_.size()) + (8 + data_.size()); return *this; } const chunk::riff& riff() const { return riff_; } const chunk::format& format() const { return format_; } const chunk::data& data() const { return data_; } private: chunk::riff riff_; chunk::format format_; chunk::data data_; } ; } // namespace detail /// WAV writer processor class writer_iq : public processor::base_iq, public gen_filename { public: typedef boost::shared_ptr<writer_iq> sptr; writer_iq(const boost::property_tree::ptree& config) : base_iq(config) , base_path_(config.get<std::string>("<xmlattr>.filePath")) , file_period_(gen_filename::str2period(config.get<std::string>("<xmlattr>.filePeriod"))) , pos_(0) , header_(0, config.get<int>("<xmlattr>.bitsPerSample", 16), 2) // set correct sampling frequency later, number of channels is fixed to 2 { std::cout << "writer_iq" << std::endl; } virtual ~writer_iq() {} // gen_filename methods virtual file_period filePeriod() const { return file_period_; } virtual std::string fileExtension() const { return "wav"; } virtual void process_iq(service::sptr service, const_iterator i0, const_iterator i1) { std::cout << "writer_iq::process_iq " << service->approx_ptime() << " " << pos_ << " " << std::distance(i0, i1) << std::endl; const boost::filesystem::path filepath(gen_file_path(base_path_, service->stream_name(), service->approx_ptime())); if (boost::filesystem::exists(filepath) and (pos_ == std::streampos(0))) { std::cerr << "file '" << filepath << "' exists and will be overwritten" << std::endl; boost::filesystem::remove(filepath); } if (not boost::filesystem::exists(filepath)) { std::cerr << "new file " << filepath << " samplerate= " << service->sample_rate_Hz() << std::endl; std::ofstream ofs(filepath.c_str(), std::ios::binary); detail::writeT(ofs, header_.change_sample_rate(service->sample_rate_Hz())); pos_ = ofs.tellp(); std::cerr << "writing header to file '" << filepath << "' exists " << std::endl; } // write data std::ofstream ofs(filepath.c_str(), std::ios::in | std::ios::out | std::ios::binary); ofs.seekp(pos_); std::string s(2*std::distance(i0,i1)*header_.format().bitsPerSample()/8, 0); std::string::iterator si(s.begin()); for (processor::base_iq::const_iterator i(i0); i!=i1; ++i) { si = detail::write_real_sample(si, header_.format().bitsPerSample(), i->real()); // i si = detail::write_real_sample(si, header_.format().bitsPerSample(), i->imag()); // q } ofs << s; pos_ = ofs.tellp(); detail::writeT(ofs.seekp(0), header_.add_samples(std::distance(i0, i1))); } protected: private: std::string base_path_; gen_filename::file_period file_period_; std::streampos pos_; detail::wave_header header_; } ; } // namespace wave /// @} /// @} #endif // _WAVE_WRITER_HPP_cm121217_
0c16b433d3570cf026cd501fb501b04df8969f22
45f8efba65edb09f7e8de34dfa397afaa1068def
/Lab9/Server.cpp
94abac1b15797170635194086f5081cd0c5aaf5c
[]
no_license
nadavbrkt/ChatProject
382154e6fb191950f73be78c124c3584922d3621
458322688ebf9b9dbec45df6511f91cdfb080da4
refs/heads/master
2021-08-22T07:38:44.712576
2017-11-29T16:57:30
2017-11-29T16:57:30
112,502,740
0
0
null
null
null
null
UTF-8
C++
false
false
1,178
cpp
Server.cpp
/* * Server.cpp * * Created on: May 14, 2016 * Author: user */ #include "Server.h" #include "TCPMessengerProtocol.h" #include <unistd.h> #include "Dispatcher.h" using namespace std; using namespace npl; Server::Server() : _server(MSNGR_PORT) { // TODO Auto-generated constructor stub } Server::~Server() { // TODO Auto-generated destructor stub npl::Dispatcher::getInstance()->close(); _server.close(); } void npl::Server::run() { TCPSocket * tempConn = NULL; // Starts dispatcher npl::Dispatcher::getInstance()->start(); // Wait for connection while (_server.isAlive()) { _server.listen(); // Accepts connection tempConn = _server.accept(); // Adds it to dispatcher if(tempConn != NULL) { npl::Dispatcher::getInstance()->addSocket(*tempConn); cout << "Start Connection from : " << tempConn->fromAddr() << ":" << tempConn->getPort() << endl; } tempConn = NULL; sleep(1); } cout << "Closed Listener Server" << endl; } void npl::Server::closeConnections() { npl::Dispatcher::getInstance()->close(); } void npl::Server::waitForThread() { npl::Dispatcher::getInstance()->waitForThread(); MThread::waitForThread(); }
d2bbe16065bcc3a2d7f687cc3d9df710cc0cb677
c5a19f699823b952afb37095e164e4fee3a7b1f1
/colorMap.h
bbd4ab2223f19eee901da7ce902593216165f6e0
[]
no_license
alen0216056/Image_search_by_sketch
9885fd8162fdbb15bdea45a2e5cafb55b4b96835
6f9e6695d36ae50c7741a735b7e248383f01891a
refs/heads/master
2021-01-10T14:24:35.105181
2016-05-02T05:53:49
2016-05-02T05:53:49
54,110,090
0
2
null
2016-03-17T11:54:33
2016-03-17T10:41:19
C++
UTF-8
C++
false
false
1,277
h
colorMap.h
#ifndef __COLORMAP_H__ #define __COLORMAP_H__ #include "grid.h" #include <cv.h> #include <highgui.h> #include <opencv2\highgui\highgui.hpp> #include <highgui/highgui.hpp> #include <vector> #include <string> #include <iostream> using namespace std; struct colorWithMap { int color; grid<double> gd; colorWithMap(int c, const grid<double> &g) : color(c), gd(g){} colorWithMap(int c, const vector<double> &vec) : color(c), gd(grid<double>(vec)){} bool operator<(const colorWithMap& rhs) const { if ( color != rhs.color ) return color < rhs.color; return gd < rhs.gd; } bool operator==(const colorWithMap& rhs) const { return color == rhs.color && gd == rhs.gd; } bool operator!=(const colorWithMap& rhs) const { return !(*this == rhs); } }; class colorMap { private: public: string fileName; vector<colorWithMap> cv; colorMap(istream&); colorMap(string&,bool = true, bool fill = true); double operator- (const colorMap&) const; bool operator< (const colorMap&) const; bool operator== (const colorMap&) const; void show(string&); void save(ostream&) const; void printColors(ostream& = cout) const; double debugShow(const colorMap&, ostream& = cout) const; }; #endif
0c2a34221b87311467b566ad0a13264f7819d499
96e8048d809d1459f019e6a5aa2829d0c55c957c
/project/include/StdLib/Quote.h
10b563fb86154a3c7aca24696cb9b94daad58da5
[]
no_license
Hnatekmar/TPJ
caec78d5ff92c9f46a54f6897b7c90fa6e1060ac
ef322615d5c07e3dda97ecd8b335fd22992e8a26
refs/heads/master
2021-06-06T09:36:31.422467
2021-04-05T05:41:19
2021-04-05T05:41:19
72,508,926
1
0
null
null
null
null
UTF-8
C++
false
false
208
h
Quote.h
#ifndef QUOTE #define QUOTE #include "../IFunction.h" #include "Macro.h" class Quote : public IFunction { public: Token execute(std::vector<std::shared_ptr<AST> > &args, Context &) override; }; #endif
2cf7d3416ad1f93badd241cd8c1a0214aad76a3d
cd7e4c7c8eee3bebc9b95516d99a9d8c94cb8ab3
/009_Pangolin_study/test/test1.cpp
92d843c83c095da5a6659e60247ca693c013d011
[ "WTFPL" ]
permissive
DreamWaterFound/Codes
323cc8e76282f0cc82b35ef5a0cce456cb73488d
e7d80eb8bfd7d6f104abd18724cb4bface419233
refs/heads/master
2021-07-25T12:53:12.262593
2020-04-30T03:28:45
2020-04-30T03:28:45
162,776,145
16
2
null
null
null
null
UTF-8
C++
false
false
2,663
cpp
test1.cpp
//测试功能:在窗口中绘制一个坐标轴和点, //然后可以通过panel中的变量来控制坐标轴的大小和点的大小,以及点的颜色 #include <pangolin/pangolin.h> int main( int /*argc*/, char** /*argv*/ ) { //========================= 窗口 ======================== pangolin::CreateWindowAndBind( "Axis and points test", //窗口标题 640, //窗口尺寸 480); //窗口尺寸 glEnable(GL_DEPTH_TEST); //========================== 3D 交互器 ===================== // Define Projection and initial ModelView matrix pangolin::OpenGlRenderState s_cam( pangolin::ProjectionMatrix( 640,480, //相机图像的长和宽 420,420,320,240, //相机的内参,fu fv u0 v0 0.2,100), //相机所能够看到的最浅和最深的像素 pangolin::ModelViewLookAt( -2,2,-2, //相机光心位置,NOTICE z轴不要设置为0 0,0,0, //相机要看的位置 pangolin::AxisNegY) //和观察的方向有关 ); //======================== 调节面板 ============================== const int UI_WIDTH=180; pangolin::View& d_cam = pangolin::CreateDisplay() .SetBounds(0.0, 1.0, pangolin::Attach::Pix(UI_WIDTH), 1.0, -640.0f/480.0f) .SetHandler(new pangolin::Handler3D(s_cam)); pangolin::CreatePanel("ui") .SetBounds(0.0, 1.0, 0.0, pangolin::Attach::Pix(UI_WIDTH)); //接下来要开始准备添加控制选项了 //pangolin::Var<double> axisSize("ui.axis_size",5,0.5,20); pangolin::Var<double> pointSize("ui.point_size",3,1,20); pangolin::Var<double> pointR("ui.point_r",1,0,1); pangolin::Var<double> pointG("ui.point_g",1,0,1); pangolin::Var<double> pointB("ui.point_b",1,0,1); while( !pangolin::ShouldQuit() ) { // Clear screen and activate view to render into glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); d_cam.Activate(s_cam); // Render OpenGL Cube //pangolin::glDrawColouredCube(); //尝试按照谢晓佳的视频中给出的代码绘制 pangolin::glDrawAxis(3); glPointSize(double(pointSize)); glBegin(GL_POINTS); glColor3f( (double)pointR, (double)pointG, (double)pointB); glVertex3f(0.0f,0.0f,0.0f); glVertex3f(1,0,0); glVertex3f(0,2,0); glEnd(); //不要忘记了这个东西!!! glFlush(); // Swap frames and Process Events pangolin::FinishFrame(); } return 0; }
b30a07099a2b0798bd708604f9794507db1137c6
52b4f281edc750128bf2d200d5dd3795532e1e4b
/ParticleNGL/include/random.h
82f4235af3b9f261592980559a49ca9b340cf6fe
[]
no_license
yazici/SIMD
71ea7947fb471d81b56d2c15c8a0148c51d52ad8
5608c1f6c91474c505c4db407cc2adb4a30f81de
refs/heads/master
2020-04-29T15:33:03.861452
2019-03-14T15:45:33
2019-03-14T15:45:33
null
0
0
null
null
null
null
UTF-8
C++
false
false
771
h
random.h
#ifndef RANDOM_H_ #define RANDOM_H_ #include <cstdint> #include <cstdlib> #include <cmath> #include <unistd.h> #include "simd.h" namespace frng // fast rng code { extern uint32_t rand1i(); extern i128 rand4i(); extern void seedJkiss4i(int32_t x=123456789, int32_t y=234567891,int32_t z=345678912, int32_t w=456789123, int32_t c=0); extern float rand1f(); extern float rand1f(float min, float max); extern f128 rand4f(); extern f128 rand4f(float min, float max); extern void initKiss32Urand(); extern void initKissSSEUrand(); #ifdef UNITTESTS extern f128 frexp4f(const f128 x, i128 &e); extern f128 log4f(const f128 _l); extern float log1f(float _l); extern f128 fastlog4f(const f128 _l); #endif }; #endif
15a27c1789296bddee17e348bb8f06692346bc0a
b98d3580875e29cc668e9eef84582861e954a727
/Tracking/utility.h
f5a6846b8523dbffbd667119c0fe470e82ea964c
[ "MIT" ]
permissive
qimmer/mta13341
a3e7f6c5f65db405f545517788e7a0efd8497cc4
b1ea93b5ae95fcf2b2e9fd04e0579cf4cdbadbc7
refs/heads/master
2021-01-20T10:37:14.751052
2014-01-28T08:01:36
2014-01-28T08:01:36
null
0
0
null
null
null
null
UTF-8
C++
false
false
979
h
utility.h
#ifndef UTILITY_H #define UTILITY_H #include "tracking_global.h" #include <QImage> #include <QList> struct Blob; class TRACKINGSHARED_EXPORT Utility { public: /** * @brief depthToImage Creates a RGBA32 image from floating point depth data. * Only use this for debugging purposes, as precision is lost! * @param pDepthSrc The source floating point depth image * @param image The address of the output RGBA32 image */ static void depthToImage(float *pDepthSrc, QImage *image); /** * @brief depthToBinary Take depth data and generate white pixels for every time a depth * value is not zero (outside near and far clip planes). * @param pDepthSrc The floating point depth image * @param binaryImage The address of the output image */ static void depthToBinary(float *pDepthSrc, QImage *binaryImage); static void centerOfPlayer(Blob &blob); }; #endif // DEPTHSLICER_H
ddc629b4fd68b49e07afcdd153dd09bf6a5d4360
fed8c15ca511de80625fcd20e172a043fa2897ed
/include/roboteam_utils/Triangle.h
6eeac138008a622e8772f62a4d88c61df5b583d1
[]
no_license
RoboTeamTwente/roboteam_utils
941df3a07ce0c2951ce3151eafe9ab77e0d7eded
10c951b6102c15928b08d1a8441f54fb7f261933
refs/heads/development
2022-11-10T23:39:46.689896
2022-07-09T17:36:10
2022-07-09T17:36:10
69,015,550
0
2
null
2022-07-09T17:36:11
2016-09-23T10:38:34
C++
UTF-8
C++
false
false
2,603
h
Triangle.h
// // Created by rolf on 24-01-20. // #ifndef RTT_TRIANGLE_H #define RTT_TRIANGLE_H #include "Vector2.h" namespace rtt { class LineSegment; class Line; /** * @author rolf * @date 28 January 2020 * @brief A class that describes a triangle and some useful functions on it. */ class Triangle { public: /** * @brief Construct a triangle from 3 points * @param point1 First point * @param point2 Second point * @param point3 Third point */ Triangle(const Vector2 &point1, const Vector2 &point2, const Vector2 &point3); /** * The three points that define the corners of the triangle */ Vector2 corner1; Vector2 corner2; Vector2 corner3; /** * @brief Checks whether a point is inside or on the boundary of the triangle * @param point * @return True if point is inside or on the boundary of the triangle */ [[nodiscard]] bool contains(const Vector2 &point) const; /** * @brief Get the area of the triangle * @return The area of the triangle */ [[nodiscard]] double area() const; /** * @brief Get the boundary lines of the triangle * @return A vector containing the 3 line segments that define the boundary of the triangle */ [[nodiscard]] std::vector<LineSegment> lines() const; /** * @brief Get the corners of the triangle * @return A vector containing the 3 corners of the triangle */ [[nodiscard]] std::vector<Vector2> corners() const; /** * @brief Get the intersection points of the line and triangle. * @param line line to check intersections for * @return A vector with all the intersection points. May have duplicate corner points. */ [[nodiscard]] std::vector<Vector2> intersects(const LineSegment &line) const; /** * @brief Get the intersection points of the line and triangle. * @param line line to check intersections for * @return A vector with all the intersection points. May have duplicate corner points. */ [[nodiscard]] std::vector<Vector2> intersects(const Line &line) const; /** * @brief checks if the line intersects with the triangle * @param line * @return True if the line intersects with the triangle */ [[nodiscard]] bool doesIntersect(const LineSegment &line) const; /** * @brief checks if the line intersects with the triangle * @param line * @return True if the line intersects with the triangle */ [[nodiscard]] bool doesIntersect(const Line &line) const; }; } // namespace rtt #endif // RTT_TRIANGLE_H
20c23277043871b27ac1abade61c1fbea8a5e387
6e665dcd74541d40647ebb64e30aa60bc71e610c
/600/VoipLib/sipstack/BaseUser.cxx
fdd042e8c50458c030962b4c469d4740c0a5f808
[]
no_license
jacklee032016/pbx
b27871251a6d49285eaade2d0a9ec02032c3ec62
554149c134e50db8ea27de6a092934a51e156eb6
refs/heads/master
2020-03-24T21:52:18.653518
2018-08-04T20:01:15
2018-08-04T20:01:15
143,054,776
0
0
null
null
null
null
UTF-8
C++
false
false
427
cxx
BaseUser.cxx
/* * $Id: BaseUser.cxx,v 1.3 2007/03/03 18:38:55 lizhijie Exp $ */ #include "global.h" #include "BaseUser.hxx" using namespace Vocal; BaseUser::BaseUser() { } BaseUser::~BaseUser() { } bool Vocal::operator<(const Sptr<BaseUser>& left, const Sptr<BaseUser>& right) { if (left == 0 && right == 0) return false; else if (left == 0) return true; else return left->isLessThan(right); }
6c2d9791761c3d60493cf7ccae5aab1568fd4355
55119c9e9307f5079eb006b5c84e8c92f481366e
/Eggplant.h
70dcef1b8ef1f262a12a73dae3536d2b4437bfe1
[]
no_license
elisionJL/sp1
91e226e0a6dbc1dc89b0f43267a6b5b8f31b92af
f2ea7bf58c5ee1eb5258c8ad7e27eba75c7be6ba
refs/heads/main
2023-07-18T15:32:38.751888
2021-08-26T19:07:02
2021-08-26T19:07:02
396,563,885
0
0
null
null
null
null
UTF-8
C++
false
false
171
h
Eggplant.h
#pragma once #include "Entity.h" class Eggplant : public Entity { public: Eggplant(int x); string getMoveName(int MoveNo); int skill(int x); ~Eggplant(); };
6de9d093036b16e1e55a494e43d38fd95c5b2b1d
244645ab3d369814d4517227a61bfe5f86a76701
/src/NJR/Implementation/LinearProgramming.cpp
fc1dee134b6f96c707bb5f7dc8686887e4005362
[]
no_license
tectronics/vedo
15ed46edf050bba4a51dbd0cb2c913fc1aeb3946
0c3dd2c0d3917bf9d7455ed65f98a387a4e909ff
refs/heads/master
2018-01-11T15:03:26.121307
2013-04-10T04:59:53
2013-04-10T04:59:53
49,370,464
0
0
null
null
null
null
UTF-8
C++
false
false
13,053
cpp
LinearProgramming.cpp
#include <NJR/Interfaces/LinearProgramming.h> #include <NJR/Interfaces/RandomGenerator.h> #include <algorithm> #include <cstdio> #include <cstring> #include <functional> namespace njr { Vector3d BMvector(1e6, 1e6, 1e6); void LinearProgramming::Clear() { cols = 0; rows = 0; num_m = 0; num_s = 0; nbas = 0; _checked = false; _feasiable = false; _polygon = false; if (kid != 0) { delete [] kid; kid = 0; } if (basis != 0) { delete [] basis; basis = 0; } if (nbasis != 0 ) { delete [] nbasis; nbasis = 0; } }; bool LinearProgramming::PurgeArtificialVariable() { if (_checked == false) { LinearProgramming::Check(); } if (_feasiable == false) { return false; } std::vector<unsigned int> NewNbasis; for (unsigned int i=0; i<nbas; i++) { if (kid[nbasis[i]] != 'M') { NewNbasis.push_back(nbasis[i]); } } delete nbasis; nbasis = new unsigned int[NewNbasis.size()]; for (unsigned int i=0; i< NewNbasis.size(); i++) { nbasis[i]=NewNbasis[i]; } // rows unchange // num_s unchange nbas -= num_m; cols -= num_m; num_m = 0; return true; }; double LinearProgramming::GetObjValue() { Matrix BIA(rows, 1); Matrix RCOST(1, cols); Matrix XBASIS(rows, 1); Matrix E(rows, rows); Matrix rhsmemo = rhs; RandomGenerator random; double objval; double ch [2]; unsigned int i; unsigned int temp; unsigned int pxin; unsigned int pxout; unsigned int cuti = 0; for (i=0; i<rows; ++i) { rhs(i, 0) = rhs(i, 0) * ( 1.0 + random(1e-9, -1e-9) ); } while ( (++cuti) < (nbas*5) ) { XBASIS = BI * rhs; objval = ( obj.Select(basis, rows) * XBASIS ) (0, 0); RCOST = ( obj.Select(basis,rows) * BI * A.Select(nbasis,nbas) ) - obj.Select(nbasis,nbas); for (i=0; i<nbas; ++i) { pxin = i; if (RCOST(0,i) < 0.0) { break; } } if (i == nbas) { break; } BIA = BI * A.Select(nbasis+pxin ,1); ch[0] = 1e24; for (i=0; i<rows; ++i) { if(BIA(i,0) == 0.0) { ch[1] = 1e24; } else { ch[1] = XBASIS(i,0) / BIA(i,0); } if ( (ch[1] > 0) && (ch[1] < ch[0]) ) { ch[0] = ch [1]; pxout = i; } } temp = basis[pxout]; basis[pxout] = nbasis[pxin]; nbasis[pxin] = temp; E = 1; for (i=0; i<rows; ++i) { if (i != pxout) { E(i, pxout) = - BIA(i,0) / BIA(pxout, 0); } else { E(i, pxout) = 1.0 / BIA(pxout, 0); } } BI = E * BI; } rhs = rhsmemo; XBASIS = BI * rhs; objval = ( obj.Select(basis, rows) * XBASIS ) (0, 0); return objval; }; void LinearProgramming::Allocation() { kid = new char[cols]; basis = new unsigned int [rows]; nbasis = new unsigned int [nbas]; obj.Resize(1,cols); A.Resize(rows,cols); rhs.Resize(rows,1); BI.Resize(rows,rows); }; LinearProgramming::LinearProgramming() { cols = 0; rows = 0; num_m = 0; num_s = 0; nbas = 0; _checked = false; _feasiable = false; _polygon = false; kid = 0; basis = 0; nbasis = 0; }; LinearProgramming::LinearProgramming(const LinearProgramming &lp) { cols = lp.cols; rows = lp.rows; num_m = lp.num_m; num_s = lp.num_s; nbas = lp.nbas; LinearProgramming::Allocation (); _checked = lp._checked; _feasiable = lp._feasiable; _polygon = lp._polygon; memcpy(kid, lp.kid, sizeof(char) * cols); memcpy(basis, lp.basis, sizeof(unsigned int) * rows); memcpy(nbasis, lp.nbasis , sizeof(unsigned int) * nbas); obj = lp.obj; rhs = lp.rhs; BI = lp.BI; A = lp.A; }; LinearProgramming::~LinearProgramming() { LinearProgramming::Clear(); }; const LinearProgramming& LinearProgramming::operator = (const LinearProgramming& lp) { LinearProgramming::Clear(); cols = lp.cols; rows = lp.rows; num_m = lp.num_m; num_s = lp.num_s; nbas = lp.nbas ; LinearProgramming::Allocation (); _checked = lp._checked; _feasiable = lp._feasiable; _polygon = lp._polygon; memcpy(kid , lp.kid , sizeof(char) * cols); memcpy(basis , lp.basis , sizeof(unsigned int) * rows); memcpy(nbasis, lp.nbasis, sizeof(unsigned int) * nbas); obj = lp.obj; rhs = lp.rhs; BI = lp.BI; A = lp.A; return *this; }; void LinearProgramming::Set(const njr::NJRpolyhedra &a) { LinearProgramming::Clear(); register unsigned int number; register unsigned int i; register unsigned int m; register unsigned int s; unsigned int n; unsigned int b; std::vector<njr::HalfSpace> vchf = a.constrains(); for (i=0; i<vchf.size(); ++i) { vchf[i].Translate(BMvector); } for_each (vchf.begin(), vchf.end(), std::mem_fun_ref(&njr::HalfSpace::AbsRhs)); number = (unsigned int) vchf.size(); for(i=0; i< number ; ++i) { switch ( vchf[i].sense() ) { case L: ++num_s; break; case G: ++num_m; ++num_s; break; case E: ++num_m; break; } } rows = number; cols = 3 + num_m + num_s; nbas = cols - rows; LinearProgramming::Allocation(); for (i=0; i<3; i++) { kid[i] = 'P'; obj(0,i) = 0.0; } for (; i<3+num_s; i++) { kid[i] = 'S'; obj(0,i) = 0.0; } for (; i<cols; i++) { kid[i] = 'M'; obj(0,i) = -2.0; } nbasis [0] = 0; nbasis [1] = 1; nbasis [2] = 2; for (i=0 , m=3+num_s , s=3 , n=3 , b=0 ; i < number ; ++i) { A(i, 0)= vchf[i].a(); A(i, 1)= vchf[i].b(); A(i, 2)= vchf[i].c(); rhs(i, 0) = vchf[i].d(); switch ( vchf[i].sense() ) { case G: nbasis[n] = s; basis[b] = m; A(i,s) = -1.0; A(i,m) = 1.0; n++; b++; s++; m++; break; case E: basis[b] = m; A(i,m) = 1.0; b++; m++; break; case L: basis[b] = s; A(i,s) = 1.0; b++; s++; break; } } }; bool LinearProgramming::Check() { if (_checked) { return _feasiable; } Matrix BIA(rows, 1); Matrix RCOST(1, cols); Matrix XBASIS(rows, 1); Matrix E(rows, rows); Matrix rhsmemo = rhs; double objval; double ch [2]; unsigned int i; unsigned int temp; // Counter of iterationis unsigned int cuti = 0; /************************************************************************** * The pointer of the variable is selected from nonbasis set and will be * put into basis set in next iteration. **************************************************************************/ unsigned int pxin; /************************************************************************** * The pointer of the variable is selected from basis set and will be put * into nonbasis set in next iteration. **************************************************************************/ unsigned int pxout; RandomGenerator random(2000); for (i=0; i<rows; ++i) { rhs(i, 0) = rhs(i, 0) * (1.0 + random(1e-9, -1e-9) ); } BI = 1.0; while ( (++cuti) < (nbas*5) ) { /********************************************************************** * Calculate the feasiable solution and objective value in this * iteration. **********************************************************************/ XBASIS = BI * rhs; objval = (obj.Select(basis, rows) * XBASIS) (0,0); if ( objval >= 0 ) { break; } /********************************************************************** * 1. calculate the reduce cost (RCOST) of each non-basis variable and * make sue if all RCOSTS >= 0. * 2. If all RCOST >= 0 , the feasiable solution in the iteration is * the optimum solution of this stdlp. * 3. Select one non-basis variable whoese RCOST < 0 into basis set in * next iteration. **********************************************************************/ RCOST = (obj.Select(basis,rows) * BI * A.Select(nbasis,nbas)) - obj.Select(nbasis,nbas); for (i=0; i<nbas; ++i) { pxin = i; if (RCOST(0,i) < 0.0) { break; } } if (i == nbas) { break; } // Select one basis variable into nonbasis set BIA = BI * A.Select(nbasis+pxin, 1); ch[0] = 1e24; for (i=0; i<rows; ++i) { if(BIA(i,0) == 0.0) { ch[1] = 1e24; } else { ch[1] = XBASIS(i,0) / BIA(i,0); } if ( (ch[1] > 0) && (ch[1] < ch[0]) ) { ch[0] = ch[1]; pxout = i; } } // Swap the variable of basis and the variable of non-basis selected if (pxout > rows) { throw 0.0; return false; } temp = basis[pxout]; basis[pxout] = nbasis[pxin]; nbasis[pxin] = temp; // Calculte new BI E = 1; for (i=0; i<rows; ++i) { if (i != pxout) { E(i, pxout) = - BIA(i,0) / BIA(pxout,0); } else { E(i, pxout) = 1.0 / BIA(pxout,0) ; } } BI = E * BI; } _checked = true; _feasiable = (objval == 0 ) ? true : false; temp = 0; for (i=0; i<nbas; ++i) { if ((kid[nbasis[i]] == 'S') || (kid[nbasis[i]] == 'P')) { temp++; } } _polygon = (temp==2) ? true : false; rhs = rhsmemo; return _feasiable; }; void LinearProgramming::print () const { register unsigned int i; std::cout << ((_checked) ? "checked " : "unchecked " ); std::cout << ((_feasiable) ? "feasiable " : "infeasiable " ); std::cout << ((_polygon) ? "This is a polygon " : "This is not polygon "); std::cout << std::endl; printf("\nbasis\n"); for (i=0; i<rows; ++i) { printf ( (i%5==4) ? "[%3d %c]\n" : "[%3d %c] ", basis[i], kid[basis[i]]); } printf("\nnonbasis\n"); for (i=0; i<nbas; ++i) { printf ( (i%5==4) ? "[%3d %c]\n" : "[%3d %c]", nbasis[i], kid[nbasis[i]]); } printf ("\n"); }; NJRpolygon LinearProgramming::GetPolygon() { std::vector<Vector3d>vertexes(0); if (_polygon==false) { return NJRpolygon(vertexes); } Matrix BIA(rows, 1); Matrix XBASIS(rows, 1); Matrix X(rows, 1); Matrix E(rows, rows); Matrix rhsmemo = rhs; unsigned int i; unsigned int num_ans; unsigned int temp; double ch[2]; /************************************************************************** * There should be only two non-basis variables that is not artiffical * variables,if all feasible solutions of this problems are on the same * plane. **************************************************************************/ const unsigned max_ans = (rows-1) * (rows-2) / 2; unsigned int nonbasis[3]; unsigned int inibasis[2]; /************************************************************************** * The pointer of the variable is selected from nonbasis set and will be * put into basis set in next iteration. **************************************************************************/ unsigned int pxout=0; RandomGenerator random(2000); for (i=0; i<rows; ++i) rhs(i, 0) = rhs(i, 0) * ( 1.0 + random(1e-9, -1e-9) ); /************************************************************************** * Select and record the only two non-basis variables that is not * artiffical varisable **************************************************************************/ for(temp=0, i=0 ;i<nbas; ++i) { if ( (kid[nbasis[i]] == 'S') || (kid[nbasis[i]] == 'P') ) { inibasis[temp]=nbasis[i]; temp++; } } nonbasis[1]=inibasis[0]; nonbasis[2]=inibasis[1]; for (num_ans=0; num_ans<max_ans; num_ans++) { XBASIS = BI * rhs; X = BI * rhsmemo; double x = 0.0; double y = 0.0; double z = 0.0; for(i=0; i<rows ;i++) { switch(basis[i]) { case 0: x = X(i,0); break; case 1: y = X(i,0); break; case 2: z = X(i,0); break; } } vertexes.push_back(Vector3d(x,y,z) - BMvector); BIA = BI * (A.Select(nonbasis + 2 ,1)); ch[0] = 1e24; for (i=0; i<rows ;++i) { ch[1] = (BIA(i,0)==0.0) ? 1e24 : XBASIS(i,0)/BIA(i,0); if ((ch[1] > 0) && (ch[1] < ch[0])) { ch[0] = ch [1] ; pxout = i; } } nonbasis[0] = basis[pxout]; basis[pxout] = nonbasis[2]; if ( (inibasis[0] == nonbasis[0]) && (inibasis[1] == nonbasis[1]) ) { break; } nonbasis[2] = nonbasis[1]; nonbasis[1] = nonbasis[0]; E = 1.0; for (i=0; i<rows; ++i) { E(i, pxout) = (i!=pxout) ? (-BIA(i,0)/BIA(pxout,0)) : (1.0/BIA(pxout,0)); } BI = E * BI; } rhs = rhsmemo; return NJRpolygon(vertexes); }; bool LinearProgramming::GetExtremeValue (double& maxX, double& minX, double& maxY, double& minY, double& maxZ, double& minZ) { if (LinearProgramming::PurgeArtificialVariable() == false) { return false; } obj(0,0) = 1.0; maxX = LinearProgramming::GetObjValue() - BMvector % njrdxf::AXIALX; obj(0,0) = -1.0; minX = -LinearProgramming::GetObjValue() - BMvector % njrdxf::AXIALX; obj(0,0) = 0.0; obj(0,1) = 1.0; maxY = LinearProgramming::GetObjValue() - BMvector % njrdxf::AXIALY; obj(0,1) = -1.0; minY = -LinearProgramming::GetObjValue() - BMvector % njrdxf::AXIALY; obj(0,1) = 0.0; obj(0,2) = 1.0; maxZ = LinearProgramming::GetObjValue() - BMvector % njrdxf::AXIALZ; obj(0,2) = -1.0; minZ = -LinearProgramming::GetObjValue() - BMvector % njrdxf::AXIALZ; obj(0,2) = 0.0; return true; }; }; // namespace NJR
ebdf9be9c5c600b7854cd220a904ee81d3e594ed
2db8f4cf0b447c5d416de489a3e7dedbe754a19c
/Largest Number.cpp
2d77c68ab3a8afc7e6008a0708090e7cacba2028
[]
no_license
Arka0101/hacktoberfest2021
1172b0c51b505a46be664a29c6b33cdbc6f0cb8f
5b2e4363f5d4ede295d590ecd4a02d4ad372c44a
refs/heads/master
2023-09-01T01:05:31.920534
2021-10-22T19:59:58
2021-10-22T19:59:58
null
0
0
null
null
null
null
UTF-8
C++
false
false
663
cpp
Largest Number.cpp
class Solution { public: bool static comp(string a,string b) { string ab=a.append(b); string ba=b.append(a); return ab>ba; } string largestNumber(vector<int>& nums) { int i,n=nums.size(); vector<string>str; string ans=""; for(i=0;i<n;i++) { str.push_back(to_string(nums[i])); } sort(str.begin(),str.end(),comp); for(i=0;i<n;i++) { ans=ans+str[i]; } int j=0; while(ans[j]=='0') { ans.erase(j); } if(ans=="")return "0"; return ans; } };
352d7afbe4e15626392523a7b08f881a04815509
4da077fa6d07a889dee67a7d76cba21bfa8a8107
/HW#4/analysis/Bucket.h
1eff2903f265dc73d6aee0a858e496ca1dcec81a
[]
no_license
ChaseGregoryCS/DataStructures-College
b6db6ef320e4d8743aec2252c675a548ffb27128
656a77e0cc01a032ffa261ca2a02941247256a27
refs/heads/master
2020-03-09T22:08:56.724100
2018-04-11T04:03:14
2018-04-11T04:03:14
129,027,520
0
0
null
null
null
null
UTF-8
C++
false
false
2,150
h
Bucket.h
#ifndef _BKT_ #define _BKT_ #include <iostream> using namespace std; class Bucket{ public: struct node; typedef node* Link; struct node{ int data; Link next; Link prev; }; //Constructors Bucket(); Bucket(const Bucket& otherBucket); //Destructor ~Bucket(); /* narrative: Gets the mazimum number of each node in the list pre: Initalized bucket exists post: return maximum number */ int GetMax(); /* narrative: Gets the minimum number of each node in the list pre: Initalized bucket exists post: return minimum number */ int GetMin(); /* narrative: Gets the length of the List pre: Initalized list post: Observer */ int Length() const; /* narrative: inserts data in unsorted order pre: Initalized bucket exists post: length + 1 and new member exists in the list */ void Insert(int data); /* narrative: inserts data in sorted order pre: Initalized bucket exists post: length + 1 and new member exists in the list */ void SortedInsert(int data); /* narrative:deletes the last item in the list pre: Initalized bucket exists post: length - 1 and last element is deleted */ bool DeleteLast(); //Print Method void PrintBucket(); int Find(int what); protected: Link HeadAddress() const; private: // Helper Methods void DeleteMe(); void CopyStuff(const Bucket& otherBucket); //DataMemebers Link head; Link tail; Link iter; int length; }; #endif
a87daa051c4112412a07960296a159c4907f86d5
9c36c37eb161f2735c12fefba851e60ed28065ef
/20180517/223.cpp
11aed8c33e9809ba755cc7ea17413bff3f0a3de7
[]
no_license
Const5215/Leetcode
945165605bc4370e77d19989dc0801cc9a87abb8
631f99962f0054434bacd54fea5c6b53083c0468
refs/heads/master
2021-08-07T09:57:16.940144
2018-09-17T18:13:51
2018-09-17T18:13:51
130,818,051
0
0
null
null
null
null
UTF-8
C++
false
false
437
cpp
223.cpp
class Solution { public: int computeArea(int A, int B, int C, int D, int E, int F, int G, int H) { long long a = A, b = B, c = C, d = D, e = E, f = F, g = G, h = H; long long res = (c-a)*(d-b)+(g-e)*(h-f); long long Lx = max(a,e), Rx = min(c,g), Ly = max(b,f), Ry = min(d,h); long long dex = 0; if (Lx < Rx && Ly < Ry) dex = (Rx-Lx)*(Ry-Ly); return (int)(res-dex); } };
d61c694b6fdb3dc71e29c818a3278f13ae5e14f3
58c26741735a42db49985609217afae81fed0fd2
/tcp_server/ios_exception_timer.cpp
d7e24b6f5c754aff7243b0f091e81865a81f3b79
[]
no_license
alortimor/c-_tests
aef68003a66ea4c9b6e17674c6c787f9cb35c8cd
3238ec0418de601addb143a2ce0979368ddcb6ba
refs/heads/master
2020-08-05T08:40:46.561214
2019-10-03T00:21:02
2019-10-03T00:21:02
212,467,467
1
0
null
null
null
null
UTF-8
C++
false
false
2,074
cpp
ios_exception_timer.cpp
#include <boost/asio.hpp> #include <boost/shared_ptr.hpp> #include <boost/thread.hpp> #include <boost/bind.hpp> #include <mutex> #include <thread> #include <iostream> std::mutex mx; void work_thread(boost::shared_ptr<boost::asio::io_service> ios, int cnt) { // Ensure lock each time a cout is performed mx.lock(); std::cout << "Thread " << cnt << " Start.\n"; mx.unlock(); while(true) { try { boost::system::error_code ec; ios->run(ec); if (ec) { mx.lock(); std::cout << "Error Message: " << ec << ".\n"; mx.unlock(); } break; } catch(std::exception &ex) { mx.lock(); std::cout << "Exception Message: " << ex.what() << ".\n"; mx.unlock(); } } mx.lock(); std::cout << "Thread " << cnt << " End.\n"; mx.unlock(); } void throw_exception(boost::shared_ptr<boost::asio::io_service> ios) { mx.lock(); std::cout << "Throw Error\n" ; mx.unlock(); ios->post(boost::bind(&throw_exception, ios)); throw(std::runtime_error("ERROR")); } void better_late_than_never(const boost::system::error_code & ec) { if(ec) { mx.lock(); std::cout << "Error Message: " << ec << ".\n"; mx.unlock(); } else { mx.lock(); std::cout << "Text appears after 10 seconds.\n"; std::cout << "Enter to exit.\n"; mx.unlock(); } } void print_number(int number) { std::cout << "Number: " << number << std::endl; } int main(void) { boost::shared_ptr<boost::asio::io_service> ios (new boost::asio::io_service); boost::shared_ptr<boost::asio::io_service::work> worker (new boost::asio::io_service::work(*ios)); mx.lock(); std::cout << "Program will exit once all work has completed.\n"; mx.unlock(); boost::thread_group threads; for(int i=1; i<=3; i++) threads.create_thread(boost::bind(&work_thread, ios, i)); boost::asio::deadline_timer timer(*ios); timer.expires_from_now(boost::posix_time::seconds(10)); timer.async_wait(better_late_than_never); std::cin.get(); ios->stop(); threads.join_all(); return 0; }
fd6b5f65cd28bf5da3bdf3a8ce3f026ccb8d14f9
b4aace2a192d7289b769a9d0a1560ab2e2534094
/src/VoxelCube/ofNoisyLayers.cpp
0b420a993b8afbc3fed8b727493b4923ed5b4ba5
[ "MIT" ]
permissive
FilipePires98/ofCreativeCoding
e267a6509fad2f1f7a2e3bc27b26320fd165a003
d9a7217d9a80cfb2283454e7d29ae2cd5460c001
refs/heads/main
2023-05-30T18:01:48.750477
2021-06-10T21:23:18
2021-06-10T21:23:18
367,112,327
2
0
null
null
null
null
UTF-8
C++
false
false
5,866
cpp
ofNoisyLayers.cpp
#include "ofNoisyLayers.h" //-------------------------------------------------------------- void ofNoisyLayers::setup() { ofSetWindowTitle("Voxel Cube - Noisy Layers"); ofSetFrameRate(60); // change application's framerate ofBackground(255); // change background color (value between 0 and 255) ofEnableDepthTest(); this->frame.setMode(ofPrimitiveMode::OF_PRIMITIVE_LINES); } //-------------------------------------------------------------- void ofNoisyLayers::update() { this->face.clear(); this->frame.clear(); auto span = 30; // change size of small cubes ofColor face_color, frame_color; // change values of x,y,z on each loop to create different patterns for (int x = -300; x <= 300; x += span) { for (int y = -300; y <= 300; y += span) { for (int z = -300; z <= 300; z += span) { auto max = std::max({ abs(x), abs(y), abs(z) }); auto noise_value = ofNoise(glm::vec4(x * 0.005, y * 0.005, z * 0.005, ofGetFrameNum() * 0.02)); if (noise_value > ofMap(max, 180, 300, 0.1, 0.55)) { face_color = ofColor(ofMap(max, 180, 300, 239, 39)); // change small cubes' colors frame_color = ofColor(255); this->setBoxToMesh(this->face, this->frame, glm::vec3(x, y, z), span, face_color, frame_color); } } } } } //-------------------------------------------------------------- void ofNoisyLayers::draw() { this->cam.begin(); ofRotateX(ofGetFrameNum() * 0.37); ofRotateY(ofGetFrameNum() * 0.72); this->face.draw(); this->frame.drawWireframe(); this->cam.end(); } //-------------------------------------------------------------- void ofNoisyLayers::setBoxToMesh(ofMesh& face_target, ofMesh& frame_target, glm::vec3 location, float size, ofColor face_color, ofColor frame_color) { this->setBoxToMesh(face_target, frame_target, location, size, size, size, face_color, frame_color); } //-------------------------------------------------------------- void ofNoisyLayers::setBoxToMesh(ofMesh& face_target, ofMesh& frame_target, glm::vec3 location, float height, float width, float depth, ofColor face_color, ofColor frame_color) { int index = face_target.getVertices().size(); face_target.addVertex(location + glm::vec3(width * -0.5 * 0.99, height * 0.5 * 0.99, depth * -0.5 * 0.99)); face_target.addVertex(location + glm::vec3(width * 0.5 * 0.99, height * 0.5 * 0.99, depth * -0.5 * 0.99)); face_target.addVertex(location + glm::vec3(width * 0.5 * 0.99, height * 0.5 * 0.99, depth * 0.5 * 0.99)); face_target.addVertex(location + glm::vec3(width * -0.5 * 0.99, height * 0.5 * 0.99, depth * 0.5 * 0.99)); face_target.addVertex(location + glm::vec3(width * -0.5 * 0.99, height * -0.5 * 0.99, depth * -0.5 * 0.99)); face_target.addVertex(location + glm::vec3(width * 0.5 * 0.99, height * -0.5 * 0.99, depth * -0.5 * 0.99)); face_target.addVertex(location + glm::vec3(width * 0.5 * 0.99, height * -0.5 * 0.99, depth * 0.5 * 0.99)); face_target.addVertex(location + glm::vec3(width * -0.5 * 0.99, height * -0.5 * 0.99, depth * 0.5 * 0.99)); face_target.addIndex(index + 0); face_target.addIndex(index + 1); face_target.addIndex(index + 2); face_target.addIndex(index + 0); face_target.addIndex(index + 2); face_target.addIndex(index + 3); face_target.addIndex(index + 4); face_target.addIndex(index + 5); face_target.addIndex(index + 6); face_target.addIndex(index + 4); face_target.addIndex(index + 6); face_target.addIndex(index + 7); face_target.addIndex(index + 0); face_target.addIndex(index + 4); face_target.addIndex(index + 1); face_target.addIndex(index + 4); face_target.addIndex(index + 5); face_target.addIndex(index + 1); face_target.addIndex(index + 1); face_target.addIndex(index + 5); face_target.addIndex(index + 6); face_target.addIndex(index + 6); face_target.addIndex(index + 2); face_target.addIndex(index + 1); face_target.addIndex(index + 2); face_target.addIndex(index + 6); face_target.addIndex(index + 7); face_target.addIndex(index + 7); face_target.addIndex(index + 3); face_target.addIndex(index + 2); face_target.addIndex(index + 3); face_target.addIndex(index + 7); face_target.addIndex(index + 4); face_target.addIndex(index + 4); face_target.addIndex(index + 0); face_target.addIndex(index + 3); frame_target.addVertex(location + glm::vec3(width * -0.5, height * 0.5, depth * -0.5)); frame_target.addVertex(location + glm::vec3(width * 0.5, height * 0.5, depth * -0.5)); frame_target.addVertex(location + glm::vec3(width * 0.5, height * 0.5, depth * 0.5)); frame_target.addVertex(location + glm::vec3(width * -0.5, height * 0.5, depth * 0.5)); frame_target.addVertex(location + glm::vec3(width * -0.5, height * -0.5, depth * -0.5)); frame_target.addVertex(location + glm::vec3(width * 0.5, height * -0.5, depth * -0.5)); frame_target.addVertex(location + glm::vec3(width * 0.5, height * -0.5, depth * 0.5)); frame_target.addVertex(location + glm::vec3(width * -0.5, height * -0.5, depth * 0.5)); frame_target.addIndex(index + 0); frame_target.addIndex(index + 1); frame_target.addIndex(index + 1); frame_target.addIndex(index + 2); frame_target.addIndex(index + 2); frame_target.addIndex(index + 3); frame_target.addIndex(index + 3); frame_target.addIndex(index + 0); frame_target.addIndex(index + 4); frame_target.addIndex(index + 5); frame_target.addIndex(index + 5); frame_target.addIndex(index + 6); frame_target.addIndex(index + 6); frame_target.addIndex(index + 7); frame_target.addIndex(index + 7); frame_target.addIndex(index + 4); frame_target.addIndex(index + 0); frame_target.addIndex(index + 4); frame_target.addIndex(index + 1); frame_target.addIndex(index + 5); frame_target.addIndex(index + 2); frame_target.addIndex(index + 6); frame_target.addIndex(index + 3); frame_target.addIndex(index + 7); for (int i = 0; i < 8; i++) { this->face.addColor(face_color); this->frame.addColor(frame_color); } }
32851167ff5aad36fdaeabd7a97289cd161bfa7d
b1dc77585ae059a969a632ad17370e9dd82f7366
/SourceCode/NarratorOfWindows.WindowsHelper/LogicalLayer/now.core/action/common/NowActionEnter.cpp
8e787bcfa80fbb28dc5d13ccd69a701817d87019
[]
no_license
chienphan/narrator-of-windows
e93954a2869ad99c6dc2b7167457c8e2f143c535
8a49870ad4d10e8226254a2825c98860352e673c
refs/heads/master
2020-05-26T21:18:41.959937
2014-06-20T17:07:48
2014-06-20T17:07:48
37,664,702
0
0
null
null
null
null
UTF-8
C++
false
false
1,791
cpp
NowActionEnter.cpp
#include "NowActionEnter.h" #include "NowStorage.h" #include "NowLogger.h" #include "NowStringProcessor.h" #include "NowDeviceMouse.h" #include "NowDeviceKeyboard.h" #include "NowUtility.h" NowActionEnter::NowActionEnter(void) { } NowActionEnter::~NowActionEnter(void) { } //enter=<window_name>|<control_name>|<content> NOW_RESULT NowActionEnter::prepareArguments(vector<wstring>* argumnents) { NOW_RESULT nResult = NOW_FALSE; m_strWindowName = NowStringProcessor::wstringTostring(argumnents->at(1)); m_strControlname = NowStringProcessor::wstringTostring(argumnents->at(2)); m_strContent = argumnents->at(3); nResult = NowStorage::getInstance()->getWindow(m_strWindowName.c_str(), m_window); if (NOW_SUCCEED(nResult)) { nResult = NowStorage::getInstance()->getControl(m_strControlname.c_str(), m_control); } return nResult; } NOW_RESULT NowActionEnter::doAction() { NOW_RESULT nResult = NOW_FALSE; if (m_window != NULL) { m_window->bringToTop(); } Sleep(500); string strValue;// = ""; if (m_control != NULL) { nResult = m_control->getProperty(NOW_PROP_BOUNDING_RECTANGLE, strValue); if (NOW_SUCCEED(nResult)) { vector<string>* vec = NowStringProcessor::split(strValue, NOW_CHAR_COMMA); if (vec != NULL) { int left = 0; int top = 0; int width = 0; int height = 0; NowUtility::getRectData(vec, left, top, width, height); NowDeviceMouse::clickMouse(left + width / 2, top + height / 2, NowDeviceMouse::getClickType("left")); //Sleep(100); //enter keys NowDeviceKeyboard::sendKey(L"^a"); //Sleep(50); NowDeviceKeyboard::sendKey(L"{DEL}"); //Sleep(50); NowDeviceKeyboard::sendKey(m_strContent); } } } return NOW_OK; }
64be32b8af4384fb6cc5d5f49626f973bfe06ad6
618532b5faa7e66bd7be8586c7522b5eac28d6ce
/main.cpp
36950fa5af16cfea5bdf303b7a8eb7486fb61c9e
[]
no_license
brandonrogers/Sic-XE-Disassembler
861d9ad653de7ea8a7237aeae21cd5712c8ad8ed
dc7fc0f802ba0a2c8222aceea0272264e5cc0a57
refs/heads/master
2016-09-06T02:42:37.069248
2015-04-22T05:51:24
2015-04-22T05:51:24
34,371,483
0
0
null
null
null
null
UTF-8
C++
false
false
182
cpp
main.cpp
/* * File: main.cpp * Author: brandonrogers * * Created on March 10, 2015, 5:00 PM */ using namespace std; /* * */ int main(int argc, char** argv) { return 0; }
0de657bd68cd151ff63f032016e5bd1b039cf607
6c36333ff7c936074d614e1f31c16ae024c29b2e
/map_patterns.cc
c7345a3ca334e3fbd7f57973c70357e2cd2c3c60
[]
no_license
michalspondr/Map-Generator
85fb1b1147a1e8aba4c2572394c14836557b4ea4
dd263a01053688b9408a82f288936d879609f3ce
refs/heads/master
2020-05-29T19:32:40.208469
2011-03-02T23:42:05
2011-03-02T23:42:05
1,430,588
0
0
null
null
null
null
UTF-8
C++
false
false
2,528
cc
map_patterns.cc
#include "map_patterns.h" /** * Fill map with WALL tiles only */ void Wall::fill() { for (unsigned i=0; i < getHeight(); ++i) for (unsigned j=0; j < getWidth(); ++j) field[i][j] = map::WALL; } /** * Randomly fill the map * TODO I need to know how to get the modulo divider number from MapType enum */ void Random::fill() { for (unsigned i=0; i < getHeight(); ++i) for (unsigned j=0; j < getWidth(); ++j) field[i][j] = (map::MapType) (generator.rand() % 3); // how to get enum size? } /** * Cave - we need a continous block of FLOOR type * First we create wall - there is a small chance to create floor. After a floor is luckily created, * it's more probable to create floor tile again. * * Check 8-side around a tile. If the tile is a floor, it's bigger probability to create floor tile again. Et vice versa */ void Cave::fill() { short floorProbability = 10; // 90% probability of wall appearance for (unsigned i=0; i < getHeight(); ++i) for (unsigned j=0; j < getWidth(); ++j) { if (floorTileAround(i,j)) { // there is a floor tile around field[i][j] // so it's bigger chance to create another floor tile // let's say it's 90% if ((generator.rand() % 100) < floorProbability) { // we've got another floor tile field[i][j] = map::FLOOR; floorProbability = 90; } else { // a wall appeared again field[i][j] = map::WALL; floorProbability = 10; } } } //for } /** * Check if there is a floor tile around given coordinates * TODO this should be done in a general way, not just for a Cave class */ bool Cave::floorTileAround(unsigned i, unsigned j) { if (i >= getHeight() || j >= getWidth()) { throw "Index out of map range. "; } // we've got 8 direction to check // 123 // 4 5 // 678 p1: if (i == 0 || j == 0) goto p2; if (field[i-1][j-1] == map::FLOOR) return true; p2: if (i == 0) goto p3; if (field[i-1][j] == map::FLOOR) return true; p3: if (i == 0 || j == getWidth()-1) goto p4; if (field[i-1][j+1] == map::FLOOR) return true; p4: if (j == 0) goto p5; if (field[i][j-1] == map::FLOOR) return true; p5: if (j == getWidth()-1) goto p6; if (field[i][j+1] == map::FLOOR) return true; p6: if (i == getHeight()-1 || j == 0) goto p7; if (field[i+1][j-1] == map::FLOOR) return true; p7: if (i == getHeight()-1) goto p8; if (field[i+1][j] == map::FLOOR) return true; p8: if (i == getHeight()-1 || j == getWidth()-1) return false; if (field[i+1][j+1] == map::FLOOR) return true; return false; }
325ac11392fba62b47549a1319e120427448a8c9
6399c810fccd5ea64f9c74efe98895502d4d9294
/Ex03/Ex03_InsertionSort-Source/file_readers.cpp
e292c380c41a9ea7ebe3337d9b19a8a30c892524
[]
no_license
truongcntn2017/AlgorithmsAndComplexity
0e2da9355b7001fe7f705a091a903cda6520700e
39cf2909530146d59068d5f933f21dcfbfb8343c
refs/heads/master
2022-05-28T17:37:58.234416
2020-05-07T06:35:11
2020-05-07T06:35:11
255,987,975
4
0
null
null
null
null
UTF-8
C++
false
false
314
cpp
file_readers.cpp
#include "file_readers.h" #include <iostream> using namespace std; vector<int> readIntArray(istream& inStream) { vector<int> data; string s; getline(inStream, s); istringstream iss(s); int temp; while (iss.good()) { iss >> temp; data.push_back(temp); } return data; }
3b25dc38f6ea559a63bb20c28a323b997343c083
806a0e71fa40501e2f0edfe62269e8801f187e5c
/Co so du lieu/CodeC/ViDu/g.cpp
57047f2afaa578ed62bf6c967f60fec929b5bdab
[]
no_license
ducthangbui/Learning
1c991a84a27cf6f112f9d2d643eacfdfb0a1de49
5a7acdf0c05e00e4ba736113a075423bf0b967db
refs/heads/master
2020-03-31T13:46:30.180506
2018-10-14T15:18:06
2018-10-14T15:18:06
152,268,559
0
0
null
null
null
null
UTF-8
C++
false
false
197
cpp
g.cpp
#include<stdio.h> #include<math.h> main() { int m,dv; printf("Nhap:"); scanf("%d",&m); int lc=0; int n=fabs(m); while (n!=0) { dv=n%10; n=n/10; if(dv>lc) lc=dv; } printf("%d",lc); }
cb15d5506e0c23995b29638eb74672f1afc1e2c2
1b73955197836915b6fe69cc03b57a88c17e28e2
/part_2_input_and_output/ch_11/problem_16.cpp
52bc9859db3c6848287eba045321e4b2f9bfcce8
[]
no_license
vocasle/principles_and_practice_using_cpp
7213f5914014039d31571562492b202a1bbf59e9
a6e4d0b42373fef419ae2fbf53d6dc39ef76ea31
refs/heads/master
2022-09-16T14:06:21.342871
2022-08-26T15:48:14
2022-08-26T15:48:14
247,622,270
2
0
null
null
null
null
UTF-8
C++
false
false
1,307
cpp
problem_16.cpp
#include "chapter_11.hpp" #include <fstream> #include <algorithm> #include <iomanip> std::vector<double> read_numbers(const std::string& fname) { auto file = std::ifstream{ fname }; if (!file) { file_open_err(fname, FileType::in); } auto numbers = std::vector<double>(); for (auto num = 0.0; file >> num;) { numbers.push_back(num); } if ((file.bad() || file.fail()) && !file.eof()) { error("Failed to read data from file " + fname); } return numbers; } struct Pair { double num; uint32_t cnt; Pair(double num, uint32_t cnt) : num{ num }, cnt{cnt} {} }; void print_numbers(std::vector<double>& nums) { auto prev = 123456789.987654321; auto cnt = 0u; auto occurences = std::vector<Pair>(); std::sort(nums.begin(), nums.end()); for (auto& num : nums) { if (num != prev) { occurences.emplace_back(prev, cnt); prev = num; cnt = 0; } else { ++cnt; } } for (auto& pair : occurences) { std::cout << std::setw(8) << pair.num << '\t' << pair.cnt << '\n'; } } int main() { try { auto in = prompt_filename(FileType::in); auto numbers = read_numbers(in); print_numbers(numbers); } catch (const std::exception& e) { std::cerr << e.what() << '\n'; return -1; } catch (...) { std::cerr << "Unknown exception occured.\n"; return -2; } }
73434f651e35cec5bac4c6dfaccf2821abaaf97b
6099e0ebd8e78311c5e3dfae1a4678c2a4d51873
/3rdParty/rocksdb/6.27/utilities/cassandra/cassandra_compaction_filter.cc
3d49ea0ab7203a3388f3f269246d228bcaf3a5ff
[ "Apache-2.0", "GPL-2.0-only", "BSD-3-Clause", "ICU", "LGPL-2.1-or-later", "OpenSSL", "GPL-1.0-or-later", "Zlib", "MIT", "ISC", "CC0-1.0", "BSL-1.0", "LicenseRef-scancode-autoconf-simple-exception", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "LicenseRef-scancode-pcre", "BSD-...
permissive
vishalbelsare/arangodb
be647e192dd7505a9907263892fe65112ce81d2d
a6bd3ccd6f622fab2a288d2e3a06ab8e338d3ec1
refs/heads/devel
2023-09-05T13:34:28.350423
2021-12-27T07:16:58
2021-12-27T07:16:58
137,596,199
0
0
Apache-2.0
2021-12-28T14:39:52
2018-06-16T16:54:10
C++
UTF-8
C++
false
false
4,082
cc
cassandra_compaction_filter.cc
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. // This source code is licensed under both the GPLv2 (found in the // COPYING file in the root directory) and Apache 2.0 License // (found in the LICENSE.Apache file in the root directory). #include "utilities/cassandra/cassandra_compaction_filter.h" #include <string> #include "rocksdb/slice.h" #include "rocksdb/utilities/object_registry.h" #include "rocksdb/utilities/options_type.h" #include "utilities/cassandra/format.h" #include "utilities/cassandra/merge_operator.h" namespace ROCKSDB_NAMESPACE { namespace cassandra { static std::unordered_map<std::string, OptionTypeInfo> cassandra_filter_type_info = { #ifndef ROCKSDB_LITE {"purge_ttl_on_expiration", {offsetof(struct CassandraOptions, purge_ttl_on_expiration), OptionType::kBoolean, OptionVerificationType::kNormal, OptionTypeFlags::kNone}}, {"gc_grace_period_in_seconds", {offsetof(struct CassandraOptions, gc_grace_period_in_seconds), OptionType::kUInt32T, OptionVerificationType::kNormal, OptionTypeFlags::kNone}}, #endif // ROCKSDB_LITE }; CassandraCompactionFilter::CassandraCompactionFilter( bool purge_ttl_on_expiration, int32_t gc_grace_period_in_seconds) : options_(gc_grace_period_in_seconds, 0, purge_ttl_on_expiration) { RegisterOptions(&options_, &cassandra_filter_type_info); } CompactionFilter::Decision CassandraCompactionFilter::FilterV2( int /*level*/, const Slice& /*key*/, ValueType value_type, const Slice& existing_value, std::string* new_value, std::string* /*skip_until*/) const { bool value_changed = false; RowValue row_value = RowValue::Deserialize( existing_value.data(), existing_value.size()); RowValue compacted = options_.purge_ttl_on_expiration ? row_value.RemoveExpiredColumns(&value_changed) : row_value.ConvertExpiredColumnsToTombstones(&value_changed); if (value_type == ValueType::kValue) { compacted = compacted.RemoveTombstones(options_.gc_grace_period_in_seconds); } if(compacted.Empty()) { return Decision::kRemove; } if (value_changed) { compacted.Serialize(new_value); return Decision::kChangeValue; } return Decision::kKeep; } CassandraCompactionFilterFactory::CassandraCompactionFilterFactory( bool purge_ttl_on_expiration, int32_t gc_grace_period_in_seconds) : options_(gc_grace_period_in_seconds, 0, purge_ttl_on_expiration) { RegisterOptions(&options_, &cassandra_filter_type_info); } std::unique_ptr<CompactionFilter> CassandraCompactionFilterFactory::CreateCompactionFilter( const CompactionFilter::Context&) { std::unique_ptr<CompactionFilter> result(new CassandraCompactionFilter( options_.purge_ttl_on_expiration, options_.gc_grace_period_in_seconds)); return result; } #ifndef ROCKSDB_LITE int RegisterCassandraObjects(ObjectLibrary& library, const std::string& /*arg*/) { library.Register<MergeOperator>( CassandraValueMergeOperator::kClassName(), [](const std::string& /*uri*/, std::unique_ptr<MergeOperator>* guard, std::string* /* errmsg */) { guard->reset(new CassandraValueMergeOperator(0)); return guard->get(); }); library.Register<CompactionFilter>( CassandraCompactionFilter::kClassName(), [](const std::string& /*uri*/, std::unique_ptr<CompactionFilter>* /*guard */, std::string* /* errmsg */) { return new CassandraCompactionFilter(false, 0); }); library.Register<CompactionFilterFactory>( CassandraCompactionFilterFactory::kClassName(), [](const std::string& /*uri*/, std::unique_ptr<CompactionFilterFactory>* guard, std::string* /* errmsg */) { guard->reset(new CassandraCompactionFilterFactory(false, 0)); return guard->get(); }); size_t num_types; return static_cast<int>(library.GetFactoryCount(&num_types)); } #endif // ROCKSDB_LITE } // namespace cassandra } // namespace ROCKSDB_NAMESPACE
64cbeeb426ebbedd9b5c3e00e5104612c0accba2
3d8ed3cc1eeeb85e4c984cf4d010401966d94b6d
/printinitials.cpp
93eb51f097b73e0bb9b1555cdb88c537df561b93
[]
no_license
krishna-mathuria/competitive
805c4ba56e37e7ffa87d749e465a0d4051b2452a
549b6fb7ec849f3082ba06faaff58efba849e18c
refs/heads/main
2023-08-22T07:21:26.260193
2021-10-26T13:32:31
2021-10-26T13:32:31
386,506,918
1
0
null
null
null
null
UTF-8
C++
false
false
398
cpp
printinitials.cpp
class Solution{ public: string firstAlphabet(string S) { // Your code goes here bool fl=1; string ans=""; for(int i=0;i<S.size();i++){ if(S[i]>='a' && S[i]<='z'){ if(fl){ ans+=S[i]; fl=0; } continue; } else{ fl=1; } } return ans; } };
002e9099bd898fd8fc740d4b96f451a21151f2ab
4f0bdeadfac434557fcce81c4f6131b84077cb51
/M1_Chess/Base.h
50a52d239c38244e7f465db509575e54bd5ba9c3
[]
no_license
mirogon/M1_Chess
4710b5ee1d5acafa8c22f094e1dde043654f0c9d
01c9a16dd5735b3b3d1d02fee2e9b8916c8b86a0
refs/heads/master
2020-04-11T15:50:29.672772
2018-12-15T12:57:27
2018-12-15T12:57:27
161,905,004
0
0
null
null
null
null
UTF-8
C++
false
false
717
h
Base.h
#pragma once #include "Global.h" namespace m1 { extern const unsigned int WINDOW_RESOLUTION_X; extern const unsigned int WINDOW_RESOLUTION_Y; #define _GetWindow Base::getInstance()->GetWindow() #define _GetRenderer Base::getInstance()->GetRenderer() class Base { public: //INLINE static Base* getInstance(); SDL_Window* GetWindow(); SDL_Renderer* GetRenderer(); private: Base(); ~Base(); SDL_Window* mainWindow; SDL_Renderer* mainRenderer; }; inline Base* Base::getInstance() { static Base instance; return &instance; } inline SDL_Window* Base::GetWindow() { return mainWindow; }; inline SDL_Renderer* Base::GetRenderer() { return mainRenderer; }; };
6a3f7e03ed15ccf4eb99b21a00fba7465c9a8a92
1155fd18ab7ba098346e23911abbe517dab8643e
/storage/include/filehandler.h
ca08e8aa3315cc76fc0a30cbd79060b483dd3c71
[]
no_license
mamigot/sterling
92dcef210934ff6be1d5368c5ae60ecada723972
f5db9ebf7306bfa1a37bf1e27b9ccb4d7b165150
refs/heads/master
2020-04-11T04:23:03.708945
2016-04-17T16:36:43
2016-04-17T16:36:43
51,568,246
2
0
null
null
null
null
UTF-8
C++
false
false
789
h
filehandler.h
#ifndef FILEHANDLER_H_ #define FILEHANDLER_H_ #include <string> #include <map> #include <vector> #include "config.h" using namespace std; void appendToDataFile(const string& filePath, const string& content); // Iterates through the file backwards and returns an offset (in bytes) of the // first matching entry int itemMatch(const string& filePath, string& dataType, const map<string, string> matchArgs); // Iterates through the file backwards and returns relevant entries vector<string> itemMatchSweep(const string& filePath, string& dataType, map<string, string> matchArgs, int limit); // Iterates through the file backwards and modifies each entry's "active" status int setActiveFlag(bool active, const string& filePath, string& dataType, map<string, string> matchArgs); #endif
8b72f760effa0db3447c81e3d39f857e80a81876
58d87660a72a91373c00f16cd1b8c36cac5e6d8a
/1.cpp
db1c879b82fe92976960d0b222ff18709afc30e8
[]
no_license
RickGrin/Lab4
c489e65c26fb23644c2755e025e360ab6c954cba
08928894898b8edebd02f22d14ac7c936ca31822
refs/heads/master
2022-11-14T00:32:54.741285
2020-06-15T16:26:40
2020-06-15T16:26:40
266,830,105
0
0
null
null
null
null
UTF-8
C++
false
false
594
cpp
1.cpp
 #include "iostream" #include <string.h> #include <conio.h> using namespace std; void Sort(int A[], int N, int i) { if (i < N) { int min = A[i], index = i; for (int j = i + 1; j < N; j++) if (A[j] < min) min = A[j], index = j; A[index] = A[i]; A[i] = min; i++; Sort(A, N, i); } } int main() { int i = 0, N = 6; int* mas = new int[6]{ 9, 7, 5, 3, 1 }; Sort(mas, N, i); for (int j = 0; j < N; j++) cout << mas[j] << " "; _getch(); delete mas; return 0; }
7bd5a225721b0c69e9a57afa9e15fe61c15fc79f
51635684d03e47ebad12b8872ff469b83f36aa52
/external/gcc-12.1.0/libstdc++-v3/testsuite/experimental/propagate_const/swap/lwg3413.cc
8dc13cfebdd4e01cace0db88f130b8b5e4610b7f
[ "LGPL-2.1-only", "GPL-3.0-only", "GCC-exception-3.1", "GPL-2.0-only", "LGPL-3.0-only", "LGPL-2.0-or-later", "Zlib", "LicenseRef-scancode-public-domain" ]
permissive
zhmu/ananas
8fb48ddfe3582f85ff39184fc7a3c58725fe731a
30850c1639f03bccbfb2f2b03361792cc8fae52e
refs/heads/master
2022-06-25T10:44:46.256604
2022-06-12T17:04:40
2022-06-12T17:04:40
30,108,381
59
8
Zlib
2021-09-26T17:30:30
2015-01-31T09:44:33
C
UTF-8
C++
false
false
1,028
cc
lwg3413.cc
// { dg-do compile { target c++14 } } // LWG 3413 // propagate_const's swap's noexcept specification needs to be constrained // and use a trait #include <experimental/propagate_const> using std::experimental::propagate_const; propagate_const<int*> i; static_assert( noexcept(i.swap(i)), "member swap is noexcept" ); static_assert( noexcept(swap(i, i)), "non-member swap is noexcept" ); struct P { int i = 0; int& operator*() const; }; void swap(P&, P&) noexcept(false); propagate_const<P> p; static_assert( ! noexcept(p.swap(p)), "member swap is conditionally noexcept" ); static_assert( ! noexcept(swap(p, p)), "non-member swap is conditionally noexcept" ); // std::is_swappable not available for -std=c++14 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) struct Q { int i = 0; int& operator*() const; Q& operator=(Q&&) = delete; }; static_assert( ! std::is_swappable<Q>::value, "" ); static_assert( ! std::is_swappable<propagate_const<Q>>::value, "non-member swap is constrained" ); #endif
057fad893a2f6b8858bf3726797113e5f3635f5d
c8ae8d1e60147afd8ad3183a29ebd854cd26a0c5
/main.cpp
e22bbbc9b9fec65a53f22bb24a62b73dfda3fc21
[]
no_license
rdecker7/po2-OldTimeyPhoto
40b38c5bfe6f8649ca8f6796b6ea78180a08cf26
5aa4e9f0447e2b632939cda1ae39403947f76e1c
refs/heads/master
2021-07-11T22:22:10.857706
2017-10-17T00:17:07
2017-10-17T00:17:07
105,600,089
0
0
null
null
null
null
UTF-8
C++
false
false
1,618
cpp
main.cpp
//Author: Riley Decker #include<iostream> #include<string> #include "bitmap.h" #include<vector> using namespace std; int main() { //Create Bitmap Bitmap image; Pixel rgb; //Create vector of vector of Pixels vector< vector<Pixel> > bmp; //Collect user input for file name and store string fileName; cout<<"Please input bmp file as 'fileName.bmp'"<<endl; cin>>fileName; //Open bmp file as Bitmap image image.open(fileName); //Check if image is valid bool validBmp=image.isImage(); //Loop if image was valid if (validBmp==1) { bmp=image.toPixelMatrix(); //Create loop to go through each row of pixels and modify them for(int r=0;r<bmp.size();r++) { for(int c=0;c<bmp[r].size();c++) { //Modifying pixels based on rgb values rgb=bmp[r][c]; int avg= (rgb.red+rgb.green+rgb.blue)/3; rgb.red=avg; rgb.green=avg; rgb.blue=avg; bmp[r][c]=rgb; } } //Save the modified image as bmp file image.fromPixelMatrix(bmp); image.save("OldTimey.bmp"); } else { cout<<"Invalid file name, please try again."<<endl; } return 0; }
3482976b63f224581934a5b1034533504f8c8316
d4d2b9b61c28947542b3d0b9a3d84b9031a04d30
/Floor.hpp
ba3d67b32f2c5a429593ac8f4ef8f2713d2dda7d
[]
no_license
DougHughes8906/find-the-thief
7a9d2c484529c027f4e1b1a369b10186f46046e7
6c31e8d26f9f957c1dca85f7265b1efeae2367fa
refs/heads/master
2020-09-19T16:19:40.421724
2019-12-16T17:38:26
2019-12-16T17:38:26
224,244,225
0
0
null
null
null
null
UTF-8
C++
false
false
1,479
hpp
Floor.hpp
/********************************************************************* ** Program name: Floor.hpp ** Author: Doug Hughes ** Date: December 10, 2019 ** Description: Header file for the Floor class. ** Derived class of the Space class. The class is used ** in conjunction with the ThiefGame class to represent ** empty floor spaces in the game. There is no ** special interaction or information associated with ** these empty floor spaces. *********************************************************************/ #ifndef FLOOR_HPP #define FLOOR_HPP #include "Space.hpp" #include <string> class Floor : public Space { private: static const std::string TYPE; public: // Default constructor Floor(); // Returns a string representing the Floor // type. Used to distinguish Floor spaces // from other spaces when a Space pointer is // being used. virtual std::string getType() const override; // Returns the same value as the getType // method but can be used without a specific // object instance. static std::string statType(); // Prints a single character to the console // representing the Floor space. virtual void printSpace() const override; // Performs an event related to the Floor // and returns a string representing the // event. virtual std::string event() override; // Returns information related to the Floor // as a string. No parameters. virtual std::string information() override; }; #endif
9d9330155dc5cfd89a3940b3baad91ac7d92ba34
6b84794b2b0aa23a2d2c3c5f1437001d103213ae
/Problems & Contents/Maratona - Facul/problema_5.cpp
9578d540a11c234fe52a500e1ab474ceb985d216
[]
no_license
mtreviso/university
2406d3782759a75ef00af4da8e4e1ed99cfb89d8
164dbfc13d6dddb3bdbb04957c4702d0e0885402
refs/heads/master
2021-01-09T08:14:21.551497
2016-06-09T23:19:01
2016-06-09T23:19:01
16,703,296
0
2
null
null
null
null
UTF-8
C++
false
false
683
cpp
problema_5.cpp
#include <iostream> #include <iomanip> #include <cstdio> #include <vector> using namespace std; void printVector(vector<int> &v){ int n = v.size(); for(int i=1; i<=n; i++) printf("%d ", v[i]); printf("\n"); } int main(){ int qtd, pos, pulo; int k; cin >> k; while(k--){ cin >> qtd >> pos >> pulo; vector<int> circulo = vector<int>(qtd+1); for(int i=0; i<=qtd; i++) circulo[i]=i; while(circulo.size() > 2){ pos = (pos+pulo-1) % (circulo.size()-1); circulo.erase(circulo.begin()+pos); } printf("%d\n", circulo[0]); } return 0; } /*. 1 - 2 - 3 - 4 - 5 - 6 - 7 2 - 3 - 4 - 5 - 6 - 7 2 - 3 - 4 - 6 - 7 3 - 4 - 6 - 7 3 - 4 - 6 4 - 6 4 */
ef0b6d30925664f856ec9773b25df41376c85ff9
0b63b6248727505008fc7ea5cd21089239c31a5d
/LeafSimilarTrees/CodeClassFile.h
72d40424baaf461841defa32ef569bf69da6e330
[]
no_license
CliffRoberson/LeetCodeProblems
421ffe699459f4e633f9bbd4472cb47788fe4c95
68c7f0c58b3b3d7cddd6be8fa1a1a89e4ecf9630
refs/heads/master
2020-05-07T15:58:42.654878
2019-08-05T20:26:04
2019-08-05T20:26:04
180,642,270
0
0
null
null
null
null
UTF-8
C++
false
false
871
h
CodeClassFile.h
#pragma once #include "../std_lib_facilities.h" struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) {} }; class Solution { public: vector<int> leafSeq1; vector<int> leafSeq2; void getLeafSeq1(TreeNode* root) { if (root == NULL) return; else if (root->left == NULL && root->right == NULL) { leafSeq1.push_back(root->val); } else { getLeafSeq1(root->left); getLeafSeq1(root->right); } } void getLeafSeq2(TreeNode* root) { if (root == NULL) return; else if (root->left == NULL && root->right == NULL) { leafSeq2.push_back(root->val); } else { getLeafSeq2(root->left); getLeafSeq2(root->right); } } bool leafSimilar(TreeNode* root1, TreeNode* root2) { getLeafSeq1(root1); getLeafSeq2(root2); return leafSeq1 == leafSeq2; } };
c3ae1919909ffd8a680f94044b44fb15d0cb118f
cb142edda7a972adb64b011e9ba12bf7204d245c
/Day-1/switchCaluclator.cpp
4d3a76bc2b07216a6c029de45371657dd9c6d123
[]
no_license
amn5277/CODE
31770a4b850365da23ae4c1add83153c9d13b074
335d6ee02a019970fea74424029e8499076326d9
refs/heads/main
2023-05-07T15:34:54.943459
2021-05-28T03:45:07
2021-05-28T03:45:07
364,125,298
0
0
null
2021-05-28T03:45:08
2021-05-04T03:09:37
C++
UTF-8
C++
false
false
532
cpp
switchCaluclator.cpp
#include <iostream> using namespace std; int main(){ int n1,n2; cout<<"Enter Two Numbers:"; cin>>n1>>n2; char input; cout<<"Enter the operation to perform"; cin>>input; switch (input){ case '+': cout<<n1+n2; break; case '-': cout<<n1-n2; break; case '*': cout<<n1*n2; break; case '/': cout<<n1/n2; break; default: cout<<"Invalid Input"; } }
5af44d701a3535ee483d0aeb56c8855ea94d05de
49643ae2ac5449ec9a44f04047081893de1535e8
/DSAndAlgo/HackerRank Problems/TimeConvert.cpp
2569416e96fbbe895ff6a2f3da19c31670d4907e
[]
no_license
Vaibank1/DSAndAlgo
0b224540eb64ae905bdec4a39ea036d779cf4443
1606e5ba2b49e6b7625a517713dbc5b54e0f535f
refs/heads/master
2022-02-20T06:33:18.161853
2019-09-29T07:14:36
2019-09-29T07:14:36
104,919,933
0
0
null
null
null
null
UTF-8
C++
false
false
523
cpp
TimeConvert.cpp
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> #include <string> using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ string str; cin >> str; if (str[str.length() - 2] == 'A') { cout << str.substr(0, str.length() - 2); } else { str.erase(str.length() - 2, 2); int num = stoi(str.substr(0, 2)); num += 12; str[1] = num % 10 + '0'; num /= 10; str[0] = num % 10 +'0'; cout << str; } return 0; }
213df457beaf963f195315230439b284c5cf3fde
96b6ed490eada4e5864000681c587aa7060cf938
/102-Memory/main.cpp
04bcee8460807527cc1c2ab39bd2636326b22ba6
[]
no_license
AlessandroScrem/Qt_samples
f2cdfc7cd858432ee96497f7b64e69c1188fb3b9
5a07b49e10f948dc12ab6dc0720b30e9225af2f2
refs/heads/master
2020-12-04T07:12:06.644337
2020-01-13T18:10:04
2020-01-13T18:10:04
231,672,644
0
0
null
null
null
null
UTF-8
C++
false
false
361
cpp
main.cpp
#include <QCoreApplication> #include "test.h" #include <QPointer> #include "child.h" int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); Test cTest; // use qpointer when class is not qobject parent // you can't pass qobject pointer QPointer<Child> cChild = new Child; cChild->DoSomethings(); return a.exec(); }
a3d820ba146e8e13365544351ecb7f405a13963c
3c2e997ec49bd97a21d3685e088f3d69e2fb48ad
/codeforces/336a.cpp
e6eb823e90c8c1feade7dae57de218b5878948dd
[]
no_license
LGBitencourt/Competitive-Programming
7faa5b2c33ab08a7e79ff1713a3d5731501daccd
609d35a109236278a33f2eb0b5699952c12ce5fa
refs/heads/master
2021-01-17T04:08:04.596355
2017-06-18T22:11:50
2017-06-18T22:11:50
40,277,315
2
0
null
null
null
null
UTF-8
C++
false
false
637
cpp
336a.cpp
#include <bits/stdc++.h> #define pb push_back #define ff first #define ss second using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; const double eps = 1e-9; const int inf = 0x3f3f3f3f; /////////////////0123456789 const int MAXN = 10004; int main() { int x, y, t, xi, yi, xj, yj; scanf(" %d %d", &x, &y); t = abs(x) + abs(y); if (x > 0 && y > 0) xi = yj = 0, yi = xj = t; else if (x < 0 && y > 0) xi = -t, yi = xj = 0, yj = t; else if (x < 0 && y < 0) xi = yj = -t, xj = yi = 0; else xi = yj = 0, yi = -t, xj = t; printf("%d %d %d %d\n", xi, yi, xj, yj); }
fb3afeb653ad1f6b461fc2c132548b0740be8129
cca16e10578df868208a95515bd4387ddb74d38f
/day01/ex03/HumanB.hpp
f09ab73cbe280325490f9ebce79ad51e113ba5ed
[]
no_license
mel-hamr/cpp
8929c0cb9db2ee55d3f6d3853ca7af80ba77bb84
a1307b09c87974311ec5dd04aaeb4498daab97d5
refs/heads/master
2023-09-03T19:33:28.836062
2021-11-02T09:57:15
2021-11-02T09:57:15
401,765,322
0
0
null
null
null
null
UTF-8
C++
false
false
323
hpp
HumanB.hpp
#include <iostream> #include "Weapon.hpp" class HumanB { private: std::string name; Weapon weapon; public: HumanB(std::string name) { this->name = name; } void get_name(std::string name); void setWeapon(std::string weapon); void attack(void); };
1890b63f078b65393f6269068d22661cf8c12781
d09945668f19bb4bc17087c0cb8ccbab2b2dd688
/codeforce/581-620/592/d2.cpp
b38ab86221fab238234ffc39b21781e1b1617d89
[]
no_license
kmjp/procon
27270f605f3ae5d80fbdb28708318a6557273a57
8083028ece4be1460150aa3f0e69bdb57e510b53
refs/heads/master
2023-09-04T11:01:09.452170
2023-09-03T15:25:21
2023-09-03T15:25:21
30,825,508
23
2
null
2023-08-18T14:02:07
2015-02-15T11:25:23
C++
UTF-8
C++
false
false
1,494
cpp
d2.cpp
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) //------------------------------------------------------- int N; ll C[101010][3]; int col[101010]; vector<int> V; vector<int> E[101010]; void dfs(int cur,int pre) { V.push_back(cur); FORR(e,E[cur]) if(e!=pre) dfs(e,cur); } void solve() { int i,j,k,l,r,x,y; string s; cin>>N; FOR(i,3) FOR(j,N) cin>>C[j][i]; FOR(i,N-1) { cin>>x>>y; E[x-1].push_back(y-1); E[y-1].push_back(x-1); } FOR(i,N) if(E[i].size()>=3) return _P("-1\n"); FOR(i,N) if(E[i].size()==1) { dfs(i,i); break; } dfs(0,0); vector<int> cand={0,1,2}; vector<int> D; ll mi=1LL<<60; do { ll tot=0; FOR(i,N) tot+=C[V[i]][cand[i%3]]; if(tot<mi) { mi=tot; D=cand; } } while(next_permutation(ALL(cand))); FOR(i,N) col[V[i]]=D[i%3]; cout<<mi<<endl; FOR(i,N) cout<<col[i]+1<<" "; cout<<endl; } int main(int argc,char** argv){ string s;int i; if(argc==1) ios::sync_with_stdio(false), cin.tie(0); FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin); cout.tie(0); solve(); return 0; }
317d0a983f7482f580f7c92c756bb5865e984a98
1bc29212030b5af28ae3a9d8f72039b6fd55b81f
/main.cpp
ef8eb109ef98f8fc4e0e1bcff96445b964bbc980
[]
no_license
malhadbah/p04-malhadbah
fe68efbc5fddf4a25bf2bdc576d93a96b6a15db8
061b931198d9792c71d3638cfd1e9c26d9d885cd
refs/heads/master
2021-08-24T09:59:26.311111
2017-12-09T04:22:24
2017-12-09T04:22:24
110,870,307
0
0
null
null
null
null
UTF-8
C++
false
false
5,703
cpp
main.cpp
#include <iostream> #include <string> #include <fstream> #include "Board.h" using namespace std; //win score #define WIN_SCORE 10 //data file name #define GAME_DATA_FILE "data.txt" //read a position (row, col) to put player symbol void readPosition(Board &boardObject, int &row, int &col, string prompt); //display game history void displayGameHistory(); //display menu and get user selection string menu(); //play a game and return winner or empty if tie char playGame(); //save game to file void saveGame(string Xname, string Oname, int Xscore, int Oscore); //main function int main(){ //name of players string Xname, Oname; int Xscore = 0; //X user score for all games int Oscore = 0; //O user score for all games char winner; //winner for one game //prompt for first player's name cout << "Please enter the name of X player: "; getline(cin, Xname); //prompt for second player's name cout << "Please enter the name of O player: "; getline(cin, Oname); //display menu and read user selection string selection = menu(); //allows to play until they are ready to quit while (selection != "3"){ if (selection == "1") {//display game history displayGameHistory(); }else if (selection == "2") {//play game winner = playGame(); if (winner == X) { Xscore += WIN_SCORE; }else if (winner == O) { Oscore += WIN_SCORE; } }else{//invalid selection cout << "Invalid selection" << endl; } cout << endl; selection = menu(); //display menu and read user selection }//end while //save game saveGame(Xname, Oname, Xscore, Oscore); cout << endl << "Thank you and Good bye!" << endl; return 0; } void readPosition(Board &boardObject, int &row, int &col, string prompt){ string input = ""; //input e.g. C1 or c1 bool valid = false; //validate //loop until it is valid while(!valid){ //read input cout << prompt; getline(cin, input); //it must be 2 digits if (input.length() == 2) { //extract row, column row = input[0] - '1'; col = input[1] - '1'; //validate indices if (row < 0 || row >= SIZE || col < 0 || col >= SIZE) { cout << "Invalid input" << endl; }else{ valid = true; } }else{ cout << "Invalid input" << endl; } } } void displayGameHistory(){ //input data file ifstream inFile; string line;//line from file //open file inFile.open(GAME_DATA_FILE); if (!inFile) { cout << "Unable to open file " << GAME_DATA_FILE; }else{ //read line by line until end of file while (getline(inFile, line)) { cout << line << endl; } inFile.close(); } } //display menu and get user selection //read a whole line and return //this function does not check valid option string menu(){ string selection; //user's selection cout << "1. View game history" << endl; cout << "2. Play game" << endl; cout << "3. Quit application" << endl; cout << "Enter your selection? "; getline(cin, selection); return selection; } char playGame(){ int row, col; char turn = X;//current turn bool gameEnd = false; //end game Board boardObject;//Board object cout << boardObject; //play one game while(!gameEnd){ cout << "----" << turn << "'s turn ----" << endl; //read row, column for player at turn (valid position) readPosition(boardObject, row, col, "Please enter a position: "); //put symbol at this position boardObject(row, col) = turn; cout << endl; //check win if (boardObject.isWin(turn)){ cout << turn << " won" << endl << endl; gameEnd = true; }else if (boardObject.isFull()){ cout << "Game ties" << endl << endl; turn =EMPTY; gameEnd = true; } if(!gameEnd){//swap turn if (turn == X){ turn = O; }else{ turn = X; } } cout << boardObject; //print board } return turn; } void saveGame(string Xname, string Oname, int Xscore, int Oscore){ ofstream outfile;//output stream outfile.open (GAME_DATA_FILE, ios::out | ios::app); outfile << Xname << ": " << Xscore << ", " << Oname << ": " << Oscore << "\n"; //close file outfile.close(); }
d389d8deff39bc74a5edcb24ba30a03b1c2ff06d
c9fe88b36a428445b9acbafb991c2e2205415998
/MagicWand.ino
c7da39840a43b02ed3bd2119b05de31c27c34d93
[]
no_license
bigeyex/curie-magic-wand
29a03b7a356b396dccb7ff25249cd94ca81f11b9
7f9918bff4648972c4ae5067edc48fcfb7df6f23
refs/heads/master
2021-01-17T04:59:22.897964
2017-02-25T04:29:17
2017-02-25T04:29:17
83,054,066
0
0
null
null
null
null
UTF-8
C++
false
false
765
ino
MagicWand.ino
#include "Bluetooth.h" #include "sequencer.h" const unsigned char beepcmd[] = {0xff, 0x55, 0x07, 0x00, 0x02, 0x22, 0x06, 0x01, 0xfa, 0x00}; void setup() { Serial.begin(115200); Serial.println("Start"); ble_setup(); ble_on_connect(on_connected); ble_on_disconnect(on_disconnet); ble_connect_nearest(); } void on_connected() { Serial.println("Connected"); ble_write(beepcmd, 10); delay(1000); // use seq_run_single to run a single command; seq_add(MOVE_FORWARD); seq_add(MOVE_BACKWARD); seq_add(MOVE_LEFT); seq_add(MOVE_RIGHT); seq_add(MOVE_STOP); seq_play(); } void on_disconnet() { Serial.println("Disconnected"); ble_connect_nearest(); } void loop() { ble_loop(); seq_loop(); }
a254817a2fbb7be930fa1af495fe5a849d7b17d9
fa82ee5e765c18812240abface6cecfe3601c5a2
/helicopter.h
3a7fa50fdf1c63944c55cb21a9d9adb6cc73ddc3
[]
no_license
smcelrea/3501A
0d3c3166d2225cc80de705d70668042f4afcf269
73bcaf22033229e9465ed9b4ae580056f270f345
refs/heads/master
2023-07-07T05:43:10.220632
2018-12-06T22:08:28
2018-12-06T22:08:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,473
h
helicopter.h
#ifndef HELICOPTER_H_ #define HELICOPTER_H_ #include <string> #define GLEW_STATIC #include <GL/glew.h> #include <GLFW/glfw3.h> #include <glm/glm.hpp> #define GLM_FORCE_RADIANS #include <glm/gtc/quaternion.hpp> #include "resource.h" #include "scene_node.h" namespace game { // Abstraction of an asteroid class Helicopter : public SceneNode { public: // Create asteroid from given resources Helicopter(const std::string name, const Resource *geometry, const Resource *material, const Resource *texture); Helicopter(const SceneNode &nodeCpy); // Destructor ~Helicopter(); // Get/set attributes specific to Helicopters glm::quat GetAngM(void) const; void SetAngM(glm::quat angm); void SetKeysIn(std::map<std::string, bool> keysin); void ApplyAngForce(glm::vec3 angularvel); // vec3 ( pitch, yaw, roll ) void ApplyForce(glm::vec3 force); //void Pitch(float angle); //void Yaw(float angle); //void Roll(float angle); // Update geometry configuration void Update(void); private: // Angular momentum of asteroid glm::quat angm_; glm::vec3 angularvel_; glm::vec3 velocity_; glm::vec3 acceleration; std::map<std::string, bool> keysin_; }; // class Helicopter } // namespace game #endif // HELICOPTER_H_
aee891b0943f3b5ad445f2f56be95715790f4c59
005cb1c69358d301f72c6a6890ffeb430573c1a1
/Pods/Headers/Private/GeoFeatures/boost/shared_array.hpp
6590a5dd074f20a01316e5c0bbb6ed25fb9076aa
[ "Apache-2.0" ]
permissive
TheClimateCorporation/DemoCLUs
05588dcca687cc5854755fad72f07759f81fe673
f343da9b41807694055151a721b497cf6267f829
refs/heads/master
2021-01-10T15:10:06.021498
2016-04-19T20:31:34
2016-04-19T20:31:34
51,960,444
0
0
null
null
null
null
UTF-8
C++
false
false
58
hpp
shared_array.hpp
../../../../GeoFeatures/GeoFeatures/boost/shared_array.hpp
e561113c85185f24e269d24c6271b4b42330c1a9
6e2e8592b602ac36de770ad101eed05405c982cc
/modules/perception/camera/lib/traffic_light/proto/detection.pb.cc
b0a480881bc3f76bf95720fbb36df21a84dc5ba3
[]
no_license
sxhxliang/Apollo-Lite
6060dc361fd22b90fa2c986ee4dbbb6cf38d50ec
b59e1c6a9a88aa421e72fa709a80c10e868531f8
refs/heads/main
2023-04-09T19:04:15.275450
2021-04-17T18:25:22
2021-04-17T18:25:22
356,549,140
2
3
null
null
null
null
UTF-8
C++
false
true
61,866
cc
detection.pb.cc
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: modules/perception/camera/lib/traffic_light/proto/detection.proto #include "modules/perception/camera/lib/traffic_light/proto/detection.pb.h" #include <algorithm> #include <google/protobuf/stubs/common.h> #include <google/protobuf/io/coded_stream.h> #include <google/protobuf/extension_set.h> #include <google/protobuf/wire_format_lite.h> #include <google/protobuf/descriptor.h> #include <google/protobuf/generated_message_reflection.h> #include <google/protobuf/reflection_ops.h> #include <google/protobuf/wire_format.h> // @@protoc_insertion_point(includes) #include <google/protobuf/port_def.inc> namespace apollo { namespace perception { namespace camera { namespace traffic_light { namespace detection { class DetectionParamDefaultTypeInternal { public: ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<DetectionParam> _instance; } _DetectionParam_default_instance_; } // namespace detection } // namespace traffic_light } // namespace camera } // namespace perception } // namespace apollo static void InitDefaultsscc_info_DetectionParam_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto() { GOOGLE_PROTOBUF_VERIFY_VERSION; ::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_model_name_.DefaultConstruct(); *::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_model_name_.get_mutable() = std::string("RTNet", 5); ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyString( ::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_model_name_.get_mutable()); ::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_model_type_.DefaultConstruct(); *::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_model_type_.get_mutable() = std::string("RTNet", 5); ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyString( ::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_model_type_.get_mutable()); ::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_proto_file_.DefaultConstruct(); *::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_proto_file_.get_mutable() = std::string("caffe.pt", 8); ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyString( ::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_proto_file_.get_mutable()); ::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_weight_file_.DefaultConstruct(); *::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_weight_file_.get_mutable() = std::string("caffe.model", 11); ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyString( ::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_weight_file_.get_mutable()); { void* ptr = &::apollo::perception::camera::traffic_light::detection::_DetectionParam_default_instance_; new (ptr) ::apollo::perception::camera::traffic_light::detection::DetectionParam(); ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); } ::apollo::perception::camera::traffic_light::detection::DetectionParam::InitAsDefaultInstance(); } ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_DetectionParam_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto = {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsscc_info_DetectionParam_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto}, {}}; static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto[1]; static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto = nullptr; static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto = nullptr; const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { PROTOBUF_FIELD_OFFSET(::apollo::perception::camera::traffic_light::detection::DetectionParam, _has_bits_), PROTOBUF_FIELD_OFFSET(::apollo::perception::camera::traffic_light::detection::DetectionParam, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::apollo::perception::camera::traffic_light::detection::DetectionParam, min_crop_size_), PROTOBUF_FIELD_OFFSET(::apollo::perception::camera::traffic_light::detection::DetectionParam, crop_method_), PROTOBUF_FIELD_OFFSET(::apollo::perception::camera::traffic_light::detection::DetectionParam, mean_b_), PROTOBUF_FIELD_OFFSET(::apollo::perception::camera::traffic_light::detection::DetectionParam, mean_g_), PROTOBUF_FIELD_OFFSET(::apollo::perception::camera::traffic_light::detection::DetectionParam, mean_r_), PROTOBUF_FIELD_OFFSET(::apollo::perception::camera::traffic_light::detection::DetectionParam, is_bgr_), PROTOBUF_FIELD_OFFSET(::apollo::perception::camera::traffic_light::detection::DetectionParam, crop_scale_), PROTOBUF_FIELD_OFFSET(::apollo::perception::camera::traffic_light::detection::DetectionParam, input_blob_name_), PROTOBUF_FIELD_OFFSET(::apollo::perception::camera::traffic_light::detection::DetectionParam, im_param_blob_name_), PROTOBUF_FIELD_OFFSET(::apollo::perception::camera::traffic_light::detection::DetectionParam, output_blob_name_), PROTOBUF_FIELD_OFFSET(::apollo::perception::camera::traffic_light::detection::DetectionParam, model_name_), PROTOBUF_FIELD_OFFSET(::apollo::perception::camera::traffic_light::detection::DetectionParam, model_type_), PROTOBUF_FIELD_OFFSET(::apollo::perception::camera::traffic_light::detection::DetectionParam, proto_file_), PROTOBUF_FIELD_OFFSET(::apollo::perception::camera::traffic_light::detection::DetectionParam, weight_file_), PROTOBUF_FIELD_OFFSET(::apollo::perception::camera::traffic_light::detection::DetectionParam, max_batch_size_), 9, 7, 10, 11, 12, 13, 14, 0, 1, 2, 3, 4, 5, 6, 8, }; static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { { 0, 20, sizeof(::apollo::perception::camera::traffic_light::detection::DetectionParam)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::apollo::perception::camera::traffic_light::detection::_DetectionParam_default_instance_), }; const char descriptor_table_protodef_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto[] = "\nAmodules/perception/camera/lib/traffic_" "light/proto/detection.proto\0220apollo.perc" "eption.camera.traffic_light.detection\"\217\003" "\n\016DetectionParam\022\032\n\rmin_crop_size\030\001 \001(\005:" "\003270\022\026\n\013crop_method\030\002 \001(\005:\0010\022\022\n\006mean_b\030\003" " \001(\002:\00295\022\022\n\006mean_g\030\004 \001(\002:\00299\022\022\n\006mean_r\030\005" " \001(\002:\00296\022\024\n\006is_bgr\030\006 \001(\010:\004true\022\027\n\ncrop_s" "cale\030\007 \001(\002:\0032.5\022\027\n\017input_blob_name\030\010 \001(\t" "\022\032\n\022im_param_blob_name\030\t \001(\t\022\030\n\020output_b" "lob_name\030\n \001(\t\022\031\n\nmodel_name\030\013 \001(\t:\005RTNe" "t\022\031\n\nmodel_type\030\014 \001(\t:\005RTNet\022\034\n\nproto_fi" "le\030\r \001(\t:\010caffe.pt\022 \n\013weight_file\030\016 \001(\t:" "\013caffe.model\022\031\n\016max_batch_size\030\017 \001(\005:\0011" ; static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto_deps[1] = { }; static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto_sccs[1] = { &scc_info_DetectionParam_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto.base, }; static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto_once; static bool descriptor_table_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto_initialized = false; const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto = { &descriptor_table_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto_initialized, descriptor_table_protodef_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto, "modules/perception/camera/lib/traffic_light/proto/detection.proto", 519, &descriptor_table_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto_once, descriptor_table_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto_sccs, descriptor_table_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto_deps, 1, 0, schemas, file_default_instances, TableStruct_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto::offsets, file_level_metadata_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto, 1, file_level_enum_descriptors_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto, file_level_service_descriptors_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto, }; // Force running AddDescriptors() at dynamic initialization time. static bool dynamic_init_dummy_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto = ( ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto), true); namespace apollo { namespace perception { namespace camera { namespace traffic_light { namespace detection { // =================================================================== void DetectionParam::InitAsDefaultInstance() { } class DetectionParam::HasBitSetters { public: using HasBits = decltype(std::declval<DetectionParam>()._has_bits_); static void set_has_min_crop_size(HasBits* has_bits) { (*has_bits)[0] |= 512u; } static void set_has_crop_method(HasBits* has_bits) { (*has_bits)[0] |= 128u; } static void set_has_mean_b(HasBits* has_bits) { (*has_bits)[0] |= 1024u; } static void set_has_mean_g(HasBits* has_bits) { (*has_bits)[0] |= 2048u; } static void set_has_mean_r(HasBits* has_bits) { (*has_bits)[0] |= 4096u; } static void set_has_is_bgr(HasBits* has_bits) { (*has_bits)[0] |= 8192u; } static void set_has_crop_scale(HasBits* has_bits) { (*has_bits)[0] |= 16384u; } static void set_has_input_blob_name(HasBits* has_bits) { (*has_bits)[0] |= 1u; } static void set_has_im_param_blob_name(HasBits* has_bits) { (*has_bits)[0] |= 2u; } static void set_has_output_blob_name(HasBits* has_bits) { (*has_bits)[0] |= 4u; } static void set_has_model_name(HasBits* has_bits) { (*has_bits)[0] |= 8u; } static void set_has_model_type(HasBits* has_bits) { (*has_bits)[0] |= 16u; } static void set_has_proto_file(HasBits* has_bits) { (*has_bits)[0] |= 32u; } static void set_has_weight_file(HasBits* has_bits) { (*has_bits)[0] |= 64u; } static void set_has_max_batch_size(HasBits* has_bits) { (*has_bits)[0] |= 256u; } }; ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> DetectionParam::_i_give_permission_to_break_this_code_default_model_name_; ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> DetectionParam::_i_give_permission_to_break_this_code_default_model_type_; ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> DetectionParam::_i_give_permission_to_break_this_code_default_proto_file_; ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> DetectionParam::_i_give_permission_to_break_this_code_default_weight_file_; #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int DetectionParam::kMinCropSizeFieldNumber; const int DetectionParam::kCropMethodFieldNumber; const int DetectionParam::kMeanBFieldNumber; const int DetectionParam::kMeanGFieldNumber; const int DetectionParam::kMeanRFieldNumber; const int DetectionParam::kIsBgrFieldNumber; const int DetectionParam::kCropScaleFieldNumber; const int DetectionParam::kInputBlobNameFieldNumber; const int DetectionParam::kImParamBlobNameFieldNumber; const int DetectionParam::kOutputBlobNameFieldNumber; const int DetectionParam::kModelNameFieldNumber; const int DetectionParam::kModelTypeFieldNumber; const int DetectionParam::kProtoFileFieldNumber; const int DetectionParam::kWeightFileFieldNumber; const int DetectionParam::kMaxBatchSizeFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 DetectionParam::DetectionParam() : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) { SharedCtor(); // @@protoc_insertion_point(constructor:apollo.perception.camera.traffic_light.detection.DetectionParam) } DetectionParam::DetectionParam(const DetectionParam& from) : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr), _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom(from._internal_metadata_); input_blob_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); if (from.has_input_blob_name()) { input_blob_name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.input_blob_name_); } im_param_blob_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); if (from.has_im_param_blob_name()) { im_param_blob_name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.im_param_blob_name_); } output_blob_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); if (from.has_output_blob_name()) { output_blob_name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.output_blob_name_); } model_name_.UnsafeSetDefault(&::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_model_name_.get()); if (from.has_model_name()) { model_name_.AssignWithDefault(&::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_model_name_.get(), from.model_name_); } model_type_.UnsafeSetDefault(&::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_model_type_.get()); if (from.has_model_type()) { model_type_.AssignWithDefault(&::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_model_type_.get(), from.model_type_); } proto_file_.UnsafeSetDefault(&::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_proto_file_.get()); if (from.has_proto_file()) { proto_file_.AssignWithDefault(&::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_proto_file_.get(), from.proto_file_); } weight_file_.UnsafeSetDefault(&::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_weight_file_.get()); if (from.has_weight_file()) { weight_file_.AssignWithDefault(&::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_weight_file_.get(), from.weight_file_); } ::memcpy(&crop_method_, &from.crop_method_, static_cast<size_t>(reinterpret_cast<char*>(&crop_scale_) - reinterpret_cast<char*>(&crop_method_)) + sizeof(crop_scale_)); // @@protoc_insertion_point(copy_constructor:apollo.perception.camera.traffic_light.detection.DetectionParam) } void DetectionParam::SharedCtor() { ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_DetectionParam_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto.base); input_blob_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); im_param_blob_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); output_blob_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); model_name_.UnsafeSetDefault(&::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_model_name_.get()); model_type_.UnsafeSetDefault(&::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_model_type_.get()); proto_file_.UnsafeSetDefault(&::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_proto_file_.get()); weight_file_.UnsafeSetDefault(&::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_weight_file_.get()); crop_method_ = 0; max_batch_size_ = 1; min_crop_size_ = 270; mean_b_ = 95; mean_g_ = 99; mean_r_ = 96; is_bgr_ = true; crop_scale_ = 2.5f; } DetectionParam::~DetectionParam() { // @@protoc_insertion_point(destructor:apollo.perception.camera.traffic_light.detection.DetectionParam) SharedDtor(); } void DetectionParam::SharedDtor() { input_blob_name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); im_param_blob_name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); output_blob_name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); model_name_.DestroyNoArena(&::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_model_name_.get()); model_type_.DestroyNoArena(&::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_model_type_.get()); proto_file_.DestroyNoArena(&::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_proto_file_.get()); weight_file_.DestroyNoArena(&::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_weight_file_.get()); } void DetectionParam::SetCachedSize(int size) const { _cached_size_.Set(size); } const DetectionParam& DetectionParam::default_instance() { ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_DetectionParam_modules_2fperception_2fcamera_2flib_2ftraffic_5flight_2fproto_2fdetection_2eproto.base); return *internal_default_instance(); } void DetectionParam::Clear() { // @@protoc_insertion_point(message_clear_start:apollo.perception.camera.traffic_light.detection.DetectionParam) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x0000007fu) { if (cached_has_bits & 0x00000001u) { input_blob_name_.ClearNonDefaultToEmptyNoArena(); } if (cached_has_bits & 0x00000002u) { im_param_blob_name_.ClearNonDefaultToEmptyNoArena(); } if (cached_has_bits & 0x00000004u) { output_blob_name_.ClearNonDefaultToEmptyNoArena(); } if (cached_has_bits & 0x00000008u) { model_name_.UnsafeMutablePointer()->assign(*&::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_model_name_.get()); } if (cached_has_bits & 0x00000010u) { model_type_.UnsafeMutablePointer()->assign(*&::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_model_type_.get()); } if (cached_has_bits & 0x00000020u) { proto_file_.UnsafeMutablePointer()->assign(*&::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_proto_file_.get()); } if (cached_has_bits & 0x00000040u) { weight_file_.UnsafeMutablePointer()->assign(*&::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_weight_file_.get()); } } crop_method_ = 0; if (cached_has_bits & 0x00007f00u) { max_batch_size_ = 1; min_crop_size_ = 270; mean_b_ = 95; mean_g_ = 99; mean_r_ = 96; is_bgr_ = true; crop_scale_ = 2.5f; } _has_bits_.Clear(); _internal_metadata_.Clear(); } #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER const char* DetectionParam::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure HasBitSetters::HasBits has_bits{}; while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); CHK_(ptr); switch (tag >> 3) { // optional int32 min_crop_size = 1 [default = 270]; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { HasBitSetters::set_has_min_crop_size(&has_bits); min_crop_size_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); } else goto handle_unusual; continue; // optional int32 crop_method = 2 [default = 0]; case 2: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) { HasBitSetters::set_has_crop_method(&has_bits); crop_method_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); } else goto handle_unusual; continue; // optional float mean_b = 3 [default = 95]; case 3: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 29)) { HasBitSetters::set_has_mean_b(&has_bits); mean_b_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr); ptr += sizeof(float); } else goto handle_unusual; continue; // optional float mean_g = 4 [default = 99]; case 4: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 37)) { HasBitSetters::set_has_mean_g(&has_bits); mean_g_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr); ptr += sizeof(float); } else goto handle_unusual; continue; // optional float mean_r = 5 [default = 96]; case 5: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 45)) { HasBitSetters::set_has_mean_r(&has_bits); mean_r_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr); ptr += sizeof(float); } else goto handle_unusual; continue; // optional bool is_bgr = 6 [default = true]; case 6: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 48)) { HasBitSetters::set_has_is_bgr(&has_bits); is_bgr_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); } else goto handle_unusual; continue; // optional float crop_scale = 7 [default = 2.5]; case 7: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 61)) { HasBitSetters::set_has_crop_scale(&has_bits); crop_scale_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr); ptr += sizeof(float); } else goto handle_unusual; continue; // optional string input_blob_name = 8; case 8: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) { ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_input_blob_name(), ptr, ctx, "apollo.perception.camera.traffic_light.detection.DetectionParam.input_blob_name"); CHK_(ptr); } else goto handle_unusual; continue; // optional string im_param_blob_name = 9; case 9: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 74)) { ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_im_param_blob_name(), ptr, ctx, "apollo.perception.camera.traffic_light.detection.DetectionParam.im_param_blob_name"); CHK_(ptr); } else goto handle_unusual; continue; // optional string output_blob_name = 10; case 10: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 82)) { ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_output_blob_name(), ptr, ctx, "apollo.perception.camera.traffic_light.detection.DetectionParam.output_blob_name"); CHK_(ptr); } else goto handle_unusual; continue; // optional string model_name = 11 [default = "RTNet"]; case 11: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 90)) { ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_model_name(), ptr, ctx, "apollo.perception.camera.traffic_light.detection.DetectionParam.model_name"); CHK_(ptr); } else goto handle_unusual; continue; // optional string model_type = 12 [default = "RTNet"]; case 12: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 98)) { ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_model_type(), ptr, ctx, "apollo.perception.camera.traffic_light.detection.DetectionParam.model_type"); CHK_(ptr); } else goto handle_unusual; continue; // optional string proto_file = 13 [default = "caffe.pt"]; case 13: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 106)) { ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_proto_file(), ptr, ctx, "apollo.perception.camera.traffic_light.detection.DetectionParam.proto_file"); CHK_(ptr); } else goto handle_unusual; continue; // optional string weight_file = 14 [default = "caffe.model"]; case 14: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 114)) { ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParserUTF8Verify(mutable_weight_file(), ptr, ctx, "apollo.perception.camera.traffic_light.detection.DetectionParam.weight_file"); CHK_(ptr); } else goto handle_unusual; continue; // optional int32 max_batch_size = 15 [default = 1]; case 15: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 120)) { HasBitSetters::set_has_max_batch_size(&has_bits); max_batch_size_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr); CHK_(ptr); } else goto handle_unusual; continue; default: { handle_unusual: if ((tag & 7) == 4 || tag == 0) { ctx->SetLastTag(tag); goto success; } ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx); CHK_(ptr != nullptr); continue; } } // switch } // while success: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } #else // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER bool DetectionParam::MergePartialFromCodedStream( ::PROTOBUF_NAMESPACE_ID::io::CodedInputStream* input) { #define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure ::PROTOBUF_NAMESPACE_ID::uint32 tag; // @@protoc_insertion_point(parse_start:apollo.perception.camera.traffic_light.detection.DetectionParam) for (;;) { ::std::pair<::PROTOBUF_NAMESPACE_ID::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); tag = p.first; if (!p.second) goto handle_unusual; switch (::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::GetTagFieldNumber(tag)) { // optional int32 min_crop_size = 1 [default = 270]; case 1: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (8 & 0xFF)) { HasBitSetters::set_has_min_crop_size(&_has_bits_); DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( input, &min_crop_size_))); } else { goto handle_unusual; } break; } // optional int32 crop_method = 2 [default = 0]; case 2: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (16 & 0xFF)) { HasBitSetters::set_has_crop_method(&_has_bits_); DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( input, &crop_method_))); } else { goto handle_unusual; } break; } // optional float mean_b = 3 [default = 95]; case 3: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (29 & 0xFF)) { HasBitSetters::set_has_mean_b(&_has_bits_); DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< float, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_FLOAT>( input, &mean_b_))); } else { goto handle_unusual; } break; } // optional float mean_g = 4 [default = 99]; case 4: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (37 & 0xFF)) { HasBitSetters::set_has_mean_g(&_has_bits_); DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< float, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_FLOAT>( input, &mean_g_))); } else { goto handle_unusual; } break; } // optional float mean_r = 5 [default = 96]; case 5: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (45 & 0xFF)) { HasBitSetters::set_has_mean_r(&_has_bits_); DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< float, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_FLOAT>( input, &mean_r_))); } else { goto handle_unusual; } break; } // optional bool is_bgr = 6 [default = true]; case 6: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (48 & 0xFF)) { HasBitSetters::set_has_is_bgr(&_has_bits_); DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< bool, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_BOOL>( input, &is_bgr_))); } else { goto handle_unusual; } break; } // optional float crop_scale = 7 [default = 2.5]; case 7: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (61 & 0xFF)) { HasBitSetters::set_has_crop_scale(&_has_bits_); DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< float, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_FLOAT>( input, &crop_scale_))); } else { goto handle_unusual; } break; } // optional string input_blob_name = 8; case 8: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (66 & 0xFF)) { DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( input, this->mutable_input_blob_name())); ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( this->input_blob_name().data(), static_cast<int>(this->input_blob_name().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, "apollo.perception.camera.traffic_light.detection.DetectionParam.input_blob_name"); } else { goto handle_unusual; } break; } // optional string im_param_blob_name = 9; case 9: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (74 & 0xFF)) { DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( input, this->mutable_im_param_blob_name())); ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( this->im_param_blob_name().data(), static_cast<int>(this->im_param_blob_name().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, "apollo.perception.camera.traffic_light.detection.DetectionParam.im_param_blob_name"); } else { goto handle_unusual; } break; } // optional string output_blob_name = 10; case 10: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (82 & 0xFF)) { DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( input, this->mutable_output_blob_name())); ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( this->output_blob_name().data(), static_cast<int>(this->output_blob_name().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, "apollo.perception.camera.traffic_light.detection.DetectionParam.output_blob_name"); } else { goto handle_unusual; } break; } // optional string model_name = 11 [default = "RTNet"]; case 11: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (90 & 0xFF)) { DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( input, this->mutable_model_name())); ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( this->model_name().data(), static_cast<int>(this->model_name().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, "apollo.perception.camera.traffic_light.detection.DetectionParam.model_name"); } else { goto handle_unusual; } break; } // optional string model_type = 12 [default = "RTNet"]; case 12: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (98 & 0xFF)) { DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( input, this->mutable_model_type())); ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( this->model_type().data(), static_cast<int>(this->model_type().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, "apollo.perception.camera.traffic_light.detection.DetectionParam.model_type"); } else { goto handle_unusual; } break; } // optional string proto_file = 13 [default = "caffe.pt"]; case 13: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (106 & 0xFF)) { DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( input, this->mutable_proto_file())); ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( this->proto_file().data(), static_cast<int>(this->proto_file().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, "apollo.perception.camera.traffic_light.detection.DetectionParam.proto_file"); } else { goto handle_unusual; } break; } // optional string weight_file = 14 [default = "caffe.model"]; case 14: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (114 & 0xFF)) { DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadString( input, this->mutable_weight_file())); ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( this->weight_file().data(), static_cast<int>(this->weight_file().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::PARSE, "apollo.perception.camera.traffic_light.detection.DetectionParam.weight_file"); } else { goto handle_unusual; } break; } // optional int32 max_batch_size = 15 [default = 1]; case 15: { if (static_cast< ::PROTOBUF_NAMESPACE_ID::uint8>(tag) == (120 & 0xFF)) { HasBitSetters::set_has_max_batch_size(&_has_bits_); DO_((::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::ReadPrimitive< ::PROTOBUF_NAMESPACE_ID::int32, ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::TYPE_INT32>( input, &max_batch_size_))); } else { goto handle_unusual; } break; } default: { handle_unusual: if (tag == 0) { goto success; } DO_(::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SkipField( input, tag, _internal_metadata_.mutable_unknown_fields())); break; } } } success: // @@protoc_insertion_point(parse_success:apollo.perception.camera.traffic_light.detection.DetectionParam) return true; failure: // @@protoc_insertion_point(parse_failure:apollo.perception.camera.traffic_light.detection.DetectionParam) return false; #undef DO_ } #endif // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER void DetectionParam::SerializeWithCachedSizes( ::PROTOBUF_NAMESPACE_ID::io::CodedOutputStream* output) const { // @@protoc_insertion_point(serialize_start:apollo.perception.camera.traffic_light.detection.DetectionParam) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; // optional int32 min_crop_size = 1 [default = 270]; if (cached_has_bits & 0x00000200u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32(1, this->min_crop_size(), output); } // optional int32 crop_method = 2 [default = 0]; if (cached_has_bits & 0x00000080u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32(2, this->crop_method(), output); } // optional float mean_b = 3 [default = 95]; if (cached_has_bits & 0x00000400u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloat(3, this->mean_b(), output); } // optional float mean_g = 4 [default = 99]; if (cached_has_bits & 0x00000800u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloat(4, this->mean_g(), output); } // optional float mean_r = 5 [default = 96]; if (cached_has_bits & 0x00001000u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloat(5, this->mean_r(), output); } // optional bool is_bgr = 6 [default = true]; if (cached_has_bits & 0x00002000u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBool(6, this->is_bgr(), output); } // optional float crop_scale = 7 [default = 2.5]; if (cached_has_bits & 0x00004000u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloat(7, this->crop_scale(), output); } // optional string input_blob_name = 8; if (cached_has_bits & 0x00000001u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( this->input_blob_name().data(), static_cast<int>(this->input_blob_name().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, "apollo.perception.camera.traffic_light.detection.DetectionParam.input_blob_name"); ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteStringMaybeAliased( 8, this->input_blob_name(), output); } // optional string im_param_blob_name = 9; if (cached_has_bits & 0x00000002u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( this->im_param_blob_name().data(), static_cast<int>(this->im_param_blob_name().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, "apollo.perception.camera.traffic_light.detection.DetectionParam.im_param_blob_name"); ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteStringMaybeAliased( 9, this->im_param_blob_name(), output); } // optional string output_blob_name = 10; if (cached_has_bits & 0x00000004u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( this->output_blob_name().data(), static_cast<int>(this->output_blob_name().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, "apollo.perception.camera.traffic_light.detection.DetectionParam.output_blob_name"); ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteStringMaybeAliased( 10, this->output_blob_name(), output); } // optional string model_name = 11 [default = "RTNet"]; if (cached_has_bits & 0x00000008u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( this->model_name().data(), static_cast<int>(this->model_name().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, "apollo.perception.camera.traffic_light.detection.DetectionParam.model_name"); ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteStringMaybeAliased( 11, this->model_name(), output); } // optional string model_type = 12 [default = "RTNet"]; if (cached_has_bits & 0x00000010u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( this->model_type().data(), static_cast<int>(this->model_type().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, "apollo.perception.camera.traffic_light.detection.DetectionParam.model_type"); ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteStringMaybeAliased( 12, this->model_type(), output); } // optional string proto_file = 13 [default = "caffe.pt"]; if (cached_has_bits & 0x00000020u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( this->proto_file().data(), static_cast<int>(this->proto_file().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, "apollo.perception.camera.traffic_light.detection.DetectionParam.proto_file"); ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteStringMaybeAliased( 13, this->proto_file(), output); } // optional string weight_file = 14 [default = "caffe.model"]; if (cached_has_bits & 0x00000040u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( this->weight_file().data(), static_cast<int>(this->weight_file().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, "apollo.perception.camera.traffic_light.detection.DetectionParam.weight_file"); ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteStringMaybeAliased( 14, this->weight_file(), output); } // optional int32 max_batch_size = 15 [default = 1]; if (cached_has_bits & 0x00000100u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32(15, this->max_batch_size(), output); } if (_internal_metadata_.have_unknown_fields()) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFields( _internal_metadata_.unknown_fields(), output); } // @@protoc_insertion_point(serialize_end:apollo.perception.camera.traffic_light.detection.DetectionParam) } ::PROTOBUF_NAMESPACE_ID::uint8* DetectionParam::InternalSerializeWithCachedSizesToArray( ::PROTOBUF_NAMESPACE_ID::uint8* target) const { // @@protoc_insertion_point(serialize_to_array_start:apollo.perception.camera.traffic_light.detection.DetectionParam) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; // optional int32 min_crop_size = 1 [default = 270]; if (cached_has_bits & 0x00000200u) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->min_crop_size(), target); } // optional int32 crop_method = 2 [default = 0]; if (cached_has_bits & 0x00000080u) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->crop_method(), target); } // optional float mean_b = 3 [default = 95]; if (cached_has_bits & 0x00000400u) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(3, this->mean_b(), target); } // optional float mean_g = 4 [default = 99]; if (cached_has_bits & 0x00000800u) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(4, this->mean_g(), target); } // optional float mean_r = 5 [default = 96]; if (cached_has_bits & 0x00001000u) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(5, this->mean_r(), target); } // optional bool is_bgr = 6 [default = true]; if (cached_has_bits & 0x00002000u) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(6, this->is_bgr(), target); } // optional float crop_scale = 7 [default = 2.5]; if (cached_has_bits & 0x00004000u) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(7, this->crop_scale(), target); } // optional string input_blob_name = 8; if (cached_has_bits & 0x00000001u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( this->input_blob_name().data(), static_cast<int>(this->input_blob_name().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, "apollo.perception.camera.traffic_light.detection.DetectionParam.input_blob_name"); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteStringToArray( 8, this->input_blob_name(), target); } // optional string im_param_blob_name = 9; if (cached_has_bits & 0x00000002u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( this->im_param_blob_name().data(), static_cast<int>(this->im_param_blob_name().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, "apollo.perception.camera.traffic_light.detection.DetectionParam.im_param_blob_name"); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteStringToArray( 9, this->im_param_blob_name(), target); } // optional string output_blob_name = 10; if (cached_has_bits & 0x00000004u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( this->output_blob_name().data(), static_cast<int>(this->output_blob_name().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, "apollo.perception.camera.traffic_light.detection.DetectionParam.output_blob_name"); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteStringToArray( 10, this->output_blob_name(), target); } // optional string model_name = 11 [default = "RTNet"]; if (cached_has_bits & 0x00000008u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( this->model_name().data(), static_cast<int>(this->model_name().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, "apollo.perception.camera.traffic_light.detection.DetectionParam.model_name"); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteStringToArray( 11, this->model_name(), target); } // optional string model_type = 12 [default = "RTNet"]; if (cached_has_bits & 0x00000010u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( this->model_type().data(), static_cast<int>(this->model_type().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, "apollo.perception.camera.traffic_light.detection.DetectionParam.model_type"); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteStringToArray( 12, this->model_type(), target); } // optional string proto_file = 13 [default = "caffe.pt"]; if (cached_has_bits & 0x00000020u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( this->proto_file().data(), static_cast<int>(this->proto_file().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, "apollo.perception.camera.traffic_light.detection.DetectionParam.proto_file"); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteStringToArray( 13, this->proto_file(), target); } // optional string weight_file = 14 [default = "caffe.model"]; if (cached_has_bits & 0x00000040u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( this->weight_file().data(), static_cast<int>(this->weight_file().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, "apollo.perception.camera.traffic_light.detection.DetectionParam.weight_file"); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteStringToArray( 14, this->weight_file(), target); } // optional int32 max_batch_size = 15 [default = 1]; if (cached_has_bits & 0x00000100u) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(15, this->max_batch_size(), target); } if (_internal_metadata_.have_unknown_fields()) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields(), target); } // @@protoc_insertion_point(serialize_to_array_end:apollo.perception.camera.traffic_light.detection.DetectionParam) return target; } size_t DetectionParam::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:apollo.perception.camera.traffic_light.detection.DetectionParam) size_t total_size = 0; if (_internal_metadata_.have_unknown_fields()) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::ComputeUnknownFieldsSize( _internal_metadata_.unknown_fields()); } ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x000000ffu) { // optional string input_blob_name = 8; if (cached_has_bits & 0x00000001u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( this->input_blob_name()); } // optional string im_param_blob_name = 9; if (cached_has_bits & 0x00000002u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( this->im_param_blob_name()); } // optional string output_blob_name = 10; if (cached_has_bits & 0x00000004u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( this->output_blob_name()); } // optional string model_name = 11 [default = "RTNet"]; if (cached_has_bits & 0x00000008u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( this->model_name()); } // optional string model_type = 12 [default = "RTNet"]; if (cached_has_bits & 0x00000010u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( this->model_type()); } // optional string proto_file = 13 [default = "caffe.pt"]; if (cached_has_bits & 0x00000020u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( this->proto_file()); } // optional string weight_file = 14 [default = "caffe.model"]; if (cached_has_bits & 0x00000040u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( this->weight_file()); } // optional int32 crop_method = 2 [default = 0]; if (cached_has_bits & 0x00000080u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( this->crop_method()); } } if (cached_has_bits & 0x00007f00u) { // optional int32 max_batch_size = 15 [default = 1]; if (cached_has_bits & 0x00000100u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( this->max_batch_size()); } // optional int32 min_crop_size = 1 [default = 270]; if (cached_has_bits & 0x00000200u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( this->min_crop_size()); } // optional float mean_b = 3 [default = 95]; if (cached_has_bits & 0x00000400u) { total_size += 1 + 4; } // optional float mean_g = 4 [default = 99]; if (cached_has_bits & 0x00000800u) { total_size += 1 + 4; } // optional float mean_r = 5 [default = 96]; if (cached_has_bits & 0x00001000u) { total_size += 1 + 4; } // optional bool is_bgr = 6 [default = true]; if (cached_has_bits & 0x00002000u) { total_size += 1 + 1; } // optional float crop_scale = 7 [default = 2.5]; if (cached_has_bits & 0x00004000u) { total_size += 1 + 4; } } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } void DetectionParam::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { // @@protoc_insertion_point(generalized_merge_from_start:apollo.perception.camera.traffic_light.detection.DetectionParam) GOOGLE_DCHECK_NE(&from, this); const DetectionParam* source = ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<DetectionParam>( &from); if (source == nullptr) { // @@protoc_insertion_point(generalized_merge_from_cast_fail:apollo.perception.camera.traffic_light.detection.DetectionParam) ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); } else { // @@protoc_insertion_point(generalized_merge_from_cast_success:apollo.perception.camera.traffic_light.detection.DetectionParam) MergeFrom(*source); } } void DetectionParam::MergeFrom(const DetectionParam& from) { // @@protoc_insertion_point(class_specific_merge_from_start:apollo.perception.camera.traffic_light.detection.DetectionParam) GOOGLE_DCHECK_NE(&from, this); _internal_metadata_.MergeFrom(from._internal_metadata_); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = from._has_bits_[0]; if (cached_has_bits & 0x000000ffu) { if (cached_has_bits & 0x00000001u) { _has_bits_[0] |= 0x00000001u; input_blob_name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.input_blob_name_); } if (cached_has_bits & 0x00000002u) { _has_bits_[0] |= 0x00000002u; im_param_blob_name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.im_param_blob_name_); } if (cached_has_bits & 0x00000004u) { _has_bits_[0] |= 0x00000004u; output_blob_name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.output_blob_name_); } if (cached_has_bits & 0x00000008u) { _has_bits_[0] |= 0x00000008u; model_name_.AssignWithDefault(&::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_model_name_.get(), from.model_name_); } if (cached_has_bits & 0x00000010u) { _has_bits_[0] |= 0x00000010u; model_type_.AssignWithDefault(&::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_model_type_.get(), from.model_type_); } if (cached_has_bits & 0x00000020u) { _has_bits_[0] |= 0x00000020u; proto_file_.AssignWithDefault(&::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_proto_file_.get(), from.proto_file_); } if (cached_has_bits & 0x00000040u) { _has_bits_[0] |= 0x00000040u; weight_file_.AssignWithDefault(&::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_weight_file_.get(), from.weight_file_); } if (cached_has_bits & 0x00000080u) { crop_method_ = from.crop_method_; } _has_bits_[0] |= cached_has_bits; } if (cached_has_bits & 0x00007f00u) { if (cached_has_bits & 0x00000100u) { max_batch_size_ = from.max_batch_size_; } if (cached_has_bits & 0x00000200u) { min_crop_size_ = from.min_crop_size_; } if (cached_has_bits & 0x00000400u) { mean_b_ = from.mean_b_; } if (cached_has_bits & 0x00000800u) { mean_g_ = from.mean_g_; } if (cached_has_bits & 0x00001000u) { mean_r_ = from.mean_r_; } if (cached_has_bits & 0x00002000u) { is_bgr_ = from.is_bgr_; } if (cached_has_bits & 0x00004000u) { crop_scale_ = from.crop_scale_; } _has_bits_[0] |= cached_has_bits; } } void DetectionParam::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { // @@protoc_insertion_point(generalized_copy_from_start:apollo.perception.camera.traffic_light.detection.DetectionParam) if (&from == this) return; Clear(); MergeFrom(from); } void DetectionParam::CopyFrom(const DetectionParam& from) { // @@protoc_insertion_point(class_specific_copy_from_start:apollo.perception.camera.traffic_light.detection.DetectionParam) if (&from == this) return; Clear(); MergeFrom(from); } bool DetectionParam::IsInitialized() const { return true; } void DetectionParam::Swap(DetectionParam* other) { if (other == this) return; InternalSwap(other); } void DetectionParam::InternalSwap(DetectionParam* other) { using std::swap; _internal_metadata_.Swap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); input_blob_name_.Swap(&other->input_blob_name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); im_param_blob_name_.Swap(&other->im_param_blob_name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); output_blob_name_.Swap(&other->output_blob_name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual()); model_name_.Swap(&other->model_name_, &::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_model_name_.get(), GetArenaNoVirtual()); model_type_.Swap(&other->model_type_, &::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_model_type_.get(), GetArenaNoVirtual()); proto_file_.Swap(&other->proto_file_, &::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_proto_file_.get(), GetArenaNoVirtual()); weight_file_.Swap(&other->weight_file_, &::apollo::perception::camera::traffic_light::detection::DetectionParam::_i_give_permission_to_break_this_code_default_weight_file_.get(), GetArenaNoVirtual()); swap(crop_method_, other->crop_method_); swap(max_batch_size_, other->max_batch_size_); swap(min_crop_size_, other->min_crop_size_); swap(mean_b_, other->mean_b_); swap(mean_g_, other->mean_g_); swap(mean_r_, other->mean_r_); swap(is_bgr_, other->is_bgr_); swap(crop_scale_, other->crop_scale_); } ::PROTOBUF_NAMESPACE_ID::Metadata DetectionParam::GetMetadata() const { return GetMetadataStatic(); } // @@protoc_insertion_point(namespace_scope) } // namespace detection } // namespace traffic_light } // namespace camera } // namespace perception } // namespace apollo PROTOBUF_NAMESPACE_OPEN template<> PROTOBUF_NOINLINE ::apollo::perception::camera::traffic_light::detection::DetectionParam* Arena::CreateMaybeMessage< ::apollo::perception::camera::traffic_light::detection::DetectionParam >(Arena* arena) { return Arena::CreateInternal< ::apollo::perception::camera::traffic_light::detection::DetectionParam >(arena); } PROTOBUF_NAMESPACE_CLOSE // @@protoc_insertion_point(global_scope) #include <google/protobuf/port_undef.inc>
7821b1d10c59cd082209fe3e9d6fa88a5513a2ed
6911d7ba9eb53bd885917e6fbed8eec694f00488
/ValiableGravity/ValiableGravity/Device/Impl/Mouse.cpp
14edad07ae3ea30255523b931261067db5394e37
[]
no_license
KORYUOH/koryuohproject-svn-server
86fc2128546bb6000af65f65e210775004cd03fc
eea045863cab70fc8534917b6a1356690e6fc10e
refs/heads/master
2021-01-19T13:25:33.993255
2015-04-04T08:10:21
2015-04-04T08:10:21
32,276,044
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
5,386
cpp
Mouse.cpp
/**===File Commentary=======================================*/ /** * @file Mouse.cpp * * @brief OpenGLマウスクラス実装 * * @author KORYUOH * * @date 2012/04/29 */ /**===File Include=========================================*/ #include <Define/ClassDefine.h> #include <Device/Impl/Mouse.h> #include <cmath> #include <cassert> /**===Class Implementation=================================*/ /**========================================================*/ /** * @brief 静的メンバ変数の初期化 * @author KORYUOH */ /**========================================================*/ int GLMouse::mButton = -1; int GLMouse::mState = 0; GLMouse::Position GLMouse::mPos = GLMouse::Position(); GLMouse::Position GLMouse::mDrag = GLMouse::Position(); /**========================================================*/ /** * @brief コンストラクタ * @author KORYUOH */ /**========================================================*/ GLMouse::GLMouse(){}; /**========================================================*/ /** * @brief 更新 * @author KORYUOH */ /**========================================================*/ void GLMouse::update(void){ glutPassiveMotionFunc(positionUpdate); glutMouseFunc(callBack); } /**========================================================*/ /** * @brief コールバック関数 * @param[in] マウスボタン * @param[in] ボタン状態 * @author KORYUOH */ /**========================================================*/ void GLMouse::callBack(int button,int state, int x, int y){ mButton = button; mState = state; mPos.x_ = x; mPos.y_ = y; mDrag.x_ = x; mDrag.y_ = y; } /**========================================================*/ /** * @brief クリックされているか? * @param[in] ボタン * @param[in] 状態 * @author KORYUOH */ /**========================================================*/ bool GLMouse::MouseClick(int button,int state)const{ if(mButton == button && mState == state) return true; return false; } /**========================================================*/ /** * @brief 矩形内チェック * @param[in] 比較範囲 * @param[in] マウス位置 * @attention 無記名名前空間内 * @author KORYUOH * @return 入っていれば真 */ /**========================================================*/ namespace{ bool rectCheck(GSrect& rect,GSrect& mou){ if(rect.top<mou.top&&mou.top<rect.bottom) if(rect.left<mou.left&& mou.left <rect.right) return true; return false; } } /**========================================================*/ /** * @brief 衝突判定 * @param[in] 衝突範囲 * @param[in] マウスボタン * @param[in] 状態 * @author KORYUOH * @return 入っている状態でstateなら真 */ /**========================================================*/ bool GLMouse::MouseCollision(GSrect& rect,int button,int state)const{ if(MouseClick(button,state)){ if(rectCheck(rect,GSrect(mPos.x_,mPos.y_))) return true; } return false; } /**========================================================*/ /** * @brief ドラッグ状態コールバック関数 * @param[in] x座標 * @param[in] y座標 * @author KORYUOH */ /**========================================================*/ void GLMouse::drug(int x,int y){ mDrag.x_ = x; mDrag.y_ = y; } /**========================================================*/ /** * @brief ドラッグ状態コールバック関数 * @param[in] x座標 * @param[in] y座標 * @author KORYUOH */ /**========================================================*/ void GLMouse::toDrag(int button,int state){ switch(state){ case MOUSE_STATE_UP: glutPassiveMotionFunc(drug); break; case MOUSE_STATE_DOWN: motionCall(button,state); break; default: assert(false); } } /**========================================================*/ /** * @brief マウス位置の取得 * @author KORYUOH * @return マウス座標 */ /**========================================================*/ GLMouse::Position GLMouse::getMousePosition()const{ return mPos; } /**========================================================*/ /** * @brief マウス位置の更新コールバック * @author KORYUOH */ /**========================================================*/ void GLMouse::positionUpdate(int x,int y){ mPos.x_ = x; mPos.y_ = y; mDrag = mPos; } /**========================================================*/ /** * @brief 長さの取得 * @author KORYUOH * @return 長さ */ /**========================================================*/ float GLMouse::length(){ Position tmp = mPos - mDrag; return std::sqrt((float)(tmp.x_*tmp.x_+tmp.y_*tmp.y_)); } /**========================================================*/ /** * @brief 長さの取得 * @author KORYUOH * @return 長さ */ /**========================================================*/ float GLMouse::angle(){ Position tmp(0,480); if(mState == MOUSE_STATE_UP) tmp -= mPos; else tmp -= mDrag; return std::atan2f(tmp.y_,-tmp.x_); } void GLMouse::motionCall(int button,int state){ if(MouseClick(button,state)) glutMotionFunc(drug); else glutMotionFunc(NULL); } /**===End Of File==========================================*/
fc271215783a8907099133aec9cdcda463bf37b2
f5b20bb341b8ba7351714f5c55a8cc2b4640ca82
/GcnAsmTest/OpenclRunner/ShuffleOperations.h
f10cb9517c8023e70cf974e343ac76215be09c55
[ "MIT" ]
permissive
tupieurods/gcn_asm_test
f0979500e45524db1fce03b763d942fe5c3baa91
99de34b0722b4a469d449c4cfc5dde66fc0eaa9d
refs/heads/master
2021-01-06T16:46:07.004558
2020-04-24T12:36:43
2020-04-24T12:36:43
241,404,111
0
0
null
null
null
null
UTF-8
C++
false
false
709
h
ShuffleOperations.h
#pragma once #include "OpenclHelpers.h" #include "utils.h" inline uint8_t ShuffleIndexes1[64] = { 0x35, 0x20, 0x00, 0x29, 0x0d, 0x2a, 0x19, 0x02, 0x17, 0x15, 0x18, 0x3f, 0x26, 0x2e, 0x34, 0x1f, 0x2c, 0x33, 0x2b, 0x30, 0x01, 0x1c, 0x27, 0x0f, 0x37, 0x25, 0x24, 0x16, 0x3c, 0x06, 0x3e, 0x14, 0x28, 0x11, 0x3b, 0x0a, 0x31, 0x03, 0x13, 0x07, 0x36, 0x04, 0x0e, 0x22, 0x23, 0x21, 0x0b, 0x3d, 0x3a, 0x2d, 0x09, 0x1a, 0x12, 0x32, 0x10, 0x1e, 0x1b, 0x08, 0x0c, 0x39, 0x05, 0x1d, 0x2f, 0x38 }; void ExecuteShuffleOperationsKernel( cl::CommandQueue commandQueue, cl::Kernel kernel, cl::Buffer aBuffer, cl::Buffer bBuffer, std::array<cl_uint, WORKSIZE> a, std::array<cl_uint, WORKSIZE> b );
0a8f6058bb07bcf94af6d04a804bfa420aa12208
46e1796795eadd2f2cb7aa2d570594ae7c288885
/csci41/lec33/inheritance.cpp
23e4ef97e1d30d3e8f0b29eb117452fa4bc80e6d
[]
no_license
lawtonsclass/f20-code-from-class
1afb7f7a6d230f6af9e368f13e4df8634d86a011
34db321491455044a14d029fff11ea81309f6792
refs/heads/master
2023-01-20T04:57:11.353707
2020-11-27T03:59:53
2020-11-27T03:59:53
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,635
cpp
inheritance.cpp
#include <iostream> #include <string> #include <vector> using namespace std; // this is an "abstract class"--it can't be instantiated class MacLaptop { protected: // protected lets us use these things in subclasses double price; int batteryLife; public: MacLaptop(double price, int batteryLife) : price(price), batteryLife(batteryLife) {} double getPrice() const { return price; } int getBatteryLife() const { return batteryLife; } virtual bool runsWindows() const = 0; // pure virtual method }; class MacBookAirIntel : public MacLaptop { protected: string processorModel; public: MacBookAirIntel(double price, int batteryLife, string processorModel) : MacLaptop(price, batteryLife), processorModel(processorModel) {} string getProcessorModel() const { return processorModel; } bool runsWindows() const override { return true; } }; class MacBookProM1 : public MacLaptop { public: MacBookProM1(double price, int batteryLife) : MacLaptop(price, batteryLife) {} bool runsWindows() const override { return false; } bool isOwnedByAHipster() const { return true; } }; int main() { /* MacLaptop ml(42, 42); // can't do this */ MacBookAirIntel mai(999, 8, "i5"); MacBookProM1 mbpm1(9999, 42); cout << mai.getProcessorModel() << endl; cout << mai.getPrice() << endl; cout << mai.runsWindows() << endl; cout << mbpm1.getBatteryLife() << endl; cout << mbpm1.runsWindows() << endl; cout << mbpm1.isOwnedByAHipster() << endl; // we can treat subclasses like the base class! vector<MacLaptop*> v = {&mai, &mbpm1}; cout << v.at(0)->runsWindows() << endl; return 0; }
0cb8d93cd6835064be09698af4b84aeeab942cdb
7063c3de7e6ae208cabad6f72abb01c6a0952fd2
/Soluer/GameLevel.h
d926031d84fcb29fb5503e9f73ba3feab409d3a6
[]
no_license
AI-Decay/PetGame
35d56b14805ba0ef71a33944e2fb804475efa3b4
39b6b4666027104f668926d347e068b2382cf1c1
refs/heads/master
2020-11-25T21:59:17.774864
2020-01-29T10:25:52
2020-01-29T10:25:52
228,863,193
1
0
null
null
null
null
UTF-8
C++
false
false
766
h
GameLevel.h
#pragma once #include <memory> #include "Graphics.h" #include "SpriteSheet.h" #include "GameTime.h" class GameLevel { protected: static std::shared_ptr<Graphics> gfx; std::unique_ptr<GameTime> time; float jumpHight = 100.0f; bool jump = false; bool mRight = false; bool mLeft = false; bool onPlatform = false; public: static void Init(std::shared_ptr<Graphics> graphics); virtual void Load() = 0; virtual void Unload() = 0; virtual void Render() = 0; virtual void Update() = 0; virtual void Move(float x, float y) = 0; virtual void Jump() = 0; virtual void Shot() = 0; void EnableJump() { if(onPlatform) jump = true; } void EnablemRight() { mRight = true; } void EnablemLeft() { mLeft = true; } void JumpHeightDefault() { jumpHight = 100.0f; } };
c102183e80d23462289c157ffe741964273d7f3d
66b92f429ba7fb7336177b3dfc5e0999fbae94b9
/HDRR demo/OGLF/PostProcessingFX.cpp
43ff90e6078fe407b7c787274d13e6aa3bc67873
[]
no_license
dletozeun/3D
2a9094a083e3b76b9cc1e02f337e773808ff32d7
8ca77e4eaf842d4dfc353492d1dc21106f0f203a
refs/heads/master
2021-01-19T14:57:30.677479
2014-05-17T16:33:11
2014-05-17T16:33:11
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,837
cpp
PostProcessingFX.cpp
#include <string> #include "PostProcessingFX.h" #include "Renderer.h" using namespace std; namespace Oglf { PostProcessingFX::PostProcessingFX( const string& sName, Renderer* pRenderer ) : Namable( sName ) , m_pOutputRT( NULL ) , m_pRenderer( pRenderer ) , m_bRenderToScreen( false ) { if( m_pRenderer == NULL ) throw Error( "PostProcessingFX::PostProcessingFX error : Invalid renderer!" ); m_pOutputRT = new RenderTexture(); } PostProcessingFX::~PostProcessingFX() { delete m_pOutputRT; vector< PassFx* >::iterator oPassIt = m_vPasses.begin(); for( oPassIt; oPassIt != m_vPasses.end(); ++oPassIt ) delete *oPassIt; } void PostProcessingFX::addPass( string sName, std::string sFXshaderFilename , string sInputTexSamplerName, Texture2D* pInputTex, Texture2D* pOutputTex ) { if( m_bRenderToScreen ) throw Error( "PostProcessingFX::addPass error : you can't add an additional pass!" ); PassFx* pPass = new PassFx( sName, sFXshaderFilename, sInputTexSamplerName, pInputTex, pOutputTex ); m_vPasses.push_back( pPass ); if( pOutputTex == NULL ) { m_bRenderToScreen = true; m_pRenderer->addPostProcessingFX( *this ); } } void PostProcessingFX::compute() { vector< PassFx* >::iterator oPassIt = m_vPasses.begin(); // Set the projection matrix to 2D projection glMatrixMode( GL_PROJECTION ); glPushMatrix(); glLoadIdentity(); glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0 ); glMatrixMode( GL_MODELVIEW ); glPushMatrix(); glLoadIdentity(); glPushAttrib( GL_VIEWPORT_BIT ); bool bDepthTest = false; if( glIsEnabled( GL_DEPTH_TEST ) == GL_TRUE ) { glDisable( GL_DEPTH_TEST ); bDepthTest = true; } RenderingFX* pRfx = NULL; Texture2D* pOutputTex = NULL; for( oPassIt; oPassIt != m_vPasses.end(); ++oPassIt ) { pRfx = ( *oPassIt )->m_pRfx; pOutputTex = ( *oPassIt )->m_pOutputTex; if( pOutputTex != NULL ) { m_pOutputRT->setTexture( *pOutputTex ); m_pOutputRT->bind(); glViewport(0, 0, pOutputTex->getWidth(), pOutputTex->getHeight()); } else { m_pOutputRT->bind( false ); glViewport(0, 0, m_pRenderer->getRenderTargetWidth(), m_pRenderer->getRenderTargetHeight() ); } pRfx->enable(); glBegin(GL_QUADS); glTexCoord2f(0.0, 0.0); glVertex2f(0.0, 0.0); glTexCoord2f(1.0, 0.0); glVertex2f(1.0, 0.0); glTexCoord2f(1.0, 1.0); glVertex2f(1.0, 1.0); glTexCoord2f(0.0, 1.0); glVertex2f(0.0, 1.0); glEnd(); if( pOutputTex!= NULL && pOutputTex->isMipmapped() ) { pOutputTex->bind(); glGenerateMipmapEXT( GL_TEXTURE_2D ); pOutputTex->bind( false ); } } pRfx->disable(); if( bDepthTest ) glEnable( GL_DEPTH_TEST ); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); glPopAttrib(); } }
fb43de9990de04da29dcb2c31afb06cda9cc33de
b4e1ae98329725a72b10487682decd7d6e69b4c3
/adjecency matrix/main.cpp
34ef16fafd65295436a0038c221ee5d7d89e6f66
[]
no_license
bhavya1224/Its-all-code
2105d543d75f8514b977d76651a8c9bfbd82bf89
be3de9edb3c23e7842466ee15bb5b36d6b7e4244
refs/heads/master
2022-09-07T00:45:22.170484
2020-05-29T11:23:22
2020-05-29T11:23:22
266,622,557
0
0
null
null
null
null
UTF-8
C++
false
false
1,446
cpp
main.cpp
#include <bits/stdc++.h> using namespace std; void add_Edge(int **adm,int SN, int EN, int W, string s) { if (s == "yes") { adm[SN-1][EN-1] = W; } else { adm[SN-1][EN-1] = W; adm[EN-1][SN-1] = W; } } int main() { int nodes; int edges; string s; cout<<"Please enter the number of nodes in the graph"; cin>>nodes; int SN, EN, W; cout<<"Please enter the number of edges in the graph"; cin>>edges; cout<<"Is the graph directed"; cin>>s; cout<<"Adjacency Matrix Representation:"<<endl; for(int i = 0; i<nodes; i++) { for(int j = 0; j<nodes; j++) { cout<<"0"; } cout<<endl; } int **adm = (int **)malloc(nodes * sizeof(int *)); for(int i = 0; i<nodes; i++) { adm[i] = (int *)malloc(nodes * sizeof(int)); } for(int i = 0; i<nodes; i++) { for(int j = 0; j<nodes; j++) { adm[i][j] = 0 ; } } for(int i = 0; i < edges; i++) { cout<<"Enter the start node, end node and weight of edge no"<<i+1; cin >> SN; cin >> EN; cin >> W; add_Edge(adm,SN,EN,W,s); } for(int i = 0; i<nodes; i++) { for(int j = 0; j<nodes; j++) { cout<<adm[i][j]; } cout<<endl; } }
93e513fa0a6db531c61927892878e61c88eac1bd
86baaa6bbe4088275cdb11d7804e2b6406ba8bbb
/example1/example1_module/Algorithm/Deadreckoning/VisualizationMono/Edit/VisualizationMono_Algorithm_Deadreckoning_Vars.h
9df25eef251cb0bfeb34dcc5f55d28e286d17259
[]
no_license
wr786/I2IR-Archive
601e1010b058cf0f9f74cbf3be7ee546b99a648e
db4926b8e5630cfc1a4fde0da173f499dce92faf
refs/heads/main
2023-01-18T22:42:07.547067
2020-11-24T14:46:44
2020-11-24T14:46:44
299,824,100
2
0
null
null
null
null
UTF-8
C++
false
false
2,349
h
VisualizationMono_Algorithm_Deadreckoning_Vars.h
//You need to modify this file. #ifndef VISUALIZATIONMONO_ALGORITHM_DEADRECKONING_VARS_H #define VISUALIZATIONMONO_ALGORITHM_DEADRECKONING_VARS_H #include<RobotSDK_Global.h> /*! \defgroup VisualizationMono_Algorithm_Deadreckoning_Vars VisualizationMono_Algorithm_Deadreckoning_Vars \ingroup VisualizationMono_Algorithm_Deadreckoning \brief VisualizationMono_Algorithm_Deadreckoning_Vars defines the Vars in VisualizationMono_Algorithm_Deadreckoning. */ /*! \addtogroup VisualizationMono_Algorithm_Deadreckoning_Vars @{ */ /*! \file VisualizationMono_Algorithm_Deadreckoning_Vars.h Defines the Vars of VisualizationMono_Algorithm_Deadreckoning */ //*******************Please add other headers below******************* #include <opencv/cv.h> #include<opencv/cxcore.h> #include <opencv/highgui.h> #include "../example1_module/Algorithm/Deadreckoning/VisualizationMono/Mat2img.h" #include "VisualizationMono_Algorithm_Deadreckoning_ParamsData.h" #include <vector> //The Vars is defined as below /*! \class VisualizationMono_Algorithm_Deadreckoning_Vars \brief The Vars of VisualizationMono_Algorithm_Deadreckoning. \details **Please add details below** */ class ROBOTSDK_OUTPUT VisualizationMono_Algorithm_Deadreckoning_Vars { public: /*! \fn VisualizationMono_Algorithm_Deadreckoning_Vars() \brief The constructor of VisualizationMono_Algorithm_Deadreckoning_Vars. [required] \details ****Please add details below**** */ VisualizationMono_Algorithm_Deadreckoning_Vars() { track=new QLabel(); track->setAlignment(Qt::AlignCenter); //lastpoint.x=-10000; //robottrack=new cv::Mat(); //temprobottrack=new cv::Mat(); } /*! \fn ~VisualizationMono_Algorithm_Deadreckoning_Vars() \brief The destructor of VisualizationMono_Algorithm_Deadreckoning_Vars. [required] \details *****Please add details below***** */ ~VisualizationMono_Algorithm_Deadreckoning_Vars() { if(track->parent()==NULL){ delete track; } // robottrack->release(); //temprobottrack->release(); } public: //*******************Please add variables below******************* QLabel *track; //累计图像 cv::Mat robottrack; cv::Point2d lastpoint; //实时显示图像 cv::Mat temprobottrack; //初始状态标志 bool init; }; /*! @}*/ #endif
30b6024426c98855587b35aafc0df4e1a9ea2ae0
ca7a68d83ea9051068ac7ada1997d9253883b0da
/lab2/cannible.cpp
4f9282c3cadf88d7a1df0aaa73aaf680a18e9a82
[]
no_license
anuragshirolkar/AI-labs
384713430133248dd3e16b55b11a13bd1d73993c
468ba3182557e6c6cfb3296136c572cf4e2cbe83
refs/heads/master
2021-01-21T19:06:06.428864
2015-04-28T22:06:38
2015-04-28T22:06:38
29,127,508
0
0
null
null
null
null
UTF-8
C++
false
false
2,598
cpp
cannible.cpp
#include <algorithm> #include <iostream> #include <vector> using namespace std; /** * structure to denote state of the problem */ struct node { int cannibals, priests; bool boatstate; void print(); bool valid(); node(){}; node(int c, int p, bool b) { cannibals = c; priests = p; boatstate = b; } }; bool operator<(const node &a, const node &b) { if (a.cannibals != b.cannibals) return a.cannibals < b.cannibals; if (a.priests != b.priests) return a.priests < b.priests; return false; } bool operator==(const node &a, const node &b) { if (a.cannibals != b.cannibals || a.priests != b.priests || a.boatstate != b.boatstate) return false; return true; } struct KeyHasher { std::size_t operator()(const node& k) const { int count = 0; count += k.cannibals; count = count*4+k.priests; count = count*2+k.boatstate; return count; } }; void node::print() { cout << "Cannibals: " << cannibals << endl; cout << "Priests : " << priests << endl; if (boatstate) cout << "Boat on the left" << endl; else cout << "Boat on the right" << endl; cout << endl; } bool node::valid() { if (cannibals < 0 || cannibals > 3 || priests < 0 || priests > 3) return false; if ((priests == 3) || (priests == 0)) return true; if (cannibals == priests) return true; return false; } /** * structure to denote the problem as a graph */ struct graph { node start, goal; graph(); vector<pair<node, int> > next(node &); int h(node &); }; graph::graph() { start.cannibals = 3; start.priests = 3; start.boatstate = true; goal.cannibals = 0; goal.priests = 0; goal.boatstate = false; } vector<pair<node, int> > graph::next(node &n) { vector<pair<node, int> > v; if (n.boatstate) { node a[5]; a[0] = *(new node(n.cannibals-2, n.priests, !n.boatstate)); a[1] = *(new node(n.cannibals-1, n.priests, !n.boatstate)); a[2] = *(new node(n.cannibals-1, n.priests-1, !n.boatstate)); a[3] = *(new node(n.cannibals, n.priests-1, !n.boatstate)); a[4] = *(new node(n.cannibals, n.priests-2, !n.boatstate)); for (int i = 0; i < 5; i++) if(a[i].valid()) v.push_back(pair<node, int>(a[i], 1)); } else { node a[5]; a[0] = *(new node(n.cannibals+2, n.priests, !n.boatstate)); a[1] = *(new node(n.cannibals+1, n.priests, !n.boatstate)); a[2] = *(new node(n.cannibals+1, n.priests+1, !n.boatstate)); a[3] = *(new node(n.cannibals, n.priests+1, !n.boatstate)); a[4] = *(new node(n.cannibals, n.priests+2, !n.boatstate)); for (int i = 0; i < 5; i++) if(a[i].valid()) v.push_back(pair<node, int>(a[i], 1)); } return v; } int graph::h(node & n) { return 0; }
8d22220f76da07de7c0be33f179fecd4c59358a3
5661921fd7adcd75444c46107cb57e55a3f66953
/SafeQueue.h
536b89eefdb133ca13fd3d1e2ae123afe5e4c5e8
[]
no_license
Squidiot/MazeMaker
51958773b4175256e87673300e053fb13a9cce42
c5e16b926216794956d3e17b50c745c0ddf06907
refs/heads/master
2023-03-09T08:07:31.198732
2021-02-25T00:45:15
2021-02-25T00:45:15
86,031,153
0
0
null
null
null
null
UTF-8
C++
false
false
440
h
SafeQueue.h
#ifndef SAFEQUEUE_HEADER #define SAFEQUEUE_HEADER #include <mutex> #include <condition_variable> #include <queue> struct PrintData { int row, col, color; char str[4]; static const PrintData* kill; }; class SafeQueue { std::queue<const PrintData*> values; std::mutex mtx; std::condition_variable condition; public: const PrintData* read(); void write(const PrintData* data); }; #endif
5a6e9eb739a32ddcb00b95623d1bb78a36d629e7
8eb41f92d93c7af25295fdf831a73b4617351e9e
/SoftTerminal/src/stconfig.cpp
3d261ebed5bf0aa0c1e66391092f9e1f55b009b5
[]
no_license
sunpu/softterminal
adbc611e95debcbc78af246fcc23f698fdc83900
c1a6f98c412287dd1e7593412155ca01427f242b
refs/heads/master
2021-01-24T11:21:57.678887
2018-06-20T06:22:53
2018-06-20T06:22:53
123,078,740
0
0
null
null
null
null
UTF-8
C++
false
false
804
cpp
stconfig.cpp
#include "stconfig.h" using namespace tahiti; STConfig::STConfig() { } STConfig::~STConfig() { } QString STConfig::getConfig(QString key) { QString path = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + DATA_ROOT_PATH + CONFIG_PATH + CONFIG_FILE_NAME; QSettings* config = new QSettings(path, QSettings::IniFormat); config->setIniCodec("UTF8"); QString value = config->value(key).toString(); delete config; return value; } void STConfig::setConfig(QString key, QString value) { QString path = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + DATA_ROOT_PATH + CONFIG_PATH + CONFIG_FILE_NAME; QSettings* config = new QSettings(path, QSettings::IniFormat); config->setIniCodec("UTF8"); config->setValue(key, value); delete config; }
96a155fefce49b293b33756104a148586d9fb74b
2947bd4fdcb608ced8b55b0375a9f3e02fc46ee7
/Year3Engine/GameScreen.cpp
495eec10d478be63dfc41b307e4a2db22cd77b78
[ "MIT" ]
permissive
EvanCGriffin/soccergame
4f542db93a532aa202a90497fd3c6bd18805b8f0
8056b39a4c7adfab3aa47333237474fc8250e7ac
refs/heads/master
2020-05-25T10:19:40.417860
2014-03-02T19:17:24
2014-03-02T19:17:24
17,344,069
2
0
null
null
null
null
UTF-8
C++
false
false
795
cpp
GameScreen.cpp
#include "GameScreen.h" #include "Engine.h" GameScreen::GameScreen() :paused(false) { } GameScreen::~GameScreen(void) { components.clear(); } void GameScreen::LoadContent() { } void GameScreen::HandleInput(Input input) { for (compIter = components.begin(); compIter != components.end(); compIter++) (*compIter)->HandleInput(input); } void GameScreen::Update(float deltaTime) { for (compIter = components.begin(); compIter != components.end(); compIter++) (*compIter)->Update(deltaTime); } void GameScreen::Draw() { for (compIter = components.begin(); compIter != components.end(); compIter++) (*compIter)->Draw(); } void GameScreen::AddComponent(shared_ptr<GameComponent> component) { component->parent = this; component->LoadContent(); components.push_back(component); }
7332fd89a98146818264b9c5337aaa3193dea53c
32bdcae61d616a4a711564f23123a730592f18af
/repeating/struct2.cpp
f85a7269be7f054727330c67b9d5eeb00da7fbe0
[]
no_license
ndina/competitive-programming
e47ebc9a9bdf81ee49668116bd2238f588c30718
be4896d05d350bfcb890e26a9f40d7ef7a4c008b
refs/heads/master
2020-03-19T10:25:08.074327
2018-06-22T08:58:39
2018-06-22T08:58:39
136,368,286
2
1
null
null
null
null
UTF-8
C++
false
false
398
cpp
struct2.cpp
#include <iostream> #include <algorithm> using namespace std; struct f{ string n,s; double a1, b ,c; //r1, r2 ,r3; }; int main(){ int n; double r1 = 0, r2 = 0, r3 = 0; cin >> n; f a[n]; for(int i = 0; i < n; i ++){ cin >> a[i].n >> a[i].s >> a[i].a1 >> a[i].b >> a[i].c; r1 += a[i].a1; r2 += a[i].b; r3 += a[i].c; } cout <<r1 / n << " " << r2 / n << " " << r3 / n; }
11230dfc0be2283d8f5bb000889e5625606fef47
a878a9e9fabe8538fef85a3eb90f05751db97713
/src/Hpipe/CppEmitter.h
747df5f52ed6fb8be3bee84ab73947f49515d48e
[ "Apache-2.0" ]
permissive
hleclerc/Hpipe
7ba638e7db8cf8709f61e9f3adf2b00ca0cc712c
5ac7fa1fa2a2a4aaf2826ae793c799ddd828ac6c
refs/heads/master
2020-05-21T19:14:22.645379
2017-06-01T22:15:52
2017-06-01T22:15:52
60,592,056
2
0
null
null
null
null
UTF-8
C++
false
false
2,282
h
CppEmitter.h
#pragma once #include "InstructionGraph.h" namespace Hpipe { /** */ class CppEmitter { public: using VariableMap = CharGraph::VariableMap; using Variable = CharGraph::Variable; enum { BT_HPIPE_CB_STRING_PTR, BT_HPIPE_BUFFER, BT_BEG_END, BT_C_STR, }; CppEmitter(); void read ( InstructionGraph *sg ); // functions to be called after read void write_preliminaries( StreamSepMaker &ss ); void write_declarations ( StreamSepMaker &ss ); void write_definitions ( StreamSepMaker &ss ); int test ( const std::vector<Lexer::TestData> &tds ); bool bench ( const std::vector<Lexer::TrainingData> &tds ); // attributes to be modified before read() int stop_char; ///< used if type == C_STR int buffer_type; ///< BT_... bool trace_labels; ///< // helpers for Instruction*::... bool interruptible () const; bool need_buf () const; std::string repl_data ( std::string code, const std::string &repl ); void write_label ( StreamSepMaker &ss, unsigned num, char letter = 'l' ); void add_variable ( const std::string &name, const std::string &type, const std::string &default_value = {} ); unsigned nb_cont_label; unsigned size_save_glo; unsigned size_save_loc; unsigned nb_id_gen; Vec<std::string> preliminaries; VariableMap variables; Vec<std::string> includes; Vec<std::string> loc_vars; Vec<std::string> methods; protected: void write_parse_def ( StreamSepMaker &ss, const std::string &hpipe_data_name = "HpipeData", const std::string &func_name = "parse", const char *additional_args = 0 ); void get_ordering ( Vec<Instruction *> &ordering, Instruction *inst ); std::string parse_content; std::string ctor; }; } // namespace Hpipe
5e65f11afb12d99d7902042fb0bf1c35feb7f2a5
8a363d876cfe7bd0a39db63e0fc88c326db587d8
/source/resource/core/settings/cxStateService.h
3ac41626738f6095c2911f89bba6666049733652
[ "BSD-3-Clause" ]
permissive
SINTEFMedtek/CustusX
07c3df5ee388040c0ee1c5225221b688bed1f929
8a9561f3461534bce8039ab10aa61d85fde4de31
refs/heads/develop
2023-07-06T07:17:16.709351
2023-06-27T09:21:06
2023-06-27T09:21:06
980,970
62
22
NOASSERTION
2023-02-16T00:55:29
2010-10-12T11:32:57
C++
UTF-8
C++
false
false
3,730
h
cxStateService.h
/*========================================================================= This file is part of CustusX, an Image Guided Therapy Application. Copyright (c) SINTEF Department of Medical Technology. All rights reserved. CustusX is released under a BSD 3-Clause license. See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details. =========================================================================*/ #ifndef CXSTATESERVICE_H_ #define CXSTATESERVICE_H_ #include "cxResourceExport.h" #include "cxForwardDeclarations.h" #include <QObject> #include "cxSettings.h" class QActionGroup; class ctkPluginContext; #define StateService_iid "cx::StateService" namespace cx { /** * \file * \addtogroup cx_resource_core_settings * @{ */ /** * \brief Data class for CustusX desktop. * * Contains info about widget and toolbar info in the MainWindow, * and the Layout ID. * * \sa StateService * */ struct cxResource_EXPORT Desktop { Desktop(); Desktop(QString layout, QByteArray mainwindowstate); void addPreset(QString name, int pos, bool tabbed=true); QString mLayoutUid; QString mSecondaryLayoutUid; QByteArray mMainWindowState; struct Preset { QString name; // name of widget without postfix (i.e. Workflow instead of WorkflowToolbar) int position; // corresponding to values in Qt::DockWidgetArea and Qt::ToolBarArea bool tabbed; }; std::vector<Preset> mPresets; // used on top of the MainWindowState: gives programmatic control over positioning }; /** * \brief Workflow states for CustusX. * * Maintains global state. The responsibility of this service * has been reduced, it now controls the workflow steps. * * - \ref cx_resource_core_settings also contains some global state. * - \ref cx::Profile contains more state. * * \section cx_section_workflow Workflow * * The use of CustusX during a surgical procedure can be broken down into a series of steps: * * - Preoperative data acquisition * - Planning * - Registration * - Navigation + Intraoperative data acquisition. * - Postoperative analysis * * This is the main workflow. Each step is named a Workflow State, and are * states in StateManager. They can be customized in the State Manager, and * they have a unique GUI setup. * * \image html workflow_steps_small.png "Workflow steps. The buttons are enlarged." * * \sa WorkflowStateMachine * * During each step, There are operations that usually are performed in * sequence. Examples: * * - Acquire data -> reconstruct. * - Import/acquire data -> show in view. * * These automations can be set in Preferences->Automation. * * * * \date 4. aug. 2010 * \author Janne Beate Bakeng, SINTEF */ class cxResource_EXPORT StateService: public QObject { Q_OBJECT public: virtual ~StateService() {} virtual QString getVersionName() = 0; virtual QString getApplicationStateName() const = 0; virtual QStringList getAllApplicationStateNames() const = 0; virtual QActionGroup* getWorkflowActions() = 0; virtual void setWorkFlowState(QString uid) = 0; virtual Desktop getActiveDesktop() = 0; virtual void saveDesktop(Desktop desktop) = 0; virtual void resetDesktop() = 0; virtual WorkflowStateMachinePtr getWorkflow() = 0; virtual bool isNull() = 0; static StateServicePtr getNullObject(); protected: void fillDefaultSettings(); template<class T> void fillDefault(QString name, T value) { settings()->fillDefault(name, value); } signals: void workflowStateChanged(); void workflowStateAboutToChange(); void applicationStateChanged(); }; /** * @} */ } Q_DECLARE_INTERFACE(cx::StateService, StateService_iid) #endif /* CXSTATESERVICE_H_ */
3cbfa2435794cd08a1b2d09710a7c3da2b46f988
01dbe06e8ad0d7da2635604650edbbd8f1dd5cf8
/cpp/src/rz/rz-kauvir/rz-graph-token/valuer/rz-lisp-graph-function-info.cpp
349bc8355c350393786f8634970d85baba59dbf4
[ "BSL-1.0", "LicenseRef-scancode-proprietary-license" ]
permissive
scignscape/SubjectiveSpeechQualityMeasurement
ccfe93d4569d45d711eb6a92c842cac9ae4a5404
ab68b91108f3f1d7086ea1ac9a8801c063dc9bff
refs/heads/master
2020-04-04T11:24:26.062577
2018-12-02T04:44:44
2018-12-02T04:44:44
155,889,835
0
1
BSL-1.0
2018-11-13T17:09:00
2018-11-02T16:02:47
C++
UTF-8
C++
false
false
414
cpp
rz-lisp-graph-function-info.cpp
// Copyright Nathaniel Christen 2018. // 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) #include "rz-lisp-graph-function-info.h" USING_RZNS(GBuild) void RZ_Lisp_Graph_Function_Info::pre_init() { Core_Function_Family = RZ_Function_Family_Not_Set; Core_Function_Code = 0; }
42cb0a00aaa6d63e5b537235bf0cc7488e73e703
047f795075d1170878b0a1b5798777afb82ba7d5
/ra4/scatter.cxx
9522d96915f154225974e1afd181ec78520d1e68
[]
no_license
heller3/wh_draw
1de808549001a11298f84bf3afd9162800113f26
7fdfbf697b20f404dedc1022b631c3d109810d01
refs/heads/master
2021-08-29T14:02:37.070549
2021-08-17T21:03:33
2021-08-17T21:03:33
164,376,980
0
2
null
2020-09-21T21:23:16
2019-01-07T04:11:32
C++
UTF-8
C++
false
false
8,726
cxx
scatter.cxx
#include "ra4/scatter.hpp" #include <cstdlib> #include <iostream> #include <string> #include <vector> #include <memory> #include <unistd.h> #include <getopt.h> #include "TError.h" #include "TColor.h" #include "core/baby.hpp" #include "core/process.hpp" #include "core/named_func.hpp" #include "core/plot_maker.hpp" #include "core/plot_opt.hpp" #include "core/palette.hpp" #include "core/hist2d.hpp" #include "core/utilities.hpp" using namespace std; using namespace PlotOptTypes; namespace{ bool single_thread = false; } int main(int argc, char *argv[]){ gErrorIgnoreLevel = 6000; GetOptions(argc, argv); double lumi = 135; const NamedFunc leading_ak8_score("leading_ak8_score", [](const Baby &b) ->NamedFunc::ScalarType{ double score(-1); if(b.nak8jets() > 0) score = b.ak8jets_nom_bin_top()->at(0); return score; }); const NamedFunc max_nom_raw("Highest Nominal Raw",[&](const Baby &b){ double max(0.), score(0); for(size_t ijet = 0; ijet < b.ak8jets_pt()->size(); ijet++) { score = b.ak8jets_nom_raw_top()->at(ijet); if(score > max && b.ak8jets_pt()->at(ijet) >= 300) max = score; } return max; }); string base_path = ""; string hostname = execute("echo $HOSTNAME"); if(Contains(hostname, "cms") || Contains(hostname,"compute-")){ base_path = "/net/cms29"; } string mc_dir = base_path+"/cms29r0/babymaker/babies/2017_01_27/mc/merged_mcbase_standard/"; Palette colors("txt/colors.txt", "default"); auto tt1l = Process::MakeShared<Baby_full>("t#bar{t} (1l)", Process::Type::background, colors.RGB(1,57,166), {mc_dir+"*_TTJets*Lept*.root"}, "ntruleps<=1&&stitch_met"); tt1l->SetMarkerStyle(23); tt1l->SetMarkerSize(0.8); auto tt2l = Process::MakeShared<Baby_full>("t#bar{t} (2l)", Process::Type::background, colors.RGB(86,160,211), {mc_dir+"*_TTJets*Lept*.root"}, "ntruleps>=2&&stitch_met"); tt2l->SetMarkerStyle(22); tt2l->SetMarkerSize(0.8); auto wjets = Process::MakeShared<Baby_full>("W+jets", Process::Type::background, colors("wjets"), {mc_dir+"*_WJetsToLNu*.root"},"stitch"); auto single_t = Process::MakeShared<Baby_full>("Single t", Process::Type::background, colors("single_t"), {mc_dir+"*_ST_*.root"}); auto ttv = Process::MakeShared<Baby_full>("t#bar{t}V", Process::Type::background, colors("ttv"), {mc_dir+"*_TTWJets*.root", mc_dir+"*_TTZTo*.root"}); auto other = Process::MakeShared<Baby_full>("Other", Process::Type::background, colors("other"), {mc_dir+"*DYJetsToLL*.root", mc_dir+"*_QCD_HT*.root", mc_dir+"*_ZJet*.root", mc_dir+"*_WWTo*.root", mc_dir+"*ggZH_HToBB*.root", mc_dir+"*ttHJetTobb*.root", mc_dir+"*_TTGJets*.root", mc_dir+"*_TTTT_*.root", mc_dir+"*_WH_HToBB*.root", mc_dir+"*_WZTo*.root", mc_dir+"*_ZH_HToBB*.root", mc_dir+"*_ZZ_*.root"}); auto t1tttt = Process::MakeShared<Baby_full>("T1tttt(1800,100)", Process::Type::signal, colors("t1tttt"), {base_path+"/cms29r0/babymaker/babies/2017_02_22_grooming/T1tttt/renormed/*SMS-T1tttt_mGluino-1800_mLSP-100_*.root"}); t1tttt->SetMarkerStyle(21); t1tttt->SetMarkerSize(0.9); auto data = Process::MakeShared<Baby_full>("Data", Process::Type::data, kBlack, {base_path+"/cms29r0/babymaker/babies/2017_02_14/data/merged_database_stdnj5/*.root"},"pass&&trig_ra4"); data->SetMarkerStyle(20); data->SetMarkerSize(1.); string mc_standard_path("/net/cms29/cms29r0/babymaker/babies/2018_08_03/mc/merged_mcbase_standard/"); string ttbar1L(mc_standard_path+"*_TTJets*SingleLept*.root"); string ttbar2L(mc_standard_path+"*_TTJets*DiLept*.root"); string ttbarHT(mc_standard_path+"*_TTJets*HT*.root"); string signal1(mc_standard_path+"*mGluino-1200_mLSP-800*.root"); string signal2(mc_standard_path+"*mGluino-2000_mLSP-100*.root"); auto tt1l_wAK8 = Process::MakeShared<Baby_full>("1L t#bar{t}", Process::Type::background, colors("tt_1l"), {ttbar1L,ttbarHT}, "ntruleps<=1&&stitch_met&&nak8jets>0"); auto tt2l_wAK8 = Process::MakeShared<Baby_full>("2L t#bar{t}", Process::Type::background, colors("tt_2l"), {ttbar2L,ttbarHT}, "ntruleps>=2&&stitch_met&&nak8jets>0"); auto sig_wAK8 = Process::MakeShared<Baby_full>("T1tttt(2000,100)", Process::Type::background, kRed , {signal2}, "stitch_met&&nak8jets>0"); auto sig_comp_wAK8 = Process::MakeShared<Baby_full>("T1tttt(1200,800)", Process::Type::background, kMagenta , {signal1}, "stitch_met&&nak8jets>0"); tt1l_wAK8->SetMarkerStyle(21); tt1l_wAK8->SetMarkerSize(0.9); tt2l_wAK8->SetMarkerStyle(20); tt2l_wAK8->SetMarkerSize(0.9); sig_wAK8->SetMarkerStyle(22); sig_wAK8->SetMarkerSize(1.1); vector<shared_ptr<Process> > ttbar_wAK8 = {tt1l_wAK8, tt2l_wAK8}; vector<shared_ptr<Process> > ttbar_sig_wAK8 = {tt1l_wAK8, tt2l_wAK8, sig_wAK8}; vector<shared_ptr<Process> > ttbar_1l_wAK8 = {tt1l_wAK8}; vector<shared_ptr<Process> > ttbar_2l_wAK8 = {tt2l_wAK8}; vector<shared_ptr<Process> > sig = {sig_wAK8}; vector<shared_ptr<Process> > sig_comp = {sig_comp_wAK8}; vector<shared_ptr<Process> > all_procs = {data, t1tttt, tt1l, tt2l, wjets, single_t, ttv, other}; vector<shared_ptr<Process> > tt_sig = {tt1l, tt2l, t1tttt}; PlotOpt style("txt/plot_styles.txt", "Scatter"); vector<PlotOpt> bkg_hist = {style().Stack(StackType::data_norm).Title(TitleType::supplementary).CanvasWidth(600)}; vector<PlotOpt> bkg_pts = {style().Stack(StackType::lumi_shapes).Title(TitleType::simulation_supplementary)}; NamedFunc baseline = "nleps==1&&st>500&&met>150&&njets>=6&&nbm>=1&&nveto==0"; NamedFunc weight = "weight"; vector<NamedFunc> met_bins = {"met>200","met>200&&met<=350", "met>350&&met<=500", "met>500"}; vector<NamedFunc> nbm_bins = {"nbm==1", "nbm>=2"}; NamedFunc low_jet("njets >= 6 && njets <= 8"), high_jet("njets >= 9"); NamedFunc low_b("nbm == 1"), mid_b("nbm == 2"), high_b("nbm >= 3"); vector<NamedFunc> R4 = {low_jet && low_b, high_jet && low_b, low_jet && mid_b, high_jet && mid_b, low_jet && high_b, high_jet && high_b}; PlotMaker pm; // for(const auto &met_bin: met_bins){ // for(const auto &nbm_bin: nbm_bins){ // NamedFunc cut = baseline && met_bin && nbm_bin; // pm.Push<Hist2D>(Axis(44, 0., 1100., "mj14", "M_{J} [GeV]", {250., 400.}), Axis(25 , 0., 700., "mt", "m_{T} [GeV]", {140.}), cut, all_procs, bkg_hist); // pm.Push<Hist2D>(Axis(48, 0., 1200., "mj14", "M_{J} [GeV]", {250., 400.}), Axis(175, 0., 700., "mt", "m_{T} [GeV]", {140.}), cut, tt_sig, bkg_hist); // pm.Push<Hist2D>(Axis(100, 0., 1., "ak8jets_nom_bin_top[0]", "top score", {0.4}), Axis(200, 0., 1000., "mt", "m_{T} [GeV]", {140.}), baseline, ttbar_wAK8, bkg_hist).Tag("al_nom_bin"); // Baseline pm.Push<Hist2D>(Axis(64, 0., 1600., "mj14", "M_{J} [GeV]", {250.,400}), Axis(50, 0., 1., max_nom_raw, "Maximum Nominal Raw score", {0.4}), baseline, ttbar_wAK8, bkg_hist).Tag("SUSY_Talk_MJ_NR_ttbar_600"); pm.Push<Hist2D>(Axis(56, 0., 1400., "mj14", "M_{J} [GeV]", {250.,400}), Axis(50, 0., 1., max_nom_raw, "Maximum Nominal Raw score", {0.4}), baseline, sig, bkg_hist).Tag("SUSY_Talk_MJ_NR_sig_600"); // Compressed signal pm.Push<Hist2D>(Axis(56, 0., 1400., "mj14", "M_{J} [GeV]", {250.,400}), Axis(50, 0., 1., max_nom_raw, "Maximum Nominal Raw score", {0.4}), baseline, sig, bkg_hist).Tag("MJ_NR_sig_comp"); for(int i = 0; i < 6; i++) { pm.Push<Hist2D>(Axis(56, 0., 1400., "mj14", "M_{J} [GeV]", {250.,400}), Axis(50, 0., 1., max_nom_raw, "Maximum Nominal Raw score", {0.4}), baseline && R4.at(i), ttbar_wAK8, bkg_hist).Tag("MJ_NR_ttbar_R4_"+to_string(i)); pm.Push<Hist2D>(Axis(56, 0., 1400., "mj14", "M_{J} [GeV]", {250.,400}), Axis(50, 0., 1., max_nom_raw, "Maximum Nominal Raw score", {0.4}), baseline && R4.at(i), sig, bkg_hist).Tag("MJ_NR_sig_R4_"+to_string(i)); } if(single_thread) pm.multithreaded_ = false; pm.min_print_=true; pm.MakePlots(lumi); } void GetOptions(int argc, char *argv[]){ while(true){ static struct option long_options[] = { {"single_thread", no_argument, 0, 's'}, {0, 0, 0, 0} }; char opt = -1; int option_index; opt = getopt_long(argc, argv, "s", long_options, &option_index); if( opt == -1) break; string optname; switch(opt){ case 's': single_thread = true; break; case 0: optname = long_options[option_index].name; if(false){ }else{ printf("Bad option! Found option name %s\n", optname.c_str()); } break; default: printf("Bad option! getopt_long returned character code 0%o\n", opt); break; } } }
58f35056cb53c7d20db8d8849624e1b5c3ab5de7
9091a2844e2bdc33db4ad2a561b2dea00c3fd796
/MyDrive.build/module.django.cpp
5ab8f430d0d78aac82186a241a278b2f6037b586
[]
no_license
nalini123/PICT-Drive
46d4ea24b7d28bd5f35cc1439e1eecf4652bf48e
d1b4a94b3a8652a97b37de26d943135ee1556acd
refs/heads/master
2021-01-20T23:48:17.128543
2015-08-09T06:15:52
2015-08-09T06:15:52
null
0
0
null
null
null
null
UTF-8
C++
false
false
25,633
cpp
module.django.cpp
// Generated code for Python source for module 'django' // created by Nuitka version 0.5.5.3 // This code is in part copyright 2014 Kay Hayen. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "nuitka/prelude.hpp" #include "__helpers.hpp" // The _module_django is a Python object pointer of module type. // Note: For full compatability with CPython, every module variable access // needs to go through it except for cases where the module cannot possibly // have changed in the mean time. PyObject *module_django; PyDictObject *moduledict_django; // The module constants used extern PyObject *const_int_0; extern PyObject *const_int_neg_1; extern PyObject *const_int_pos_1; extern PyObject *const_int_pos_6; extern PyObject *const_dict_empty; extern PyObject *const_tuple_empty; extern PyObject *const_str_plain_args; extern PyObject *const_str_plain_final; extern PyObject *const_str_plain_django; extern PyObject *const_str_plain_kwargs; extern PyObject *const_str_plain_VERSION; extern PyObject *const_str_plain___doc__; extern PyObject *const_str_plain___file__; extern PyObject *const_str_plain___path__; extern PyObject *const_str_plain_get_version; static PyObject *const_tuple_str_plain_get_version_tuple; static PyObject *const_str_digest_22cf0c699ec64933be2438c919acd799; extern PyObject *const_str_digest_7b0986266463f6f3532b6c3b9bcb1f27; static PyObject *const_str_digest_a98643134010b8bdeffbda48ea99b5eb; extern PyObject *const_tuple_str_plain_args_str_plain_kwargs_tuple; static PyObject *const_list_str_digest_a98643134010b8bdeffbda48ea99b5eb_list; static PyObject *const_tuple_int_pos_1_int_pos_6_int_pos_6_str_plain_final_int_0_tuple; static PyObject *const_tuple_str_plain_args_str_plain_kwargs_str_plain_get_version_tuple; static void _initModuleConstants(void) { const_tuple_str_plain_get_version_tuple = PyTuple_New( 1 ); PyTuple_SET_ITEM( const_tuple_str_plain_get_version_tuple, 0, const_str_plain_get_version ); Py_INCREF( const_str_plain_get_version ); const_str_digest_22cf0c699ec64933be2438c919acd799 = UNSTREAM_STRING( &constant_bin[ 246279 ], 51, 0 ); const_str_digest_a98643134010b8bdeffbda48ea99b5eb = UNSTREAM_STRING( &constant_bin[ 246279 ], 39, 0 ); const_list_str_digest_a98643134010b8bdeffbda48ea99b5eb_list = PyList_New( 1 ); PyList_SET_ITEM( const_list_str_digest_a98643134010b8bdeffbda48ea99b5eb_list, 0, const_str_digest_a98643134010b8bdeffbda48ea99b5eb ); Py_INCREF( const_str_digest_a98643134010b8bdeffbda48ea99b5eb ); const_tuple_int_pos_1_int_pos_6_int_pos_6_str_plain_final_int_0_tuple = PyTuple_New( 5 ); PyTuple_SET_ITEM( const_tuple_int_pos_1_int_pos_6_int_pos_6_str_plain_final_int_0_tuple, 0, const_int_pos_1 ); Py_INCREF( const_int_pos_1 ); PyTuple_SET_ITEM( const_tuple_int_pos_1_int_pos_6_int_pos_6_str_plain_final_int_0_tuple, 1, const_int_pos_6 ); Py_INCREF( const_int_pos_6 ); PyTuple_SET_ITEM( const_tuple_int_pos_1_int_pos_6_int_pos_6_str_plain_final_int_0_tuple, 2, const_int_pos_6 ); Py_INCREF( const_int_pos_6 ); PyTuple_SET_ITEM( const_tuple_int_pos_1_int_pos_6_int_pos_6_str_plain_final_int_0_tuple, 3, const_str_plain_final ); Py_INCREF( const_str_plain_final ); PyTuple_SET_ITEM( const_tuple_int_pos_1_int_pos_6_int_pos_6_str_plain_final_int_0_tuple, 4, const_int_0 ); Py_INCREF( const_int_0 ); const_tuple_str_plain_args_str_plain_kwargs_str_plain_get_version_tuple = PyTuple_New( 3 ); PyTuple_SET_ITEM( const_tuple_str_plain_args_str_plain_kwargs_str_plain_get_version_tuple, 0, const_str_plain_args ); Py_INCREF( const_str_plain_args ); PyTuple_SET_ITEM( const_tuple_str_plain_args_str_plain_kwargs_str_plain_get_version_tuple, 1, const_str_plain_kwargs ); Py_INCREF( const_str_plain_kwargs ); PyTuple_SET_ITEM( const_tuple_str_plain_args_str_plain_kwargs_str_plain_get_version_tuple, 2, const_str_plain_get_version ); Py_INCREF( const_str_plain_get_version ); } // The module code objects. static PyCodeObject *codeobj_18cb704013ebd7a42cbd3ad49c005d15; static PyCodeObject *codeobj_44f1ab183df53cb389f4eff26e13c9af; static PyCodeObject *codeobj_5032e8f2e53840d907df9cb0271b8ff6; static void _initModuleCodeObjects(void) { codeobj_18cb704013ebd7a42cbd3ad49c005d15 = MAKE_CODEOBJ( const_str_digest_22cf0c699ec64933be2438c919acd799, const_str_plain_django, 0, const_tuple_empty, 0, CO_NOFREE ); codeobj_44f1ab183df53cb389f4eff26e13c9af = MAKE_CODEOBJ( const_str_digest_22cf0c699ec64933be2438c919acd799, const_str_plain_get_version, 3, const_tuple_str_plain_args_str_plain_kwargs_tuple, 2, CO_NEWLOCALS | CO_OPTIMIZED | CO_VARARGS | CO_VARKEYWORDS | CO_NOFREE ); codeobj_5032e8f2e53840d907df9cb0271b8ff6 = MAKE_CODEOBJ( const_str_digest_22cf0c699ec64933be2438c919acd799, const_str_plain_get_version, 3, const_tuple_str_plain_args_str_plain_kwargs_str_plain_get_version_tuple, 0, CO_NEWLOCALS | CO_OPTIMIZED | CO_VARARGS | CO_VARKEYWORDS | CO_NOFREE ); } // The module function declarations. NUITKA_CROSS_MODULE PyObject *impl_function_3_complex_call_helper_star_list_star_dict_of_module___internal__( PyObject *_python_par_called, PyObject *_python_par_star_arg_list, PyObject *_python_par_star_arg_dict ); static PyObject *MAKE_FUNCTION_function_1_get_version_of_module_django( ); // The module function definitions. static PyObject *impl_function_1_get_version_of_module_django( Nuitka_FunctionObject *self, PyObject *_python_par_args, PyObject *_python_par_kwargs ) { // No context is used. // Local variable declarations. PyObjectLocalVariable par_args; par_args.object = _python_par_args; PyObjectLocalVariable par_kwargs; par_kwargs.object = _python_par_kwargs; PyObjectLocalVariable var_get_version; PyObject *exception_type = NULL, *exception_value = NULL; PyTracebackObject *exception_tb = NULL; PyObject *tmp_assign_source_1; PyObject *tmp_dircall_arg1_1; PyObject *tmp_dircall_arg2_1; PyObject *tmp_dircall_arg3_1; PyObject *tmp_frame_locals; PyObject *tmp_import_globals_1; PyObject *tmp_import_locals_1; PyObject *tmp_import_name_from_1; PyObject *tmp_return_value; tmp_return_value = NULL; // Actual function code. static PyFrameObject *cache_frame_function = NULL; MAKE_OR_REUSE_FRAME( cache_frame_function, codeobj_44f1ab183df53cb389f4eff26e13c9af, module_django ); PyFrameObject *frame_function = cache_frame_function; // Push the new frame as the currently active one. pushFrameStack( frame_function ); // Mark the frame object as in use, ref count 1 will be up for reuse. Py_INCREF( frame_function ); assert( Py_REFCNT( frame_function ) == 2 ); // Frame stack #if PYTHON_VERSION >= 340 frame_function->f_executing += 1; #endif // Framed code: tmp_import_globals_1 = ((PyModuleObject *)module_django)->md_dict; tmp_import_locals_1 = PyDict_New(); if ((var_get_version.object != NULL)) { PyDict_SetItem( tmp_import_locals_1, const_str_plain_get_version, var_get_version.object ); } if ((par_args.object != NULL)) { PyDict_SetItem( tmp_import_locals_1, const_str_plain_args, par_args.object ); } if ((par_kwargs.object != NULL)) { PyDict_SetItem( tmp_import_locals_1, const_str_plain_kwargs, par_kwargs.object ); } frame_function->f_lineno = 6; tmp_import_name_from_1 = IMPORT_MODULE( const_str_digest_7b0986266463f6f3532b6c3b9bcb1f27, tmp_import_globals_1, tmp_import_locals_1, const_tuple_str_plain_get_version_tuple, const_int_neg_1 ); Py_DECREF( tmp_import_locals_1 ); if ( tmp_import_name_from_1 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_function->f_lineno = 6; goto frame_exception_exit_1; } tmp_assign_source_1 = IMPORT_NAME( tmp_import_name_from_1, const_str_plain_get_version ); Py_DECREF( tmp_import_name_from_1 ); if ( tmp_assign_source_1 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_function->f_lineno = 6; goto frame_exception_exit_1; } assert( var_get_version.object == NULL ); var_get_version.object = tmp_assign_source_1; tmp_dircall_arg1_1 = var_get_version.object; tmp_dircall_arg2_1 = par_args.object; if ( tmp_dircall_arg2_1 == NULL ) { exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError ); exception_value = UNSTREAM_STRING( &constant_bin[ 201 ], 50, 0 ); exception_tb = NULL; frame_function->f_lineno = 7; goto frame_exception_exit_1; } tmp_dircall_arg3_1 = par_kwargs.object; if ( tmp_dircall_arg3_1 == NULL ) { exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError ); exception_value = UNSTREAM_STRING( &constant_bin[ 251 ], 52, 0 ); exception_tb = NULL; frame_function->f_lineno = 7; goto frame_exception_exit_1; } tmp_return_value = impl_function_3_complex_call_helper_star_list_star_dict_of_module___internal__( INCREASE_REFCOUNT( tmp_dircall_arg1_1 ), INCREASE_REFCOUNT( tmp_dircall_arg2_1 ), INCREASE_REFCOUNT( tmp_dircall_arg3_1 ) ); if ( tmp_return_value == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_function->f_lineno = 7; goto frame_exception_exit_1; } goto frame_return_exit_1; #if 0 RESTORE_FRAME_EXCEPTION( frame_function ); #endif // Put the previous frame back on top. popFrameStack(); #if PYTHON_VERSION >= 340 frame_function->f_executing -= 1; #endif Py_DECREF( frame_function ); goto frame_no_exception_1; frame_return_exit_1:; #if 0 RESTORE_FRAME_EXCEPTION( frame_function ); #endif popFrameStack(); #if PYTHON_VERSION >= 340 frame_function->f_executing -= 1; #endif Py_DECREF( frame_function ); goto function_return_exit; frame_exception_exit_1:; #if 0 RESTORE_FRAME_EXCEPTION( frame_function ); #endif if ( exception_tb == NULL ) { exception_tb = MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) ); } else if ( exception_tb->tb_frame != frame_function ) { PyTracebackObject *traceback_new = (PyTracebackObject *)MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) ); traceback_new->tb_next = exception_tb; exception_tb = traceback_new; } tmp_frame_locals = PyDict_New(); if ((var_get_version.object != NULL)) { PyDict_SetItem( tmp_frame_locals, const_str_plain_get_version, var_get_version.object ); } if ((par_args.object != NULL)) { PyDict_SetItem( tmp_frame_locals, const_str_plain_args, par_args.object ); } if ((par_kwargs.object != NULL)) { PyDict_SetItem( tmp_frame_locals, const_str_plain_kwargs, par_kwargs.object ); } detachFrame( exception_tb, tmp_frame_locals ); popFrameStack(); #if PYTHON_VERSION >= 340 frame_function->f_executing -= 1; #endif Py_DECREF( frame_function ); // Return the error. goto function_exception_exit; frame_no_exception_1:; // Return statement must be present. assert(false); function_exception_exit: assert( exception_type ); PyErr_Restore( exception_type, exception_value, (PyObject *)exception_tb ); return NULL; function_return_exit: return tmp_return_value; } static PyObject *fparse_function_1_get_version_of_module_django( Nuitka_FunctionObject *self, PyObject **args, Py_ssize_t args_size, PyObject *kw ) { assert( kw == NULL || PyDict_Check( kw ) ); NUITKA_MAY_BE_UNUSED Py_ssize_t kw_size = kw ? PyDict_Size( kw ) : 0; NUITKA_MAY_BE_UNUSED Py_ssize_t kw_found = 0; NUITKA_MAY_BE_UNUSED Py_ssize_t kw_only_found = 0; Py_ssize_t args_given = args_size; PyObject *_python_par_args = NULL; PyObject *_python_par_kwargs = NULL; if ( kw == NULL ) { _python_par_kwargs = PyDict_New(); } else { if ( ((PyDictObject *)kw)->ma_used > 0 ) { #if PYTHON_VERSION < 330 _python_par_kwargs = _PyDict_NewPresized( ((PyDictObject *)kw)->ma_used ); for ( int i = 0; i <= ((PyDictObject *)kw)->ma_mask; i++ ) { PyDictEntry *entry = &((PyDictObject *)kw)->ma_table[ i ]; if ( entry->me_value != NULL ) { #if PYTHON_VERSION < 300 if (unlikely( !PyString_Check( entry->me_key ) && !PyUnicode_Check( entry->me_key ) )) #else if (unlikely( !PyUnicode_Check( entry->me_key ) )) #endif { PyErr_Format( PyExc_TypeError, "get_version() keywords must be strings" ); goto error_exit; } int res = PyDict_SetItem( _python_par_kwargs, entry->me_key, entry->me_value ); if (unlikely( res == -1 )) { goto error_exit; } } } #else if ( _PyDict_HasSplitTable( (PyDictObject *)kw) ) { PyDictObject *mp = (PyDictObject *)kw; PyObject **newvalues = PyMem_NEW( PyObject *, mp->ma_keys->dk_size ); assert (newvalues != NULL); PyDictObject *split_copy = PyObject_GC_New( PyDictObject, &PyDict_Type ); assert( split_copy != NULL ); split_copy->ma_values = newvalues; split_copy->ma_keys = mp->ma_keys; split_copy->ma_used = mp->ma_used; mp->ma_keys->dk_refcnt += 1; Nuitka_GC_Track( split_copy ); Py_ssize_t size = mp->ma_keys->dk_size; for ( Py_ssize_t i = 0; i < size; i++ ) { PyDictKeyEntry *entry = &split_copy->ma_keys->dk_entries[ i ]; if (unlikely( !PyUnicode_Check( entry->me_key ) )) { PyErr_Format( PyExc_TypeError, "get_version() keywords must be strings" ); goto error_exit; } split_copy->ma_values[ i ] = INCREASE_REFCOUNT_X( mp->ma_values[ i ] ); } _python_par_kwargs = (PyObject *)split_copy; } else { _python_par_kwargs = PyDict_New(); PyDictObject *mp = (PyDictObject *)kw; Py_ssize_t size = mp->ma_keys->dk_size; for ( Py_ssize_t i = 0; i < size; i++ ) { PyDictKeyEntry *entry = &mp->ma_keys->dk_entries[i]; // TODO: One of these cases has been dealt with above. PyObject *value; if ( mp->ma_values ) { value = mp->ma_values[ i ]; } else { value = entry->me_value; } if ( value != NULL ) { if (unlikely( !PyUnicode_Check( entry->me_key ) )) { PyErr_Format( PyExc_TypeError, "get_version() keywords must be strings" ); goto error_exit; } int res = PyDict_SetItem( _python_par_kwargs, entry->me_key, value ); if (unlikely( res == -1 )) { goto error_exit; } } } } #endif } else { _python_par_kwargs = PyDict_New(); } } // Copy left over argument values to the star list parameter given. if ( args_given > 0 ) { _python_par_args = PyTuple_New( args_size - 0 ); for( Py_ssize_t i = 0; i < args_size - 0; i++ ) { PyTuple_SET_ITEM( _python_par_args, i, INCREASE_REFCOUNT( args[0+i] ) ); } } else { _python_par_args = INCREASE_REFCOUNT( const_tuple_empty ); } return impl_function_1_get_version_of_module_django( self, _python_par_args, _python_par_kwargs ); error_exit:; Py_XDECREF( _python_par_args ); Py_XDECREF( _python_par_kwargs ); return NULL; } static PyObject *dparse_function_1_get_version_of_module_django( Nuitka_FunctionObject *self, PyObject **args, int size ) { if ( size == 2 ) { return impl_function_1_get_version_of_module_django( self, MAKE_TUPLE( &args[ 0 ], size > 0 ? size-0 : 0 ), PyDict_New() ); } else { PyObject *result = fparse_function_1_get_version_of_module_django( self, args, size, NULL ); return result; } } static PyObject *MAKE_FUNCTION_function_1_get_version_of_module_django( ) { PyObject *result = Nuitka_Function_New( fparse_function_1_get_version_of_module_django, dparse_function_1_get_version_of_module_django, const_str_plain_get_version, #if PYTHON_VERSION >= 330 NULL, #endif codeobj_5032e8f2e53840d907df9cb0271b8ff6, NULL, #if PYTHON_VERSION >= 300 NULL, const_dict_empty, #endif module_django, Py_None ); return result; } #if PYTHON_VERSION >= 300 static struct PyModuleDef mdef_django = { PyModuleDef_HEAD_INIT, "django", /* m_name */ NULL, /* m_doc */ -1, /* m_size */ NULL, /* m_methods */ NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL, /* m_free */ }; #endif #define _MODULE_UNFREEZER 0 #if _MODULE_UNFREEZER #include "nuitka/unfreezing.hpp" // Table for lookup to find "frozen" modules or DLLs, i.e. the ones included in // or along this binary. static struct Nuitka_MetaPathBasedLoaderEntry meta_path_loader_entries[] = { { NULL, NULL, 0 } }; #endif // The exported interface to CPython. On import of the module, this function // gets called. It has to have an exact function name, in cases it's a shared // library export. This is hidden behind the MOD_INIT_DECL. MOD_INIT_DECL( django ) { #if defined(_NUITKA_EXE) || PYTHON_VERSION >= 300 static bool _init_done = false; // Packages can be imported recursively in deep executables. if ( _init_done ) { return MOD_RETURN_VALUE( module_django ); } else { _init_done = true; } #endif #ifdef _NUITKA_MODULE // In case of a stand alone extension module, need to call initialization // the init here because that's the first and only time we are going to get // called here. // Initialize the constant values used. _initBuiltinModule(); _initConstants(); // Initialize the compiled types of Nuitka. PyType_Ready( &Nuitka_Generator_Type ); PyType_Ready( &Nuitka_Function_Type ); PyType_Ready( &Nuitka_Method_Type ); PyType_Ready( &Nuitka_Frame_Type ); #if PYTHON_VERSION < 300 initSlotCompare(); #endif patchBuiltinModule(); patchTypeComparison(); #endif #if _MODULE_UNFREEZER registerMetaPathBasedUnfreezer( meta_path_loader_entries ); #endif _initModuleConstants(); _initModuleCodeObjects(); // puts( "in initdjango" ); // Create the module object first. There are no methods initially, all are // added dynamically in actual code only. Also no "__doc__" is initially // set at this time, as it could not contain NUL characters this way, they // are instead set in early module code. No "self" for modules, we have no // use for it. #if PYTHON_VERSION < 300 module_django = Py_InitModule4( "django", // Module Name NULL, // No methods initially, all are added // dynamically in actual module code only. NULL, // No __doc__ is initially set, as it could // not contain NUL this way, added early in // actual code. NULL, // No self for modules, we don't use it. PYTHON_API_VERSION ); #else module_django = PyModule_Create( &mdef_django ); #endif moduledict_django = (PyDictObject *)((PyModuleObject *)module_django)->md_dict; assertObject( module_django ); // Seems to work for Python2.7 out of the box, but for Python3, the module // doesn't automatically enter "sys.modules", so do it manually. #if PYTHON_VERSION >= 300 { int r = PyObject_SetItem( PySys_GetObject( (char *)"modules" ), const_str_plain_django, module_django ); assert( r != -1 ); } #endif // For deep importing of a module we need to have "__builtins__", so we set // it ourselves in the same way than CPython does. Note: This must be done // before the frame object is allocated, or else it may fail. PyObject *module_dict = PyModule_GetDict( module_django ); if ( PyDict_GetItem( module_dict, const_str_plain___builtins__ ) == NULL ) { PyObject *value = (PyObject *)builtin_module; // Check if main module, not a dict then. #if !defined(_NUITKA_EXE) || !0 value = PyModule_GetDict( value ); #endif #ifndef __NUITKA_NO_ASSERT__ int res = #endif PyDict_SetItem( module_dict, const_str_plain___builtins__, value ); assert( res == 0 ); } #if PYTHON_VERSION >= 330 #if _MODULE_UNFREEZER PyDict_SetItem( module_dict, const_str_plain___loader__, metapath_based_loader ); #else PyDict_SetItem( module_dict, const_str_plain___loader__, Py_None ); #endif #endif // Temp variables if any PyObject *exception_type, *exception_value; PyTracebackObject *exception_tb; PyObject *tmp_assign_source_1; PyObject *tmp_assign_source_2; PyObject *tmp_assign_source_3; PyObject *tmp_assign_source_4; PyObject *tmp_assign_source_5; // Module code. tmp_assign_source_1 = Py_None; UPDATE_STRING_DICT0( moduledict_django, (Nuitka_StringObject *)const_str_plain___doc__, tmp_assign_source_1 ); tmp_assign_source_2 = const_str_digest_22cf0c699ec64933be2438c919acd799; UPDATE_STRING_DICT0( moduledict_django, (Nuitka_StringObject *)const_str_plain___file__, tmp_assign_source_2 ); tmp_assign_source_3 = LIST_COPY( const_list_str_digest_a98643134010b8bdeffbda48ea99b5eb_list ); UPDATE_STRING_DICT1( moduledict_django, (Nuitka_StringObject *)const_str_plain___path__, tmp_assign_source_3 ); tmp_assign_source_4 = const_tuple_int_pos_1_int_pos_6_int_pos_6_str_plain_final_int_0_tuple; UPDATE_STRING_DICT0( moduledict_django, (Nuitka_StringObject *)const_str_plain_VERSION, tmp_assign_source_4 ); // Frame without reuse. PyFrameObject *frame_module = MAKE_FRAME( codeobj_18cb704013ebd7a42cbd3ad49c005d15, module_django ); // Push the new frame as the currently active one, and we should be exlusively // owning it. pushFrameStack( frame_module ); assert( Py_REFCNT( frame_module ) == 1 ); #if PYTHON_VERSION >= 340 frame_module->f_executing += 1; #endif // Framed code: tmp_assign_source_5 = MAKE_FUNCTION_function_1_get_version_of_module_django( ); if ( tmp_assign_source_5 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); Py_DECREF( tmp_assign_source_5 ); frame_module->f_lineno = 3; goto frame_exception_exit_1; } UPDATE_STRING_DICT1( moduledict_django, (Nuitka_StringObject *)const_str_plain_get_version, tmp_assign_source_5 ); // Restore frame exception if necessary. #if 0 RESTORE_FRAME_EXCEPTION( frame_module ); #endif popFrameStack(); assertFrameObject( frame_module ); Py_DECREF( frame_module ); goto frame_no_exception_1; frame_exception_exit_1:; #if 0 RESTORE_FRAME_EXCEPTION( frame_module ); #endif if ( exception_tb == NULL ) { exception_tb = MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_module ) ); } else if ( exception_tb->tb_frame != frame_module ) { PyTracebackObject *traceback_new = (PyTracebackObject *)MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_module ) ); traceback_new->tb_next = exception_tb; exception_tb = traceback_new; } // Put the previous frame back on top. popFrameStack(); #if PYTHON_VERSION >= 340 frame_module->f_executing -= 1; #endif Py_DECREF( frame_module ); // Return the error. goto module_exception_exit; frame_no_exception_1:; return MOD_RETURN_VALUE( module_django ); module_exception_exit: PyErr_Restore( exception_type, exception_value, (PyObject *)exception_tb ); return MOD_RETURN_VALUE( NULL ); }
9cc72cfc09ec4208c1556d7bdc30660ce7e96b0e
a3d6556180e74af7b555f8d47d3fea55b94bcbda
/media/cast/cast_config.cc
6ddb5e693f0dc4b8a6d05cfa509177704899dbb3
[ "BSD-3-Clause" ]
permissive
chromium/chromium
aaa9eda10115b50b0616d2f1aed5ef35d1d779d6
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
refs/heads/main
2023-08-24T00:35:12.585945
2023-08-23T22:01:11
2023-08-23T22:01:11
120,360,765
17,408
7,102
BSD-3-Clause
2023-09-10T23:44:27
2018-02-05T20:55:32
null
UTF-8
C++
false
false
3,927
cc
cast_config.cc
// Copyright 2013 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "media/cast/cast_config.h" #include "media/base/audio_codecs.h" #include "media/base/video_codecs.h" namespace media::cast { AudioCodec ToAudioCodec(Codec codec) { switch (codec) { case Codec::kAudioOpus: return AudioCodec::kOpus; case Codec::kAudioPcm16: return AudioCodec::kPCM; case Codec::kAudioAac: return AudioCodec::kAAC; case Codec::kAudioRemote: default: return AudioCodec::kUnknown; } } VideoCodec ToVideoCodec(Codec codec) { switch (codec) { case Codec::kVideoVp8: return VideoCodec::kVP8; case Codec::kVideoH264: return VideoCodec::kH264; case Codec::kVideoVp9: return VideoCodec::kVP9; case Codec::kVideoAv1: return VideoCodec::kAV1; case Codec::kVideoFake: case Codec::kVideoRemote: default: return VideoCodec::kUnknown; } } VideoCodecParams::VideoCodecParams() = default; VideoCodecParams::VideoCodecParams(const VideoCodecParams& other) = default; VideoCodecParams::VideoCodecParams(VideoCodecParams&& other) = default; VideoCodecParams& VideoCodecParams::operator=(const VideoCodecParams& other) = default; VideoCodecParams& VideoCodecParams::operator=(VideoCodecParams&& other) = default; VideoCodecParams::~VideoCodecParams() = default; FrameSenderConfig::FrameSenderConfig() = default; FrameSenderConfig::FrameSenderConfig(uint32_t sender_ssrc, uint32_t receiver_ssrc, base::TimeDelta min_playout_delay, base::TimeDelta max_playout_delay, RtpPayloadType rtp_payload_type, bool use_hardware_encoder, int rtp_timebase, int channels, int max_bitrate, int min_bitrate, int start_bitrate, double max_frame_rate, Codec codec, std::string aes_key, std::string aes_iv_mask, VideoCodecParams video_codec_params) : sender_ssrc(sender_ssrc), receiver_ssrc(receiver_ssrc), min_playout_delay(min_playout_delay), max_playout_delay(max_playout_delay), rtp_payload_type(rtp_payload_type), use_hardware_encoder(use_hardware_encoder), rtp_timebase(rtp_timebase), channels(channels), max_bitrate(max_bitrate), min_bitrate(min_bitrate), start_bitrate(start_bitrate), max_frame_rate(max_frame_rate), codec(codec), aes_key(aes_key), aes_iv_mask(aes_iv_mask), video_codec_params(video_codec_params) {} FrameSenderConfig::FrameSenderConfig(const FrameSenderConfig& other) = default; FrameSenderConfig::FrameSenderConfig(FrameSenderConfig&& other) = default; FrameSenderConfig& FrameSenderConfig::operator=( const FrameSenderConfig& other) = default; FrameSenderConfig& FrameSenderConfig::operator=(FrameSenderConfig&& other) = default; FrameSenderConfig::~FrameSenderConfig() = default; FrameReceiverConfig::FrameReceiverConfig() = default; FrameReceiverConfig::FrameReceiverConfig(const FrameReceiverConfig& other) = default; FrameReceiverConfig::FrameReceiverConfig(FrameReceiverConfig&& other) = default; FrameReceiverConfig& FrameReceiverConfig::operator=( const FrameReceiverConfig& other) = default; FrameReceiverConfig& FrameReceiverConfig::operator=( FrameReceiverConfig&& other) = default; FrameReceiverConfig::~FrameReceiverConfig() = default; } // namespace media::cast
db9ba43f3b3cd3b6019fbc51dc97f937be3a4adc
e37e526a9ea114994f8b419eb7404ddf28398171
/Wound Segmentation/wound_segmentation_form.cpp
ce3219a10f22004739c4933ead4340c66841ae8f
[]
no_license
tobygameac/Wound-Segmentation
61f595b78590614a508e74df8cdf0dcb972f6004
7d6b611880db0f850a4316b7515afcb0a88ef5c6
refs/heads/master
2020-02-26T17:01:06.385859
2016-10-04T04:58:19
2016-10-04T04:58:19
48,569,484
1
0
null
null
null
null
UTF-8
C++
false
false
369
cpp
wound_segmentation_form.cpp
#include "wound_segmentation_form.h" using namespace System; using namespace System::Windows::Forms; [STAThread] int main(array<String^> ^args) { Application::EnableVisualStyles(); Application::SetCompatibleTextRenderingDefault(false); WoundSegmentation::WoundSegmentationForm wound_segmentation_form; Application::Run(%wound_segmentation_form); return 0; }
3286c7de0636280132da727446cab0a960e9b721
ce6f5f7cb0e13c8e81d246f77963c0be9c04b878
/C++/uva621.cpp
320a9c8b2f9be6569f6a5139336c5bf7f46a420c
[]
no_license
HankLyu/NCPC_pratice
63d629665c2afa98e724a1a7cff8effcfd4fd2ad
3ecfa0067a281fdaf7f81cb4ba88904b1f0a5fad
refs/heads/master
2021-01-20T02:47:42.979283
2014-12-03T03:07:44
2014-12-03T03:07:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
488
cpp
uva621.cpp
#include<cstdio> #include<iostream> #include<cstring> #include<string> #define maxx 40 using namespace std; int main() { int test; string s; scanf("%d",&test); while(test--){ cin>>s; int len=s.length(); if(len==1 && (s[0]=='1' || s[0]=='4')) printf("+\n"); else if(len==2 && s[0]=='7' && s[1]=='8') printf("+\n"); else if(s[len-1]=='5'&& s[len-2]=='3') printf("-\n"); else if(s[0]=='9' && s[len-1]=='4') printf("*\n"); else printf("?\n"); } return 0; }
7b4eec5cda3c158fdd82004886ee78a2147cb2ac
8dd61530024fc5bf045cac5cad5cef5df25f1cfe
/An I/Algoritmica Grafurilor/Adaugare muchie noua la apcm - Kruskal.cpp
0c234d341625682c94f826c0beb55b4b6e9b602f
[]
no_license
SeverinDragos/Universitate
b91dedf518b23d6d39ccbc0952444f75bed6904a
1201a0614fc66ff5d173fdd4c2fcd5233b8f1ce2
refs/heads/master
2020-04-27T21:29:12.608114
2019-03-09T13:41:49
2019-03-09T13:41:49
174,698,761
0
0
null
null
null
null
UTF-8
C++
false
false
3,931
cpp
Adaugare muchie noua la apcm - Kruskal.cpp
#include <iostream> #include <fstream> #include <stdlib.h> #include <vector> #include <cstring> using namespace std; struct muchie { int vf1, vf2, pondere; }; int cmp (const void* a, const void* b) { return ((muchie*)a)->pondere - ((muchie*)b)->pondere; } void Initializare (int u, int* tata, int* h) { tata[u] = h[u] = 0; } int Reprez (int u, int* tata) { if (tata[u] == 0) return u; tata[u] = Reprez(tata[u], tata); return tata[u]; } void Reuneste (int u, int v, int* tata, int* h) { int ru = Reprez(u, tata), rv = Reprez(v, tata); if (h[ru] > h[rv]) { tata[rv] = ru; } else { tata[ru] = rv; if(h[ru] == h[rv]) h[rv] ++; } } void DF (int u , int& contor, vector <pair <int, int> > li[], int* tata, int* viz, muchie* ciclu, int& indice) { viz[u] = 1; for (int i = 0; i < li[u].size(); i ++) if (contor == 0){ int v = li[u][i].second; if (viz[v] == 0) { tata[v] = u; DF(v,contor, li, tata, viz, ciclu, indice); } else if (tata[u] != v){ contor = 1; indice = 0; ciclu[indice].vf1 = u; ciclu[indice].vf2 = v; ciclu[indice].pondere = li[u][i].first; indice++; int parc = u; while (parc != v) { for (int j = 0; j < li[parc].size(); j++) { if (tata[parc] == li[parc][j].second) { ciclu[indice].vf1 = parc; ciclu[indice].vf2 = tata[parc]; ciclu[indice].pondere = li[parc][j].first; indice++; } } parc = tata[parc]; } } } } int main() { ifstream fin ("graf.in"); if (!fin.is_open()) cout << "Eroare la deschiderea fisierului!" << endl; int n, m, nr_iteratii = 0; fin >> n >> m; int* tata = new int [n + 1]; int* h = new int [n + 1]; int* viz = new int [n + 1]; muchie* v = new muchie [m]; vector <pair <int, int> > li[n + 1]; for (int i = 0; i < m; i++) { fin >> v[i].vf1 >> v[i].vf2 >> v[i].pondere; } //Sortare muchii int (*pf)(const void*, const void*); pf = cmp; qsort(v, m, sizeof(muchie),pf); //Initializare for (int i = 1; i <= n; i++) Initializare(i, tata, h); muchie nou; cin >> nou.vf1 >> nou.vf2 >> nou.pondere; int sum = 0; cout << "Muchiile apcm in G: " << endl; //Sa fie nebunie for (int i = 0; (i < m) && (nr_iteratii != n - 1); i++) { if ( Reprez(v[i].vf1, tata) != Reprez(v[i].vf2, tata) ) { Reuneste(v[i].vf1, v[i].vf2, tata, h); cout << v[i].vf1 << " " << v[i].vf2 << endl; sum += v[i].pondere; li[v[i].vf1].push_back(make_pair(v[i].pondere, v[i].vf2)); li[v[i].vf2].push_back(make_pair(v[i].pondere, v[i].vf1)); nr_iteratii++; } } cout << "Cost " << sum << endl; memset(tata, 0, sizeof(int) * (n + 1)); memset(viz, 0, sizeof(int) * (n + 1)); muchie* ciclu = new muchie [n]; li[nou.vf1].push_back(make_pair(nou.pondere, nou.vf2)); li[nou.vf2].push_back(make_pair(nou.pondere, nou.vf1)); int contor = 0, indice = 0; DF(nou.vf1, contor, li, tata, viz, ciclu, indice); int maxim = 0, retin; for (int i = 0; i < indice; i++) { if (ciclu[i].pondere > maxim) { maxim = ciclu[i].pondere; retin = i; } } cout << "Muchia de cost maxim din ciclul inchis de " << nou.vf1 << " " << nou.vf2 << " in apcm este " << ciclu[retin].vf1 << " " << ciclu[retin].vf2 << " de cost " << ciclu[retin].pondere << endl; cout << "Dupa adaugarea muchiei apcm are costul " << sum + nou.pondere - ciclu[retin].pondere << endl; delete []viz; delete []tata; delete []h; delete []v; fin.close(); return 0; } /*Afisare muchii, in caz ca-mi trebuie for (int i = 0; i < m; i++) { cout << v[i].vf1 << " " << v[i].vf2 << " : " << v[i].pondere << endl; } Afisare tata si h for (int i = 1; i <= n; i++) { cout << i << ": " << tata[i] << " " << h[i] << endl; } */
9a9f43f8772f354bef355a8df469df18db231976
19782ae15716e723fbfe7cee6fd425a645b6e0fa
/Packt_CreatingGamesWithAI/Basics/Helpers/IdManager.hpp
604a631fe75e23c9ea27c68d8dfe4dbc17a55318
[ "MIT" ]
permissive
PacktPublishing/Hands-On-Game-AI-Development
b91ff950472694b82c53b76a41ba98f4a96debe2
27328e4658bfd1606abe51cc14a8adbe8c752d76
refs/heads/master
2021-04-26T22:18:45.786513
2021-01-14T15:40:01
2021-01-14T15:40:01
124,068,805
9
6
null
null
null
null
UTF-8
C++
false
false
628
hpp
IdManager.hpp
// // IdManager.hpp // Packt_CreatingGamesWithAI // // Created by Cihan Ozer on 07/03/2018. // Copyright © 2018 Cihan Ozer. All rights reserved. // #ifndef IdManager_hpp #define IdManager_hpp #include <queue> #define ID_Manager IdManager::getInstance() // Helper class for managing given IDs class IdManager { public: static IdManager& getInstance(); void clear(); unsigned int getNextId(); void giveIdBack(const unsigned int pUsedId); private: IdManager(); ~IdManager(); unsigned int mId; std::queue<unsigned int> mAvailableIds; }; #endif /* IdManager_hpp */
047ad13c55ee3180241cf3fae960c72929279d31
39a894abfd04331d3ef4efe0f9a3b19c6150f695
/projects.cpp/vc6-projects/WBASE/Tfcvt.h
2cdf3d7b3885b97818e7d4d3ba5222db9c13868a
[]
no_license
kbergerstock/myProjects
dc9fd761e6521946804f0e54c3241a3bfa3c3d77
7238d9c18223958f903aa56fa8080ec9840c0bc4
refs/heads/master
2023-08-22T02:59:34.808450
2021-09-18T20:30:41
2021-09-18T20:30:41
407,316,497
0
0
null
null
null
null
UTF-8
C++
false
false
964
h
Tfcvt.h
#ifndef __WINDOWS_H #define STRICT #include "windows.h" #endif #include "tstack.h" #ifndef __TFCVT_H #define __TFCVT_H template <class TYPE> class TFCVT { private: int DecimalPos; int NumDigits; public: TFCVT() { DecimalPos = 3; NumDigits = 0;} void SetDecimalPos(int p) { DecimalPos = p;} void SetNumDigits(int p) { NumDigits = p;} LPSTR Convert(TYPE val, LPSTR S); }; template <class TYPE> LPSTR TFCVT<TYPE>::Convert(TYPE val,LPSTR s) { int cnt = NumDigits+DecimalPos; LPSTR tmp = s; TYPE sgn = val < 0.0 ? -1.0 : 1.0; int i,w; STACK<char> stack; double exp = 1.0; for(i = 0; i < DecimalPos; i++) exp *= 10.0; long v = (long)((exp * sgn * val) + 0.5); for(i = 0; i < cnt || v > 0;i++,v/=10) { w = '0' + (v % 10); stack.push(char(w)); if(i == (DecimalPos-1)) stack.push('.'); } if(sgn < 0) stack.push('-'); for(char a=stack.pop(); a; a=stack.pop() ) { *tmp++ = a; *tmp = 0; } return s; } #endif
317fc8e515c126f6774ba2bd8ecd650fa55b19e1
6068ba18ad958a56082844188765d6bfc6e512fa
/src/main.cpp
58efff0ba59556c6152837f355e02b18fee5a098
[]
no_license
ZeitLab-SputterAutomation/sputterautomation
695a3edf318d61d262fa79848a39332265e9081d
59c37239741a6862b46475de7d256a75e10ab39a
refs/heads/master
2020-03-22T10:48:55.679596
2018-12-24T02:16:42
2018-12-24T02:16:42
139,928,669
0
0
null
null
null
null
UTF-8
C++
false
false
898
cpp
main.cpp
#include <iostream> #include <QApplication> #include "config/config.h" #include "logging/logging.h" #include "mainwindow.h" #include "stacktrace.h" int main(int argc, char *argv[]) { try { logging::init(); config::init(); QApplication app(argc, argv); MainWindow window; window.show(); // If cleanup code is needed, connect to the QCoreApplication::aboutToQuit signal return app.exec(); } catch (const std::exception &e) { std::string msg{"Unhandled exception: "}; msg += e.what(); const boost::stacktrace::stacktrace *st = boost::get_error_info<traced>(e); if (st) { std::stringstream ss; ss << *st; msg += "\nStacktrace:\n" + ss.str(); } msg += '\n'; spdlog::get("main")->critical(msg); } std::cin.get(); return 0; }
455b275060ce0b3516c3f7098a0d994baf829683
a5a99f646e371b45974a6fb6ccc06b0a674818f2
/DataFormats/HcalRecHit/src/HcalCalibRecHit.cc
9c921f42915a7e6aae837f99146d89c9fd6dfe90
[ "Apache-2.0" ]
permissive
cms-sw/cmssw
4ecd2c1105d59c66d385551230542c6615b9ab58
19c178740257eb48367778593da55dcad08b7a4f
refs/heads/master
2023-08-23T21:57:42.491143
2023-08-22T20:22:40
2023-08-22T20:22:40
10,969,551
1,006
3,696
Apache-2.0
2023-09-14T19:14:28
2013-06-26T14:09:07
C++
UTF-8
C++
false
false
424
cc
HcalCalibRecHit.cc
#include "DataFormats/HcalRecHit/interface/HcalCalibRecHit.h" HcalCalibRecHit::HcalCalibRecHit() : id_(), amplitude_(0), time_(0) {} HcalCalibRecHit::HcalCalibRecHit(const HcalCalibDetId& id, float ampl, float time) : id_(id), amplitude_(ampl), time_(time) {} std::ostream& operator<<(std::ostream& s, const HcalCalibRecHit& hit) { return s << hit.id() << ": " << hit.amplitude() << " , " << hit.time() << " ns"; }
3a2215de8e5415583b8ecab0836089878da3df07
aea7d4e41b6b8847e5cd6f2a9df89688e894f6e4
/src/eqclass.hpp
537b2eadb4ecf7f5880d31f5c88b8fbb33e705a4
[ "NCSA" ]
permissive
netarch/neo
8284b44371614ae029efed99304c7798aa605671
82db0a66a69b55e131173f82204ae77110bc24d8
refs/heads/master
2023-08-04T16:38:30.260181
2023-07-23T21:08:11
2023-07-23T21:08:11
183,942,096
10
5
NOASSERTION
2022-10-31T04:20:13
2019-04-28T18:03:51
C++
UTF-8
C++
false
false
1,215
hpp
eqclass.hpp
#pragma once #include <set> #include <string> class EqClass; #include "ecrange.hpp" /* * An EqClass (instance) is a set of ECRanges (a continuous range of IP * addresses), where any packet with its destination (or source) inside the * ranges has the same behavior. The ranges are disjoint. */ class EqClass { private: std::set<ECRange> ranges; friend bool operator==(const EqClass &, const EqClass &); public: typedef std::set<ECRange>::iterator iterator; typedef std::set<ECRange>::const_iterator const_iterator; typedef std::set<ECRange>::reverse_iterator reverse_iterator; typedef std::set<ECRange>::const_reverse_iterator const_reverse_iterator; std::string to_string() const; bool empty() const; void add_range(const ECRange &); void rm_range(const ECRange &); bool contains(const IPv4Address &) const; IPv4Address representative_addr() const; iterator begin(); const_iterator begin() const; iterator end(); const_iterator end() const; reverse_iterator rbegin(); const_reverse_iterator rbegin() const; reverse_iterator rend(); const_reverse_iterator rend() const; }; bool operator==(const EqClass &, const EqClass &);
42460ad232374e4566956b18c9b1cc657a9a984c
0d5522e449d27e91a2f0c736280029f46ba3f487
/ObjLoader.h
a754e1c055811b80c70cdb29001b35ed5787c436
[]
no_license
shixinsb/openGL
c0619d10cc314e3496c4181ff49251f5708c855a
639b894f8858b28f67740bcca88fe108bc4b420c
refs/heads/master
2021-01-18T17:23:56.667461
2017-04-05T18:58:08
2017-04-05T18:58:08
86,793,621
0
0
null
null
null
null
UTF-8
C++
false
false
2,406
h
ObjLoader.h
/* * ObjLoader.h * * Created on: 2017年4月5日 * Author: xshi */ #ifndef OBJLOADER_H_ #define OBJLOADER_H_ #include <GL/glew.h> #include <fstream> #include <iostream> #include <complex> #include <cstdlib> #include <string> #include <vector> class ObjLoader { private: std::vector<GLfloat> points; std::vector<GLuint> indices; GLuint pointNum; GLuint triangleNum; public: ObjLoader(const GLchar* objPath) { std::ifstream objFile; objFile.exceptions(std::ifstream::failbit | std::ifstream::badbit); try { // Open files objFile.open(objPath); std::string line; std::getline(objFile, line); std::getline(objFile, line); int spaceLoc = line.find_first_of(' '); pointNum = std::stoi( line.substr(spaceLoc + 1, line.find(' ', spaceLoc + 1))); std::getline(objFile, line); std::getline(objFile, line); spaceLoc = line.find_first_of(' '); triangleNum = std::stoi( line.substr(spaceLoc + 1, line.find(' ', spaceLoc + 1))); while (!objFile.eof()) { std::getline(objFile, line); if (line[0] == 'g') break; } for (int i = 0; i < pointNum; i++) { std::getline(objFile, line); std::istringstream lines(line); std::string s; double a[3]; lines >> s >> a[0] >> a[1] >> a[2]; points.push_back(a[0]); points.push_back(a[1]); points.push_back(a[2]); } std::getline(objFile, line); for (int i = 0; i < triangleNum; i++) { std::getline(objFile, line); std::istringstream lines(line); std::string s; double a[3]; lines >> s >> a[0] >> a[1] >> a[2]; indices.push_back(a[0]-1); indices.push_back(a[1]-1); indices.push_back(a[2]-1); } // close file handlers objFile.close(); } catch (std::ifstream::failure e) { std::cout << "ERROR::OBJLOADER::FILE_NOT_SUCCESFULLY_READ" << std::endl; } } GLuint getNumberOfTriangle() { return this->triangleNum; } GLfloat* getVertices() { GLfloat *vert = &this->points[0]; return vert; } GLuint* getIndices() { GLuint *index = &this->indices[0]; return index; } GLuint getNumberOfPoints(){ return this->pointNum; } void info(){ std::cout<<"total points = "<<this->getNumberOfPoints()<<std::endl; std::cout<<"total triangle = "<<this->getNumberOfTriangle()<<std::endl; std::cout<<"length of index = "<<this->getNumberOfTriangle()*3<<std::endl; } }; #endif /* OBJLOADER_H_ */
a4fe1644a2b5cc40f27ce5051beb7cc40e8453f8
549cd46ea13a50424bfa5f82bc323ae6fbf91581
/sub_test.hpp
cd56ed086aab02244583e10b0b645018645d78c0
[]
no_license
vendlou/composite
2b9c4e81b230b53e13a4b236269fcddc182c3207
2f2d565c3c7319e676e85b64778246cdb18d5fe4
refs/heads/master
2020-11-26T19:24:02.545699
2019-10-31T22:34:17
2019-10-31T22:34:17
229,184,403
0
0
null
null
null
null
UTF-8
C++
false
false
275
hpp
sub_test.hpp
#ifndef __SUB_TEST_HPP__ #define __SUB_TEST_HPP__ #include "gtest/gtest.h" #include "op.hpp" #include "sub.hpp" TEST(SubTest, SubTest1) { Op* left = new Op(8); Op* right = new Op(2); Sub* sub = new Sub(left,right); EXPECT_EQ(sub->evaluate(), 6); } #endif
a25dd13d07733efe1174ef58c5ddab76d6ec378c
e62b72f6fcdfe40575997e237d8b5bd05b00236f
/connectfour.h
e6ba0ee6849bfd90268333e31b085e99a9fd85c5
[]
no_license
COP3503Checkers/GameBox
8614849f0f897f15779a7c7e667594b3737d60ce
9ef792b81c6e6670fd4a1ec524e789ed7bf74450
refs/heads/master
2021-06-06T17:28:01.440221
2016-04-20T08:39:08
2016-04-20T08:39:08
54,787,583
1
0
null
null
null
null
UTF-8
C++
false
false
6,963
h
connectfour.h
#ifndef CONNECTFOUR_H_ #define CONNECTFOUR_H_ namespace con4 { //defined as const variables instead of #define // to avoid problems with multiple declarations //constants here const int VACANT = 0; const int RED = 1; const int BLACK = -1; //board dimensions const int ROW = 6; const int COL = 7; //helper functions, inline these if necessary bool isRed(int x) { return x == RED; } bool isBlack(int x) { return x == BLACK; } bool isVacant(int x) { return x == VACANT; } //return if both a and b are on same/opposite side, respectively bool isMatching(int a, int b) { return isRed(a) ? isRed(b) : (isBlack(a) ? isBlack(b) : false); } bool isOpposite(int a, int b) { return isRed(a) ? isBlack(b) : (isBlack(a) ? isRed(b) : false); } } //namespace con4 #include <cstddef> #include <utility> namespace con4 { //object representation of board position //only allows 1 board per run due to static int **board struct BoardPos { //pointer to board as a 2d int array static int **board; //position represented by two ints //change to unsigned? int r, c; //constructors BoardPos() : r(), c() { } BoardPos(int r, int c) : r(r), c(c) { } //copy constructor and equals overload BoardPos(const BoardPos& p) : r(p.r), c(p.c) { } BoardPos& operator=(const BoardPos& p) { r = p.r, c = p.c; return *this; } //return value of piece on board //because *BoardPos(1,2) looks nicer than board[1][2]? //lol get outta here int& operator*() { return board[r][c]; } int& operator*() const { return board[r][c]; } //position arithmetic //treats position as a vector BoardPos operator-() const { return BoardPos(-r, -c); } BoardPos operator+(const BoardPos& p) const { return BoardPos(r + p.r, c + p.c); } BoardPos& operator+=(const BoardPos& p) { return *this = (*this + p); } BoardPos operator-(const BoardPos& p) const { return *this + -BoardPos(p); } BoardPos& operator-=(const BoardPos& p) { return *this = (*this - p); } //midpoint of this and p BoardPos operator/(const BoardPos& p) const { return BoardPos((r + p.r) / 2, (c + p.c) / 2); } bool operator==(const BoardPos& p) const { return r == p.r && c == p.c; } }; //just to be pedantic int **BoardPos::board = NULL; typedef std::pair<BoardPos, BoardPos> ifpos_pair_type; } //namespace con4 #include <iostream> #include <limits> #include <iomanip> namespace con4 { //return char representation of how pieces should be displayed char pieceRep(int i) { switch(i) { case RED: return 'r'; case BLACK: return 'b'; } return ' '; } //output board representation to cout void printBoard() { std::cout << "+---+---+---+---+---+---+---+\n"; for(int l = 0; l < ROW; ++l) { for(int m = 0; m < COL; ++m) std::cout << "|" << std::setw(2) << pieceRep(*BoardPos(l, m)) << " "; std::cout << "|\n+---+---+---+---+---+---+---+\n"; } std::cout << " 1 2 3 4 5 6 7\n"; } //the board with int values being manipulated as the game progresses int **board = NULL; //the default board const int INITBOARD[ROW][COL] = { { VACANT, VACANT, VACANT, VACANT, VACANT, VACANT, VACANT }, { VACANT, VACANT, VACANT, VACANT, VACANT, VACANT, VACANT }, { VACANT, VACANT, VACANT, VACANT, VACANT, VACANT, VACANT }, { VACANT, VACANT, VACANT, VACANT, VACANT, VACANT, VACANT }, { VACANT, VACANT, VACANT, VACANT, VACANT, VACANT, VACANT }, { VACANT, VACANT, VACANT, VACANT, VACANT, VACANT, VACANT } }; //flag for whether it's black's turn //isBlackTurn = !isBlackTurn to flip turns bool isBlackTurn = false; //delete old board and make new board void initBoard() { //delete old board if(board != NULL) { for(int i = 0; i < ROW; ++i) delete board[i]; delete board; } //and... //make new board board = new int*[ROW]; for(int i = 0; i < ROW; ++i) { board[i] = new int[COL]; for(int j = 0; j < COL; ++j) board[i][j] = INITBOARD[i][j]; } //set pointer in BoardPos to the new board //30 minutes of debugging >.> BoardPos::board = board; } //put a piece into column numbered c //columns are indexed from 0 //returns whether drop was successful bool dropPiece(unsigned c) { //get first unfilled space going down in the column unsigned i = 0; if(c > ROW) return 0; while(i < ROW && isVacant(*BoardPos(i, c))) ++i; //column is completely filled, return unsuccessful if(i == 0) return false; //go back up to unfilled slot --i; //fill the slot and flip turns if(isBlackTurn) *BoardPos(i, c) = BLACK; else *BoardPos(i, c) = RED; isBlackTurn = !isBlackTurn; return true; } //go through one turn void play() { int c; printBoard(); std::cout << (isBlackTurn ? "Black" : "Red") << "'s turn!" << std::endl; //get column std::cout << "Where would you like to drop your piece? "; //TODO: put this into its own function while(!(std::cin >> c)) { std::cin.clear(); std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); std::cout << "Error: NaN, try again: "; } //attempt to drop and display whether it was successful if(dropPiece(c - 1)) std::cout << "Piece dropped successfully!" << std::endl; else std::cout << "That's not on the board!" << std::endl; } //return if position represented by p is within bounds bool withinBounds(const BoardPos& p) { return 0 <= p.r && p.r < ROW && 0 <= p.c && p.c < COL; } //return which side is the winner //returns VACANT if there is no winner int winner() { typedef BoardPos b; //iterate through each slot and... for(int i = 0; i < ROW; i++) { for(int j = 0; j < COL; j++) { b p(i, j), q; //skip if slot is vacant if(isVacant(*p)) continue; //check along main diagonal if(withinBounds(q = (p + b(1, 1))) && isMatching(*p, *q)) { if(withinBounds(q = (p + b(2, 2))) && isMatching(*p, *q)) { if(withinBounds(q = (p + b(3, 3))) && isMatching(*p, *q)) { return *p; } } } //check downwards if(withinBounds(q = (p + b(1, 0))) && isMatching(*p, *q)) { if(withinBounds(q = (p + b(2, 0))) && isMatching(*p, *q)) { if(withinBounds(q = (p + b(3, 0))) && isMatching(*p, *q)) { return *p; } } } //check along anti-diagonal if(withinBounds(q = (p + b(1, -1))) && isMatching(*p, *q)) { if(withinBounds(q = (p + b(2, -2))) && isMatching(*p, *q)) { if(withinBounds(q = (p + b(3, -3))) && isMatching(*p, *q)) { return *p; } } } //check rightwards if(withinBounds(q = (p + b(0, 1))) && isMatching(*p, *q)) { if(withinBounds(q = (p + b(0, 2))) && isMatching(*p, *q)) { if(withinBounds(q = (p + b(0, 3))) && isMatching(*p, *q)) { return *p; } } } //upwards and leftwards check not needed } } //no slots and directions produce winner return VACANT; } } //namespace con4 /* example playthrough: int main() { con4::initBoard(); while(con4::isVacant(con4::winner())) con4::play(); con4::printBoard(); std::cout << "Winner: " << (con4::isBlackTurn ? "Red" : "Black") << std::endl; } */ #endif
4ae17cac718854797eeb7d7461afe40ad3f76419
c1b44e9322f13e96368f6698e4a75a83c18624ac
/widget.h
0e310f070355c9cbb6161cad871340205f1d4fdd
[]
no_license
midmva/MyProject
eaf1f0fde178b0a2a16ec74beb49fe21c51378d8
fe2d82a6eeda7fa06330e413996916fa7bbcfe7b
refs/heads/master
2020-12-24T13:53:28.668723
2015-03-11T07:43:52
2015-03-11T07:43:52
32,001,413
0
0
null
null
null
null
UTF-8
C++
false
false
413
h
widget.h
#ifndef WIDGET_H #define WIDGET_H #include <QWidget> #include <QHBoxLayout> #include <QVBoxLayout> #include "spider.h" #include "struct.h" namespace Ui { class Widget; } class Widget : public QWidget { Q_OBJECT public slots: void addSpider(); public: explicit Widget(QWidget *parent = 0); ~Widget(); private: Ui::Widget *ui; Spider *spider; Struct *size; }; #endif // WIDGET_H
68b795ff335b9890fa138875a17fb0ccbefb3a82
9914266a26076c07f1bfbb1313f1970375fbed33
/Beispiel_Kompositum/Kompositum.cpp
59393cc113338840bf9266d9e0fde4c1d421f3ee
[]
no_license
lukasmerk/programming2
9882b29b166c10305b52231b1c1e27034ee9cee0
7647fd6743b40d42cdfc5aea7a4e5eeba5272637
refs/heads/master
2021-06-16T08:21:55.063526
2017-05-24T08:48:45
2017-05-24T08:48:45
null
0
0
null
null
null
null
UTF-8
C++
false
false
684
cpp
Kompositum.cpp
#include "Kompositum.h" Kompositum::Kompositum(int z) { zahl = z; for (int i=0; i<MAXKOMP; i++) { komponenten[i] = 0; } aktuelleAnzahl = 0; } Kompositum::~Kompositum(void) { } bool Kompositum::fuegeHinzu (Komponente* k) { bool retval = false; if (aktuelleAnzahl < MAXKOMP) { komponenten[aktuelleAnzahl] = k; aktuelleAnzahl++; retval = true; } return retval; } void Kompositum::print() { cout << zahl << ' '; for (int i=0; i<aktuelleAnzahl; i++) { komponenten[i]->print(); cout << ' '; } } int Kompositum::summe() { int sum = zahl; for (int i=0; i<aktuelleAnzahl; i++) { sum += komponenten[i]->summe(); } return sum; }
4fbd50aa0efc4ee02138dbb251c1a406fe06ddfc
c1f3cf1bb6e2a0be181630ea2a992d971b37b278
/iobus/iobus.h
141509495249baf00fde2c04dfcecc102eabe348
[]
no_license
leeonky/clayer
1f00b7ccafec6450b6672f714dd4e9c39bf962e9
26216dac5c1979118f207a502a662afd04a8b353
refs/heads/master
2023-08-24T08:45:01.410961
2021-10-07T14:43:34
2021-10-07T14:43:34
107,023,342
1
0
null
null
null
null
UTF-8
C++
false
false
1,591
h
iobus.h
#ifndef IOBUS_H #define IOBUS_H #include <functional> #include <cstdlib> class iobus { public: iobus(FILE *in, FILE *out, FILE *err) : file_in(in), file_out(out), file_err(err), line(nullptr), arguments(""), processed(true) {} ~iobus() { free(line); } void post(const char *format, ...); void post_some(const char *format, ...); int get(const std::function<int(const char *, const char *)> &); int get(const char *, const std::function<int(void)> &, int, const char *, ...); int get(const char *event, const std::function<int(const char *)> &action); int forward_last() { if(processed) return -1; fprintf(file_out, "%s\n", line); fflush(file_out); accept_processed(); return 0; } int ignore_last() { if(processed) return -1; accept_processed(); return 0; } int pass_through(); int except(const char *); void recaption_and_post() { if(line) { fprintf(file_out, "%s\n", line); fflush(file_out); } } public: private: FILE *file_in, *file_out, *file_err; char *line; char command[128]; const char *arguments; bool processed; void accept_processed() { processed = true; } }; template<typename Processor, typename Action> inline int ignore_untill(iobus &iob, const Processor &proseccor, const Action &action) { while(proseccor(iob, action)) { if(iob.ignore_last()) return -1; } return 0; } template<typename Processor, typename Action> inline int forward_untill(iobus &iob, const Processor &proseccor, const Action &action) { while(proseccor(iob, action)) { if(iob.forward_last()) return -1; } return 0; } #endif
eb3ccaf29422aff01bc0635d9e8d8d5cdd0ae23b
63a87dbee6a1af2af8a0890b6e50b5b22cff3d5e
/src04024.cpp
eccaae36948be176dcd2462f84e57065e4953983
[]
no_license
startergate-learns-stuff/Learn-CPP
19d14c8190319bd1266f021ea09f6691d433cbfb
8f4e6378c020fa821f046f50a7bcccb8aa06d32e
refs/heads/master
2020-04-26T23:36:24.738513
2019-06-17T04:56:42
2019-06-17T04:56:42
null
0
0
null
null
null
null
UTF-8
C++
false
false
855
cpp
src04024.cpp
#include "stdafx.h" #include <iostream> using namespace std; class CTestData { public: CTestData(int nparam, const char *pszname) :ndata(nparam), pszname(pszname) { cout << "CTestData(int, char *): " << pszname << endl; } ~CTestData() { cout << "~CTestData()" << endl; } CTestData(const CTestData &rhs) :ndata(rhs.ndata), pszname(rhs.pszname) { cout << "CTestData(const CTestData &): " << pszname << endl; } CTestData& operator=(const CTestData &rhs) { cout << "operator=" << endl; ndata = rhs.ndata; return *this; } int GetData() const { return ndata; } void SetData(int nparam) { ndata = nparam; } private: int ndata = 0; const char *pszname = nullptr; }; CTestData testfunc(int nparam) { CTestData a(nparam, "a"); return a; } int main() { CTestData b(5, "b"); b = testfunc(10); cout << b.GetData() << endl; }
9c5dfe4b80ec6c6b4ff048788d8d0c6f72c92ca4
314b9c82fb7f8564cb895c6a079000749dcdeabe
/Commond/DeletePageCommand.cpp
857074753f2a1c0db542a6f89f06f880bda4b7e2
[]
no_license
HarryPottor/DesignedMode
f008ba2f727ea49a4deed5bd3be6247f258c5421
1e65a6f19f29f4ab042da95a2a2fb398aca61605
refs/heads/master
2021-01-19T11:31:29.552036
2017-02-24T10:04:24
2017-02-24T10:04:24
82,250,576
0
0
null
null
null
null
UTF-8
C++
false
false
252
cpp
DeletePageCommand.cpp
#include "DeletePageCommand.h" CDeletePageCommand::CDeletePageCommand(void) { } CDeletePageCommand::~CDeletePageCommand(void) { } void CDeletePageCommand::Execute() { ICommand::m_ppg->Find(); ICommand::m_ppg->Delete(); ICommand::m_ppg->Plan(); }
9031f92822a81fde15bab095bec3fe007dcfb831
e0847c15577361fda54f9e0f519777d8f545e761
/src/readwritexml.cpp
8072ed38681e6b53d33e4fe82648855f826f06dd
[]
no_license
rgleason/Deviation_pi
ff00f92886d91be755bbd64dead0ad1198735bc2
3ef49622b3e9b0f060293d48c5ef069e13bd7bff
refs/heads/master
2023-08-21T22:32:22.824590
2023-08-16T14:04:46
2023-08-16T14:04:46
111,655,279
0
0
null
2023-08-16T12:45:32
2017-11-22T08:14:39
C++
UTF-8
C++
false
false
10,064
cpp
readwritexml.cpp
/* * <one line to give the program's name and a brief idea of what it does.> * Copyright (C) 2017 Dirk Smits <email> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ #include "readwritexml.h" #include <wx/filename.h> #include "SharedStuff.h" #ifndef XMLCheckResult #define XMLCheckResult(a_eResult) if (a_eResult != XML_SUCCESS) { printf("Error: %i\n", a_eResult); } #endif ReadWriteXML::ReadWriteXML(compass_data* Data) { //Will initialize and read the XML file. If the XML file is not available or broken it will make a new file. data = Data; //save ptr to struct //doc; if (!doc.LoadFile(data->filename.mb_str() ) ) { //Something going wrong with opening the file. We make a backup copy and make a fresh file without any info. //wxMessageBox(wxString::Format("Error loading file.... %s", data->filename )); wxCopyFile(data->filename, data->filename + wxT(".bck")); wxRemoveFile(data->filename); doc.Clear(); TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "UTF8", "" ); doc.LinkEndChild( decl ); data->needsaving = true; //doc.SaveFile( data->filename.mb_str() ); } p_rootnode = doc.FirstChildElement(); if(p_rootnode == NULL) { //No root node available, so we do make one //wxMessageBox(wxT("Failed to load file: No root element.")); p_rootnode = new TiXmlElement( "root" ); doc.LinkEndChild( p_rootnode ); TiXmlComment * comment = new TiXmlComment(); comment->SetValue(" Settings for the OpenCPN Compass Deviation Plugin " ); p_rootnode->LinkEndChild( comment ); data->needsaving = true; //doc.SaveFile( data->filename.mb_str() ); } if (data->shipsname == _("")) { p_shipnode = NULL; p_compassnode = NULL; data->needsaving = true; return; } p_shipnode = p_rootnode->FirstChildElement( "aship" ); while ( p_shipnode ) { TiXmlElement* temp = p_shipnode->ToElement(); if ( strcmp (temp->Attribute("shipsname"),data->shipsname.mb_str()) == 0) break; p_shipnode = p_shipnode->NextSibling("aship"); } if( p_shipnode == NULL ) { //No child with given name found so we have to make one. TiXmlElement* temp = new TiXmlElement( "aship" ); temp->SetAttribute( "shipsname", data->shipsname.mb_str() ); p_shipnode = temp->Clone(); p_rootnode->LinkEndChild( p_shipnode ); data->needsaving = true; } if (data->compassname == _("")) { p_compassnode = NULL; data->needsaving = true; return; } p_compassnode = p_shipnode->FirstChildElement( "acompass" ); while ( p_compassnode ) { TiXmlElement* temp = p_compassnode->ToElement(); if ( strcmp (temp->Attribute("compassname"),data->compassname.mb_str()) == 0) break; p_compassnode = p_compassnode->NextSibling("acompass"); } if(p_compassnode == NULL) { //No child with given name found so we have to make one. TiXmlElement* temp = new TiXmlElement( "acompass" ); temp->SetAttribute( "compassname", data->compassname.mb_str() ); p_compassnode = temp->Clone(); p_shipnode->LinkEndChild( p_compassnode ); data->needsaving = true; } } ReadWriteXML::~ReadWriteXML() { //if (data->needsaving) doc.SaveFile( data->filename.mb_str() ); } void ReadWriteXML::WriteBearings(std::vector<Meassurement*> Ms) { DeleteAllBearingNodes(); TiXmlElement* envS = new TiXmlElement( "EnvSettings" ); p_compassnode->LinkEndChild(envS); envS->SetDoubleAttribute("SendNMEA", data->SendNMEA); envS->SetDoubleAttribute("ShowTool", data->ShowToolbarBtn); TiXmlElement* abcde = new TiXmlElement( "ABCDEvalues" ); p_compassnode->LinkEndChild(abcde); abcde->SetDoubleAttribute("factorA", data->A); abcde->SetDoubleAttribute("factorB", data->B); abcde->SetDoubleAttribute("factorC", data->C); abcde->SetDoubleAttribute("factorD", data->D); abcde->SetDoubleAttribute("factorE", data->E); for (unsigned i=0; i < Ms.size(); i++) { WriteBearing( Ms[i]); } doc.SaveFile( data->filename.mb_str() ); data->needsaving = false; } void ReadWriteXML::WriteBearing(Meassurement* M) { TiXmlElement* temp = new TiXmlElement( "abearing" ); TiXmlElement * pBearings = new TiXmlElement("aBearing"); p_compassnode->LinkEndChild(pBearings); pBearings->SetDoubleAttribute("CompassBearing", M->compassbearing); pBearings->SetDoubleAttribute("CompassCourse", M->compasscourse); pBearings->SetDoubleAttribute("TrueBearing", M->truebearing); pBearings->SetDoubleAttribute("Variation", M->variation); pBearings->SetDoubleAttribute("Deviation", M->deviation); pBearings->SetDoubleAttribute("Latitude", M->lat); pBearings->SetDoubleAttribute("Longitude", M->lon); //wxString s = M->datetime.FormatISOCombined(); pBearings->SetAttribute("DateTime", M->datetime.FormatISOCombined().mb_str() ); pBearings->SetAttribute("Methode", M->methode); pBearings->SetAttribute("Enabled", (int)M->enabled); pBearings->SetAttribute("Remarks", M->MeassurementRemarks.mb_str()); } void ReadWriteXML::ReadBearings(std::vector<Meassurement*> &Ms) { if ( p_compassnode == NULL ) return; TiXmlElement* N = p_compassnode->FirstChildElement("EnvSettings"); if ( N != NULL ){ N->QueryBoolAttribute("SendNMEA", &data->SendNMEA); N->QueryBoolAttribute("ShowTool", &data->ShowToolbarBtn); } N = p_compassnode->FirstChildElement("ABCDEvalues"); if ( N != NULL ){ N->QueryDoubleAttribute("factorA", &data->A); N->QueryDoubleAttribute("factorB", &data->B); N->QueryDoubleAttribute("factorC", &data->C); N->QueryDoubleAttribute("factorD", &data->D); N->QueryDoubleAttribute("factorE", &data->E); } for (unsigned i=0; i < Ms.size(); i++) //Empty the vector with bearings { delete Ms[i]; } Ms.clear(); N = p_compassnode->FirstChildElement("aBearing"); while ( N != NULL) { Meassurement* me = new Meassurement(); ReadBearing( me, N ); Ms.push_back( me ); N = N->NextSiblingElement(); } } void ReadWriteXML::ReadBearing(Meassurement* &M, TiXmlElement* pNode) { pNode->QueryDoubleAttribute("CompassBearing", &M->compassbearing); pNode->QueryDoubleAttribute("CompassCourse", &M->compasscourse); pNode->QueryDoubleAttribute("TrueBearing", &M->truebearing); pNode->QueryDoubleAttribute("Variation", &M->variation); pNode->QueryDoubleAttribute("Deviation", &M->deviation); pNode->QueryDoubleAttribute("Latitude", &M->lat); pNode->QueryDoubleAttribute("Longitude", &M->lon); const char* s = pNode->Attribute("DateTime"); wxString mystring = wxString::FromUTF8(s); M->datetime.ParseISOCombined(mystring); pNode->QueryIntAttribute("Methode", &M->methode); int i; pNode->QueryIntAttribute("Enabled", &i); M->enabled = (bool)i; std::string _value; pNode->QueryStringAttribute("Remarks", &_value); wxString temp(_value); M->MeassurementRemarks= temp; //(_value);//.c_str(), wxConvUTF8); //wxString mystring(stlstring.c_str(), wxConvUTF8); } void ReadWriteXML::DeleteAllBearingNodes() { if ( p_compassnode != NULL) { TiXmlNode* temp = p_compassnode->LastChild(); while ( temp != NULL ) { p_compassnode->RemoveChild( temp ); temp = p_compassnode->LastChild(); } data->needsaving = true; } } wxArrayString ReadWriteXML::GetShipsList() { wxArrayString Ships; if ( p_rootnode == NULL) return Ships; TiXmlNode* p_Ship = p_rootnode->FirstChildElement( "aship" ); //Get the first ship node, if not exist return null while ( p_Ship ) //iterate over { TiXmlElement* temp = p_Ship->ToElement(); if ( temp != NULL ) Ships.Add( wxString::FromUTF8( temp->Attribute("shipsname")) ); p_Ship = p_Ship->NextSibling(); } return Ships; } wxArrayString ReadWriteXML::GetCompassList() { wxArrayString CompassL; if ( p_shipnode == NULL) return CompassL; TiXmlNode* p_Compas = p_shipnode->FirstChildElement( "acompass" ); //Get the first ship node, if not exist return null while ( p_Compas ) //iterate over { TiXmlElement* temp = p_Compas->ToElement(); if ( temp != NULL ) CompassL.Add( wxString::FromUTF8( temp->Attribute("compassname")) ); p_Compas = p_Compas->NextSibling(); } return CompassL; } void ReadObjectsFromXML(compass_data* Data) { if (( Data->shipsname != wxEmptyString ) && ( Data->compassname != wxEmptyString )) { ReadWriteXML* a = new ReadWriteXML( Data); a->ReadBearings(Data->vec); delete a; } } void WriteObjectsToXML(compass_data* Data ) { if (( Data->shipsname != wxEmptyString ) && ( Data->compassname != wxEmptyString ) && ( Data->needsaving )) { ReadWriteXML* a = new ReadWriteXML(Data); a->WriteBearings(Data->vec); Data->needsaving = false; delete a; //wxPuts(_("WriteObjectsToXML")); } }
ea0cde6eacb180f922118f7b12f34c1a134c8f45
f4f27ed995abc43ca779f72f40f1dff046657239
/Practice_Algorithm/difficulty1/2027.cpp
e8b22bbc966c206179fb58361e2c915010311fdf
[]
no_license
hyunho9304/Practice_Algorithm
b283a693d2e43635fa821f9c8f35d9a2edeed52d
ec3a6591959475e3514b230ef1695dd4a7d7c183
refs/heads/master
2022-02-28T13:43:23.658914
2022-02-14T07:03:48
2022-02-14T07:03:48
151,240,432
0
0
null
2022-02-14T07:03:48
2018-10-02T10:58:54
C++
UTF-8
C++
false
false
631
cpp
2027.cpp
/* 2027. 대각선 출력하기 https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5QFuZ6As0DFAUq&categoryId=AV5QFuZ6As0DFAUq&categoryType=CODE&&& < output > #++++ +#+++ ++#++ +++#+ ++++# */ #include<iostream> #include<stdio.h> #include<string.h> #include<algorithm> using namespace std ; int main() { char text[6] = "#++++" ; int i = 0 ; while( i < 5 ) { printf("%s\n" , text ) ; char tmpText[6] = "" ; strcpy ( tmpText , text ) ; char tmpChar = tmpText[4] ; for( int j = 0 ; j < 4 ; j++ ) { text[ j + 1 ] = tmpText[ j ] ; } text[0] = tmpChar ; i++ ; } return 0 ; }
e30da89d74c854a4da6378c2d3713b6e1a0e7704
648ffc6937bef12b2f2ac18f2e57e34910951346
/WMPRemote/SettingsDialog.cpp
dc573e4515e52f88f6cd20e2a9b1d4161dc70508
[]
no_license
zanderz/WMPRemote
71ee25796f427ffd737b686bf0b1300110707c9d
f01587db161ce2c1f10eaec9c7b0cd1089dad08d
refs/heads/master
2022-10-03T21:01:06.514347
2022-09-18T18:14:23
2022-09-18T18:14:23
45,816,750
0
0
null
null
null
null
UTF-8
C++
false
false
650
cpp
SettingsDialog.cpp
#include "stdafx.h" #include "SettingsDialog.h" LRESULT CSettingsDialog::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { CAxDialogImpl<CSettingsDialog>::OnInitDialog(uMsg, wParam, lParam, bHandled); SetDlgItemInt(IDC_COUNTDOWN, m_countdown); SetDlgItemInt(IDC_FORCEFADE, m_fadeout); return 1; } LRESULT CSettingsDialog::OnClickedOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { BOOL translated; UINT val = GetDlgItemInt(IDC_COUNTDOWN, &translated); if (translated) m_countdown = val; val = GetDlgItemInt(IDC_FORCEFADE, &translated); if (translated) m_fadeout = val; EndDialog(wID); return 0; }
0702cb32030425d0f228f2fdbb4017baca425e3d
d70ffa58b4cfeb21a9d7d51d530369488b2c07a2
/Redundant Connection.cpp
cc6fb4e65ccbb3d16f26f89f752c38e208186e00
[]
no_license
pramod3009/leetcode
0eb0c04e537d4a353114594debc1c792b7783e65
5f4e165b7e7d0e99607522a62a1b29d165559a83
refs/heads/master
2023-06-21T11:19:05.445737
2021-07-25T22:44:50
2021-07-25T22:44:50
273,813,595
0
1
null
null
null
null
UTF-8
C++
false
false
841
cpp
Redundant Connection.cpp
class Solution { public: int find(vector<int> &parent, int x){ if(parent[x]==x){ return x; } return find(parent,parent[x]); } vector<int> findRedundantConnection(vector<vector<int>>& edges) { vector<int> result(2,0); if(!edges.size() or !edges[0].size()){ return result; } vector<int> parent(edges.size() + 1, 0); for(int i = 0; i <= edges.size(); i++){ parent[i] = i; } for(int i = 0; i < edges.size(); i++){ int x = find(parent,edges[i][0]); int y = find(parent,edges[i][1]); if(x!=y){ parent[x] = y; } else { result[0] = edges[i][0]; result[1] = edges[i][1]; } } return result; } };
6290d848daec85edc5faf5ce4234da5947270ed0
046b675cb8529d1585a688f21563eb0209c94f19
/src/Control2012/libreoffice/com/sun/star/io/FilePermission.hpp
1321ee68d5db733c58c18f44bd4d2dac7be9147b
[]
no_license
yoshi5534/schorsch-the-robot
a2a4bd35668600451e53bd8d7f879df90dcb9994
77eb8dcabaad5da3908d6b4b78a05985323f9ba4
refs/heads/master
2021-03-12T19:41:35.524173
2013-04-17T20:00:29
2013-04-17T20:00:29
32,867,962
0
0
null
null
null
null
UTF-8
C++
false
false
1,766
hpp
FilePermission.hpp
#ifndef INCLUDED_COM_SUN_STAR_IO_FILEPERMISSION_HPP #define INCLUDED_COM_SUN_STAR_IO_FILEPERMISSION_HPP #include "sal/config.h" #include "com/sun/star/io/FilePermission.hdl" #include "com/sun/star/uno/Type.hxx" #include "cppu/unotype.hxx" #include "rtl/ustring.hxx" #include "sal/types.h" #include "typelib/typeclass.h" #include "typelib/typedescription.h" namespace com { namespace sun { namespace star { namespace io { inline FilePermission::FilePermission() SAL_THROW( () ) : URL() , Actions() { } inline FilePermission::FilePermission(const ::rtl::OUString& URL_, const ::rtl::OUString& Actions_) SAL_THROW( () ) : URL(URL_) , Actions(Actions_) { } } } } } namespace com { namespace sun { namespace star { namespace io { inline ::com::sun::star::uno::Type const & cppu_detail_getUnoType(::com::sun::star::io::FilePermission const *) { //TODO: On certain platforms with weak memory models, the following code can result in some threads observing that the_type points to garbage static ::typelib_TypeDescriptionReference * the_type = 0; if (the_type == 0) { ::typelib_TypeDescriptionReference * the_members[] = { ::cppu::UnoType< ::rtl::OUString >::get().getTypeLibType(), ::cppu::UnoType< ::rtl::OUString >::get().getTypeLibType() }; ::typelib_static_struct_type_init(&the_type, "com.sun.star.io.FilePermission", 0, 2, the_members, 0); } return *reinterpret_cast< ::com::sun::star::uno::Type * >(&the_type); } } } } } inline ::com::sun::star::uno::Type const & SAL_CALL getCppuType(::com::sun::star::io::FilePermission const *) SAL_THROW(()) { return ::cppu::UnoType< ::com::sun::star::io::FilePermission >::get(); } #endif // INCLUDED_COM_SUN_STAR_IO_FILEPERMISSION_HPP
90d15c8f127c1ad12425dcd7044bcf52ef8c28d1
b8620e9c84bd3ae180cf0f6db1695a5d7cf69a3f
/include/DetectorHit.hh
7106a4d749834812df46d8fed72b37c6e9ff97c9
[]
no_license
bsmaat/SimpleModel
be38208325e09ca49ea1476b15f13752b639eedc
3e1ce1855a96c77832bbe88e86b6504cb858b1b9
refs/heads/master
2021-01-10T12:53:57.584220
2016-02-10T14:21:45
2016-02-10T14:21:45
51,371,309
0
0
null
null
null
null
UTF-8
C++
false
false
2,199
hh
DetectorHit.hh
#ifndef DetectorHit_h #define DetectorHit_h 1 #include "G4VHit.hh" #include "G4THitsCollection.hh" #include "G4Allocator.hh" #include "G4ThreeVector.hh" #include "tls.hh" #include "G4ParticleDefinition.hh" class DetectorHit : public G4VHit { public: DetectorHit(); DetectorHit(const DetectorHit&); virtual ~DetectorHit(); //operators const DetectorHit& operator=(const DetectorHit&); G4int operator==(const DetectorHit&) const; inline void* operator new(size_t); inline void operator delete(void*); //methods from base class virtual void Draw(); virtual void Print(); // Set methods void SetTrackID (G4int track) { fTrackID = track; }; void SetParentID (G4int parent) { fParentID = parent; }; void SetChamberNb(G4int chamb) { fChamberNb = chamb; }; void SetEdep (G4double de) { fEdep = de; }; void SetKE (G4double ke) { fKE = ke; }; void SetPos (G4ThreeVector xyz){ fPos = xyz; }; void SetMom (G4ThreeVector xyz){ fMom = xyz; }; void SetParticle (G4ParticleDefinition* f) { fParticle = f; }; // Get methods G4int GetTrackID() const { return fTrackID; }; G4int GetParentID() const { return fParentID; }; G4int GetChamberNb() const { return fChamberNb; }; G4double GetEdep() const { return fEdep; }; G4double GetKE() const { return fKE; }; G4ThreeVector GetPos() const { return fPos; }; G4ThreeVector GetMom() const { return fMom; }; G4ParticleDefinition* GetParticle() const { return fParticle; } private: //some data members; G4int fTrackID, fChamberNb, fParentID; G4double fEdep, fKE; G4ThreeVector fPos, fMom; G4ParticleDefinition* fParticle; }; //not sure about this: collection of hits? typedef G4THitsCollection<DetectorHit> DetectorHitsCollection; extern G4ThreadLocal G4Allocator<DetectorHit>* DetectorHitAllocator; inline void* DetectorHit::operator new(size_t) { if(!DetectorHitAllocator) DetectorHitAllocator = new G4Allocator<DetectorHit>; return (void *) DetectorHitAllocator->MallocSingle(); } inline void DetectorHit::operator delete(void *hit) { DetectorHitAllocator->FreeSingle((DetectorHit*) hit); } #endif
77dd612ab82ccb1723cf8a9ea11ad30ddeca8d44
089077acd7dc512a1afde017692382b0b9ada02f
/SmartHSR/HLineElement.h
de4fdf1121d6d73bcf79bc70b103e2f566890f8c
[]
no_license
lizzyly7/SmartDraw
6830b172cebcf2005366b7438d771af3faa137cf
cb891dbe66d75bbb3f692fce72e91402e1c97010
refs/heads/main
2023-04-19T05:54:52.948266
2021-05-04T11:02:01
2021-05-04T11:02:01
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,019
h
HLineElement.h
// HLineElement.h: interface for the CHLineElement class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_HLINEELEMENT_H__9B4B8B48_2D4A_46BE_AED7_8DB43C747FD1__INCLUDED_) #define AFX_HLINEELEMENT_H__9B4B8B48_2D4A_46BE_AED7_8DB43C747FD1__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "HiddenDef.h" #include "HSRFace.h" #include "HSRScanner.h" #include "HSRBoundingBox.h" // Added by ClassView #include "Element.h" class CHLineElement : public CHSRElement { public: CHLineElement(); virtual ~CHLineElement(); public: bool ParseLine(CHSRScanner* pHSRScanner); CHSRFace* CreateFace(CHSRViewFormat* pViewFormat,long& nID){ return NULL;} bool IsInVolume(const CIsVolume& volume); DECLARE_HSR_ELEMENT(CHLineElement); protected: int CalcVolume(); public: CHSRBoundingBox GetBoundingBox(); long m_nGroup; POINT_T m_pt[2]; bool m_bVisible; }; #endif // !defined(AFX_HLINEELEMENT_H__9B4B8B48_2D4A_46BE_AED7_8DB43C747FD1__INCLUDED_)
1b7f695cf13a3c07c2d8c6683841380e56ab7756
6fcb7cc80abe2f1b249525d7dfe973c62b106c85
/TXT/TXTDlg.h
f6031c4831c24898e76e70e7a2f947cbf5262f31
[]
no_license
qq635938204/TXT
e64887a547e0e14e4796ef8faa84b9ab9195ed92
96b0276a60a718936acc8fcfb5a1bbb10c9c2d34
refs/heads/master
2020-03-30T10:38:14.568605
2015-03-27T09:43:38
2015-03-27T09:43:38
32,063,441
0
0
null
null
null
null
GB18030
C++
false
false
917
h
TXTDlg.h
// TXTDlg.h : 头文件 // #pragma once #include "afxwin.h" // CTXTDlg 对话框 class CTXTDlg : public CDialogEx { // 构造 public: CTXTDlg(CWnd* pParent = NULL); // 标准构造函数 ~CTXTDlg(); // 对话框数据 enum { IDD = IDD_TXT_DIALOG }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 // 实现 protected: HICON m_hIcon; // 生成的消息映射函数 virtual BOOL OnInitDialog(); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); DECLARE_MESSAGE_MAP() private: HANDLE m_hMain; public: CString m_csPath; CString m_csFileName; CString m_csMainPath; CString m_csOutPutFilename; protected: public: afx_msg void OnBnClickedButtonStart(); long FileProcessing(const CString& csPath); CEdit m_output; CButton m_start; afx_msg void OnIdclose(); virtual void OnCancel(); void Stop(); afx_msg void OnBnClickedButtonTest(); CButton m_Test; };
09bc53af8b0e0219409c36e6244fc4c9dd73e0f2
c4a94f04fcb9215ff55f855798f16d183ac8fd86
/Snake/menu.h
3b741195af9fa9c4011cfc297805e4e37ddc83d7
[]
no_license
happyCode2020/Snake
96851e15f91e0cfaf4de6c126b1ef8ab0b0e41c5
8fdc7176ff8fc9d0829b22ca45dc3fffd349a4b5
refs/heads/master
2021-02-27T01:03:22.954634
2020-03-20T00:26:10
2020-03-20T00:26:10
245,565,483
0
0
null
null
null
null
GB18030
C++
false
false
958
h
menu.h
#pragma once #include"include.h" #define MENU_FIRST_X 34 //菜单的水平位置 #define MENU_FIRST_Y 10 //菜单的竖直位置 #define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0) //检测是否按下VK_NONAME键 using namespace std; class menu { static bool menuFlag; static bool flagUP; static int choiceNum; static bool game; static bool music; static int speed;//速度 public: static void show();//显示菜单 static void choice();//选择 static void setCursorVisible(bool visible);//光标可见性 static void setCursorPosition(int x,int y);//光标位置 static void setOutputColor(WORD color);//接下来打印的文字颜色 static void setGame(bool setIt);//允许暂停 static void setShow(); private: static void startGame();//开始游戏 static DWORD WINAPI Fun(LPVOID lpParamter);//按键检测以及确认效果(线程函数) static DWORD WINAPI setFun(LPVOID lpParamter);//设置(线程函数) };
6e0ab82a92953a91c4c3b73b1f03a0c03bbba022
8d74ac4708e6c58662ca2daa18f4af86d138c719
/shared/xstring/xstring.h
e9cf572e95ec5cb96a080422f80899af9c29aff3
[]
no_license
mr-nv/phantomhack
760bcc6bd54ba37d77414e674c2a7a46e179fb73
bf9a8b221fc5c62171517cb71744ce391bc53e3a
refs/heads/master
2023-02-26T10:34:28.705391
2021-02-02T18:31:36
2021-02-02T18:31:36
335,384,137
0
1
null
null
null
null
UTF-8
C++
false
false
12,517
h
xstring.h
#pragma once /* ****************************************************** *** Created by Fullmetal Alcoholic in 2018 *** *** Subject: xstring (xstringA/xstringW) *** *** Description: xor encrypted thread-safe string *** ****************************************************** Formatting Guide: Both of strings (xstringA/xstringW) has .Format and .AppendFormat methods. It is similar with sprintf and wsprintf formatting, but it has a unique implementation. ************************************************************************************** * Pattern: %<#><[Width/Precision]><Modifier><Data type><(Delimiter for raw data)> * ************************************************************************************** 0. Percent character If you need to put percent character in your string ('%') - just write it twice: '%%'. Single percent means format pattern. 1. Prefix '#' [optional] # - put it after format character to use prefix "0x" (or "0b") for hexadecimal or binary numbers. 2. Width/Precision '[...]' [optional] [width (or precision if float, double or decimal value)] - size limit for string or raw buffer to be presented. Must be inside of []. If float, double or digital data types are chosen (exepting 'B' and 'c') - this value will mean precision of it. 3. Modifier [optional] Modifier - 'l' or 'll' (long / long long). Size prefix for numbers. For example lli us long long int. type - type of data to format. Modifiers only for raw data types ('rx', 'rX', 'ru', 'rb'): 'n' for no space delimiters. Cannot be used with '#' prefix. And 't' for custom delimiter. When using t after data type comes '()'. You can define any delimiter inside. For example '(;\r\n)', '(_)', '(lol)', etc. And modifier 'z' to specify string or char type. Only for 's' and 'c' types. 4. Data type [required] You must to select one of next data types to interpret input data according to your needs. You can choose only one of data type for every '%' format instance. But you can modify some of them with 'l' or 'll'. For example '%u', '%lu' or '%llu'. 5. Delimiter for raw data '()' [optional] Any characters or words to separate bytes. Usable only with 't' modifier. Not neccessary even with 't'. Can also be empty: '()' Data types: ********************************************************************************************************* d, i - signed int. u - unsigned int. f - double (can also present float) ("lf" is a long double). x - Lower-case unsigned hexadecimal int. X - Upper-case unsigned hexadecimal int. a, p - Lower-case address (or pointer). Same as x. A, P - Upper-case address (or pointer). Same as X. b - Any type as binary. c - Single character (char or wchar_t). s - String (char*). B - Boolean (bool) (as text). rx - Raw bytes as HEX pairs (lower-case). If no width defined - next function parameter must be size of bytes to read. rX - Raw bytes as HEX pairs (upper-case). If no width defined - next function parameter must be size of bytes to read. ru - Raw bytes as unsigned decimal bytes. If no width defined - next function parameter must be size of bytes to read. rb - Raw bytes as binary sequence. If no width defined - next function parameter must be size of bytes to read. ********************************************************************************************************* Modifiers: ********************************************************************************************************* l - Means 'long'. Application: Only for integer and floating point values. Supported data types: 'd', 'i', 'f', 'x', 'X', 'a', 'p', 'A', 'P', 'b' ll - Means 'long long'. Maximum size. Can be applied only to integer values. Supported data types: 'd', 'i', 'x', 'X', 'a', 'p', 'A', 'P', 'b' n - No delimiter for raw data. Bytes will be presented without any delimiters. Can be applied only to raw data. Not works with '#' prefix. Supported data types: 'rx', 'rX', 'ru', 'rb'. t - Custom delimiter for raw data. Can be applied only to raw data. When used: You able to put '()' on the end of pattern to specify the delimiter. Example of usage: '%trx(;)' - All raw data bytes will be delimited by ';'. If brackets are not used with this modifier - all data will be delimited by spaces. Supported data types: 'rx', 'rX', 'ru', 'rb'. z - Explicitly specify string type. Widechar or multibyte. Can be applied only to string or character. When used: You able to put '.' on the end of pattern to specify the type of string. '.a' Means ANSI string (or multibyte). '.w' Means wide-char string. Example of usage: '%zc.a' or '%zs.w'. Supported data types: 's', 'c'. ********************************************************************************************************* All possible combinations of modificators and data types: ld, li, lld, lli lu, llu lb, llb lf lx, llx, lX, llX la, lla, lA, llA lp, llp, lP, llP lb, llb nr, nR, nru, nrb (Works only without '#' prefix) trx, trX, tru, trb zs, zc Exapmles: xstr.Format("Int some = %i", i); //Int some = 28 xstr.Format("Progress: %i%%", prog); //Progress: 95% xstr.Format("Length of str %s is %u", buf, len); //Length of str Tokyo is 5 xstr.Format("Raw bytes: %#r", buf, size); //Raw bytes: 0x1F 0x56 0x12 0xA7 0x84 0xD1 xstr.Format("Raw bytes: %#[4]r", buf); //Raw bytes: 0x1F 0x56 0x12 0xA7 xstr.Format("Raw bytes: %[4]r", buf); //Raw bytes: 1F 56 12 A7 xstr.Format("Very long number as HEX: %#llX", some); //Very long number as HEX: 0x12415FX225 xstr.Format("First 3 chars of str is %[3]s", buf); //First 3 chars of str is Tok double d = 2.842146; xstr.Format("d with precision 3 is %[3]f", d); //d with precision 3 is 2.842 */ #include <Windows.h> #include <string> class _xstringA; class _xstringW; typedef volatile _xstringW xstringW; typedef volatile _xstringA xstringA; #ifdef UNICODE typedef xstringW xstring; #else typedef xstringA xstring; #endif class _xstringA { public: /*class Iterator { private: xstringA* m_pstr; size_t m_i; size_t m_from; size_t m_maxcount; size_t m_count; bool m_looped; bool m_reversed; bool m_reached; public: Iterator(xstringA &str); bool Go(); void Reversed(bool IsReversed); void Looped(bool IsLooped); void SetBounds(size_t start, size_t count = 0); char Get(); void Reset(xstringA &str); void __fastcall Set(char c); };*/ private: //friend Iterator; volatile char* m_lpcStr; volatile char* m_lpXorKey; volatile size_t m_stLen; volatile size_t m_stxKeySize; volatile HANDLE m_hMutex; volatile bool m_bXorStr; void __fastcall _setStr(const char* str, bool HoldMutex = true) volatile; void __fastcall _decrypt(char* output) const volatile; void _generateKey(size_t strl) volatile; size_t __fastcall _getKeyIndexForIndex(size_t i) const volatile; void __fastcall _append(const char* str, bool HoldMutex) volatile; void __fastcall _push(const char c, bool HoldMutex) volatile; public: _xstringA(); _xstringA(bool xorstr); _xstringA(volatile const char* str, bool xor = true); _xstringA(const char* str, bool xor = true); _xstringA(std::string str, bool xor = true); //_xstringA(const xstringA &str); _xstringA(xstringA &str); ~_xstringA(); const std::string GetStr() const volatile; const std::string GetStr_a() const volatile; const std::wstring GetStr_w() const volatile; size_t GetLen() const volatile; std::string GetReversed() const volatile; void __fastcall Append(const xstringA& str) volatile; void __fastcall Append(const char* str) volatile; void __fastcall Append(const std::string str) volatile; void __fastcall Push(const char c) volatile; void __fastcall Format(const char* fmt, ...) volatile; void __fastcall AppendFormat(const char* fmt, ...) volatile; void __fastcall Encryption(bool enabled) volatile; void __fastcall ReInit(const char* str, bool xor = true) volatile; bool __fastcall SetChar(const char c, size_t n) volatile; volatile _xstringA& operator=(const volatile _xstringA& right) volatile; volatile _xstringA& operator=(const char* right) volatile; volatile _xstringA& operator=(const std::string right) volatile; volatile _xstringA& operator+=(const volatile _xstringA& right) volatile; volatile _xstringA& operator+=(const char* right) volatile; volatile _xstringA& operator+=(char right) volatile; volatile _xstringA& operator+=(const std::string right) volatile; friend bool operator==(const volatile _xstringA left, const volatile _xstringA& right); friend bool operator!=(const volatile _xstringA left, const volatile _xstringA& right); friend bool operator==(const volatile _xstringA left, const std::string& right); friend bool operator!=(const volatile _xstringA left, const std::string& right); friend bool operator==(const volatile _xstringA left, const char* right); friend bool operator!=(const volatile _xstringA left, const char* right); friend xstringA operator+(xstringA left, const xstringA& right); friend xstringA operator+(xstringA left, const char* right); friend xstringA operator+(xstringA left, char right); friend xstringA operator+(xstringA left, std::string right); operator const std::string() const volatile; char operator [] (size_t n) const volatile; }; class _xstringW { private: volatile wchar_t* m_lpcwStr; volatile char* m_lpXorKey; volatile size_t m_stLen; volatile size_t m_stxKeySize; volatile HANDLE m_hMutex; volatile bool m_bXorStr; void __fastcall _setStr(const wchar_t* str, bool HoldMutex = true) volatile; void __fastcall _decrypt(wchar_t* output) const volatile; void _generateKey(size_t strl) volatile; size_t __fastcall _getKeyIndexForIndex(size_t i) const volatile; wchar_t __fastcall _cryptWchar(size_t index, wchar_t _wc = 0, bool custom = false) const volatile; void __fastcall _append(const wchar_t* str, bool HoldMutex) volatile; void __fastcall _push(const wchar_t c, bool HoldMutex) volatile; public: _xstringW(); _xstringW(bool xorstr); _xstringW(volatile const wchar_t* str, bool xor = true); _xstringW(const wchar_t* str, bool xor = true); _xstringW(const std::wstring str, bool xor = true); //_xstringW(const xstringW &str); _xstringW(xstringW &str); ~_xstringW(); const std::wstring GetStr() const volatile; const std::wstring GetStr_w() const volatile; const std::string GetStr_a() const volatile; size_t GetLen() const volatile; std::wstring GetReversed() const volatile; void __fastcall Append(const xstringW& str) volatile; void __fastcall Append(const wchar_t* str) volatile; void __fastcall Append(const std::wstring str) volatile; void __fastcall Push(const wchar_t c) volatile; void __fastcall Format(const wchar_t* fmt, ...) volatile; void __fastcall AppendFormat(const wchar_t* fmt, ...) volatile; void __fastcall Encryption(bool enabled) volatile; void __fastcall ReInit(const wchar_t* str, bool xor = true) volatile; bool __fastcall SetChar(const wchar_t c, size_t n) volatile; volatile _xstringW& operator=(const volatile _xstringW& right) volatile; volatile _xstringW& operator=(const wchar_t* right) volatile; volatile _xstringW& operator=(const std::wstring right) volatile; volatile _xstringW& operator+=(const volatile _xstringW& right) volatile; volatile _xstringW& operator+=(const wchar_t* right) volatile; volatile _xstringW& operator+=(wchar_t right) volatile; volatile _xstringW& operator+=(const std::wstring right) volatile; friend bool operator==(const volatile _xstringW left, const volatile _xstringW& right); friend bool operator!=(const volatile _xstringW left, const volatile _xstringW& right); friend bool operator==(const volatile _xstringW left, const std::wstring& right); friend bool operator!=(const volatile _xstringW left, const std::wstring& right); friend bool operator==(const volatile _xstringW left, const wchar_t* right); friend bool operator!=(const volatile _xstringW left, const wchar_t* right); friend xstringW operator+(xstringW left, const xstringW& right); friend xstringW operator+(xstringW left, const wchar_t* right); friend xstringW operator+(xstringW left, wchar_t right); friend xstringW operator+(xstringW left, const std::wstring& right); operator const std::wstring() const volatile; wchar_t operator [] (size_t n) const volatile; };
34718fd54dbeb2f8a5b04ae9f5862c1a3f5aff9c
957d669a64358ac792f109f5930288fa858d89ac
/TheRayTracerChallengeTests/TransformTests.cpp
baed191ac237699032443752edc0dc8de29c3989
[]
no_license
AdrianGerber/TheRayTracerChallenge
130d60b6e541193af60800b2ff75c74a8dceb10e
6a39a555a62d9fd0389f82e9d078f379c55875d6
refs/heads/master
2020-05-01T12:16:28.080810
2019-05-10T19:02:47
2019-05-10T19:02:47
177,462,004
4
1
null
null
null
null
UTF-8
C++
false
false
5,775
cpp
TransformTests.cpp
#include "stdafx.h" #include "CppUnitTest.h" #include <Matrix.h> #include <Transform.h> #include <Constants.h> #include <Tuple.h> #include <cmath> using namespace Microsoft::VisualStudio::CppUnitTestFramework; using namespace RayTracer; namespace TheRayTracesChallengeTests { TEST_CLASS(TransformTests) { public: TEST_METHOD(Translation) { Transform translation = Transform::CreateTranslation(5.0f, -3.0f, 2.0f); Tuple point = Tuple::CreatePoint(-3.0f, 4.0f, 5.0f); Tuple vector = Tuple::CreateVector(-3.0f, 4.0f, 5.0f); //Translating a point Assert::IsTrue(translation * point == Tuple::CreatePoint(2.0f, 1.0f, 7.0f)); //Translating a vector (no change) Assert::IsTrue(vector * translation == vector); //Inverse translation Assert::IsTrue(translation.Inversion() * point == Tuple::CreatePoint(-8.0f, 7.0f, 3.0f)); } TEST_METHOD(Scaling) { Transform scale = Transform::CreateScale(2.0f, 3.0f, 4.0f); Tuple point = Tuple::CreatePoint(-4.0f, 6.0f, 8.0f); Tuple vector = Tuple::CreateVector(-4.0f, 6.0f, 8.0f); //Scaling a point Assert::IsTrue(scale * point == Tuple::CreatePoint(-8.0f, 18.0f, 32.0f)); //Scaling a vector Assert::IsTrue(scale * vector == Tuple::CreateVector(-8.0f, 18.0f, 32.0f)); //Inverse scaling Assert::IsTrue(scale.Inversion() * vector == Tuple::CreateVector(-2.0f, 2.0f, 2.0f)); //Reflection (Scale by negative value) Assert::IsTrue( Transform::CreateScale(-1.0f, 1.0f, 1.0f) * Tuple::CreatePoint(2.0f, 3.0f, 4.0f) == Tuple::CreatePoint(-2.0f, 3.0f, 4.0f) ); } TEST_METHOD(RotationX) { Tuple p = Tuple::CreatePoint(0.0f, 1.0f, 0.0f); //Rotation around x-axis Transform halfQuarter = Transform::CreateRotationX(Constants::PI / 4.0f); Transform fullQuarter = Transform::CreateRotationX(Constants::PI / 2.0f); Assert::IsTrue(halfQuarter * p == Tuple::CreatePoint(0.0f, sqrtf(2.0f) / 2.0f, sqrtf(2.0f) / 2.0f)); Assert::IsTrue(fullQuarter * p == Tuple::CreatePoint(0.0f, 0.0f, 1.0f)); Assert::IsTrue(halfQuarter.Inversion() * p == Tuple::CreatePoint(0.0f, sqrtf(2.0f) / 2.0f, -sqrtf(2.0f) / 2.0f)); } TEST_METHOD(RotationY) { Tuple p = Tuple::CreatePoint(0.0f, 0.0f, 1.0f); //Rotation around y-axis Transform halfQuarter = Transform::CreateRotationY(Constants::PI / 4.0f); Transform fullQuarter = Transform::CreateRotationY(Constants::PI / 2.0f); Assert::IsTrue(halfQuarter * p == Tuple::CreatePoint(sqrtf(2.0f) / 2.0f, 0.0f, sqrtf(2.0f) / 2.0f)); Assert::IsTrue(fullQuarter * p == Tuple::CreatePoint(1.0f, 0.0f, 0.0f)); } TEST_METHOD(RotationZ) { Tuple p = Tuple::CreatePoint(0.0f, 1.0f, 0.0f); //Rotation around z-axis Transform halfQuarter = Transform::CreateRotationZ(Constants::PI / 4.0f); Transform fullQuarter = Transform::CreateRotationZ(Constants::PI / 2.0f); Assert::IsTrue(halfQuarter * p == Tuple::CreatePoint(-sqrtf(2.0f) / 2.0f, sqrtf(2.0f) / 2.0f, 0.0f)); Assert::IsTrue(fullQuarter * p == Tuple::CreatePoint(-1.0f, 0.0f, 0.0f)); } TEST_METHOD(Shearing) { Tuple point = Tuple::CreatePoint(2.0f, 3.0f, 4.0f); //x in proportion to y Assert::IsTrue( Transform::CreateShear(1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f) * point == Tuple::CreatePoint(5.0f, 3.0f, 4.0f) ); //x in proportion to z Assert::IsTrue( Transform::CreateShear(0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f) * point == Tuple::CreatePoint(6.0f, 3.0f, 4.0f) ); //y in proportion to x Assert::IsTrue( Transform::CreateShear(0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f) * point == Tuple::CreatePoint(2.0f, 5.0f, 4.0f) ); //y in proportion to z Assert::IsTrue( Transform::CreateShear(0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f) * point == Tuple::CreatePoint(2.0f, 7.0f, 4.0f) ); //z in proportion to x Assert::IsTrue( Transform::CreateShear(0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f) * point == Tuple::CreatePoint(2.0f, 3.0f, 6.0f) ); //z in proportion to y Assert::IsTrue( Transform::CreateShear(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f) * point == Tuple::CreatePoint(2.0f, 3.0f, 7.0f) ); } TEST_METHOD(ChainingTransformations) { Tuple point = Tuple::CreatePoint(1.0f, 0.0f, 1.0f); Transform rotation = Transform::CreateRotationX(Constants::PI / 2.0f); Transform scaling = Transform::CreateScale(5.0f, 5.0f, 5.0f); Transform translation = Transform::CreateTranslation(10.0f, 5.0f, 7.0f); Tuple point2 = rotation * point; Assert::IsTrue(point2 == Tuple::CreatePoint(1.0f, -1.0f, 0.0f)); Tuple point3 = scaling * point2; Assert::IsTrue(point3 == Tuple::CreatePoint(5.0f, -5.0f, 0.0f)); Tuple point4 = translation * point3; Assert::IsTrue(point4 == Tuple::CreatePoint(15.0f, 0.0f, 7.0f)); Transform transform; transform.RotateX(Constants::PI / 2.0f).Scale(5.0f, 5.0f, 5.0f).Translate(10.0f, 5.0f, 7.0f); Assert::IsTrue(transform * point == point4); } }; }