blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
264
content_id
stringlengths
40
40
detected_licenses
listlengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
5
140
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
905 values
visit_date
timestamp[us]date
2015-08-09 11:21:18
2023-09-06 10:45:07
revision_date
timestamp[us]date
1997-09-14 05:04:47
2023-09-17 19:19:19
committer_date
timestamp[us]date
1997-09-14 05:04:47
2023-09-06 06:22:19
github_id
int64
3.89k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]date
2012-06-07 00:51:45
2023-09-14 21:58:39
gha_created_at
timestamp[us]date
2008-03-27 23:40:48
2023-08-21 23:17:38
gha_language
stringclasses
141 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
10.4M
extension
stringclasses
115 values
content
stringlengths
3
10.4M
authors
listlengths
1
1
author_id
stringlengths
0
158
12ebfa958a7389e97650f42bdbbb60d510bff7ce
4cfbccc070d8744b76e3c54eb7a2743ecfe82690
/libevwork_full/example/jsonsrv/logic.h
e7c04cb846c5dd9a16159f544619588df46f3e58
[]
no_license
oasangqi/c-libs
ab9a504937712743b95fadaa8e56e48f32c20dc8
f7632377146844f3b38eb6bf7b7a9567f3ab0571
refs/heads/master
2021-06-10T06:40:37.500580
2021-04-24T08:24:49
2021-04-24T08:24:49
144,525,989
1
0
null
null
null
null
UTF-8
C++
false
false
638
h
#pragma once #include "libevwork/EVWork.h" #include "libevwork/jsmfc/FormDef.h" #include "libevwork/jsmfc/Sender.h" #include "libevwork/TimerHandler.h" class CLogic : public js::PHClass , public evwork::ILinkEvent { public: DECLARE_JS_FORM_MAP; CLogic(); virtual ~CLogic(); // 连接关注 virtual void onConnected(evwork::IConn* pConn); virtual void onClose(evwork::IConn* pConn); // 协议处理 void onMessage1(Json::Value* pJson, evwork::IConn* pConn); private: // 模拟客户端定时发包 virtual bool __onHandlerSender(); // 定时器 TimerHandler<CLogic, &CLogic::__onHandlerSender> m_timerSender; };
[ "oasangqi@163.com" ]
oasangqi@163.com
c8ea9a4b2a7b96167b60ca08211b9a0d15b6c097
cfb800c3a1659afc3ce16c65bb013c66de66f160
/hw_03_02.cpp
b6b546aac8f868fa866ce90a4de5db31de57c7e0
[]
no_license
zhushh/AlgorithmHomeWork-2014
361b7fdba73d95b0965538075c7cf6963276bfbb
3bacafe57acd7b02174781c3d1f8e526e017bf53
refs/heads/master
2021-01-17T12:56:31.318383
2015-01-16T11:21:49
2015-01-16T11:21:49
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,152
cpp
#include <iostream> #include <stack> #include <string> using namespace std; stack<char> con; bool isBracket(char c) { if (c == '{' || c == '}' || c == '(' || c == ')' || c == '[' || c == ']') { return true; } else { return false; } } void test(string& src) { for (size_t i = 0; i < src.size(); i++) { /// cout << src[i]; if (isBracket(src[i])) { if (con.empty()) { con.push(src[i]); } else if ((con.top() == '{' && '}' == src[i]) || (con.top() == '(' && ')' == src[i]) || (con.top() == '[' && ']' == src[i])) { con.pop(); } else { con.push(src[i]); } } } if (con.empty()) { cout << "True" << endl; } else { cout << "False" << endl; } while (!con.empty()) { con.pop(); } } int main() { string input; int t; cin >> t; getline(cin, input); while (t-- > 0) { getline(cin, input); ///cout << "test for " << input << endl; test(input); } return 0; }
[ "zsh5318@gmail.com" ]
zsh5318@gmail.com
cc091f15f883bdaa530ac4dd22fdf288b9c3b451
215750938b1dd4354eab9b8581eec76881502afb
/src/mfx/pi/param/MapLog.h
5589c97da9875f96c39640ccf2f1d5c8d04bee41
[ "WTFPL" ]
permissive
EleonoreMizo/pedalevite
c28fd19578506bce127b4f451c709914ff374189
3e324801e3a1c5f19a4f764176cc89e724055a2b
refs/heads/master
2023-05-30T12:13:26.159826
2023-05-01T06:53:31
2023-05-01T06:53:31
77,694,808
103
8
null
null
null
null
UTF-8
C++
false
false
1,912
h
/***************************************************************************** MapLog.h Author: Laurent de Soras, 2016 --- Legal stuff --- This program is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more details. *Tab=3***********************************************************************/ #pragma once #if ! defined (mfx_pi_param_MapLog_HEADER_INCLUDED) #define mfx_pi_param_MapLog_HEADER_INCLUDED #if defined (_MSC_VER) #pragma warning (4 : 4250) #endif /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ namespace mfx { namespace pi { namespace param { class MapLog { /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ public: inline void config (double val_min, double val_max); inline double conv_norm_to_nat (double norm) const; inline double conv_nat_to_norm (double nat) const; /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ protected: /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ private: double _a = 1; // nat = exp (norm * _a + _b) double _b = 0; double _ai = 1; // 1 / _a /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ private: bool operator == (const MapLog &other) const = delete; bool operator != (const MapLog &other) const = delete; }; // class MapLog } // namespace param } // namespace pi } // namespace mfx #include "mfx/pi/param/MapLog.hpp" #endif // mfx_pi_param_MapLog_HEADER_INCLUDED /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
[ "fuck@fuck.fuck" ]
fuck@fuck.fuck
f6a264bec26b3aa845f7d1b79f1faec9d6c6b3a6
c79c32e2f30a10f3481d370c68c40b90581be594
/2131R Tower Takeover/include/OnScreen/disabled.hpp
2a788b624e2219f26ce32a080dda1f6eeddebd9b
[]
no_license
Go-Line-Track-Yourself/R-Team-Repository
ad282258f58f4e2c4b13d304b8085b7c1335328c
f411b0af53f0cad243776a845e6cd37b59071914
refs/heads/master
2020-04-01T05:13:55.090756
2020-02-06T22:30:04
2020-02-06T22:30:04
152,895,103
0
0
null
null
null
null
UTF-8
C++
false
false
35
hpp
#pragma once #include "main.h"
[ "ellisonscheuller@gmail.com" ]
ellisonscheuller@gmail.com
9f7a56b41862369701298b9ee05d2de8d9a1c1ce
31c38c6fa9d1aa2ad0ce113e7084cb8c0f7bc956
/SDK/AB_K23_Coat_ACCs01_REF_classes.h
967b30a5535f92a1a408d799f41fcea0e95528e5
[]
no_license
xnf4o/DBD_SDK_461
d46feebba60aa71285479e4c71ff5dbf5d57b227
9d4fb29a75b63f4bd8813d4ee0cdb897aa792a58
refs/heads/main
2023-04-12T22:27:19.819706
2021-04-14T22:09:39
2021-04-14T22:09:39
358,058,055
3
1
null
null
null
null
UTF-8
C++
false
false
5,954
h
#pragma once // Name: DeadByDaylight, Version: 4.6.1 /*!!DEFINE!!*/ /*!!HELPER_DEF!!*/ /*!!HELPER_INC!!*/ #ifdef _MSC_VER #pragma pack(push, 0x01) #endif namespace CG { //--------------------------------------------------------------------------- // Classes //--------------------------------------------------------------------------- // AnimBlueprintGeneratedClass AB_K23_Coat_ACCs01_REF.AB_K23_Coat_ACCs01_REF_C // 0x5C78 (FullSize[0x5EF8] - InheritedSize[0x0280]) class UAB_K23_Coat_ACCs01_REF_C : public UDynamicAccessoryAnimInstance { public: struct FPointerToUberGraphFrame UberGraphFrame; // 0x0280(0x0008) (ZeroConstructor, Transient, DuplicateTransient) struct FAnimNode_Root AnimGraphNode_Root; // 0x0288(0x0038) struct FAnimNode_TransitionResult AnimGraphNode_TransitionResult_2; // 0x02C0(0x0028) struct FAnimNode_TransitionResult AnimGraphNode_TransitionResult; // 0x02E8(0x0028) struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_20; // 0x0310(0x0460) struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_19; // 0x0770(0x0460) struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_18; // 0x0BD0(0x0460) struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_17; // 0x1030(0x0460) struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_16; // 0x1490(0x0460) struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_15; // 0x18F0(0x0460) struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_14; // 0x1D50(0x0460) struct FAnimNode_UseCachedPose AnimGraphNode_UseCachedPose_3; // 0x21B0(0x0030) struct FAnimNode_ConvertLocalToComponentSpace AnimGraphNode_LocalToComponentSpace_2; // 0x21E0(0x0020) struct FAnimNode_ConvertComponentToLocalSpace AnimGraphNode_ComponentToLocalSpace_2; // 0x2200(0x0020) struct FAnimNode_StateResult AnimGraphNode_StateResult_3; // 0x2220(0x0038) unsigned char UnknownData_8NDA[0x8]; // 0x2258(0x0008) MISSED OFFSET (FIX SPACE BETWEEN PREVIOUS PROPERTY) struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_13; // 0x2260(0x0460) struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_12; // 0x26C0(0x0460) struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_11; // 0x2B20(0x0460) struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_10; // 0x2F80(0x0460) struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_9; // 0x33E0(0x0460) struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_8; // 0x3840(0x0460) struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_7; // 0x3CA0(0x0460) struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_6; // 0x4100(0x0460) struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_5; // 0x4560(0x0460) struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_4; // 0x49C0(0x0460) struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_3; // 0x4E20(0x0460) struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_2; // 0x5280(0x0460) struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics; // 0x56E0(0x0460) struct FAnimNode_ConvertComponentToLocalSpace AnimGraphNode_ComponentToLocalSpace; // 0x5B40(0x0020) struct FAnimNode_UseCachedPose AnimGraphNode_UseCachedPose_2; // 0x5B60(0x0030) struct FAnimNode_ConvertLocalToComponentSpace AnimGraphNode_LocalToComponentSpace; // 0x5B90(0x0020) struct FAnimNode_StateResult AnimGraphNode_StateResult_2; // 0x5BB0(0x0038) struct FAnimNode_UseCachedPose AnimGraphNode_UseCachedPose; // 0x5BE8(0x0030) struct FAnimNode_StateResult AnimGraphNode_StateResult; // 0x5C18(0x0038) struct FAnimNode_StateMachine AnimGraphNode_StateMachine; // 0x5C50(0x00B0) struct FAnimNode_CopyPoseFromMesh AnimGraphNode_CopyPoseFromMesh; // 0x5D00(0x0140) (ContainsInstancedReference) struct FAnimNode_SaveCachedPose AnimGraphNode_SaveCachedPose; // 0x5E40(0x00B8) static UClass* StaticClass() { static auto ptr = nullptr; if (!ptr) ptr = UObject::FindClass("AnimBlueprintGeneratedClass AB_K23_Coat_ACCs01_REF.AB_K23_Coat_ACCs01_REF_C"); return ptr; } void AnimGraph(struct FPoseLink* AnimGraph); void ExecuteUbergraph_AB_K23_Coat_ACCs01_REF(int EntryPoint); }; } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "xnf4o@inbox.ru" ]
xnf4o@inbox.ru
d1101dd2b5ca0818c6bfc97163451de9873441f3
8963590287e66840e0b3490d38b823f202c57206
/src/WeightWatchers.h
5788c05fc6f95ad516f27dc21c1e8770382630f3
[]
no_license
Cakalaka/WeightWatchers
0a60fa393fbefd6446033f6130430c922a94d953
aea88acbdc42f0c5d51eabb9c14d58060634e98b
refs/heads/master
2021-03-27T11:54:42.910881
2013-03-08T12:43:22
2013-03-08T12:43:22
8,161,480
0
0
null
null
null
null
UTF-8
C++
false
false
741
h
/* * WeightWatchers.h * * Created on: 12 Feb 2013 * Author: christopher */ #ifndef WEIGHTWATCHERS_H_ #define WEIGHTWATCHERS_H_ #include<iostream> #include<cmath> #include<stdlib.h> #include<time.h> #include"client.h" using namespace std; class WeightWatchers{ public: WeightWatchers(); virtual ~WeightWatchers(); double height, weight; char gender; double bodyMassIndex ( double height, double weight); double bodySurfaceArea( double height, double weight); double leanMassIndex ( double height, double weight, char gender); string calculateDescription(double bmi, char gender); }; void display(); struct personData{ string name; double height; double weight; char gender; }; #endif /* WEIGHTWATCHERS_H_ */
[ "chistopehrkay@gmail.com" ]
chistopehrkay@gmail.com
cce410aeba67acaf6a4d39631308790394a303bc
2e5befeb790072c7f15ab81fe387eeb4576dd612
/container_constructor.cpp
66edc9b2937a29cd9679787a7f9aebb630925ccd
[]
no_license
SemyonWinter/ProgramMethodsOOP
59e1efdc860bb51bf89326ae6eec32d3765bae7e
c67dc32b0aa02df08583a5e7b8a388b01e12007f
refs/heads/master
2022-11-07T06:36:09.875853
2020-06-12T04:06:09
2020-06-12T04:06:09
267,502,865
0
0
null
null
null
null
UTF-8
C++
false
false
141
cpp
#include "container.h" #include "number_complex.h" #include "number_fractal.h" container::container() { size = 0; begin = end = nullptr; }
[ "filippov.semyon@gmail.com" ]
filippov.semyon@gmail.com
025ac1b84a5adeec74e6eb51f2b8528e4474d33c
f268ef85eb335af1794a669e7f69e3c94d3b3cb0
/Client/source/FeintEdit/util/settinghelper.h
e9cc2f5baf0d9a62edaa0c712b7bb454d623d51c
[]
no_license
feint123/Emoji
a67a9a6f7cc2e61bba16f9cb75a18c61c8b5d428
9929171c9eb74b9799fd3ab23e35d68c059dcfbf
refs/heads/master
2020-06-16T18:30:49.915832
2017-02-02T07:33:09
2017-02-02T07:33:09
75,077,349
3
0
null
null
null
null
UTF-8
C++
false
false
748
h
#ifndef SETTINGHELPER_H #define SETTINGHELPER_H #include <domain/setting.h> #include<QDir> #include<QFile> class SettingHelper:public QObject { Q_OBJECT public: SettingHelper(); static int fontSize(); static QString fontFamily(); static QString workspacing(); static QString workPath(QString file); //最近一次打开的笔记本 static QString currentBook(); static QString currentBookName(); static int isShareImage(); static int autoSave(); static Setting* setting(); static Setting* loadSetting(); static void saveSetting(Setting *setting); static bool hasSetting(); static void initWorkspacing(); static void initBasePlug(QString name); }; #endif // SETTINGHELPER_H
[ "13479399352zyf@gmail.com" ]
13479399352zyf@gmail.com
cf6a235b77497cd2b6314c36090a85e61c5668ef
f3a1120331a1c30f0144c511e20c120be86cf150
/src/Selector.h
c11806f8f22fc0b5680705415b63bf5dee355788
[]
no_license
bhaddow/gibbler
11f158e55514bc1fe3377d3a11ee6e78050a4ba8
20761d337a03f770d0d8cf5580d6d560e51ac5ee
refs/heads/master
2021-01-18T11:45:04.847813
2011-10-31T22:33:22
2011-10-31T22:33:22
2,672,235
1
0
null
null
null
null
UTF-8
C++
false
false
3,867
h
/*********************************************************************** Moses - factored phrase-based language decoder Copyright (C) 2010 University of Edinburgh This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ***********************************************************************/ #pragma once /** * Strategies used to select samples proposed by the gibbs operators. **/ #include <vector> #include <boost/random/mersenne_twister.hpp> #include <boost/random/uniform_real.hpp> #include <boost/random/variate_generator.hpp> #include "AnnealingSchedule.h" #include "Gibbler.h" #include "TranslationDelta.h" namespace Josiah { /** * Abstract base class for sample selection strategy. **/ class DeltaSelector { public: virtual TDeltaHandle Select( size_t sampleId, //which sample is selected from the batch const TDeltaVector& deltas, const TDeltaHandle& noChangeDelta, size_t iteration) = 0; virtual void BeginBurnin() {} virtual void EndBurnin() {} virtual void SetSamples(const SampleVector& samples) {} virtual ~DeltaSelector() {} }; /** * Selector that samples the delta by converting the scores to probabilities. **/ class SamplingSelector : public DeltaSelector { public: SamplingSelector(); virtual TDeltaHandle Select( size_t sampleId, const TDeltaVector& deltas, const TDeltaHandle& noChangeDelta, size_t iteration); void SetAnnealingSchedule(AnnealingSchedule* annealingSchedule); void SetTemperature(float temperature); private: //Note that the annealingSchedule overrides the temperature AnnealingSchedule* m_annealingSchedule; float m_temperature; }; typedef boost::mt19937 base_generator_type; template<class T> T log_sum (T log_a, T log_b) { T v; if (log_a < log_b) { v = log_b+log ( 1 + exp ( log_a-log_b )); } else { v = log_a+log ( 1 + exp ( log_b-log_a )); } return ( v ); } /** * Wraps the random number generation and enables seeding. **/ class RandomNumberGenerator { //mersenne twister - and why not? public: static RandomNumberGenerator& instance() {return s_instance;} double next() {return m_random();} void setSeed(uint32_t seed){ m_generator.seed(seed); std::cerr << "Setting random seed to " << seed << std::endl; } size_t getRandomIndexFromZeroToN(size_t n) { return (size_t)(next()*n); } private: static RandomNumberGenerator s_instance; RandomNumberGenerator(); boost::uniform_real<> m_dist; base_generator_type m_generator; boost::variate_generator<base_generator_type&, boost::uniform_real<> > m_random; }; struct RandomIndex { ptrdiff_t operator() (ptrdiff_t max) { return static_cast<ptrdiff_t>(RandomNumberGenerator::instance().getRandomIndexFromZeroToN(max)); } }; };
[ "bhaddow@1f5c12ca-751b-0410-a591-d2e778427230" ]
bhaddow@1f5c12ca-751b-0410-a591-d2e778427230
f7970d082208ae23fa4b85079fc1f678974b44a1
59cd0501c68406bb5918636ed5ee6006d3089d77
/Graph/Bipartite_Matching.cpp
eec2307784423ec45c73099973f11c4e1768cddb
[]
no_license
darrenleeleelee1/CodeBook
8e3d4526fea4b5dc63c3d84813b87f426575c5d5
9de6b9122f2b231e38b58d5322b4f7355f1bf601
refs/heads/master
2023-01-24T01:10:16.590421
2023-01-12T18:03:49
2023-01-12T18:03:49
247,207,032
0
0
null
null
null
null
UTF-8
C++
false
false
1,367
cpp
const int maxn = 500+5; int W[maxn][maxn], n; int Lx[maxn], Ly[maxn]; int Lef[maxn]; bool S[maxn], T[maxn]; bool match(int i) { S[i] = true; for (int j = 1; j <= n; ++j) { if(Lx[i] + Ly[j] == W[i][j] && !T[j]) { T[j] = true; if(!Lef[j] || match(Lef[j])) { Lef[j] = i; return true; } } } return false; } void update() { int a = 0x3f3f3f3f; for(int i = 1; i <= n; i++) { if(S[i]) { for(int j = 1; j <= n; j++) { if(!T[j]) a = min(a, Lx[i] + Ly[j] - W[i][j]); } } } for(int i = 1; i <= n; i++) { if(S[i]) Lx[i] -= a; if(T[i]) Ly[i] += a; } } void KM() { for (int i = 1; i <= n; ++i) { Lef[i] = Lx[i] = Ly[i] = 0; for(int j = 1; j <= n; j++){ Lx[i] = max(Lx[i], W[i][j]); } } for (int i = 1; i <= n; ++i) { for(;;){ for(int j = 1; j <= n; j++){ S[j] = T[j] = 0; } if(match(i)) break; else update(); } } } int main(int argc, char const *argv[]) { for(int i = 1; i <= n; i++){ for(int j = 1; j <= n; j++){ scanf("%d", &W[i][j]); } } KM(); int ans = 0; for(int i = 1; i <= n; i++){ ans += Ly[i]; ans += Lx[i]; } for(int i = 1; i <= n; i++){ if(i != n) printf("%d ", Lx[i]); else printf("%d\n", Lx[i]); } for(int i = 1; i <= n; i++){ if(i != n) printf("%d ", Ly[i]); else printf("%d\n", Ly[i]); } printf("%d\n", ans); return 0; }
[ "darrenleeleelee1@gmail.com" ]
darrenleeleelee1@gmail.com
dfe98b2f043ecc73a8ae0c2e935c789d35e7f030
41177e1c1e60621a21afcb48ac5e2c3e3ee67305
/lib/MBASUB.cpp
b8a566b3f24645052b1ea33c54de53f8d76c7f95
[]
no_license
easy-forks/llvm_things
0ad5a28bb98d60a61121e8dfc5a270b828ae736b
5b334fa92fd95d0c76227c07d869fe6f2873dd26
refs/heads/main
2023-03-25T20:58:12.775288
2021-01-28T08:17:53
2021-01-28T08:17:53
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,880
cpp
//============================================================================== // FILE: // MBASub.cpp // // DESCRIPTION: // Obfuscation for integer sub instructions through Mixed Boolean Arithmetic // (MBA). This pass performs an instruction substitution based on this // equality: // a - b == (a + ~b) + 1 // See formula 2.2 (j) in [1]. // // USAGE: // 1. Legacy pass manager: // $ opt -load <BUILD_DIR>/lib/libMBASub.so --legacy-mba-sub <bitcode-file> // 2. New pass maanger: // $ opt -load-pass-plugin <BUILD_DIR>/lib/libMBASub.so `\` // -passes=-"mba-sub" <bitcode-file> // // [1] "Hacker's Delight" by Henry S. Warren, Jr. // // License: MIT //============================================================================== #include "MBASub.h" #include "llvm/ADT/Statistic.h" #include "llvm/IR/IRBuilder.h" #include "llvm/Passes/PassBuilder.h" #include "llvm/Passes/PassPlugin.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include <random> using namespace llvm; #define DEBUG_TYPE "mba-sub" STATISTIC(SubstCount, "The # of substituted instructions"); //----------------------------------------------------------------------------- // MBASub Implementaion //----------------------------------------------------------------------------- bool MBASub::runOnBasicBlock(BasicBlock &BB) { bool Changed = false; LLVM_DEBUG(dbgs()<<"hello"); // Loop over all instructions in the block. Replacing instructions requires // iterators, hence a for-range loop wouldn't be suitable. for (auto Inst = BB.begin(), IE = BB.end(); Inst != IE; ++Inst) { // Skip non-binary (e.g. unary or compare) instruction. auto *BinOp = dyn_cast<BinaryOperator>(Inst); if (!BinOp) continue; /// Skip instructions other than integer sub. unsigned Opcode = BinOp->getOpcode(); if (Opcode != Instruction::Sub || !BinOp->getType()->isIntegerTy()) continue; // A uniform API for creating instructions and inserting // them into basic blocks. IRBuilder<> Builder(BinOp); // Create an instruction representing (a + ~b) + 1 Instruction *NewValue = BinaryOperator::CreateAdd( Builder.CreateAdd(BinOp->getOperand(0), Builder.CreateNot(BinOp->getOperand(1)) ), ConstantInt::get(BinOp->getType(), 1) ); // The following is visible only if you pass -debug on the command line // *and* you have an assert build. LLVM_DEBUG(dbgs() << *BinOp << " -> " << *NewValue << "\n"); // Replace `(a - b)` (original instructions) with `(a + ~b) + 1` // (the new instruction) ReplaceInstWithInst(BB.getInstList(), Inst, NewValue); Changed = true; // Update the statistics ++SubstCount; } return Changed; } PreservedAnalyses MBASub::run(llvm::Function &F, llvm::FunctionAnalysisManager &) { LLVM_DEBUG(dbgs()<<"hello"); bool Changed = false; for (auto &BB : F) { Changed |= runOnBasicBlock(BB); } return (Changed ? llvm::PreservedAnalyses::none() : llvm::PreservedAnalyses::all()); } bool LegacyMBASub::runOnFunction(llvm::Function &F) { bool Changed = false; for (auto &BB : F) { Changed |= Impl.runOnBasicBlock(BB); } return Changed; } //----------------------------------------------------------------------------- // New PM Registration //----------------------------------------------------------------------------- llvm::PassPluginLibraryInfo getMBASubPluginInfo() { return {LLVM_PLUGIN_API_VERSION, "mba-sub1", LLVM_VERSION_STRING, [](PassBuilder &PB) { PB.registerPipelineParsingCallback( [](StringRef Name, FunctionPassManager &FPM, ArrayRef<PassBuilder::PipelineElement>) { if (Name == "mba-sub1") { FPM.addPass(MBASub()); return true; } return false; }); }}; } extern "C" LLVM_ATTRIBUTE_WEAK ::llvm::PassPluginLibraryInfo llvmGetPassPluginInfo() { return getMBASubPluginInfo(); } //----------------------------------------------------------------------------- // Legacy PM Registration //----------------------------------------------------------------------------- char LegacyMBASub::ID = 0; // Register the pass - required for (among others) opt static RegisterPass<LegacyMBASub> X(/*PassArg=*/"legacy-mba-sub", /*Name=*/"MBASub", /*CFGOnly=*/true, /*is_analysis=*/false);
[ "qwedd80@sina.com" ]
qwedd80@sina.com
d26b05f3ce67e515c81574804dd5e6218c34633c
6ca4d5f12e9a3839e70163856ff29220f63375f9
/dependencies/thermite3d/source/SurfacePatchRenderable.cpp
2cbdf4dae4686c6e495a425a3e501401ca3a554a
[ "MIT" ]
permissive
weflowers/voxeliens
8d75f304067cea534cd906c86715f08207496640
64322d13d1661b6d5f88032b16f410516b9690b8
refs/heads/master
2023-01-31T21:22:55.461634
2020-12-11T19:35:47
2020-12-11T19:35:47
null
0
0
null
null
null
null
UTF-8
C++
false
false
20,248
cpp
/******************************************************************************* Copyright (c) 2005-2009 David Williams This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. *******************************************************************************/ #include "SurfacePatchRenderable.h" #include "Application.h" #include "PolyVoxCore/VertexTypes.h" #include "OgreVertexIndexData.h" #include <QSettings> #include <limits> using namespace PolyVox; using namespace Ogre; namespace Thermite { SurfacePatchRenderable::SurfacePatchRenderable(const String& strName) :m_RenderOp(0) { mName = strName; m_matWorldTransform = Ogre::Matrix4::IDENTITY; m_strMatName = "BaseWhite"; m_pMaterial = Ogre::MaterialManager::getSingleton().getByName("BaseWhite"); m_pParentSceneManager = NULL; mParentNode = NULL; //FIXME - use proper values. mBox.setExtents(Ogre::Vector3(-1000.0f,-1000.0f,-1000.0f), Ogre::Vector3(1000.0f,1000.0f,1000.0f)); } SurfacePatchRenderable::~SurfacePatchRenderable(void) { if(m_RenderOp) { delete m_RenderOp->vertexData; delete m_RenderOp->indexData; delete m_RenderOp; } } const Ogre::AxisAlignedBox& SurfacePatchRenderable::getBoundingBox(void) const { return mBox; } Real SurfacePatchRenderable::getBoundingRadius(void) const { return Math::Sqrt((std::max)(mBox.getMaximum().squaredLength(), mBox.getMinimum().squaredLength())); } const Ogre::LightList& SurfacePatchRenderable::getLights(void) const { // Use movable query lights //return queryLights(); typedef std::multimap<float,Ogre::Light*> olm; olm OLM; //Ogre::SceneManager* sm = m_pParentSceneManager; Ogre::SceneManager* sm = Ogre::Root::getSingletonPtr()->getSceneManager("OgreSceneManager"); if(sm) { //Ogre::LightList& list = Cache[object]; const Ogre::LightList& frlist = sm->_getLightsAffectingFrustum(); //int halfRegionSideLength = qApp->settings()->value("Engine/RegionSideLength", 32).toInt() / 2; for(unsigned i=0;i<frlist.size();++i) { Ogre::Light* light = frlist[i]; if(light->getVisible() == false) continue; if(light->getType() == Ogre::Light::LT_DIRECTIONAL) { OLM.insert(olm::value_type(0,light));//distance 0, priority continue; } const Ogre::Vector3& lpos = light->getDerivedPosition(); /*Ogre::Vector3 dif(lpos.x-(m_v3dPos.x + halfRegionSideLength),lpos.y-(m_v3dPos.y+halfRegionSideLength), lpos.z-(m_v3dPos.z+halfRegionSideLength)); float realDistSquared = dif.x*dif.x+dif.y*dif.y+dif.z*dif.z; OLM.insert(olm::value_type(sqrt(realDistSquared) * lpos.y,light)); //plus lpos.y to ,ake higher lights less significant*/ OLM.insert(olm::value_type(lpos.y + 100.0f,light)); //Plus 100 to make sure it's always positive. } } list.clear(); //now we have lightst ordered in OLM, push it in for(olm::iterator it = OLM.begin();it!=OLM.end();++it) list.push_back(it->second); return list; } const Ogre::MaterialPtr& SurfacePatchRenderable::getMaterial(void) const { return m_pMaterial; } const String& SurfacePatchRenderable::getMovableType(void) const { static String movType = "SurfacePatchRenderable"; return movType; } void SurfacePatchRenderable::getRenderOperation(Ogre::RenderOperation& op) { //This doesn't cause a crash when op is null, because in that case this function //won't be called as this renderable won't have been added by _updateRenderQueue(). op = *m_RenderOp; } Real SurfacePatchRenderable::getSquaredViewDepth(const Camera *cam) const { Vector3 vMin, vMax, vMid, vDist; vMin = mBox.getMinimum(); vMax = mBox.getMaximum(); vMid = ((vMin - vMax) * 0.5) + vMin; vDist = cam->getDerivedPosition() - vMid; return vDist.squaredLength(); } const Quaternion &SurfacePatchRenderable::getWorldOrientation(void) const { return Quaternion::IDENTITY; } const Vector3 &SurfacePatchRenderable::getWorldPosition(void) const { return Vector3::ZERO; } void SurfacePatchRenderable::getWorldTransforms( Ogre::Matrix4* xform ) const { *xform = m_matWorldTransform * mParentNode->_getFullTransform(); } void SurfacePatchRenderable::setBoundingBox( const Ogre::AxisAlignedBox& box ) { mBox = box; } void SurfacePatchRenderable::setMaterial( const Ogre::String& matName ) { m_strMatName = matName; m_pMaterial = Ogre::MaterialManager::getSingleton().getByName(m_strMatName); if (m_pMaterial.isNull()) OGRE_EXCEPT( Ogre::Exception::ERR_ITEM_NOT_FOUND, "Could not find material " + m_strMatName, "SurfacePatchRenderable::setMaterial" ); // Won't load twice anyway m_pMaterial->load(); } void SurfacePatchRenderable::setWorldTransform( const Ogre::Matrix4& xform ) { m_matWorldTransform = xform; } void SurfacePatchRenderable::_updateRenderQueue(RenderQueue* queue) { if(m_RenderOp) { //Single material patches get rendered first, so the multi material //patches can be added afterwards using additive blending. if(isSingleMaterial()) { PolyVox::LodRecord lodRecord = m_vecLodRecords[0]; m_RenderOp->indexData->indexStart = lodRecord.beginIndex; m_RenderOp->indexData->indexCount = lodRecord.endIndex - lodRecord.beginIndex; queue->addRenderable( this, mRenderQueueID, RENDER_QUEUE_MAIN); } else { queue->addRenderable( this, mRenderQueueID, RENDER_QUEUE_6); } } } void SurfacePatchRenderable::visitRenderables(Ogre::Renderable::Visitor* visitor, bool debugRenderables) { visitor->visit(this, 0, false); } Real* SurfacePatchRenderable::addVertex(const PositionMaterialNormal& vertex, float alpha, Real* prPos) { *prPos++ = vertex.getPosition().getX(); *prPos++ = vertex.getPosition().getY(); *prPos++ = vertex.getPosition().getZ(); *prPos++ = vertex.getNormal().getX(); *prPos++ = vertex.getNormal().getY(); *prPos++ = vertex.getNormal().getZ(); *prPos++ = vertex.getMaterial(); *prPos++ = alpha; return prPos; } void SurfacePatchRenderable::buildRenderOperationFrom(SurfaceMesh<PositionMaterial>& mesh) { if(mesh.isEmpty()) { m_RenderOp = 0; return; } m_vecLodRecords = mesh.m_vecLodRecords; m_bIsSingleMaterial = true; RenderOperation* renderOperation = new RenderOperation(); //Set up what we can of the vertex data renderOperation->vertexData = new VertexData(); renderOperation->vertexData->vertexStart = 0; renderOperation->vertexData->vertexCount = 0; renderOperation->operationType = RenderOperation::OT_TRIANGLE_LIST; //Set up what we can of the index data renderOperation->indexData = new IndexData(); renderOperation->useIndexes = true; renderOperation->indexData->indexStart = 0; renderOperation->indexData->indexCount = 0; //Set up the vertex declaration VertexDeclaration *decl = renderOperation->vertexData->vertexDeclaration; decl->removeAllElements(); decl->addElement(0, 0, VET_FLOAT4, VES_POSITION);// Material ID gets packed in 'w' coponent const std::vector<PositionMaterial>& vecVertices = mesh.getVertices(); const std::vector<uint32_t>& vecIndices = mesh.getIndices(); renderOperation->vertexData->vertexCount = vecVertices.size(); renderOperation->indexData->indexCount = vecIndices.size(); VertexBufferBinding *bind = renderOperation->vertexData->vertexBufferBinding; HardwareVertexBufferSharedPtr vbuf = HardwareBufferManager::getSingleton().createVertexBuffer( renderOperation->vertexData->vertexDeclaration->getVertexSize(0), renderOperation->vertexData->vertexCount, HardwareBuffer::HBU_STATIC_WRITE_ONLY, false); bind->setBinding(0, vbuf); HardwareIndexBufferSharedPtr ibuf = HardwareBufferManager::getSingleton().createIndexBuffer( HardwareIndexBuffer::IT_32BIT, // type of index renderOperation->indexData->indexCount, // number of indexes HardwareBuffer::HBU_STATIC_WRITE_ONLY, // usage false); // no shadow buffer renderOperation->indexData->indexBuffer = ibuf; Real *prPos = static_cast<Real*>(vbuf->lock(HardwareBuffer::HBL_DISCARD)); memcpy(prPos, &vecVertices[0], sizeof(PositionMaterial) * vecVertices.size()); unsigned long* pIdx = static_cast<unsigned long*>(ibuf->lock(HardwareBuffer::HBL_DISCARD)); memcpy(pIdx, &vecIndices[0], sizeof(uint32_t) * vecIndices.size()); ibuf->unlock(); vbuf->unlock(); m_RenderOp = renderOperation; } void SurfacePatchRenderable::buildRenderOperationFrom(SurfaceMesh<PositionMaterialNormal>& mesh, bool bSingleMaterial) { if(mesh.isEmpty()) { m_RenderOp = 0; return; } if((!bSingleMaterial) && (mesh.getNoOfNonUniformTrianges() == 0)) { m_RenderOp = 0; return; } m_vecLodRecords = mesh.m_vecLodRecords; m_bIsSingleMaterial = bSingleMaterial; RenderOperation* renderOperation = new RenderOperation(); //Set up what we can of the vertex data renderOperation->vertexData = new VertexData(); renderOperation->vertexData->vertexStart = 0; renderOperation->vertexData->vertexCount = 0; renderOperation->operationType = RenderOperation::OT_TRIANGLE_LIST; //Set up what we can of the index data renderOperation->indexData = new IndexData(); renderOperation->useIndexes = true; renderOperation->indexData->indexStart = 0; renderOperation->indexData->indexCount = 0; //Set up the vertex declaration VertexDeclaration *decl = renderOperation->vertexData->vertexDeclaration; decl->removeAllElements(); decl->addElement(0, 0, VET_FLOAT3, VES_POSITION); decl->addElement(0, 3 * sizeof(float), VET_FLOAT3, VES_NORMAL); decl->addElement(0, 6 * sizeof(float), VET_FLOAT2, VES_TEXTURE_COORDINATES); const std::vector<PositionMaterialNormal>& vecVertices = mesh.getVertices(); const std::vector<uint32_t>& vecIndices = mesh.getIndices(); //The '3 * 3' in the following expressions comes from the fact that when we encounter a non uniform //triangle we make it degenerate and add three new ones. That is an increase of nine vertices. if(bSingleMaterial) { renderOperation->vertexData->vertexCount = (vecVertices.size()) + (mesh.getNoOfNonUniformTrianges() * 3); renderOperation->indexData->indexCount = vecIndices.size(); } else { renderOperation->vertexData->vertexCount = (mesh.getNoOfNonUniformTrianges() * 3 * 3); renderOperation->indexData->indexCount = (mesh.getNoOfNonUniformTrianges() * 3 * 3); } VertexBufferBinding *bind = renderOperation->vertexData->vertexBufferBinding; HardwareVertexBufferSharedPtr vbuf = HardwareBufferManager::getSingleton().createVertexBuffer( renderOperation->vertexData->vertexDeclaration->getVertexSize(0), renderOperation->vertexData->vertexCount, HardwareBuffer::HBU_STATIC_WRITE_ONLY, false); bind->setBinding(0, vbuf); HardwareIndexBufferSharedPtr ibuf = HardwareBufferManager::getSingleton().createIndexBuffer( HardwareIndexBuffer::IT_32BIT, // type of index renderOperation->indexData->indexCount, // number of indexes HardwareBuffer::HBU_STATIC_WRITE_ONLY, // usage false); // no shadow buffer renderOperation->indexData->indexBuffer = ibuf; // Drawing stuff Vector3 vaabMin(std::numeric_limits<Real>::max(),std::numeric_limits<Real>::max(),std::numeric_limits<Real>::max()); Vector3 vaabMax(0.0,0.0,0.0); Real *prPos = static_cast<Real*>(vbuf->lock(HardwareBuffer::HBL_DISCARD)); if(bSingleMaterial) { for(std::vector<PositionMaterialNormal>::const_iterator vertexIter = vecVertices.begin(); vertexIter != vecVertices.end(); ++vertexIter) { prPos = addVertex(*vertexIter, 1.0f, prPos); } } if(bSingleMaterial) { unsigned long* pIdx = static_cast<unsigned long*>(ibuf->lock(HardwareBuffer::HBL_DISCARD)); unsigned long newVertexIndex = vecVertices.size(); for(int i = 0; i < vecIndices.size() - 2; i += 3) { if((vecVertices[vecIndices[i]].getMaterial() == vecVertices[vecIndices[i+1]].getMaterial()) && (vecVertices[vecIndices[i]].getMaterial() == vecVertices[vecIndices[i+2]].getMaterial())) { *pIdx = vecIndices[i]; pIdx++; *pIdx = vecIndices[i+1]; pIdx++; *pIdx = vecIndices[i+2]; pIdx++; } else { //Make the non uniform triangle degenerate /**pIdx = 0; pIdx++; *pIdx = 0; pIdx++; *pIdx = 0; pIdx++;*/ //Construct new vertices PositionMaterialNormal vert0 = vecVertices[vecIndices[i+0]]; PositionMaterialNormal vert1 = vecVertices[vecIndices[i+1]]; PositionMaterialNormal vert2 = vecVertices[vecIndices[i+2]]; /*float mat0 = vert0.getMaterial(); float mat1 = vert1.getMaterial(); float mat2 = vert2.getMaterial();*/ vert0.setMaterial(0); vert1.setMaterial(0); vert2.setMaterial(0); /*prPos = addVertex(vert0, 1.0, prPos); prPos = addVertex(vert1, 0.0, prPos); prPos = addVertex(vert2, 0.0, prPos);*/ prPos = addVertex(vert0, 1.0, prPos); prPos = addVertex(vert1, 1.0, prPos); prPos = addVertex(vert2, 1.0, prPos); *pIdx = newVertexIndex; pIdx++; newVertexIndex++; *pIdx = newVertexIndex; pIdx++; newVertexIndex++; *pIdx = newVertexIndex; pIdx++; newVertexIndex++; //Construct new vertices /*vert0.setMaterial(mat1); vert1.setMaterial(mat1); vert2.setMaterial(mat1); prPos = addVertex(vert0, 0.0, prPos); prPos = addVertex(vert1, 1.0, prPos); prPos = addVertex(vert2, 0.0, prPos); *pIdx = newVertexIndex; pIdx++; newVertexIndex++; *pIdx = newVertexIndex; pIdx++; newVertexIndex++; *pIdx = newVertexIndex; pIdx++; newVertexIndex++; //Construct new vertices vert0.setMaterial(mat2); vert1.setMaterial(mat2); vert2.setMaterial(mat2); prPos = addVertex(vert0, 0.0, prPos); prPos = addVertex(vert1, 0.0, prPos); prPos = addVertex(vert2, 1.0, prPos); *pIdx = newVertexIndex; pIdx++; newVertexIndex++; *pIdx = newVertexIndex; pIdx++; newVertexIndex++; *pIdx = newVertexIndex; pIdx++; newVertexIndex++;*/ } } } else { unsigned long* pIdx = static_cast<unsigned long*>(ibuf->lock(HardwareBuffer::HBL_DISCARD)); unsigned long newVertexIndex = 0; //vecVertices.size(); for(int i = 0; i < vecIndices.size() - 2; i += 3) { if((vecVertices[vecIndices[i]].getMaterial() == vecVertices[vecIndices[i+1]].getMaterial()) && (vecVertices[vecIndices[i]].getMaterial() == vecVertices[vecIndices[i+2]].getMaterial())) { /**pIdx = vecIndices[i]; pIdx++; *pIdx = vecIndices[i+1]; pIdx++; *pIdx = vecIndices[i+2]; pIdx++;*/ } else { //Make the non uniform triangle degenerate /**pIdx = 0; pIdx++; *pIdx = 0; pIdx++; *pIdx = 0; pIdx++;*/ //Construct new vertices PositionMaterialNormal vert0 = vecVertices[vecIndices[i+0]]; PositionMaterialNormal vert1 = vecVertices[vecIndices[i+1]]; PositionMaterialNormal vert2 = vecVertices[vecIndices[i+2]]; float mat0 = vert0.getMaterial(); float mat1 = vert1.getMaterial(); float mat2 = vert2.getMaterial(); vert0.setMaterial(mat0); vert1.setMaterial(mat0); vert2.setMaterial(mat0); //I broke this if statement when I removed 'm_mapUsedMaterials' from PolyVox, not realising it was used by Thermite. //I'm not going to fix it as I'm not using this smooth surface functionality in my current project, and Thermite is being decommisioned anyway. //if(mesh.m_mapUsedMaterials.find(mat0) != mesh.m_mapUsedMaterials.end()) //{ // prPos = addVertex(vert0, 1.0, prPos); //} //else //{ prPos = addVertex(vert0, 0.0, prPos); //} prPos = addVertex(vert1, 0.0, prPos); prPos = addVertex(vert2, 0.0, prPos); *pIdx = newVertexIndex; pIdx++; newVertexIndex++; *pIdx = newVertexIndex; pIdx++; newVertexIndex++; *pIdx = newVertexIndex; pIdx++; newVertexIndex++; //Construct new vertices vert0.setMaterial(mat1); vert1.setMaterial(mat1); vert2.setMaterial(mat1); prPos = addVertex(vert0, 0.0, prPos); //I broke this if statement when I removed 'm_mapUsedMaterials' from PolyVox, not realising it was used by Thermite. //I'm not going to fix it as I'm not using this smooth surface functionality in my current project, and Thermite is being decommisioned anyway. //if(mesh.m_mapUsedMaterials.find(mat1) != mesh.m_mapUsedMaterials.end()) //{ // prPos = addVertex(vert1, 1.0, prPos); //} //else //{ prPos = addVertex(vert1, 0.0, prPos); //} prPos = addVertex(vert2, 0.0, prPos); *pIdx = newVertexIndex; pIdx++; newVertexIndex++; *pIdx = newVertexIndex; pIdx++; newVertexIndex++; *pIdx = newVertexIndex; pIdx++; newVertexIndex++; //Construct new vertices vert0.setMaterial(mat2); vert1.setMaterial(mat2); vert2.setMaterial(mat2); prPos = addVertex(vert0, 0.0, prPos); prPos = addVertex(vert1, 0.0, prPos); //I broke this if statement when I removed 'm_mapUsedMaterials' from PolyVox, not realising it was used by Thermite. //I'm not going to fix it as I'm not using this smooth surface functionality in my current project, and Thermite is being decommisioned anyway. //if(mesh.m_mapUsedMaterials.find(mat2) != mesh.m_mapUsedMaterials.end()) //{ // prPos = addVertex(vert2, 1.0, prPos); //} //else //{ prPos = addVertex(vert2, 0.0, prPos); //} *pIdx = newVertexIndex; pIdx++; newVertexIndex++; *pIdx = newVertexIndex; pIdx++; newVertexIndex++; *pIdx = newVertexIndex; pIdx++; newVertexIndex++; } } } ibuf->unlock(); vbuf->unlock(); //This function is extreamly slow. //renderOperation->indexData->optimiseVertexCacheTriList(); m_RenderOp = renderOperation; } bool SurfacePatchRenderable::isSingleMaterial(void) { return m_bIsSingleMaterial; } //----------------------------------------------------------------------- String SurfacePatchRenderableFactory::FACTORY_TYPE_NAME = "SurfacePatchRenderable"; //----------------------------------------------------------------------- const String& SurfacePatchRenderableFactory::getType(void) const { return FACTORY_TYPE_NAME; } //----------------------------------------------------------------------- MovableObject* SurfacePatchRenderableFactory::createInstanceImpl(const String& name, const NameValuePairList* params) { return new SurfacePatchRenderable(name); } //----------------------------------------------------------------------- void SurfacePatchRenderableFactory::destroyInstance( MovableObject* obj) { delete obj; } }
[ "matt@milliams.com" ]
matt@milliams.com
5c784eac73250e60745fe03fc81d6da07a5d9a9e
9118cd1d941969cbf0a691b1de858efad1d2c5c4
/Projects/User/logic/menu/menu_admin.cpp
7b68a0834015f778fd8fd475e6d71e28f8e47013
[]
no_license
Merafour/smartLock
68d92521b05716cdf86ee48feca50b76da419e19
1a15512e7b20c2bfc23f99e54afe6e3875af7b0d
refs/heads/master
2020-03-27T08:31:59.380187
2018-08-27T07:53:59
2018-08-27T07:53:59
146,264,766
3
3
null
null
null
null
GB18030
C++
false
false
9,209
cpp
/************************ (C) COPYLEFT 2018 Merafour ************************* * File Name : menu.cpp * Author : Merafour * Last Modified Date : 04/17/2018 * Description : This file provides the menu library. ******************************************************************************/ #include "menu_level.h" //#include "delay.h" //#include "user.h" //#include "main.h" //#include "RTC.h" #include "data.h" #include <string.h> //extern ssd1306syp display; void func_browse(void) { data_user_t _user; menu.browse(&_user); } void func_time(void) { menu.func_time(); } void MENU_LEVEL::func_time(void) { // RTC_TimeTypeDef Time; // RTC_DateTypeDef Date; uint8_t key=0; //uint8_t key_temp; uint8_t buf[14]; // Y:4, M:2, D:2, H:2, M:2, S:2 uint8_t tmp[14]; // Y:4, M:2, D:2, H:2, M:2, S:2 uint16_t year=0, month=0, day=0; uint16_t hour=0, minute=0, second=0; //uint16_t num=0; uint32_t ms; uint8_t index=0; uint8_t i=0; sys_data_t _sys; _data.get_sys(&_sys); waitting(_sys.back); init: get_time(year, month, day, hour, minute, second); #if 0 RTC_GetTime(RTC_Format_BIN, &Time); RTC_GetDate(RTC_Format_BIN, &Date); year = Date.RTC_Year;//+2000; // tmp[0] = year/1000; // data = year%1000; // tmp[1] = year/100; // data = year%100; tmp[0] = 2; tmp[1] = 0; tmp[2] = year/10; tmp[3] = year%10; tmp[4] = Date.RTC_Month/10; tmp[5] = Date.RTC_Month%10; tmp[6] = Date.RTC_Date/10; tmp[7] = Date.RTC_Date%10; tmp[8] = Time.RTC_Hours/10; tmp[9] = Time.RTC_Hours%10; tmp[10] = Time.RTC_Minutes/10; tmp[11] = Time.RTC_Minutes%10; tmp[12] = Time.RTC_Seconds/10; tmp[13] = Time.RTC_Seconds%10; #endif tmp[0] = 2; tmp[1] = 0; tmp[2] = year/10; tmp[3] = year%10; tmp[4] = month/10; tmp[5] = month%10; tmp[6] = day/10; tmp[7] = day%10; tmp[8] = hour/10; tmp[9] = hour%10; tmp[10] = minute/10; tmp[11] = minute%10; tmp[12] = second/10; tmp[13] = second%10; index=2; while(waitting(0)>0) { ms = tick(); ms = ms/500; // ms/512; for(i=0; i<14; i++) { buf[i] = tmp[i]+'0'; } if(ms&0x1) buf[index] = ' '; _display.clear(0); #if 1 _display.setCursor(0,0); _display.printf("时间同步"); _display.setCursor(0,16); _display.printf("%c%c%c%c.%c%c.%c%c", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]); _display.setCursor(0,32); _display.printf("%c%c:%c%c:%c%c %c", buf[8], buf[9], buf[10], buf[11], buf[12], buf[13], (14==index)?'#':' '); #else _display.format(0, 0, 2, 0, "时间同步"); _display.format(0, 16, 2, 0, "%c%c%c%c.%c%c.%c%c", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]); _display.format(0, 32, 2, 0, "%c%c:%c%c:%c%c %c", buf[8], buf[9], buf[10], buf[11], buf[12], buf[13], (14==index)?'#':' '); #endif // setCursor(0,48); // printf("%d:%d:%d", sys_data.hour, sys_data.minute, sys_data.second); _display.update(); key=_input.Infr_Scan(); if(key) { waitting(_sys.back); //key = Infr_deco(key_temp); if('*'==key) // back { if(index>2) index--; } else if('#'==key) // OK { if(index<14) { index++; continue; } year = 0; // for(i=0; i<4; i++) // { // year = year*10 + tmp[i]; // } #if 0 sys_data.year = data; sys_data.month = tmp[4]*10+tmp[5]; sys_data.day = tmp[6]*10+tmp[7]; sys_data.hour = tmp[8]*10+tmp[9]; sys_data.minute = tmp[10]*10+tmp[11]; sys_data.second = tmp[12]*10+tmp[13]; #else // check year = tmp[2]*10+tmp[3]; if(year<18) { menu.show_title(0, 32, "Year ERROR!"); index=0; goto init; } month = tmp[4]*10+tmp[5]; if(month>12) { menu.show_title(0, 32, "Month ERROR!"); index=4; goto init; } day = tmp[6]*10+tmp[7]; if(day>31) { menu.show_title(0, 32, "Day ERROR!"); index=6; goto init; } hour = tmp[8]*10+tmp[9]; if(hour>23) { menu.show_title(0, 32, "Hour ERROR!"); index=8; goto init; } minute = tmp[10]*10+tmp[11]; if(minute>59) { menu.show_title(0, 32, "Minute ERROR!"); index=10; goto init; } second = tmp[12]*10+tmp[13]; if(second>59) { menu.show_title(0, 32, "Second ERROR!"); index=12; goto init; } #endif // save #if 0 //SetTime(0); Date.RTC_Year = year; Date.RTC_Month = month; Date.RTC_Date = day; Time.RTC_Hours = hour; Time.RTC_Minutes = minute; Time.RTC_Seconds = second; RTC_SetTime(RTC_Format_BIN, &Time); RTC_SetDate(RTC_Format_BIN, &Date); #endif set_time(year, month, day, hour, minute, second); break; } else if(('0'<=key) && ('9'>=key)) // passwd { //if(pass_index<sizeof(passwd)) if(index<14) { tmp[index]=key-'0'; index++; } } } } } void func_add(void) { menu.func_add(); } void MENU_LEVEL::func_add(void) { data_user_t _user; uint32_t passwd=0; uint32_t passwd_tmp=0; uint16_t count=0; sys_data_t _sys; _data.get_sys(&_sys); waitting(_sys.back); while(waitting(0)>0) { #if 0 _data.get_user_empty(&_user, lock_dhcp4_max); if((user_number_min>_user.uid) || (user_number_max<=_user.uid)) { menu.show_title(0, 32, "存储已满!"); break; } #else browse_user(&_user); if((user_number_min>_user.uid) || (user_number_max<=_user.uid)) { break; } #endif _voice.play_info(DATA::get_volume(), 1, "请输入密码"); passwd = menu.get_user_input(0, 6, 1, "请输入密码", _user.uid-user_number_min); if(0==waitting(0)) break; _voice.play_info(DATA::get_volume(), 1, "请再次输入密码"); passwd_tmp = menu.get_user_input(0, 6, 1, "再次输入密码", _user.uid-user_number_min); if(0==waitting(0)) break; if(passwd==passwd_tmp) { _data.save_data(_user.uid, passwd, start_date(), 10000, 0, 0); // OK //menu.show_title(0, 32, "添加成功!"); _display.vformat(false, 0, 0, "操作完成", 2000, "添加成功!"); //printf("%d", uid); break; } else { //menu.show_title(0, 32, "密码不一致!"); _display.vformat(false, 0, 0, "操作失败", 2000, "密码不一致!"); count++; //if(count<3) waitting_time(back); //else break; if(count>=3) break; } } } void func_add_admin(void) { menu.func_add_admin(); } void MENU_LEVEL::func_add_admin(void) { data_user_t _user; uint32_t passwd=0; uint32_t passwd_tmp=0; uint16_t count=0; sys_data_t _sys; _data.get_sys(&_sys); waitting(_sys.back); while(waitting(0)>0) { #if 0 _data.get_user_empty(&_user, lock_admin_max); //menu.get_user_input(6, 1, "管理员", _user.uid); //if((user_number_min<=_user.uid) && (user_number_max>_user.uid)) if((user_number_min>_user.uid) || ((user_number_min+lock_admin_max)<=_user.uid)) { menu.show_title(0, 32, "存储已满!"); break; } #else browse_admin(&_user); if((user_number_min>_user.uid) || (user_number_max<=_user.uid)) { break; } #endif _voice.play_info(DATA::get_volume(), 1, "请输入密码"); passwd = menu.get_user_input(0, 6, 0, "请输入密码", _user.uid-user_number_min); if(0==waitting(0)) break; _voice.play_info(DATA::get_volume(), 1, "请再次输入密码"); passwd_tmp = menu.get_user_input(0, 6, 0, "再次输入密码", _user.uid-user_number_min); if(0==waitting(0)) break; if(passwd==passwd_tmp) { _data.save_data(_user.uid, passwd, start_date(), 10000, 0, 0); // OK //menu.show_title(0, 32, "添加成功!"); _display.vformat(false, 0, 0, "操作完成", 2000, "添加成功!"); //printf("%d", uid); break; } else { //menu.show_title(0, 32, "密码不一致!"); _display.vformat(false, 0, 0, "操作失败", 2000, "密码不一致!"); count++; //if(count<3) waitting_time(back); //else break; if(count>=3) break; } } } void func_del(void) { menu.func_del(); } void MENU_LEVEL::func_del(void) { data_user_t _user; menu.browse(&_user); if((user_number_min>_user.uid) || (user_number_max<=_user.uid)) { return ; } if(MENU::check_uid==_user.uid) { //menu.show_title(0, 32, "操作拒绝!"); _display.vformat(false, 0, 0, "操作拒绝", 2000, "操作拒绝!"); } else { // del if(0==_data.user_del(_user.uid)) { //menu.show_title(0, 32, "已删除!"); _display.vformat(false, 0, 0, "操作完成", 2000, "已删除!"); } else { //menu.show_title(0, 32, "删除失败!"); _display.vformat(false, 0, 0, "操作失败", 2000, "删除失败!"); } } } void func_net(void) { menu.show_title(0, 32, "网络"); } extern void func_info(void); extern void func_set(void); menu_t Menu[] = { //{func_admin, CN_16x16_admin[0], sizeof(CN_16x16_admin)/32}, {func_add, "添加用户"}, {func_add_admin, "添加管理员"}, {func_del, "删除用户"}, {func_info, "信息"}, {func_browse, "浏览"}, {func_net, "网络"}, {func_time, "时间同步"}, {func_set, "系统设置"}, //{func_about, CN_16x16_about[0], sizeof(CN_16x16_about)/32} }; const unsigned int Menu_size = sizeof(Menu)/sizeof(Menu[0]); void MENU_LEVEL::menu_admin_option(void) { common(Menu, Menu_size, 4); } //void MENU_ADMIN::option(void) //{ // common(Menu, Menu_size, 4); //}
[ "merafour@163.com" ]
merafour@163.com
39b0ef48048de1deb3b7e395c2aabb07fd72e2df
bf007dec921b84d205bffd2527e376bb60424f4c
/Codeforces_Submissions/1003B.cpp
58de853d1beef90a78335c7dcd4c5cd25f5d01df
[]
no_license
Suvrojyoti/APS-2020
257e4a94f52f5fe8adcac1ba4038cc66e81d9d26
d4de0ef098e7ce9bb40036ef55616fa1f159f7a5
refs/heads/master
2020-12-21T19:27:59.955338
2020-04-22T13:27:49
2020-04-22T13:27:49
236,534,218
0
0
null
null
null
null
UTF-8
C++
false
false
717
cpp
#include <bits/stdc++.h> using namespace std; int main() { long int f=0,b,s,o=0,z=0,i,x; char b1,s1; cin>>z>>o>>x; if(o>z) { b=o; s=z; b1='1'; s1='0'; } else { b=z; s=o; b1='0'; s1='1'; } for(i=x;i>1;i--) { if(f%2==0) { cout<<b1; b--; } else { cout<<s1; s--; } f++; } if(f%2==1) { while(s--) cout<<s1; while(b--) cout<<b1; } else { while(b--) cout<<b1; while(s--) cout<<s1; } return 0; }
[ "suvrojyoti.mandal@theatom.app" ]
suvrojyoti.mandal@theatom.app
4942da7471a122ca5417796839366f8345bc5239
3d1f60e71cfa3a869cd1f1a173032d435f65c420
/Source/BatteryCollector/Pickup.cpp
7d55deb6672916fdee3c360ea34824ac74a7adae
[]
no_license
LadyCyan/TorchedThirdPerson
58c90bdbeb571e488391e57266bd87a12fa5bdfe
07d9abd913f7a965c373b1cc7859d0ad77164039
refs/heads/main
2023-01-24T16:19:04.894448
2020-12-15T00:03:44
2020-12-15T00:03:44
318,984,070
0
0
null
null
null
null
UTF-8
C++
false
false
1,095
cpp
// Fill out your copyright notice in the Description page of Project Settings. #include "Pickup.h" #include "Components/StaticMeshComponent.h" #include "Engine/World.h" // Sets default values APickup::APickup() { // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it. PrimaryActorTick.bCanEverTick = false; //All pickups start active bIsActive = false; //Create static mesh component PickupMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("PickupMesh")); RootComponent = PickupMesh; } // Called when the game starts or when spawned void APickup::BeginPlay() { Super::BeginPlay(); } // Called every frame void APickup::Tick(float DeltaTime) { Super::Tick(DeltaTime); } //returns active state bool APickup::IsActive() { return bIsActive; } //changes active state void APickup::SetActive(bool NewPickupState) { bIsActive = NewPickupState; } void APickup::WasTriggered_Implementation() { FString PickupDebugString = GetName(); UE_LOG(LogClass, Log, TEXT("You have collected %s"), *PickupDebugString); }
[ "taylorrenner@u.boisestate.edu" ]
taylorrenner@u.boisestate.edu
b6173167431b342de431f5d29017b0c91bdfd377
6f154afa302efeac5256e82c973616c0a428d3d5
/src/main/unit_tests/UnitTest/TestNYSECME.h
35b2ca5805437b1322a0dcf7987c381e430e6aff
[]
no_license
clhongooo/trading_engine
2ff58cc5d6cf7bef0a619549a4b4d63f923483dd
d4d74ad7ba21caa01f49054d63cdd8b2317d1702
refs/heads/master
2020-06-03T21:38:44.509346
2019-07-05T10:16:24
2019-07-05T10:16:24
191,741,370
0
1
null
2019-06-13T10:23:32
2019-06-13T10:23:32
null
UTF-8
C++
false
false
508
h
#ifndef UNITTEST_TESTNYSECME_H_ #define UNITTEST_TESTNYSECME_H_ #include "UTest.h" #include <boost/shared_ptr.hpp> #include <boost/thread.hpp> #include "NYSE.h" #include "CME.h" #include <cppunit/ui/text/TestRunner.h> #include <cppunit/extensions/HelperMacros.h> class TestNYSECME : public CppUnit::TestFixture { public: TestNYSECME(); virtual ~TestNYSECME(); void RunTest(); void setUp(); void tearDown(); static CppUnit::Test *suite(); }; #endif /* UNITTEST_TESTNYSECME_H_ */
[ "sunny.yan@cashalgo.com" ]
sunny.yan@cashalgo.com
6b78868d9b7fe2e0d258b6201a95f777bc0ef4da
d99ab6e8586f76c6e6bdec1b2fba73e7d892f5e8
/ACM/APAC B/3.cpp
9d951b5a94a54d16428f7e8b514dbaeefd25e316
[]
no_license
jindalshivam09/cppcodes
661d368c77793a0c8170397711c1eec9eeff1e27
c2913c4d3e144de7a0a60749b675e2f661d5b07b
refs/heads/master
2021-05-16T02:39:47.452998
2020-07-26T18:45:42
2020-07-26T18:45:42
23,185,118
1
0
null
null
null
null
UTF-8
C++
false
false
1,350
cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef list<int> li; typedef vector<int> vi; typedef vector<double> vd; typedef vector<long long> vll; typedef vector<bool> vb; typedef pair<int,int> pii; typedef vector<pair<int,int> > vpii; typedef pair<double,double> pdd; typedef vector<pair<double,double> > vpdd; #define rep(i,n) for(int i=0;i<n;i++) #define repi(i,k,n) for(int i=k;i<n;i++) #define mp make_pair #define pb push_back #define all(a) a.begin(),a.end() #define imax numeric_limits<int>::max() #define imin numeric_limits<int>::min() #define dmax numeric_limits<double>::max() #define dmin numeric_limits<double>::min() int cnt = 0,n,k; string str ; void brute(int l, int r, string s) { // cout << l << " " <<r << endl; if(l==0&&r==0) { cnt ++; if(cnt == k) { // cout << s << endl; // return s; str = s ; } return ; } if(r==0 || l<0) return ; if(l) brute(l-1,r,s+"(") ; if(l<r) brute(l,r-1,s+")") ; } int main() { ifstream cin("input.txt") ; ofstream cout("output.txt") ; int t; cin >> t ; for(int test=1;test<=t;test++) { cin >> n >> k ; string s = ""; cout << "Case #" << test << ": "; brute(n,n,s); if(str.size()) cout << str ; else cout << "Doesn't Exist!"; cout << endl; str.clear() ; } }
[ "jindalshivam09@gmail.com" ]
jindalshivam09@gmail.com
b9a9107ddfd30d2cab07c96355d008afe2c28441
ee5faac27732fcbca05b7a37d22ca610f26e72b9
/FINISHED/SEQUENCER/Firmware/modular_secuencer_firmware/Adafruit_BusIO_Register.h
5ef07a39c5cfbd04cb1dded5ce0bcb67510c4eaa
[]
no_license
ernesto-g/modular-synth
bb35d8a507ad0e98389436c6cdb6854315c346cb
dc859de7d16e40874dcc1ea2861baaf0e7f204fe
refs/heads/master
2023-05-08T14:16:46.214944
2021-05-30T16:45:33
2021-05-30T16:45:33
273,597,114
3
0
null
null
null
null
UTF-8
C++
false
false
2,321
h
#include "Adafruit_I2CDevice.h" #include "Adafruit_SPIDevice.h" #include <Arduino.h> #ifndef Adafruit_BusIO_Register_h #define Adafruit_BusIO_Register_h typedef enum _Adafruit_BusIO_SPIRegType { ADDRBIT8_HIGH_TOREAD = 0, AD8_HIGH_TOREAD_AD7_HIGH_TOINC = 1, ADDRBIT8_HIGH_TOWRITE = 2, } Adafruit_BusIO_SPIRegType; /*! * @brief The class which defines a device register (a location to read/write * data from) */ class Adafruit_BusIO_Register { public: Adafruit_BusIO_Register(Adafruit_I2CDevice *i2cdevice, uint16_t reg_addr, uint8_t width = 1, uint8_t byteorder = LSBFIRST, uint8_t address_width = 1); Adafruit_BusIO_Register(Adafruit_SPIDevice *spidevice, uint16_t reg_addr, Adafruit_BusIO_SPIRegType type, uint8_t width = 1, uint8_t byteorder = LSBFIRST, uint8_t address_width = 1); Adafruit_BusIO_Register(Adafruit_I2CDevice *i2cdevice, Adafruit_SPIDevice *spidevice, Adafruit_BusIO_SPIRegType type, uint16_t reg_addr, uint8_t width = 1, uint8_t byteorder = LSBFIRST, uint8_t address_width = 1); bool read(uint8_t *buffer, uint8_t len); bool read(uint8_t *value); bool read(uint16_t *value); uint32_t read(void); bool write(uint8_t *buffer, uint8_t len); bool write(uint32_t value, uint8_t numbytes = 0); uint8_t width(void); void print(Stream *s = &Serial); void println(Stream *s = &Serial); private: Adafruit_I2CDevice *_i2cdevice; Adafruit_SPIDevice *_spidevice; Adafruit_BusIO_SPIRegType _spiregtype; uint16_t _address; uint8_t _width, _addrwidth, _byteorder; uint8_t _buffer[4]; // we wont support anything larger than uint32 for // non-buffered read }; /*! * @brief The class which defines a slice of bits from within a device register * (a location to read/write data from) */ class Adafruit_BusIO_RegisterBits { public: Adafruit_BusIO_RegisterBits(Adafruit_BusIO_Register *reg, uint8_t bits, uint8_t shift); bool write(uint32_t value); uint32_t read(void); private: Adafruit_BusIO_Register *_register; uint8_t _bits, _shift; }; #endif // BusIO_Register_h
[ "ernestogigliotti@gmail.com" ]
ernestogigliotti@gmail.com
a88ed72164c715c6875f5bae545cd94fba5f74e4
a73521863337d8a59c17497e352cb394efcc40bc
/tubesdataloader.h
e501235f8b0e5a5f19329a5899ffac48bca7c469
[]
no_license
SevenLines/Tube
a3451168dbcc861eb60296191efebd4ada62d725
6361e24ac8a5fe719aeb494c296c32435198269c
refs/heads/master
2020-05-17T15:48:17.055353
2015-11-21T19:35:11
2015-11-21T19:35:11
16,460,522
0
0
null
null
null
null
UTF-8
C++
false
false
549
h
#ifndef TUBESDATALOADER_H #define TUBESDATALOADER_H #include <QThread> #include <tubesdata.h> class TubesDataLoader : public QThread { Q_OBJECT QString mDirWithImages; public: explicit TubesDataLoader(QObject *parent = 0); TubesData tubesData; QString dirWithImages(); signals: public slots: void setDirWithImages(QString dirWithImages); void loadTubesInfo(); // the same as start // QThread interface protected: void run(); }; #endif // TUBESDATALOADER_H
[ "mmailm@mail.ru" ]
mmailm@mail.ru
fc7e38ed1f68bddc4a26e086cf5d14924e4a8a85
21553f6afd6b81ae8403549467230cdc378f32c9
/arm/cortex/Spansion/MB9AF11xN/include/arch/reg/exti.hpp
df4d9dca7d9bcc1b7a02444c9610d5337f321ad8
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
digint/openmptl-reg-arm-cortex
3246b68dcb60d4f7c95a46423563cab68cb02b5e
88e105766edc9299348ccc8d2ff7a9c34cddacd3
refs/heads/master
2021-07-18T19:56:42.569685
2017-10-26T11:11:35
2017-10-26T11:11:35
108,407,162
3
1
null
null
null
null
UTF-8
C++
false
false
8,019
hpp
/* * OpenMPTL - C++ Microprocessor Template Library * * This program is a derivative representation of a CMSIS System View * Description (SVD) file, and is subject to the corresponding license * (see "License.txt" in the parent directory). * * 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. */ //////////////////////////////////////////////////////////////////////// // // Import from CMSIS-SVD: "Spansion/MB9AF11xN.svd" // // name: MB9AF11xN // version: 1.7 // description: MB9AF11xN // -------------------------------------------------------------------- // // C++ Header file, containing architecture specific register // declarations for use in OpenMPTL. It has been converted directly // from a CMSIS-SVD file. // // https://digint.ch/openmptl // https://github.com/posborne/cmsis-svd // #ifndef ARCH_REG_EXTI_HPP_INCLUDED #define ARCH_REG_EXTI_HPP_INCLUDED #warning "using untested register declarations" #include <register.hpp> namespace mptl { /** * External Interrupt and NMI Control */ struct EXTI { static constexpr reg_addr_t base_addr = 0x40030000; /** * Enable Interrupt Request Register */ struct ENIR : public reg< uint16_t, base_addr + 0x0, rw, 0x0000 > { using type = reg< uint16_t, base_addr + 0x0, rw, 0x0000 >; using EN15 = regbits< type, 15, 1 >; /**< Bit15 of ENIR */ using EN14 = regbits< type, 14, 1 >; /**< Bit14 of ENIR */ using EN13 = regbits< type, 13, 1 >; /**< Bit13 of ENIR */ using EN12 = regbits< type, 12, 1 >; /**< Bit12 of ENIR */ using EN11 = regbits< type, 11, 1 >; /**< Bit11 of ENIR */ using EN10 = regbits< type, 10, 1 >; /**< Bit10 of ENIR */ using EN9 = regbits< type, 9, 1 >; /**< Bit9 of ENIR */ using EN8 = regbits< type, 8, 1 >; /**< Bit8 of ENIR */ using EN7 = regbits< type, 7, 1 >; /**< Bit7 of ENIR */ using EN6 = regbits< type, 6, 1 >; /**< Bit6 of ENIR */ using EN5 = regbits< type, 5, 1 >; /**< Bit5 of ENIR */ using EN4 = regbits< type, 4, 1 >; /**< Bit4 of ENIR */ using EN3 = regbits< type, 3, 1 >; /**< Bit3 of ENIR */ using EN2 = regbits< type, 2, 1 >; /**< Bit2 of ENIR */ using EN1 = regbits< type, 1, 1 >; /**< Bit1 of ENIR */ using EN0 = regbits< type, 0, 1 >; /**< Bit0 of ENIR */ }; /** * External Interrupt Request Register */ struct EIRR : public reg< uint16_t, base_addr + 0x4, ro, 0x0000 > { using type = reg< uint16_t, base_addr + 0x4, ro, 0x0000 >; using ER15 = regbits< type, 15, 1 >; /**< Bit15 of EIRR */ using ER14 = regbits< type, 14, 1 >; /**< Bit14 of EIRR */ using ER13 = regbits< type, 13, 1 >; /**< Bit13 of EIRR */ using ER12 = regbits< type, 12, 1 >; /**< Bit12 of EIRR */ using ER11 = regbits< type, 11, 1 >; /**< Bit11 of EIRR */ using ER10 = regbits< type, 10, 1 >; /**< Bit10 of EIRR */ using ER9 = regbits< type, 9, 1 >; /**< Bit9 of EIRR */ using ER8 = regbits< type, 8, 1 >; /**< Bit8 of EIRR */ using ER7 = regbits< type, 7, 1 >; /**< Bit7 of EIRR */ using ER6 = regbits< type, 6, 1 >; /**< Bit6 of EIRR */ using ER5 = regbits< type, 5, 1 >; /**< Bit5 of EIRR */ using ER4 = regbits< type, 4, 1 >; /**< Bit4 of EIRR */ using ER3 = regbits< type, 3, 1 >; /**< Bit3 of EIRR */ using ER2 = regbits< type, 2, 1 >; /**< Bit2 of EIRR */ using ER1 = regbits< type, 1, 1 >; /**< Bit1 of EIRR */ using ER0 = regbits< type, 0, 1 >; /**< Bit0 of EIRR */ }; /** * External Interrupt Clear Register */ struct EICL : public reg< uint16_t, base_addr + 0x8, rw, 0xFFFF > { using type = reg< uint16_t, base_addr + 0x8, rw, 0xFFFF >; using ECL15 = regbits< type, 15, 1 >; /**< Bit15 of EICL */ using ECL14 = regbits< type, 14, 1 >; /**< Bit14 of EICL */ using ECL13 = regbits< type, 13, 1 >; /**< Bit13 of EICL */ using ECL12 = regbits< type, 12, 1 >; /**< Bit12 of EICL */ using ECL11 = regbits< type, 11, 1 >; /**< Bit11 of EICL */ using ECL10 = regbits< type, 10, 1 >; /**< Bit10 of EICL */ using ECL9 = regbits< type, 9, 1 >; /**< Bit9 of EICL */ using ECL8 = regbits< type, 8, 1 >; /**< Bit8 of EICL */ using ECL7 = regbits< type, 7, 1 >; /**< Bit7 of EICL */ using ECL6 = regbits< type, 6, 1 >; /**< Bit6 of EICL */ using ECL5 = regbits< type, 5, 1 >; /**< Bit5 of EICL */ using ECL4 = regbits< type, 4, 1 >; /**< Bit4 of EICL */ using ECL3 = regbits< type, 3, 1 >; /**< Bit3 of EICL */ using ECL2 = regbits< type, 2, 1 >; /**< Bit2 of EICL */ using ECL1 = regbits< type, 1, 1 >; /**< Bit1 of EICL */ using ECL0 = regbits< type, 0, 1 >; /**< Bit0 of EICL */ }; /** * External Interrupt Level Register */ struct ELVR : public reg< uint32_t, base_addr + 0xc, rw, 0x00000000 > { using type = reg< uint32_t, base_addr + 0xc, rw, 0x00000000 >; using LB15 = regbits< type, 31, 1 >; /**< Bit31 of ELVR */ using LA15 = regbits< type, 30, 1 >; /**< Bit30 of ELVR */ using LB14 = regbits< type, 29, 1 >; /**< Bit29 of ELVR */ using LA14 = regbits< type, 28, 1 >; /**< Bit28 of ELVR */ using LB13 = regbits< type, 27, 1 >; /**< Bit27 of ELVR */ using LA13 = regbits< type, 26, 1 >; /**< Bit26 of ELVR */ using LB12 = regbits< type, 25, 1 >; /**< Bit25 of ELVR */ using LA12 = regbits< type, 24, 1 >; /**< Bit24 of ELVR */ using LB11 = regbits< type, 23, 1 >; /**< Bit23 of ELVR */ using LA11 = regbits< type, 22, 1 >; /**< Bit22 of ELVR */ using LB10 = regbits< type, 21, 1 >; /**< Bit21 of ELVR */ using LA10 = regbits< type, 20, 1 >; /**< Bit20 of ELVR */ using LB9 = regbits< type, 19, 1 >; /**< Bit19 of ELVR */ using LA9 = regbits< type, 18, 1 >; /**< Bit18 of ELVR */ using LB8 = regbits< type, 17, 1 >; /**< Bit17 of ELVR */ using LA8 = regbits< type, 16, 1 >; /**< Bit16 of ELVR */ using LB7 = regbits< type, 15, 1 >; /**< Bit15 of ELVR */ using LA7 = regbits< type, 14, 1 >; /**< Bit14 of ELVR */ using LB6 = regbits< type, 13, 1 >; /**< Bit13 of ELVR */ using LA6 = regbits< type, 12, 1 >; /**< Bit12 of ELVR */ using LB5 = regbits< type, 11, 1 >; /**< Bit11 of ELVR */ using LA5 = regbits< type, 10, 1 >; /**< Bit10 of ELVR */ using LB4 = regbits< type, 9, 1 >; /**< Bit9 of ELVR */ using LA4 = regbits< type, 8, 1 >; /**< Bit8 of ELVR */ using LB3 = regbits< type, 7, 1 >; /**< Bit7 of ELVR */ using LA3 = regbits< type, 6, 1 >; /**< Bit6 of ELVR */ using LB2 = regbits< type, 5, 1 >; /**< Bit5 of ELVR */ using LA2 = regbits< type, 4, 1 >; /**< Bit4 of ELVR */ using LB1 = regbits< type, 3, 1 >; /**< Bit3 of ELVR */ using LA1 = regbits< type, 2, 1 >; /**< Bit2 of ELVR */ using LB0 = regbits< type, 1, 1 >; /**< Bit1 of ELVR */ using LA0 = regbits< type, 0, 1 >; /**< Bit0 of ELVR */ }; /** * Non Maskable Interrupt Request Register */ struct NMIRR : public reg< uint8_t, base_addr + 0x14, ro, 0x00 > { using type = reg< uint8_t, base_addr + 0x14, ro, 0x00 >; using NR = regbits< type, 0, 1 >; /**< NMI interrupt request detection bit */ }; /** * Non Maskable Interrupt Clear Register */ struct NMICL : public reg< uint8_t, base_addr + 0x18, rw, 0x01 > { using type = reg< uint8_t, base_addr + 0x18, rw, 0x01 >; using NCL = regbits< type, 0, 1 >; /**< NMI interrupt cause clear bit */ }; }; } // namespace mptl #endif // ARCH_REG_EXTI_HPP_INCLUDED
[ "axel@tty0.ch" ]
axel@tty0.ch
cc631df23bc77c1ee9897b66e7e474a457dd22ee
d9ef801a3c3601252a0b947c61c40586e21d58c4
/robot_control/include/robot_control/search.h
3bcb95cf89451a8ac37271a7ac1be49e423012c6
[]
no_license
cagrikilic/cataglyphis3-software
204abc0ffeb47e36b62ff8143b7720185bbc0c77
b9e06cc857456d6b7686c53dcc909bd9277dcb67
refs/heads/master
2021-06-27T08:58:59.800212
2017-04-05T17:21:29
2017-04-05T17:21:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
143
h
#ifndef SEARCH_H #define SEARCH_H #include "action.h" class Search : public Action { public: void init(); int run(); }; #endif // SEARCH_H
[ "mountainman@live.com" ]
mountainman@live.com
c69d17bc4b1209adc6149d957171696730176213
f05ad7795ddf4b4a9675829301541d35ebb985a7
/Framework/Include/Scripting/Packages/Core/Resources/DepthStencilTarget.h
40c80fd000416b47e8ff6ab2e914ab1c3165239c
[]
no_license
blockspacer/CarbonSDKAlpha
4d89904b822691fef2ea457bdacb8fcdb79a860d
a90d30cd970be25e73102eb6ef5f709f7753dce2
refs/heads/master
2021-05-21T09:46:23.810708
2014-07-26T21:16:34
2014-07-26T21:16:34
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,697
h
#pragma once // Required headers #include <Scripting/cgScriptPackage.h> #include <Resources/cgDepthStencilTarget.h> // Parent hierarchy namespace cgScriptPackages { namespace Core { namespace Resources { // Package declaration namespace DepthStencilTarget { // Package descriptor class Package : public cgScriptPackage { BEGIN_SCRIPT_PACKAGE( "Core.Resources.DepthStencilTarget" ) END_SCRIPT_PACKAGE( ) // Type declarations void declare( cgScriptEngine * engine ) { BINDSUCCESS( engine->registerObjectType( "DepthStencilTarget", 0, asOBJ_REF ) ); BINDSUCCESS( engine->registerObjectType( "DepthStencilTargetHandle", sizeof(cgDepthStencilTargetHandle), asOBJ_VALUE | asOBJ_APP_CLASS_CDA ) ); } // Member bindings void bind( cgScriptEngine * engine ) { using namespace cgScriptInterop::Utils; // Register the reference/object handle support for the objects. registerHandleBehaviors<cgDepthStencilTarget>( engine ); // Register base / system behaviors. Core::Resources::Texture::registerTextureMethods<cgDepthStencilTarget>( engine, "DepthStencilTarget" ); // Register the object methods // ToDo // Register resource handle type Core::Resources::Types::registerResourceHandleMethodsEx<cgDepthStencilTargetHandle, cgTextureHandle>( engine, "DepthStencilTargetHandle", "DepthStencilTarget", "TextureHandle" ); } }; // End Class : Package } } } } // End Namespace : cgScriptPackages::Core::Resources::DepthStencilTarget
[ "Adam@73940bfc-ff42-174e-80ad-c9fe183b27ed" ]
Adam@73940bfc-ff42-174e-80ad-c9fe183b27ed
b9506c6e5d074ab315d287b0fd7d998e1d544309
27c1cb57c1608b65639c6194dc945a440df25473
/cg_exercise_02/cglib/lib/glm/glm/gtc/reciprocal.hpp
0ef78179eb7c2f6cc7a6589fc2bfb9dada6f85f7
[ "MIT", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "LicenseRef-scancode-happy-bunny" ]
permissive
brankyy/CG
41c7de721ffdba2aefda48db823521fb0d409710
217960504e0c723b73dab664e6ca0ccf3aeeeec8
refs/heads/master
2020-04-05T00:36:27.888286
2019-01-06T22:02:49
2019-01-06T22:02:49
156,395,913
0
0
null
null
null
null
UTF-8
C++
false
false
3,617
hpp
/// @ref gtc_reciprocal /// @file glm/gtc/reciprocal.hpp /// /// @see core (dependence) /// /// @defgroup gtc_reciprocal GLM_GTC_reciprocal /// @ingroup gtc /// /// Include <glm/gtc/reciprocal.hpp> to use the features of this extension. /// /// Define secant, cosecant and cotangent functions. #pragma once // Dependencies #include "../detail/setup.hpp" #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTC_reciprocal extension included") #endif namespace glm { /// @addtogroup gtc_reciprocal /// @{ /// Secant function. /// hypotenuse / adjacent or 1 / cos(x) /// /// @tparam genType Floating-point scalar or vector types. /// /// @see gtc_reciprocal template<typename genType> GLM_FUNC_DECL genType sec(genType angle); /// Cosecant function. /// hypotenuse / opposite or 1 / sin(x) /// /// @tparam genType Floating-point scalar or vector types. /// /// @see gtc_reciprocal template<typename genType> GLM_FUNC_DECL genType csc(genType angle); /// Cotangent function. /// adjacent / opposite or 1 / tan(x) /// /// @tparam genType Floating-point scalar or vector types. /// /// @see gtc_reciprocal template<typename genType> GLM_FUNC_DECL genType cot(genType angle); /// Inverse secant function. /// /// @return Return an angle expressed in radians. /// @tparam genType Floating-point scalar or vector types. /// /// @see gtc_reciprocal template<typename genType> GLM_FUNC_DECL genType asec(genType x); /// Inverse cosecant function. /// /// @return Return an angle expressed in radians. /// @tparam genType Floating-point scalar or vector types. /// /// @see gtc_reciprocal template<typename genType> GLM_FUNC_DECL genType acsc(genType x); /// Inverse cotangent function. /// /// @return Return an angle expressed in radians. /// @tparam genType Floating-point scalar or vector types. /// /// @see gtc_reciprocal template<typename genType> GLM_FUNC_DECL genType acot(genType x); /// Secant hyperbolic function. /// /// @tparam genType Floating-point scalar or vector types. /// /// @see gtc_reciprocal template<typename genType> GLM_FUNC_DECL genType sech(genType angle); /// Cosecant hyperbolic function. /// /// @tparam genType Floating-point scalar or vector types. /// /// @see gtc_reciprocal template<typename genType> GLM_FUNC_DECL genType csch(genType angle); /// Cotangent hyperbolic function. /// /// @tparam genType Floating-point scalar or vector types. /// /// @see gtc_reciprocal template<typename genType> GLM_FUNC_DECL genType coth(genType angle); /// Inverse secant hyperbolic function. /// /// @return Return an angle expressed in radians. /// @tparam genType Floating-point scalar or vector types. /// /// @see gtc_reciprocal template<typename genType> GLM_FUNC_DECL genType asech(genType x); /// Inverse cosecant hyperbolic function. /// /// @return Return an angle expressed in radians. /// @tparam genType Floating-point scalar or vector types. /// /// @see gtc_reciprocal template<typename genType> GLM_FUNC_DECL genType acsch(genType x); /// Inverse cotangent hyperbolic function. /// /// @return Return an angle expressed in radians. /// @tparam genType Floating-point scalar or vector types. /// /// @see gtc_reciprocal template<typename genType> GLM_FUNC_DECL genType acoth(genType x); /// @} }//namespace glm #include "reciprocal.inl" // CG_REVISION 81651e9d3440cf57bc693b5ac8ad23edb0a3bee0
[ "brankyy@gmail.com" ]
brankyy@gmail.com
4bb7501750b6b66598231f12567f0d3c4cb80c89
6b2a8dd202fdce77c971c412717e305e1caaac51
/solutions_5695413893988352_0/C++/xosmig/Create.cpp
c8cf1f94eb6fff177d7b5e947a60aab9e0ec4095
[]
no_license
alexandraback/datacollection
0bc67a9ace00abbc843f4912562f3a064992e0e9
076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf
refs/heads/master
2021-01-24T18:27:24.417992
2017-05-23T09:23:38
2017-05-23T09:23:38
84,313,442
2
4
null
null
null
null
UTF-8
C++
false
false
3,681
cpp
#include <bits/stdc++.h> using namespace std; typedef int INT; typedef long long ll; typedef long double ld; #define int ll typedef pair<int, int> pii; #define one first #define two second #define isize(v) static_cast<int>(v.size()) #define qfor(i, a, b) for (int i = static_cast<int>(a), _end_ = static_cast<int>(b); i < _end_; ++i) #define fori(n) qfor(i, 0, n) #define forj(n) qfor(j, 0, n) #define forin(x, v) for (auto &x: v) void solve() { string s, g; cin >> s >> g; int n = s.size(); string s0, s9, g0, g9; s0.resize(n + 1); s0.back() = '\0'; s9.resize(n + 1); s9.back() = '\0'; g0.resize(n + 1); g0.back() = '\0'; g9.resize(n + 1); g9.back() = '\0'; transform(s.begin(), s.end(), s0.begin(), [](char c){ return c == '?' ? '0' : c; }); transform(g.begin(), g.end(), g0.begin(), [](char c){ return c == '?' ? '0' : c; }); transform(s.begin(), s.end(), s9.begin(), [](char c){ return c == '?' ? '9' : c; }); transform(g.begin(), g.end(), g9.begin(), [](char c){ return c == '?' ? '9' : c; }); string sr, gr; sr.resize(n); gr.resize(n); char who = '\0'; fori (n) { if (who == '\0') { int bs = '0', bg = '0'; int best = 1e18 + 10; for (char sc = '0'; sc <= '9'; ++sc) { for (char gc = '0'; gc <= '9'; ++gc) { if ((s[i] != '?' && s[i] != sc) || (g[i] != '?' && g[i] != gc)) { continue; } s0[i] = sc; s9[i] = sc; g0[i] = gc; g9[i] = gc; int cur1 = abs(atoll(&s0[i]) - atoll(&g0[i])); int cur2 = abs(atoll(&s0[i]) - atoll(&g9[i])); int cur3 = abs(atoll(&s9[i]) - atoll(&g0[i])); int cur = min(cur1, min(cur2, cur3)); if (cur < best) { best = cur; bs = sc; bg = gc; } } } sr[i] = bs; gr[i] = bg; if (bs > bg) { who = 's'; } if (bg > bs) { who = 'g'; } } else { if (s[i] == '?' && g[i] == '?') { if (who == 's') { sr[i] = '0'; gr[i] = '9'; } else { sr[i] = '9'; gr[i] = '0'; } } if (s[i] == '?' && g[i] != '?') { gr[i] = g[i]; if (who == 's') { sr[i] = '0'; } else { sr[i] = '9'; } } if (s[i] != '?' && g[i] == '?') { sr[i] = s[i]; if (who == 's') { gr[i] = '9'; } else { gr[i] = '0'; } } if (s[i] != '?' && g[i] != '?') { sr[i] = s[i]; gr[i] = g[i]; } } } cout << sr << ' ' << gr << endl; } INT main() { #ifdef _GLIBCXX_DEBUG assert(freopen("test.in", "r", stdin)); assert(freopen("result.out", "w", stdout)); #else // assert(freopen("unequal.in", "r", stdin)); // assert(freopen("result.out", "w", stdout)); cin.tie(0); #endif ios_base::sync_with_stdio(0); /// ======================================= int n; cin >> n; fori (n) { cout << "Case #" << i + 1 << ": "; solve(); } }
[ "alexandra1.back@gmail.com" ]
alexandra1.back@gmail.com
a80a44f297d091263df004af292a4e12475f60bd
7f524d69e99d2edd98c254eeb18f84df7a1a9731
/PDMBasal.h
5385be02fcb2f9bfcb283fb156bb5e7ef5889c90
[]
no_license
whynot2018/rtlomni
c8f4ac06f565b20655e098770e664f71b2762997
e4f11937b59c95f837b22b7aac21ec6db44f1140
refs/heads/master
2020-05-04T15:46:13.280601
2018-03-23T12:25:29
2018-03-23T12:25:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
466
h
#ifndef _PDMBASAL #define _PDMBASAL #include "Message.h" #include "SubMessage.h" #define MAX_BYTE_SUBMSG_BODY 255 class PDMBasal { private: public: SubMessage submessage; unsigned long ID2; PDMBasal(); void SetFromSubMessage(SubMessage *submessage_in); int InterpertSubmessage(); int PrintState(); int Create(float Units,unsigned int Nonce,bool DividedFieldA); int CreateExtra(float Units,bool Pairing); }; #endif
[ "evaristec@gmail.com" ]
evaristec@gmail.com
3fcc6b6ab7defe428d2ef52f939bc8cf23846b34
ab6a46a0d7f630201c5860a425855a2a4da1d000
/stress_test/sms/a.cpp
7ca6a101425cd859dd7d442d2d2b562b1f41d2cb
[]
no_license
brunomaletta/DynamicArray
25df565340bd0df90b5815a44bdc32891bedfab1
e3bbfda8d4075a968cc4eab3fe45b48dd100e6fc
refs/heads/master
2023-08-03T20:54:55.622888
2023-07-20T12:25:33
2023-07-20T12:25:33
331,475,048
1
0
null
null
null
null
UTF-8
C++
false
false
565
cpp
#include <iostream> #include "../../src/sms.cpp" int main() { int q; std::cin >> q; sms<int> s; while (q--) { char c; std::cin >> c; if (c == '+') { int x; std::cin >> x; s.insert(x); } else if (c == '-') { int x; std::cin >> x; s.erase(x); } else if (c == '?') { int x; std::cin >> x; if (s.count(x)) std::cout << 1 << std::endl; else std::cout << 0 << std::endl; } else if (c == '$') { if (!s.size()) std::cout << -1 << std::endl; else std::cout << s.min() << " " << s.max() << std::endl; } } return 0; }
[ "malettabruno@gmail.com" ]
malettabruno@gmail.com
d6fc44eabb4e5ca1c441c0540b1a7fecc8f52226
1e61e976e458fb7fc1b9944e07ea648d0e422389
/fun C/standard_password.cpp
37b8cd15bfff00c3a03b5e7cc4fd6e7cefb877a2
[]
no_license
eduschadesoares/others
e0641557d901f987df6502a4c77fc68b8838bc59
3aa2ec5e2160d4b28a30840fcac7b2e2ac76734a
refs/heads/master
2018-10-09T21:39:59.449875
2018-06-23T01:34:37
2018-06-23T01:34:37
68,648,335
0
0
null
null
null
null
UTF-8
C++
false
false
1,545
cpp
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <time.h> #include <locale.h> #include <unistd.h> #include <conio.h> int password(int); int main() { int a, b, c; if(password(a)==1) { return 0; } system("pause"); } int password(int robson) { setlocale(LC_ALL, "portuguese"); int i, N=30, junior, cleber=0, nelso=3; char V[N], C[N]= {"robson"}; junior=strlen(C); //Início da verificação de tentativas while(nelso>=0) { printf("Insira a senha: "); i=0; cleber=0; //Início do teste da senha dentro da leitura while(i<junior) { V[i]=getch(); if(V[i]==C[i]) { printf("*"); } else { printf("*"); cleber++; } i++; } printf("\n"); if(cleber==0) { printf(" ==============\n"); printf(" === NICE ===\n"); printf(" ==============\n"); return 1; } else { if(nelso>1) { printf("Senha incorreta, tente novamente. (%d tentativas restantes)\n", nelso); } else { if(nelso==1) { printf("Senha incorreta, tente novamente. (%d tentativa restante)\n", nelso); } } nelso--; } } printf("\nVose atingio o numero massimo de tentativas, cai fora!\n\n"); /* printf(" ===============================================================================\n"); printf(" == Voçê atingiu o numero máximo de tentativas. Tente novamente mais tarde. ==\n"); printf(" ===============================================================================\n"); */ return 0; }
[ "eduschadesoares@hotmail.com" ]
eduschadesoares@hotmail.com
e97c69a4f47f6af59fb726ed5b29f61f8f8537bc
382b0f5468933665a7ce9dfc616b2edf03b56f39
/lab1/sorts/BubbleSort.h
0f15bb730c061fef834dc4870e2f3698a6b08205
[]
no_license
pixel-pixel/KNU_OOP_K28
0ca7b0347b92099b5073be06f2d621c2c0a30c70
5e61e417efb95298033f77e6e4b7691215f83515
refs/heads/master
2023-01-07T10:43:02.206271
2020-11-02T21:41:49
2020-11-02T21:41:49
293,591,416
1
3
null
2020-11-02T21:41:51
2020-09-07T17:31:15
C++
UTF-8
C++
false
false
1,133
h
#ifndef KNU_OOP_K28_BUBBLESORT_H #define KNU_OOP_K28_BUBBLESORT_H #include "Sort.h" /** * @brief * Class implements Sort interface. It sort arrays by Bubble sort. * @tparam T Class or primitive with override relational operators or have it own Comparator. */ template<class T> class BubbleSort : public Sort<T> { public: /** * @brief * Method for sort arrays by Bubble sort by Comparator or relational operators(if point on Comparator == nullptr); * @param arr Array which we want to sort. * @param size Size of our array. * @param comparator Functional interface for compare 2 objects. DefaultComparator if not init. */ void sort(T *arr, int size, Comparator<T> *comparator = new DefaultComparator<T>) override { T temp; for (int i = 1; i < size; i++) { for (int j = 0; j < size - i; j++) { if (comparator->compare(arr[j], arr[j + 1]) == 1) { temp = arr[j + 1]; arr[j + 1] = arr[j]; arr[j] = temp; } } } } }; #endif
[ "bartishco@gmail.com" ]
bartishco@gmail.com
10a2950b1a76c2117c050185d7a7f3787bdb93b3
0da6ca75e78a982341f15ed060ae54c6ed4803d9
/labwork2 var4/Conway's game of life.cpp
76732cfe5e380f4d795129a194658d26b4dcb86c
[]
no_license
Malthess/Programming-languages
324b6f00e97b11113c87a33951e03dff8d6830e5
76c98484214de007d8b6aab5a39216b76cc6a05d
refs/heads/master
2022-10-31T02:02:45.621043
2020-06-15T14:41:27
2020-06-15T14:41:27
255,125,628
0
0
null
null
null
null
UTF-8
C++
false
false
6,969
cpp
#include <iostream> #include <cstdlib> #include <ctime> #include <type_traits> const int gridsize = 50; //Making this a global constant to avoid array issues. void Display(bool grid[gridsize + 1][gridsize + 1]); //This copy's the grid for comparision purposes. void CopyGrid(bool grid[gridsize + 1][gridsize + 1], bool grid2[gridsize + 1][gridsize + 1]); //Calculates Life or Death void liveOrDie(bool grid[gridsize + 1][gridsize + 1], bool grid2[gridsize + 1][gridsize + 1], int& alive, int& dead, int rows, int cols); void alivedead(int& alive, int& dead, bool grid[gridsize + 1][gridsize + 1]); void somestuff(bool grid[gridsize + 1][gridsize + 1], bool grid2[gridsize + 1][gridsize + 1], int a, int b, int& life, int rows, int cols); void checking(bool grid[gridsize + 1][gridsize + 1], bool grid2[gridsize + 1][gridsize + 1], int life, int a, int b); int main() { srand(unsigned(time(0))); //const int gridsize = 50; bool grid[gridsize + 1][gridsize + 1] = {}, grid2[gridsize + 1][gridsize + 1] = {}, pravda = true; //just checking how much rows and columns we have int rows = std::extent<decltype(grid), 0>::value; int cols = std::extent<decltype(grid), 1>::value; int alive = 0, dead = 0; //there we will determine how much cycles we do want to see unsigned int stepsss; int stepss = 0; std::cout << "Please tell us how much cycles you'd like this program to do: "; std::cin >> stepsss; while (stepsss < 0) { std::cout << "Please enter values from 0 to eternity: "; std::cin >> stepsss; } //randomly designates alive cells at the start int howmuch = (rand() % ((gridsize + 1) * (gridsize + 1))); //defines amount of cells being alive at the start int xarray, yarray, xtemp = NULL, ytemp = NULL; //this line defines default variables of i and j for arrays and two temporary variables for them as well. while (howmuch) //this randomly assigns default alive cells without them repeating places { xarray = rand() % gridsize; yarray = rand() % gridsize; if (xtemp != xarray && ytemp != yarray) { grid[xarray][yarray] = true; howmuch--; xtemp = xarray; ytemp = yarray; } } do { Display(grid); //This is our display. liveOrDie(grid, grid2, alive, dead, rows, cols); //calculate if it lives or dies. std::cout << "alive " << alive << "/ "; std::cout << "dead " << dead << "\n"; system("CLS"); stepss = stepss + 1; } while (stepss != stepsss); } void Display(bool grid[gridsize + 1][gridsize + 1]) { for (int a = 0; a <= gridsize; a++) { for (int b = 0; b <= gridsize; b++) { if (grid[a][b] == true) { std::cout << "*"; } else { std::cout << " "; } if (b == gridsize) { std::cout << std::endl; } } } } void liveOrDie(bool grid[gridsize + 1][gridsize + 1], bool grid2[gridsize + 1][gridsize + 1], int& alive, int& dead, int rows, int cols) { CopyGrid(grid, grid2); alivedead(alive, dead, grid); for (int a = 0; a <= gridsize; a++) { for (int b = 0; b <= gridsize; b++) { int life = 0; somestuff(grid, grid2, a, b, life, rows, cols); checking(grid, grid2, life, a, b); } } } void CopyGrid(bool grid[gridsize + 1][gridsize + 1], bool grid2[gridsize + 1][gridsize + 1]) { for (int a = 0; a <= gridsize; a++) { for (int b = 0; b <= gridsize; b++) { grid2[a][b] = grid[a][b]; } } } void alivedead(int& alive, int& dead, bool grid[gridsize + 1][gridsize + 1]) { alive = 0; dead = 0; for (int i = 0; i <= gridsize; i++) { for (int j = 0; j <= gridsize; j++) { if (grid[i][j] == true)alive++; else { dead++; } } } } void somestuff(bool grid[gridsize + 1][gridsize + 1], bool grid2[gridsize + 1][gridsize + 1], int a, int b, int& life, int rows, int cols) { if (a == 0) { //highest left if (b == 0) { if (grid2[a][b + 1] == true) ++life;//Право if (grid2[a + 1][b] == true) ++life;//Низ if (grid2[a + 1][b + 1] == true) ++life;//Нижний правый угол } //highest right if (b == cols) { if (grid2[a][b - 1] == true) ++life;//Лево if (grid2[a + 1][b] == true) ++life;//Низ if (grid2[a + 1][b - 1] == true) ++life;//Нижний левый угол } //highest line if (b != cols && b != 0) { if (grid2[a][b - 1] == true) ++life;//Лево if (grid2[a][b + 1] == true) ++life;//Право if (grid2[a + 1][b] == true) ++life;//Низ if (grid2[a + 1][b - 1] == true) ++life;//Нижний левый угол if (grid2[a + 1][b + 1] == true) ++life;//Нижний правый угол } } else if (b == 0) { //lowest left if (a == rows) { if (grid2[a - 1][b] == true) ++life;//Верх if (grid2[a][b + 1] == true) ++life;//Право if (grid2[a - 1][b + 1] == true) ++life;//Верхний правый угол } //leftest line else if (a != 0) { if (grid2[a - 1][b] == true) ++life;//Верх if (grid2[a][b + 1] == true) ++life;//Право if (grid2[a + 1][b] == true) ++life;//Низ if (grid2[a + 1][b + 1] == true) ++life;//Нижний правый угол if (grid2[a - 1][b + 1] == true) ++life;//Верхний правый угол } } if (a == rows) { //lowest line if (b != 0 && b != cols) { if (grid2[a][b - 1] == true) ++life;//Лево if (grid2[a - 1][b] == true) ++life;//Верх if (grid2[a][b + 1] == true) ++life;//Право if (grid2[a - 1][b - 1] == true) ++life;//Верхний левый угол if (grid2[a - 1][b + 1] == true) ++life;//Верхний правый угол } //lowest right else if (b == cols) { if (grid2[a][b - 1] == true) ++life;//Лево if (grid2[a - 1][b] == true) ++life;//Верх if (grid2[a - 1][b - 1] == true) ++life;//Верхний левый угол } } else if (a != 0) { //righteous line if (a != rows && b == cols) { if (grid2[a - 1][b] == true) ++life;//Верх if (grid2[a][b - 1] == true) ++life;//Лево if (grid2[a + 1][b] == true) ++life;//Низ if (grid2[a - 1][b - 1] == true) ++life;//Верхний левый угол if (grid2[a + 1][b - 1] == true) ++life;//Нижний левый угол } } //center if (a != 0 && a != rows && b != 0 && b != cols) { if (grid2[a - 1][b] == true) ++life;//Верх if (grid2[a][b - 1] == true) ++life;//Лево if (grid2[a][b + 1] == true) ++life;//Право if (grid2[a + 1][b] == true) ++life;//Низ if (grid2[a - 1][b - 1] == true) ++life;//Верхний левый угол if (grid2[a + 1][b - 1] == true) ++life;//Нижний левый угол if (grid2[a - 1][b + 1] == true) ++life;//Верхний правый угол if (grid2[a + 1][b + 1] == true) ++life;//Нижний правый угол } } void checking(bool grid[gridsize + 1][gridsize + 1], bool grid2[gridsize + 1][gridsize + 1], int life, int a, int b) { if (grid2[a][b]) { if (life < 2) { grid[a][b] = false; } else if (life > 3) { grid[a][b] = false; } } else { if (life == 3)grid[a][b] = true; } }
[ "risonnan@gmail.com" ]
risonnan@gmail.com
ca43a138d9f5c7a83320831afce705cf9e57c48b
4afb5f7c922822c5121b9bf4c6b8fe86a5960306
/least_fit.cpp
89f19ff321490ae214c53d8bb56d0395554f554b
[]
no_license
duttasoumo/CPP-LPP-Program-Files
d3ce4b0e10e85d8ac22d8b814c87b10a7554b8da
5a286cd0c08bc403dc399a9ba5939d2d6d16ce31
refs/heads/main
2023-05-04T15:14:35.087339
2021-05-21T21:24:28
2021-05-21T21:24:28
369,657,135
0
0
null
null
null
null
UTF-8
C++
false
false
1,547
cpp
//least_fit.cpp : Write a program to implement least square fit method #include<iostream.h> class Least_Square_Fit { public: double a[10]; void least_square_fit(double x[100],double y[100],int m,int n); void gauss_elimination(double a1[10][10],double b1[10],int n); }; void Least_Square_Fit :: least_square_fit(double x[100],double y[100],int m,int n) { double s1,s2,p; int i,j,k,k1,k2; double a1[10][10],b1[10]; //To calculate coefficient matrix a1[][] for(i=0;i<=n;i++) for(j=0;j<=n;j++) { k=i+j; //p=1; s1=0; for(k1=0;k1<m;k1++) { p=1; for(k2=1;k2<=k;k2++) p=p*x[k1]; s1=s1+p; } a1[i][j]=s1; } //To calculate coefficient b1[] for(i=0;i<=n;i++) { s2=0; //p=1; k=i; for(k1=0;k1<m;k1++) { p=1; for(k2=1;k2<=k;k2++) p=p*x[k1]; s2=s2+p*y[k1]; } b1[i]=s2; } //To display all co-efficients cout.precision(16); cout<<endl<<"Elements in a1[][] Matrix--->"<<endl; for(i=0;i<=n;i++) { for(j=0;j<=n;j++) cout<<a1[i][j]<<"\t"; cout<<endl; } cout<<"Elements in b1[] array--->"<<endl; for(i=0;i<=n;i++) cout<<b1[i]<<endl; } int main() { double x[100],y[100]; int i,n,m; system("clear"); cout<<endl<<"Enter number of points(1-100)="; cin>>m; cout<<endl<<"Enter x-points, y-points one by one--->"<<endl; for(i=0;i<m;i++) { cout<<"x["<<i<<"]="; cin>>x[i]; cout<<"y["<<i<<"]="; cin>>y[i]; } cout<<"Enter order of polynomial="; cin>>n; Least_Square_Fit LSF; LSF.least_square_fit(x,y,m,n); return 0; }
[ "duttasoumo@gmail.com" ]
duttasoumo@gmail.com
611c949e512947de1c51c53d3912c1e093162c11
44a02874d44d0449a731fa7ba31b4c17f24fdf73
/src/display.cpp
e0a5c619feca9d42c3efef2cafcdc205eee55480
[]
no_license
shen-tian/feather-send
358691360d2eeb20b6f715fb3efc2cd5d2a6dc14
4fed794969ef57d7be407ac35bf6d84954c0d7ae
refs/heads/master
2023-04-28T23:56:55.140681
2023-04-19T15:33:15
2023-04-19T15:33:15
112,788,328
1
0
null
null
null
null
UTF-8
C++
false
false
7,203
cpp
#include "display.h" Adafruit_SSD1306 display = Adafruit_SSD1306(128, SCREEN_H); void initDisplay(State &state) { Serial.println("Display: init"); // initialize with the I2C addr 0x3C (for the 128x32) display.begin(SSD1306_SWITCHCAPVCC, 0x3C); display.setTextSize(1); display.setTextColor(WHITE); display.clearDisplay(); display.setCursor(0, 0); display.println("hello " + String(state.callsign) + "."); display.display(); } const char *timeSince(unsigned long timestamp) { long elapsed = (millis() - timestamp) / 1000; int n; char unit; static char buff[20]; if (elapsed < 2) { strcpy(buff, "now"); return buff; } else if (elapsed < 60) { n = elapsed; unit = 's'; } else if (elapsed < 3600) { n = elapsed / 60; unit = 'm'; } else { n = elapsed / 3600; unit = 'h'; } sprintf(buff, "%d%c", n, unit); return buff; } void updateSystemDisplay(State &state) { display.clearDisplay(); char buff[50]; float measuredvbat = 0; for (int i = 0; i < 8; i++) measuredvbat += analogRead(VBAT_PIN); measuredvbat /= 8; measuredvbat *= VBAT_RATIO; sprintf(buff, "VBatt: %.2fV", measuredvbat); display.setCursor(0, 0); display.println(buff); sprintf(buff, "Uptime: %s", timeSince(0)); display.println(buff); sprintf(buff, "Free mem: %dkb", freeMemory()); display.println(buff); sprintf(buff, "Freq: %.2fMhz", state.loraFreq); display.println(buff); display.display(); state.lastDisplay = millis(); } void updateGpsDisplay(State &state, TrackerGps &gps) { display.clearDisplay(); char buff[50]; display.setCursor(0, 0); //sprintf(buff, "%02d:%02d:%02d %02lds ago", gps.hour, gps.minute, gps.second, (millis() - gps.fixTimestamp)/1000); int age = (millis() - gps.fixTimestamp) / 1000; byte second = gps.second + age; byte hour = gps.hour; byte minute = gps.minute; while (second >= 60) { second -= 60; minute++; } while (minute >= 60) { minute -= 60; hour++; } while (hour >= 24) { hour--; } sprintf(buff, "%02d:%02d:%02d %d", hour, minute, second, age); display.println(buff); if (gps.isAwake()) display.fillCircle(123, 3, 2, 1); sprintf(buff, "lat:%11.6f %2d", gps.lat / 1e6, gps.numSats); display.println(buff); sprintf(buff, "lon:%11.6f", gps.lon / 1e6); display.println(buff); sprintf(buff, "acc:%4.0fm alt:%4dm", gps.hAccuracy, (int)(gps.altitude / 100)); display.println(buff); display.drawBitmap(17 * 6, 1 * LINE_PX, satIcon, 8, 8, 1); display.display(); state.lastDisplay = millis(); } void updateImuDisplay(State &state, Imu &imu) { display.clearDisplay(); display.setCursor(0, 0); char buff[20]; if (imu.exists()) { sprintf(buff, "br %3ld tp %2d S%dG%dA%dM%d", imu.heading, imu.temperature, imu.sysCal, imu.gyroCal, imu.accCal, imu.magCal); display.println(buff); sprintf(buff, "eu x%5.0fy%5.0fz%5.0f", imu.euler.x(), imu.euler.y(), imu.euler.z()); display.println(buff); sprintf(buff, "ma x%5.1fy%5.1fz%5.1f", imu.mag.x(), imu.mag.y(), imu.mag.z()); display.println(buff); sprintf(buff, "gy x%5.1fy%5.1fz%5.1f", imu.gyro.x(), imu.gyro.y(), imu.gyro.z()); display.println(buff); } else { display.println("No IMU installed"); } display.display(); state.lastDisplay = millis(); } String getCallsigns(State &state) { int count = state.numTrackers(); if (count == 0) { return "all alone"; } String s = ""; for (int i = 0; i < count; i++) { int slot = (state.activeLoc + i) % count; if (i == 0) { s.concat(">"); } String cs = String(state.otherLocs[slot].callsign); if (millis() - state.otherLocs[slot].timestamp > OTHER_LOC_STALENESS) { cs.toLowerCase(); } else { cs.toUpperCase(); } s.concat(cs); //if (i == 0) { // s.concat("]"); //} s.concat(" "); if (s.length() > LINE_LEN) { break; } } return s.substring(0, LINE_LEN); } // Distance/bearing Math from here: // https://www.movable-type.co.uk/scripts/latlong.html float distanceFromLoc(int lat0, int lat1, int lon0, int lon1) { int R = 6371e3; // metres float t0 = PI * lat0 / (180.0 * 1e6); float t1 = PI * lat1 / (180.0 * 1e6); float dt = PI * (lat1 - lat0) / (180.0 * 1e6); float dl = PI * (lon1 - lon0) / (180.0 * 1e6); float a = sin(dt / 2) * sin(dt / 2) + cos(t0) * cos(t1) * sin(dl / 2) * sin(dl / 2); float c = 2 * atan2(sqrt(a), sqrt(1 - a)); return R * c; } float initialBearing(int lat0, int lat1, int lon0, int lon1) { float t0 = PI * lat0 / (180.0 * 1e6); float t1 = PI * lat1 / (180.0 * 1e6); float l0 = PI * lon0 / (180.0 * 1e6); float l1 = PI * lon1 / (180.0 * 1e6); float y = sin(l1 - l0) * cos(t1); float x = cos(t0) * sin(t1) - sin(t0) * cos(t1) * cos(l1 - l0); if (x == 0 && y == 0) return -1; else return atan2(y, x) * 180 / PI; } String locationString(fix *loc, char nofixstr[], TrackerGps gps) { char line[20]; float distance = distanceFromLoc(loc->lat, gps.lat, loc->lon, gps.lon); float bearing = initialBearing(gps.lat, loc->lat, gps.lon, loc->lon); if (distance < 1000) { sprintf(line, "%.0fm away, %.0fdeg", distance, bearing); } else { sprintf(line, "%.1fkm away, %.0fdeg ", distance / 1000, bearing); } return line; } // void showHeading(fix* loc){ // float bearing = initialBearing(gps.lat, loc->lat, gps.lon, loc->lon); // float diff = thisImu.heading - bearing; // while (diff > 180) // diff -= 360; // while (diff < -180) // diff += 180; // int8_t offset = diff / 360.0 * 127; // display.fillRect(64 - offset, 3*LINE_PX, 1, 8, 1); // display.fillRect(63, 3*LINE_PX,3,2,1); // } void updateMainDisplay(State &state, TrackerGps &gps) { fix theirLoc = state.otherLocs[state.activeLoc]; int count = state.numTrackers(); display.clearDisplay(); display.setCursor(0, 0); display.println(getCallsigns(state)); if (count > 0) { char msg[10]; strcpy(msg, ""); display.println(locationString(&theirLoc, msg, gps)); display.println(timeSince(theirLoc.timestamp)); display.setCursor(60, 2 * LINE_PX); display.println(String(theirLoc.rssi) + "db"); //showHeading(&theirLoc); } display.setCursor(0, 3 * LINE_PX); //char msg[10]; //strcpy(msg, "and lost"); String fixStatus = ""; long sinceLastFix = millis() - gps.fixTimestamp; long sinceLastSend = millis() - state.lastSend; if (sinceLastFix > MAX_FIX_AGE) { // GPS data is stale fixStatus = "!"; } else if (state.sending || (sinceLastSend >= 0 && sinceLastSend < 400)) { fixStatus = "."; } display.setCursor(120, 3 * LINE_PX); display.println(fixStatus); display.display(); state.lastDisplay = millis(); } void updateMainDisplay(State &state, Imu &imu, TrackerGps &gps) { switch (state.dispMode) { case 0: updateMainDisplay(state, gps); break; case 1: updateGpsDisplay(state, gps); break; case 2: updateImuDisplay(state, imu); break; case 3: updateSystemDisplay(state); break; } }
[ "biozinc@gmail.com" ]
biozinc@gmail.com
58c3c317635435df9b235701e84d1ec161f341d8
9e1e09ea61632e80465f371a083625d03b1e5ab2
/src/P2p/LevinProtocol.cpp
3d71cb90b1920c53ee0244bf58547cd85478432d
[ "MIT" ]
permissive
bitcoin-note/bitcoin-note
0f93c5a04dda2df6ff838187d894a0c4af633649
7be1e60f327b7ce1f995fee97f80131dcb934e70
refs/heads/master
2021-05-11T19:50:51.485229
2018-01-18T00:05:24
2018-01-18T00:05:24
117,895,059
3
2
null
null
null
null
UTF-8
C++
false
false
3,538
cpp
// Copyright (c) 2018, The Bitcoin Note Developers. // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "LevinProtocol.h" #include <System/TcpConnection.h> using namespace CryptoNote; namespace { const uint64_t LEVIN_SIGNATURE = 0x0101010101012101LL; //Bender's nightmare const uint32_t LEVIN_PACKET_REQUEST = 0x00000001; const uint32_t LEVIN_PACKET_RESPONSE = 0x00000002; const uint32_t LEVIN_DEFAULT_MAX_PACKET_SIZE = 100000000; //100MB by default const uint32_t LEVIN_PROTOCOL_VER_1 = 1; #pragma pack(push) #pragma pack(1) struct bucket_head2 { uint64_t m_signature; uint64_t m_cb; bool m_have_to_return_data; uint32_t m_command; int32_t m_return_code; uint32_t m_flags; uint32_t m_protocol_version; }; #pragma pack(pop) } bool LevinProtocol::Command::needReply() const { return !(isNotify || isResponse); } LevinProtocol::LevinProtocol(System::TcpConnection& connection) : m_conn(connection) {} void LevinProtocol::sendMessage(uint32_t command, const BinaryArray& out, bool needResponse) { bucket_head2 head = { 0 }; head.m_signature = LEVIN_SIGNATURE; head.m_cb = out.size(); head.m_have_to_return_data = needResponse; head.m_command = command; head.m_protocol_version = LEVIN_PROTOCOL_VER_1; head.m_flags = LEVIN_PACKET_REQUEST; // write header and body in one operation BinaryArray writeBuffer; writeBuffer.reserve(sizeof(head) + out.size()); Common::VectorOutputStream stream(writeBuffer); stream.writeSome(&head, sizeof(head)); stream.writeSome(out.data(), out.size()); writeStrict(writeBuffer.data(), writeBuffer.size()); } bool LevinProtocol::readCommand(Command& cmd) { bucket_head2 head = { 0 }; if (!readStrict(reinterpret_cast<uint8_t*>(&head), sizeof(head))) { return false; } if (head.m_signature != LEVIN_SIGNATURE) { throw std::runtime_error("Levin signature mismatch"); } if (head.m_cb > LEVIN_DEFAULT_MAX_PACKET_SIZE) { throw std::runtime_error("Levin packet size is too big"); } BinaryArray buf; if (head.m_cb != 0) { buf.resize(head.m_cb); if (!readStrict(&buf[0], head.m_cb)) { return false; } } cmd.command = head.m_command; cmd.buf = std::move(buf); cmd.isNotify = !head.m_have_to_return_data; cmd.isResponse = (head.m_flags & LEVIN_PACKET_RESPONSE) == LEVIN_PACKET_RESPONSE; return true; } void LevinProtocol::sendReply(uint32_t command, const BinaryArray& out, int32_t returnCode) { bucket_head2 head = { 0 }; head.m_signature = LEVIN_SIGNATURE; head.m_cb = out.size(); head.m_have_to_return_data = false; head.m_command = command; head.m_protocol_version = LEVIN_PROTOCOL_VER_1; head.m_flags = LEVIN_PACKET_RESPONSE; head.m_return_code = returnCode; BinaryArray writeBuffer; writeBuffer.reserve(sizeof(head) + out.size()); Common::VectorOutputStream stream(writeBuffer); stream.writeSome(&head, sizeof(head)); stream.writeSome(out.data(), out.size()); writeStrict(writeBuffer.data(), writeBuffer.size()); } void LevinProtocol::writeStrict(const uint8_t* ptr, size_t size) { size_t offset = 0; while (offset < size) { offset += m_conn.write(ptr + offset, size - offset); } } bool LevinProtocol::readStrict(uint8_t* ptr, size_t size) { size_t offset = 0; while (offset < size) { size_t read = m_conn.read(ptr + offset, size - offset); if (read == 0) { return false; } offset += read; } return true; }
[ "bitnotecurrency@gmail.com" ]
bitnotecurrency@gmail.com
8ff17b36840abda9f49c5d1933de82e08123d5a5
26c62fc84c5e32e20a99025dc21ea40ac187496a
/Skype-Android/jni/transport.hpp
ea08fd480fa62519c328d0ce1d4bf898d2b2bed2
[]
no_license
gotomypc/Skype-Android
697107294258e3cfa78298418f2a438af683eee8
ef1ba27dbe61a7e76d5aab23b241030cb19ce33f
refs/heads/master
2021-01-17T22:48:54.084229
2012-08-01T23:11:29
2012-08-01T23:11:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,081
hpp
#ifndef __TRANSPORT_HPP_INCLUDED__ #define __TRANSPORT_HPP_INCLUDED__ #include "IPNetwork.hpp" class Transport { public: virtual ~Transport() {}; virtual bool Connect(const char *host=NULL)=0; virtual void Disconnect()=0; virtual int Read(void *buf,int len)=0; virtual int Write(void *buf,int len)=0; virtual bool Poll()=0; virtual Address GetAddress()=0; virtual void GetStats(uint& bytessent,uint& bytesperminsent, uint& bytesreceived,uint& bytesperminreceived)=0; }; class TCPTransport : public Transport { TCPConnection tcpconnection; unsigned int sent,received; time_t starttime; public: virtual void GetStats(uint& bytessent,uint& bytesperminsent, uint& bytesreceived,uint& bytesperminreceived) { bytessent=sent; bytesreceived=received; time_t t=(time(NULL)-starttime)/60; if (starttime && t>0) { bytesperminsent=sent/t; bytesperminreceived=received/t; } else { bytesperminsent=0; bytesperminreceived=0; } } virtual bool Connect(const char *host) { MEMBLOCK m; int port; m.SetSize(strlen(host)+1); strcpy((char *)m.Ptr,host); char *s=strchr((char *)m.Ptr,':'); if (s) { *s='\0'; port=atoi(s+1); } else port=80; printf("TCPTransport connecting to %s:%d\n",(char *)m.Ptr,port); starttime=time(NULL); sent=received=0; return tcpconnection.Open((char *)m.Ptr,port); } virtual void Disconnect() { tcpconnection.Close(); } virtual bool Poll() { return tcpconnection.DataReady(); } virtual int Read(void *buf,int len) { int i; i=tcpconnection.Read((uchar *)buf,len); if (i>0) received+=i; return i; } virtual int Write(void *buf,int len) { int i; i=tcpconnection.Write((uchar *)buf,len); if (i>0) sent+=i; return i; } virtual Address GetAddress() { Address a; IPADDR n; n=tcpconnection.GetName(); a.IPAddress=n.GetAddr(); a.Port=n.GetPort(); return a; } }; #endif
[ "aditya.agarwal@compuware.com" ]
aditya.agarwal@compuware.com
63a2c8f3116d71c6d26527cdf2ba9af889938ed0
d7bfca6d289b47e8b192f9ba012bc5ac5372a452
/header.h
6f1faf1922c5f7ea3d21f5c12da44306866868f3
[]
no_license
jaycariaga/Stock-Transaction-Terminal
95fdb21232baf651ca3a3fb676e510581d3cb937
cd621c466b9c750b685fee4c7fa3823236c9cb41
refs/heads/master
2022-12-05T21:08:30.566353
2020-08-27T23:25:30
2020-08-27T23:25:30
290,902,975
0
0
null
null
null
null
UTF-8
C++
false
false
1,387
h
// // Created by jaymc on 4/17/2018. // #ifndef PROJECT2_HEADER_H #define PROJECT2_HEADER_H #endif //PROJECT2_HEADER_H #include <iostream> #include <string> #include <fstream> #include <iomanip> #include <vector> #include <stdio.h> using namespace::std; struct stockhistory{ //for stock_transaction_history and portfolios string symbol; string company; int number; //number of stocks double price; double total; }; void stockmenu(int *a); void bankmenu(int *a); vector<string> inputtoarray(); bool checksearch(string x); void validinput(double &x); void deletline(); /* typedef struct _SYSTEMTIME { double wHour; double wMinute; double wSecond; } SYSTEMTIME; */ class Account { public: Account(); double getBalance(); void setBalance(double); private: double cashBalance; }; class stockAccount : public Account{ public: stockAccount(); void getstockprice(); void buy(vector<stockhistory>& ); void sell(vector<stockhistory>&); void getportfolio(vector<stockhistory>&); void gettransaction(); void display2bank(string, int, double); private: }; class bankAccount : public Account{ private: public: bankAccount(); void deposit(vector<stockhistory>&); void withdraw(vector<stockhistory>&); void gettransaction(vector<stockhistory>&); void getportfolio(vector<stockhistory>&); };
[ "jay_jay_xray@yahoo.com" ]
jay_jay_xray@yahoo.com
550228efd0268530e0e60004d386199e2821cda2
f9485b64c2f0632572423e3c29d4911846849c6c
/src/CurrencyAdapter.cpp
29edddaa68154f906f4fa29a34b833320fedb789
[ "MIT" ]
permissive
prascoin/prascoinwallet
55928aabaa1360099cf42a58e69436e4269f9d50
27bae19ded60a9b72c71cfe6471c9cc27a38eb99
refs/heads/master
2020-03-08T23:54:08.453684
2018-04-06T22:14:19
2018-04-06T22:14:19
128,367,020
0
0
null
null
null
null
UTF-8
C++
false
false
3,561
cpp
// Copyright (c) 2011-2015 The Cryptonote developers // Copyright (c) 2016-2018 The PrasCoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <crypto/crypto.h> #include <Common/StringTools.h> #include "CurrencyAdapter.h" #include "CryptoNoteWalletConfig.h" #include "LoggerAdapter.h" namespace WalletGui { CurrencyAdapter& CurrencyAdapter::instance() { static CurrencyAdapter inst; return inst; } CurrencyAdapter::CurrencyAdapter() : m_currency(CryptoNote::CurrencyBuilder(LoggerAdapter::instance().getLoggerManager()).currency()) { } CurrencyAdapter::~CurrencyAdapter() { } const CryptoNote::Currency& CurrencyAdapter::getCurrency() { return m_currency; } quintptr CurrencyAdapter::getNumberOfDecimalPlaces() const { return m_currency.numberOfDecimalPlaces(); } QString CurrencyAdapter::getCurrencyDisplayName() const { return WALLET_CURRENCY_DISPLAY_NAME; } QString CurrencyAdapter::getCurrencyName() const { return CryptoNote::CRYPTONOTE_NAME; } QString CurrencyAdapter::getCurrencyTicker() const { return WALLET_CURRENCY_TICKER; } quint64 CurrencyAdapter::getMinimumFee() const { return m_currency.minimumFee(); } quint64 CurrencyAdapter::getAddressPrefix() const { return m_currency.publicAddressBase58Prefix(); } QString CurrencyAdapter::formatAmount(quint64 _amount) const { QString result = QString::number(_amount); if (result.length() < getNumberOfDecimalPlaces() + 1) { result = result.rightJustified(getNumberOfDecimalPlaces() + 1, '0'); } quint32 dot_pos = result.length() - getNumberOfDecimalPlaces(); for (quint32 pos = result.length() - 1; pos > dot_pos + 1; --pos) { if (result[pos] == '0') { result.remove(pos, 1); } else { break; } } result.insert(dot_pos, "."); for (qint32 pos = dot_pos - 3; pos > 0; pos -= 3) { if (result[pos - 1].isDigit()) { //result.insert(pos, ','); } } return result; } quint64 CurrencyAdapter::parseAmount(const QString& _amountString) const { QString amountString = _amountString.trimmed(); amountString.remove(','); int pointIndex = amountString.indexOf('.'); int fractionSize; if (pointIndex != -1) { fractionSize = amountString.length() - pointIndex - 1; while (getNumberOfDecimalPlaces() < fractionSize && amountString.right(1) == "0") { amountString.remove(amountString.length() - 1, 1); --fractionSize; } if (getNumberOfDecimalPlaces() < fractionSize) { return 0; } amountString.remove(pointIndex, 1); } else { fractionSize = 0; } if (amountString.isEmpty()) { return 0; } for (qint32 i = 0; i < getNumberOfDecimalPlaces() - fractionSize; ++i) { amountString.append('0'); } return amountString.toULongLong(); } bool CurrencyAdapter::validateAddress(const QString& _address) const { CryptoNote::AccountPublicAddress internalAddress; return m_currency.parseAccountAddressString(_address.toStdString(), internalAddress); } CryptoNote::AccountPublicAddress CurrencyAdapter::internalAddress(const QString& _address) const { CryptoNote::AccountPublicAddress internalAddress; if(!m_currency.parseAccountAddressString(_address.toStdString(), internalAddress)) { // Error message } return internalAddress; } QString CurrencyAdapter::generatePaymentId() const { Crypto::Hash payment_id; payment_id = Crypto::rand<Crypto::Hash>(); return QString::fromStdString(Common::podToHex(payment_id)); } }
[ "prascoin@prascoin.com" ]
prascoin@prascoin.com
ef7805e25d6c2fcab9b45203bb63fdc11ceb31c7
7c974a6805b96838f23061d94500b16cb73df320
/ndivphi/main.cpp
aebc18cea7b084efc8d6c0992d8d506af93b1b83
[]
no_license
vectar31/Spoj-solutions-and-other-c-codes
b14ea488baf8c34d078dc0f18b5d3220b08d144f
db3fbf884c3ba00b4bb1495da60fee692cad3cf8
refs/heads/master
2021-01-10T02:10:45.340417
2015-12-14T11:47:10
2015-12-14T11:47:10
47,930,233
0
0
null
null
null
null
UTF-8
C++
false
false
644
cpp
#include <iostream> using namespace std; int f[]={2, 4, 9, 16, 25, 64, 289, 729, 1681, 2401, 3481, 4096, 5041, 7921, 10201, 15625, 17161, 27889, 28561, 29929, 65536, 83521, 85849, 146689, 262144, 279841, 458329, 491401, 531441, 552049, 579121, 597529, 683929, 703921, 707281, 734449, 829921}; int main() { int t; cin>>t; while(t--) { int a,b; cin>>a>>b; int ans=0; int i,j; j=0; while(f[j]<a) j++; i=j; while(f[i]<b) i++; //if(f[i]==b) // ans+=1; cout<<i-j<<endl; //cout<<ans<<endl; } return 0; }
[ "vectarpiyush31@gmail.com" ]
vectarpiyush31@gmail.com
1ad8ea418cbb0ffcafafa52b3ddd3be9d6c54445
acbebf091af8bcf2fbd5b403639f2ca40653b0ed
/EEDataSync/EELocalDataParser/eefoldermodel.cpp
b484e0a3cce293ca8006e15e5f0199761dfcf297
[]
no_license
rybaklevko/X-Cloud-Desktop
f58e46dce4e84346062d4e6e88021729ee11d473
b323095bc6579e337c4654ab4724e1a5ca097e90
refs/heads/master
2020-06-16T20:09:20.644678
2019-02-13T07:40:07
2019-02-13T07:40:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,168
cpp
#include "eefoldermodel.h" #include <QList> #include <QString> EEFolderModel::EEFolderModel(EEModel *parent) : EEModel(parent) { } EEFolderModel::~EEFolderModel() { if (mSubdirs.size() > 0) { qDeleteAll(mSubdirs); mSubdirs.clear(); } if (mFiles.size() > 0) { qDeleteAll(mFiles); mFiles.clear(); } } /** * @brief EEFolderModel::cleanChildrenList * delete all subfolders and subfiles */ void EEFolderModel::cleanChildrenList() { if (mSubdirs.size() > 0) { qDeleteAll(mSubdirs); mSubdirs.clear(); } if (mFiles.size() > 0) { qDeleteAll(mFiles); mFiles.clear(); } } bool EEFolderModel::isEmpty() { bool lIsEmpty = false; if (!mSubdirs.count()) { if (!mFiles.count()) { lIsEmpty = true; } } return lIsEmpty; } /** * @brief EEFolderModel::addChild * Add child to list of children * If it's not exists yet * @param child * @return */ bool EEFolderModel::addFolder(EEFolderModel *folder) { if (folder != nullptr) { foreach (EEFolderModel *tmpFolder, mSubdirs) { if (folder->name() == tmpFolder->name()) { return false; } } mSubdirs.append(folder); return true; } else { return false; } } bool EEFolderModel::addFile(EEModel *file) { if (file != nullptr) { foreach (EEFolderModel *tmpFile, mSubdirs) { if (file->name() == tmpFile->name()) { return false; } } mFiles.append(file); return true; } else { return false; } } /** * @brief EEFolderModel::getChildrenList * @return */ QList<EEFolderModel *> EEFolderModel::folderList() const { return mSubdirs; } bool EEFolderModel::deleteFile(EEModel *file) { if (file != nullptr) { return mFiles.removeOne(file); } return false; } bool EEFolderModel::deleteFolder(EEFolderModel *folder) { if (folder != nullptr) { return mSubdirs.removeOne(folder); } return false; } QList<EEModel *> EEFolderModel::filesList() const { return mFiles; }
[ "lev-volodymyr.rybak@indeema.com" ]
lev-volodymyr.rybak@indeema.com
2f9e43c42e156747d8315f87791670398b07591f
4eb5f5ba0ac095c7df74b7d4860b2dfe975d2323
/POD_TestClient3/POD_x11/cMonster_Info.cpp
2dd7853a3c708bc79dff87ef1627ad5beb818309
[]
no_license
holycaous/P.O.D
2758840c4fead1479ecfcab613fc3c719524291b
20e32c4cfbbf01e4a93b9286a0ba68fa9c03220d
refs/heads/master
2020-05-21T18:05:28.732875
2017-01-24T18:18:10
2017-01-24T18:18:10
63,501,643
2
0
null
2016-10-25T06:58:51
2016-07-16T20:45:37
C++
UTF-8
C++
false
false
243
cpp
#include "StdAfx.h" cMonster_Info::cMonster_Info(UINT Type, float HP, float posX, float posY, float posZ) :CObject() { m_Type = Type; m_HP = HP; m_Pos_x = posX; m_Pos_y = posY; m_Pos_z = posZ; } cMonster_Info::~cMonster_Info(void) { }
[ "tory6486@naver.com" ]
tory6486@naver.com
b87ca23896e958452ed852bcbd53b44b2b7118ed
d573c5f4e2e2e13f16c74845d29d12a8417e83f3
/frc-2018/src/main/include/Commands/AutoCommand.h
3d71ae9153645c1c97b1726f1c4c460e6492475e
[]
no_license
Frc2481/frc-2018
01075ba5a0f9f46b93094bdc4a57acf90d048fbe
7c035fe84db4894a90853fb1925583c2f9a79d29
refs/heads/master
2021-03-27T13:27:42.163292
2019-03-09T04:24:04
2019-03-09T04:24:04
117,299,772
4
1
null
2019-03-09T04:24:05
2018-01-13T00:05:05
C++
UTF-8
C++
false
false
387
h
/* * AutoCommand.h * * Created on: Feb 6, 2018 * Author: FIRSTMentor */ #ifndef SRC_COMMANDS_AUTOCOMMAND_H_ #define SRC_COMMANDS_AUTOCOMMAND_H_ #include "CommandBase.h" class AutoCommand : public CommandBase{ public: AutoCommand() : CommandBase("AutoCommand"){} virtual ~AutoCommand(){} bool IsFinished() { return true; } }; #endif /* SRC_COMMANDS_AUTOCOMMAND_H_ */
[ "mhoosen2@gmail.com" ]
mhoosen2@gmail.com
e60c10319476d4c28767839abb02d6471650bca8
f3bdc5713fcbf31a5098e5c6bc7b536f63be1609
/GameEngine/src/WebImage.h
c796a6a9a3c9fc8e58694cb02e512a77313c7363
[]
no_license
leonardo98/GameEngine
1cceaf0f6dc8bc66d9d1862f8523b8199ef54356
2f3c218437434c05afe9eaac0900c3ff46ff7055
refs/heads/master
2020-04-05T22:56:53.009769
2015-07-16T14:59:07
2015-07-16T14:59:07
33,198,384
0
0
null
null
null
null
UTF-8
C++
false
false
565
h
#pragma once #include "Actor.h" #include <string> namespace oxygine { DECLARE_SMART(HttpRequestTask, spHttpRequestTask); DECLARE_SMART(Sprite, spSprite); DECLARE_SMART(WebImage, spWebImage); class WebImage : public _Actor { public: DECLARE_COPYCLONE(WebImage); WebImage(); ~WebImage(); void load(const std::string &url); void unload(); private: void loaded(Event*); void error(Event*); spSprite _image; spHttpRequestTask _http; }; } #ifdef OX_EDITOR #include "EditorWebImage.h" #else typedef oxygine::WebImage BaseWebImage; #endif
[ "am98pln@gmail.com" ]
am98pln@gmail.com
862b1571c4a26063affd157f499c859274bb0ecf
abfeed27920b038bdc2296e4854fb836107f5c81
/Graphs-Dijkstra'sShortestPath/Planet.h
d2308336db94c2686518f51725813fea1d1af1ff
[]
no_license
kbaumst2/Data-Structures-and-Algorithms
8affe02d75393fa6823a945bc0263d6a8ada37ec
b9f1ba594e093b516a77c42f9b8dc82c1ecb1b72
refs/heads/master
2020-07-23T02:47:40.993582
2019-09-09T23:54:46
2019-09-09T23:54:46
207,424,046
0
0
null
null
null
null
UTF-8
C++
false
false
588
h
#ifndef PLANET_H #define PLANET_H #include <iostream> #include <cstdlib> #include <string> #include <list> #include <vector> class Planet{ private: std::string name; long xCoor; long yCoor; long zCoor; public: bool explored; double dist; Planet * optPrev; // char flag = 'w'; std::vector<Planet*> adjacents; double distanceBetween(Planet * p2); Planet(std::string planetName, long xCoor, long yCoor, long zCoor); std::string getName(); long getXCoor(); long getYCoor(); long getZCoor(); std::list<Planet*> getAdjacent(); std::vector<Planet*> getAdjacentV(); }; #endif
[ "kbaumst2@binghamton.edu" ]
kbaumst2@binghamton.edu
71b0789672274bb1a79bab2f509c1b185dbfd346
0531065a63cd20d9628de66994b8e007e91f24f3
/src/Interface/CFrame.hpp
3a4875003875d0a49581d98785f88a7d167743b5
[]
no_license
Sebajuste/Omeglond3D
a91590e87bcf835d36c85821cce60aef268662e0
28a3910b47490ec837a29e40e132369f957aedc7
refs/heads/master
2020-05-09T17:09:04.321541
2019-04-14T11:23:32
2019-04-14T11:23:32
181,298,014
4
0
null
null
null
null
UTF-8
C++
false
false
1,336
hpp
#ifndef _DEF_OMEGLOND3D_CFRAME_HPP #define _DEF_OMEGLOND3D_CFRAME_HPP #include "CComponent.hpp" #include "../Core/ITexture.hpp" #include "../Font/IFont.hpp" #include "../Model/IStaticModel.hpp" #include "../Utils/Export.hpp" #include <vector> namespace OMGL3D { namespace UI { class EXPORT CFrame : public CComponent { public: CFrame(const std::string & name); void SetBackground(const std::string & name); void SetTitle(const std::string & title, const std::string & font); void SetDrawnable(bool drawn); bool IsDrawnable() const; void AddComponent(CComponent * component); std::vector<UTILS::ptr<CComponent>::SharedPtr> & GetListComponent(); void OnEvent(const MouseEvent & event); void Draw(); private: bool _hold; int _mousex, _mousey; bool _drawn; UTILS::ptr<MODEL::IStaticModel>::ResourcePtr _model; UTILS::ptr<CORE::ITexture>::ResourcePtr _background; UTILS::ptr<FONT::IFont>::ResourcePtr _font; std::string _title; std::vector<UTILS::ptr<CComponent>::SharedPtr> _list_component; }; } } #endif
[ "Sebastien@192.168.1.28" ]
Sebastien@192.168.1.28
e109d91a36d8cf46e4affd91cdc175be11aa4c05
fbbc663c607c9687452fa3192b02933b9eb3656d
/tags/1.21.01.00/mptrack/Ctrl_gen.h
aa56bfe11d3dde3c7fc86ae33fccb87138b43ebf
[ "BSD-3-Clause" ]
permissive
svn2github/OpenMPT
594837f3adcb28ba92a324e51c6172a8c1e8ea9c
a2943f028d334a8751b9f16b0512a5e0b905596a
refs/heads/master
2021-07-10T05:07:18.298407
2019-01-19T10:27:21
2019-01-19T10:27:21
106,434,952
2
1
null
null
null
null
UTF-8
C++
false
false
2,824
h
/* * ctrl_gen.h * ---------- * Purpose: General tab, upper panel. * Notes : (currently none) * Authors: Olivier Lapicque * OpenMPT Devs * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. */ #pragma once //========================= class CVuMeter: public CWnd //========================= { protected: LONG m_nDisplayedVu, m_nVuMeter; public: CVuMeter() { m_nDisplayedVu = -1; m_nVuMeter = 0; } VOID SetVuMeter(LONG lVuMeter); protected: VOID DrawVuMeter(HDC hdc); protected: afx_msg void OnPaint(); DECLARE_MESSAGE_MAP(); }; enum { MAX_SLIDER_GLOBAL_VOL=256, MAX_SLIDER_VSTI_VOL=255, MAX_SLIDER_SAMPLE_VOL=255 }; //======================================= class CCtrlGeneral: public CModControlDlg //======================================= { public: CCtrlGeneral(); LONG* GetSplitPosRef() {return &CMainFrame::GetSettings().glGeneralWindowHeight;} //rewbs.varWindowSize private: void setAsDecibels(LPSTR stringToSet, double value, double valueAtZeroDB); // Determine how the global volume slider should be scaled to actual global volume. // Display range for XM / S3M should be 0...64, for other formats it's 0...256. UINT GetGlobalVolumeFactor() { return (m_pSndFile->GetType() & (MOD_TYPE_XM | MOD_TYPE_S3M)) ? UINT(MAX_SLIDER_GLOBAL_VOL / 64) : UINT(MAX_SLIDER_GLOBAL_VOL / 128); } public: bool m_bEditsLocked; //{{AFX_DATA(CCtrlGeneral) CEdit m_EditTitle; CStatic m_EditModType; CEdit m_EditTempo, m_EditSpeed, m_EditGlobalVol, m_EditRestartPos, m_EditSamplePA, m_EditVSTiVol; CSpinButtonCtrl m_SpinTempo, m_SpinSpeed, m_SpinGlobalVol, m_SpinRestartPos, m_SpinSamplePA, m_SpinVSTiVol; CSliderCtrl m_SliderTempo, m_SliderSamplePreAmp, m_SliderGlobalVol, m_SliderVSTiVol; CVuMeter m_VuMeterLeft, m_VuMeterRight; //}}AFX_DATA //{{AFX_VIRTUAL(CCtrlGeneral) virtual BOOL OnInitDialog(); virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support virtual void RecalcLayout(); virtual void UpdateView(DWORD dwHintMask=0, CObject *pObj=NULL); virtual CRuntimeClass *GetAssociatedViewClass(); virtual void OnActivatePage(LPARAM); virtual void OnDeactivatePage(); virtual BOOL GetToolTipText(UINT uId, LPSTR pszText); //}}AFX_VIRTUAL protected: //{{AFX_MSG(CCtrlGeneral) afx_msg LRESULT OnUpdatePosition(WPARAM, LPARAM); afx_msg void OnVScroll(UINT, UINT, CScrollBar *); afx_msg void OnTitleChanged(); afx_msg void OnTempoChanged(); afx_msg void OnSpeedChanged(); afx_msg void OnGlobalVolChanged(); afx_msg void OnVSTiVolChanged(); afx_msg void OnSamplePAChanged(); afx_msg void OnRestartPosChanged(); afx_msg void OnSongProperties(); afx_msg void OnPlayerProperties(); afx_msg void OnLoopSongChanged(); afx_msg void OnEnSetfocusEditSongtitle(); //}}AFX_MSG DECLARE_MESSAGE_MAP() };
[ "saga-games@56274372-70c3-4bfc-bfc3-4c3a0b034d27" ]
saga-games@56274372-70c3-4bfc-bfc3-4c3a0b034d27
35cdacbc104da4d6b2b2a1e49ba5734d427910c0
83e8de12d7af457840de0da581ef8db1d96dc1fb
/atcoder_scores/400/abc153.cpp
af8668c2b658eed0a637dc9d002e87d08413073f
[]
no_license
watchmen-r/atcoder_learning
3b13340830f7ea32e594028eba9da88c1043b650
9377a439afc5fc62d1fec1fffcab33fc4565a143
refs/heads/master
2022-04-01T20:36:59.456628
2020-02-04T14:44:50
2020-02-04T14:44:50
222,950,951
1
0
null
null
null
null
UTF-8
C++
false
false
328
cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll h; cin >> h; ll zyou = 1; ll ans = 0; while(true){ if(h>=1){ ans += zyou; zyou *= 2; }else{ break; } h /= 2; } cout << ans << endl; return 0; }
[ "watchmen0205@yahoo.co.jp" ]
watchmen0205@yahoo.co.jp
bd04c0a05791e3ae515fdb453ab4424dea7450ef
4f62797d4d19e747fdf037779cc4e486d8afd627
/Linux/Demo/Linux_g++_mem_pools_static/main.cpp
777fa47aefe3beb14f7849d603adfa7def027e1a
[ "GPL-1.0-or-later", "GPL-2.0-only", "MIT", "GPL-2.0-or-later", "GPL-3.0-only" ]
permissive
michaelbecker/freertos-addons
6fbe25154a49b4f540fbd5a8065651335eca507b
76326f9d16cdd9aaf9d8c1195df64a4b90bebc08
refs/heads/master
2023-05-25T00:06:38.778423
2023-05-11T13:15:29
2023-05-11T13:15:29
59,873,254
420
116
MIT
2023-07-07T14:57:09
2016-05-28T02:16:48
C
UTF-8
C++
false
false
8,758
cpp
/**************************************************************************** * * Copyright (c) 2023, Michael Becker (michael.f.becker@gmail.com) * * This file is part of the FreeRTOS Add-ons project. * * Source Code: * https://github.com/michaelbecker/freertos-addons * * Project Page: * http://michaelbecker.github.io/freertos-addons/ * * On-line Documentation: * http://michaelbecker.github.io/freertos-addons/docs/html/index.html * * MIT License * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files * (the "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so,subject to the * following conditions: * * + The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * + Credit is appreciated, but not required, if you find this project * useful enough to include in your application, product, device, etc. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ***************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <cstring> #include <iostream> #include "FreeRTOS.h" #include "task.h" #include "thread.hpp" #include "ticks.hpp" #include "mem_pool.hpp" using namespace cpp_freertos; using namespace std; MemoryPool *pool_1; MemoryPool *pool_2; MemoryPool *pool_3; MemoryPool *pool_4; MemoryPool *pool_5; MemoryPool *pool_6; MemoryPool *pool_7; MemoryPool *pool_8; MemoryPool *pool_9; #define NUM_POOL_1_ITEMS 10 #define NUM_POOL_2_ITEMS 10 #define NUM_POOL_3_ITEMS 10 #define NUM_POOL_4_ITEMS 10 #define NUM_POOL_5_ITEMS 10 #define NUM_POOL_6_ITEMS 10 #define NUM_POOL_7_ITEMS 10 #define NUM_POOL_8_ITEMS 10 #define NUM_POOL_9_ITEMS 10 #define POOL_1_ITEM_SIZE 1 #define POOL_2_ITEM_SIZE 2 #define POOL_3_ITEM_SIZE 3 #define POOL_4_ITEM_SIZE 4 #define POOL_5_ITEM_SIZE 5 #define POOL_6_ITEM_SIZE 6 #define POOL_7_ITEM_SIZE 7 #define POOL_8_ITEM_SIZE 8 #define POOL_9_ITEM_SIZE 9 unsigned char Buffer1[NUM_POOL_1_ITEMS * POOL_1_ITEM_SIZE]; unsigned char Buffer2[NUM_POOL_2_ITEMS * POOL_2_ITEM_SIZE]; unsigned char Buffer3[NUM_POOL_3_ITEMS * POOL_3_ITEM_SIZE]; unsigned char Buffer4[NUM_POOL_4_ITEMS * POOL_4_ITEM_SIZE]; unsigned char Buffer5[NUM_POOL_5_ITEMS * POOL_5_ITEM_SIZE]; unsigned char Buffer6[NUM_POOL_6_ITEMS * POOL_6_ITEM_SIZE]; unsigned char Buffer7[NUM_POOL_7_ITEMS * POOL_7_ITEM_SIZE]; unsigned char Buffer8[NUM_POOL_8_ITEMS * POOL_8_ITEM_SIZE]; unsigned char Buffer9[NUM_POOL_9_ITEMS * POOL_9_ITEM_SIZE]; class TestThread : public Thread { public: TestThread(string name, int delayInSeconds, int patternStart) : Thread(name, 100, 1), DelayInSeconds(delayInSeconds), PatternStart(patternStart) { // // Now that construction is completed, we // can safely start the thread. // Start(); }; protected: virtual void Run() { cout << "Starting thread " << GetName() << endl; TickType_t ticks = Ticks::SecondsToTicks(DelayInSeconds); Delay(ticks); int run_cnt = 0; while (true) { ticks = Ticks::MsToTicks(1); Delay(ticks); StressPool(pool_1, NUM_POOL_1_ITEMS, 1); StressPool(pool_2, NUM_POOL_2_ITEMS, 2); StressPool(pool_3, NUM_POOL_3_ITEMS, 3); StressPool(pool_4, NUM_POOL_4_ITEMS, 4); StressPool(pool_5, NUM_POOL_5_ITEMS, 5); StressPool(pool_6, NUM_POOL_6_ITEMS, 6); StressPool(pool_7, NUM_POOL_7_ITEMS, 7); StressPool(pool_8, NUM_POOL_8_ITEMS, 8); StressPool(pool_9, NUM_POOL_9_ITEMS, 9); if (run_cnt++ > 1) { run_cnt = 0; cout << "Running thread " << GetName() << endl; } } }; private: int DelayInSeconds; int PatternStart; // // Generic function to stress a memory pool. // void StressPool(MemoryPool *p, int NumPoolItems, int dataSize) { // // Create an array to hold the addresses we will alloc. // unsigned char **addr = new unsigned char *[NumPoolItems + 1]; // // Set up the unique pattern(s) we are going to fill in. // int localStart = PatternStart; // // Try to allocate the whole pool. // for (int i = 0; i < NumPoolItems + 1; i++) { addr[i] = (unsigned char*)p->Allocate(); // // If you got an item, fill it with a known pattern, // and create the next pattern. // if (addr[i]) { memset(addr[i], localStart, dataSize); localStart++; } } // // Wait a bit just to allow multithreading to randomize things. // We want the threads competing for the pools. // TickType_t ticks = Ticks::MsToTicks(PatternStart); Delay(ticks); // // Now check and free. // for (int i = 0; i < NumPoolItems + 1; i++) { if (addr[i]) { // // If we allocated an item from the pool, verify all // bytes are what we think they should be. // for (int j = 0; j < dataSize; j++) { configASSERT(addr[i][j] == PatternStart); } // // We are working with bytes so make sure we wrap. // if (++PatternStart >= 256) { PatternStart = 0; } // // Poison the memory before freeing it. // memset(addr[i], 0xEE, dataSize); p->Free(addr[i]); addr[i] = NULL; } } delete [] addr; } }; int main (void) { cout << "Testing FreeRTOS C++ wrappers" << endl; cout << "MemoryPool Testing - Run this under Valgrind" << endl; TestThread thread1("Thread_1", 1, 1); TestThread thread2("Thread_2", 1, 3); TestThread thread3("Thread_3", 1, 5); TestThread thread4("Thread_4", 1, 7); TestThread thread5("Thread_5", 1, 11); pool_1 = new MemoryPool(POOL_1_ITEM_SIZE, Buffer1, sizeof(Buffer1), 1); pool_2 = new MemoryPool(POOL_2_ITEM_SIZE, Buffer2, sizeof(Buffer2), 2); pool_3 = new MemoryPool(POOL_3_ITEM_SIZE, Buffer3, sizeof(Buffer3), 4); pool_4 = new MemoryPool(POOL_4_ITEM_SIZE, Buffer4, sizeof(Buffer4), 8); pool_5 = new MemoryPool(POOL_5_ITEM_SIZE, Buffer5, sizeof(Buffer5), 16); pool_6 = new MemoryPool(POOL_6_ITEM_SIZE, Buffer6, sizeof(Buffer6), 32); pool_7 = new MemoryPool(POOL_7_ITEM_SIZE, Buffer7, sizeof(Buffer7), 64); pool_8 = new MemoryPool(POOL_8_ITEM_SIZE, Buffer8, sizeof(Buffer8), 128); pool_9 = new MemoryPool(POOL_9_ITEM_SIZE, Buffer9, sizeof(Buffer9), 256); Thread::StartScheduler(); // // We shouldn't ever get here unless someone calls // Thread::EndScheduler() // cout << "Scheduler ended!" << endl; return 0; } void vAssertCalled( unsigned long ulLine, const char * const pcFileName ) { printf("ASSERT: %s : %d\n", pcFileName, (int)ulLine); while(1); } unsigned long ulGetRunTimeCounterValue(void) { return 0; } void vConfigureTimerForRunTimeStats(void) { return; } extern "C" void vApplicationMallocFailedHook(void); void vApplicationMallocFailedHook(void) { while(1); }
[ "michael.f.becker@gmail.com" ]
michael.f.becker@gmail.com
a5098b00fce7cb5920021fa910d2c172a257c5ab
943df9ffb049370111b7a8197ac5fc1ce4be743a
/Sudoku Solver/Menu.h
8f608ceca40b8938c9895b6c9a2f4b5875a17cc6
[]
no_license
pawelzar/cpp-sudoku-solver
ab8588449a11c62d9b3a773f587c6dfa55fc643b
93502447f220d6c2d1843a45e6e51a8297c05390
refs/heads/master
2021-01-01T03:53:12.367415
2016-04-20T10:50:45
2016-04-20T10:50:45
56,679,274
0
0
null
null
null
null
UTF-8
C++
false
false
468
h
#ifndef MENU_H #define MENU_H #include <iostream> using namespace std; inline void Menu() { system("cls"); cout << " MENU:\n" << " A) Graj\n" << " B) Pomoc\n" << " C) Informacje\n" << " ESC) Wyjscie\n"; } inline void MenuWithBoard() { system("cls"); cout << " MENU:\n" << " A) Rozwiaz\n" << " B) Generuj nowe\n" << " C) Zapisz aktualne sudoku\n" << " D) Wczytaj ostatnie zapisane sudoku\n" << " ESC) Powrot do MENU\n\n"; } #endif // MENU_H
[ "pawelzaur@gmail.com" ]
pawelzaur@gmail.com
d35bd80468b5326299f737ee8b7eb8544d8a91ba
3ca7dd1e368194aa2f884139d01f802073cbbe0d
/Google/Kickstart/2018-03-18/B/B.cpp
760f66317774eecb6d406d5317b41c15b77a045a
[]
no_license
callistusystan/Algorithms-and-Data-Structures
07fd1a87ff3cfb07326f9f18513386a575359447
560e860ca1e546b7e7930d4e1bf2dd7c3acbcbc5
refs/heads/master
2023-02-17T17:29:21.678463
2023-02-11T09:12:40
2023-02-11T09:12:40
113,574,821
8
1
null
null
null
null
UTF-8
C++
false
false
831
cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pii; void solve() { int N,K; cin >> N >> K; vector<double> A(N); for (int i=0;i<N;i++) cin >> A[i]; sort(A.begin(), A.end()); vector<double> sum(N); for (int i=0;i<N;i++) { sum[i] = A[i]; if (i) sum[i] += sum[i-1]; } double prob = sum[N-1]/N; for (int i=0;i<K;i++) { int nBelowMean = upper_bound(A.begin(), A.end(), prob) - A.begin(); prob = nBelowMean*prob/N; if (nBelowMean == 0) prob += sum[N-1]/N; else prob += (sum[N-1]-sum[nBelowMean-1])/N; } cout << fixed << setprecision(12) << prob << endl; } int main() { ios::sync_with_stdio(0); cin.tie(0); int T; cin >> T; for (int i=1;i<=T;i++) { cout << "Case #" << i << ": "; solve(); } return 0; }
[ "callistusystan@gmail.com" ]
callistusystan@gmail.com
f0bb5e1a39a49c095577d8c135d76eaab01e2763
6c9151b55392ec2a8416a5062084036d8e2e1703
/program6/program6.cpp
28f7b9b887927c761dabd7587cee22fc8d3b685c
[]
no_license
Al-Mahmud-2019331048/c_plus_plus_tutorials
b522474106fd3d8321942da641804bead1c44a77
9423b9bbfcfb18a9c18ce67f74df69ae58180648
refs/heads/main
2023-02-25T02:41:45.396501
2021-01-25T13:06:38
2021-01-25T13:06:38
405,417,031
2
0
null
2021-09-11T15:40:22
2021-09-11T15:40:22
null
UTF-8
C++
false
false
465
cpp
#include <iostream> #include <conio.h> using namespace std; int main () { char name[20]; float gpa; // taking user input cout << "Enter your name : " << endl; cin >> name; cout << "Enter your gpa : " << endl; cin >> gpa; //printing cout << "---------------------------" << endl; cout << "Name : " << name << endl; cout << "GPA : " << gpa << endl; cout << "---------------------------" << endl; getch(); }
[ "anisul.islam@tuni.fi" ]
anisul.islam@tuni.fi
b081e2d851c5d70310da22717fc0b823a9bbe379
74b5ee447d8544ef9a9ad86d71181965b46ba7b0
/src/saiga/vulkan/lighting/Shadowmap.cpp
453ad0088dc1efbf6f34966acae6998ef0e1ccb7
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
mharrer97/saiga
d15273ff9909c59611d1df0c1bc5f1026ac04174
d8faed6e1f1d87784457ee4897ed2b037f4e9fbc
refs/heads/master
2020-06-14T01:14:27.983392
2020-02-11T16:35:12
2020-02-11T16:35:12
194,846,767
0
0
null
2019-07-02T11:03:45
2019-07-02T11:03:45
null
UTF-8
C++
false
false
7,308
cpp
/** * Copyright (c) 2017 Darius Rückert * Licensed under the MIT License. * See LICENSE file for more information. * * Created by Mathias Harrer: mathias.mh.harrer@fau.de */ #include "saiga/vulkan/lighting/Shadowmap.h" //#include "saiga/opengl/error.h" //#include "saiga/opengl/texture/cube_texture.h" namespace Saiga { namespace Vulkan { namespace Lighting { /* void ShadowmapBase::bindFramebuffer() { #if defined(SAIGA_DEBUG) depthBuffer.check(); #endif glViewport(0, 0, w, h); depthBuffer.bind(); glClear(GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST); glDepthMask(GL_TRUE); } void ShadowmapBase::unbindFramebuffer() { depthBuffer.unbind(); } */ SimpleShadowmap::SimpleShadowmap() : shadowBuffer() {} void SimpleShadowmap::init(VulkanBase& base, int w, int h, vk::RenderPass shadowPass) //, ShadowQuality quality) { this->w = w; this->h = h; // depthBuffer.create(); // depthBuffer.unbind(); shadowBuffer = std::make_shared<ShadowBuffer>(); shadowBuffer->destroy(); shadowBuffer->init(base, w, h); frameBuffer.destroy(); frameBuffer.createDepth(w, h, shadowBuffer->location->data.view, shadowPass, base.device); /*std::shared_ptr<Texture> depth = std::make_shared<Texture>(); switch (quality) { case ShadowQuality::LOW: depth->createEmptyTexture(w, h, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT16, GL_UNSIGNED_SHORT); break; case ShadowQuality::MEDIUM: depth->createEmptyTexture(w, h, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT32, GL_UNSIGNED_INT); break; case ShadowQuality::HIGH: depth->createEmptyTexture(w, h, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT32F, GL_FLOAT); break; } // depth->createEmptyTexture(w,h,GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT32,GL_UNSIGNED_INT); // depth->setWrap(GL_CLAMP_TO_EDGE); depth->setWrap(GL_CLAMP_TO_BORDER); // depth->setBorderColor(vec4(1.0f)); depth->setBorderColor(make_vec4(0.0f)); // no light on the outside depth->setFiltering(GL_LINEAR); // this requires the texture sampler in the shader to be sampler2DShadow depth->setParameter(GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE); depth->setParameter(GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL); depthTexture = depth; depthBuffer.attachTextureDepth(depth); depthBuffer.check(); // initialized = true; assert_no_glerror();*/ } /*CubeShadowmap::CubeShadowmap(int w, int h, ShadowQuality quality) { this->w = w; this->h = h; depthBuffer.create(); depthBuffer.unbind(); auto cubeMap = std::make_shared<TextureCube>(); // cubeMap->createEmptyTexture(w,h,GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT16,GL_UNSIGNED_SHORT); switch (quality) { case ShadowQuality::LOW: cubeMap->createEmptyTexture(w, h, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT16, GL_UNSIGNED_SHORT); break; case ShadowQuality::MEDIUM: cubeMap->createEmptyTexture(w, h, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT32, GL_UNSIGNED_INT); break; case ShadowQuality::HIGH: cubeMap->createEmptyTexture(w, h, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT32F, GL_FLOAT); break; } // cubeMap->createEmptyTexture(w,h,GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT32,GL_UNSIGNED_INT); cubeMap->setWrap(GL_CLAMP_TO_EDGE); cubeMap->setFiltering(GL_LINEAR); // this requires the texture sampler in the shader to be samplerCubeShadow cubeMap->setParameter(GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE); cubeMap->setParameter(GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL); depthTexture = cubeMap; // deleteTexture = cubeMap; // initialized = true; assert_no_glerror(); } void CubeShadowmap::bindCubeFace(GLenum side) { glViewport(0, 0, w, h); depthBuffer.bind(); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, side, getDepthTexture()->getId(), 0); // depthBuffer.drawToNone(); glClear(GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST); glDepthMask(GL_TRUE); #if defined(SAIGA_DEBUG) depthBuffer.check(); #endif } CascadedShadowmap::CascadedShadowmap(int w, int h, int numCascades, ShadowQuality quality) { this->w = w; this->h = h; depthBuffer.create(); depthBuffer.unbind(); #if 0 for(int i = 0 ; i < numCascades; ++i){ std::shared_ptr<Texture> depth = std::make_shared<Texture>(); switch(quality){ case ShadowQuality::LOW: depth->createEmptyTexture(w,h,GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT16,GL_UNSIGNED_SHORT); break; case ShadowQuality::MEDIUM: depth->createEmptyTexture(w,h,GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT32,GL_UNSIGNED_INT); break; case ShadowQuality::HIGH: depth->createEmptyTexture(w,h,GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT32F,GL_FLOAT); break; } // depth->createEmptyTexture(w,h,GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT32,GL_UNSIGNED_INT); // depth->setWrap(GL_CLAMP_TO_EDGE); depth->setWrap(GL_CLAMP_TO_BORDER); depth->setBorderColor(vec4(1.0f)); depth->setFiltering(GL_LINEAR); //this requires the texture sampler in the shader to be sampler2DShadow depth->setParameter(GL_TEXTURE_COMPARE_MODE,GL_COMPARE_REF_TO_TEXTURE); depth->setParameter(GL_TEXTURE_COMPARE_FUNC,GL_LEQUAL); depthTextures.push_back(depth); } #endif depthTexture = std::make_shared<ArrayTexture2D>(); switch (quality) { case ShadowQuality::LOW: depthTexture->createEmptyTexture(w, h, numCascades, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT16, GL_UNSIGNED_SHORT); break; case ShadowQuality::MEDIUM: depthTexture->createEmptyTexture(w, h, numCascades, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT32, GL_UNSIGNED_INT); break; case ShadowQuality::HIGH: depthTexture->createEmptyTexture(w, h, numCascades, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT32F, GL_FLOAT); break; } depthTexture->setWrap(GL_CLAMP_TO_BORDER); depthTexture->setBorderColor(make_vec4(1.0f)); depthTexture->setFiltering(GL_LINEAR); // this requires the texture sampler in the shader to be sampler2DShadow depthTexture->setParameter(GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE); depthTexture->setParameter(GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL); assert_no_glerror(); } void CascadedShadowmap::bindAttachCascade(int n) { glViewport(0, 0, w, h); depthBuffer.bind(); glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depthTexture->getId(), 0, n); // depthBuffer.attachTextureDepth(getDepthTexture(n)); // glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, side, getDepthTexture(0)->getId(), 0); // depthBuffer.drawToNone(); glClear(GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST); glDepthMask(GL_TRUE); #if defined(SAIGA_DEBUG) depthBuffer.check(); #endif } */ } // namespace Lighting } // namespace Vulkan } // namespace Saiga
[ "mathias.mh.harrer@fau.de" ]
mathias.mh.harrer@fau.de
0ea5d48072647fd14fa13b7b4cb163670f7cd856
5c31d08dc4d892d2de712fb403a0fb993b519983
/abc081/b.cpp
d431330bceb31468939d8c16ac420a4ff7d6d9f2
[]
no_license
urib0/atcoder
d4a691423ee4e14cb5a2109015410ce3daa48637
891c1a30d8233982220a4b817056c7f3331dcec4
refs/heads/master
2022-04-25T21:21:51.449695
2020-04-26T16:01:07
2020-04-26T16:01:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
735
cpp
#include<iostream> #include<cstring> using namespace std; int check(long long int *a, int n); void div(long long int *a, int n); int main(){ int i,n,res = 0; long long int a[200] = {0}; cin >> n; for( i = 0; i < n; i++){ cin >> a[i]; } while( 1 ){ if( check( a, n) ){ break; } else{ div( a, n ); res++; } } cout << res << "\n"; } int check(long long int *a, int n){ int i,res = 0; for( i = 0; i < n; i++){ if( a[i] % 2 == 1 ){ res++; break; } } return res; } void div(long long int *a, int n){ int i; for( i = 0; i < n; i++ ){ a[i] /= 2; } }
[ "ur1b0.dev@gmail.com" ]
ur1b0.dev@gmail.com
a336ea4f1bcc8d44da812959ce99e93b23238394
676a84034edec9578c0d290b73699da2e9d71c77
/src/qt/qtipcserver.cpp
db84c8774081aa01e47829d65d5f5c291d275891
[ "MIT" ]
permissive
MrSilver6666/CB
d54981cc572578fa5f948e5189f06ead66205f9a
bb9f68cae7267395c0f2cd1fd4ac8d660ecd5ca1
refs/heads/master
2016-09-06T13:01:59.529982
2014-11-14T09:00:35
2014-11-14T09:00:35
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,935
cpp
// Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <boost/version.hpp> #if defined(WIN32) && BOOST_VERSION == 104900 #define BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME #define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME #endif #include "qtipcserver.h" #include "guiconstants.h" #include "ui_interface.h" #include "util.h" #include <boost/algorithm/string/predicate.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/interprocess/ipc/message_queue.hpp> #include <boost/version.hpp> #if defined(WIN32) && (!defined(BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME) || !defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME) || BOOST_VERSION < 104900) #warning Compiling without BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME and BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME uncommented in boost/interprocess/detail/tmp_dir_helpers.hpp or using a boost version before 1.49 may have unintended results see svn.boost.org/trac/boost/ticket/5392 #endif using namespace boost; using namespace boost::interprocess; using namespace boost::posix_time; #if defined MAC_OSX || defined __FreeBSD__ // URI handling not implemented on OSX yet void ipcScanRelay(int argc, char *argv[]) { } void ipcInit(int argc, char *argv[]) { } #else static void ipcThread2(void* pArg); static bool ipcScanCmd(int argc, char *argv[], bool fRelay) { // Check for URI in argv bool fSent = false; for (int i = 1; i < argc; i++) { if (boost::algorithm::istarts_with(argv[i], "CryptoBancor:")) { const char *strURI = argv[i]; try { boost::interprocess::message_queue mq(boost::interprocess::open_only, BITCOINURI_QUEUE_NAME); if (mq.try_send(strURI, strlen(strURI), 0)) fSent = true; else if (fRelay) break; } catch (boost::interprocess::interprocess_exception &ex) { // don't log the "file not found" exception, because that's normal for // the first start of the first instance if (ex.get_error_code() != boost::interprocess::not_found_error || !fRelay) { printf("main() - boost interprocess exception #%d: %s\n", ex.get_error_code(), ex.what()); break; } } } } return fSent; } void ipcScanRelay(int argc, char *argv[]) { if (ipcScanCmd(argc, argv, true)) exit(0); } static void ipcThread(void* pArg) { // Make this thread recognisable as the GUI-IPC thread RenameThread("CryptoBancor-gui-ipc"); try { ipcThread2(pArg); } catch (std::exception& e) { PrintExceptionContinue(&e, "ipcThread()"); } catch (...) { PrintExceptionContinue(NULL, "ipcThread()"); } printf("ipcThread exited\n"); } static void ipcThread2(void* pArg) { printf("ipcThread started\n"); message_queue* mq = (message_queue*)pArg; char buffer[MAX_URI_LENGTH + 1] = ""; size_t nSize = 0; unsigned int nPriority = 0; while (true) { ptime d = boost::posix_time::microsec_clock::universal_time() + millisec(100); if (mq->timed_receive(&buffer, sizeof(buffer), nSize, nPriority, d)) { uiInterface.ThreadSafeHandleURI(std::string(buffer, nSize)); MilliSleep(1000); } if (fShutdown) break; } // Remove message queue message_queue::remove(BITCOINURI_QUEUE_NAME); // Cleanup allocated memory delete mq; } void ipcInit(int argc, char *argv[]) { message_queue* mq = NULL; char buffer[MAX_URI_LENGTH + 1] = ""; size_t nSize = 0; unsigned int nPriority = 0; try { mq = new message_queue(open_or_create, BITCOINURI_QUEUE_NAME, 2, MAX_URI_LENGTH); // Make sure we don't lose any bitcoin: URIs for (int i = 0; i < 2; i++) { ptime d = boost::posix_time::microsec_clock::universal_time() + millisec(1); if (mq->timed_receive(&buffer, sizeof(buffer), nSize, nPriority, d)) { uiInterface.ThreadSafeHandleURI(std::string(buffer, nSize)); } else break; } // Make sure only one bitcoin instance is listening message_queue::remove(BITCOINURI_QUEUE_NAME); delete mq; mq = new message_queue(open_or_create, BITCOINURI_QUEUE_NAME, 2, MAX_URI_LENGTH); } catch (interprocess_exception &ex) { printf("ipcInit() - boost interprocess exception #%d: %s\n", ex.get_error_code(), ex.what()); return; } if (!NewThread(ipcThread, mq)) { delete mq; return; } ipcScanCmd(argc, argv, false); } #endif
[ "CB" ]
CB
17e3a1a9685a39d5b58758b71ceababf027f2ec0
8ae41115b878aa5c14fbf13ddbc681282762ae32
/FushigiDungeon/Timer.cpp
3a245608c43e35b37ed8598983f333cf34f497c2
[]
no_license
assbee0/FushigiDungeonCplus
be0aab3151430204d379e70723ccee3a44d7a074
e83978ba394aae116412b3e0ba46bfc97afa8d37
refs/heads/master
2023-03-07T15:22:08.795508
2021-02-20T15:11:53
2021-02-20T15:11:53
332,395,764
1
1
null
null
null
null
UTF-8
C++
false
false
148
cpp
#include "Timer.h" Timer::Timer() { } // The time of last frame float Timer::deltaTime = 0; // Total time cost unsigned int Timer::ticksCount = 0;
[ "niuniu9785@hotmail.com" ]
niuniu9785@hotmail.com
19442ec6797f75890da57de560998e61bbeae82d
f537f2d046eb1532dae030c01a7daca2abb31d18
/IO/tcpsocket.hpp
34f4a0f10178d8c795e93527cc5cd36da26b337f
[]
no_license
Amos-Q/Linux
871975da8b8b4660a4fade1915ca141e73aa431f
c44e7843c13936a1f147ff7b26d304d9303aa048
refs/heads/master
2021-03-03T14:09:29.990343
2020-09-08T07:55:20
2020-09-08T07:55:20
245,965,824
0
0
null
null
null
null
GB18030
C++
false
false
3,375
hpp
#pragma once #include <cstdio> #include <string> #include <unistd.h> #include <netinet/in.h> #include <arpa/inet.h> #include <sys/socket.h> //listen的第二个参数决定同一时间能够接收多少客户端连接 ////并不决定整体通信能够接收多少客户端连接 #define MAX_LISTEN 5 #define CHECK_RET(q) if((q)==false){return -1;} class TcpSocket { public: TcpSocket ():_sockfd(-1){} int GetFd() { return _sockfd; } void SetFd(int fd) { _sockfd = fd; } bool Socket() { //socket(地址域, 套接字类型, 协议类型) _sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (_sockfd < 0) { perror("socket error"); return false; } return true; } bool Bind(const std::string &ip, uint16_t port) { struct sockaddr_in addr; addr.sin_family = AF_INET; addr.sin_port = htons(port); addr.sin_addr.s_addr = inet_addr(ip.c_str()); socklen_t len = sizeof(struct sockaddr_in); int ret = bind(_sockfd, (struct sockaddr*)&addr, len); if (ret < 0) { perror("bind error"); return false; } return true; } bool Listen(int backlog = MAX_LISTEN) { //listen(套接字描述符, 最大并发连接数) int ret = listen(_sockfd, backlog); if (ret < 0) { perror("listen error"); return false; } return true; } bool Accept(TcpSocket *new_sock, std::string *ip=NULL, uint16_t *port=NULL) { //新建套接字描述符 = accept(监听套接字描述符, 客户端地址信息,地址长度); struct sockaddr_in addr; socklen_t len = sizeof(addr); int new_fd = accept(_sockfd, (struct sockaddr*)&addr, &len); if (new_fd < 0) { perror("accept error"); return false; } new_sock->_sockfd = new_fd; if (ip != NULL) { (*ip) = inet_ntoa(addr.sin_addr); } if (port != NULL) { *port = ntohs(addr.sin_port); } return true; } bool Recv(std::string *buf) { //recv(通信套接字描述符,缓冲区首地址,接收数据长度, 标志位-0阻塞) char tmp[4096] = {0}; int ret = recv(_sockfd, tmp, 4096, 0); if (ret < 0) { perror("recv error"); return false; }else if (ret == 0) {//recv默认阻塞,没有数据就会等待,返回0,表示连接断开 printf("connection broken\n"); return false; } buf->assign(tmp, ret); return true; } bool Send(const std::string &data) { //send(描述符,要发送数据首地址,要发送的数据长度,标志位-0阻塞) int ret = send(_sockfd, data.c_str(), data.size(), 0); if (ret < 0) { perror("send error"); return false; } return true; } bool Close() { if (_sockfd > 0) { close(_sockfd); _sockfd = -1; } return true; } bool Connect(const std::string &ip, uint16_t port) { //向服务端发起连接 //connect(描述符, 服务端地址信息, 地址信息长度) struct sockaddr_in addr; addr.sin_family = AF_INET; addr.sin_port = htons(port); addr.sin_addr.s_addr = inet_addr(ip.c_str()); socklen_t len = sizeof(struct sockaddr_in); int ret = connect(_sockfd, (struct sockaddr *)&addr, len); if (ret < 0) { perror("connect error"); return false; } return true; } private: int _sockfd; };
[ "1334819112@qq.com" ]
1334819112@qq.com
bbc0cfefdd3a4bfe1ef89814067ff4c06d32ce75
a2111a80faf35749d74a533e123d9da9da108214
/raw/pmsb13/pmsb13-data-20130530/sources/b26wz51ypvk5m3bf/2013-04-09T15-21-23.343+0200/sandbox/my_sandbox/apps/first_app/first_app.cpp
14381a129a09cc97c5c790c617b0cdd93807749c
[ "MIT" ]
permissive
bkahlert/seqan-research
f2c550d539f511825842a60f6b994c1f0a3934c2
21945be863855077eec7cbdb51c3450afcf560a3
refs/heads/master
2022-12-24T13:05:48.828734
2015-07-01T01:56:22
2015-07-01T01:56:22
21,610,669
1
0
null
null
null
null
UTF-8
C++
false
false
1,281
cpp
#include <iostream> #include <seqan/sequence.h> #include <seqan/file.h> using namespace seqan; // Function to print simple alignment between two sequences with the same length // .. for two sequences of the same type template <typename TText> void printAlign(TText const & genomeFragment, TText const & read) { std::cout << "Alignment " << std::endl; std::cout << " genome : "; std::cout << genomeFragment << std::endl; std::cout << " read : "; std::cout << read << std::endl; } int main() { // We have given a genome sequence Dna5String genome = "ATGGTTTCAACGTAATGCTGAACATGTCGCGT"; // A read sequence Dna5String read = "TGGTNTCA"; // And the begin position of a given alignment between the read and the genome unsigned beginPosition = 1; Dna5String genomeFragment; // We have to create a copy of the corresponding fragment of the genome, where the read aligns to for (unsigned i = 0; i < length(read); ++i){ appendValue(genomeFragment, genome[beginPosition+i]); } // Call of our function to print the simple alignment printAlign(genomeFragment, read); String <int> test1; appendValue(test1, 1337); std::cout<<(*(test1[0]))<<test1[0]<<'\n'; return 0; }
[ "mail@bkahlert.com" ]
mail@bkahlert.com
fb7cc667dd257474c1551b5756c3ea6ba596fcef
5e1f5f2090013041b13d1e280f747aa9f914caa4
/src/camera/drivers/controller/stream_protocol.cc
0c610ff0a73ab30acdf83537550993c63686c548
[ "BSD-2-Clause" ]
permissive
mvanotti/fuchsia-mirror
477b7d51ae6818e456d5803eea68df35d0d0af88
7fb60ae374573299dcb1cc73f950b4f5f981f95c
refs/heads/main
2022-11-29T08:52:01.817638
2021-10-06T05:37:42
2021-10-06T05:37:42
224,297,435
0
1
BSD-2-Clause
2022-11-21T01:19:37
2019-11-26T22:28:11
C++
UTF-8
C++
false
false
5,015
cc
// Copyright 2019 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "src/camera/drivers/controller/stream_protocol.h" #include <lib/fit/defer.h> #include <lib/syslog/cpp/macros.h> #include <lib/trace/event.h> #include <zircon/errors.h> #include <utility> #include "src/camera/drivers/controller/graph_utils.h" #include "src/camera/drivers/controller/processing_node.h" namespace camera { constexpr auto kTag = "camera_controller"; StreamImpl::StreamImpl(ProcessNode* output_node) : binding_(this), output_node_(*output_node) {} zx_status_t StreamImpl::Attach(zx::channel channel, fit::function<void(void)> disconnect_handler) { FX_DCHECK(!binding_.is_bound()); disconnect_handler_ = std::move(disconnect_handler); binding_.set_error_handler([this](zx_status_t status) { Shutdown(status); disconnect_handler_(); }); zx_status_t status = binding_.Bind(std::move(channel)); if (status != ZX_OK) { FX_PLOGST(ERROR, kTag, status); return status; } return ZX_OK; } void StreamImpl::FrameReady(const frame_available_info_t* info) { TRACE_DURATION("camera", "StreamImpl::FrameReady"); TRACE_FLOW_BEGIN("camera", "camera_stream_on_frame_available", info->metadata.timestamp); ZX_ASSERT(thread_checker_.is_thread_valid()); fuchsia::camera2::FrameAvailableInfo frame_info; frame_info.frame_status = static_cast<fuchsia::camera2::FrameStatus>(info->frame_status); frame_info.buffer_id = info->buffer_id; frame_info.metadata.set_image_format_index(info->metadata.image_format_index); frame_info.metadata.set_timestamp(info->metadata.timestamp); frame_info.metadata.set_capture_timestamp(info->metadata.capture_timestamp); ZX_ASSERT(binding_.is_bound()); binding_.events().OnFrameAvailable(std::move(frame_info)); } void StreamImpl::Shutdown(zx_status_t status) { // Close the connection if it's open. if (binding_.is_bound()) { binding_.Close(status); } // Stop streaming if its started if (started_) { Stop(); } } void StreamImpl::Stop() { output_node_.OnStopStreaming(); started_ = false; } void StreamImpl::Start() { output_node_.OnStartStreaming(); started_ = true; } void StreamImpl::ReleaseFrame(uint32_t buffer_id) { output_node_.OnReleaseFrame(buffer_id); } void StreamImpl::AcknowledgeFrameError() { FX_LOGST(ERROR, kTag) << __PRETTY_FUNCTION__ << " not implemented"; Shutdown(ZX_ERR_UNAVAILABLE); } void StreamImpl::SetRegionOfInterest(float x_min, float y_min, float x_max, float y_max, SetRegionOfInterestCallback callback) { zx_status_t status = ZX_OK; auto cleanup = fit::defer([&]() { callback(status); }); auto stream_type = output_node_.configured_streams().at(0); auto* parent_node = output_node_.parent_node(); while (parent_node) { if (parent_node->is_crop_region_supported(stream_type)) { status = parent_node->OnSetCropRect(x_min, y_min, x_max, y_max); break; } parent_node = parent_node->parent_node(); } if (parent_node == nullptr) { status = ZX_ERR_NOT_SUPPORTED; } } void StreamImpl::SetImageFormat(uint32_t image_format_index, SetImageFormatCallback callback) { zx_status_t status = ZX_OK; auto cleanup = fit::defer([&]() { if (status == ZX_OK) { output_node_.set_current_image_format_index(image_format_index); } callback(status); }); auto& available_image_formats = output_node_.output_image_formats(); if (image_format_index >= available_image_formats.size()) { status = ZX_ERR_INVALID_ARGS; return; } auto stream_type = output_node_.configured_streams().at(0); auto* parent_node = output_node_.parent_node(); if (output_node_.current_image_format_index() != image_format_index) { while (parent_node) { if (parent_node->is_dynamic_resolution_supported(stream_type)) { parent_node->OnResolutionChangeRequest(image_format_index); break; } parent_node = parent_node->parent_node(); } if (parent_node == nullptr) { status = ZX_ERR_INVALID_ARGS; } } } void StreamImpl::GetImageFormats(GetImageFormatsCallback callback) { auto& available_image_formats = output_node_.output_image_formats(); callback({available_image_formats.begin(), available_image_formats.end()}); } void StreamImpl::GetBuffers(GetBuffersCallback callback) { auto parent_node = output_node_.parent_node(); // in_place nodes may not have bound buffer collection ptr, walk up to find the real collection. while (parent_node && !parent_node->output_buffer_collection()) { parent_node = parent_node->parent_node(); } auto& input_buffer_collection = parent_node->output_buffer_collection(); ZX_ASSERT(input_buffer_collection); fuchsia::sysmem::BufferCollectionTokenHandle token; input_buffer_collection->AttachToken(ZX_RIGHT_SAME_RIGHTS, token.NewRequest()); callback(std::move(token)); } } // namespace camera
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
3c39a70c77b915c6cac03c1973970c1cc1b8ef92
523a8424ea2277d637dc47655d95cb09a89752c6
/class_exercise/main.cpp
c396e6125fe543b48dd87a1757af8fa365d3a141
[]
no_license
adiatomei/c_plus_exercises
ea29cee2fd3ff528dd8377ce1287a219ff08e05d
02bb1fdb9f4e6e5598faf142a392cfc976d84f0d
refs/heads/master
2022-11-27T14:20:05.332986
2020-07-31T14:50:03
2020-07-31T14:50:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
334
cpp
#include <iostream> #include "head.h" #include "sour.cpp" using namespace std; int main() { Student john(15, "john", "carmack", 10); cout << john.get_age() << endl; cout << john.get_firstName() << ", " << john.get_lastName() << endl; cout << john.get_standard() << endl; cout << john.toString(); return 0; }
[ "atomic_adi@yahoo.com" ]
atomic_adi@yahoo.com
e5f133cfdd388ed4287167e11e4422180e1da24c
c6a98b8e273e69533009e5073a505508e3a0c2c5
/Problems/Codeforces/TooManyHiphens.cpp
961559999c4ad4abbefe20429554004ace007129
[]
no_license
BenjaminRubio/CompetitiveProgramming
5c72a9b803e66e194fd7fe8a26d0d81d14a7fc5c
33ba1125a2eb5ba4d6f9cbc8522c92432bc92b0d
refs/heads/master
2023-06-08T19:43:44.069793
2023-05-27T18:53:32
2023-05-27T18:53:32
176,643,093
16
5
null
null
null
null
UTF-8
C++
false
false
3,800
cpp
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)n; i++) typedef long long ll; ll K; int L, R; string s, s_; ll DP[100][100][100]; ll dp(int i, int l, int r) { if (l < 0 or r < 0 or l > r) return 0; if (i == s.size() and l == 0 and r <= 1) return 1; if (i == s.size()) return 0; if (DP[i][l][r] != -1LL) return DP[i][l][r]; ll ans = 0; if (!(i > 0 and s[i] == '-' and s[i - 1] == '-')) ans += dp(i + 1, l, r); ans += dp(i + 1, l - 1, r); ans += dp(i + 1, l, r - 1); ans += dp(i + 1, l - 2, r); ans += dp(i + 1, l, r - 2); ans += dp(i + 1, l - 1, r - 1); if (l != r) ans += dp(i + 1, l - 1, r - 1); return DP[i][l][r] = ans; } int main() { cin >> s >> K; s_ = ""; memset(DP, -1LL, sizeof DP); int c = 0; rep(i, s.size() - 1) if (s[i] == '-' and s[i + 1] == '-') c++; L = R = c - c / 2; if (K > dp(0, L, R)) { cout << "Overflow\n"; return 0; } ll C = 0, aux; rep(i, s.size()) { if (s[i] == '+') { aux = dp(i + 1, L, R); if (C + aux >= K) { s_ += '+'; continue; } C += aux; if (L) { aux = dp(i + 1, L - 1, R); if (C + aux >= K) { s_ += "{+"; L--; continue; } C += aux; } if (R > L) { aux = dp(i + 1, L, R - 1); if (C + aux >= K) { s_ += "}+"; R--; continue; } C += aux; } } else if (s[i] == '-') { if (!(i > 0 and s[i - 1] == '-')) { aux = dp(i + 1, L, R); if (C + aux >= K) { s_ += '-'; continue; } C += aux; } if (L) { aux = dp(i + 1, L - 1, R); if (C + aux >= K) { s_ += "{-"; L--; continue; } C += aux; } if (L > 1) { aux = dp(i + 1, L - 2, R); if (C + aux >= K) { s_ += "{{-"; L -= 2; continue; } C += aux; } if (L and R) { aux = dp(i + 1, L - 1, R - 1); if (C + aux >= K) { s_ += "{}-"; R--; L--; continue; } C += aux; } if (R > L) { aux = dp(i + 1, L, R - 1); if (C + aux >= K) { s_ += "}-"; R--; continue; } C += aux; } if (L and R) { aux = dp(i + 1, L - 1, R - 1); if (R > L and C + aux >= K) { s_ += "}{-"; R--; L--; continue; } C += aux; } if (R > L + 1) { aux = dp(i + 1, L, R - 2); if (C + aux >= K) { s_ += "}}-"; R -= 2; continue; } C += aux; } } } if (R) { s_ += '}'; R--; } cout << s_ << '\n'; }
[ "BenjaR@localhost.localdomain" ]
BenjaR@localhost.localdomain
5626210def697cf700e8d7ffbcb6d95526641d98
82646fb7fe40db6dcdf238548128f7b633de94c0
/nyoj/11月月赛_G.cpp
bb6dc2b200db3d61e6a03df36c55fe9a0c09b5cf
[]
no_license
jtahstu/iCode
a7873618fe98e502c1e0e2fd0769d71b3adac756
42d0899945dbc1bab98092d21a1d946137a1795e
refs/heads/master
2021-01-10T22:55:47.677615
2016-10-23T12:42:38
2016-10-23T12:42:38
70,316,051
1
0
null
null
null
null
UTF-8
C++
false
false
383
cpp
#include <iostream> using namespace std; int main() { int n; cin>>n; while(n--) { int h1=0,m1=0,s1=0; int h2=0,m2=0,s2=0; cin>>h1>>m1>>s1>>h2>>m2>>s2; cout<<h1+h2+(m1+m2+(s1+s2)/60)/60<<" " <<(m1+m2+(s1+s2)/60)%60 <<" "<<(s1+s2)%60<<endl; } return 0; } /*2 3 5 7 2 4 6 24 21 30 24 38 30*/
[ "root@jtahstu.com" ]
root@jtahstu.com
69a6bf3581e2dbe8d4ad61a9a83f838651bb97ea
fe17dff616b13bed8faf45de656012aecc952b49
/LookupTable.h
e4446d29dc262a63b568f95ed231a576507b2e81
[]
no_license
anaspk/huffman-encoding-cpp
5a21726f2a55110cd933185e9dc4064a2be5c63d
391ebd133f414c368dccbc31ba8ff2fb1cf3f865
refs/heads/master
2020-06-02T09:29:56.509045
2013-01-01T01:11:34
2013-01-01T01:11:34
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,010
h
/* * File: LookupTable.h * Author: Anas * * Created on January 1, 2013, 12:26 AM */ #ifndef LOOKUPTABLE_H #define LOOKUPTABLE_H #include "LookupTableRow.h" #include "SingleLinkedList.h" class LookupTable : public SingleLinkedList<LookupTableRow> { public: LookupTableRow getCodeRow(char character); }; LookupTableRow LookupTable::getCodeRow(char character) { if (!isEmpty()) { SingleLinkedListNode<LookupTableRow> * temp = head; while (temp->next != 0) { if (temp->info.character == character) { // cout << "matched " << temp->info.character << " to " << character << endl; return temp->info; } temp = temp->next; } if (temp->info.character == character) { // cout << "matched " << temp->info.character << " to " << character << endl; return temp->info; } } } #endif /* LOOKUPTABLE_H */
[ "anastts.pk@gmail.com" ]
anastts.pk@gmail.com
2f43806f7ca819df6849a041217b73837d7679f0
a9d7fa297b591799d2823f00a0ee9ee5ec760ff6
/Console2/Console/DlgSettingsAppearance.cpp
6291dc3ab7259506764ecf56be1b6272cfcd590d
[]
no_license
jbesemer/jb_src
9707061e762cb432c4bc8f41808940b8a7b36633
b4b5299932ce54ce5d709179ae856f8a43a2deca
refs/heads/master
2020-12-27T22:30:07.601657
2020-02-04T00:02:08
2020-02-04T00:02:08
238,085,122
0
0
null
null
null
null
UTF-8
C++
false
false
11,205
cpp
#include "stdafx.h" #include "resource.h" #include "DlgSettingsAppearance.h" ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// DlgSettingsAppearance::DlgSettingsAppearance(CComPtr<IXMLDOMElement>& pOptionsRoot) : DlgSettingsBase(pOptionsRoot) { IDD = IDD_SETTINGS_APPEARANCE; } ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// LRESULT DlgSettingsAppearance::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { m_windowSettings.Load(m_pOptionsRoot); m_fontSettings.Load(m_pOptionsRoot); m_positionSettings.Load(m_pOptionsRoot); m_strWindowTitle = m_windowSettings.strTitle.c_str(); m_nUseTabTitle = m_windowSettings.bUseTabTitles ? 1 : 0; m_strWindowIcon = m_windowSettings.strIcon.c_str(); m_nUseTabIcon = m_windowSettings.bUseTabIcon ? 1 : 0; m_nUseConsoleTitle = m_windowSettings.bUseConsoleTitle ? 1 : 0; m_nShowCommand = m_windowSettings.bShowCommand ? 1 : 0; m_nShowCommandTabs = m_windowSettings.bShowCommandInTabs ? 1 : 0; m_strFontName = m_fontSettings.strName.c_str(); m_nFontBold = m_fontSettings.bBold ? 1 : 0; m_nFontItalic = m_fontSettings.bItalic ? 1 : 0; m_nUseFontColor = m_fontSettings.bUseColor ? 1 : 0; m_nUsePosition = ((m_positionSettings.nX == -1) && (m_positionSettings.nY == -1)) ? 0 : 1; m_nX = ((m_positionSettings.nX == -1) && (m_positionSettings.nY == -1)) ? 0 : m_positionSettings.nX; m_nY = ((m_positionSettings.nX == -1) && (m_positionSettings.nY == -1)) ? 0 : m_positionSettings.nY; m_nSnapToEdges = (m_positionSettings.nSnapDistance == -1) ? 0 : 1; if (m_nSnapToEdges == 0) m_positionSettings.nSnapDistance = 0; m_nDocking = static_cast<int>(m_positionSettings.dockPosition) + 1; m_nZOrder = static_cast<int>(m_positionSettings.zOrder); CUpDownCtrl spin; UDACCEL udAccel; spin.Attach(GetDlgItem(IDC_SPIN_FONT_SIZE)); spin.SetRange(5, 36); spin.Detach(); spin.Attach(GetDlgItem(IDC_SPIN_X)); spin.SetRange(-2048, 2048); udAccel.nSec = 0; udAccel.nInc = 5; spin.SetAccel(1, &udAccel); spin.Detach(); spin.Attach(GetDlgItem(IDC_SPIN_Y)); spin.SetRange(-2048, 2048); udAccel.nSec = 0; udAccel.nInc = 5; spin.SetAccel(1, &udAccel); spin.Detach(); spin.Attach(GetDlgItem(IDC_SPIN_SNAP)); spin.SetRange(0, 20); spin.Detach(); EnableControls(); DoDataExchange(DDX_LOAD); return TRUE; } ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// LRESULT DlgSettingsAppearance::OnCtlColorStatic(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { CWindow staticCtl(reinterpret_cast<HWND>(lParam)); CDCHandle dc(reinterpret_cast<HDC>(wParam)); if (staticCtl.m_hWnd == GetDlgItem(IDC_FONT_COLOR)) { CBrush brush(::CreateSolidBrush(m_fontSettings.crFontColor)); CRect rect; staticCtl.GetClientRect(&rect); dc.FillRect(&rect, brush); return 0; } bHandled = FALSE; return 0; } ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// LRESULT DlgSettingsAppearance::OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { if (wID == IDOK) { DoDataExchange(DDX_SAVE); m_windowSettings.strTitle = m_strWindowTitle; m_windowSettings.bUseTabTitles = (m_nUseTabTitle > 0); m_windowSettings.strIcon = m_strWindowIcon; m_windowSettings.bUseTabIcon = (m_nUseTabIcon > 0); m_windowSettings.bUseConsoleTitle= (m_nUseConsoleTitle > 0); m_windowSettings.bShowCommand = (m_nShowCommand > 0); m_windowSettings.bShowCommandInTabs = (m_nShowCommandTabs > 0); if (m_fontSettings.dwSize > 36) m_fontSettings.dwSize = 36; m_fontSettings.strName = m_strFontName; m_fontSettings.bBold = (m_nFontBold > 0); m_fontSettings.bItalic = (m_nFontItalic > 0); m_fontSettings.bUseColor = (m_nUseFontColor > 0); if (m_nUsePosition > 0) { m_positionSettings.nX = m_nX; m_positionSettings.nY = m_nY; if (m_positionSettings.nX == -1) m_positionSettings.nX = 0; if (m_positionSettings.nY == -1) m_positionSettings.nY = 0; } else { m_positionSettings.nX = -1; m_positionSettings.nY = -1; } if (m_nSnapToEdges == 0) { m_positionSettings.nSnapDistance = -1; } m_positionSettings.dockPosition = static_cast<DockPosition>(m_nDocking - 1); m_positionSettings.zOrder = static_cast<ZOrder>(m_nZOrder); WindowSettings& windowSettings = g_settingsHandler->GetAppearanceSettings().windowSettings; FontSettings& fontSettings = g_settingsHandler->GetAppearanceSettings().fontSettings; PositionSettings& positionSettings= g_settingsHandler->GetAppearanceSettings().positionSettings; windowSettings.strTitle = m_windowSettings.strTitle; windowSettings.bUseTabTitles= m_windowSettings.bUseTabTitles; windowSettings.strIcon = m_windowSettings.strIcon; windowSettings.bUseTabIcon = m_windowSettings.bUseTabIcon; windowSettings.bUseConsoleTitle= m_windowSettings.bUseConsoleTitle; windowSettings.bShowCommand = m_windowSettings.bShowCommand; windowSettings.bShowCommandInTabs= m_windowSettings.bShowCommandInTabs; fontSettings.strName = m_fontSettings.strName; fontSettings.dwSize = m_fontSettings.dwSize; fontSettings.bBold = m_fontSettings.bBold; fontSettings.bItalic = m_fontSettings.bItalic; fontSettings.bUseColor = m_fontSettings.bUseColor; fontSettings.crFontColor= m_fontSettings.crFontColor; positionSettings.nX = m_positionSettings.nX; positionSettings.nY = m_positionSettings.nY; positionSettings.nSnapDistance = m_positionSettings.nSnapDistance; positionSettings.dockPosition = m_positionSettings.dockPosition; positionSettings.zOrder = m_positionSettings.zOrder; m_windowSettings.Save(m_pOptionsRoot); m_fontSettings.Save(m_pOptionsRoot); m_positionSettings.Save(m_pOptionsRoot); } DestroyWindow(); return 0; } ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// LRESULT DlgSettingsAppearance::OnClickedBtnBrowseIcon(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { DoDataExchange(DDX_SAVE); CFileDialog fileDialog( TRUE, NULL, NULL, OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_NOCHANGEDIR|OFN_PATHMUSTEXIST, L"Icon Files (*.ico)\0*.ico\0\0"); if (fileDialog.DoModal() == IDOK) { m_strWindowIcon = fileDialog.m_szFileName; DoDataExchange(DDX_LOAD); } return 0; } ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// LRESULT DlgSettingsAppearance::OnClickedBtnBrowseFont(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { DoDataExchange(DDX_SAVE); LOGFONT lf; ::ZeroMemory(&lf, sizeof(LOGFONT)); wcsncpy(lf.lfFaceName, LPCTSTR(m_strFontName), 32); lf.lfHeight = -MulDiv(m_fontSettings.dwSize, GetDeviceCaps(::GetDC(NULL), LOGPIXELSY), 72); lf.lfWeight = (m_nFontBold > 0) ? FW_BOLD : FW_NORMAL; lf.lfItalic = static_cast<BYTE>(m_nFontItalic); CFontDialog fontDlg(&lf); if (fontDlg.DoModal() == IDOK) { m_strFontName = fontDlg.GetFaceName();// fontDlg.m_lf.lfFaceName; m_fontSettings.dwSize= static_cast<DWORD>(static_cast<double>(-fontDlg.m_lf.lfHeight*72)/static_cast<double>(GetDeviceCaps(::GetDC(NULL), LOGPIXELSY)) + 0.5); m_nFontBold = fontDlg.IsBold() ? 1 : 0; //(fontDlg.m_lf.lfWeight == FW_BOLD) ? 1 : 0; m_nFontItalic = fontDlg.IsItalic() ? 1 : 0; // fontDlg.m_lf.lfItalic; DoDataExchange(DDX_LOAD); } return 0; } ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// LRESULT DlgSettingsAppearance::OnClickedCheckbox(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { DoDataExchange(DDX_SAVE); EnableControls(); return 0; } ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// LRESULT DlgSettingsAppearance::OnClickedFontColor(WORD /*wNotifyCode*/, WORD /*wID*/, HWND hWndCtl, BOOL& /*bHandled*/) { CColorDialog dlg(m_fontSettings.crFontColor, CC_FULLOPEN); if (dlg.DoModal() == IDOK) { // update color m_fontSettings.crFontColor = dlg.GetColor(); CWindow(hWndCtl).Invalidate(); } return 0; } ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// void DlgSettingsAppearance::EnableControls() { ::EnableWindow(GetDlgItem(IDC_WINDOW_TITLE), FALSE); ::EnableWindow(GetDlgItem(IDC_WINDOW_ICON), FALSE); ::EnableWindow(GetDlgItem(IDC_BTN_BROWSE_ICON), FALSE); ::EnableWindow(GetDlgItem(IDC_CHECK_SHOW_COMMAND), FALSE); ::EnableWindow(GetDlgItem(IDC_CHECK_SHOW_COMMAND_TABS), FALSE); ::EnableWindow(GetDlgItem(IDC_FONT_COLOR), FALSE); ::EnableWindow(GetDlgItem(IDC_POS_X), FALSE); ::EnableWindow(GetDlgItem(IDC_POS_Y), FALSE); ::EnableWindow(GetDlgItem(IDC_SPIN_X), FALSE); ::EnableWindow(GetDlgItem(IDC_SPIN_Y), FALSE); ::EnableWindow(GetDlgItem(IDC_SNAP), FALSE); ::EnableWindow(GetDlgItem(IDC_SPIN_SNAP), FALSE); if (m_nUseTabTitle == 0) ::EnableWindow(GetDlgItem(IDC_WINDOW_TITLE), TRUE); if (m_nUseTabIcon == 0) { ::EnableWindow(GetDlgItem(IDC_WINDOW_ICON), TRUE); ::EnableWindow(GetDlgItem(IDC_BTN_BROWSE_ICON), TRUE); } if (m_nUseConsoleTitle == 0) { ::EnableWindow(GetDlgItem(IDC_CHECK_SHOW_COMMAND), TRUE); ::EnableWindow(GetDlgItem(IDC_CHECK_SHOW_COMMAND_TABS), TRUE); } if (m_nUseFontColor > 0) { ::EnableWindow(GetDlgItem(IDC_FONT_COLOR), TRUE); } if (m_nUsePosition > 0) { ::EnableWindow(GetDlgItem(IDC_POS_X), TRUE); ::EnableWindow(GetDlgItem(IDC_POS_Y), TRUE); ::EnableWindow(GetDlgItem(IDC_SPIN_X), TRUE); ::EnableWindow(GetDlgItem(IDC_SPIN_Y), TRUE); } if (m_nSnapToEdges > 0) { ::EnableWindow(GetDlgItem(IDC_SNAP), TRUE); ::EnableWindow(GetDlgItem(IDC_SPIN_SNAP), TRUE); } } //////////////////////////////////////////////////////////////////////////////
[ "jbesemer@users.noreply.github.com" ]
jbesemer@users.noreply.github.com
dfe64efe87fd37e0b3d50e611ff517f9b5f22e61
dbbee1b50e56ca17c48577062a36bc936dda72aa
/src/x509/bio_utes.cpp
0a4d6dac6bd557f7233852a6dea5be5c2057c954
[]
no_license
robertblackwell/x509_certificate_library
11afa79e610ed3837c9be9327c41633b409cd6d4
6efc7cd37ea020a8233b775907e81d27ba9fa430
refs/heads/master
2021-10-11T09:07:23.215115
2021-10-03T04:33:50
2021-10-03T04:33:50
240,992,929
2
1
null
null
null
null
UTF-8
C++
false
false
450
cpp
// // bio_utes.cpp // x509 // // Created by Robert BLACKWELL on 2/8/20. // Copyright © 2020 ROBERT BLACKWELL. All rights reserved. // #include <string> #include <cert/x509.hpp> std::string BIO_to_string(BIO* bio) { BUF_MEM* bmp; BIO_get_mem_ptr(bio, &bmp); std::string result(bmp->data, bmp->length); return result; } size_t BIO_mem_length(BIO* bio) { BUF_MEM* bmp; BIO_get_mem_ptr(bio, &bmp); return bmp->length; }
[ "rob@whiteacorn.com" ]
rob@whiteacorn.com
d2ce6ac2c226da155a8ff6eefaa0a08462a1772a
614369bd9a9452f6b48b9c667b12daacf153d6b8
/Dongmin/Baekjoon/코딩 테스트 대비 문제집/동적 계획법2/00-동전/main.cpp
bcf8602b0e54d4d9db1fbed4709946809d554a94
[]
no_license
minji0320/Algorithm_for_CodingTest
339ad05a81a89b2645dfab73d7bcbc2df9775d77
7fc091f93693d549fa1975044f4b4ff5ee056520
refs/heads/master
2022-06-26T05:14:27.149435
2021-06-30T00:16:38
2021-06-30T00:16:38
242,951,278
2
0
null
2020-02-25T08:43:49
2020-02-25T08:43:48
null
UTF-8
C++
false
false
836
cpp
#include<iostream> #include<vector> #include<cstring> using namespace std; int dp[21][10001]; int solve(int n, int target, vector<int> coins) { if (n==1) return (target % coins[0] == 0); int &ret = dp[n][target]; if (ret != -1) return ret; int biggest = coins.back(); int remainder = target; coins.pop_back(); int sum = 0; while (remainder >= 0) { sum += solve(n-1, remainder, coins); remainder -= biggest; } ret = sum; return ret; } int main() { int T; cin >> T; for (int t=0; t<T; t++) { int N, M; cin >>N; vector<int> coins(N, 0); memset(dp, -1, sizeof(dp)); for (int i=0; i<N; i++) { cin >> coins[i]; } cin >> M; cout << solve(N, M, coins) << endl; } return 0; }
[ "pkalsh345@gmail.com" ]
pkalsh345@gmail.com
9a2be910bb5b8ae36f3f8fa3923312b9a12ab165
8354d413d08bc98bc164ce3750e14898af14c400
/GmotorTesterSC/messagebox.h
6b4b001b58a001522c22cf96f53c8e42ed9b8675
[]
no_license
dohoangtu/gmotorTesterSC
0e65dd47435aa63a7e0b32ce51c0abe6a24cbd16
565898791b86ec38e35f37af2816e21b55af8cb5
refs/heads/master
2016-09-10T11:13:18.063744
2013-09-12T01:37:00
2013-09-12T01:37:00
null
0
0
null
null
null
null
UTF-8
C++
false
false
400
h
#ifndef MESSAGEBOX_H #define MESSAGEBOX_H #include <QWidget> namespace Ui { class messageBox; } class messageBox : public QWidget { Q_OBJECT public: explicit messageBox(QWidget *parent = 0); ~messageBox(); void showButton(); int btClicked; private slots: void btOk_Clicked(); void btCANCEL_Clicked(); private: Ui::messageBox *ui; }; #endif // MESSAGEBOX_H
[ "dohoangtu90@gmail.com" ]
dohoangtu90@gmail.com
343ac0943d172819ed45a1aea0747ade9835efca
068f61a8c2ab115abdbd3e2dcd69c0676c6ab82b
/triefunctions.cc
6b047d2f1479bc2ae5aba3fad5c6678d2bd2e908
[]
no_license
Endokun/Quadris
b14d755325ab4cc587dbc1744e0c749aa5e055ad
57db990304ecac0469335c95edc8a6b66af26d30
refs/heads/master
2021-01-01T19:38:43.192882
2012-01-27T05:05:29
2012-01-27T05:05:29
3,280,169
0
0
null
null
null
null
UTF-8
C++
false
false
2,857
cc
#include <iostream> #include <fstream> #include <iomanip> #include "trie.h" using namespace std; //Releases all the memory void releasememory(TrieNode *node) { for(int i = 0; i < 26; i++) { if(node->letters[i] != NULL) releasememory(node->letters[i]); } delete node; } //Adds a name void insert(TrieNode *node, string word) { TrieNode *tempnode = node; //Creates a temporary node to traverse down the tree int lengthofword = word.length(); //Stores length of word int n = 0; for(int i = 0; i < lengthofword; i++) { //Goes through the TrieNodes n = word[i] - 'a'; if(tempnode->letters[n] == NULL) { tempnode->letters[n] = new TrieNode; tempnode = tempnode->letters[n]; } else { tempnode = tempnode->letters[n]; } } tempnode->isWord = true; } //Actively goes through all the children that aren't NULL and accumulates the words into a string void printwords(TrieNode *node, string *result, string word) { if(node->isWord) *result = word; for(int i = 0; i < 26; i++) { if(node->letters[i] != NULL) { char letter = 'a' + i; printwords(node->letters[i], result, word + letter); //Recursive } } } //Takes the shortcut and get the name for the full command string grabfullcommand(TrieNode *node, string word) { string command = word; string *result = &command; TrieNode *tempnode = node; int lengthofword = word.length(); int n = 0; for(int i = 0; i < lengthofword; i++) { //Gets to the position where the shortcut ends n = word[i] - 'a'; tempnode = tempnode->letters[n]; //Goes further down the tree } for(int i = 0; i < 26; i++) { //Goes through all the children to return the full command if(tempnode->letters[i] != NULL) { char letter = 'a' + i; printwords(tempnode->letters[i], result, word + letter); } } return command; } //Checks if the shortcut command is valid bool checkifexists(TrieNode *node, string word) { TrieNode *tempnode = node; int numpaths = 0; //Used to make sure the shortcut entered only has one possible path int lengthofword = word.length(); if(lengthofword > 26 || lengthofword < 0) return false; int n = 0; for(int i = 0; i < lengthofword; i++) { if(tempnode->letters[i] != NULL) numpaths++; } if(1) { for(int i = 0; i < lengthofword; i++) { n = word[i] - 'a'; if(tempnode->letters[n] == NULL) return false; //Since the letter is NULL, it means the given word does not exist in the tree else tempnode = tempnode->letters[n]; //Goes further down the tree } if(tempnode->isWord) //If the word exists, return true return true; else return false; } else return false; }
[ "kingslim@hotmail.com" ]
kingslim@hotmail.com
1617ac0ea20ccef49d0bb9ea37686dc6e2fdbc5b
5e00242dc035fdab6aa6bbb40c6d7e6c119ad8e6
/Vault/Codeforces Rounds/CFR498D3/CFR498D3A.cpp
ab9ef59bbf6168718f43cf97931a8e653f8ec5d9
[]
no_license
AkiLotus/AkikazeCP
39b9c649383dcb7c71962a161e830b9a9a54a4b3
064db52198873bf61872ea66235d66b97fcde80e
refs/heads/master
2023-07-15T09:53:36.520644
2021-09-03T09:54:06
2021-09-03T09:54:06
141,382,884
9
1
null
null
null
null
UTF-8
C++
false
false
20,898
cpp
/********************************************************** * Code written by Akikaze * * Duy-Bach Le, #Team4T's Chief Executor * * #Team4T Tertiary Flagship - Oblivion * * * * Written by a random fan of momocashew and Chiho * **********************************************************/ /************** [OPTIMIZATION PROTOCOL] **************/ #pragma comment(linker, "/stack:227420978") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") /*****************************************************/ /************** [LIBRARY PROTOCOL] **************/ #include <bits/stdc++.h> using namespace std; /************************************************/ /************** [LEGENDS/CONSTANTS] **************/ #define endl '\n' #define i64 long long #define ld long double #define rsz resize #define pub push_back #define mp make_pair #define fi first #define se second typedef vector<i64> vi; typedef vector<ld> vd; typedef vector<string> vs; typedef vector<bool> vb; typedef pair<i64, i64> pii; typedef pair<i64, pii> pip; typedef pair<pii, i64> ppi; const long long MOD = 1000000007LL, INF = 1e9, LINF = 1e18; const long double PI = 3.141592653589793116, EPS = 1e-9, GOLD = ((1+sqrt(5))/2); i64 keymod[] = {1000000007LL, 1000000009LL, 1000000021LL, 1000000033LL}; vi HashMod(keymod, keymod + sizeof(keymod) / sizeof(i64)); /*************************************************/ /************** [BITWISE FUNCTIONS] **************/ template<class T> int getbit(T s, int i) { return (s >> i) & 1; } template<class T> T onbit(T s, int i) { return s | (T(1) << i); } template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); } template<class T> int cntbit(T s) { return __builtin_popcount(s); } /*************************************************/ /************** [GLOBAL VARIABLES] **************/ auto TimeStart = chrono::steady_clock::now(); auto TimeEnd = chrono::steady_clock::now(); #define OImode 227420978 #undef OImode // Switch this off if submitting OI problems. i64 n; vi a; map<i64, i64> Map; /************************************************/ /************** [FUNCTIONS] **************/ void ControlIO(int argc, char* argv[]); void TimerStart(); void TimerStop(); void Exit(); void Input() { cin >> n; a.rsz(n); for (i64 i=0; i<n; i++) { cin >> a[i]; Map[a[i]]++; } } void Solve() { for (auto it=Map.begin(); it!=Map.end(); it++) { i64 val = it->first; for (i64 i=0; i<n; i++) { if (a[i] != val) continue; if (val % 2 > 0) a[i] += 0; else a[i]--; } } for (i64 i=0; i<n; i++) cout << a[i] << " "; } /*****************************************/ /************** [MAIN] **************/ int main(int argc, char* argv[]) { ios_base::sync_with_stdio(0); cin.tie(NULL); ControlIO(argc, argv); Input(); TimerStart(); Solve(); TimerStop(); return 0; } /************************************/ /************** [SUPPORTING FUNCTIONS] **************/ void ControlIO(int argc, char* argv[]) { #ifdef Akikaze if (argc > 1) assert(freopen(argv[1], "r", stdin)); if (argc > 2) assert(freopen(argv[2], "w", stdout)); #elif OImode freopen("filename.inp", "r", stdin); freopen("filename.out", "w", stdout); #endif } void TimerStart() { #ifdef Akikaze TimeStart = chrono::steady_clock::now(); #endif } void TimerStop() { #ifdef Akikaze TimeEnd = chrono::steady_clock::now(); auto ElapsedTime = TimeEnd - TimeStart; cout << "\n\nTime elapsed: " << chrono::duration<double>(ElapsedTime).count() << " seconds.\n"; #endif } void Exit() { TimerStop(); exit(0); } /****************************************************/ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Li f // // # W ; // // . #. # G // // W .## : . # // // j# #K# #; j E // // #, # # . , L E # ;Li // // G # #f # ;W . G. ;KKKKKEE // // W #W# # W L i fEWKKWWWWWWWKWLWKKW // // # E tfWWWKKKKKWWWWWWW##WWKf // // ## . , # # jfLWWWWWKKKWWWWWWWWWW#####j // // # # # # fLLWWWWWWWKKWWWWWWWWWWWWWWW## // // # L W # # ifLLWWWWWWWWWWWWWWWWWWWWWWWWWW##i // // . Gt f #ff ; ijfLWWWWWWWWWWWWWWWWWWWWKKWWWWWW### // // : ## t t # : # ijfGWWWWWWWKKWWWWWWWWWWKKKKWWWWWW#### // // D : W K : . # # jffGWWWWWWKKKKWWWWWWWWWWKKKKWWWWWW####K // // t G E# # j tLK#WWWWWWKKKKKWWWWWWWWWWWKKKKWWWWWW####D. // //D . ### E #j ; . DEK##WWWWWKKKKKKWWWWWWWWWWWKWKKWWWWWW#WW#EL // // : L . # :. , i# .DEK#W#WWKWWKKKKKKWWWWWWWWWWWWWKKWWWWWW#WW##Lt // // # ## K E DEK#WWWWKKWWWKKKKKWWWWWWWWWWWWWWKWWWWWWWWWW#Lj: // // # ### # W GEEWW##WWWKK#WWKKKKWWW#WWWWWWWWWWWWWWWWWWWWW#Wft # // // # K ## .# fDEWKKKEKKKWKKWWKjfKWWW#WWWWWWWWWWKWWWKWWWWWW##Lj; i#. // // # :#D ## i i jDEEKEEWWKKWKWKWGDjjDDWW#WWWWWWWWWWWWWKWW##WW####ft, ,#. // // ## # # L jD ,GEDKEEWWKKWWKK#WjjtfD##W##GfEWWWWWWWWKWW##WW######Et; :# ## // //# # :#G , ff; jEKKEEEWWWWKKWKKKDGDiLKWW##GfLKWWWWK#WWW##WW#######KDL . :# // // ## ; W #### fDGifLfWKKKWWEEKEWKKKWKEtGjtGEK##EffLLGWW#WKW#############DDi ## // // # # # . .# ### .j .tGGEEEWKKKKEKWKEWW#WfKELKKKEGDWLffKWWEEEK########W####KEj: ##D // // G G ,## # #### LG GEDEEKWWEEKEEK#EEW#WWEEEKKEWfff:fKWKEEEEEEE##WWKEE#W###Kff ### // // # ##### j iDEKEW#KWEEEWK#KEW#W#KEEEEEEEEEfWfEWWWWKEEEKWEEEEEWWW##WL; ### // //G ### D ##### t GWKEKWWWEKKWK#WEWWKEWWWWWWWWW;fWGfWWKKEEEEKWKEEKKEW###WL; #### // //L K K#### f KWWEEK#WKKEKEKWWKWKKKW#W#WWKEKDLWKK#WKKKKKEKKKKKWKKKW###Df :### // // K L#### G KWKWEWWKWWEEKWKKWEKK###KKKWWWWWWWK#WWWKWKKEKK#KKKKKKW###DD #### // // , K#### W#WWWKEEEE. WKWKKWWKEEKWEKWWEKW##WKKKKKWKWWWK#WK###KKK#WGWKKEEE#WWWEEi ##### // // i E#### #WWWWWKKEEDEEDGWWWWWWWKWWEEWWEEKW#WWKKKKKKKWWWKW########KWWGDKKEEWKWKKE,: ##### // // i :K### WWWKKKKKKEELjLGGW##WKKKWEEKWEKKW#WWKK#######KW############WGGEGW#W#WWt,, ###### // // . # K###D WWW# tG KffLGDKKWWWKEEKWWKWWKW#WWWGG######WWW#####W######WWWWWW###Li,: ####### // //# KW### W#W tL WWWKGDK#WWWWKKWWKWKKWWW#KGGG########KKWWWWWW#######WWW#WWWfi, ######W# // //G fWWW#W #WW ft WW#WWW#WWKKWWWWWKKWW##KDGGG#######KKKKKKKWKD#####WWW##WWWWt; ###D###WL // // WWWWW# #W Lt iEWW##WWW#WKKWWWWWWW##EGDGGGD####WKKKKKKKKWGE####WWWWWWWWWWWj, ###G###KK // // KWWWWWW WW LtLfL#W###WWWWWWWKKKW##KjGGDGGGG###KKKKKKKKKGGGKG###WWWWW####WKf ###D#G##EK // // WWWWWWW #W tjfWK#####WKK#WW#W###KWfGGDGLLGW#KKKEKKEEKGGGGDGG###WDGG####WK ##KGE###KDK // // WWWWWWW# #W ttK#j#######W#W#####GGGfDGGLffDDWKEEEKEEWGGjGEGGG#GDGKGGLW###D ##GGG#G##DDK // // WWWWWW#W# WG itW#f#######KW#####KGKj;fDjtLjjGLjK###WWGEGfjGGGGGGGGDLLLWWWKDDj ##GGG#GG#WDDf // // ,KWWWKWW## WW :tjWjK#####EDDDEK##GDDj;tDtGLjtLLttLjGLiDfftttDfijGGjGLLfjKW#KEEL ##GGG#WG##KGE // // KKWWWKWK## WW fLEfG###EEEDGGGGDGKt;;;;DjiitEitttGLEt;tjtttji,;jfjDLfLtDKWKEL #DGGGG#GG##DGK // // GKWWWE#WE## W KjLDGWDGGGGLLGGLjKtjffjjjij;i;i;;ifji,it:;ffGi;jGjGGL,tjGW#i .. ##GGGGD#GL##WLGK // // EKWWEGWDD## WW WKfjLGGGGLtDfDGGKfKK##WWtjtDit,;t;i;Lt,LKWWWWEtifGjGGL;:tfi: : ##GGGGG#KLG##DLEj // // GKWWWGGWDE##t KW ;KEEKfDGLjDLLfGGjttGD#W#W##EjEttttiiE,DEWWW#WEiittLjDGGj jj: :: ##DGGGGGD#LLL#KGDK // // EKWWLL#WEE### WWW iEE E i,DLLLffLLjtjjt#KWWWKKtGtittiijELKEKWWKttittGjGfLL;Ljj .: ##GGGGGGG#GLL##ELDK // // jKWWWLGWWEE### W## ;iKfE tWGGLLLfjLtitf,EDEDDE;GjitjitjijiWEELDKtifitGtEfLGLGfft ,: L##GGGGGGG#GLLL#EDDK // // jDKWWGLL#WEEE## #W# ;i KK LEGGffLjLffttGf,ftfjL,,f;fttfttL,,ffjj;EifiijfGffLGLLfG ,, ##GGGGLLLLE#LLL#WDEDW// // jKWWWLLLWDDDD## WW#jiiKG jGGEELLEjEjttiijWttjjj,,,i,jitjijj,jffDjELfitifGGLLEGLL.t ,:, f##GGGLLffLL#LLLL#EDDK// // jLKWWWLLKWDDDD## #WWWfjjjDGGGGELfGjLtttttiiGiL;,,,,,,;,ifLtt;;GiEiDifiGGGELLLLKGD L :,f. ##GGGLffffff#LLLL#KDEE// // jEKWWLLf##GGDD## WWW WW tiWGGELfjKjttttti;i;;;;,,,,;:;,t,,ji;;;;;DGjtLDGKfGLLGDDDG ,;t G##GGGfjjjjff#KLLLL#DEE// // jjKWWWLLfW#GGGDK# # W# f GGGELG.GjDDtitj;;;;;;,,,;;,;;,i,,;;;;;;tDjfGGfDGLDLGGLLDL; .:,,i ##GLLfjjjjjjjf#LLLL#KEE// // jDWWWGLfjW#GGGDD# W L.GL DfLjLjtDittti;;;;,,,,;;;;;,,,,;;;;if;DDjjGjjGLKGLGGLGDjjjti. .##ffjjjjjjjjjj#fLLLL#EE// // jjEWWWffjjW#GGGGD# WW :tGLG GfjGiDtDjiiGf;,,,,,,,,;;;;,,,,,,,,,GtGGtjLjjGLGELLLKLLD #Wjjjttttttjjjj#fLLLL#KE// // jjKWWWjjjjWGLGGGG#W ,, KW iLGD :fjjLGGjjEtiijti;,,,:,,;;;,,,,,,,,,;;KjjjjGjjELGKDGLLEGLt :#WjjtttttttttjjL#ffLL##E// // fjDWWWjjjjjWLLGGGGG# ;: K .GGj ,jtjDDjGjjttiiti;:::,,,,,,,,,,,,,,:iEKtjtjEfjKLKLG LLDj fj #Wjtttttttttttttj#ffLf.#K// // jjKWWWjjjtGWLLLLLGG# ; GK , LL: ,;tjfDjtDtjttfij;,:,,,,,,,,,,,,,,,:jELtGtjEffKGDLW ;LDj ji .#ttttttttiiittttt#fffff##// //;jfKWWWtjtt#WLLLLLLG# ;, WK ;,Lf ;,,LjfGjjjEftGifit:,,,,,,,,,,,,,,,,,iL:jfjjLjLKGGD GGt Ej #EttttittiiiiittttGffDfff#// //fjEKWWtttttWWLLLLLLGDW ,, KWjj Lj ;,.;jfffjjfLttDDfj,,,,,,;,,,,,,,,,,fWfjjjjLffWGDGL :DLL jDK#jttttiiiiiiiiiiW;i#fffff#// //ffKKKWtttttWWfLLLLLLD# # ; K fj Lff;, fLfLjjjfLLiDDji,,,,,,,,,,,,,,:G#EffLjjEffWGGL. ELE GfED#tttiiiiiiiiii:,,;Wfffff#// //fDKKKKtttiiWKffLLLLLf#W# ;WKff; GLj:,:ttLLLDjjjLGLLDDEi,,,,,,,,,,,,:#EGGLfjjDGffLLLL. jDD DjjGLttiiiiiiiiiW::,,;#ffffff// //LEKKKtttiiiKKffffLLLfL# jLfjfLGLj;,,jtffLLEfjjLLLLDDDD,,,,,,,,,,GWWLLLLDjDDLfEGLft,.:.tEG Gj,iLKtiiDiiiiit,,#,,;DEfffff// //GKKKKttiiiiKKjffffLLf## K,fj:jDtff;jij fLLLDfjjfGGGLGEWK,,,,,,DLj,#LfEGKjfDffGLLG ,: ;LK Gj:tLLti#Kiiit,:,i#,,;t#fffff// //DKKKKtiii;;KLjjjfffff#LW WK jjLt: ,j;tt EfEfEGjtGjLLfEDDEEDfGDLLjj:#GfLLLjGfD ffLL ,. ,fK #ft:jLLDt#WiiE:::,#K,,;i#jffff// //EKKKtii;;;;Etjjjjffff#fKW WK Gjt : tftt,.GfGGDDGfitjGLDDDDDDLfLLjff:WGiLLLGfitLLDLf ,:;Gt #f,tLLLfi##i:::::f#,,,;i#ffjff// //KWWKtii;;;,Etttjjfffffff#K KW fDLDjtij,jiGjDjG:G jLtGLDWEDDGLffjjfffWD;GLLL .LL Lf, ::G #jjtLLLffW#E,,::::#L,,,;i#jjjjf// //WWWWti;;;,,EttttjffffffffLW KK. jGjfjt;. jjGjjf.: ijLtLWEDGGLjjjjffWWGDDDfGD fL LK ,;ff ##LjGLLLfffK:,:::::W:,,,,i#jjjjj// //WWWEii;;,,,DttttjjfffffffifWWK .j .t: iLDjL;GjDffjtjjLDKWDGGjjjjjjWWWDGELGGLL fL DGi,, iDWKEDLLLLfft,,,:::::D::,,,i#jjjjj// //WWWti;;,,,:DiiittjjfffffGiiiKW. fG fiiLji;,;ttGLfffLjEKEEWGfjjjjjKEKWWGjDfL :Lf :: L; WDEDGLLLLL,:,,:::::::::,,,i#jjjjj// //WWWti;,,,::DiiittjjfffffLiijKWG#Kt Diii,t;,,,,,tD,ft:fDKEEEEEjjjjEEEEEWWWEiffj fGLLL. GE ##KDDLLLLL,,,,::,:::::::,,,;#jjjjj// //WWWt;;,,:::GiiittjjffffDiiiWKLLfftW .iii;;j;,,;,,tDL;;;iKKEEEEEEffKEEEEEEWWWtGLfEGDLjfG. iK##KEGLLLLL,,,,::::,,:::::,,,K#tjjjj// //WWti;,,,:::GiiitjjjfjjWiiiiKKLLfGGGLi;ii,,jL,,,,Etf,,fii;iEKKDEED;;;WKEE#DtttttttttLfjjffD; #KWEEDiLLf,,,,:::::::;,::::W,;WtLjjj// //WWti;,,,:::GiiitjjjffWiiiijKWLLLtGGG;;i;,,jji,,Ejf,,,,,j,iGW;;EE,;;t,:#WWftiiiiiiijfDKGtiLi###EEELfLL,,,,,:::::::::j::,,i;WLLLKj// //WWi;;,,::::GiiitjjjjWiiiiiWKLLLGtGWKKKKW,,,ttttttL;,,,,tWEKEG,E;;;E,,,fEEEEt;i;,,,,iiiGLiiDi#KEfLLLL,,,,,::::::::::::,,K,;WffLLL// //WWi;,,,::::GDiitjjjWiiiiiiKKLLLtLGKKKKKKKKG,LtjtD;;;,,,KEDDD;;;;;t,,,,,EEEEW,,,,,,,,iiiDiiiifGLLLLL;,,,,::::::::::::::;,,;GfffLL// //Wti;,,:::L.G:GitjjW;ii;;;iEKLLLtLKKKKKKKKKKW,,;;;;;;,,,EDEDDE,;;t,,,,f;#DEDK,,,,,,,,,iitt;iDfGfLLL,,,,,:::::,:::::::::,,,;jfffff// //Wi;;,,::f..G::,GGL;iKKKKKKEKLLGjWKKKKKKKKKKK;,,ti;i;,,,KDEKKK,t,,,f;,,,,LEE,,,,,,,,,;;iiijiiiGLGL,,,,,,::fWWWW::,::::,::,,ffffff// //Wi;;,,,:...G::,;,i;KL EE.W#tKWKKKWWWKKWKKK,:jtii;,,,iEEEDDL,;;,,,,,,,:EE,,,,,,,,;;;iiiif;iLLGi,,,,,WWWWt .WK:::::::,,tfffff// //Wi;;,,:....G:,,;;;K DE LjWKKKKWWWWKKWKKtWWDii,,,,,EEDDDK,t;,,,,:ti,D,,,,,,,,,;;;ii;;;f;iLti,,,#WW ;,:::::,,,jffff// //KE;;,,j....D:,,;;K: EE tKWKKWWWWWWWWWW#WKKWii,,,,,,KDE#K,,,,,,,,,,,;,,,,,,,,,;;ii;;;;;;;WWW;,# :::::,,,jffff// //K;G;;E:....D,,,;;K EK tWKKKWWKKKWWWW##KKKKE;,,,,,,fEWWW;,,,,,,,,,,i,,,,,,,,,if;;;,;;;;i###j: ::::,,,jjfff// //W;;;,......f,,;;;f E jtWWKWWKKKKW#WWWWWKKKEi;,,,,,,WWKW;,;,,,,,,;;E,,,,,,,,,;t;;,;;t#WWWWW :,::,,,jjjjf// //K;;;:::::..:,,;;t KE tLWWWWKKKKKWKWWWWW#KKKK;,,,,,LKEKEj;;,,,,,G,;WW,,,,,,,,,t;;,;WWWWWWWWWE; W::,,,jjjjj// //W;;;:.::::..,,;;K KK Dj .WWWKKWKKKKWKKWWWWWWWG,,,,fEEEKED;;i,,,E;,WKEf,,,,,,,LL;;KKKWWWWWW#WDt i:,,,jjjjj// //K;;;::f:::..;;;; KK jfiKKWWKWWKKKKKKWKKK#WWKKE;;GDEDDKWG;;i,,;iWWKEEE,,,,,WKKKiiKKWWW##W##Wj :,,,jjjjj// //Ei;;::,::::.i;;; KKGt,KKKWWWWWKKKKKKKWWWWWWWKWjtDEEDDKWG;;;,,;;iWKEEEt,,jKKKK#tEKKKW###W#WE K,,,jjfjj// //ji;;::::,:::E;iK KKjt EEK#WWWKKWKKKKKKW##WWWWWLEEEEEDEjDi;;,,;;;WKEEEE,jKKKKWW#WWWKW#####WK ,,,jKKKj// //tiiG,,:,,,:.:;K KKjL GDEWWWWWWKKKKKKKKW###WW#WDEEE####ijii;;;;;#EEEEEKEKKKW#WWWW#W####WWWKK E,,jW Wj// //iiiE,,,,,,:.G;K WKE DEWKWWWKWKKKKKKKWW#WWW#WEEEE#####iiiii;;;WEEEEEWKKKW####WW####WWWWWKKW ,,f D K// //iiiK,,,,,,,;KtK DKD EWKWWWKKKKKKWKKKWW#WW#WEEEDKK####iiii;;;EEEEEEWKKK#########WWWW##WKKK. ;,j W// //tiiKKK: K;;;tK LKD KKKWWKKKKKKKKW#WWW#KWWW#EEW#KE#W#jiii;;#EEEEE#WKK########WWW####WWWWWK ,K W// //jtEK .;;i jKE EKKKKKKKKKKKKKW#WWW#W##W#EE#KKWK#itW##G#EEKWW#WWW###W##W#WW###WWWKWWWK; tW ,// //fDK ;E GjKEK iKKKKKKKKKKWKKKKWWWW#W#WK###WWWKKW#W#KKK#W#W########WKWW#WK##W#WWWKKWKKf: D // //fW Ei fjfKE ,KKEKKKKWKKWWWWWKK##WWW#WKKK#KKWKKKKKWKKWKWKWWW###KKKKWWW#WW#KK#WWWKKKKKE;; KE // //fW W jj KK DKEEKWWWWWWWWWWWWKW####W#KKKKKKEWKKKKKWWKKKWWKKKEEKEDEW#WWK#WKKWWWWKKKKKEE;,. E // //W :jG KKDKEEKKWWWWWWWWWWWWWWWWW#W#KKKKWKEEEK#WKWWKWWKKKEEEKEEEKWWKKW#KKKWKKWWKKKKKEK;,, // //W : jj DDEEEKWKEKWWWWWKWWWWWWWWWW##WWWWKEEEKKKK##WWWEEEEEEEEEEKWKKKWWKKKKKKWWKEEEKKEEEL; // //# G Gjj iDDDDKKKEEWWWWKKKKKWWW##WKWWWWKKW#KEKWWWWWKWWEEEEEEEEEEEWWWKK#WKKKKKKW#WKEEEEEEEEKED // // fjD LDDEEKKEEWWWWWKKKKKKWW######WWKK###WWWWKWWKWWEEKEEEEEEEEWWWKKWKKKKKKKW#WKKEEEEEEKKEEEE // // jj .GDDKEKKEWWWWWWKKKKWWWW####W##WKKKK#K####WKKKWWWWKEEEEEEK#WWKWWKKKKWKKK#WKKEEEEEEKKKKEEi // // jj ;LDDKEKEWWWWWWKKKWWWWWE########WKKWWKK##WKWWW#WWWWEEEEEEEWWWK#WKKKKWKKW#WKKKEEEEEKKKEEE; // // # Gjj fDDKKKKWWWWWWKKKWWWWW########W#KKKWKKWKWKKKKWWWWKEEEEEKEKKWW#KKKKKWKKWWWKKKKEEEKKKKKEE; // //. K LjG LLDDEEWWWWWWWKKWWWWWWE#######Eii#KWKKKK#KKK#WWWKEEEEEEKWKKWWWKKKKWWKKWWWKKKEEEEKKKEKKE, // //D W jj iDDEKWWWWWWWKWWWWKKKW#######iiiiKKKKKKWKW#KWWKKEEEEEEW#WKKWWWKKKWWKKWWKKKKKEEKKWKEEKK, // //W jj GDDKKWWWWWKKWKE###########;iiiiiiWKKKWEEEKWWKKEEEEEKW#WKW##WKKWWWKKW#KKKKKKKKKWKEEKt, // //W jj LGKKWWWWW#####KWWWW####j;iiiiiiiiKEKWKEEWKWWKEEEEKK##WKW###WKWW#KKW#KKKKKKEKWWKKKEt // //W jf KKKWWWWW######KWWW###;;;iiiiiiiWEKKKKKW##WKWKEEEK##W##KW###K#W#KKWWKKKKKEEKWWKKKKj # // //# jL EKKKWWWW#######KWW##G;;;;;iiiiifEKKKKKWWW#WKWWEEKK#WWW##K###W#K#KKWWKKKKKKEKKWKKKKf # // //# jf fKWKWWW#K########WW#;;;;;;;;;iiiWKKKKK##WW#KW#WWKE##WWWW######WK#KW#KKKKKKEEKWKKKKKK: :,j## // //# jf GGWWWW##K#########E;;;;;;;;;;iifKKKKKK#KW##KW##KE#####WWW######W#KW#KKKKKKKKKWWWKKKKWi;;DE# // //# fj jELWWW##K########;;;;;;;;;;;iiiDWKKKK#WWW#WKK######W##WWWW#W###WWKWWKKKKKKKKKWWWKWWWKKiEE## // //# :ff fEDWWW#W#######i;;;;,;;;;;;iiGWWWKKW#KW##KKKW#######WWWKKK#####KWWKKKKWWWKKKWWWKWKKWKKEEKG // //#j ff DEKWW#W#####i;;;;;,,;;;;iitWWW#KK#WKW#WKKKK####W##KKWKKKK####WWWKKKW##WKKKWWWKKKKKKKEEEK W// //:# ff iWWWK#####ii;;;;;,,,,,,iiKWWW##WWKKW#WKKKKW##K##WKKWWKKKK####WWKKKW##WKKWWWKKKKKKEEDEEE #// // # ffj GEEEEKKW###i;;;;;;;,,,,iij#######KKK#WWKKKKK#WWW#WKKKWWKKKW####WKKW###WKKWWWKKKKKKEEEEGG #// // # ffD EWW##WKK##i;;;;;;;;,,,iitW######WKKW#WWKKKKK##WKKKKKWWWWWWWWW###KW####WKKWWWWKKKKKKDDEGD W// // # Lff KW########,;;;;;;,;;;;ii#######WKKK#WWKKKKKKW#WKKWWWWWWWWWWWW##WWW###WKKWWWWKKKKEEEDDGGEKG WW// // Eff j#W#######;;;;;;;;,;;iiG#######KKKW#WWKKKKKKW#WWWWWWWWWWWWWWWW######WKKKWWWKWKEEEEDDGEKKKK W // // # .ffD DWG#####W;;;;;;;;;;;i########WWWKKWWKKKKKKKWW#WWWWWWWWWWWWWWWW####WWWWWWWKKKKEEEEDDKKKKEK W // // # fff KWW#G####i;;;;;;;;;;t########WWWWKKKKKKKKKKWWW#WWWWWWWWWWWWWWW####W#W##WWWKKKKEEEEWKKKKKKE iW // // fff WWEKKD###;;;;;;;;;;E#########WWWWWKKKKKKWWWWWWWWWWWWWWWWWWWWW########WWWWKKKKKEEEWKKKKKKKK WtK// // Efff fWW##D###;;;;;;;;D##########WWWWWWWWKKKWWWWWWWW#WWWWWWW###########W#WW#WKKKKKEEWWWKKKKKKKK W# // // # Dff EWW#W####Lii;;;iW#########WWWWWWWWWWWWWWWWWWWWWWWWWWW############KKKWWWWKKKKKEEWWWKKKKKKKE W // // GD L#W########ti;##W#########W#WWWWWWWWWWWWWWWWWWWWW#WW#############WWKKKWWWWWKKKEWWWWKKKKKKKL W# // // DWWWW############WW#########WWWW#WWWWWWWWWWWWWWWWW#################WWKKKWWWWWWKKEWWWWKKKKKKK # // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
[ "duybach.224575@gmail.com" ]
duybach.224575@gmail.com
0191ecb112cf69f688f2028528d22c65c2e407ee
dd057dd0e08a6bb2aa83eb5e40754a86f2ca1ecb
/generator/include/.svn/text-base/LUXSimGeneratorRn220.hh.svn-base
7ee32c6d6f3d7d3750a438c574fb2787cb8957d9
[]
no_license
p-terman/muon
898158d26182732f7866da9251a0f9bbe5f29be9
7fe4ffb0026df2cb462be9707a267f454022c9b4
refs/heads/master
2021-01-25T08:23:07.250257
2017-06-08T15:38:26
2017-06-08T15:38:26
93,760,679
0
1
null
null
null
null
UTF-8
C++
false
false
1,281
//////////////////////////////////////////////////////////////////////////////// /* LUXSimGeneratorRn220.hh * * This is the header file for the Rn220 generator. * ******************************************************************************** * Change log * 16-February-2015 - file creation (Simon), copying from Rn222 generator * */ //////////////////////////////////////////////////////////////////////////////// #ifndef LUXSimGeneratorRn220_HH #define LUXSimGeneratorRn220_HH 1 // // GEANT4 includes // #include "G4ParticleDefinition.hh" #include "globals.hh" // // LUXSim includes // #include "LUXSimSource.hh" //------++++++------++++++------++++++------++++++------++++++------++++++------ class LUXSimGeneratorRn220 : public LUXSimSource { public: LUXSimGeneratorRn220(); ~LUXSimGeneratorRn220(); public: using LUXSimSource::GenerateEventList; void GenerateEventList( G4ThreeVector, G4int, G4int, G4double ); using LUXSimSource::GenerateFromEventList; void GenerateFromEventList(G4GeneralParticleSource*,G4Event*,decayNode*); //using LUXSimSource::GenerateEvent; //void GenerateEvent( G4GeneralParticleSource*, G4Event* ); private: G4ParticleDefinition *ion; }; #endif
[ "pterman@tamu.edu" ]
pterman@tamu.edu
fc58132e22735a37a8b41a2a2765cb68413e20e2
e57d206aac19fbd73482b2ebc5f62afa6186c53e
/src/ast.cc
35dbdde6a94ee0c89e6cc68f779f969904d1b938
[]
no_license
adrien1018/CompilerDesign2019
d41ba71e56cead7cc730357b08d0563cb320395d
ad7b791264b3dabe7e25fb45af3c693489ea1065
refs/heads/master
2021-07-05T17:50:58.869633
2020-12-28T11:35:28
2020-12-28T11:35:28
215,280,145
1
0
null
null
null
null
UTF-8
C++
false
false
120
cc
#include "ast.h" void RecursiveDelete(AstNode* nd) { for (AstNode* x : nd->child) RecursiveDelete(x); delete nd; }
[ "adrien1018@users.noreply.github.com" ]
adrien1018@users.noreply.github.com
05917eefd17b52faa617115690e01c3b6a6015d1
acd3bb7874b0c3a696d1c3df968b56b067d2bf1b
/CameraCalibration/Settings.cpp
4dabca8d1f26606f68dfe0efb2863e3fbb8e12a2
[]
no_license
IfeanyiOnah/SourceCode_FARO
d0041c3a7c9f151948ce7530b9562b9aaf8dafe3
e93d3b8392b85275a710d9a83a17f5424c90e4e1
refs/heads/master
2020-04-24T23:47:30.850436
2019-04-08T19:56:10
2019-04-08T19:56:10
172,356,059
0
0
null
null
null
null
UTF-8
C++
false
false
9,301
cpp
#include "Settings.h" #include <opencv2/calib3d.hpp> #include <opencv2/highgui.hpp> #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/xml_parser.hpp> #include <boost/foreach.hpp> #include "Polarization.h" namespace POL { Settings::Settings() : goodInput(false) { } Settings::~Settings() { } void Settings::write(cv::FileStorage& fs) const //Write serialization for this class { fs << "{" << "BoardSize_Width" << boardSize.width << "BoardSize_Height" << boardSize.height << "Square_Size" << squareSize << "Calibrate_Pattern" << patternToUse << "Calibrate_NrOfFrameToUse" << nrFrames << "Calibrate_FixAspectRatio" << aspectRatio << "Calibrate_AssumeZeroTangentialDistortion" << calibZeroTangentDist << "Calibrate_FixPrincipalPointAtTheCenter" << calibFixPrincipalPoint << "Write_DetectedFeaturePoints" << writePoints << "Write_extrinsicParameters" << writeExtrinsics << "Write_outputFileName" << outputFileName << "Show_UndistortedImage" << showUndistorsed << "Input_FlipAroundHorizontalAxis" << flipVertical << "Input_Delay" << delay << "Input" << input << "}"; } void Settings::read(const cv::FileNode& node) //Read serialization for this class { node["BoardSize_Width"] >> boardSize.width; node["BoardSize_Height"] >> boardSize.height; node["Calibrate_Pattern"] >> patternToUse; node["Square_Size"] >> squareSize; node["Calibrate_NrOfFrameToUse"] >> nrFrames; node["Calibrate_FixAspectRatio"] >> aspectRatio; node["Write_DetectedFeaturePoints"] >> writePoints; node["Write_extrinsicParameters"] >> writeExtrinsics; node["Write_outputFileName"] >> outputFileName; node["Calibrate_AssumeZeroTangentialDistortion"] >> calibZeroTangentDist; node["Calibrate_FixPrincipalPointAtTheCenter"] >> calibFixPrincipalPoint; node["Calibrate_UseFisheyeModel"] >> useFisheye; node["Input_FlipAroundHorizontalAxis"] >> flipVertical; node["Show_UndistortedImage"] >> showUndistorsed; node["Input"] >> input; node["Input_Delay"] >> delay; node["Fix_K1"] >> fixK1; node["Fix_K2"] >> fixK2; node["Fix_K3"] >> fixK3; node["Fix_K4"] >> fixK4; node["Fix_K5"] >> fixK5; node["image_width"] >> imWidth; node["image_height"] >> imHeight; node["camera_matrix"] >> cameraMatrix; node["distortion_coefficients"] >> distCoef; validate(); } void Settings::validate() { goodInput = true; if (boardSize.width <= 0 || boardSize.height <= 0) { cerr << "Invalid Board size: " << boardSize.width << " " << boardSize.height << endl; goodInput = false; } if (squareSize <= 10e-6) { cerr << "Invalid square size " << squareSize << endl; goodInput = false; } if (nrFrames <= 0) { cerr << "Invalid number of frames " << nrFrames << endl; goodInput = false; } if (!(v_raw_sep == Polarization::RAW || v_raw_sep == Polarization::SEPARATED)) { error("invalid calibration image type: ", "Please enter 'raw' or 'sep' at the settings file"); goodInput = false; } if (input.empty()) // Check for valid input inputType = INVALID; else { if (input[0] >= '0' && input[0] <= '9') { stringstream ss(input); ss >> cameraID; inputType = CAMERA; } else { if (isListOfImages(input) && readStringList(input, imageList)) { inputType = IMAGE_LIST; nrFrames = (nrFrames < (int)imageList.size()) ? nrFrames : (int)imageList.size(); } else inputType = VIDEO_FILE; } if (inputType == CAMERA) inputCapture.open(cameraID); if (inputType == VIDEO_FILE) inputCapture.open(input); if (inputType != IMAGE_LIST && !inputCapture.isOpened()) inputType = INVALID; } if (inputType == INVALID) { cerr << " Input does not exist: " << input; goodInput = false; } flag = 0; if (calibFixPrincipalPoint) flag |= cv::CALIB_FIX_PRINCIPAL_POINT; if (calibZeroTangentDist) flag |= cv::CALIB_ZERO_TANGENT_DIST; if (aspectRatio) flag |= cv::CALIB_FIX_ASPECT_RATIO; if (fixK1) flag |= cv::CALIB_FIX_K1; if (fixK2) flag |= cv::CALIB_FIX_K2; if (fixK3) flag |= cv::CALIB_FIX_K3; if (fixK4) flag |= cv::CALIB_FIX_K4; if (fixK5) flag |= cv::CALIB_FIX_K5; if (useFisheye) { // the fisheye model has its own enum, so overwrite the flags flag = cv::fisheye::CALIB_FIX_SKEW | cv::fisheye::CALIB_RECOMPUTE_EXTRINSIC; if (fixK1) flag |= cv::fisheye::CALIB_FIX_K1; if (fixK2) flag |= cv::fisheye::CALIB_FIX_K2; if (fixK3) flag |= cv::fisheye::CALIB_FIX_K3; if (fixK4) flag |= cv::fisheye::CALIB_FIX_K4; if (calibFixPrincipalPoint) flag |= cv::fisheye::CALIB_FIX_PRINCIPAL_POINT; } calibrationPattern = NOT_EXISTING; if (!patternToUse.compare("CHESSBOARD")) calibrationPattern = CHESSBOARD; if (!patternToUse.compare("CIRCLES_GRID")) calibrationPattern = CIRCLES_GRID; if (!patternToUse.compare("ASYMMETRIC_CIRCLES_GRID")) calibrationPattern = ASYMMETRIC_CIRCLES_GRID; if (calibrationPattern == NOT_EXISTING) { cerr << " Camera calibration mode does not exist: " << patternToUse << endl; goodInput = false; } atImageList = 0; } cv::Mat Settings::nextImage() { cv::Mat result; if (inputCapture.isOpened()) { cv::Mat view0; inputCapture >> view0; view0.copyTo(result); } else if (atImageList < imageList.size()) result = cv::imread(imageList[atImageList++], cv::IMREAD_COLOR); return result; } bool Settings::readStringList(const string& filename, vector<string>& l) { // Create empty property tree object namespace pt = boost::property_tree; pt::ptree tree; // Parse the XML into the property tree. pt::read_xml(filename, tree); l.clear(); //cv::FileStorage fs(filename, cv::FileStorage::READ); //if (!fs.isOpened()) // return false; //cv::FileNode n = fs.getFirstTopLevelNode(); //if (n.type() != cv::FileNode::SEQ) // return false; //cv::FileNodeIterator it = n.begin(), it_end = n.end(); //for (; it != it_end; ++it) // l.push_back((string)*it); // Parse the XML into the property tree. pt::read_xml(filename, tree); BOOST_FOREACH(boost::property_tree::ptree::value_type &v, tree.get_child("opencv_storage.Images")) l.push_back(v.second.data()); return true; } bool Settings::isListOfImages(const string& filename) { string s(filename); // Look for file extension if (s.find(".xml") == string::npos && s.find(".yaml") == string::npos && s.find(".yml") == string::npos) return false; else return true; } void Settings::setUp(const string &filename) { // Create empty property tree object namespace pt = boost::property_tree; pt::ptree tree; // Parse the XML into the property tree. pt::read_xml(filename, tree); // Use get_child to find the node containing the modules, and iterate over // its children. If the path cannot be resolved, get_child throws. // A C++11 for-range loop would also work. int widt = 0, height = 0; BOOST_FOREACH(pt::ptree::value_type &v, tree.get_child("polarization_settings.camera_calibration")) { // The data function is used to access the data stored in a node. if (v.first == "BoardSize_Width")stringstream(v.second.data()) >> widt; else if (v.first == "BoardSize_Height")stringstream(v.second.data()) >> height; else if (v.first == "Square_Size")stringstream(v.second.data()) >> squareSize; else if (v.first == "Calibrate_Pattern")stringstream(v.second.data()) >> patternToUse; else if (v.first == "Input") input = v.second.data(); else if (v.first == "Input_FlipAroundHorizontalAxis")stringstream(v.second.data()) >> flipVertical; else if (v.first == "Input_Delay")stringstream(v.second.data()) >> delay; else if (v.first == "Calibrate_NrOfFrameToUse")stringstream(v.second.data()) >> nrFrames; else if (v.first == "Calibrate_FixAspectRatio")stringstream(v.second.data()) >> aspectRatio; else if (v.first == "Calibrate_AssumeZeroTangentialDistortion")stringstream(v.second.data()) >> calibZeroTangentDist; else if (v.first == "Calibrate_FixPrincipalPointAtTheCenter")stringstream(v.second.data()) >> calibFixPrincipalPoint; else if (v.first == "Write_outputFileName")stringstream(v.second.data()) >> outputFileName; else if (v.first == "Write_DetectedFeaturePoints")stringstream(v.second.data()) >> writePoints; else if (v.first == "Write_extrinsicParameters")stringstream(v.second.data()) >> writeExtrinsics; else if (v.first == "Show_UndistortedImage")stringstream(v.second.data()) >> showUndistorsed; else if (v.first == "Calibrate_UseFisheyeModel")stringstream(v.second.data()) >> useFisheye; else if (v.first == "Fix_K1")stringstream(v.second.data()) >> fixK1; else if (v.first == "Fix_K2")stringstream(v.second.data()) >> fixK2; else if (v.first == "Fix_K3")stringstream(v.second.data()) >> fixK3; else if (v.first == "Fix_K4")stringstream(v.second.data()) >> fixK4; else if (v.first == "Fix_K5")stringstream(v.second.data()) >> fixK5; else if (v.first == "Raw_Sep")stringstream(v.second.data()) >> v_raw_sep; } boardSize = cv::Size(widt, height); validate(); } }
[ "onah.ifeanyi02@gmail.com" ]
onah.ifeanyi02@gmail.com
538cae4544d6bd2d448d607171ac87b391fc513e
bc563a420e0c0be4788f302914ce6d917f5d3b34
/src/alarm/AlarmObserver.h
1d8a4237fd1f7ad6adcecdc32cb9eaa8c6917708
[ "MIT" ]
permissive
alexeylysenko/SmartHome
720adfc4dbd7275e7dcb53bd625f3cd2ff5d114b
63b6514a36a93737087713a2f07e6672f5621520
refs/heads/master
2020-12-22T22:16:37.702937
2020-02-06T10:18:39
2020-02-06T10:18:39
236,945,810
0
0
MIT
2020-02-06T10:18:41
2020-01-29T09:29:34
null
UTF-8
C++
false
false
582
h
#ifndef ALARMOBSERVER_H #define ALARMOBSERVER_H #include <QObject> #include "AlarmData.h" class AlarmManager; class AlarmObserver : public QObject { Q_GADGET public: explicit AlarmObserver(AlarmManager *alarmManager); void addAlarm(AlarmData *alarm); void removeAlarm(AlarmData *alarm); void updateAlarm(AlarmData *alarm); protected: void timerEvent(QTimerEvent *event) override; private: void checkAlarms(); AlarmManager *mAlarmManager; QMultiHash<QString, AlarmData *> mTimeAlarmHash; QHash<int, QString> mIdTimeHash; }; #endif // ALARMOBSERVER_H
[ "oleksii.lysenko@intive.com" ]
oleksii.lysenko@intive.com
1aa06fea14cd14882cdf6aed6ba968ab89ff5744
e8a562e13ca47764ba96cb47b9e0c477447a6296
/string/suffixarray/sol/correct.cpp
bb0255e5613fd3996b078c74a630658315dbee39
[ "Apache-2.0" ]
permissive
yosupo06/library-checker-problems
0600700ee39a7b32fdec635076d75ee270c0e636
9d8930c908153adc3bd3f50999d782c89f666725
refs/heads/master
2023-08-22T19:59:02.303444
2023-08-10T07:58:08
2023-08-10T07:58:08
189,480,738
440
129
Apache-2.0
2023-09-12T08:39:13
2019-05-30T20:49:42
C++
UTF-8
C++
false
false
3,631
cpp
#include <iostream> #include <vector> using namespace std; using uint = unsigned int; using ll = long long; using ull = unsigned long long; constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); } template <class T> using V = vector<T>; template <class T> using VV = V<V<T>>; template <class Str> struct SA { Str s; V<int> sa, rsa, lcp; SA() {} SA(Str _s, V<int> _sa) : s(_s), sa(_sa) { int n = int(s.size()); // make rsa rsa = V<int>(n + 1); for (int i = 0; i <= n; i++) { rsa[sa[i]] = i; } // make lcp lcp = V<int>(n); int h = 0; for (int i = 0; i < n; i++) { int j = sa[rsa[i] - 1]; if (h > 0) h--; for (; j + h < n && i + h < n; h++) { if (s[j + h] != s[i + h]) break; } lcp[rsa[i] - 1] = h; } } }; template <class Str> V<int> sa_is(Str s, int B = 200) { int n = int(s.size()); V<int> sa(n + 1); if (n == 0) return sa; for (int i = 0; i < n; i++) s[i]++; s.push_back(0); B++; V<bool> ls(n + 1); ls[n] = true; for (int i = n - 1; i >= 0; i--) { ls[i] = (s[i] == s[i + 1]) ? ls[i + 1] : (s[i] < s[i + 1]); } V<int> sum_l(B + 1), sum_s(B + 1); for (int i = 0; i <= n; i++) { if (!ls[i]) sum_s[s[i]]++; else sum_l[s[i] + 1]++; } for (int i = 0; i < B; i++) { sum_l[i + 1] += sum_s[i]; sum_s[i + 1] += sum_l[i + 1]; } auto induce = [&](const V<int>& lms) { fill(begin(sa), end(sa), -1); auto buf0 = sum_s; for (auto d : lms) { sa[buf0[s[d]]++] = d; } auto buf1 = sum_l; for (int i = 0; i <= n; i++) { int v = sa[i]; if (v >= 1 && !ls[v - 1]) { sa[buf1[s[v - 1]]++] = v - 1; } } auto buf2 = sum_l; for (int i = n; i >= 0; i--) { int v = sa[i]; if (v >= 1 && ls[v - 1]) { sa[--buf2[s[v - 1] + 1]] = v - 1; } } }; V<int> lms, lms_map(n + 1, -1); for (int i = 1; i <= n; i++) { if (!ls[i - 1] && ls[i]) { lms_map[i] = int(lms.size()); lms.push_back(i); } } induce(lms); if (lms.size() >= 2) { int m = int(lms.size()) - 1; V<int> lms2; for (int v : sa) { if (lms_map[v] != -1) lms2.push_back(v); } int rec_n = 1; V<int> rec_s(m); rec_s[lms_map[lms2[1]]] = 1; for (int i = 2; i <= m; i++) { int l = lms2[i - 1], r = lms2[i]; int nl = lms[lms_map[l] + 1], nr = lms[lms_map[r] + 1]; if (nl - l != nr - r) rec_n++; else { while (l <= nl) { if (s[l] != s[r]) { rec_n++; break; } l++; r++; } } rec_s[lms_map[lms2[i]]] = rec_n; } V<int> nx_lms; auto ch_sa = sa_is(rec_s, rec_n); for (int d : ch_sa) { nx_lms.push_back(lms[d]); } induce(nx_lms); } return sa; } int main() { static char buf[1'000'000]; string s; scanf("%s", buf); s = buf; SA<string> sa(s, sa_is(s)); int n = int(s.size()); for (int i = 1; i <= n; i++) { printf("%d", sa.sa[i]); if (i != n) printf(" "); } printf("\n"); return 0; }
[ "yosupo06@gmail.com" ]
yosupo06@gmail.com
7c443d5f2e0612e5ce51809e7bdccbeea1b6e0c0
bcc4dbd702a96c53540f45c85acc0d17c27bff9f
/src/GameLibrary/Screen/UI/MenuScreen.h
c3561be7e5d08c39b9ca1736c031092284fe5d1a
[]
no_license
ratalaika/MobileBrawler
d4e4e1e195fb5c229449d8a473154c4d96653ad2
4e0c1fd2c3276c9c6058f539f29ba823269bde1c
refs/heads/master
2021-01-23T23:26:28.367462
2015-03-23T17:25:30
2015-03-23T17:25:35
null
0
0
null
null
null
null
UTF-8
C++
false
false
11,776
h
#pragma once #include "../Screen.h" #include "ActorMenuElement.h" #include "../../Actor/Actor.h" #include "../../Actor/SpriteActor.h" #include "../../Actor/Animation.h" #include "../../Actor/TextActor.h" #include "../../Graphics/Graphics.h" #include "../../Input/Keyboard.h" #include <climits> namespace GameLibrary { /*! The selected index when a MenuScreen has not selected an item*/ #define MENUSCREEN_NOSELECTION ACTORMENU_NOSELECTION /*! Thin Screen wrapper around ActorMenuElement. The main difference is that this class DOES automatically handle deallocation of any added Actor pointers.*/ class MenuScreen : public Screen { public: /*! default constructor*/ MenuScreen(); /*! Constructs a MenuScreen to be the root Screen of a Window. Only one screen in any Screen stack should be delegated as the root Screen. \param window the Window that the Screen will be contained within*/ MenuScreen(Window*window); /*! virtual destructor*/ virtual ~MenuScreen(); MenuScreen(const MenuScreen&) = delete; MenuScreen& operator=(const MenuScreen&) = delete; /*! Adds a SpriteActor. This Actor's deallocation will be automatically handled when this Screen is deallocated \param actor a SpriteActor pointer \returns the index of the added SpriteActor \throws GameLibrary::IllegalArgumentException if actor argument is null*/ unsigned int addItem(SpriteActor*actor); /*! Adds a SpriteActor that will be automatically resized by the AutoLayout. This Actor's deallocation will be automatically handled when this Screen is deallocated \param bounds the ratio in the frame where the Actor will be laid out \param actor a SpriteActor pointer \returns the index of the added SpriteActor \throws GameLibrary::IllegalArgumentException if actor argument is null*/ unsigned int addItem(const RectD&bounds, SpriteActor*actor); /*! Creates and adds a SpriteActor. \param position the position of the Actor in the Screen \param animation the default Animation of the Actor \param direction the default Animation::Direction of the Actor \param destructAnimation true to have the Actor handle deallocation of the Animation, or false to manually handle deallocation of the Animation \throws GameLibrary::IllegalArgumentException if the animation argument is null, or if direction is not a valid Animation::Direction*/ unsigned int addItem(const Vector2d&position, Animation*animation, const Animation::Direction&direction=Animation::FORWARD, bool destructAnimation=true); /*! Creates and adds a SpriteActor that will be automatically resized by the AutoLayout. \param bounds the ratio in the frame where the Actor will be laid out \param animation the default Animation of the Actor \param direction the default Animation::Direction of the Actor \param destructAnimation true to have the Actor handle deallocation of the Animation, or false to manually handle deallocation of the Animation \throws GameLibrary::IllegalArgumentException if the animation argument is null, or if direction is not a valid Animation::Direction*/ unsigned int addItem(const RectD&bounds, Animation*animation, const Animation::Direction&direction=Animation::FORWARD, bool destructAnimation=true); /*! Adds a TextActor. This Actor's deallocation will be automatically handled when this Screen is deallocated. \param actor a TextActor pointer \throws GameLibrary::IllegalArgumentException if actor argument is null*/ unsigned int addItem(TextActor*actor); /*! Adds a TextActor that will be automatically resized by the AutoLayout. This Actor's deallocation will be automatically handled when this Screen is deallocated. \param bounds the ratio in the frame where the Actor will be laid out \param actor a TextActor pointer \throws GameLibrary::IllegalArgumentException if actor argument is null*/ unsigned int addItem(const RectD&bounds, TextActor*actor); /*! Creates and adds a TextActor. \param position the position of the Actor in the Screen \param text a string to display \param font a font to use to display the text \param color the text color \param fontSize the glyph size of the font \param fontStyle the style (plain, bold italic, etc.) of the font \see GameLibrary::Font::Style \param alignment the alignment of the text, relative the origin \see GameLibrary::TextActor::TextAlignment*/ unsigned int addItem(const Vector2d&position, const String&text, Font*font=Graphics::getDefaultFont(), const Color&color=Color::BLACK, unsigned int fontsize=18, int fontstyle=Font::STYLE_PLAIN, const TextActor::TextAlignment&alignment=TextActor::ALIGN_CENTER); /*! Creates and adds a TextActor that will be automatically resized by the AutoLayout. \param bounds the ratio in the frame where the Actor will be laid out \param text a string to display \param font a font to use to display the text \param color the text color \param fontSize the glyph size of the font \param fontStyle the style (plain, bold italic, etc.) of the font \see GameLibrary::Font::Style \param alignment the alignment of the text, relative the origin \see GameLibrary::TextActor::TextAlignment*/ unsigned int addItem(const RectD&bounds, const String&text, Font*font=Graphics::getDefaultFont(), const Color&color=Color::BLACK, unsigned int fontsize=18, int fontstyle=Font::STYLE_PLAIN, const TextActor::TextAlignment&alignment=TextActor::ALIGN_CENTER); /*! Removes and deallocates a previously added Actor pointer. \param index the index of the Actor. When an Actor is removed, the indexes of other Actors may change*/ void removeItem(unsigned int index); /*! Gets the total number of items stored in the menu. \returns an unsigned int representing the total amount of Actor pointers added to the menu*/ unsigned int getTotalItems(); /*! Gets an Actor pointer at a given index. \param index the index of the Actor \returns an Actor pointer*/ Actor* getItem(unsigned int index) const; /*! Called when an Actor in the menu is hovered over by a mouse or touch instance. \param index the index of the Actor*/ virtual void onItemHover(unsigned int index); /*! Called when an Actor in the menu finished being hovered over by a mouse or touch instance. \param index the index of the Actor*/ virtual void onItemHoverFinish(unsigned int index); /*! Called when an Actor in the menu is pressed by a mouse or touch instance. \param index the index of the Actor*/ virtual void onItemPress(unsigned int index); /*! Called when an Actor in the menu has a pressed mouse or touch instance leave the vicinity of the Actor, or some other event cancels the press. \param index the index of the Actor*/ virtual void onItemPressCancel(unsigned int index); /*! Called when an Actor in the menu is released by a mouse or touch instance that previously pressed it. \param index the index of the Actor*/ virtual void onItemRelease(unsigned int index); /*! Called after an Actor in the menu is released. Menu button actions should be handled here. \param index the index of the Actor*/ virtual void onItemSelect(unsigned int index); /*! Manually sets the current hover to the next Actor above the current one, or the first Actor in the list, if no Actor is currently hovered. This function automatically sets the Keyboard to be the enabled input for this menu.*/ virtual void moveHoverUp(); /*! Manually sets the current hover to the next Actor below the current one, or the last Actor in the list, if no Actor is currently hovered. This function automatically sets the Keyboard to be the enabled input for this menu.*/ virtual void moveHoverDown(); /*! Manually sets the current hover to the next Actor to the left of the current one, or the first Actor in the list, if no Actor is currently hovered. This function automatically sets the Keyboard to be the enabled input for this menu.*/ virtual void moveHoverLeft(); /*! Manually sets the current hover to the next Actor to the right of the current one, or the last Actor in the list, if no Actor is currently hovered. This function automatically sets the Keyboard to be the enabled input for this menu.*/ virtual void moveHoverRight(); /*! Calls onActorSelect(unsigned int) for the currently hovered Actor, or does nothing if no Actor is currently hovered. \returns true if an Actor was selected, or false if otherwise*/ virtual bool selectCurrentIndex(); /*! Adds a keyboard key to manually move up in the menu. \param key a key constant*/ void addUpKey(const Keyboard::Key&key); /*! Adds a keyboard key to manually move down in the menu. \param key a key constant*/ void addDownKey(const Keyboard::Key&key); /*! Adds a keyboard key to manually move left in the menu. \param key a key constant*/ void addLeftKey(const Keyboard::Key&key); /*! Adds a keyboard key to manually move right in the menu. \param key a key constant*/ void addRightKey(const Keyboard::Key&key); /*! Adds a keyboard key to manually select the current menu item. \param key a key constant*/ void addSelectKey(const Keyboard::Key&key); /*! Removes all the added keys from the menu.*/ void clearKeys(); /*! Enables keyboard input instead of mouse or touch input. The keyboard is automatically enabled if one of the added keys is pressed, and automatically disabled if one of the Actor objects becomes hovered or pressed. \param enabled true to enable keyboard input, false to disable keyboard input*/ void setKeyboardEnabled(bool enabled); /*! Clears all the current mouse states for all the Actor objects, and cancels all press states.*/ void clearMouseStates(); /*! Sets the currently hovered Actor index in the menu. This automatically enables Keyboard input. \param index the Actor index to set hovered, or MENUSCREEN_NOSELECTION for no selected index*/ void setSelectedIndex(unsigned int index); /*! Tells if the menu's input is currently set to the keyboard. \returns true if input is set to the keyboard, and false if input is set to mouse or touch*/ bool isKeyboardEnabled() const; /*! Gets the currently hovered Actor index in the menu. \returns an index for an Actor in the menu, or MENUSCREEN_NOSELECTION if no index is selected*/ unsigned int getSelectedIndex() const; /*! Gets the automatic layout manager for the contained actors. \returns a const AutoLayout reference*/ const AutoLayout& getAutoActorLayout() const; protected: /*! Called to draw an Actor in the menu. This function can be overridden to add custom drawing behavior. \param appData specifies information about the Application drawing the Actor, such as the Window object, the View transform, etc. \see GameLibrary::ApplicationData \param graphics the Graphics object used to draw the Actor \param actor the Actor from the menu being drawn*/ virtual void drawItem(ApplicationData appData, Graphics graphics, Actor*item) const; private: class MainElement : public ActorMenuElement { private: MenuScreen*menuScreen; protected: virtual void drawActor(ApplicationData appData, Graphics graphics, Actor*actor) const override; public: MainElement(MenuScreen*menuScreen, const RectangleD&frame); virtual ~MainElement(); virtual void onActorHover(unsigned int index) override; virtual void onActorHoverFinish(unsigned int index) override; virtual void onActorPress(unsigned int index) override; virtual void onActorPressCancel(unsigned int index) override; virtual void onActorRelease(unsigned int index) override; virtual void onActorSelect(unsigned int index) override; }; MainElement* mainElement; }; }
[ "luisfinke@gmail.com" ]
luisfinke@gmail.com
69c620139e0c399160fdca425ac5ce821ab3c3c9
2ee540793f0a390d3f418986aa7e124083760535
/Online Judges/Panda OJ/INC 2016/rationalNumber.cpp
41f7dbdbd1cbeb635ba153bf3f7d19de7cc4f62e
[]
no_license
dickynovanto1103/CP
6323d27c3aed4ffa638939f26f257530993401b7
f1e5606904f22bb556b1d4dda4e574b409abc17c
refs/heads/master
2023-08-18T10:06:45.241453
2023-08-06T23:58:54
2023-08-06T23:58:54
97,298,343
0
0
null
null
null
null
UTF-8
C++
false
false
1,692
cpp
#include <bits/stdc++.h> using namespace std; #define inf 1000000000 #define unvisited -1 #define visited 1 #define eps 1e-9 #define pb push_back typedef long long ll; typedef vector<int> vi; typedef pair<int,int> ii; typedef vector<ii> vii; bool isprime[31701]; int prime[3410]; void sieve(int n){ int i,j; isprime[0] = isprime[1] = false; for(i=2;i*i<=n;i++){ if(isprime[i]){ for(j=i*2;j<=n;j+=i){ isprime[j] = false; } } } } ll gcd(ll a, ll b){return b==0 ? a: gcd(b,a%b);} ll modPow(ll a, ll b, ll mod){ if(b==0){return 1;} else{ if(b%2==0){return (modPow(a,b/2,mod)%mod * modPow(a,b/2,mod)%mod)%mod;} else{return (a%mod*modPow(a,b-1,mod)%mod)%mod;} } } ll eulerPhi(ll n){ ll idx = 0, pf = prime[idx], ans = n; while(pf*pf<=n){ if(n%pf==0){ans-=ans/pf;} while(n%pf==0){n/=pf;} pf = prime[++idx]; } if(n!=1){ans-=ans/n;} return ans; } int main() { ll i; int n = 31700, cnt = 0; memset(isprime,true,sizeof isprime); sieve(n); for(i=0;i<=n;i++){ if(isprime[i]){prime[cnt] = i; cnt++;} } int tc; ll a,b; scanf("%d",&tc); int test = 1; while(tc--){ printf("Case #%d: ",test++); scanf("%lld %lld",&a,&b); a = abs(a); b = abs(b); int pembagi = gcd(a,b); a/=pembagi; b/=pembagi; //ilangin faktor 2 dan 5 dari b; while(b%2==0){b/=2;} while(b%5==0){b/=5;} ll tot = eulerPhi((ll)b); ll ans = 0; if(b>1){ //cari bil yang lebih kecil dari totient yang membagi habis totient..order unit theorem ans = tot; for(i=1;i*i<=tot;i++){ if(tot%i==0){ if(modPow(10,i,b)==1){ans = min(ans,i);} ll j = tot/i; if(modPow(10,j,b)==1){ans = min(ans,j);} } } } printf("%lld\n",ans); } return 0; }
[ "dickynovanto1103@gmail.com" ]
dickynovanto1103@gmail.com
32e40f789cb473dd07bd64efc7753b4daddde258
34fb2c48d29b4aac014571cbb0d4232896380742
/数据结构/数据结构实验课文件/EXP1/代码/20354006/bubble.cpp
890f46a354205e236c9a17df0dd045d73b03ae17
[]
no_license
dkhonker/sysu
2aca46818fc9bf77ededa0d8922859c3cabbd1e7
ef3b8d0f6d5bb03b408081c932716dbd37ad0a22
refs/heads/master
2023-06-17T01:09:03.174593
2021-07-14T04:27:07
2021-07-14T04:27:07
382,212,051
0
0
null
null
null
null
UTF-8
C++
false
false
276
cpp
#include<stdio.h> int main() { int n,i,j,t; int a[10001]; scanf("%d",&n); for(i=1;i<=n;i++) scanf("%d",&a[i]); for(i=n;i>=2;i--) for(j=1;j<i;j++) if(a[j]>a[j+1]) {t=a[j]; a[j]=a[j+1]; a[j+1]=t; } for(i=1;i<=n;i++) printf("%d ",a[i]); return 0; }
[ "2373591933@qq.com" ]
2373591933@qq.com
2bcee65caa5bf8c713d43ce49c58b09150d78ac9
5eb49e30896620d40003bc42d7bd9540331ad5be
/day6/exam4/exam4.cpp
85eaa136df62438cb9a08754c4e31007028f8cfa
[]
no_license
104103annhj2081103/study
5344fcdc89e4664f2b70649030c55e1939c1ca95
cb02131cf0a653123f223a36646662e90349888f
refs/heads/master
2020-06-10T11:53:23.577666
2019-07-12T02:31:59
2019-07-12T02:31:59
193,642,485
0
0
null
null
null
null
UTF-8
C++
false
false
1,066
cpp
// exam4.cpp : 이 파일에는 'main' 함수가 포함됩니다. 거기서 프로그램 실행이 시작되고 종료됩니다. // #include <iostream> #include <stdio.h> int sumint(int num1, int num2) { int num3 = num1 + num2; printf_s("두 수를 입력하세요 : "); scanf_s("%d %d\n", &num1, &num2); num3 = num1 + num2; return num3; } int subInt(int num1, int num2) { int num3 = num1 - num2; return num3; } int mint(int num1, int num2) { int num3 = num1 * num2; return num3; } int react(int num1, int num2) { int num3 = num1 / num2; return num3; } int main() { printf_s("두 수의 합은 %d입니다.\n", sumint(2, 3)); printf_s("두 수의 합은 %d입니다.\n", sumint(3, 3)); printf_s("두 수의 합은 %d입니다.\n", sumint(4, 3)); printf_s("%d\n", subInt(7, 2)); printf_s("%d\n", subInt(10, 1)); printf_s("%d\n", subInt(6, 2)); printf_s("%d\n", mint(4, 3)); printf_s("%d\n", mint(7, 3)); printf_s("%d\n", mint(9, 6)); printf_s("%d\n", react(4, 2)); printf_s("%d\n", react(9, 3)); printf_s("%d\n", react(14, 2)); }
[ "anhj03292gmail.com" ]
anhj03292gmail.com
7a7e32f55cf28cb6767e38de9351f7cc1a81e9d6
299c03c1389dee6f3f3a1296bee2c88dde2a950b
/RJWorkshopNtuple/include/SunBase.hh
a9a8882a9ae91626ace8e4869b52200c12ab271b
[]
no_license
lawrenceleejr/RJRNtupleCreation
65a45fc1c319f521a1c3d35b1bceb2e1e9a9c079
ff1264479b61519a16313c34dd08441e8ebbb545
refs/heads/master
2021-01-18T22:43:22.366652
2016-07-28T18:46:11
2016-07-28T18:46:11
64,419,366
0
0
null
null
null
null
UTF-8
C++
false
false
6,596
hh
////////////////////////////////////////////////////////// // This class has been automatically generated on // Thu Dec 10 11:11:53 2015 by ROOT version 5.34/25 // from TTree FiducialEventsTree/Fiducial Events // found on file: Data.root ////////////////////////////////////////////////////////// #ifndef SunBase_h #define SunBase_h #include <TROOT.h> #include <TChain.h> #include <TFile.h> // Header file for the classes stored in the TTree if any. #include <vector> #include <vector> // Fixed size dimensions of array or collections stored in the TTree if any. using namespace std; class SunBase { public : TTree *fChain; //!pointer to the analyzed TTree or TChain Int_t fCurrent; //!current Tree number in a TChain // Declaration of leaf types Int_t m_jet_n; vector<float> *m_jet_pt; vector<float> *m_jet_eta; vector<float> *m_jet_phi; vector<float> *m_jet_E; vector<bool> *m_jet_btag; Int_t m_muon_n; vector<float> *m_muon_pt; vector<float> *m_muon_eta; vector<float> *m_muon_phi; Int_t m_el_n; vector<float> *m_el_pt; vector<float> *m_el_eta; vector<float> *m_el_phi; Int_t m_tau_n; vector<float> *m_tau_pt; vector<float> *m_tau_eta; vector<float> *m_tau_phi; Float_t m_met_Et; Float_t m_met_phi; Float_t m_weight; // List of branches TBranch *b_m_jet_n; //! TBranch *b_m_jet_pt; //! TBranch *b_m_jet_eta; //! TBranch *b_m_jet_phi; //! TBranch *b_m_jet_E; //! TBranch *b_m_jet_btag; //! TBranch *b_m_muon_n; //! TBranch *b_m_muon_pt; //! TBranch *b_m_muon_eta; //! TBranch *b_m_muon_phi; //! TBranch *b_m_el_n; //! TBranch *b_m_el_pt; //! TBranch *b_m_el_eta; //! TBranch *b_m_el_phi; //! TBranch *b_m_tau_n; //! TBranch *b_m_tau_pt; //! TBranch *b_m_tau_eta; //! TBranch *b_m_tau_phi; //! TBranch *b_m_met_Et; //! TBranch *b_m_met_phi; //! TBranch *b_m_weight; //! SunBase(TTree *tree=0); virtual ~SunBase(); virtual Int_t Cut(Long64_t entry); virtual Int_t GetEntry(Long64_t entry); virtual Long64_t LoadTree(Long64_t entry); virtual void Init(TTree *tree); virtual void Loop(){} virtual Bool_t Notify(); virtual void Show(Long64_t entry = -1); }; #endif //#ifdef SunBase_cxx inline SunBase::SunBase(TTree *tree) : fChain(0) { // if parameter tree is not specified (or zero), connect the file // used to generate this class and read the Tree. if (tree == 0) { TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("Data.root"); if (!f || !f->IsOpen()) { f = new TFile("Data.root"); } f->GetObject("FiducialEventsTree",tree); } Init(tree); } inline SunBase::~SunBase() { if (!fChain) return; delete fChain->GetCurrentFile(); } inline Int_t SunBase::GetEntry(Long64_t entry) { // Read contents of entry. if (!fChain) return 0; return fChain->GetEntry(entry); } inline Long64_t SunBase::LoadTree(Long64_t entry) { // Set the environment to read one entry if (!fChain) return -5; Long64_t centry = fChain->LoadTree(entry); if (centry < 0) return centry; if (fChain->GetTreeNumber() != fCurrent) { fCurrent = fChain->GetTreeNumber(); Notify(); } return centry; } inline void SunBase::Init(TTree *tree) { // The Init() function is called when the selector needs to initialize // a new tree or chain. Typically here the branch addresses and branch // pointers of the tree will be set. // It is normally not necessary to make changes to the generated // code, but the routine can be extended by the user if needed. // Init() will be called many times when running on PROOF // (once per file to be processed). // Set object pointer m_jet_pt = 0; m_jet_eta = 0; m_jet_phi = 0; m_jet_E = 0; m_jet_btag = 0; m_muon_pt = 0; m_muon_eta = 0; m_muon_phi = 0; m_el_pt = 0; m_el_eta = 0; m_el_phi = 0; m_tau_pt = 0; m_tau_eta = 0; m_tau_phi = 0; // Set branch addresses and branch pointers if (!tree) return; fChain = tree; fCurrent = -1; fChain->SetMakeClass(1); fChain->SetBranchAddress("m_jet_n", &m_jet_n, &b_m_jet_n); fChain->SetBranchAddress("m_jet_pt", &m_jet_pt, &b_m_jet_pt); fChain->SetBranchAddress("m_jet_eta", &m_jet_eta, &b_m_jet_eta); fChain->SetBranchAddress("m_jet_phi", &m_jet_phi, &b_m_jet_phi); fChain->SetBranchAddress("m_jet_E", &m_jet_E, &b_m_jet_E); fChain->SetBranchAddress("m_jet_btag", &m_jet_btag, &b_m_jet_btag); fChain->SetBranchAddress("m_muon_n", &m_muon_n, &b_m_muon_n); fChain->SetBranchAddress("m_muon_pt", &m_muon_pt, &b_m_muon_pt); fChain->SetBranchAddress("m_muon_eta", &m_muon_eta, &b_m_muon_eta); fChain->SetBranchAddress("m_muon_phi", &m_muon_phi, &b_m_muon_phi); fChain->SetBranchAddress("m_el_n", &m_el_n, &b_m_el_n); fChain->SetBranchAddress("m_el_pt", &m_el_pt, &b_m_el_pt); fChain->SetBranchAddress("m_el_eta", &m_el_eta, &b_m_el_eta); fChain->SetBranchAddress("m_el_phi", &m_el_phi, &b_m_el_phi); fChain->SetBranchAddress("m_tau_n", &m_tau_n, &b_m_tau_n); fChain->SetBranchAddress("m_tau_pt", &m_tau_pt, &b_m_tau_pt); fChain->SetBranchAddress("m_tau_eta", &m_tau_eta, &b_m_tau_eta); fChain->SetBranchAddress("m_tau_phi", &m_tau_phi, &b_m_tau_phi); fChain->SetBranchAddress("m_met_Et", &m_met_Et, &b_m_met_Et); fChain->SetBranchAddress("m_met_phi", &m_met_phi, &b_m_met_phi); fChain->SetBranchAddress("m_weight", &m_weight, &b_m_weight); Notify(); } inline Bool_t SunBase::Notify() { // The Notify() function is called when a new file is opened. This // can be either for a new TTree in a TChain or when when a new TTree // is started when using PROOF. It is normally not necessary to make changes // to the generated code, but the routine can be extended by the // user if needed. The return value is currently not used. return kTRUE; } inline void SunBase::Show(Long64_t entry) { // Print contents of entry. // If entry is not specified, print current entry if (!fChain) return; fChain->Show(entry); } inline Int_t SunBase::Cut(Long64_t entry) { // This function may be called from Loop. // returns 1 if entry is accepted. // returns -1 otherwise. return 1; } //#endif // #ifdef SunBase_cxx
[ "lawrenceleejr@gmail.com" ]
lawrenceleejr@gmail.com
1a21b9c45436e22fd4ff22ebe0dd9eaee8fffbe0
2edc8f86d8971d07f4cbf10072a44cf43170b17a
/pku/23/2375/2375.cc
73fcbccd95cee0cdd8698eb88a3099fec601d355
[]
no_license
nya3jp/icpc
b9527da381d6f9cead905b540541f03505eb79c3
deb82dcdece5815e404f5ea33956d52a57e67158
refs/heads/master
2021-01-20T10:41:22.834961
2012-10-25T11:11:54
2012-10-25T11:19:37
4,337,683
2
2
null
null
null
null
UTF-8
C++
false
false
2,436
cc
#include <cstdio> #include <set> #include <map> #include <complex> #include <vector> #include <algorithm> #include <utility> using namespace std; typedef complex<int> P; typedef vector<P> Edges; typedef map<P,Edges> Graph; namespace std { template<class T> bool operator<(const complex<T>& a, const complex<T>& b) { return (make_pair(a.real(), a.imag()) < make_pair(b.real(), b.imag())); } } void dfs(Graph& g, P& root, Edges& result, set<P>& visited) { if (visited.count(root) > 0) return; visited.insert(root); Edges& v = g[root]; for(int i = 0; i < (int)v.size(); i++) dfs(g, v[i], result, visited); result.push_back(root); } int scc(Graph& g) { Edges order; { set<P> visited; for(Graph::iterator it = g.begin(); it != g.end(); ++it) { P root = it->first; dfs(g, root, order, visited); } } Graph r; for(Graph::iterator it = g.begin(); it != g.end(); ++it) { P a = it->first; Edges& v = it->second; for(int i = 0; i < (int)v.size(); i++) { P b = v[i]; r[b].push_back(a); } } int n = 0; { set<P> visited; for(int i = 0; i < (int)order.size(); i++) { P& root = order[i]; if (visited.count(root) == 0) { Edges v; dfs(r, root, v, visited); n++; } } } return n; } const int INF = numeric_limits<int>::max(); int main() { int w, h; scanf("%d%d", &w, &h); vector< vector<int> > field(h+2, vector<int>(w+2, INF)); for(int i = 1; i <= h; i++) { for(int j = 1; j <= w; j++) { int t; scanf("%d", &t); field[i][j] = t; } } Graph g; for(int i = 1; i <= h; i++) { for(int j = 1; j <= w; j++) { if (field[i-1][j] <= field[i][j]) g[P(i,j)].push_back(P(i-1,j)); if (field[i][j-1] <= field[i][j]) g[P(i,j)].push_back(P(i,j-1)); if (field[i+1][j] <= field[i][j]) g[P(i,j)].push_back(P(i+1,j)); if (field[i][j+1] <= field[i][j]) g[P(i,j)].push_back(P(i,j+1)); } } printf("%d\n", scc(g) - 1); return 0; }
[ "takahashi.shuhei@gmail.com" ]
takahashi.shuhei@gmail.com
204efdcb8888d348fec0d257642bdf8b8236c6de
7e90a1f8280618b97729d0b49b80c6814d0466e2
/workspace_pc/catkin_ws/devel_isolated/gazebo_msgs/include/gazebo_msgs/ODEJointProperties.h
f535d0b8c9cc916878b2190bf09623052ef3609b
[]
no_license
IreneYIN7/Map-Tracer
91909f4649a8b65afed56ae3803f0c0602dd89ff
cbbe9acf067757116ec74c3aebdd672fd3df62ed
refs/heads/master
2022-04-02T09:53:15.650365
2019-12-19T07:31:31
2019-12-19T07:31:31
null
0
0
null
null
null
null
UTF-8
C++
false
false
9,926
h
// Generated by gencpp from file gazebo_msgs/ODEJointProperties.msg // DO NOT EDIT! #ifndef GAZEBO_MSGS_MESSAGE_ODEJOINTPROPERTIES_H #define GAZEBO_MSGS_MESSAGE_ODEJOINTPROPERTIES_H #include <string> #include <vector> #include <map> #include <ros/types.h> #include <ros/serialization.h> #include <ros/builtin_message_traits.h> #include <ros/message_operations.h> namespace gazebo_msgs { template <class ContainerAllocator> struct ODEJointProperties_ { typedef ODEJointProperties_<ContainerAllocator> Type; ODEJointProperties_() : damping() , hiStop() , loStop() , erp() , cfm() , stop_erp() , stop_cfm() , fudge_factor() , fmax() , vel() { } ODEJointProperties_(const ContainerAllocator& _alloc) : damping(_alloc) , hiStop(_alloc) , loStop(_alloc) , erp(_alloc) , cfm(_alloc) , stop_erp(_alloc) , stop_cfm(_alloc) , fudge_factor(_alloc) , fmax(_alloc) , vel(_alloc) { (void)_alloc; } typedef std::vector<double, typename ContainerAllocator::template rebind<double>::other > _damping_type; _damping_type damping; typedef std::vector<double, typename ContainerAllocator::template rebind<double>::other > _hiStop_type; _hiStop_type hiStop; typedef std::vector<double, typename ContainerAllocator::template rebind<double>::other > _loStop_type; _loStop_type loStop; typedef std::vector<double, typename ContainerAllocator::template rebind<double>::other > _erp_type; _erp_type erp; typedef std::vector<double, typename ContainerAllocator::template rebind<double>::other > _cfm_type; _cfm_type cfm; typedef std::vector<double, typename ContainerAllocator::template rebind<double>::other > _stop_erp_type; _stop_erp_type stop_erp; typedef std::vector<double, typename ContainerAllocator::template rebind<double>::other > _stop_cfm_type; _stop_cfm_type stop_cfm; typedef std::vector<double, typename ContainerAllocator::template rebind<double>::other > _fudge_factor_type; _fudge_factor_type fudge_factor; typedef std::vector<double, typename ContainerAllocator::template rebind<double>::other > _fmax_type; _fmax_type fmax; typedef std::vector<double, typename ContainerAllocator::template rebind<double>::other > _vel_type; _vel_type vel; typedef boost::shared_ptr< ::gazebo_msgs::ODEJointProperties_<ContainerAllocator> > Ptr; typedef boost::shared_ptr< ::gazebo_msgs::ODEJointProperties_<ContainerAllocator> const> ConstPtr; }; // struct ODEJointProperties_ typedef ::gazebo_msgs::ODEJointProperties_<std::allocator<void> > ODEJointProperties; typedef boost::shared_ptr< ::gazebo_msgs::ODEJointProperties > ODEJointPropertiesPtr; typedef boost::shared_ptr< ::gazebo_msgs::ODEJointProperties const> ODEJointPropertiesConstPtr; // constants requiring out of line definition template<typename ContainerAllocator> std::ostream& operator<<(std::ostream& s, const ::gazebo_msgs::ODEJointProperties_<ContainerAllocator> & v) { ros::message_operations::Printer< ::gazebo_msgs::ODEJointProperties_<ContainerAllocator> >::stream(s, "", v); return s; } } // namespace gazebo_msgs namespace ros { namespace message_traits { // BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': False} // {'sensor_msgs': ['/opt/ros/melodic/share/sensor_msgs/cmake/../msg'], 'std_msgs': ['/opt/ros/melodic/share/std_msgs/cmake/../msg'], 'trajectory_msgs': ['/opt/ros/melodic/share/trajectory_msgs/cmake/../msg'], 'gazebo_msgs': ['/home/gse5/catkin_ws/src/gazebo_ros_pkgs/gazebo_msgs/msg'], 'geometry_msgs': ['/opt/ros/melodic/share/geometry_msgs/cmake/../msg']} // !!!!!!!!!!! ['__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_parsed_fields', 'constants', 'fields', 'full_name', 'has_header', 'header_present', 'names', 'package', 'parsed_fields', 'short_name', 'text', 'types'] template <class ContainerAllocator> struct IsFixedSize< ::gazebo_msgs::ODEJointProperties_<ContainerAllocator> > : FalseType { }; template <class ContainerAllocator> struct IsFixedSize< ::gazebo_msgs::ODEJointProperties_<ContainerAllocator> const> : FalseType { }; template <class ContainerAllocator> struct IsMessage< ::gazebo_msgs::ODEJointProperties_<ContainerAllocator> > : TrueType { }; template <class ContainerAllocator> struct IsMessage< ::gazebo_msgs::ODEJointProperties_<ContainerAllocator> const> : TrueType { }; template <class ContainerAllocator> struct HasHeader< ::gazebo_msgs::ODEJointProperties_<ContainerAllocator> > : FalseType { }; template <class ContainerAllocator> struct HasHeader< ::gazebo_msgs::ODEJointProperties_<ContainerAllocator> const> : FalseType { }; template<class ContainerAllocator> struct MD5Sum< ::gazebo_msgs::ODEJointProperties_<ContainerAllocator> > { static const char* value() { return "1b744c32a920af979f53afe2f9c3511f"; } static const char* value(const ::gazebo_msgs::ODEJointProperties_<ContainerAllocator>&) { return value(); } static const uint64_t static_value1 = 0x1b744c32a920af97ULL; static const uint64_t static_value2 = 0x9f53afe2f9c3511fULL; }; template<class ContainerAllocator> struct DataType< ::gazebo_msgs::ODEJointProperties_<ContainerAllocator> > { static const char* value() { return "gazebo_msgs/ODEJointProperties"; } static const char* value(const ::gazebo_msgs::ODEJointProperties_<ContainerAllocator>&) { return value(); } }; template<class ContainerAllocator> struct Definition< ::gazebo_msgs::ODEJointProperties_<ContainerAllocator> > { static const char* value() { return "# access to low level joint properties, change these at your own risk\n" "float64[] damping # joint damping\n" "float64[] hiStop # joint limit\n" "float64[] loStop # joint limit\n" "float64[] erp # set joint erp\n" "float64[] cfm # set joint cfm\n" "float64[] stop_erp # set joint erp for joint limit \"contact\" joint\n" "float64[] stop_cfm # set joint cfm for joint limit \"contact\" joint\n" "float64[] fudge_factor # joint fudge_factor applied at limits, see ODE manual for info.\n" "float64[] fmax # ode joint param fmax\n" "float64[] vel # ode joint param vel\n" ; } static const char* value(const ::gazebo_msgs::ODEJointProperties_<ContainerAllocator>&) { return value(); } }; } // namespace message_traits } // namespace ros namespace ros { namespace serialization { template<class ContainerAllocator> struct Serializer< ::gazebo_msgs::ODEJointProperties_<ContainerAllocator> > { template<typename Stream, typename T> inline static void allInOne(Stream& stream, T m) { stream.next(m.damping); stream.next(m.hiStop); stream.next(m.loStop); stream.next(m.erp); stream.next(m.cfm); stream.next(m.stop_erp); stream.next(m.stop_cfm); stream.next(m.fudge_factor); stream.next(m.fmax); stream.next(m.vel); } ROS_DECLARE_ALLINONE_SERIALIZER }; // struct ODEJointProperties_ } // namespace serialization } // namespace ros namespace ros { namespace message_operations { template<class ContainerAllocator> struct Printer< ::gazebo_msgs::ODEJointProperties_<ContainerAllocator> > { template<typename Stream> static void stream(Stream& s, const std::string& indent, const ::gazebo_msgs::ODEJointProperties_<ContainerAllocator>& v) { s << indent << "damping[]" << std::endl; for (size_t i = 0; i < v.damping.size(); ++i) { s << indent << " damping[" << i << "]: "; Printer<double>::stream(s, indent + " ", v.damping[i]); } s << indent << "hiStop[]" << std::endl; for (size_t i = 0; i < v.hiStop.size(); ++i) { s << indent << " hiStop[" << i << "]: "; Printer<double>::stream(s, indent + " ", v.hiStop[i]); } s << indent << "loStop[]" << std::endl; for (size_t i = 0; i < v.loStop.size(); ++i) { s << indent << " loStop[" << i << "]: "; Printer<double>::stream(s, indent + " ", v.loStop[i]); } s << indent << "erp[]" << std::endl; for (size_t i = 0; i < v.erp.size(); ++i) { s << indent << " erp[" << i << "]: "; Printer<double>::stream(s, indent + " ", v.erp[i]); } s << indent << "cfm[]" << std::endl; for (size_t i = 0; i < v.cfm.size(); ++i) { s << indent << " cfm[" << i << "]: "; Printer<double>::stream(s, indent + " ", v.cfm[i]); } s << indent << "stop_erp[]" << std::endl; for (size_t i = 0; i < v.stop_erp.size(); ++i) { s << indent << " stop_erp[" << i << "]: "; Printer<double>::stream(s, indent + " ", v.stop_erp[i]); } s << indent << "stop_cfm[]" << std::endl; for (size_t i = 0; i < v.stop_cfm.size(); ++i) { s << indent << " stop_cfm[" << i << "]: "; Printer<double>::stream(s, indent + " ", v.stop_cfm[i]); } s << indent << "fudge_factor[]" << std::endl; for (size_t i = 0; i < v.fudge_factor.size(); ++i) { s << indent << " fudge_factor[" << i << "]: "; Printer<double>::stream(s, indent + " ", v.fudge_factor[i]); } s << indent << "fmax[]" << std::endl; for (size_t i = 0; i < v.fmax.size(); ++i) { s << indent << " fmax[" << i << "]: "; Printer<double>::stream(s, indent + " ", v.fmax[i]); } s << indent << "vel[]" << std::endl; for (size_t i = 0; i < v.vel.size(); ++i) { s << indent << " vel[" << i << "]: "; Printer<double>::stream(s, indent + " ", v.vel[i]); } } }; } // namespace message_operations } // namespace ros #endif // GAZEBO_MSGS_MESSAGE_ODEJOINTPROPERTIES_H
[ "sh9339@outlook.com" ]
sh9339@outlook.com
e91d1ad1bdccff7e0bd1fcdad5dc55296e2e3dde
8442aaaf90bb106b53791ff8adb16505973fdb1e
/27/sources/main.cpp
3e0cfbcfe7624026067d7a706260792be4422db6
[]
no_license
ajile/bmtsu-cpp-2
18bd5499d8f7edf828f1d3bbdcdb5002455d090b
69db355e952d6956f326ca5a455871a0a9e594c4
refs/heads/master
2021-01-13T07:21:05.922056
2017-02-01T11:02:41
2017-02-01T11:02:50
79,021,075
1
0
null
null
null
null
UTF-8
C++
false
false
2,085
cpp
#include <iostream> #include <stdio.h> #include <string> #include <vector> using namespace std; class Expression { string expression; public: Expression (string); string getExpression() { return expression; }; int countOperations() { int length = expression.size(); int counter = 0; for (int i = 0; i < length; ++i) { if (expression[i] == '+' || expression[i] == '-' || expression[i] == '/' || expression[i] == '*') { counter++; } } return counter; }; }; Expression::Expression(string exp) { expression = exp; } struct ListNode { ListNode* next = NULL; Expression* value = NULL; }; int main(void) { Expression * exp1 = new Expression("2+4"); Expression * exp2 = new Expression("7*10-2"); Expression * exp3 = new Expression("12-3+1/2"); Expression * expressions[3] = { exp1, exp2, exp3 }; /* Expression * expressions = new Expression [3] = (Expression("123+213")); */ int counter; counter = 0; for (int i = 0; i < sizeof(expressions) / sizeof(*expressions); ++i){ string exp = expressions[i] -> getExpression(); int count = expressions[i] -> countOperations(); counter += count; cout << "Expression '" << exp << "' contains " << count << " operations;" << endl; } cout << "(array) Total amount of operations is " << counter << endl; ListNode *expNode1, *expNode2, *expNode3; expNode1 = new ListNode(); expNode2 = new ListNode(); expNode3 = new ListNode(); expNode1 -> value = exp1; expNode2 -> value = exp2; expNode3 -> value = exp3; expNode1 -> next = expNode2; expNode2 -> next = expNode3; ListNode * expression = expNode1; counter = 0; do { string exp = expression -> value -> getExpression(); int count = expression -> value -> countOperations(); counter += count; cout << "Expression '" << exp << "' contains " << count << " operations;" << endl; expression = expression -> next; } while (expression); cout << "(list) Total amount of operations is " << counter << endl; return 0; }
[ "v.v.milkov@gmail.com" ]
v.v.milkov@gmail.com
accf875f523d2b3db1ad9741b33207313d6c8ac8
755a93e7bc3376481f696a48717e369563c39b72
/Hazel/vendor/spdlog/bench/bench.cpp
756b04a2a56b31cf1153ec3a181eccc969a0e6a0
[ "MIT", "Apache-2.0" ]
permissive
kiseop91/CI_test
d0dcd0ede9183b821603362ce58af645a309d7a1
426cddb22419392d6f88f52bb63ed580165bbf4d
refs/heads/master
2020-11-25T21:59:53.040208
2019-12-19T02:25:00
2019-12-19T02:25:00
228,863,305
0
1
Apache-2.0
2019-12-18T16:22:55
2019-12-18T14:59:35
C++
UTF-8
C++
false
false
8,542
cpp
// // Copyright(c) 2015 Gabi Melman. // Distributed under the MIT License (http://opensource.org/licenses/MIT) // // // bench.cpp : spdlog benchmarks // #include "spdlog/spdlog.h" #include "spdlog/async.h" #include "spdlog/sinks/basic_file_sink.h" #include "spdlog/sinks/daily_file_sink.h" #include "spdlog/sinks/null_sink.h" #include "spdlog/sinks/rotating_file_sink.h" #include "utils.h" #include <atomic> #include <cstdlib> // EXIT_FAILURE #include <memory> #include <string> #include <thread> using namespace std; using namespace std::chrono; using namespace spdlog; using namespace spdlog::sinks; using namespace utils; void bench(int howmany, std::shared_ptr<spdlog::logger> log); void bench_mt(int howmany, std::shared_ptr<spdlog::logger> log, int thread_count); void bench_default_api(int howmany, std::shared_ptr<spdlog::logger> log); void bench_c_string(int howmany, std::shared_ptr<spdlog::logger> log); int main(int argc, char *argv[]) { spdlog::default_logger()->set_pattern("[%^%l%$] %v"); int howmany = 1000000; int queue_size = howmany + 2; int threads = 10; size_t file_size = 30 * 1024 * 1024; size_t rotating_files = 5; try { if (argc > 1) howmany = atoi(argv[1]); if (argc > 2) threads = atoi(argv[2]); if (argc > 3) queue_size = atoi(argv[3]); spdlog::info("**************************************************************"); spdlog::info("Single thread, {:n} iterations", howmany); spdlog::info("**************************************************************"); auto basic_st = spdlog::basic_logger_st("basic_st", "logs/basic_st.log", true); bench(howmany, std::move(basic_st)); basic_st.reset(); auto rotating_st = spdlog::rotating_logger_st("rotating_st", "logs/rotating_st.log", file_size, rotating_files); bench(howmany, std::move(rotating_st)); auto daily_st = spdlog::daily_logger_st("daily_st", "logs/daily_st.log"); bench(howmany, std::move(daily_st)); bench(howmany, spdlog::create<null_sink_st>("null_st")); spdlog::info("**************************************************************"); spdlog::info("Default API. Single thread, {:n} iterations", howmany); spdlog::info("**************************************************************"); basic_st = spdlog::basic_logger_st("basic_st", "logs/basic_st.log", true); bench_default_api(howmany, std::move(basic_st)); rotating_st = spdlog::rotating_logger_st("rotating_st", "logs/rotating_st.log", file_size, rotating_files); bench_default_api(howmany, std::move(rotating_st)); daily_st = spdlog::daily_logger_st("daily_st", "logs/daily_st.log"); bench_default_api(howmany, std::move(daily_st)); bench_default_api(howmany, spdlog::create<null_sink_st>("null_st")); spdlog::info("**************************************************************"); spdlog::info("C-string (500 bytes). Single thread, {:n} iterations", howmany); spdlog::info("**************************************************************"); basic_st = spdlog::basic_logger_st("basic_st", "logs/basic_cs.log", true); bench_c_string(howmany, std::move(basic_st)); rotating_st = spdlog::rotating_logger_st("rotating_st", "logs/rotating_cs.log", file_size, rotating_files); bench_c_string(howmany, std::move(rotating_st)); daily_st = spdlog::daily_logger_st("daily_st", "logs/daily_cs.log"); bench_c_string(howmany, std::move(daily_st)); bench_c_string(howmany, spdlog::create<null_sink_st>("null_st")); spdlog::info("**************************************************************"); spdlog::info("{:n} threads sharing same logger, {:n} iterations", threads, howmany); spdlog::info("**************************************************************"); auto basic_mt = spdlog::basic_logger_mt("basic_mt", "logs/basic_mt.log", true); bench_mt(howmany, std::move(basic_mt), threads); auto rotating_mt = spdlog::rotating_logger_mt("rotating_mt", "logs/rotating_mt.log", file_size, rotating_files); bench_mt(howmany, std::move(rotating_mt), threads); auto daily_mt = spdlog::daily_logger_mt("daily_mt", "logs/daily_mt.log"); bench_mt(howmany, std::move(daily_mt), threads); bench_mt(howmany, spdlog::create<null_sink_mt>("null_mt"), threads); spdlog::info("**************************************************************"); spdlog::info("Asyncronous.. {:n} threads sharing same logger, {:n} iterations", threads, howmany); spdlog::info("**************************************************************"); for (int i = 0; i < 3; ++i) { spdlog::init_thread_pool(static_cast<size_t>(queue_size), 1); auto as = spdlog::basic_logger_mt<spdlog::async_factory>("async", "logs/basic_async.log", true); bench_mt(howmany, std::move(as), threads); } } catch (std::exception &ex) { spdlog::error(ex.what()); return EXIT_FAILURE; } return EXIT_SUCCESS; } void bench(int howmany, std::shared_ptr<spdlog::logger> log) { using std::chrono::high_resolution_clock; auto start = high_resolution_clock::now(); for (auto i = 0; i < howmany; ++i) { log->info("Hello logger: msg number {}", i); } auto delta = high_resolution_clock::now() - start; auto delta_d = duration_cast<duration<double>>(delta).count(); spdlog::info("{:<16} Elapsed: {:0.2f} secs {:>16n}/sec", log->name(), delta_d, int(howmany / delta_d)); spdlog::drop(log->name()); } void bench_mt(int howmany, std::shared_ptr<spdlog::logger> log, int thread_count) { using std::chrono::high_resolution_clock; vector<thread> threads; auto start = high_resolution_clock::now(); for (int t = 0; t < thread_count; ++t) { threads.push_back(std::thread([&]() { for (int j = 0; j < howmany / thread_count; j++) { log->info("Hello logger: msg number {}", j); } })); } for (auto &t : threads) { t.join(); }; auto delta = high_resolution_clock::now() - start; auto delta_d = duration_cast<duration<double>>(delta).count(); spdlog::info("{:<16} Elapsed: {:0.2f} secs {:>16n}/sec", log->name(), delta_d, int(howmany / delta_d)); spdlog::drop(log->name()); } void bench_default_api(int howmany, std::shared_ptr<spdlog::logger> log) { using std::chrono::high_resolution_clock; auto orig_default = spdlog::default_logger(); spdlog::set_default_logger(log); auto start = high_resolution_clock::now(); for (auto i = 0; i < howmany; ++i) { spdlog::info("Hello logger: msg number {}", i); } auto delta = high_resolution_clock::now() - start; auto delta_d = duration_cast<duration<double>>(delta).count(); spdlog::drop(log->name()); spdlog::set_default_logger(std::move(orig_default)); spdlog::info("{:<16} Elapsed: {:0.2f} secs {:>16n}/sec", log->name(), delta_d, int(howmany / delta_d)); } void bench_c_string(int howmany, std::shared_ptr<spdlog::logger> log) { const char *msg = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum pharetra metus cursus " "lacus placerat congue. Nulla egestas, mauris a tincidunt tempus, enim lectus volutpat mi, eu consequat sem " "libero nec massa. In dapibus ipsum a diam rhoncus gravida. Etiam non dapibus eros. Donec fringilla dui sed " "augue pretium, nec scelerisque est maximus. Nullam convallis, sem nec blandit maximus, nisi turpis ornare " "nisl, sit amet volutpat neque massa eu odio. Maecenas malesuada quam ex, posuere congue nibh turpis duis."; using std::chrono::high_resolution_clock; auto orig_default = spdlog::default_logger(); spdlog::set_default_logger(log); auto start = high_resolution_clock::now(); for (auto i = 0; i < howmany; ++i) { spdlog::log(level::info, msg); } auto delta = high_resolution_clock::now() - start; auto delta_d = duration_cast<duration<double>>(delta).count(); spdlog::drop(log->name()); spdlog::set_default_logger(std::move(orig_default)); spdlog::info("{:<16} Elapsed: {:0.2f} secs {:>16n}/sec", log->name(), delta_d, int(howmany / delta_d)); }
[ "kiseop91@naver.com" ]
kiseop91@naver.com
a6b6b50a24b73d31cc46c69fc9a210118169eca5
d46de4f297518d0e8ac22d10e30cb39e157ae7d1
/Homework/Gaddis_9thEd_Ch2_Prob13_CircuitBoard/main.cpp
5a98da3affbea2dfa1f1a3e4b3b81bb7babc54fd
[]
no_license
jtemblador/Spring_CSC5_JoseTemblador
9d5adbf9530302588eb5c6a23988cbda10754d47
1c75d851e9e67f1a1d14682ad44aea62cc7f370c
refs/heads/main
2023-05-22T11:58:10.094565
2021-06-10T05:18:44
2021-06-10T05:18:44
375,524,821
0
0
null
null
null
null
UTF-8
C++
false
false
799
cpp
/* * File: main.cpp * Author: Dr. Mark E. Lehr * Created on January 4, 2021, 10:50 AM * Purpose: CPP Template * To be copied for each Assignment Problem */ //System Libraries #include <iostream> //I/O Library using namespace std; //User Libraries //Global Constants //Math, Science, Universal, Conversions, High Dimensioned Arrays //Function Prototypes //Execution Begins Here int main(int argc, char** argv) { //Initialize the Random Number Seed int profit, //profit of circuit board cost; //Cost to make circuit board cost=14.95; profit=0.35*cost; cout<<"Profit for circuit boards is 35%.\n" "If they cost $14.95 to make, they must be sold at $"<<profit+cost<<".\n"; //Exit the Program - Cleanup return 0; }
[ "tembladorjose@yahoo.com" ]
tembladorjose@yahoo.com
624dc1345e2ba2e8b7d430f7db92c10e17e97fa5
3afb95922302de91933dec8c4c88cf22a05b2c9e
/include/disp.h
6c780511e85fe546c3253f56a7cb56c2732f235b
[]
no_license
sosomasox/jex86
dc91eccb1340477649c875598d32f61f76cf2437
a7991358a6174f7552f0a8b95605f61b0b7c01a7
refs/heads/master
2022-02-20T08:03:24.322595
2019-07-23T13:08:46
2019-07-23T13:08:46
null
0
0
null
null
null
null
UTF-8
C++
false
false
165
h
#ifndef _DISP_H_ #define _DISP_H_ class DISP { public: union { std::uint8_t disp8; std::uint8_t disp32; }; }; #endif
[ "izewfktvy533zjmn@gmail.com" ]
izewfktvy533zjmn@gmail.com
95f2686d3cb814dd6b80ee6b7cdf632c2926ccab
c5332c10775e9df3093dd2677babe34e02b05704
/openframeworks/NawlzFluid/src/addons/ofxBox2d/ofxBox2d.cpp
d7ec44bcdeb78c14b841f51010e6db60aa3422a3
[]
no_license
aurialLoop/julapy
bb1f7c458b2c1fefef6de6bdd512ee1ca781a6dc
80ea9b32c6de7e34ad353416f75878551193d2a9
refs/heads/master
2021-10-08T13:46:46.279988
2021-09-29T05:59:03
2021-09-29T05:59:03
33,194,282
0
0
null
null
null
null
UTF-8
C++
false
false
10,914
cpp
#include "ofxBox2d.h" // ------------------------------------------------------ ofxBox2d::ofxBox2d() { } // ------------------------------------------------------ init void ofxBox2d::init() { //settings bHasContactListener = false; bCheckBounds = false; bEnableGrabbing = true; bWorldCreated = false; scale = OFX_BOX2D_SCALE; doSleep = true; //gravity gravity.set(0, 5.0f); setFPS(60.0); velocityIterations = 40; positionIterations = 20; for( int i=0; i<OF_MAX_TOUCH_JOINTS; i++ ) touchJoints[ i ] = NULL; mouseJoint = NULL; ground = NULL; //debug drawer debugRender.setScale(scale); debugRender.SetFlags(1); worldAABB.lowerBound.Set(-100.0f, -100.0f); worldAABB.upperBound.Set(100.0f, 100.0f); world = new b2World(worldAABB, b2Vec2(gravity.x, gravity.y), doSleep); world->SetDebugDraw(&debugRender); ofLog(OF_LOG_NOTICE, "- Box2D Created -\n"); bWorldCreated = true; } // ------------------------------------------------------ grab shapes void ofxBox2d::setContactListener(ofxBox2dContactListener * listener) { if(world != NULL) { bHasContactListener = true; world->SetContactListener(listener); } else { printf("--- you need a world ---\n"); } } // ------------------------------------------------------ grab shapes Events void ofxBox2d::registerGrabbing() { #ifdef TARGET_OF_IPHONE // ofAddListener(ofEvents.touchDown, this, &ofxBox2d::touchDown); // ofAddListener(ofEvents.touchMoved, this, &ofxBox2d::touchMoved); // ofAddListener(ofEvents.touchUp, this, &ofxBox2d::touchUp); #else ofAddListener(ofEvents.mousePressed, this, &ofxBox2d::mousePressed); ofAddListener(ofEvents.mouseDragged, this, &ofxBox2d::mouseDragged); ofAddListener(ofEvents.mouseReleased, this, &ofxBox2d::mouseReleased); #endif } #ifdef TARGET_OF_IPHONE void ofxBox2d::touchDown( int x, int y, int id ) { grabShapeDown( x, y, id ); } void ofxBox2d::touchMoved( int x, int y, int id ) { grabShapeDragged( x, y, id ); } void ofxBox2d::touchUp( int x, int y, int id ) { grabShapeUp( x, y, id ); } #else void ofxBox2d::mousePressed(ofMouseEventArgs &e) { grabShapeDown(e.x, e.y); } void ofxBox2d::mouseDragged(ofMouseEventArgs &e) { grabShapeDragged(e.x, e.y); } void ofxBox2d::mouseReleased(ofMouseEventArgs &e) { grabShapeUp(e.x, e.y); } #endif; // ------------------------------------------------------ void ofxBox2d::grabShapeDown(float x, float y, int id ) { if( !bEnableGrabbing ) return; if( id == -1 ) // check the grab is valid. { if( mouseJoint != NULL ) // mouse joint already registered. { grabShapeUp( x, y, id ); // destroy the mouse joint before replacing it. } } else if( id >= 0 && id < OF_MAX_TOUCH_JOINTS ) { if( touchJoints[ id ] != NULL ) // touch joint already registered. { grabShapeUp( x, y, id ); // destroy the touch joint before replacing it. } } else { return; // invalid mouse / touch id. } b2Vec2 p( x / OFX_BOX2D_SCALE, y / OFX_BOX2D_SCALE ); b2AABB aabb; // Make a small box. b2Vec2 d; d.Set(0.001f, 0.001f); aabb.lowerBound = p - d; aabb.upperBound = p + d; const int32 k_maxCount = 10000; // Query the world for overlapping shapes. b2Shape* shapes[ k_maxCount ]; int32 count = world->Query( worldAABB, shapes, k_maxCount ); b2Body* body = NULL; for( int32 i=0; i<count; ++i ) { b2Body* shapeBody = shapes[ i ]->GetBody(); if( shapeBody->IsStatic() == false && shapeBody->GetMass() > 0.0f ) { bool inside; inside = shapes[ i ]->TestPoint( shapeBody->GetXForm(), p ); if( inside ) { body = shapes[ i ]->GetBody(); break; } } } if( body ) { b2MouseJointDef md; md.body1 = world->GetGroundBody(); md.body2 = body; md.target = p; #ifdef TARGET_FLOAT32_IS_FIXED md.maxForce = ( body->GetMass() < 16.0 )? ( 1000.0f * body->GetMass() ) : float32( 16000.0 ); #else md.maxForce = 1000.0f * body->GetMass(); #endif if( id == -1 ) { mouseJoint = (b2MouseJoint*)world->CreateJoint( &md ); } else if( id >= 0 ) { touchJoints[ id ] = (b2MouseJoint*)world->CreateJoint( &md ); } body->WakeUp(); } } void ofxBox2d :: grabShapeUp( float x, float y, int id ) { if( !bEnableGrabbing ) return; if( id == -1 ) { if( mouseJoint != NULL ) { world->DestroyJoint( mouseJoint ); mouseJoint = NULL; } } else if( id >= 0 && id < OF_MAX_TOUCH_JOINTS ) { if( touchJoints[ id ] != NULL ) { world->DestroyJoint( touchJoints[ id ] ); touchJoints[ id ] = NULL; } } } void ofxBox2d :: grabShapeDragged( float x, float y, int id ) { if( !bEnableGrabbing ) return; b2Vec2 p( x / OFX_BOX2D_SCALE, y / OFX_BOX2D_SCALE ); if( id == -1 ) { if( mouseJoint != NULL ) { mouseJoint->SetTarget( p ); } } else if( id >= 0 && id < OF_MAX_TOUCH_JOINTS ) { if( touchJoints[ id ] != NULL ) { touchJoints[ id ]->SetTarget( p ); } } } // ------------------------------------------------------ set gravity void ofxBox2d::setGravity(float x, float y) { world->SetGravity(b2Vec2(x, y)); } void ofxBox2d::setGravity(ofPoint pt) { world->SetGravity(b2Vec2(pt.x, pt.y)); } // ------------------------------------------------------ set bounds void ofxBox2d::setBounds(ofPoint lowBounds, ofPoint upBounds) { // still need to work on this... } // ------------------------------------------------------ create bounds void ofxBox2d::createFloor(float floorWidth, float bottom) { if(!bWorldCreated) return; b2BodyDef bd; bd.position.Set(0, 0); ground = world->CreateBody(&bd); b2PolygonDef sd; sd.filter.groupIndex = 1; sd.density = 0.0f; sd.restitution = 0.0f; sd.friction = 0.6; float thick = 5/OFX_BOX2D_SCALE; //bottom sd.SetAsBox((floorWidth/OFX_BOX2D_SCALE)/2, thick, b2Vec2((floorWidth/OFX_BOX2D_SCALE)/2, (bottom-thick)/OFX_BOX2D_SCALE), 0.0); ground->CreateShape(&sd); } // ------------------------------------------------------ create bounds void ofxBox2d::createBounds(float x, float y, float w, float h) { if(!bWorldCreated) return; b2BodyDef bd; bd.position.Set(0, 0); ground = world->CreateBody(&bd); b2PolygonDef sd; sd.filter.groupIndex = 1; sd.density = 0.0f; sd.restitution = 0.0f; sd.friction = 0.6; float thick = 10/OFX_BOX2D_SCALE; // w h x y r //right sd.SetAsBox(thick, (h/OFX_BOX2D_SCALE)/2, b2Vec2((w/OFX_BOX2D_SCALE), (h/OFX_BOX2D_SCALE)/2), 0.0); ground->CreateShape(&sd); //left sd.SetAsBox(thick, (h/OFX_BOX2D_SCALE)/2, b2Vec2(0, (h/OFX_BOX2D_SCALE)/2), 0.0); ground->CreateShape(&sd); //top sd.SetAsBox((w/OFX_BOX2D_SCALE)/2, thick, b2Vec2((w/OFX_BOX2D_SCALE)/2, 0), 0.0); ground->CreateShape(&sd); //bottom sd.SetAsBox((w/OFX_BOX2D_SCALE)/2, thick, b2Vec2((w/OFX_BOX2D_SCALE)/2, h/OFX_BOX2D_SCALE), 0.0); ground->CreateShape(&sd); } // ------------------------------------------------------ check if shapes are out of bounds void ofxBox2d::checkBounds(bool b) { bCheckBounds = b; } // ------------------------------------------------------ void ofxBox2d::setIterations(int velocityTimes, int positionTimes) { velocityIterations = velocityTimes; positionIterations = positionTimes; } // ------------------------------------------------------ void ofxBox2d::update() { // destroy the object if we are out of the bounds if(bCheckBounds) { /* float top = 0; float bottom = ofGetHeight(); float right = ofGetWidth(); float left = 0; b2Body* node = world->GetBodyList(); while(node) { b2Body* b = node; node = node->GetNext(); b2Vec2 p = b->GetPosition(); ofxBox2dBaseShape* base = (ofxBox2dBaseShape*)b->GetUserData(); if(base) { //printf("dead:%i\n", base->dead); if(p.y*OFX_BOX2D_SCALE > bottom) { base->dead = true; world->DestroyBody(b); } if(p.y*OFX_BOX2D_SCALE < top) { base->dead = true; world->DestroyBody(b); } if(p.x*OFX_BOX2D_SCALE > right) { base->dead = true; world->DestroyBody(b); } if(p.x*OFX_BOX2D_SCALE < left) { base->dead = true; world->DestroyBody(b); } */ } float timeStep = (1.0f / fps); world->Step(timeStep, velocityIterations, positionIterations); world->Validate(); } // ------------------------------------------------------ void ofxBox2d::drawGround() { //draw the ground if(ground != NULL) { for(b2Shape* s=ground->GetShapeList(); s; s=s->GetNext()) { const b2XForm& xf = ground->GetXForm(); b2PolygonShape* poly = (b2PolygonShape*)s; int count = poly->GetVertexCount(); const b2Vec2* verts = poly->GetVertices(); ofEnableAlphaBlending(); ofFill(); ofSetColor(90, 90, 90, 100); ofBeginShape(); for(int j=0; j<count; j++) { b2Vec2 pt = b2Mul(xf, verts[j]); ofVertex(pt.x*OFX_BOX2D_SCALE, pt.y*OFX_BOX2D_SCALE); } ofEndShape(); ofDisableAlphaBlending(); } } } // ------------------------------------------------------ void ofxBox2d::draw() { if( mouseJoint != NULL ) drawMouseJoint( mouseJoint ); for( int i=0; i<OF_MAX_TOUCH_JOINTS; i++ ) { if( touchJoints[ i ] != NULL ) drawMouseJoint( touchJoints[ i ] ); } drawGround(); } void ofxBox2d :: drawMouseJoint ( b2MouseJoint* mj ) { b2Body* mbody = mj->GetBody2(); b2Vec2 p1 = mbody->GetWorldPoint( mj->m_localAnchor); b2Vec2 p2 = mj->m_target; p1 *= OFX_BOX2D_SCALE; p2 *= OFX_BOX2D_SCALE; //draw a line from touched shape ofEnableAlphaBlending(); ofSetLineWidth(2.0); ofSetColor(200, 200, 200, 200); ofLine(p1.x, p1.y, p2.x, p2.y); ofNoFill(); ofSetLineWidth(1.0); ofCircle(p1.x, p1.y, 2); ofCircle(p2.x, p2.y, 5); ofDisableAlphaBlending(); } // ------------------------------------------------------- void ofxBox2d :: raycast ( const ofPoint &p1, const ofPoint &p2, int maxHits, vector<ofPoint>* hitPoints, vector<b2Shape*>* shapes ) { b2Segment segment; segment.p1 = b2Vec2( p1.x / OFX_BOX2D_SCALE, p1.y / OFX_BOX2D_SCALE ); segment.p2 = b2Vec2( p2.x / OFX_BOX2D_SCALE, p2.y / OFX_BOX2D_SCALE ); for( int i=0; i<maxHits; i++ ) { float lambda = 1; b2Vec2 normal; b2Shape* shape = NULL; shape = world->RaycastOne( segment, &lambda, &normal, false, NULL ); if( shape != NULL ) { if( shapes != NULL ) { shapes->push_back( shape ); } if( hitPoints != NULL ) { b2Vec2 hit; hit = ( 1 - lambda ) * segment.p1 + lambda * segment.p2; ofPoint hitPoint; hitPoint.x = hit.x * OFX_BOX2D_SCALE; hitPoint.y = hit.y * OFX_BOX2D_SCALE; hitPoints->push_back( hitPoint ); } lambda = MIN( lambda + 0.001, 1.0 ); // nudge lambda a little so it doesn't find the same shape twice. segment.p1 = ( 1 - lambda ) * segment.p1 + lambda * segment.p2; } else { return; // nothing hit. } float segmentLength; segmentLength = ofDist( segment.p1.x, segment.p1.y, segment.p2.x, segment.p2.y ); if( segmentLength <= B2_FLT_EPSILON ) return; } }
[ "julapy@81ff1be0-9049-0410-8291-4d9ff92d881a" ]
julapy@81ff1be0-9049-0410-8291-4d9ff92d881a
991e4dff1da932869b277193249762ed3e412e39
4a3e5419e89dfbd9788a4539740b8ea7321ee7ef
/143/b.cpp
7a5b9f9827f282f30f56eed3c0ee14c013542006
[]
no_license
tars0x9752/atcoder
d3cbfefeb5164edab72d87f8feb16e1160c231a2
0e54c9a34055e47ae6bb19d4493306e974a50eee
refs/heads/master
2022-11-19T15:36:17.711849
2020-07-19T12:56:31
2020-07-19T12:56:31
182,626,178
0
0
null
null
null
null
UTF-8
C++
false
false
437
cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector<int> d(n); for (int i = 0; i < n; i++) { cin >> d[i]; } ll ans = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (i == j) continue; ans += d[i] * d[j]; } } cout << ans / 2 << endl; return 0; }
[ "46079709+havveFn@users.noreply.github.com" ]
46079709+havveFn@users.noreply.github.com
b5a9452b564dde1e675dd8a2a40d337748def93d
05bf4da01c4a3c8003add28ed8178fe23dd44e37
/ROUND 3/E/sol.cpp
07e2f390cd4a3ebe539f0d9ce85d0647d8e63475
[]
no_license
LeThanhLong582000/ITIS
3690ba05d6179cdb0ccfdf867abb0095dd696069
24bffef4376ed49f8b2445a8345adf27537d28b2
refs/heads/master
2022-12-10T00:23:35.126188
2020-09-05T19:38:08
2020-09-05T19:38:08
287,475,887
0
0
null
null
null
null
UTF-8
C++
false
false
371
cpp
#include <bits/stdc++.h> using namespace std; int main(){ int t; cin >> t; while(t--){ int n, m; cin >> n >> m; int ans = (n * m - 1) * n * m; if(n >= 1 && m >= 2) ans -= (4 * (n - 1) * (m - 2)); if(n >=2 && m >=1 ) ans -= (4 * (n - 2) * (m - 1)); cout << ans << endl; } return 0; }
[ "nguyenthanhlam1672000@gmail.com" ]
nguyenthanhlam1672000@gmail.com
762b2b4552addb5b198a6b3fd7bcec173da9f48c
30bdd8ab897e056f0fb2f9937dcf2f608c1fd06a
/contest/1542579483.cpp
1c2654935628264ee2e86af5c41a14eb888b43ef
[]
no_license
thegamer1907/Code_Analysis
0a2bb97a9fb5faf01d983c223d9715eb419b7519
48079e399321b585efc8a2c6a84c25e2e7a22a61
refs/heads/master
2020-05-27T01:20:55.921937
2019-11-20T11:15:11
2019-11-20T11:15:11
188,403,594
2
1
null
null
null
null
UTF-8
C++
false
false
1,496
cpp
#include<bits/stdc++.h> #define fi first #define se second #define pii pair<int,int> #define rep(i,j,k) for(int i=(int)j;i<=(int)k;i++) #define per(i,j,k) for(int i=(int)j;i>=(int)k;i--) using namespace std; typedef long long LL; const int N=205; bool pre[N][20]; bool suf[N][20]; int len[N]; bitset<1<<16>hav[N][17]; int n,m; char s[N]; int main(){ scanf("%d",&n); rep(i,1,n){ scanf("%s",s+1); len[i]=strlen(s+1); rep(l,1,16)rep(j,1,len[i]-l+1){ int x=0; rep(d,j,j+l-1){ x<<=1; x|=(s[d]=='1'); } hav[i][l][x]=1; } rep(j,1,min(16,len[i]))pre[i][j]=(s[j]-'0'),suf[i][j]=(s[len[i]-j+1]-'0'); } scanf("%d",&m); rep(Q,1,m){ int a,b;scanf("%d%d",&a,&b); len[n+Q]=min(len[a]+len[b],1000); rep(l,1,16){ hav[n+Q][l]=hav[a][l]|hav[b][l]; rep(k,1,min(len[a],l-1))if(l-k<=len[b]){ int x=0; per(d,k,1){ x<<=1; x|=suf[a][d]; } rep(d,1,l-k){ x<<=1; x|=pre[b][d]; } hav[n+Q][l][x]=1; } } rep(i,1,min(len[b],16))suf[n+Q][i]=suf[b][i]; if(len[b]<16)rep(i,1,min(16-len[b],len[a]))suf[n+Q][i+len[b]]=suf[a][i]; rep(i,1,min(len[a],16))pre[n+Q][i]=pre[a][i]; if(len[a]<16)rep(i,1,min(16-len[a],len[b]))pre[n+Q][i+len[a]]=pre[b][i]; int ans=0; rep(i,1,16)if(hav[n+Q][i].count()<(1<<i)){ break; } else ans=i; printf("%d\n",ans); } return 0; }
[ "harshitagar1907@gmail.com" ]
harshitagar1907@gmail.com
14cf28e6ffcecf0dd47770917a8ea6101f1ebd8b
05c3808e2cfc7264d36308d01063fc83fe286354
/fendwick.cpp
a2cfe8c0e9f0c14b8f913f99597d5867fbc39ca6
[]
no_license
aakash140799/codetemplate
d8d5f32d35ea5ca457662ab19522dae5169b9fa5
506a0b2ee8c3015dda04dd609fc96db862bb432e
refs/heads/master
2022-05-28T14:27:01.263150
2022-05-03T03:04:06
2022-05-03T03:04:06
202,366,854
1
0
null
2019-08-15T02:22:53
2019-08-14T14:26:58
C++
UTF-8
C++
false
false
597
cpp
// fendwick tree const int size = 100; template<typename type> class fendwick{ public: type arr[size]; type fen[size]; int n; type zero; type merge(type arg1, type arg2) { // merge code here return arg1+arg2; } void update(type v,int i) { while(i > 0 && i <= n) { fen[i] = merge(fen[i], v); i -= (i&-i); } } void set() { for(int i = 1;i <= n;i++) { update(arr[i], i); } } type query(int l,int r) { if(r > l){return zero;} int r2 = l+(l&-l)-1; if(r2 == r){return fen[l];} else if(r2 < r){return merge(fen[l], query(r2+1, r));} else{return merge(arr[l], query(l+1, r));} } };
[ "34199858+aakash140799@users.noreply.github.com" ]
34199858+aakash140799@users.noreply.github.com
ee4c746ae217892a99e0610b9ceef0a1df473fd2
4f07dffbbc1dcf3c06c33219296eb72d99b08ab0
/chrome/browser/extensions/api/enterprise_reporting_private/chrome_desktop_report_request_helper_unittest.cc
85640fd12e5a09ff031b608fc7c6a02142b3b45b
[ "BSD-3-Clause" ]
permissive
zeyiwu/chromium
4815e89f8a9acd0e9e6957dc2be6e6d6f4995a52
2969192f368b295477a3348584160a854fd3316b
refs/heads/master
2023-02-21T20:39:29.821478
2018-05-22T02:04:26
2018-05-22T02:04:26
134,348,434
1
0
null
2018-05-22T02:16:57
2018-05-22T02:16:57
null
UTF-8
C++
false
false
6,768
cc
// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/extensions/api/enterprise_reporting_private/chrome_desktop_report_request_helper.h" #include "base/json/json_reader.h" #include "base/values.h" #include "chrome/test/base/testing_profile.h" #include "components/policy/core/common/cloud/cloud_policy_util.h" #include "components/policy/proto/device_management_backend.pb.h" #include "content/public/test/test_browser_thread_bundle.h" #include "testing/gtest/include/gtest/gtest.h" namespace em = enterprise_management; namespace extensions { class ChromeDesktopReportRequestGeneratorTest : public ::testing::Test { protected: content::TestBrowserThreadBundle test_browser_thread_bundle_; TestingProfile profile_; }; TEST_F(ChromeDesktopReportRequestGeneratorTest, OSInfo) { std::unique_ptr<em::ChromeDesktopReportRequest> request; std::string expected_os_info; // Platform and its version will be the |os_info| by default. expected_os_info = base::StringPrintf("{\"os\":\"%s\",\"os_version\":\"%s\"}", policy::GetOSPlatform().c_str(), policy::GetOSVersion().c_str()); request = GenerateChromeDesktopReportRequest(base::DictionaryValue(), &profile_); ASSERT_TRUE(request); EXPECT_EQ(expected_os_info, request->os_info()); // Platform and its version will be merged with other |os_info|. expected_os_info = base::StringPrintf( "{\"os\":\"%s\",\"os_version\":\"%s\",\"other_info\":\"info\"}", policy::GetOSPlatform().c_str(), policy::GetOSVersion().c_str()); std::unique_ptr<base::DictionaryValue> report = base::DictionaryValue::From( base::JSONReader::Read("{\"osInfo\": {\"other_info\":\"info\"}}")); ASSERT_TRUE(report); request = GenerateChromeDesktopReportRequest(*report, &profile_); ASSERT_TRUE(request); EXPECT_EQ(expected_os_info, request->os_info()); } TEST_F(ChromeDesktopReportRequestGeneratorTest, MachineName) { std::unique_ptr<em::ChromeDesktopReportRequest> request; std::string expected_machine_name; // Machine name will be a empty dict by default. expected_machine_name = "{}"; request = GenerateChromeDesktopReportRequest(base::DictionaryValue(), &profile_); ASSERT_TRUE(request); EXPECT_EQ(expected_machine_name, request->machine_name()); // Machine name will be copied from the |report|. expected_machine_name = "{\"computername\":\"name\"}"; std::unique_ptr<base::DictionaryValue> report = base::DictionaryValue::From( base::JSONReader::Read("{\"machineName\":{\"computername\":\"name\"}}")); ASSERT_TRUE(report); request = GenerateChromeDesktopReportRequest(*report, &profile_); ASSERT_TRUE(request); EXPECT_EQ(expected_machine_name, request->machine_name()); } TEST_F(ChromeDesktopReportRequestGeneratorTest, ProfileName) { // Set the profile name to a known value to compare against. const std::string test_name("TEST"); profile_.set_profile_name(test_name); // An empty report suffices for this test. The information of interest is // sourced from the profile std::unique_ptr<em::ChromeDesktopReportRequest> request = GenerateChromeDesktopReportRequest(base::DictionaryValue(), &profile_); ASSERT_TRUE(request); // Make sure the user name was set in the proto. EXPECT_EQ(test_name, request->browser_report().chrome_user_profile_reports(0).name()); } TEST_F(ChromeDesktopReportRequestGeneratorTest, ExtensionList) { std::unique_ptr<em::ChromeDesktopReportRequest> request; std::unique_ptr<base::DictionaryValue> report; std::string expected_extension_list; // Extension list will be a empty list by default. expected_extension_list = "[]"; report = base::DictionaryValue::From(base::JSONReader::Read( "{\"browserReport\": {\"chromeUserProfileReport\":[{}]}}")); ASSERT_TRUE(report); request = GenerateChromeDesktopReportRequest(*report, &profile_); ASSERT_TRUE(request); EXPECT_EQ(expected_extension_list, request->browser_report() .chrome_user_profile_reports(0) .extension_data()); // Extension list will be copied from the |report|. expected_extension_list = "[{\"id\":\"1\"}]"; report = base::DictionaryValue::From(base::JSONReader::Read( "{\"browserReport\": " "{\"chromeUserProfileReport\":[{\"extensionData\":[{\"id\":\"1\"}]}]}}")); ASSERT_TRUE(report); request = GenerateChromeDesktopReportRequest(*report, &profile_); ASSERT_TRUE(request); EXPECT_EQ(expected_extension_list, request->browser_report() .chrome_user_profile_reports(0) .extension_data()); } TEST_F(ChromeDesktopReportRequestGeneratorTest, ProfileID) { std::unique_ptr<em::ChromeDesktopReportRequest> request; // |chrome_user_profile_report| will be created with Profile ID by default. request = GenerateChromeDesktopReportRequest(base::DictionaryValue(), &profile_); ASSERT_TRUE(request); EXPECT_EQ(profile_.GetPath().AsUTF8Unsafe(), request->browser_report().chrome_user_profile_reports(0).id()); // Profile ID will be merged into the first item of // |chrome_user_profile_reports| std::unique_ptr<base::DictionaryValue> report = base::DictionaryValue::From( base::JSONReader::Read("{\"browserReport\": " "{\"chromeUserProfileReport\":[{\"extensionData\":" "[{\"id\":\"1\"}]}]}}")); ASSERT_TRUE(report); request = GenerateChromeDesktopReportRequest(*report, &profile_); ASSERT_TRUE(request); EXPECT_EQ(profile_.GetPath().AsUTF8Unsafe(), request->browser_report().chrome_user_profile_reports(0).id()); } TEST_F(ChromeDesktopReportRequestGeneratorTest, InvalidInput) { // |request| will not be generated if the type of input is invalid. std::unique_ptr<base::DictionaryValue> report; report = base::DictionaryValue::From( base::JSONReader::Read("{\"osInfo\": \"info\"}")); ASSERT_TRUE(report); EXPECT_FALSE(GenerateChromeDesktopReportRequest(*report, &profile_)); report = base::DictionaryValue::From( base::JSONReader::Read("{\"machineName\": \"info\"}")); ASSERT_TRUE(report); EXPECT_FALSE(GenerateChromeDesktopReportRequest(*report, &profile_)); report = base::DictionaryValue::From(base::JSONReader::Read( "{\"browserReport\": " "{\"chromeUserProfileReport\":[{\"extensionData\":{}}]}}")); ASSERT_TRUE(report); EXPECT_FALSE(GenerateChromeDesktopReportRequest(*report, &profile_)); } } // namespace extensions
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
6254ee13ef4c3454fdcddfef2f7f087a3a18fc11
e9240cac5feef9b44b98a9900fff1a719e0ed691
/Codes/GeneratedFiles/WQV/Release/moc_statusviewer.cpp
06b441da6f35abeaec68ca37ce5a9f5e62fe9ff1
[]
no_license
sassanaflaki/GIFMod-1
1ac83dfd2265bfde36c0c4550a0e6adab238e09e
24ffb36cd05969a8ef7213b7bc83c61b14fe0ed3
refs/heads/master
2021-01-21T10:37:35.653793
2016-08-13T14:39:33
2016-08-13T14:39:33
83,459,120
0
0
null
null
null
null
UTF-8
C++
false
false
3,354
cpp
/**************************************************************************** ** Meta object code from reading C++ file 'statusviewer.h' ** ** Created by: The Qt Meta Object Compiler version 67 (Qt 5.5.0) ** ** WARNING! All changes made in this file will be lost! *****************************************************************************/ #include "../../../GUI/statusviewer.h" #include <QtCore/qbytearray.h> #include <QtCore/qmetatype.h> #if !defined(Q_MOC_OUTPUT_REVISION) #error "The header file 'statusviewer.h' doesn't include <QObject>." #elif Q_MOC_OUTPUT_REVISION != 67 #error "This file was generated using the moc from 5.5.0. It" #error "cannot be used with the include files from this version of Qt." #error "(The moc has changed too much.)" #endif QT_BEGIN_MOC_NAMESPACE struct qt_meta_stringdata_StatusViewer_t { QByteArrayData data[3]; char stringdata0[24]; }; #define QT_MOC_LITERAL(idx, ofs, len) \ Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ qptrdiff(offsetof(qt_meta_stringdata_StatusViewer_t, stringdata0) + ofs \ - idx * sizeof(QByteArrayData)) \ ) static const qt_meta_stringdata_StatusViewer_t qt_meta_stringdata_StatusViewer = { { QT_MOC_LITERAL(0, 0, 12), // "StatusViewer" QT_MOC_LITERAL(1, 13, 9), // "onTimeout" QT_MOC_LITERAL(2, 23, 0) // "" }, "StatusViewer\0onTimeout\0" }; #undef QT_MOC_LITERAL static const uint qt_meta_data_StatusViewer[] = { // content: 7, // revision 0, // classname 0, 0, // classinfo 1, 14, // methods 0, 0, // properties 0, 0, // enums/sets 0, 0, // constructors 0, // flags 0, // signalCount // slots: name, argc, parameters, tag, flags 1, 0, 19, 2, 0x08 /* Private */, // slots: parameters QMetaType::Void, 0 // eod }; void StatusViewer::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) { if (_c == QMetaObject::InvokeMetaMethod) { StatusViewer *_t = static_cast<StatusViewer *>(_o); Q_UNUSED(_t) switch (_id) { case 0: _t->onTimeout(); break; default: ; } } Q_UNUSED(_a); } const QMetaObject StatusViewer::staticMetaObject = { { &QLabel::staticMetaObject, qt_meta_stringdata_StatusViewer.data, qt_meta_data_StatusViewer, qt_static_metacall, Q_NULLPTR, Q_NULLPTR} }; const QMetaObject *StatusViewer::metaObject() const { return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; } void *StatusViewer::qt_metacast(const char *_clname) { if (!_clname) return Q_NULLPTR; if (!strcmp(_clname, qt_meta_stringdata_StatusViewer.stringdata0)) return static_cast<void*>(const_cast< StatusViewer*>(this)); return QLabel::qt_metacast(_clname); } int StatusViewer::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QLabel::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 1) qt_static_metacall(this, _c, _id, _a); _id -= 1; } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { if (_id < 1) *reinterpret_cast<int*>(_a[0]) = -1; _id -= 1; } return _id; } QT_END_MOC_NAMESPACE
[ "arashmassoudieh@gmail.com" ]
arashmassoudieh@gmail.com
8928f5dc60d1df4e37e7c6a8b8728cff6171869f
13a32b92b1ba8ffb07e810dcc8ccdf1b8b1671ab
/home--tommy--mypy/mypy/lib/python2.7/site-packages/pystan/stan/lib/stan_math/test/unit/math/prim/mat/vectorize/expect_prim_values.hpp
370cd543d7f14d3d326ecc0f8874bb71522af385
[ "Unlicense", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
tommybutler/mlearnpy2
8ec52bcd03208c9771d8d02ede8eaa91a95bda30
9e5d377d0242ac5eb1e82a357e6701095a8ca1ff
refs/heads/master
2022-10-24T23:30:18.705329
2022-10-17T15:41:37
2022-10-17T15:41:37
118,529,175
0
2
Unlicense
2022-10-15T23:32:18
2018-01-22T23:27:10
Python
UTF-8
C++
false
false
827
hpp
#ifndef TEST_UNIT_MATH_PRIM_MAT_VECTORIZE_EXPECT_PRIM_VALUES_HPP #define TEST_UNIT_MATH_PRIM_MAT_VECTORIZE_EXPECT_PRIM_VALUES_HPP #include <test/unit/math/prim/mat/vectorize/expect_prim_scalar_value.hpp> #include <test/unit/math/prim/mat/vectorize/expect_prim_std_vector_value.hpp> #include <test/unit/math/prim/mat/vectorize/expect_prim_matrix_value.hpp> #include <test/unit/math/prim/mat/vectorize/expect_prim_vector_value.hpp> #include <test/unit/math/prim/mat/vectorize/expect_prim_row_vector_value.hpp> // CALL THIS TO TEST EVERYTHING // see: apply_scalar_unary_test.cpp for an example template <typename F> void expect_prim_values() { expect_prim_scalar_value<F>(); expect_prim_std_vector_value<F>(); expect_prim_matrix_value<F>(); expect_prim_vector_value<F>(); expect_prim_row_vector_value<F>(); } #endif
[ "tbutler.github@internetalias.net" ]
tbutler.github@internetalias.net
a849127ff2dd9f2267a163c1d915da7dbff58e15
24117b914690268e7ddc0a6dc9886d22db56f8d2
/Week4/utils.h
3881070bb9a26e28bf73747e409c75db2be3dff1
[]
no_license
Rozelin-dc/STEP-Homework
86787d855cd782d9d3cdefcb99d210e752a54200
339ddacf2dcafc7f91e2a15646232cdeb0318d52
refs/heads/master
2023-06-01T10:41:34.534733
2021-06-30T12:32:21
2021-06-30T12:32:21
365,399,183
0
0
null
2021-06-09T01:29:43
2021-05-08T02:19:50
C++
UTF-8
C++
false
false
279
h
#include <bits/stdc++.h> using namespace std; /** そのページの名前とリンクづけられたページの id を値に持つ構造体 */ typedef struct { string name; deque<string> linkedPages; } pageData_t; void readData(unordered_map<string, pageData_t>& links);
[ "66714866+Rozelin-dc@users.noreply.github.com" ]
66714866+Rozelin-dc@users.noreply.github.com
80ea3c6c654ed676d10de43f08ef89cd9856dd59
4f114a7bb0c1058d52bb98f30bc7f642bb8802aa
/src/feeds.h
6416d43a1cc7d395ef83da4a4142af2eda48aad4
[]
no_license
w1r2p1/strategy
86216aa90408b83f162145b8463b69b646475c10
64400e8076d4d01da6cc13f519ee9522a6f82dff
refs/heads/master
2023-02-03T21:35:43.649002
2020-12-12T05:24:30
2020-12-12T05:24:30
null
0
0
null
null
null
null
UTF-8
C++
false
false
266
h
#ifndef GUARD_COMMUNICATION #define GUARD_COMMUNICATION #include <ipc.h> namespace msim{ class Feed{ public: Feed(){} virtual ~Feed(){} private: Feed(const Feed&); Feed& operator=(const Feed&); }; } #endif // !GUARD_COMMUNICATION
[ "punitshah163@gmail.com" ]
punitshah163@gmail.com
b0d4816c4d367fbb3c936862bc45cbbb30335d46
edcab5eac30341ebe3bf687db7f13e4980e81f77
/src/governance.h
914e5339586c7c5603bc6d49d870f9cfa963610c
[ "MIT" ]
permissive
kulibih/WantCore
5ad24b2d3994efa0b1cd1667502e7af68d2399b8
d4fb88771567c264746165d88f82667da90b9a51
refs/heads/master
2020-03-22T21:53:40.013011
2018-04-05T05:30:14
2018-04-05T05:30:14
null
0
0
null
null
null
null
UTF-8
C++
false
false
12,752
h
// Copyright (c) 2014-2017 The Want Core developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef GOVERNANCE_H #define GOVERNANCE_H //#define ENABLE_WANT_DEBUG #include "bloom.h" #include "cachemap.h" #include "cachemultimap.h" #include "chain.h" #include "governance-exceptions.h" #include "governance-object.h" #include "governance-vote.h" #include "net.h" #include "sync.h" #include "timedata.h" #include "util.h" class CGovernanceManager; class CGovernanceTriggerManager; class CGovernanceObject; class CGovernanceVote; extern CGovernanceManager governance; struct ExpirationInfo { ExpirationInfo(int64_t _nExpirationTime, int _idFrom) : nExpirationTime(_nExpirationTime), idFrom(_idFrom) {} int64_t nExpirationTime; NodeId idFrom; }; typedef std::pair<CGovernanceObject, ExpirationInfo> object_info_pair_t; static const int RATE_BUFFER_SIZE = 5; class CRateCheckBuffer { private: std::vector<int64_t> vecTimestamps; int nDataStart; int nDataEnd; bool fBufferEmpty; public: CRateCheckBuffer() : vecTimestamps(RATE_BUFFER_SIZE), nDataStart(0), nDataEnd(0), fBufferEmpty(true) {} void AddTimestamp(int64_t nTimestamp) { if((nDataEnd == nDataStart) && !fBufferEmpty) { // Buffer full, discard 1st element nDataStart = (nDataStart + 1) % RATE_BUFFER_SIZE; } vecTimestamps[nDataEnd] = nTimestamp; nDataEnd = (nDataEnd + 1) % RATE_BUFFER_SIZE; fBufferEmpty = false; } int64_t GetMinTimestamp() { int nIndex = nDataStart; int64_t nMin = numeric_limits<int64_t>::max(); if(fBufferEmpty) { return nMin; } do { if(vecTimestamps[nIndex] < nMin) { nMin = vecTimestamps[nIndex]; } nIndex = (nIndex + 1) % RATE_BUFFER_SIZE; } while(nIndex != nDataEnd); return nMin; } int64_t GetMaxTimestamp() { int nIndex = nDataStart; int64_t nMax = 0; if(fBufferEmpty) { return nMax; } do { if(vecTimestamps[nIndex] > nMax) { nMax = vecTimestamps[nIndex]; } nIndex = (nIndex + 1) % RATE_BUFFER_SIZE; } while(nIndex != nDataEnd); return nMax; } int GetCount() { int nCount = 0; if(fBufferEmpty) { return 0; } if(nDataEnd > nDataStart) { nCount = nDataEnd - nDataStart; } else { nCount = RATE_BUFFER_SIZE - nDataStart + nDataEnd; } return nCount; } double GetRate() { int nCount = GetCount(); if(nCount < RATE_BUFFER_SIZE) { return 0.0; } int64_t nMin = GetMinTimestamp(); int64_t nMax = GetMaxTimestamp(); if(nMin == nMax) { // multiple objects with the same timestamp => infinite rate return 1.0e10; } return double(nCount) / double(nMax - nMin); } ADD_SERIALIZE_METHODS; template <typename Stream, typename Operation> inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { READWRITE(vecTimestamps); READWRITE(nDataStart); READWRITE(nDataEnd); READWRITE(fBufferEmpty); } }; // // Governance Manager : Contains all proposals for the budget // class CGovernanceManager { friend class CGovernanceObject; public: // Types struct last_object_rec { last_object_rec(bool fStatusOKIn = true) : triggerBuffer(), watchdogBuffer(), fStatusOK(fStatusOKIn) {} ADD_SERIALIZE_METHODS; template <typename Stream, typename Operation> inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { READWRITE(triggerBuffer); READWRITE(watchdogBuffer); READWRITE(fStatusOK); } CRateCheckBuffer triggerBuffer; CRateCheckBuffer watchdogBuffer; bool fStatusOK; }; typedef std::map<uint256, CGovernanceObject> object_m_t; typedef object_m_t::iterator object_m_it; typedef object_m_t::const_iterator object_m_cit; typedef CacheMap<uint256, CGovernanceObject*> object_ref_cache_t; typedef std::map<uint256, CGovernanceVote> vote_m_t; typedef vote_m_t::iterator vote_m_it; typedef vote_m_t::const_iterator vote_m_cit; typedef CacheMap<uint256, CGovernanceVote> vote_cache_t; typedef CacheMultiMap<uint256, vote_time_pair_t> vote_mcache_t; typedef object_m_t::size_type size_type; typedef std::map<COutPoint, last_object_rec > txout_m_t; typedef txout_m_t::iterator txout_m_it; typedef txout_m_t::const_iterator txout_m_cit; typedef std::map<COutPoint, int> txout_int_m_t; typedef std::set<uint256> hash_s_t; typedef hash_s_t::iterator hash_s_it; typedef hash_s_t::const_iterator hash_s_cit; typedef std::map<uint256, object_info_pair_t> object_info_m_t; typedef object_info_m_t::iterator object_info_m_it; typedef object_info_m_t::const_iterator object_info_m_cit; typedef std::map<uint256, int64_t> hash_time_m_t; typedef hash_time_m_t::iterator hash_time_m_it; typedef hash_time_m_t::const_iterator hash_time_m_cit; private: static const int MAX_CACHE_SIZE = 1000000; static const std::string SERIALIZATION_VERSION_STRING; static const int MAX_TIME_FUTURE_DEVIATION; static const int RELIABLE_PROPAGATION_TIME; int64_t nTimeLastDiff; // keep track of current block height int nCachedBlockHeight; // keep track of the scanning errors object_m_t mapObjects; // mapErasedGovernanceObjects contains key-value pairs, where // key - governance object's hash // value - expiration time for deleted objects hash_time_m_t mapErasedGovernanceObjects; object_info_m_t mapMasternodeOrphanObjects; txout_int_m_t mapMasternodeOrphanCounter; object_m_t mapPostponedObjects; hash_s_t setAdditionalRelayObjects; hash_time_m_t mapWatchdogObjects; uint256 nHashWatchdogCurrent; int64_t nTimeWatchdogCurrent; object_ref_cache_t mapVoteToObject; vote_cache_t mapInvalidVotes; vote_mcache_t mapOrphanVotes; txout_m_t mapLastMasternodeObject; hash_s_t setRequestedObjects; hash_s_t setRequestedVotes; bool fRateChecksEnabled; class ScopedLockBool { bool& ref; bool fPrevValue; public: ScopedLockBool(CCriticalSection& _cs, bool& _ref, bool _value) : ref(_ref) { AssertLockHeld(_cs); fPrevValue = ref; ref = _value; } ~ScopedLockBool() { ref = fPrevValue; } }; public: // critical section to protect the inner data structures mutable CCriticalSection cs; CGovernanceManager(); virtual ~CGovernanceManager() {} /** * This is called by AlreadyHave in main.cpp as part of the inventory * retrieval process. Returns true if we want to retrieve the object, otherwise * false. (Note logic is inverted in AlreadyHave). */ bool ConfirmInventoryRequest(const CInv& inv); void Sync(CNode* node, const uint256& nProp, const CBloomFilter& filter, CConnman& connman); void ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv, CConnman& connman); void DoMaintenance(CConnman& connman); CGovernanceObject *FindGovernanceObject(const uint256& nHash); std::vector<CGovernanceVote> GetMatchingVotes(const uint256& nParentHash); std::vector<CGovernanceVote> GetCurrentVotes(const uint256& nParentHash, const COutPoint& mnCollateralOutpointFilter); std::vector<CGovernanceObject*> GetAllNewerThan(int64_t nMoreThanTime); bool IsBudgetPaymentBlock(int nBlockHeight); void AddGovernanceObject(CGovernanceObject& govobj, CConnman& connman, CNode* pfrom = NULL); std::string GetRequiredPaymentsString(int nBlockHeight); void UpdateCachesAndClean(); void CheckAndRemove() {UpdateCachesAndClean();} void Clear() { LOCK(cs); LogPrint("gobject", "Governance object manager was cleared\n"); mapObjects.clear(); mapErasedGovernanceObjects.clear(); mapWatchdogObjects.clear(); nHashWatchdogCurrent = uint256(); nTimeWatchdogCurrent = 0; mapVoteToObject.Clear(); mapInvalidVotes.Clear(); mapOrphanVotes.Clear(); mapLastMasternodeObject.clear(); } std::string ToString() const; ADD_SERIALIZE_METHODS; template <typename Stream, typename Operation> inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { LOCK(cs); std::string strVersion; if(ser_action.ForRead()) { READWRITE(strVersion); } else { strVersion = SERIALIZATION_VERSION_STRING; READWRITE(strVersion); } READWRITE(mapErasedGovernanceObjects); READWRITE(mapInvalidVotes); READWRITE(mapOrphanVotes); READWRITE(mapObjects); READWRITE(mapWatchdogObjects); READWRITE(nHashWatchdogCurrent); READWRITE(nTimeWatchdogCurrent); READWRITE(mapLastMasternodeObject); if(ser_action.ForRead() && (strVersion != SERIALIZATION_VERSION_STRING)) { Clear(); return; } } void UpdatedBlockTip(const CBlockIndex *pindex, CConnman& connman); int64_t GetLastDiffTime() { return nTimeLastDiff; } void UpdateLastDiffTime(int64_t nTimeIn) { nTimeLastDiff = nTimeIn; } int GetCachedBlockHeight() { return nCachedBlockHeight; } // Accessors for thread-safe access to maps bool HaveObjectForHash(uint256 nHash); bool HaveVoteForHash(uint256 nHash); int GetVoteCount() const; bool SerializeObjectForHash(uint256 nHash, CDataStream& ss); bool SerializeVoteForHash(uint256 nHash, CDataStream& ss); void AddPostponedObject(const CGovernanceObject& govobj) { LOCK(cs); mapPostponedObjects.insert(std::make_pair(govobj.GetHash(), govobj)); } void AddSeenGovernanceObject(uint256 nHash, int status); void AddSeenVote(uint256 nHash, int status); void MasternodeRateUpdate(const CGovernanceObject& govobj); bool MasternodeRateCheck(const CGovernanceObject& govobj, bool fUpdateFailStatus = false); bool MasternodeRateCheck(const CGovernanceObject& govobj, bool fUpdateFailStatus, bool fForce, bool& fRateCheckBypassed); bool ProcessVoteAndRelay(const CGovernanceVote& vote, CGovernanceException& exception, CConnman& connman) { bool fOK = ProcessVote(NULL, vote, exception, connman); if(fOK) { vote.Relay(connman); } return fOK; } void CheckMasternodeOrphanVotes(CConnman& connman); void CheckMasternodeOrphanObjects(CConnman& connman); void CheckPostponedObjects(CConnman& connman); bool AreRateChecksEnabled() const { LOCK(cs); return fRateChecksEnabled; } void InitOnLoad(); int RequestGovernanceObjectVotes(CNode* pnode, CConnman& connman); int RequestGovernanceObjectVotes(const std::vector<CNode*>& vNodesCopy, CConnman& connman); private: void RequestGovernanceObject(CNode* pfrom, const uint256& nHash, CConnman& connman, bool fUseFilter = false); void AddInvalidVote(const CGovernanceVote& vote) { mapInvalidVotes.Insert(vote.GetHash(), vote); } void AddOrphanVote(const CGovernanceVote& vote) { mapOrphanVotes.Insert(vote.GetHash(), vote_time_pair_t(vote, GetAdjustedTime() + GOVERNANCE_ORPHAN_EXPIRATION_TIME)); } bool ProcessVote(CNode* pfrom, const CGovernanceVote& vote, CGovernanceException& exception, CConnman& connman); /// Called to indicate a requested object has been received bool AcceptObjectMessage(const uint256& nHash); /// Called to indicate a requested vote has been received bool AcceptVoteMessage(const uint256& nHash); static bool AcceptMessage(const uint256& nHash, hash_s_t& setHash); void CheckOrphanVotes(CGovernanceObject& govobj, CGovernanceException& exception, CConnman& connman); void RebuildIndexes(); void AddCachedTriggers(); bool UpdateCurrentWatchdog(CGovernanceObject& watchdogNew); void RequestOrphanObjects(CConnman& connman); void CleanOrphanObjects(); }; #endif
[ "boris.coin.want@gmail.com" ]
boris.coin.want@gmail.com
a698cf975369bf2dceea02fb99d2264ee2b7ad75
90d2bba22f32c4958610ab5e6dd80f3ec6a8a81a
/week-06/day-4/13.cpp
48e0d1a6d4d33ea86667ab6e2f26dbdf8e24a485
[]
no_license
greenfox-zerda-sparta/bmakszim
2b1900e58c5aba6ef9eb0f8f0f313a8c64854727
9aa1ab574e2a6b4a6a8963674c6845e611152fc3
refs/heads/master
2021-01-17T18:19:37.688308
2017-02-21T16:06:50
2017-02-21T16:06:50
71,350,616
0
1
null
null
null
null
UTF-8
C++
false
false
1,384
cpp
#include <iostream> #include <string> #include <vector> #include <stdlib.h> #include <time.h> #include <algorithm> using namespace std; vector<int> row(4); vector<vector<int>> matrix (4, row); void print_vector() { cout << endl; for (unsigned int i = 0; i < matrix.size(); i++) { for (unsigned int j = 0; j < matrix[i].size(); j++) { cout << matrix[i].at(j) << ' '; } cout << endl; } } int main() { //Create a 2 dimensional vector with matrix! // 1 0 0 0 // 0 1 0 0 // 0 0 1 0 // 0 0 0 1 // Extend it to the following format: // 1 1 1 1 1 // 0 1 0 0 1 // 0 0 1 0 1 // 0 0 0 1 1 // 0 0 0 0 1 // Mirror it horizontaly! // Mirror it verticaly! //2 dimensional matrix for (unsigned int i = 0; i < matrix.size(); i++) { matrix[i][i] = 1; } print_vector(); //Extended matrix.push_back(row); for (unsigned int i = 0; i < matrix.size(); i++) { matrix[i].push_back(1); matrix[0].at(i) = 1; } print_vector(); //Mirrored horizontally for (unsigned int i = 0; i < (matrix.size() / 2); i++) { swap(matrix[i], matrix[(matrix.size()-i)-1]); } print_vector(); //Mirrored vertically for (unsigned int i = 0; i < matrix.size(); i++) { for (unsigned int j = 0; j < (matrix[i].size() / 2); j++) { swap(matrix[i][j], matrix[i][(matrix[i].size()-j)-1]); } } print_vector(); return 0; }
[ "b.makszim@hotmail.com" ]
b.makszim@hotmail.com
e7101c4247c23daa7493375a1c994199675b8ce6
a74a0a0f590a8d9e7e83fa012377d4cc3702e857
/Classes/ClassBase/GameSpriteBase.h
549fcb892f0de6ba9e23c921c94c4d87b7b01706
[]
no_license
l1000965431/MagicForest
11e05bfd794ffbae6bf043b37dc90cb07bccbaf6
e9a4a58569b670bd3d06801cbc3999ee07b10198
refs/heads/master
2016-09-06T01:48:15.459692
2015-02-25T15:50:06
2015-02-25T15:50:06
30,901,874
0
0
null
null
null
null
GB18030
C++
false
false
863
h
/*/////////////////////////////////////////////////////////////////////////////// --作者:seele --功能说明:游戏精灵基础类 ///////////////////////////////////////////////////////////////////////////////*/ #pragma once #include "common.h" class GameSpriteBase:public Sprite { public: GameSpriteBase(); virtual ~GameSpriteBase(); public: static GameSpriteBase* create(void); static GameSpriteBase* create(const std::string& filename); static GameSpriteBase* create(const std::string& filename, const Rect& rect); static GameSpriteBase* createWithTexture(Texture2D *texture); static GameSpriteBase* createWithTexture(Texture2D *texture, const Rect& rect, bool rotated=false); static GameSpriteBase* createWithSpriteFrame(SpriteFrame *spriteFrame); static GameSpriteBase* createWithSpriteFrameName(const std::string& spriteFrameName); };
[ "l1000965431@126.com" ]
l1000965431@126.com
38e41beaf72a59fa0045a88491767ff989c573f2
583d876ec2e0577f03d27033c44a731cb5883219
/Robot_Control/robot_control.cpp
20d955b74630380a4146eedd62a36d0e9aadaa3d
[]
no_license
BGCX067/eyerobot-hg-to-git
6950df8a76cd536682843eb6c1232833735be7ee
f25681efe96f205fb0dac74b0072a5ac08070467
refs/heads/master
2016-09-01T08:50:07.262989
2010-07-09T18:40:57
2010-07-09T18:40:57
48,706,126
0
0
null
null
null
null
UTF-8
C++
false
false
9,935
cpp
// Robot_Control.cpp: implementation of the Robot_Control class. // ////////////////////////////////////////////////////////////////////// #include "Robot_Control.h" #include <stdio.h> #include <math.h> #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif /* world position in mm*/ #define CENTERX 584.8 #define CENTERY 0.0 #define CENTERZ 508.0 #define CENTERROTX 0.0 #define CENTERROTY 0.0 ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// Robot_Control::Robot_Control() { } Robot_Control::~Robot_Control() { //Robbie->LockAxes(alAllAxes); Robbie->UnlockAxes(alAllAxes); Robbie->ControlRelease(); } int Robot_Control::Initialize() { counterX=0; counterY=0; counterZ=0; toolX=0; toolY=0; toolZ=0; current_xrotation = 0; current_yrotation = 0; if FAILED(CoInitialize (NULL)) { MessageBoxA(NULL,(LPCSTR)"CoInitialize() failed.","Error", MB_OK); fprintf(stderr,"CoInitialize() failed."); exit(0); } try { // initialize robot pointer variables Robbie = ICRSRobotPtr(__uuidof(CRSRobot)); TestV3 = ICRSV3FilePtr(__uuidof(CRSV3File)); Robbie->put_Units( utMetric ); //Robbie->put_Units( utEnglish ); TheSpeed = 80; //get control of robot Robbie->ControlGet(); // open V3File TestV3->Open("reach_eye.v3", v3fReadOnly); //TestV3->Open("metr.v3", v3fReadOnly); //retrieve variables from V3 file locationtemp = TestV3->GetLocation("initial", 0, 0); // close file TestV3->Close(); //Unlock all the axes... Robbie->UnlockAxes(alAllAxes); for (int i = 0;i<100;i++){ for (int j=0;j<100;j++){ for (int k=0;k<100;k++){ grid[i][j][k] = ICRSLocationPtr(__uuidof(CRSLocation)); grid[i][j][k] = locationtemp; grid[i][j][k]->x=CENTERX; grid[i][j][k]->y=CENTERY; grid[i][j][k]->z=CENTERZ; grid[i][j][k]->xrot=CENTERROTX; grid[i][j][k]->yrot=CENTERROTY; }}} } catch (_com_error MyError) { // display error message sprintf(WorkString, "The following error occurred during initialization --\n%s", (LPCTSTR) MyError.Description()); fprintf(stderr,"%s",WorkString); MessageBoxA(NULL,(LPCSTR) MyError.Description(),"The following error occurred during initialization --", MB_OK); // MessageBox(NULL,WorkString,"Error", MB_OK); //AfxMessageBox(WorkString); //close the program of the parent...or let them try something else... Robbie->UnlockAxes(alAllAxes); Robbie->ControlRelease(); return 0; } return 1; } ICRSLocationPtr Robot_Control::GetLocation( _bstr_t V3FileName, _bstr_t Variable ){ TestV3->Open( V3FileName, v3fReadOnly); //retrieve variables from V3 file locationtemp = TestV3->GetLocation(Variable, 0, 0); // close file TestV3->Close(); return locationtemp; } int Robot_Control::Compute_Grid(int points,int pointsz, float x, float y, float z, float spacing) { int i, j, k; //counter variables temporary //int validStatus; //check the boundaries of the given world axis and the grid - is it in bounds? //instantiate a v3 object, create a file, and let's add variables to it... //transform the world coordinate to the given origin relative to the robot base... //generate the grid... FILE *fp1 = fopen("zztest.txt","wt"); /*in sensor coords: i = z, j = x, k = y*/ /*in robot coords: i = x, j = y, k = z*/ for (i=0;i<points;i++){ for (j=0;j<points;j++){ for (k=0;k<pointsz;k++){ mygrid[i][j][k].x = (float) (spacing*i+x); mygrid[i][j][k].y = (float) (spacing*j+y); mygrid[i][j][k].z = (float) (spacing*k+z); mygrid[i][j][k].xrot = 0.0; mygrid[i][j][k].yrot = 0.0; printf("Vals: x: %f y: %f z: %f\n", mygrid[i][j][k].x,mygrid[i][j][k].y,mygrid[i][j][k].z); fprintf(fp1,"%f\t%f\t%f\n", mygrid[i][j][k].x,mygrid[i][j][k].y,mygrid[i][j][k].z); } } } fprintf(fp1,"\nCorrected coordinates\n"); float lsens = 10.25; //length of sensor in in. 26cm or 10.25 in for (int i=0;i<points;i++){ for (int j=0;j<points;j++){ for (int k=0;k<pointsz;k++){ float r1 = atan2(mygrid[i][j][k].y, mygrid[i][j][k].x); float r2 = sqrt( pow(mygrid[i][j][k].x,2)+pow(mygrid[i][j][k].y,2)) - lsens; float u = r2 * cos( r1 ) ; float v = r2 * sin( r1 ); mygrid[i][j][k].x = u; mygrid[i][j][k].y = v; printf("New Vals: x: %f y: %f z: %f\n", mygrid[i][j][k].x,mygrid[i][j][k].y,mygrid[i][j][k].z); fprintf(fp1,"%f\t%f\t%f\n", mygrid[i][j][k].x,mygrid[i][j][k].y,mygrid[i][j][k].z); }}} fclose(fp1); return (points*3); } int Robot_Control::MoveToGridPoint(int xcounter, int ycounter, int zcounter) { //locationtemp->PutFlags( ACTIVEROBOTLib::locFlags(16) ); locationtemp->x = (float)mygrid[xcounter][ycounter][zcounter].x; locationtemp->y = (float)mygrid[xcounter][ycounter][zcounter].y; locationtemp->z = (float)mygrid[xcounter][ycounter][zcounter].z; locationtemp->xrot = (float)mygrid[xcounter][ycounter][zcounter].xrot; locationtemp->yrot = (float)mygrid[xcounter][ycounter][zcounter].yrot; VARIANT_BOOL metr = locationtemp->IsMetric; locFlags flags = locFlags(); locationtemp->get_Flags(&flags); try { Robbie->PutSpeed(TheSpeed); Robbie->Move(locationtemp); //Robbie->Move(grid[xcounter][ycounter][zcounter]); } catch (_com_error MyError) { // display error message sprintf(WorkString, "The following error occurred in MoveToGridPoint --\n%s", (LPCTSTR) MyError.Description()); fprintf(stderr,"%s",WorkString); MessageBoxA(NULL,(LPCSTR) MyError.Description(),"The following error occurred in MoveToGridPoint", MB_OK); //AfxMessageBox(WorkString); return 0; } counterX = xcounter; counterY = ycounter; counterZ = zcounter; return 1; } int Robot_Control::Get_X_Counter(void) { if (counterX<0 || counterX>1000) { fprintf(stderr,"CounterX is not initialized yet"); //AfxMessageBox("CounterX is not initialized yet", MB_OK, -1); //MessageBox(NULL,"CounterX is not initialized yet","Error", MB_OK); return -1; } else return (counterX); } int Robot_Control::Get_Y_Counter() { if (counterY<0 || counterY>1000) { fprintf(stderr,"CounterY is not initialized yet"); //AfxMessageBox("CounterY is not initialized yet", MB_OK, -1); // MessageBox(NULL,"CounterY is not initialized yet","Error", MB_OK); return -1; } else return (counterY); } int Robot_Control::Get_Z_Counter() { if (counterZ<0 || counterZ>1000) { fprintf(stderr,"CounterZ is not initialized yet"); //AfxMessageBox("CounterZ is not initialized yet", MB_OK, -1); //MessageBox(NULL,"CounterZ is not initialized yet","Error", MB_OK); return -1; } else return (counterZ); } float Robot_Control::Get_X_Position() { return (grid[counterX][counterY][counterZ]->x); } float Robot_Control::Get_Y_Position() { return (grid[counterX][counterY][counterZ]->y); } float Robot_Control::Get_Z_Position() { return (grid[counterX][counterY][counterZ]->z); } int Robot_Control::MoveTo_Actual_Point(float x, float y, float z, float rotatex, float rotatey) { //locationtemp = ICRSLocationPtr(__uuidof(CRSLocation)); locationtemp->Putx(x); locationtemp->Puty(y); locationtemp->Putz(z); locationtemp->Putxrot(rotatex); locationtemp->Putyrot(rotatey); float x1 = locationtemp->Getx(); float y1 = locationtemp->Gety(); float z1 = locationtemp->Getz(); float xr1 = locationtemp->Getxrot(); float xy1 = locationtemp->Getyrot(); locationtemp->GetIsValid(); /*locationtemp->x = (float)x; locationtemp->y = (float)y; locationtemp->z = (float)z; locationtemp->xrot =(float)rotatex; locationtemp->yrot =(float)rotatey;*/ VARIANT_BOOL validloc = false; validloc = locationtemp->GetIsValid(); if( validloc ){ try { Robbie->PutSpeed(TheSpeed); //Robbie->MoveStraight(locationtemp); //not interpolated movement? //Robbie->raw_Move(locationtemp); //no error msgs Robbie->Move(locationtemp); //Robbie->Approach(locationtemp,10); } catch (_com_error MyError) { // display error message sprintf(WorkString, "The following error occurred during movement to actual point --\n%s", (LPCTSTR) MyError.Description()); fprintf(stderr,"%s",(LPCTSTR) MyError.Description()); //fprintf(stderr,"%s",WorkString); //AfxMessageBox(WorkString); ::MessageBoxA(NULL,(LPCSTR) MyError.Description(),"Error", MB_OK); //close the program of the parent...or let them try something else... return 0; } } else{ //if invalid location fprintf(stderr,"Point %f %f %f is invalid\n",x,y,z); } return 1; } void Robot_Control::Ready( void ){ Robbie->Ready(); } int Robot_Control::GPIO(int pin, int onoff) { try { /* OR outputs and incoming pin for on*/ if( onoff ){ long out = Robbie->Outputs[1]; out = ((long) 1 << (pin - 1)) | out; //(long) pow( (float) 2, (pin-1) ) | out; Robbie->PutOutputs(1, out); } /* NAND outputs and incoming pin for on*/ else{ long out = Robbie->Outputs[1]; out = out & (long)((long) 0xFFFF - (long) (1 << (pin - 1)));//((long) pow( (float) 2, (pin-1) )); Robbie->PutOutputs(1, out); } } catch (_com_error MyError) { // display error message sprintf(WorkString, "The following error occurred during GPIO output change --\n%s", (LPCTSTR) MyError.Description()); fprintf(stderr,"%s",WorkString); ::MessageBoxA(NULL,(LPCSTR) MyError.Description(),"Error", MB_OK); //AfxMessageBox(WorkString); //MessageBox(NULL,WorkString,"Error", MB_OK); //close the program of the parent...or let them try something else... return 0; } return 1; }
[ "devnull@localhost" ]
devnull@localhost
1b1c22d17192f5fc83c7a25df655f573e3fa956e
802eba0a1ed88815372783c36cef3a6d43ea2238
/src/InsertMessage.cpp
695442f43074663e7fc970ecb1ec24a879002c2e
[]
no_license
IsabelleLenertz/BMP_Project-console-app
6815513a4a59766044c27efb46b4ad03179461ad
de2e6029e2aa0011f2d07ebf354883a11373ba1d
refs/heads/master
2021-05-29T06:36:41.896134
2015-11-13T01:49:07
2015-11-13T01:49:31
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,881
cpp
/* * InsertMessage.cpp * * Created on: Nov 12, 2015 * Author: Isabelle */ #include "InsertMessage.hpp" InsertMessage::InsertMessage() { this->message = ""; this->imageAddress = ""; this->insertionObject = nullptr; } InsertMessage::InsertMessage(string newAddress, string newMessage) { this->message = newMessage; this->imageAddress = newAddress; this->insertionObject = new PixelArrayIn(this->imageAddress); } InsertMessage::~InsertMessage() { delete this->insertionObject; cout << "You are deleting an InsertMessage Object" << endl; } bool InsertMessage::setImageAddress(string newAddress) { bool returnvalue = false; // Deletes the PixelArrayIn objects and creates a new one with the new address if (this->insertionObject != nullptr){ delete this->insertionObject; } this->insertionObject = new PixelArrayIn(newAddress); // Check if the new insertionObject was properly initialized if (this->insertionObject->getValidity() == true ){ returnvalue = true; } // Returns true for success, false for failure. return returnvalue; } bool InsertMessage::insertMessage(){ bool returnvalue = false; // Check if the object was initialized if ( (this->message != "") || (this->message != "") || (this->insertionObject != nullptr) ){ try{ // Inserts the message into the BMP file. returnvalue = this->insertionObject->insertMessage(this->message); } // Catches the error thrown by the insertMessage function, the error class indicates the max size the image can hold. catch (MessageTooLong & error){ // send the error to the user of the insertMessage class. throw error; } } // Returns true for success, false for failure. return returnvalue; } int InsertMessage::maxMessageSize(){ int maxSize = 0; if(this->insertionObject != nullptr){ maxSize = this->insertionObject->getMaxSizeMessage(); } return maxSize; }
[ "isabelle.lenertz@gmail.com" ]
isabelle.lenertz@gmail.com
5010b9410b82c7c908c7cd42cf23aa44219e4fd1
f525a283602fa9bf28e10df7a51641b8026e3d60
/test_led/test_led.ino
edbdf3be6232775219fee5916a74dd8fe0806dab
[]
no_license
devYaoYH/LED_ConsoleInstallation
c60276db341ceabc6f3fbe6c48a9a0e3317767de
bc1ff77120eb726d0ac4511c591c8a32d466568a
refs/heads/master
2021-01-16T11:29:39.676106
2020-03-05T04:11:37
2020-03-05T04:11:37
243,102,434
0
0
null
null
null
null
UTF-8
C++
false
false
568
ino
#include <FastLED.h> #define NUM_LEDS 50 #define DATA_PIN 5 CRGB leds[NUM_LEDS]; void setup() { // put your setup code here, to run once: delay(2000); for (int i=0;i<NUM_LEDS;++i){ leds[i] = CRGB::Black; } FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS); } void loop() { // put your main code here, to run repeatedly: for(int i=0;i<NUM_LEDS;++i){ leds[i] = CRGB::Blue; FastLED.show(); leds[i] = CRGB::Black; delay(50); } leds[NUM_LEDS-1] = CRGB::Red; FastLED.show(); leds[NUM_LEDS-1] = CRGB::Black; delay(1000); }
[ "devyaoyh@gmail.com" ]
devyaoyh@gmail.com
f93530788af66580442d136cb80ef3a291667710
07c3e4c4f82056e76285c81f14ea0fbb263ed906
/Re-Abyss/app/services/Decor/base/IDecorService.hpp
37ee20ea578f42713a853e8679c7f6e3f9685850
[]
no_license
tyanmahou/Re-Abyss
f030841ca395c6b7ca6f9debe4d0de8a8c0036b5
bd36687ddabad0627941dbe9b299b3c715114240
refs/heads/master
2023-08-02T22:23:43.867123
2023-08-02T14:20:26
2023-08-02T14:20:26
199,132,051
9
1
null
2021-11-22T20:46:39
2019-07-27T07:28:34
C++
UTF-8
C++
false
false
833
hpp
#pragma once #include <memory> #include <Siv3D/Array.hpp> #include <Siv3D/HashTable.hpp> #include <abyss/commons/Fwd.hpp> #include <abyss/entities/Decor/GraphicsEntity.hpp> #include <abyss/modules/Decor/Map/TileMapData.hpp> namespace abyss::Decor { class IDecorService { public: using DecorGraphics = s3d::HashTable<s3d::uint32, GraphicsEntity>; using DecorAnimations = s3d::HashTable<s3d::uint32, s3d::Array<AnimationEntity>>; public: virtual ~IDecorService() = default; virtual const s3d::Array<std::shared_ptr<DecorEntity>>& getDecors() const = 0; virtual s3d::Array<Map::TileMapData> getTileMap(const s3d::RectF& screen) const = 0; virtual const DecorGraphics& getGraphics() const = 0; virtual const DecorAnimations& getAnimations() const = 0; }; }
[ "tyanmahou@gmail.com" ]
tyanmahou@gmail.com
b5b78fd83c97954abd18b7d2585f94182fc20831
83473317e264f0d37224940ef233d6095b400a44
/freefloating_gazebo/include/freefloating_gazebo/thruster_allocator.h
b5fcbc544dbaafa974bedf3bcef54afe0945d890
[ "MIT" ]
permissive
x1aoo/freefloating
841bba6169c3db31c8ca852ab40302d2a22d6387
6ec86b0517c82a7422fca74f1603b236499de8b0
refs/heads/master
2020-05-23T15:57:23.690480
2019-06-24T13:27:46
2019-06-24T13:27:46
186,837,234
0
0
null
null
null
null
UTF-8
C++
false
false
2,354
h
#ifndef THRUSTER_ALLOCATOR_H #define THRUSTER_ALLOCATOR_H #include <Eigen/Core> #include <Eigen/SVD> #include <ros/ros.h> #include <geometry_msgs/Wrench.h> #include <sensor_msgs/JointState.h> #include <freefloating_gazebo/hydro_model_parser.h> #include <visp/vpFeaturePoint.h> // #include <vector> std::vector<double> plot_cost_x, plot_cost_y, plot_cost_z, plot_cost_roll, plot_cost_pitch, plot_cost_yaw, plot_cost_sum, plot_cost_roll_square, plot_cost_rate; std::vector<double> plot_time; sensor_msgs::JointState msg_pre; namespace ffg { class ThrusterAllocator { public: // parse raw param to get thruster max force and map ThrusterAllocator(ros::NodeHandle &nh); std::vector<std::string> initControl(ros::NodeHandle &nh, double map_threshold = 1e-2);//to push the controlled axes to the nh and map_threshold is useless bool has_thrusters() const {return names.size();} //transfor the array to the formolized message geometry_msgs::Wrench maxWrench() const//where we use the maxWrench function or? { geometry_msgs::Wrench wrench; wrench.force.x = max_wrench[0]; wrench.force.y = max_wrench[1]; wrench.force.z = max_wrench[2]; wrench.torque.x = max_wrench[3]; wrench.torque.y = max_wrench[4]; wrench.torque.z = max_wrench[5]; return wrench; } void saturate(Eigen::VectorXd &_command) const; sensor_msgs::JointState wrench2Thrusters(const geometry_msgs::Wrench & cmd, double angle1, double angle2, double fl, double fr, double f2, double f3, double f4, ros::NodeHandle &nh) const; // std::vector<sensor_msgs::JointState> wrench2Thrusters_iterative(const geometry_msgs::Wrench & cmd, vpColVector state_pre, ros::NodeHandle &nh) const; sensor_msgs::JointState wrench2Thrusters_iterative(const geometry_msgs::Wrench & cmd, vpColVector state_pre, ros::NodeHandle &nh) const; sensor_msgs::JointState wrench2Thrusters_3rd(const geometry_msgs::Wrench &cmd, vpColVector state_pre, vpColVector state_poi, vpColVector state_vel, ros::NodeHandle &nh, std::vector<double> gains, Eigen::Matrix3d curR) const; ffg::HydroLink base_link; std::vector<uint> steer_idx, fixed_idx; std::vector<std::string> names;//pase from passer std::vector<double> max_thrust, max_wrench, max_vel; Eigen::MatrixXd map; Eigen::MatrixXd inverse_map; }; } #endif // THRUSTER_ALLOCATOR_H
[ "mapeleaf@126.com" ]
mapeleaf@126.com
8a1023e5ca1eee62b48a6d41d64cbd692a41e680
fc7e848f63539c1f84ef071e4ba1912347dcca95
/example/src/main.cpp
5c4153e18a7cef86f932febc7f79a26da7df3347
[ "MIT", "LicenseRef-scancode-public-domain", "Zlib" ]
permissive
armadillu/ofxFontStash2
c100f43b87d26626f0720484601949330b18bcb7
55e60a8b5bcebe6fc898592971aaf5d286fc5c61
refs/heads/master
2021-01-18T22:33:19.943047
2020-10-24T12:06:30
2020-10-24T12:06:30
38,983,731
37
12
null
2018-07-18T21:31:08
2015-07-13T00:40:06
C
UTF-8
C++
false
false
738
cpp
#include "ofMain.h" #include "ofApp.h" //======================================================================== int main( ){ ofGLFWWindowSettings settings; #ifdef TARGET_OPENGLES settings.setGLESVersion(2); #else #ifdef NANOVG_GL2_IMPLEMENTATION settings.setGLVersion(2, 1); // Fixed pipeline #endif #ifdef NANOVG_GL3_IMPLEMENTATION settings.setGLVersion(3, 2); // Programmable pipeline >> you need to define GL_VERSION_3 in you pre-processor macros! #endif #endif settings.stencilBits = 8; settings.numSamples = 4; int w = 1300; int h = 1050; #if OF_VERSION_MINOR < 10 settings.width = w; settings.height = w; #else settings.setSize(w, h); #endif ofCreateWindow(settings); ofRunApp(new ofApp()); }
[ "oriol@uri.cat" ]
oriol@uri.cat