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
032ef79c289644751caa6ef91a319c421c6661dc
46117fe29f08fac144bfe234e4835ce05624f9a9
/src/main.cpp
878ef838898ee0fbadf7959610aa9d797e5b3e3b
[ "MIT" ]
permissive
djecom1/TTGO-T-Wristband-First-Steps
d322eb8942dcadcc8fb7313132e9cfd1ac0780dd
ef6ac92de175cce539d31e8ac31c37a6ba5354ea
refs/heads/master
2020-12-24T04:23:29.581854
2020-01-25T15:28:49
2020-01-25T15:28:49
237,381,768
1
0
null
2020-01-31T07:34:47
2020-01-31T07:34:46
null
UTF-8
C++
false
false
450
cpp
#include <Arduino.h> #include <Wire.h> #include <rom/rtc.h> #include "wristband-tft.hpp" #include "wristband-ota.hpp" #include "clock.hpp" #include "pages.hpp" #include "mpu.hpp" void setup() { deactivateWifi(); btStop(); Serial.begin(115200); Wire.begin(I2C_SDA_PIN, I2C_SCL_PIN); Wire.setClock(400000); initClock(); tftInit(); initButton(); addBatteryChargeInterrupt(); } void loop() { handleUi(); }
[ "r.hernandez@tvt.es" ]
r.hernandez@tvt.es
5bc1be355f0d587bf5b203a30ca663bd8adf12f5
416681ce1a6f5f2ad323063703b1ec82f87cd98d
/FacebookProject/Status.h
b1fa14355e1b85a5be5cde408d1264bdc50c64f2
[]
no_license
shirayadshalom/Facebook
d26934f371ca3b1e601210851009a3d880bcd820
7a1835209168777de45a1e98d80ef9d66fae7a0b
refs/heads/master
2020-09-11T22:44:24.496103
2020-02-02T14:19:49
2020-02-02T14:19:49
222,214,975
0
0
null
null
null
null
UTF-8
C++
false
false
1,120
h
#ifndef __STATUS_H #define __STATUS_H #include <conio.h> #include <windows.h> #include "Date.h" #include <string.h> #include "Time.h" class Status { public: enum eColor{BLUE = 1, YELLOW = 14, LIGHTGREY = 7}; protected: Date date; Time time; public: Status() = default; //d'tor virtual ~Status() {}; virtual const Status& operator=(const Status& other) = 0; virtual void showStatus() const = 0 { cout << "Date of status: "; this->date.showDate(); cout << "\nTime of status: "; this->time.showTime(); } const Date& getDate() const { return date; } const Time& getTime() const { return time; } virtual bool operator==(const Status& other) const = 0; virtual bool operator!=(const Status& other) const { return !(*this == other); } }; class ltStatus { public: // This function compare between two dates and times of the statuses bool operator()(const Status* s1, const Status* s2) const { int dateCompares = compareDates(s1->getDate(), s2->getDate()); //same day if (dateCompares == 0) return compareTime(s1->getTime(), s2->getTime()) < 0; return dateCompares < 0; } }; #endif
[ "55780023+shirayadshalom@users.noreply.github.com" ]
55780023+shirayadshalom@users.noreply.github.com
7c71565626cda911ee0341e2c72e8b242c93085c
eaaf514a11d3a64a77d73946cfac26f0d98893ed
/problemset/interview-0805.cpp
b48e47d802f6d80fdfa4be1b26842447d97b120d
[]
no_license
yinweijie/Leetcode-Leetbook
2e63d95f1fc2245662090ada5c52fded110261b7
aeea86329a1563d856709d9cce7db9447e9e1999
refs/heads/main
2023-05-09T21:55:42.219787
2021-06-10T17:05:33
2021-06-10T17:05:33
326,009,315
1
0
null
null
null
null
UTF-8
C++
false
false
549
cpp
// 面试题 08.05. 递归乘法 // https://leetcode-cn.com/problems/recursive-mulitply-lcci/ #include <unordered_map> using namespace std; class Solution { private: unordered_map<int, int> memo; public: int multiply(int A, int B) { if(B == 0) return 0; if(memo.count(B) > 0) return memo[B]; if(B % 2 == 0) { memo[B] = multiply(A, B >> 1) + multiply(A, B >> 1); return memo[B]; } else { memo[B] = A + multiply(A, B - 1); return memo[B]; } } };
[ "ywj123450@gmail.com" ]
ywj123450@gmail.com
11712215a2ae2997aaa9f15aace3f683a29865ca
a1a5b449d8dd2cdae86f30bafe575a2b22581e29
/fboss/agent/hw/sai/api/HostifApi.h
323987b608af13cb05dc241dd2e115b92b443b14
[ "BSD-3-Clause" ]
permissive
capveg/fboss
a5e373a66ec727001c058a61319812213e117fdf
edc92a489e95be2fd156c605cac8ca83847d65fb
refs/heads/master
2020-07-05T10:37:27.667627
2019-08-15T23:56:54
2019-08-15T23:56:54
202,626,192
0
0
NOASSERTION
2019-08-15T23:44:23
2019-08-15T23:44:22
null
UTF-8
C++
false
false
7,024
h
/* * Copyright (c) 2004-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ #pragma once #include "fboss/agent/hw/sai/api/SaiApi.h" #include "fboss/agent/hw/sai/api/SaiAttribute.h" #include "fboss/agent/hw/sai/api/SaiAttributeDataTypes.h" #include <folly/MacAddress.h> #include <folly/logging/xlog.h> #include <vector> extern "C" { #include <sai.h> } namespace facebook { namespace fboss { struct HostifApiParameters { static constexpr sai_api_t ApiType = SAI_API_HOSTIF; struct TxPacketAttributes { using EnumType = sai_hostif_packet_attr_t; using TxType = SaiAttribute< EnumType, SAI_HOSTIF_PACKET_ATTR_HOSTIF_TX_TYPE, sai_int32_t>; using EgressPortOrLag = SaiAttribute< EnumType, SAI_HOSTIF_PACKET_ATTR_EGRESS_PORT_OR_LAG, SaiObjectIdT>; using TxAttributes = SaiAttributeTuple<TxType, SaiAttributeOptional<EgressPortOrLag>>; TxPacketAttributes(const TxAttributes& attrs) { std::tie(txType, egressPortOrLag) = attrs.value(); } TxAttributes attrs() const { return {txType, egressPortOrLag}; } folly::Optional<typename EgressPortOrLag::ValueType> egressPortOrLag; typename TxType::ValueType txType; }; struct RxPacketAttributes { using EnumType = sai_hostif_packet_attr_t; using TrapId = SaiAttribute< EnumType, SAI_HOSTIF_PACKET_ATTR_HOSTIF_TRAP_ID, SaiObjectIdT>; using IngressPort = SaiAttribute< EnumType, SAI_HOSTIF_PACKET_ATTR_INGRESS_PORT, SaiObjectIdT>; using IngressLag = SaiAttribute< EnumType, SAI_HOSTIF_PACKET_ATTR_INGRESS_LAG, SaiObjectIdT>; using RxAttributes = SaiAttributeTuple<TrapId, IngressPort, IngressLag>; RxPacketAttributes(const RxAttributes& attrs) { std::tie(trapId, ingressPort, ingressLag) = attrs.value(); } RxAttributes attrs() const { return {trapId, ingressPort, ingressLag}; } typename TrapId::ValueType trapId; typename IngressPort::ValueType ingressPort; typename IngressLag::ValueType ingressLag; }; struct HostifApiPacket { void* buffer; size_t size; HostifApiPacket(void* buffer, size_t size) : buffer(buffer), size(size) {} }; struct Attributes { using EnumType = sai_hostif_trap_group_attr_t; using Queue = SaiAttribute<EnumType, SAI_HOSTIF_TRAP_GROUP_ATTR_QUEUE, sai_uint32_t>; using Policer = SaiAttribute< EnumType, SAI_HOSTIF_TRAP_GROUP_ATTR_POLICER, SaiObjectIdT>; using CreateAttributes = SaiAttributeTuple< SaiAttributeOptional<Queue>, SaiAttributeOptional<Policer>>; Attributes(const CreateAttributes& attrs) { std::tie(queue, policer) = attrs.value(); } CreateAttributes attrs() const { return {queue, policer}; } bool operator==(const Attributes& other) const { return attrs() == other.attrs(); } bool operator!=(const Attributes& other) const { return !(*this == other); } folly::Optional<typename Queue::ValueType> queue; folly::Optional<typename Policer::ValueType> policer; }; struct MemberAttributes { using EnumType = sai_hostif_trap_attr_t; using PacketAction = SaiAttribute<EnumType, SAI_HOSTIF_TRAP_ATTR_PACKET_ACTION, sai_int32_t>; using TrapGroup = SaiAttribute<EnumType, SAI_HOSTIF_TRAP_ATTR_TRAP_GROUP, SaiObjectIdT>; using TrapPriority = SaiAttribute< EnumType, SAI_HOSTIF_TRAP_ATTR_TRAP_PRIORITY, sai_uint32_t>; using TrapType = SaiAttribute<EnumType, SAI_HOSTIF_TRAP_ATTR_TRAP_TYPE, sai_int32_t>; using CreateAttributes = SaiAttributeTuple< TrapType, PacketAction, SaiAttributeOptional<TrapPriority>, SaiAttributeOptional<TrapGroup>>; MemberAttributes(const CreateAttributes& attrs) { std::tie(trapType, packetAction, trapPriority, trapGroup) = attrs.value(); } CreateAttributes attrs() const { return {trapType, packetAction, trapPriority, trapGroup}; } bool operator==(const MemberAttributes& other) const { return attrs() == other.attrs(); } bool operator!=(const MemberAttributes& other) const { return !(*this == other); } typename TrapType::ValueType trapType; typename PacketAction::ValueType packetAction; folly::Optional<typename TrapPriority::ValueType> trapPriority; folly::Optional<typename TrapGroup::ValueType> trapGroup; }; }; class HostifApi : public SaiApi<HostifApi, HostifApiParameters> { public: HostifApi() { sai_status_t status = sai_api_query(SAI_API_HOSTIF, reinterpret_cast<void**>(&api_)); saiApiCheckError( status, HostifApiParameters::ApiType, "Failed to query for switch api"); } private: sai_status_t _create( sai_object_id_t* hostif_trap_group_id, sai_attribute_t* attr_list, size_t count, sai_object_id_t switch_id) { return api_->create_hostif_trap_group( hostif_trap_group_id, switch_id, count, attr_list); } sai_status_t _remove(sai_object_id_t hostif_trap_group_id) { return api_->remove_hostif_trap_group(hostif_trap_group_id); } sai_status_t _getAttr(sai_attribute_t* attr, sai_object_id_t id) const { return api_->get_hostif_trap_group_attribute(id, 1, attr); } sai_status_t _setAttr(const sai_attribute_t* attr, sai_object_id_t id) { return api_->set_hostif_trap_group_attribute(id, attr); } sai_status_t _createMember( sai_object_id_t* hostif_trap_id, sai_attribute_t* attr_list, size_t count, sai_object_id_t switch_id) { return api_->create_hostif_trap( hostif_trap_id, switch_id, count, attr_list); } sai_status_t _removeMember(sai_object_id_t hostif_trap_id) { return api_->remove_hostif_trap(hostif_trap_id); } sai_status_t _getMemberAttr( sai_attribute_t* attr, sai_object_id_t hostif_trap_id) const { return api_->get_hostif_trap_attribute(hostif_trap_id, 1, attr); } sai_status_t _setMemberAttr( const sai_attribute_t* attr, sai_object_id_t hostif_trap_id) { return api_->set_hostif_trap_attribute(hostif_trap_id, attr); } sai_hostif_api_t* api_; friend class SaiApi<HostifApi, HostifApiParameters>; public: sai_status_t send( const HostifApiParameters::TxPacketAttributes::TxAttributes& attributes, sai_object_id_t switch_id, HostifApiParameters::HostifApiPacket& txPacket) { std::vector<sai_attribute_t> saiAttributeTs = attributes.saiAttrs(); return api_->send_hostif_packet( switch_id, txPacket.size, txPacket.buffer, saiAttributeTs.size(), saiAttributeTs.data()); } }; } // namespace fboss } // namespace facebook
[ "facebook-github-bot@users.noreply.github.com" ]
facebook-github-bot@users.noreply.github.com
302c54dd4427daed64172bd6226004618d76eebf
7ec0686ea3168c5e83568bd80bd65f7755d1bb2d
/HorizonX Engine/HorizonX Engine/MeshRenderer.cpp
8d19eff690f4e5238ad01f7b8b0c29f9c0ea7132
[ "MIT" ]
permissive
JonasKorte/HorizonX-Engine
f72661259c32e5e5b2b00bfffe03f0f0f2b7bcf7
72927084138e846566d34dcb41e72bc83de1d0aa
refs/heads/master
2023-02-27T03:23:04.949627
2021-02-03T09:55:29
2021-02-03T09:55:29
332,404,557
0
0
null
null
null
null
UTF-8
C++
false
false
1,440
cpp
#include "MeshRenderer.h" namespace HX { MeshRenderer::MeshRenderer(Mesh mesh, Material* material) { this->m_mesh = mesh; this->m_material = material; } MeshRenderer::MeshRenderer(const MeshRenderer& meshRenderer) { this->m_mesh = meshRenderer.m_mesh; this->m_material = meshRenderer.m_material; this->m_VAO = meshRenderer.m_VAO; this->m_VBO = meshRenderer.m_VBO; } MeshRenderer::~MeshRenderer() { } void MeshRenderer::Initialize() { glGenVertexArrays(1, &this->m_VAO); glBindVertexArray(this->m_VAO); glGenBuffers(1, &this->m_VBO); glBindBuffer(GL_ARRAY_BUFFER, this->m_VBO); std::vector<float> vertices; for (int i = 0; i < this->m_mesh.size(); i++) { Vector3 position = this->m_mesh[i].position; for (int j = 0; j < 3; j++) { switch (j) { case 0: vertices.push_back(position.x); break; case 1: vertices.push_back(position.y); break; case 2: vertices.push_back(position.z); break; } } } glBufferData(GL_ARRAY_BUFFER, this->m_mesh.size() * 3 * sizeof(float), vertices.data(), GL_DYNAMIC_DRAW); glEnableVertexAttribArray(0); glVertexAttribPointer(0, this->m_mesh.size(), GL_FLOAT, GL_FALSE, sizeof(float) * 3, 0); } void MeshRenderer::Draw() { this->m_material->Bind(); glBindVertexArray(this->m_VAO); glBindBuffer(GL_ARRAY_BUFFER, this->m_VBO); glDrawArrays(GL_TRIANGLES, 0, this->m_mesh.size()); } }
[ "jonaskorte2904@gmail.com" ]
jonaskorte2904@gmail.com
b47d72d0e35678ddcf6be6aa0496f26600708af0
c45ed46065d8b78dac0dd7df1c95b944f34d1033
/TC-SRM-549-div1-600/immortalCO/MagicalHats.cpp
b76d55fedff3aca3d3ae64421de43eb82fd43b30
[]
no_license
yzq986/cntt2016-hw1
ed65a6b7ad3dfe86a4ff01df05b8fc4b7329685e
12e799467888a0b3c99ae117cce84e8842d92337
refs/heads/master
2021-01-17T11:27:32.270012
2017-01-26T03:23:22
2017-01-26T03:23:22
84,036,200
0
0
null
2017-03-06T06:04:12
2017-03-06T06:04:12
null
UTF-8
C++
false
false
3,886
cpp
#include <vector> #include <string> #include <cstring> #include <algorithm> using namespace std; int N, M, R, C, E, lim; int f[1594323]; bool g[1594323]; // f:走到这一步的时候,我能取得的最大金币数 int pid[13][13], s[13]; int e_l[26], e_r[26], e_c[13], p3[14], cnt[3]; // 输出方程 void print_e() { puts("Equation:"); for(int i = 0; i != E; ++i) { printf("e[%d] : ", i); for(int j = 0; j != N; ++j) putchar("01"[(e_l[i] >> j) & 1]); printf(" = %d\n", e_r[i]); } } // 导出 S 到数组 s void Export(int S) { memset(s, 0, N << 2); for(int i = 0; S; ++i, S /= 3) s[i] = S % 3; memset(cnt, 0, sizeof cnt); for(int i = 0; i != N; ++i) ++cnt[s[i]]; } // 判断是否合法 bool pig() { // 先判断有没有太少、太多 if(cnt[0] + cnt[1] < M || cnt[1] > M) return 0; // 现在判断方程是否有解 static int L[26], R[26]; memcpy(L, e_l, E << 2); memcpy(R, e_r, E << 2); bool v; int t, k; for(int i = 0; i != N; ++i) if(s[i]) { v = (s[i] == 1); for(t = e_c[i]; t; t -= 1 << k) { k = __builtin_ctz(t); L[k] ^= 1 << i; R[k] ^= v; // 方程挂掉 if(!L[k] && R[k]) return 0; } } return 1; } class MagicalHats { public: int findMaximumReward(vector<string> map, vector<int> value, int _lim) { // 对抗搜索 // set 是一个三进制数,表示第 i 个帽子中 0. 未被打开 1. 被打开且有金币 2. 被打开且没金币 // 必须有金币的充分条件是:1. 帽子数 <= 金币数 2. 这一位置不取会造成冲突 N = 0, M = value.size(), R = map.size(), C = map[0].size(), lim = _lim; int N_R[13] = {}, N_C[13] = {}; for(int i = 0; i != R; ++i) for(int j = 0; j != C; ++j) if(map[i][j] == 'H') { pid[i][j] = N++; ++N_R[i]; ++N_C[j]; } // 预处理异或方程组 for(int i = 0; i != R; ++i) if(N_R[i]) { e_r[E] = N_R[i] & 1; for(int j = 0; j != C; ++j) if(map[i][j] == 'H') e_l[E] |= 1 << pid[i][j]; ++E; } for(int j = 0; j != C; ++j) if(N_C[j]) { e_r[E] = N_C[j] & 1; for(int i = 0; i != R; ++i) if(map[i][j] == 'H') e_l[E] |= 1 << pid[i][j]; ++E; } // 先消一波! for(int i = 0; i != E; ++i) { // 找到第一位的 1 int tmp = 0; for(int j = i; j != E; ++j) tmp |= e_l[j]; if(!tmp) break; // 找到第 i 行 int p = __builtin_ctz(tmp); for(int j = i; ; ++j) if(e_l[j] & (1 << p)) { swap(e_l[i], e_l[j]); swap(e_r[i], e_r[j]); break; } // 消元(暴力把上面也顺便消掉) int L = e_l[i], R = e_r[i]; for(int j = 0; j != E; ++j) if(j != i && (e_l[j] & (1 << p))) { e_l[j] ^= L; e_r[j] ^= R; } } for(int i = 0; i != E; ++i) { // 判断一次无解 if(!e_l[i] && e_r[i]) return -1; // 预处理包含每一位的方程 for(int k = 0; k != N; ++k) if(e_l[i] & (1 << k)) e_c[k] |= 1 << i; } // 开始状压 DP! int S = 1; for(int i = 0; i != N; ++i) p3[i] = S, S *= 3; p3[N] = S; // 处理每个状态是否可以到达 while(S--) { Export(S); if(cnt[1] + cnt[2] == N) g[S] = pig(); else for(int i = 0; i != N; ++i) if(!s[i] && (g[S + p3[i] * 1] || g[S + p3[i] * 2])) {g[S] = 1; break;} } if(!g[0]) return -1; int tmp_1, tmp_2; #define cmax(a, b) ((a) < (b) ? (a) = (b) : 0) S = p3[N]; // DP while(S--) { Export(S); if(!g[S] || cnt[1] + cnt[2] > lim) f[S] = -1e9; else if(cnt[1] + cnt[2] == lim) f[S] = cnt[1]; else { f[S] = -1e9; for(int i = 0; i != N; ++i) if(!s[i]) { tmp_1 = f[S + p3[i] * 1]; tmp_2 = f[S + p3[i] * 2]; (tmp_2 < 0 || (tmp_1 >= 0 && tmp_1 < tmp_2)) ? cmax(f[S], tmp_1) : cmax(f[S], tmp_2); } } } if(f[0] < 0) return -1; int ans = 0; sort(value.begin(), value.end()); for(int i = 0; i != f[0]; ++i) ans += value[i]; return ans; } } user;
[ "1261954105@qq.com" ]
1261954105@qq.com
f47eeb4e3b3dc525bde5788099fc4752b3dc72dc
c0ce442dccbb7d336490c576bb85f7448cb10ede
/src/test/prevector_tests.cpp
296fc59f7913a870d9c034a21884fb72978109ff
[ "MIT" ]
permissive
sdrtcoin/sdrt
17145ca4bcdde9c580b9da08c9f7b1d70a099f4b
4cb9602d96f0d27470a9f10271ef3c81d74b9632
refs/heads/master
2020-03-27T02:48:22.192929
2018-08-23T08:05:17
2018-08-23T08:05:17
145,819,551
0
0
null
null
null
null
UTF-8
C++
false
false
8,022
cpp
// Copyright (c) 2015 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <vector> #include "prevector.h" #include "random.h" #include "serialize.h" #include "streams.h" #include "test/test_sdrt.h" #include <boost/test/unit_test.hpp> BOOST_FIXTURE_TEST_SUITE(PrevectorTests, TestingSetup) template<unsigned int N, typename T> class prevector_tester { typedef std::vector<T> realtype; realtype real_vector; realtype real_vector_alt; typedef prevector<N, T> pretype; pretype pre_vector; pretype pre_vector_alt; typedef typename pretype::size_type Size; bool passed = true; uint32_t insecure_rand_Rz_cache; uint32_t insecure_rand_Rw_cache; template <typename A, typename B> void local_check_equal(A a, B b) { local_check(a == b); } void local_check(bool b) { passed &= b; } void test() { const pretype& const_pre_vector = pre_vector; local_check_equal(real_vector.size(), pre_vector.size()); local_check_equal(real_vector.empty(), pre_vector.empty()); for (Size s = 0; s < real_vector.size(); s++) { local_check(real_vector[s] == pre_vector[s]); local_check(&(pre_vector[s]) == &(pre_vector.begin()[s])); local_check(&(pre_vector[s]) == &*(pre_vector.begin() + s)); local_check(&(pre_vector[s]) == &*((pre_vector.end() + s) - real_vector.size())); } // local_check(realtype(pre_vector) == real_vector); local_check(pretype(real_vector.begin(), real_vector.end()) == pre_vector); local_check(pretype(pre_vector.begin(), pre_vector.end()) == pre_vector); size_t pos = 0; BOOST_FOREACH(const T& v, pre_vector) { local_check(v == real_vector[pos++]); } BOOST_REVERSE_FOREACH(const T& v, pre_vector) { local_check(v == real_vector[--pos]); } BOOST_FOREACH(const T& v, const_pre_vector) { local_check(v == real_vector[pos++]); } BOOST_REVERSE_FOREACH(const T& v, const_pre_vector) { local_check(v == real_vector[--pos]); } CDataStream ss1(SER_DISK, 0); CDataStream ss2(SER_DISK, 0); ss1 << real_vector; ss2 << pre_vector; local_check_equal(ss1.size(), ss2.size()); for (Size s = 0; s < ss1.size(); s++) { local_check_equal(ss1[s], ss2[s]); } } public: void resize(Size s) { real_vector.resize(s); local_check_equal(real_vector.size(), s); pre_vector.resize(s); local_check_equal(pre_vector.size(), s); test(); } void reserve(Size s) { real_vector.reserve(s); local_check(real_vector.capacity() >= s); pre_vector.reserve(s); local_check(pre_vector.capacity() >= s); test(); } void insert(Size position, const T& value) { real_vector.insert(real_vector.begin() + position, value); pre_vector.insert(pre_vector.begin() + position, value); test(); } void insert(Size position, Size count, const T& value) { real_vector.insert(real_vector.begin() + position, count, value); pre_vector.insert(pre_vector.begin() + position, count, value); test(); } template<typename I> void insert_range(Size position, I first, I last) { real_vector.insert(real_vector.begin() + position, first, last); pre_vector.insert(pre_vector.begin() + position, first, last); test(); } void erase(Size position) { real_vector.erase(real_vector.begin() + position); pre_vector.erase(pre_vector.begin() + position); test(); } void erase(Size first, Size last) { real_vector.erase(real_vector.begin() + first, real_vector.begin() + last); pre_vector.erase(pre_vector.begin() + first, pre_vector.begin() + last); test(); } void update(Size pos, const T& value) { real_vector[pos] = value; pre_vector[pos] = value; test(); } void push_back(const T& value) { real_vector.push_back(value); pre_vector.push_back(value); test(); } void pop_back() { real_vector.pop_back(); pre_vector.pop_back(); test(); } void clear() { real_vector.clear(); pre_vector.clear(); } void assign(Size n, const T& value) { real_vector.assign(n, value); pre_vector.assign(n, value); } Size size() { return real_vector.size(); } Size capacity() { return pre_vector.capacity(); } void shrink_to_fit() { pre_vector.shrink_to_fit(); test(); } void swap() { real_vector.swap(real_vector_alt); pre_vector.swap(pre_vector_alt); test(); } ~prevector_tester() { BOOST_CHECK_MESSAGE(passed, "insecure_rand_Rz: " << insecure_rand_Rz_cache << ", insecure_rand_Rw: " << insecure_rand_Rw_cache); } prevector_tester() { seed_insecure_rand(); insecure_rand_Rz_cache = insecure_rand_Rz; insecure_rand_Rw_cache = insecure_rand_Rw; } }; BOOST_AUTO_TEST_CASE(PrevectorTestInt) { for (int j = 0; j < 64; j++) { BOOST_TEST_MESSAGE("PrevectorTestInt " << j); prevector_tester<8, int> test; for (int i = 0; i < 2048; i++) { int r = insecure_rand(); if ((r % 4) == 0) { test.insert(insecure_rand() % (test.size() + 1), insecure_rand()); } if (test.size() > 0 && ((r >> 2) % 4) == 1) { test.erase(insecure_rand() % test.size()); } if (((r >> 4) % 8) == 2) { int new_size = std::max<int>(0, std::min<int>(30, test.size() + (insecure_rand() % 5) - 2)); test.resize(new_size); } if (((r >> 7) % 8) == 3) { test.insert(insecure_rand() % (test.size() + 1), 1 + (insecure_rand() % 2), insecure_rand()); } if (((r >> 10) % 8) == 4) { int del = std::min<int>(test.size(), 1 + (insecure_rand() % 2)); int beg = insecure_rand() % (test.size() + 1 - del); test.erase(beg, beg + del); } if (((r >> 13) % 16) == 5) { test.push_back(insecure_rand()); } if (test.size() > 0 && ((r >> 17) % 16) == 6) { test.pop_back(); } if (((r >> 21) % 32) == 7) { int values[4]; int num = 1 + (insecure_rand() % 4); for (int i = 0; i < num; i++) { values[i] = insecure_rand(); } test.insert_range(insecure_rand() % (test.size() + 1), values, values + num); } if (((r >> 26) % 32) == 8) { int del = std::min<int>(test.size(), 1 + (insecure_rand() % 4)); int beg = insecure_rand() % (test.size() + 1 - del); test.erase(beg, beg + del); } r = insecure_rand(); if (r % 32 == 9) { test.reserve(insecure_rand() % 32); } if ((r >> 5) % 64 == 10) { test.shrink_to_fit(); } if (test.size() > 0) { test.update(insecure_rand() % test.size(), insecure_rand()); } if (((r >> 11) % 1024) == 11) { test.clear(); } if (((r >> 21) % 512) == 12) { test.assign(insecure_rand() % 32, insecure_rand()); } if (((r >> 15) % 64) == 3) { test.swap(); } } } } BOOST_AUTO_TEST_SUITE_END()
[ "sdrtcoin@gmail.com" ]
sdrtcoin@gmail.com
faa9fc597dde3971162d8087795dde78ec6e984c
1b903ba3bb5ad938601539612fc1a0768946ab53
/ProyectoEngine/EngineDLL/Entity.h
ee6af7689cc65787c17aa673398a2f06e26a4b07
[]
no_license
Luciano94/EngineG3
648f6e384db1f9330aa44b6dad924098bc0d3793
e99c8a4d44c8d6fd6d0f952e39af3d0e14043de9
refs/heads/master
2020-05-04T03:37:31.344963
2019-04-02T01:08:41
2019-04-02T01:08:41
178,950,134
0
0
null
null
null
null
UTF-8
C++
false
false
859
h
#pragma once #include "Renderer.h" #include "Exports.h" #include "BoundingBox.h" class ENGINEDLL_API Entity { private: glm::vec3 pos; glm::vec3 rot; glm::vec3 scale; protected: Renderer * render; glm::mat4 WorldMatrix; glm::mat4 TranslateMatrix; glm::mat4 RotMatrix; glm::mat4 ScaleMatrix; void UpdateWorldMatrix(); BoundingBox * bBox; public: virtual void Draw() = 0; Entity(Renderer * renderPTR); ~Entity(); BoundingBox * getBoundingBox(); void SetPos(float x, float y, float z); void SetBoundingBox(float width, float heigth, bool isStatic, float bulk); void SetRot(float x, float y, float z); void SetScale(float x, float y, float z); void Translate(float x, float y, float z); void Rotate(float x, float y, float z); glm::vec3 GetPos(); glm::vec3 GetRot(); glm::vec3 GetScale(); };
[ "l" ]
l
ec2a2ac8a0cb00d32b41b5f46c639b21fcd34b21
3cf9e141cc8fee9d490224741297d3eca3f5feff
/C++ Benchmark Programs/Benchmark Files 1/classtester/autogen-sources/source-15783.cpp
ccd6b9e468ff7263d23c4fbd2e8f1ea71594095b
[]
no_license
TeamVault/tauCFI
e0ac60b8106fc1bb9874adc515fc01672b775123
e677d8cc7acd0b1dd0ac0212ff8362fcd4178c10
refs/heads/master
2023-05-30T20:57:13.450360
2021-06-14T09:10:24
2021-06-14T09:10:24
154,563,655
0
1
null
null
null
null
UTF-8
C++
false
false
2,929
cpp
struct c0; void __attribute__ ((noinline)) tester0(c0* p); struct c0 { bool active0; c0() : active0(true) {} virtual ~c0() { tester0(this); active0 = false; } virtual void f0(){} }; void __attribute__ ((noinline)) tester0(c0* p) { p->f0(); } struct c1; void __attribute__ ((noinline)) tester1(c1* p); struct c1 : virtual c0 { bool active1; c1() : active1(true) {} virtual ~c1() { tester1(this); c0 *p0_0 = (c0*)(c1*)(this); tester0(p0_0); active1 = false; } virtual void f1(){} }; void __attribute__ ((noinline)) tester1(c1* p) { p->f1(); if (p->active0) p->f0(); } struct c2; void __attribute__ ((noinline)) tester2(c2* p); struct c2 : virtual c0 { bool active2; c2() : active2(true) {} virtual ~c2() { tester2(this); c0 *p0_0 = (c0*)(c2*)(this); tester0(p0_0); active2 = false; } virtual void f2(){} }; void __attribute__ ((noinline)) tester2(c2* p) { p->f2(); if (p->active0) p->f0(); } struct c3; void __attribute__ ((noinline)) tester3(c3* p); struct c3 : c2 { bool active3; c3() : active3(true) {} virtual ~c3() { tester3(this); c0 *p0_0 = (c0*)(c2*)(c3*)(this); tester0(p0_0); c2 *p2_0 = (c2*)(c3*)(this); tester2(p2_0); active3 = false; } virtual void f3(){} }; void __attribute__ ((noinline)) tester3(c3* p) { p->f3(); if (p->active2) p->f2(); if (p->active0) p->f0(); } struct c4; void __attribute__ ((noinline)) tester4(c4* p); struct c4 : virtual c3, virtual c0, virtual c1 { bool active4; c4() : active4(true) {} virtual ~c4() { tester4(this); c0 *p0_0 = (c0*)(c2*)(c3*)(c4*)(this); tester0(p0_0); c0 *p0_1 = (c0*)(c4*)(this); tester0(p0_1); c0 *p0_2 = (c0*)(c1*)(c4*)(this); tester0(p0_2); c1 *p1_0 = (c1*)(c4*)(this); tester1(p1_0); c2 *p2_0 = (c2*)(c3*)(c4*)(this); tester2(p2_0); c3 *p3_0 = (c3*)(c4*)(this); tester3(p3_0); active4 = false; } virtual void f4(){} }; void __attribute__ ((noinline)) tester4(c4* p) { p->f4(); if (p->active2) p->f2(); if (p->active0) p->f0(); if (p->active1) p->f1(); if (p->active3) p->f3(); } int __attribute__ ((noinline)) inc(int v) {return ++v;} int main() { c0* ptrs0[25]; ptrs0[0] = (c0*)(new c0()); ptrs0[1] = (c0*)(c1*)(new c1()); ptrs0[2] = (c0*)(c2*)(new c2()); ptrs0[3] = (c0*)(c2*)(c3*)(new c3()); ptrs0[4] = (c0*)(c2*)(c3*)(c4*)(new c4()); ptrs0[5] = (c0*)(c4*)(new c4()); ptrs0[6] = (c0*)(c1*)(c4*)(new c4()); for (int i=0;i<7;i=inc(i)) { tester0(ptrs0[i]); delete ptrs0[i]; } c1* ptrs1[25]; ptrs1[0] = (c1*)(new c1()); ptrs1[1] = (c1*)(c4*)(new c4()); for (int i=0;i<2;i=inc(i)) { tester1(ptrs1[i]); delete ptrs1[i]; } c2* ptrs2[25]; ptrs2[0] = (c2*)(new c2()); ptrs2[1] = (c2*)(c3*)(new c3()); ptrs2[2] = (c2*)(c3*)(c4*)(new c4()); for (int i=0;i<3;i=inc(i)) { tester2(ptrs2[i]); delete ptrs2[i]; } c3* ptrs3[25]; ptrs3[0] = (c3*)(new c3()); ptrs3[1] = (c3*)(c4*)(new c4()); for (int i=0;i<2;i=inc(i)) { tester3(ptrs3[i]); delete ptrs3[i]; } c4* ptrs4[25]; ptrs4[0] = (c4*)(new c4()); for (int i=0;i<1;i=inc(i)) { tester4(ptrs4[i]); delete ptrs4[i]; } return 0; }
[ "ga72foq@mytum.de" ]
ga72foq@mytum.de
28681ea824c780a5a7bb5958fdfffaab05cb1709
228b25458e74199b18bfcdd0d1dc400e39e4a651
/old/2523/main.cpp
328924665c9d6cb1bd8d4207833f69b6fab92e78
[]
no_license
luxroot/baekjoon
9146f18ea345d6998e471439117516f2ea26f22c
ed40287fd53ae1f41d2958c68e6e04d498d528b9
refs/heads/master
2023-06-27T05:50:41.303356
2021-08-06T04:18:33
2021-08-06T04:18:33
111,078,357
1
0
null
null
null
null
UTF-8
C++
false
false
280
cpp
#include <iostream> using namespace std; int main() { int i,j,n; cin >> n; for(i=0;i<n-1;i++){ for(j=0;j<i+1;j++)cout << '*'; cout << endl; } for (;i>=0;i--){ for(j=0;j<i+1;j++)cout << '*'; cout << endl; } return 0; }
[ "shinmg2520@gmail.com" ]
shinmg2520@gmail.com
bd21bb8a16d648fc70e7db39841b9dc7693c2079
c776476e9d06b3779d744641e758ac3a2c15cddc
/examples/litmus/c/run-scripts/tmp_1/MP+dmb.sy+addr-[ws-rf]-addr-data-rfi.c.cbmc_out.cpp
65f8bd85f0017187df8b341a09335438070fac0d
[]
no_license
ashutosh0gupta/llvm_bmc
aaac7961c723ba6f7ffd77a39559e0e52432eade
0287c4fb180244e6b3c599a9902507f05c8a7234
refs/heads/master
2023-08-02T17:14:06.178723
2023-07-31T10:46:53
2023-07-31T10:46:53
143,100,825
3
4
null
2023-05-25T05:50:55
2018-08-01T03:47:00
C++
UTF-8
C++
false
false
56,284
cpp
// 0:vars:4 // 6:atom_1_X11_1:1 // 4:atom_1_X0_1:1 // 5:atom_1_X5_2:1 // 7:thr0:1 // 8:thr1:1 // 9:thr2:1 #define ADDRSIZE 10 #define NPROC 4 #define NCONTEXT 1 #define ASSUME(stmt) __CPROVER_assume(stmt) #define ASSERT(stmt) __CPROVER_assert(stmt, "error") #define max(a,b) (a>b?a:b) char __get_rng(); char get_rng( char from, char to ) { char ret = __get_rng(); ASSUME(ret >= from && ret <= to); return ret; } char get_rng_th( char from, char to ) { char ret = __get_rng(); ASSUME(ret >= from && ret <= to); return ret; } int main(int argc, char **argv) { // declare arrays for intial value version in contexts int meminit_[ADDRSIZE*NCONTEXT]; #define meminit(x,k) meminit_[(x)*NCONTEXT+k] int coinit_[ADDRSIZE*NCONTEXT]; #define coinit(x,k) coinit_[(x)*NCONTEXT+k] int deltainit_[ADDRSIZE*NCONTEXT]; #define deltainit(x,k) deltainit_[(x)*NCONTEXT+k] // declare arrays for running value version in contexts int mem_[ADDRSIZE*NCONTEXT]; #define mem(x,k) mem_[(x)*NCONTEXT+k] int co_[ADDRSIZE*NCONTEXT]; #define co(x,k) co_[(x)*NCONTEXT+k] int delta_[ADDRSIZE*NCONTEXT]; #define delta(x,k) delta_[(x)*NCONTEXT+k] // declare arrays for local buffer and observed writes int buff_[NPROC*ADDRSIZE]; #define buff(x,k) buff_[(x)*ADDRSIZE+k] int pw_[NPROC*ADDRSIZE]; #define pw(x,k) pw_[(x)*ADDRSIZE+k] // declare arrays for context stamps char cr_[NPROC*ADDRSIZE]; #define cr(x,k) cr_[(x)*ADDRSIZE+k] char iw_[NPROC*ADDRSIZE]; #define iw(x,k) iw_[(x)*ADDRSIZE+k] char cw_[NPROC*ADDRSIZE]; #define cw(x,k) cw_[(x)*ADDRSIZE+k] char cx_[NPROC*ADDRSIZE]; #define cx(x,k) cx_[(x)*ADDRSIZE+k] char is_[NPROC*ADDRSIZE]; #define is(x,k) is_[(x)*ADDRSIZE+k] char cs_[NPROC*ADDRSIZE]; #define cs(x,k) cs_[(x)*ADDRSIZE+k] char crmax_[NPROC*ADDRSIZE]; #define crmax(x,k) crmax_[(x)*ADDRSIZE+k] char sforbid_[ADDRSIZE*NCONTEXT]; #define sforbid(x,k) sforbid_[(x)*NCONTEXT+k] // declare arrays for synchronizations int cl[NPROC]; int cdy[NPROC]; int cds[NPROC]; int cdl[NPROC]; int cisb[NPROC]; int caddr[NPROC]; int cctrl[NPROC]; int cstart[NPROC]; int creturn[NPROC]; // declare arrays for contexts activity int active[NCONTEXT]; int ctx_used[NCONTEXT]; int r0= 0; char creg_r0; int r1= 0; char creg_r1; int r2= 0; char creg_r2; int r3= 0; char creg_r3; int r4= 0; char creg_r4; int r5= 0; char creg_r5; int r6= 0; char creg_r6; int r7= 0; char creg_r7; int r8= 0; char creg_r8; int r9= 0; char creg_r9; int r10= 0; char creg_r10; int r11= 0; char creg_r11; int r12= 0; char creg_r12; int r13= 0; char creg_r13; int r14= 0; char creg_r14; int r15= 0; char creg_r15; int r16= 0; char creg_r16; int r17= 0; char creg_r17; int r18= 0; char creg_r18; int r19= 0; char creg_r19; int r20= 0; char creg_r20; int r21= 0; char creg_r21; int r22= 0; char creg_r22; int r23= 0; char creg_r23; int r24= 0; char creg_r24; int r25= 0; char creg_r25; int r26= 0; char creg_r26; int r27= 0; char creg_r27; char old_cctrl= 0; char old_cr= 0; char old_cdy= 0; char old_cw= 0; char new_creg= 0; buff(0,0) = 0; pw(0,0) = 0; cr(0,0) = 0; iw(0,0) = 0; cw(0,0) = 0; cx(0,0) = 0; is(0,0) = 0; cs(0,0) = 0; crmax(0,0) = 0; buff(0,1) = 0; pw(0,1) = 0; cr(0,1) = 0; iw(0,1) = 0; cw(0,1) = 0; cx(0,1) = 0; is(0,1) = 0; cs(0,1) = 0; crmax(0,1) = 0; buff(0,2) = 0; pw(0,2) = 0; cr(0,2) = 0; iw(0,2) = 0; cw(0,2) = 0; cx(0,2) = 0; is(0,2) = 0; cs(0,2) = 0; crmax(0,2) = 0; buff(0,3) = 0; pw(0,3) = 0; cr(0,3) = 0; iw(0,3) = 0; cw(0,3) = 0; cx(0,3) = 0; is(0,3) = 0; cs(0,3) = 0; crmax(0,3) = 0; buff(0,4) = 0; pw(0,4) = 0; cr(0,4) = 0; iw(0,4) = 0; cw(0,4) = 0; cx(0,4) = 0; is(0,4) = 0; cs(0,4) = 0; crmax(0,4) = 0; buff(0,5) = 0; pw(0,5) = 0; cr(0,5) = 0; iw(0,5) = 0; cw(0,5) = 0; cx(0,5) = 0; is(0,5) = 0; cs(0,5) = 0; crmax(0,5) = 0; buff(0,6) = 0; pw(0,6) = 0; cr(0,6) = 0; iw(0,6) = 0; cw(0,6) = 0; cx(0,6) = 0; is(0,6) = 0; cs(0,6) = 0; crmax(0,6) = 0; buff(0,7) = 0; pw(0,7) = 0; cr(0,7) = 0; iw(0,7) = 0; cw(0,7) = 0; cx(0,7) = 0; is(0,7) = 0; cs(0,7) = 0; crmax(0,7) = 0; buff(0,8) = 0; pw(0,8) = 0; cr(0,8) = 0; iw(0,8) = 0; cw(0,8) = 0; cx(0,8) = 0; is(0,8) = 0; cs(0,8) = 0; crmax(0,8) = 0; buff(0,9) = 0; pw(0,9) = 0; cr(0,9) = 0; iw(0,9) = 0; cw(0,9) = 0; cx(0,9) = 0; is(0,9) = 0; cs(0,9) = 0; crmax(0,9) = 0; cl[0] = 0; cdy[0] = 0; cds[0] = 0; cdl[0] = 0; cisb[0] = 0; caddr[0] = 0; cctrl[0] = 0; cstart[0] = get_rng(0,NCONTEXT-1); creturn[0] = get_rng(0,NCONTEXT-1); buff(1,0) = 0; pw(1,0) = 0; cr(1,0) = 0; iw(1,0) = 0; cw(1,0) = 0; cx(1,0) = 0; is(1,0) = 0; cs(1,0) = 0; crmax(1,0) = 0; buff(1,1) = 0; pw(1,1) = 0; cr(1,1) = 0; iw(1,1) = 0; cw(1,1) = 0; cx(1,1) = 0; is(1,1) = 0; cs(1,1) = 0; crmax(1,1) = 0; buff(1,2) = 0; pw(1,2) = 0; cr(1,2) = 0; iw(1,2) = 0; cw(1,2) = 0; cx(1,2) = 0; is(1,2) = 0; cs(1,2) = 0; crmax(1,2) = 0; buff(1,3) = 0; pw(1,3) = 0; cr(1,3) = 0; iw(1,3) = 0; cw(1,3) = 0; cx(1,3) = 0; is(1,3) = 0; cs(1,3) = 0; crmax(1,3) = 0; buff(1,4) = 0; pw(1,4) = 0; cr(1,4) = 0; iw(1,4) = 0; cw(1,4) = 0; cx(1,4) = 0; is(1,4) = 0; cs(1,4) = 0; crmax(1,4) = 0; buff(1,5) = 0; pw(1,5) = 0; cr(1,5) = 0; iw(1,5) = 0; cw(1,5) = 0; cx(1,5) = 0; is(1,5) = 0; cs(1,5) = 0; crmax(1,5) = 0; buff(1,6) = 0; pw(1,6) = 0; cr(1,6) = 0; iw(1,6) = 0; cw(1,6) = 0; cx(1,6) = 0; is(1,6) = 0; cs(1,6) = 0; crmax(1,6) = 0; buff(1,7) = 0; pw(1,7) = 0; cr(1,7) = 0; iw(1,7) = 0; cw(1,7) = 0; cx(1,7) = 0; is(1,7) = 0; cs(1,7) = 0; crmax(1,7) = 0; buff(1,8) = 0; pw(1,8) = 0; cr(1,8) = 0; iw(1,8) = 0; cw(1,8) = 0; cx(1,8) = 0; is(1,8) = 0; cs(1,8) = 0; crmax(1,8) = 0; buff(1,9) = 0; pw(1,9) = 0; cr(1,9) = 0; iw(1,9) = 0; cw(1,9) = 0; cx(1,9) = 0; is(1,9) = 0; cs(1,9) = 0; crmax(1,9) = 0; cl[1] = 0; cdy[1] = 0; cds[1] = 0; cdl[1] = 0; cisb[1] = 0; caddr[1] = 0; cctrl[1] = 0; cstart[1] = get_rng(0,NCONTEXT-1); creturn[1] = get_rng(0,NCONTEXT-1); buff(2,0) = 0; pw(2,0) = 0; cr(2,0) = 0; iw(2,0) = 0; cw(2,0) = 0; cx(2,0) = 0; is(2,0) = 0; cs(2,0) = 0; crmax(2,0) = 0; buff(2,1) = 0; pw(2,1) = 0; cr(2,1) = 0; iw(2,1) = 0; cw(2,1) = 0; cx(2,1) = 0; is(2,1) = 0; cs(2,1) = 0; crmax(2,1) = 0; buff(2,2) = 0; pw(2,2) = 0; cr(2,2) = 0; iw(2,2) = 0; cw(2,2) = 0; cx(2,2) = 0; is(2,2) = 0; cs(2,2) = 0; crmax(2,2) = 0; buff(2,3) = 0; pw(2,3) = 0; cr(2,3) = 0; iw(2,3) = 0; cw(2,3) = 0; cx(2,3) = 0; is(2,3) = 0; cs(2,3) = 0; crmax(2,3) = 0; buff(2,4) = 0; pw(2,4) = 0; cr(2,4) = 0; iw(2,4) = 0; cw(2,4) = 0; cx(2,4) = 0; is(2,4) = 0; cs(2,4) = 0; crmax(2,4) = 0; buff(2,5) = 0; pw(2,5) = 0; cr(2,5) = 0; iw(2,5) = 0; cw(2,5) = 0; cx(2,5) = 0; is(2,5) = 0; cs(2,5) = 0; crmax(2,5) = 0; buff(2,6) = 0; pw(2,6) = 0; cr(2,6) = 0; iw(2,6) = 0; cw(2,6) = 0; cx(2,6) = 0; is(2,6) = 0; cs(2,6) = 0; crmax(2,6) = 0; buff(2,7) = 0; pw(2,7) = 0; cr(2,7) = 0; iw(2,7) = 0; cw(2,7) = 0; cx(2,7) = 0; is(2,7) = 0; cs(2,7) = 0; crmax(2,7) = 0; buff(2,8) = 0; pw(2,8) = 0; cr(2,8) = 0; iw(2,8) = 0; cw(2,8) = 0; cx(2,8) = 0; is(2,8) = 0; cs(2,8) = 0; crmax(2,8) = 0; buff(2,9) = 0; pw(2,9) = 0; cr(2,9) = 0; iw(2,9) = 0; cw(2,9) = 0; cx(2,9) = 0; is(2,9) = 0; cs(2,9) = 0; crmax(2,9) = 0; cl[2] = 0; cdy[2] = 0; cds[2] = 0; cdl[2] = 0; cisb[2] = 0; caddr[2] = 0; cctrl[2] = 0; cstart[2] = get_rng(0,NCONTEXT-1); creturn[2] = get_rng(0,NCONTEXT-1); buff(3,0) = 0; pw(3,0) = 0; cr(3,0) = 0; iw(3,0) = 0; cw(3,0) = 0; cx(3,0) = 0; is(3,0) = 0; cs(3,0) = 0; crmax(3,0) = 0; buff(3,1) = 0; pw(3,1) = 0; cr(3,1) = 0; iw(3,1) = 0; cw(3,1) = 0; cx(3,1) = 0; is(3,1) = 0; cs(3,1) = 0; crmax(3,1) = 0; buff(3,2) = 0; pw(3,2) = 0; cr(3,2) = 0; iw(3,2) = 0; cw(3,2) = 0; cx(3,2) = 0; is(3,2) = 0; cs(3,2) = 0; crmax(3,2) = 0; buff(3,3) = 0; pw(3,3) = 0; cr(3,3) = 0; iw(3,3) = 0; cw(3,3) = 0; cx(3,3) = 0; is(3,3) = 0; cs(3,3) = 0; crmax(3,3) = 0; buff(3,4) = 0; pw(3,4) = 0; cr(3,4) = 0; iw(3,4) = 0; cw(3,4) = 0; cx(3,4) = 0; is(3,4) = 0; cs(3,4) = 0; crmax(3,4) = 0; buff(3,5) = 0; pw(3,5) = 0; cr(3,5) = 0; iw(3,5) = 0; cw(3,5) = 0; cx(3,5) = 0; is(3,5) = 0; cs(3,5) = 0; crmax(3,5) = 0; buff(3,6) = 0; pw(3,6) = 0; cr(3,6) = 0; iw(3,6) = 0; cw(3,6) = 0; cx(3,6) = 0; is(3,6) = 0; cs(3,6) = 0; crmax(3,6) = 0; buff(3,7) = 0; pw(3,7) = 0; cr(3,7) = 0; iw(3,7) = 0; cw(3,7) = 0; cx(3,7) = 0; is(3,7) = 0; cs(3,7) = 0; crmax(3,7) = 0; buff(3,8) = 0; pw(3,8) = 0; cr(3,8) = 0; iw(3,8) = 0; cw(3,8) = 0; cx(3,8) = 0; is(3,8) = 0; cs(3,8) = 0; crmax(3,8) = 0; buff(3,9) = 0; pw(3,9) = 0; cr(3,9) = 0; iw(3,9) = 0; cw(3,9) = 0; cx(3,9) = 0; is(3,9) = 0; cs(3,9) = 0; crmax(3,9) = 0; cl[3] = 0; cdy[3] = 0; cds[3] = 0; cdl[3] = 0; cisb[3] = 0; caddr[3] = 0; cctrl[3] = 0; cstart[3] = get_rng(0,NCONTEXT-1); creturn[3] = get_rng(0,NCONTEXT-1); // Dumping initializations mem(0+0,0) = 0; mem(0+1,0) = 0; mem(0+2,0) = 0; mem(0+3,0) = 0; mem(6+0,0) = 0; mem(4+0,0) = 0; mem(5+0,0) = 0; mem(7+0,0) = 0; mem(8+0,0) = 0; mem(9+0,0) = 0; // Dumping context matching equalities co(0,0) = 0; delta(0,0) = -1; co(1,0) = 0; delta(1,0) = -1; co(2,0) = 0; delta(2,0) = -1; co(3,0) = 0; delta(3,0) = -1; co(4,0) = 0; delta(4,0) = -1; co(5,0) = 0; delta(5,0) = -1; co(6,0) = 0; delta(6,0) = -1; co(7,0) = 0; delta(7,0) = -1; co(8,0) = 0; delta(8,0) = -1; co(9,0) = 0; delta(9,0) = -1; // Dumping thread 1 int ret_thread_1 = 0; cdy[1] = get_rng(0,NCONTEXT-1); ASSUME(cdy[1] >= cstart[1]); T1BLOCK0: // call void @llvm.dbg.value(metadata i8* %arg, metadata !37, metadata !DIExpression()), !dbg !46 // br label %label_1, !dbg !47 goto T1BLOCK1; T1BLOCK1: // call void @llvm.dbg.label(metadata !45), !dbg !48 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 0), metadata !38, metadata !DIExpression()), !dbg !49 // call void @llvm.dbg.value(metadata i64 2, metadata !41, metadata !DIExpression()), !dbg !49 // store atomic i64 2, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !50 // ST: Guess iw(1,0) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STIW old_cw = cw(1,0); cw(1,0) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STCOM // Check ASSUME(active[iw(1,0)] == 1); ASSUME(active[cw(1,0)] == 1); ASSUME(sforbid(0,cw(1,0))== 0); ASSUME(iw(1,0) >= 0); ASSUME(iw(1,0) >= 0); ASSUME(cw(1,0) >= iw(1,0)); ASSUME(cw(1,0) >= old_cw); ASSUME(cw(1,0) >= cr(1,0)); ASSUME(cw(1,0) >= cl[1]); ASSUME(cw(1,0) >= cisb[1]); ASSUME(cw(1,0) >= cdy[1]); ASSUME(cw(1,0) >= cdl[1]); ASSUME(cw(1,0) >= cds[1]); ASSUME(cw(1,0) >= cctrl[1]); ASSUME(cw(1,0) >= caddr[1]); // Update caddr[1] = max(caddr[1],0); buff(1,0) = 2; mem(0,cw(1,0)) = 2; co(0,cw(1,0))+=1; delta(0,cw(1,0)) = -1; ASSUME(creturn[1] >= cw(1,0)); // call void (...) @dmbsy(), !dbg !51 // dumbsy: Guess old_cdy = cdy[1]; cdy[1] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[1] >= old_cdy); ASSUME(cdy[1] >= cisb[1]); ASSUME(cdy[1] >= cdl[1]); ASSUME(cdy[1] >= cds[1]); ASSUME(cdy[1] >= cctrl[1]); ASSUME(cdy[1] >= cw(1,0+0)); ASSUME(cdy[1] >= cw(1,0+1)); ASSUME(cdy[1] >= cw(1,0+2)); ASSUME(cdy[1] >= cw(1,0+3)); ASSUME(cdy[1] >= cw(1,6+0)); ASSUME(cdy[1] >= cw(1,4+0)); ASSUME(cdy[1] >= cw(1,5+0)); ASSUME(cdy[1] >= cw(1,7+0)); ASSUME(cdy[1] >= cw(1,8+0)); ASSUME(cdy[1] >= cw(1,9+0)); ASSUME(cdy[1] >= cr(1,0+0)); ASSUME(cdy[1] >= cr(1,0+1)); ASSUME(cdy[1] >= cr(1,0+2)); ASSUME(cdy[1] >= cr(1,0+3)); ASSUME(cdy[1] >= cr(1,6+0)); ASSUME(cdy[1] >= cr(1,4+0)); ASSUME(cdy[1] >= cr(1,5+0)); ASSUME(cdy[1] >= cr(1,7+0)); ASSUME(cdy[1] >= cr(1,8+0)); ASSUME(cdy[1] >= cr(1,9+0)); ASSUME(creturn[1] >= cdy[1]); // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 1), metadata !42, metadata !DIExpression()), !dbg !52 // call void @llvm.dbg.value(metadata i64 1, metadata !44, metadata !DIExpression()), !dbg !52 // store atomic i64 1, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !53 // ST: Guess iw(1,0+1*1) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STIW old_cw = cw(1,0+1*1); cw(1,0+1*1) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STCOM // Check ASSUME(active[iw(1,0+1*1)] == 1); ASSUME(active[cw(1,0+1*1)] == 1); ASSUME(sforbid(0+1*1,cw(1,0+1*1))== 0); ASSUME(iw(1,0+1*1) >= 0); ASSUME(iw(1,0+1*1) >= 0); ASSUME(cw(1,0+1*1) >= iw(1,0+1*1)); ASSUME(cw(1,0+1*1) >= old_cw); ASSUME(cw(1,0+1*1) >= cr(1,0+1*1)); ASSUME(cw(1,0+1*1) >= cl[1]); ASSUME(cw(1,0+1*1) >= cisb[1]); ASSUME(cw(1,0+1*1) >= cdy[1]); ASSUME(cw(1,0+1*1) >= cdl[1]); ASSUME(cw(1,0+1*1) >= cds[1]); ASSUME(cw(1,0+1*1) >= cctrl[1]); ASSUME(cw(1,0+1*1) >= caddr[1]); // Update caddr[1] = max(caddr[1],0); buff(1,0+1*1) = 1; mem(0+1*1,cw(1,0+1*1)) = 1; co(0+1*1,cw(1,0+1*1))+=1; delta(0+1*1,cw(1,0+1*1)) = -1; ASSUME(creturn[1] >= cw(1,0+1*1)); // ret i8* null, !dbg !54 ret_thread_1 = (- 1); // Dumping thread 2 int ret_thread_2 = 0; cdy[2] = get_rng(0,NCONTEXT-1); ASSUME(cdy[2] >= cstart[2]); T2BLOCK0: // call void @llvm.dbg.value(metadata i8* %arg, metadata !57, metadata !DIExpression()), !dbg !98 // br label %label_2, !dbg !80 goto T2BLOCK1; T2BLOCK1: // call void @llvm.dbg.label(metadata !97), !dbg !100 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 1), metadata !60, metadata !DIExpression()), !dbg !101 // %0 = load atomic i64, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !83 // LD: Guess old_cr = cr(2,0+1*1); cr(2,0+1*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM // Check ASSUME(active[cr(2,0+1*1)] == 2); ASSUME(cr(2,0+1*1) >= iw(2,0+1*1)); ASSUME(cr(2,0+1*1) >= 0); ASSUME(cr(2,0+1*1) >= cdy[2]); ASSUME(cr(2,0+1*1) >= cisb[2]); ASSUME(cr(2,0+1*1) >= cdl[2]); ASSUME(cr(2,0+1*1) >= cl[2]); // Update creg_r0 = cr(2,0+1*1); crmax(2,0+1*1) = max(crmax(2,0+1*1),cr(2,0+1*1)); caddr[2] = max(caddr[2],0); if(cr(2,0+1*1) < cw(2,0+1*1)) { r0 = buff(2,0+1*1); } else { if(pw(2,0+1*1) != co(0+1*1,cr(2,0+1*1))) { ASSUME(cr(2,0+1*1) >= old_cr); } pw(2,0+1*1) = co(0+1*1,cr(2,0+1*1)); r0 = mem(0+1*1,cr(2,0+1*1)); } ASSUME(creturn[2] >= cr(2,0+1*1)); // call void @llvm.dbg.value(metadata i64 %0, metadata !62, metadata !DIExpression()), !dbg !101 // %conv = trunc i64 %0 to i32, !dbg !84 // call void @llvm.dbg.value(metadata i32 %conv, metadata !58, metadata !DIExpression()), !dbg !98 // %xor = xor i32 %conv, %conv, !dbg !85 creg_r1 = max(creg_r0,creg_r0); ASSUME(active[creg_r1] == 2); r1 = r0 ^ r0; // call void @llvm.dbg.value(metadata i32 %xor, metadata !63, metadata !DIExpression()), !dbg !98 // %add = add nsw i32 2, %xor, !dbg !86 creg_r2 = max(0,creg_r1); ASSUME(active[creg_r2] == 2); r2 = 2 + r1; // %idxprom = sext i32 %add to i64, !dbg !86 // %arrayidx = getelementptr inbounds [4 x i64], [4 x i64]* @vars, i64 0, i64 %idxprom, !dbg !86 r3 = 0+r2*1; ASSUME(creg_r3 >= 0); ASSUME(creg_r3 >= creg_r2); ASSUME(active[creg_r3] == 2); // call void @llvm.dbg.value(metadata i64* %arrayidx, metadata !64, metadata !DIExpression()), !dbg !106 // call void @llvm.dbg.value(metadata i64 1, metadata !66, metadata !DIExpression()), !dbg !106 // store atomic i64 1, i64* %arrayidx monotonic, align 8, !dbg !86 // ST: Guess iw(2,r3) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW old_cw = cw(2,r3); cw(2,r3) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM // Check ASSUME(active[iw(2,r3)] == 2); ASSUME(active[cw(2,r3)] == 2); ASSUME(sforbid(r3,cw(2,r3))== 0); ASSUME(iw(2,r3) >= 0); ASSUME(iw(2,r3) >= creg_r3); ASSUME(cw(2,r3) >= iw(2,r3)); ASSUME(cw(2,r3) >= old_cw); ASSUME(cw(2,r3) >= cr(2,r3)); ASSUME(cw(2,r3) >= cl[2]); ASSUME(cw(2,r3) >= cisb[2]); ASSUME(cw(2,r3) >= cdy[2]); ASSUME(cw(2,r3) >= cdl[2]); ASSUME(cw(2,r3) >= cds[2]); ASSUME(cw(2,r3) >= cctrl[2]); ASSUME(cw(2,r3) >= caddr[2]); // Update caddr[2] = max(caddr[2],creg_r3); buff(2,r3) = 1; mem(r3,cw(2,r3)) = 1; co(r3,cw(2,r3))+=1; delta(r3,cw(2,r3)) = -1; ASSUME(creturn[2] >= cw(2,r3)); // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 2), metadata !68, metadata !DIExpression()), !dbg !107 // %1 = load atomic i64, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 2) monotonic, align 8, !dbg !89 // LD: Guess old_cr = cr(2,0+2*1); cr(2,0+2*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM // Check ASSUME(active[cr(2,0+2*1)] == 2); ASSUME(cr(2,0+2*1) >= iw(2,0+2*1)); ASSUME(cr(2,0+2*1) >= 0); ASSUME(cr(2,0+2*1) >= cdy[2]); ASSUME(cr(2,0+2*1) >= cisb[2]); ASSUME(cr(2,0+2*1) >= cdl[2]); ASSUME(cr(2,0+2*1) >= cl[2]); // Update creg_r4 = cr(2,0+2*1); crmax(2,0+2*1) = max(crmax(2,0+2*1),cr(2,0+2*1)); caddr[2] = max(caddr[2],0); if(cr(2,0+2*1) < cw(2,0+2*1)) { r4 = buff(2,0+2*1); } else { if(pw(2,0+2*1) != co(0+2*1,cr(2,0+2*1))) { ASSUME(cr(2,0+2*1) >= old_cr); } pw(2,0+2*1) = co(0+2*1,cr(2,0+2*1)); r4 = mem(0+2*1,cr(2,0+2*1)); } ASSUME(creturn[2] >= cr(2,0+2*1)); // call void @llvm.dbg.value(metadata i64 %1, metadata !70, metadata !DIExpression()), !dbg !107 // %conv4 = trunc i64 %1 to i32, !dbg !90 // call void @llvm.dbg.value(metadata i32 %conv4, metadata !67, metadata !DIExpression()), !dbg !98 // %xor5 = xor i32 %conv4, %conv4, !dbg !91 creg_r5 = max(creg_r4,creg_r4); ASSUME(active[creg_r5] == 2); r5 = r4 ^ r4; // call void @llvm.dbg.value(metadata i32 %xor5, metadata !71, metadata !DIExpression()), !dbg !98 // %add7 = add nsw i32 3, %xor5, !dbg !92 creg_r6 = max(0,creg_r5); ASSUME(active[creg_r6] == 2); r6 = 3 + r5; // %idxprom8 = sext i32 %add7 to i64, !dbg !92 // %arrayidx9 = getelementptr inbounds [4 x i64], [4 x i64]* @vars, i64 0, i64 %idxprom8, !dbg !92 r7 = 0+r6*1; ASSUME(creg_r7 >= 0); ASSUME(creg_r7 >= creg_r6); ASSUME(active[creg_r7] == 2); // call void @llvm.dbg.value(metadata i64* %arrayidx9, metadata !73, metadata !DIExpression()), !dbg !112 // %2 = load atomic i64, i64* %arrayidx9 monotonic, align 8, !dbg !92 // LD: Guess old_cr = cr(2,r7); cr(2,r7) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM // Check ASSUME(active[cr(2,r7)] == 2); ASSUME(cr(2,r7) >= iw(2,r7)); ASSUME(cr(2,r7) >= creg_r7); ASSUME(cr(2,r7) >= cdy[2]); ASSUME(cr(2,r7) >= cisb[2]); ASSUME(cr(2,r7) >= cdl[2]); ASSUME(cr(2,r7) >= cl[2]); // Update creg_r8 = cr(2,r7); crmax(2,r7) = max(crmax(2,r7),cr(2,r7)); caddr[2] = max(caddr[2],creg_r7); if(cr(2,r7) < cw(2,r7)) { r8 = buff(2,r7); } else { if(pw(2,r7) != co(r7,cr(2,r7))) { ASSUME(cr(2,r7) >= old_cr); } pw(2,r7) = co(r7,cr(2,r7)); r8 = mem(r7,cr(2,r7)); } ASSUME(creturn[2] >= cr(2,r7)); // call void @llvm.dbg.value(metadata i64 %2, metadata !75, metadata !DIExpression()), !dbg !112 // %conv12 = trunc i64 %2 to i32, !dbg !94 // call void @llvm.dbg.value(metadata i32 %conv12, metadata !72, metadata !DIExpression()), !dbg !98 // %xor13 = xor i32 %conv12, %conv12, !dbg !95 creg_r9 = max(creg_r8,creg_r8); ASSUME(active[creg_r9] == 2); r9 = r8 ^ r8; // call void @llvm.dbg.value(metadata i32 %xor13, metadata !76, metadata !DIExpression()), !dbg !98 // %add14 = add nsw i32 %xor13, 1, !dbg !96 creg_r10 = max(creg_r9,0); ASSUME(active[creg_r10] == 2); r10 = r9 + 1; // call void @llvm.dbg.value(metadata i32 %add14, metadata !77, metadata !DIExpression()), !dbg !98 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 0), metadata !78, metadata !DIExpression()), !dbg !116 // %conv17 = sext i32 %add14 to i64, !dbg !98 // call void @llvm.dbg.value(metadata i64 %conv17, metadata !80, metadata !DIExpression()), !dbg !116 // store atomic i64 %conv17, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !98 // ST: Guess iw(2,0) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW old_cw = cw(2,0); cw(2,0) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM // Check ASSUME(active[iw(2,0)] == 2); ASSUME(active[cw(2,0)] == 2); ASSUME(sforbid(0,cw(2,0))== 0); ASSUME(iw(2,0) >= creg_r10); ASSUME(iw(2,0) >= 0); ASSUME(cw(2,0) >= iw(2,0)); ASSUME(cw(2,0) >= old_cw); ASSUME(cw(2,0) >= cr(2,0)); ASSUME(cw(2,0) >= cl[2]); ASSUME(cw(2,0) >= cisb[2]); ASSUME(cw(2,0) >= cdy[2]); ASSUME(cw(2,0) >= cdl[2]); ASSUME(cw(2,0) >= cds[2]); ASSUME(cw(2,0) >= cctrl[2]); ASSUME(cw(2,0) >= caddr[2]); // Update caddr[2] = max(caddr[2],0); buff(2,0) = r10; mem(0,cw(2,0)) = r10; co(0,cw(2,0))+=1; delta(0,cw(2,0)) = -1; ASSUME(creturn[2] >= cw(2,0)); // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 0), metadata !82, metadata !DIExpression()), !dbg !118 // %3 = load atomic i64, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !100 // LD: Guess old_cr = cr(2,0); cr(2,0) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM // Check ASSUME(active[cr(2,0)] == 2); ASSUME(cr(2,0) >= iw(2,0)); ASSUME(cr(2,0) >= 0); ASSUME(cr(2,0) >= cdy[2]); ASSUME(cr(2,0) >= cisb[2]); ASSUME(cr(2,0) >= cdl[2]); ASSUME(cr(2,0) >= cl[2]); // Update creg_r11 = cr(2,0); crmax(2,0) = max(crmax(2,0),cr(2,0)); caddr[2] = max(caddr[2],0); if(cr(2,0) < cw(2,0)) { r11 = buff(2,0); } else { if(pw(2,0) != co(0,cr(2,0))) { ASSUME(cr(2,0) >= old_cr); } pw(2,0) = co(0,cr(2,0)); r11 = mem(0,cr(2,0)); } ASSUME(creturn[2] >= cr(2,0)); // call void @llvm.dbg.value(metadata i64 %3, metadata !84, metadata !DIExpression()), !dbg !118 // %conv21 = trunc i64 %3 to i32, !dbg !101 // call void @llvm.dbg.value(metadata i32 %conv21, metadata !81, metadata !DIExpression()), !dbg !98 // %cmp = icmp eq i32 %conv, 1, !dbg !102 // %conv22 = zext i1 %cmp to i32, !dbg !102 // call void @llvm.dbg.value(metadata i32 %conv22, metadata !85, metadata !DIExpression()), !dbg !98 // call void @llvm.dbg.value(metadata i64* @atom_1_X0_1, metadata !86, metadata !DIExpression()), !dbg !122 // %4 = zext i32 %conv22 to i64 // call void @llvm.dbg.value(metadata i64 %4, metadata !88, metadata !DIExpression()), !dbg !122 // store atomic i64 %4, i64* @atom_1_X0_1 seq_cst, align 8, !dbg !104 // ST: Guess iw(2,4) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW old_cw = cw(2,4); cw(2,4) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM // Check ASSUME(active[iw(2,4)] == 2); ASSUME(active[cw(2,4)] == 2); ASSUME(sforbid(4,cw(2,4))== 0); ASSUME(iw(2,4) >= max(creg_r0,0)); ASSUME(iw(2,4) >= 0); ASSUME(cw(2,4) >= iw(2,4)); ASSUME(cw(2,4) >= old_cw); ASSUME(cw(2,4) >= cr(2,4)); ASSUME(cw(2,4) >= cl[2]); ASSUME(cw(2,4) >= cisb[2]); ASSUME(cw(2,4) >= cdy[2]); ASSUME(cw(2,4) >= cdl[2]); ASSUME(cw(2,4) >= cds[2]); ASSUME(cw(2,4) >= cctrl[2]); ASSUME(cw(2,4) >= caddr[2]); // Update caddr[2] = max(caddr[2],0); buff(2,4) = (r0==1); mem(4,cw(2,4)) = (r0==1); co(4,cw(2,4))+=1; delta(4,cw(2,4)) = -1; ASSUME(creturn[2] >= cw(2,4)); // %cmp26 = icmp eq i32 %conv4, 2, !dbg !105 // %conv27 = zext i1 %cmp26 to i32, !dbg !105 // call void @llvm.dbg.value(metadata i32 %conv27, metadata !89, metadata !DIExpression()), !dbg !98 // call void @llvm.dbg.value(metadata i64* @atom_1_X5_2, metadata !90, metadata !DIExpression()), !dbg !125 // %5 = zext i32 %conv27 to i64 // call void @llvm.dbg.value(metadata i64 %5, metadata !92, metadata !DIExpression()), !dbg !125 // store atomic i64 %5, i64* @atom_1_X5_2 seq_cst, align 8, !dbg !107 // ST: Guess iw(2,5) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW old_cw = cw(2,5); cw(2,5) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM // Check ASSUME(active[iw(2,5)] == 2); ASSUME(active[cw(2,5)] == 2); ASSUME(sforbid(5,cw(2,5))== 0); ASSUME(iw(2,5) >= max(creg_r4,0)); ASSUME(iw(2,5) >= 0); ASSUME(cw(2,5) >= iw(2,5)); ASSUME(cw(2,5) >= old_cw); ASSUME(cw(2,5) >= cr(2,5)); ASSUME(cw(2,5) >= cl[2]); ASSUME(cw(2,5) >= cisb[2]); ASSUME(cw(2,5) >= cdy[2]); ASSUME(cw(2,5) >= cdl[2]); ASSUME(cw(2,5) >= cds[2]); ASSUME(cw(2,5) >= cctrl[2]); ASSUME(cw(2,5) >= caddr[2]); // Update caddr[2] = max(caddr[2],0); buff(2,5) = (r4==2); mem(5,cw(2,5)) = (r4==2); co(5,cw(2,5))+=1; delta(5,cw(2,5)) = -1; ASSUME(creturn[2] >= cw(2,5)); // %cmp31 = icmp eq i32 %conv21, 1, !dbg !108 // %conv32 = zext i1 %cmp31 to i32, !dbg !108 // call void @llvm.dbg.value(metadata i32 %conv32, metadata !93, metadata !DIExpression()), !dbg !98 // call void @llvm.dbg.value(metadata i64* @atom_1_X11_1, metadata !94, metadata !DIExpression()), !dbg !128 // %6 = zext i32 %conv32 to i64 // call void @llvm.dbg.value(metadata i64 %6, metadata !96, metadata !DIExpression()), !dbg !128 // store atomic i64 %6, i64* @atom_1_X11_1 seq_cst, align 8, !dbg !110 // ST: Guess iw(2,6) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW old_cw = cw(2,6); cw(2,6) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM // Check ASSUME(active[iw(2,6)] == 2); ASSUME(active[cw(2,6)] == 2); ASSUME(sforbid(6,cw(2,6))== 0); ASSUME(iw(2,6) >= max(creg_r11,0)); ASSUME(iw(2,6) >= 0); ASSUME(cw(2,6) >= iw(2,6)); ASSUME(cw(2,6) >= old_cw); ASSUME(cw(2,6) >= cr(2,6)); ASSUME(cw(2,6) >= cl[2]); ASSUME(cw(2,6) >= cisb[2]); ASSUME(cw(2,6) >= cdy[2]); ASSUME(cw(2,6) >= cdl[2]); ASSUME(cw(2,6) >= cds[2]); ASSUME(cw(2,6) >= cctrl[2]); ASSUME(cw(2,6) >= caddr[2]); // Update caddr[2] = max(caddr[2],0); buff(2,6) = (r11==1); mem(6,cw(2,6)) = (r11==1); co(6,cw(2,6))+=1; delta(6,cw(2,6)) = -1; ASSUME(creturn[2] >= cw(2,6)); // ret i8* null, !dbg !111 ret_thread_2 = (- 1); // Dumping thread 3 int ret_thread_3 = 0; cdy[3] = get_rng(0,NCONTEXT-1); ASSUME(cdy[3] >= cstart[3]); T3BLOCK0: // call void @llvm.dbg.value(metadata i8* %arg, metadata !133, metadata !DIExpression()), !dbg !138 // br label %label_3, !dbg !44 goto T3BLOCK1; T3BLOCK1: // call void @llvm.dbg.label(metadata !137), !dbg !140 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 2), metadata !134, metadata !DIExpression()), !dbg !141 // call void @llvm.dbg.value(metadata i64 2, metadata !136, metadata !DIExpression()), !dbg !141 // store atomic i64 2, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 2) monotonic, align 8, !dbg !47 // ST: Guess iw(3,0+2*1) = get_rng(0,NCONTEXT-1);// 3 ASSIGN STIW old_cw = cw(3,0+2*1); cw(3,0+2*1) = get_rng(0,NCONTEXT-1);// 3 ASSIGN STCOM // Check ASSUME(active[iw(3,0+2*1)] == 3); ASSUME(active[cw(3,0+2*1)] == 3); ASSUME(sforbid(0+2*1,cw(3,0+2*1))== 0); ASSUME(iw(3,0+2*1) >= 0); ASSUME(iw(3,0+2*1) >= 0); ASSUME(cw(3,0+2*1) >= iw(3,0+2*1)); ASSUME(cw(3,0+2*1) >= old_cw); ASSUME(cw(3,0+2*1) >= cr(3,0+2*1)); ASSUME(cw(3,0+2*1) >= cl[3]); ASSUME(cw(3,0+2*1) >= cisb[3]); ASSUME(cw(3,0+2*1) >= cdy[3]); ASSUME(cw(3,0+2*1) >= cdl[3]); ASSUME(cw(3,0+2*1) >= cds[3]); ASSUME(cw(3,0+2*1) >= cctrl[3]); ASSUME(cw(3,0+2*1) >= caddr[3]); // Update caddr[3] = max(caddr[3],0); buff(3,0+2*1) = 2; mem(0+2*1,cw(3,0+2*1)) = 2; co(0+2*1,cw(3,0+2*1))+=1; delta(0+2*1,cw(3,0+2*1)) = -1; ASSUME(creturn[3] >= cw(3,0+2*1)); // ret i8* null, !dbg !48 ret_thread_3 = (- 1); // Dumping thread 0 int ret_thread_0 = 0; cdy[0] = get_rng(0,NCONTEXT-1); ASSUME(cdy[0] >= cstart[0]); T0BLOCK0: // %thr0 = alloca i64, align 8 // %thr1 = alloca i64, align 8 // %thr2 = alloca i64, align 8 // call void @llvm.dbg.value(metadata i32 %argc, metadata !151, metadata !DIExpression()), !dbg !212 // call void @llvm.dbg.value(metadata i8** %argv, metadata !152, metadata !DIExpression()), !dbg !212 // %0 = bitcast i64* %thr0 to i8*, !dbg !104 // call void @llvm.lifetime.start.p0i8(i64 8, i8* %0) #7, !dbg !104 // call void @llvm.dbg.declare(metadata i64* %thr0, metadata !153, metadata !DIExpression()), !dbg !214 // %1 = bitcast i64* %thr1 to i8*, !dbg !106 // call void @llvm.lifetime.start.p0i8(i64 8, i8* %1) #7, !dbg !106 // call void @llvm.dbg.declare(metadata i64* %thr1, metadata !157, metadata !DIExpression()), !dbg !216 // %2 = bitcast i64* %thr2 to i8*, !dbg !108 // call void @llvm.lifetime.start.p0i8(i64 8, i8* %2) #7, !dbg !108 // call void @llvm.dbg.declare(metadata i64* %thr2, metadata !158, metadata !DIExpression()), !dbg !218 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 3), metadata !159, metadata !DIExpression()), !dbg !219 // call void @llvm.dbg.value(metadata i64 0, metadata !161, metadata !DIExpression()), !dbg !219 // store atomic i64 0, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 3) monotonic, align 8, !dbg !111 // ST: Guess iw(0,0+3*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW old_cw = cw(0,0+3*1); cw(0,0+3*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM // Check ASSUME(active[iw(0,0+3*1)] == 0); ASSUME(active[cw(0,0+3*1)] == 0); ASSUME(sforbid(0+3*1,cw(0,0+3*1))== 0); ASSUME(iw(0,0+3*1) >= 0); ASSUME(iw(0,0+3*1) >= 0); ASSUME(cw(0,0+3*1) >= iw(0,0+3*1)); ASSUME(cw(0,0+3*1) >= old_cw); ASSUME(cw(0,0+3*1) >= cr(0,0+3*1)); ASSUME(cw(0,0+3*1) >= cl[0]); ASSUME(cw(0,0+3*1) >= cisb[0]); ASSUME(cw(0,0+3*1) >= cdy[0]); ASSUME(cw(0,0+3*1) >= cdl[0]); ASSUME(cw(0,0+3*1) >= cds[0]); ASSUME(cw(0,0+3*1) >= cctrl[0]); ASSUME(cw(0,0+3*1) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,0+3*1) = 0; mem(0+3*1,cw(0,0+3*1)) = 0; co(0+3*1,cw(0,0+3*1))+=1; delta(0+3*1,cw(0,0+3*1)) = -1; ASSUME(creturn[0] >= cw(0,0+3*1)); // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 2), metadata !162, metadata !DIExpression()), !dbg !221 // call void @llvm.dbg.value(metadata i64 0, metadata !164, metadata !DIExpression()), !dbg !221 // store atomic i64 0, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 2) monotonic, align 8, !dbg !113 // ST: Guess iw(0,0+2*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW old_cw = cw(0,0+2*1); cw(0,0+2*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM // Check ASSUME(active[iw(0,0+2*1)] == 0); ASSUME(active[cw(0,0+2*1)] == 0); ASSUME(sforbid(0+2*1,cw(0,0+2*1))== 0); ASSUME(iw(0,0+2*1) >= 0); ASSUME(iw(0,0+2*1) >= 0); ASSUME(cw(0,0+2*1) >= iw(0,0+2*1)); ASSUME(cw(0,0+2*1) >= old_cw); ASSUME(cw(0,0+2*1) >= cr(0,0+2*1)); ASSUME(cw(0,0+2*1) >= cl[0]); ASSUME(cw(0,0+2*1) >= cisb[0]); ASSUME(cw(0,0+2*1) >= cdy[0]); ASSUME(cw(0,0+2*1) >= cdl[0]); ASSUME(cw(0,0+2*1) >= cds[0]); ASSUME(cw(0,0+2*1) >= cctrl[0]); ASSUME(cw(0,0+2*1) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,0+2*1) = 0; mem(0+2*1,cw(0,0+2*1)) = 0; co(0+2*1,cw(0,0+2*1))+=1; delta(0+2*1,cw(0,0+2*1)) = -1; ASSUME(creturn[0] >= cw(0,0+2*1)); // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 1), metadata !165, metadata !DIExpression()), !dbg !223 // call void @llvm.dbg.value(metadata i64 0, metadata !167, metadata !DIExpression()), !dbg !223 // store atomic i64 0, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !115 // ST: Guess iw(0,0+1*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW old_cw = cw(0,0+1*1); cw(0,0+1*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM // Check ASSUME(active[iw(0,0+1*1)] == 0); ASSUME(active[cw(0,0+1*1)] == 0); ASSUME(sforbid(0+1*1,cw(0,0+1*1))== 0); ASSUME(iw(0,0+1*1) >= 0); ASSUME(iw(0,0+1*1) >= 0); ASSUME(cw(0,0+1*1) >= iw(0,0+1*1)); ASSUME(cw(0,0+1*1) >= old_cw); ASSUME(cw(0,0+1*1) >= cr(0,0+1*1)); ASSUME(cw(0,0+1*1) >= cl[0]); ASSUME(cw(0,0+1*1) >= cisb[0]); ASSUME(cw(0,0+1*1) >= cdy[0]); ASSUME(cw(0,0+1*1) >= cdl[0]); ASSUME(cw(0,0+1*1) >= cds[0]); ASSUME(cw(0,0+1*1) >= cctrl[0]); ASSUME(cw(0,0+1*1) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,0+1*1) = 0; mem(0+1*1,cw(0,0+1*1)) = 0; co(0+1*1,cw(0,0+1*1))+=1; delta(0+1*1,cw(0,0+1*1)) = -1; ASSUME(creturn[0] >= cw(0,0+1*1)); // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 0), metadata !168, metadata !DIExpression()), !dbg !225 // call void @llvm.dbg.value(metadata i64 0, metadata !170, metadata !DIExpression()), !dbg !225 // store atomic i64 0, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !117 // ST: Guess iw(0,0) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW old_cw = cw(0,0); cw(0,0) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM // Check ASSUME(active[iw(0,0)] == 0); ASSUME(active[cw(0,0)] == 0); ASSUME(sforbid(0,cw(0,0))== 0); ASSUME(iw(0,0) >= 0); ASSUME(iw(0,0) >= 0); ASSUME(cw(0,0) >= iw(0,0)); ASSUME(cw(0,0) >= old_cw); ASSUME(cw(0,0) >= cr(0,0)); ASSUME(cw(0,0) >= cl[0]); ASSUME(cw(0,0) >= cisb[0]); ASSUME(cw(0,0) >= cdy[0]); ASSUME(cw(0,0) >= cdl[0]); ASSUME(cw(0,0) >= cds[0]); ASSUME(cw(0,0) >= cctrl[0]); ASSUME(cw(0,0) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,0) = 0; mem(0,cw(0,0)) = 0; co(0,cw(0,0))+=1; delta(0,cw(0,0)) = -1; ASSUME(creturn[0] >= cw(0,0)); // call void @llvm.dbg.value(metadata i64* @atom_1_X0_1, metadata !171, metadata !DIExpression()), !dbg !227 // call void @llvm.dbg.value(metadata i64 0, metadata !173, metadata !DIExpression()), !dbg !227 // store atomic i64 0, i64* @atom_1_X0_1 monotonic, align 8, !dbg !119 // ST: Guess iw(0,4) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW old_cw = cw(0,4); cw(0,4) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM // Check ASSUME(active[iw(0,4)] == 0); ASSUME(active[cw(0,4)] == 0); ASSUME(sforbid(4,cw(0,4))== 0); ASSUME(iw(0,4) >= 0); ASSUME(iw(0,4) >= 0); ASSUME(cw(0,4) >= iw(0,4)); ASSUME(cw(0,4) >= old_cw); ASSUME(cw(0,4) >= cr(0,4)); ASSUME(cw(0,4) >= cl[0]); ASSUME(cw(0,4) >= cisb[0]); ASSUME(cw(0,4) >= cdy[0]); ASSUME(cw(0,4) >= cdl[0]); ASSUME(cw(0,4) >= cds[0]); ASSUME(cw(0,4) >= cctrl[0]); ASSUME(cw(0,4) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,4) = 0; mem(4,cw(0,4)) = 0; co(4,cw(0,4))+=1; delta(4,cw(0,4)) = -1; ASSUME(creturn[0] >= cw(0,4)); // call void @llvm.dbg.value(metadata i64* @atom_1_X5_2, metadata !174, metadata !DIExpression()), !dbg !229 // call void @llvm.dbg.value(metadata i64 0, metadata !176, metadata !DIExpression()), !dbg !229 // store atomic i64 0, i64* @atom_1_X5_2 monotonic, align 8, !dbg !121 // ST: Guess iw(0,5) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW old_cw = cw(0,5); cw(0,5) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM // Check ASSUME(active[iw(0,5)] == 0); ASSUME(active[cw(0,5)] == 0); ASSUME(sforbid(5,cw(0,5))== 0); ASSUME(iw(0,5) >= 0); ASSUME(iw(0,5) >= 0); ASSUME(cw(0,5) >= iw(0,5)); ASSUME(cw(0,5) >= old_cw); ASSUME(cw(0,5) >= cr(0,5)); ASSUME(cw(0,5) >= cl[0]); ASSUME(cw(0,5) >= cisb[0]); ASSUME(cw(0,5) >= cdy[0]); ASSUME(cw(0,5) >= cdl[0]); ASSUME(cw(0,5) >= cds[0]); ASSUME(cw(0,5) >= cctrl[0]); ASSUME(cw(0,5) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,5) = 0; mem(5,cw(0,5)) = 0; co(5,cw(0,5))+=1; delta(5,cw(0,5)) = -1; ASSUME(creturn[0] >= cw(0,5)); // call void @llvm.dbg.value(metadata i64* @atom_1_X11_1, metadata !177, metadata !DIExpression()), !dbg !231 // call void @llvm.dbg.value(metadata i64 0, metadata !179, metadata !DIExpression()), !dbg !231 // store atomic i64 0, i64* @atom_1_X11_1 monotonic, align 8, !dbg !123 // ST: Guess iw(0,6) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW old_cw = cw(0,6); cw(0,6) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM // Check ASSUME(active[iw(0,6)] == 0); ASSUME(active[cw(0,6)] == 0); ASSUME(sforbid(6,cw(0,6))== 0); ASSUME(iw(0,6) >= 0); ASSUME(iw(0,6) >= 0); ASSUME(cw(0,6) >= iw(0,6)); ASSUME(cw(0,6) >= old_cw); ASSUME(cw(0,6) >= cr(0,6)); ASSUME(cw(0,6) >= cl[0]); ASSUME(cw(0,6) >= cisb[0]); ASSUME(cw(0,6) >= cdy[0]); ASSUME(cw(0,6) >= cdl[0]); ASSUME(cw(0,6) >= cds[0]); ASSUME(cw(0,6) >= cctrl[0]); ASSUME(cw(0,6) >= caddr[0]); // Update caddr[0] = max(caddr[0],0); buff(0,6) = 0; mem(6,cw(0,6)) = 0; co(6,cw(0,6))+=1; delta(6,cw(0,6)) = -1; ASSUME(creturn[0] >= cw(0,6)); // %call = call i32 @pthread_create(i64* noundef %thr0, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @t0, i8* noundef null) #7, !dbg !124 // dumbsy: Guess old_cdy = cdy[0]; cdy[0] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[0] >= old_cdy); ASSUME(cdy[0] >= cisb[0]); ASSUME(cdy[0] >= cdl[0]); ASSUME(cdy[0] >= cds[0]); ASSUME(cdy[0] >= cctrl[0]); ASSUME(cdy[0] >= cw(0,0+0)); ASSUME(cdy[0] >= cw(0,0+1)); ASSUME(cdy[0] >= cw(0,0+2)); ASSUME(cdy[0] >= cw(0,0+3)); ASSUME(cdy[0] >= cw(0,6+0)); ASSUME(cdy[0] >= cw(0,4+0)); ASSUME(cdy[0] >= cw(0,5+0)); ASSUME(cdy[0] >= cw(0,7+0)); ASSUME(cdy[0] >= cw(0,8+0)); ASSUME(cdy[0] >= cw(0,9+0)); ASSUME(cdy[0] >= cr(0,0+0)); ASSUME(cdy[0] >= cr(0,0+1)); ASSUME(cdy[0] >= cr(0,0+2)); ASSUME(cdy[0] >= cr(0,0+3)); ASSUME(cdy[0] >= cr(0,6+0)); ASSUME(cdy[0] >= cr(0,4+0)); ASSUME(cdy[0] >= cr(0,5+0)); ASSUME(cdy[0] >= cr(0,7+0)); ASSUME(cdy[0] >= cr(0,8+0)); ASSUME(cdy[0] >= cr(0,9+0)); ASSUME(creturn[0] >= cdy[0]); ASSUME(cstart[1] >= cdy[0]); // %call13 = call i32 @pthread_create(i64* noundef %thr1, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @t1, i8* noundef null) #7, !dbg !125 // dumbsy: Guess old_cdy = cdy[0]; cdy[0] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[0] >= old_cdy); ASSUME(cdy[0] >= cisb[0]); ASSUME(cdy[0] >= cdl[0]); ASSUME(cdy[0] >= cds[0]); ASSUME(cdy[0] >= cctrl[0]); ASSUME(cdy[0] >= cw(0,0+0)); ASSUME(cdy[0] >= cw(0,0+1)); ASSUME(cdy[0] >= cw(0,0+2)); ASSUME(cdy[0] >= cw(0,0+3)); ASSUME(cdy[0] >= cw(0,6+0)); ASSUME(cdy[0] >= cw(0,4+0)); ASSUME(cdy[0] >= cw(0,5+0)); ASSUME(cdy[0] >= cw(0,7+0)); ASSUME(cdy[0] >= cw(0,8+0)); ASSUME(cdy[0] >= cw(0,9+0)); ASSUME(cdy[0] >= cr(0,0+0)); ASSUME(cdy[0] >= cr(0,0+1)); ASSUME(cdy[0] >= cr(0,0+2)); ASSUME(cdy[0] >= cr(0,0+3)); ASSUME(cdy[0] >= cr(0,6+0)); ASSUME(cdy[0] >= cr(0,4+0)); ASSUME(cdy[0] >= cr(0,5+0)); ASSUME(cdy[0] >= cr(0,7+0)); ASSUME(cdy[0] >= cr(0,8+0)); ASSUME(cdy[0] >= cr(0,9+0)); ASSUME(creturn[0] >= cdy[0]); ASSUME(cstart[2] >= cdy[0]); // %call14 = call i32 @pthread_create(i64* noundef %thr2, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @t2, i8* noundef null) #7, !dbg !126 // dumbsy: Guess old_cdy = cdy[0]; cdy[0] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[0] >= old_cdy); ASSUME(cdy[0] >= cisb[0]); ASSUME(cdy[0] >= cdl[0]); ASSUME(cdy[0] >= cds[0]); ASSUME(cdy[0] >= cctrl[0]); ASSUME(cdy[0] >= cw(0,0+0)); ASSUME(cdy[0] >= cw(0,0+1)); ASSUME(cdy[0] >= cw(0,0+2)); ASSUME(cdy[0] >= cw(0,0+3)); ASSUME(cdy[0] >= cw(0,6+0)); ASSUME(cdy[0] >= cw(0,4+0)); ASSUME(cdy[0] >= cw(0,5+0)); ASSUME(cdy[0] >= cw(0,7+0)); ASSUME(cdy[0] >= cw(0,8+0)); ASSUME(cdy[0] >= cw(0,9+0)); ASSUME(cdy[0] >= cr(0,0+0)); ASSUME(cdy[0] >= cr(0,0+1)); ASSUME(cdy[0] >= cr(0,0+2)); ASSUME(cdy[0] >= cr(0,0+3)); ASSUME(cdy[0] >= cr(0,6+0)); ASSUME(cdy[0] >= cr(0,4+0)); ASSUME(cdy[0] >= cr(0,5+0)); ASSUME(cdy[0] >= cr(0,7+0)); ASSUME(cdy[0] >= cr(0,8+0)); ASSUME(cdy[0] >= cr(0,9+0)); ASSUME(creturn[0] >= cdy[0]); ASSUME(cstart[3] >= cdy[0]); // %3 = load i64, i64* %thr0, align 8, !dbg !127, !tbaa !128 // LD: Guess old_cr = cr(0,7); cr(0,7) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM // Check ASSUME(active[cr(0,7)] == 0); ASSUME(cr(0,7) >= iw(0,7)); ASSUME(cr(0,7) >= 0); ASSUME(cr(0,7) >= cdy[0]); ASSUME(cr(0,7) >= cisb[0]); ASSUME(cr(0,7) >= cdl[0]); ASSUME(cr(0,7) >= cl[0]); // Update creg_r13 = cr(0,7); crmax(0,7) = max(crmax(0,7),cr(0,7)); caddr[0] = max(caddr[0],0); if(cr(0,7) < cw(0,7)) { r13 = buff(0,7); } else { if(pw(0,7) != co(7,cr(0,7))) { ASSUME(cr(0,7) >= old_cr); } pw(0,7) = co(7,cr(0,7)); r13 = mem(7,cr(0,7)); } ASSUME(creturn[0] >= cr(0,7)); // %call15 = call i32 @pthread_join(i64 noundef %3, i8** noundef null), !dbg !132 // dumbsy: Guess old_cdy = cdy[0]; cdy[0] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[0] >= old_cdy); ASSUME(cdy[0] >= cisb[0]); ASSUME(cdy[0] >= cdl[0]); ASSUME(cdy[0] >= cds[0]); ASSUME(cdy[0] >= cctrl[0]); ASSUME(cdy[0] >= cw(0,0+0)); ASSUME(cdy[0] >= cw(0,0+1)); ASSUME(cdy[0] >= cw(0,0+2)); ASSUME(cdy[0] >= cw(0,0+3)); ASSUME(cdy[0] >= cw(0,6+0)); ASSUME(cdy[0] >= cw(0,4+0)); ASSUME(cdy[0] >= cw(0,5+0)); ASSUME(cdy[0] >= cw(0,7+0)); ASSUME(cdy[0] >= cw(0,8+0)); ASSUME(cdy[0] >= cw(0,9+0)); ASSUME(cdy[0] >= cr(0,0+0)); ASSUME(cdy[0] >= cr(0,0+1)); ASSUME(cdy[0] >= cr(0,0+2)); ASSUME(cdy[0] >= cr(0,0+3)); ASSUME(cdy[0] >= cr(0,6+0)); ASSUME(cdy[0] >= cr(0,4+0)); ASSUME(cdy[0] >= cr(0,5+0)); ASSUME(cdy[0] >= cr(0,7+0)); ASSUME(cdy[0] >= cr(0,8+0)); ASSUME(cdy[0] >= cr(0,9+0)); ASSUME(creturn[0] >= cdy[0]); ASSUME(cdy[0] >= creturn[1]); // %4 = load i64, i64* %thr1, align 8, !dbg !133, !tbaa !128 // LD: Guess old_cr = cr(0,8); cr(0,8) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM // Check ASSUME(active[cr(0,8)] == 0); ASSUME(cr(0,8) >= iw(0,8)); ASSUME(cr(0,8) >= 0); ASSUME(cr(0,8) >= cdy[0]); ASSUME(cr(0,8) >= cisb[0]); ASSUME(cr(0,8) >= cdl[0]); ASSUME(cr(0,8) >= cl[0]); // Update creg_r14 = cr(0,8); crmax(0,8) = max(crmax(0,8),cr(0,8)); caddr[0] = max(caddr[0],0); if(cr(0,8) < cw(0,8)) { r14 = buff(0,8); } else { if(pw(0,8) != co(8,cr(0,8))) { ASSUME(cr(0,8) >= old_cr); } pw(0,8) = co(8,cr(0,8)); r14 = mem(8,cr(0,8)); } ASSUME(creturn[0] >= cr(0,8)); // %call16 = call i32 @pthread_join(i64 noundef %4, i8** noundef null), !dbg !134 // dumbsy: Guess old_cdy = cdy[0]; cdy[0] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[0] >= old_cdy); ASSUME(cdy[0] >= cisb[0]); ASSUME(cdy[0] >= cdl[0]); ASSUME(cdy[0] >= cds[0]); ASSUME(cdy[0] >= cctrl[0]); ASSUME(cdy[0] >= cw(0,0+0)); ASSUME(cdy[0] >= cw(0,0+1)); ASSUME(cdy[0] >= cw(0,0+2)); ASSUME(cdy[0] >= cw(0,0+3)); ASSUME(cdy[0] >= cw(0,6+0)); ASSUME(cdy[0] >= cw(0,4+0)); ASSUME(cdy[0] >= cw(0,5+0)); ASSUME(cdy[0] >= cw(0,7+0)); ASSUME(cdy[0] >= cw(0,8+0)); ASSUME(cdy[0] >= cw(0,9+0)); ASSUME(cdy[0] >= cr(0,0+0)); ASSUME(cdy[0] >= cr(0,0+1)); ASSUME(cdy[0] >= cr(0,0+2)); ASSUME(cdy[0] >= cr(0,0+3)); ASSUME(cdy[0] >= cr(0,6+0)); ASSUME(cdy[0] >= cr(0,4+0)); ASSUME(cdy[0] >= cr(0,5+0)); ASSUME(cdy[0] >= cr(0,7+0)); ASSUME(cdy[0] >= cr(0,8+0)); ASSUME(cdy[0] >= cr(0,9+0)); ASSUME(creturn[0] >= cdy[0]); ASSUME(cdy[0] >= creturn[2]); // %5 = load i64, i64* %thr2, align 8, !dbg !135, !tbaa !128 // LD: Guess old_cr = cr(0,9); cr(0,9) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM // Check ASSUME(active[cr(0,9)] == 0); ASSUME(cr(0,9) >= iw(0,9)); ASSUME(cr(0,9) >= 0); ASSUME(cr(0,9) >= cdy[0]); ASSUME(cr(0,9) >= cisb[0]); ASSUME(cr(0,9) >= cdl[0]); ASSUME(cr(0,9) >= cl[0]); // Update creg_r15 = cr(0,9); crmax(0,9) = max(crmax(0,9),cr(0,9)); caddr[0] = max(caddr[0],0); if(cr(0,9) < cw(0,9)) { r15 = buff(0,9); } else { if(pw(0,9) != co(9,cr(0,9))) { ASSUME(cr(0,9) >= old_cr); } pw(0,9) = co(9,cr(0,9)); r15 = mem(9,cr(0,9)); } ASSUME(creturn[0] >= cr(0,9)); // %call17 = call i32 @pthread_join(i64 noundef %5, i8** noundef null), !dbg !136 // dumbsy: Guess old_cdy = cdy[0]; cdy[0] = get_rng(0,NCONTEXT-1); // Check ASSUME(cdy[0] >= old_cdy); ASSUME(cdy[0] >= cisb[0]); ASSUME(cdy[0] >= cdl[0]); ASSUME(cdy[0] >= cds[0]); ASSUME(cdy[0] >= cctrl[0]); ASSUME(cdy[0] >= cw(0,0+0)); ASSUME(cdy[0] >= cw(0,0+1)); ASSUME(cdy[0] >= cw(0,0+2)); ASSUME(cdy[0] >= cw(0,0+3)); ASSUME(cdy[0] >= cw(0,6+0)); ASSUME(cdy[0] >= cw(0,4+0)); ASSUME(cdy[0] >= cw(0,5+0)); ASSUME(cdy[0] >= cw(0,7+0)); ASSUME(cdy[0] >= cw(0,8+0)); ASSUME(cdy[0] >= cw(0,9+0)); ASSUME(cdy[0] >= cr(0,0+0)); ASSUME(cdy[0] >= cr(0,0+1)); ASSUME(cdy[0] >= cr(0,0+2)); ASSUME(cdy[0] >= cr(0,0+3)); ASSUME(cdy[0] >= cr(0,6+0)); ASSUME(cdy[0] >= cr(0,4+0)); ASSUME(cdy[0] >= cr(0,5+0)); ASSUME(cdy[0] >= cr(0,7+0)); ASSUME(cdy[0] >= cr(0,8+0)); ASSUME(cdy[0] >= cr(0,9+0)); ASSUME(creturn[0] >= cdy[0]); ASSUME(cdy[0] >= creturn[3]); // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 0), metadata !181, metadata !DIExpression()), !dbg !246 // %6 = load atomic i64, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 0) seq_cst, align 8, !dbg !138 // LD: Guess old_cr = cr(0,0); cr(0,0) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM // Check ASSUME(active[cr(0,0)] == 0); ASSUME(cr(0,0) >= iw(0,0)); ASSUME(cr(0,0) >= 0); ASSUME(cr(0,0) >= cdy[0]); ASSUME(cr(0,0) >= cisb[0]); ASSUME(cr(0,0) >= cdl[0]); ASSUME(cr(0,0) >= cl[0]); // Update creg_r16 = cr(0,0); crmax(0,0) = max(crmax(0,0),cr(0,0)); caddr[0] = max(caddr[0],0); if(cr(0,0) < cw(0,0)) { r16 = buff(0,0); } else { if(pw(0,0) != co(0,cr(0,0))) { ASSUME(cr(0,0) >= old_cr); } pw(0,0) = co(0,cr(0,0)); r16 = mem(0,cr(0,0)); } ASSUME(creturn[0] >= cr(0,0)); // call void @llvm.dbg.value(metadata i64 %6, metadata !183, metadata !DIExpression()), !dbg !246 // %conv = trunc i64 %6 to i32, !dbg !139 // call void @llvm.dbg.value(metadata i32 %conv, metadata !180, metadata !DIExpression()), !dbg !212 // %cmp = icmp eq i32 %conv, 2, !dbg !140 // %conv18 = zext i1 %cmp to i32, !dbg !140 // call void @llvm.dbg.value(metadata i32 %conv18, metadata !184, metadata !DIExpression()), !dbg !212 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 1), metadata !186, metadata !DIExpression()), !dbg !250 // %7 = load atomic i64, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 1) seq_cst, align 8, !dbg !142 // LD: Guess old_cr = cr(0,0+1*1); cr(0,0+1*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM // Check ASSUME(active[cr(0,0+1*1)] == 0); ASSUME(cr(0,0+1*1) >= iw(0,0+1*1)); ASSUME(cr(0,0+1*1) >= 0); ASSUME(cr(0,0+1*1) >= cdy[0]); ASSUME(cr(0,0+1*1) >= cisb[0]); ASSUME(cr(0,0+1*1) >= cdl[0]); ASSUME(cr(0,0+1*1) >= cl[0]); // Update creg_r17 = cr(0,0+1*1); crmax(0,0+1*1) = max(crmax(0,0+1*1),cr(0,0+1*1)); caddr[0] = max(caddr[0],0); if(cr(0,0+1*1) < cw(0,0+1*1)) { r17 = buff(0,0+1*1); } else { if(pw(0,0+1*1) != co(0+1*1,cr(0,0+1*1))) { ASSUME(cr(0,0+1*1) >= old_cr); } pw(0,0+1*1) = co(0+1*1,cr(0,0+1*1)); r17 = mem(0+1*1,cr(0,0+1*1)); } ASSUME(creturn[0] >= cr(0,0+1*1)); // call void @llvm.dbg.value(metadata i64 %7, metadata !188, metadata !DIExpression()), !dbg !250 // %conv22 = trunc i64 %7 to i32, !dbg !143 // call void @llvm.dbg.value(metadata i32 %conv22, metadata !185, metadata !DIExpression()), !dbg !212 // %cmp23 = icmp eq i32 %conv22, 1, !dbg !144 // %conv24 = zext i1 %cmp23 to i32, !dbg !144 // call void @llvm.dbg.value(metadata i32 %conv24, metadata !189, metadata !DIExpression()), !dbg !212 // call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 2), metadata !191, metadata !DIExpression()), !dbg !254 // %8 = load atomic i64, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @vars, i64 0, i64 2) seq_cst, align 8, !dbg !146 // LD: Guess old_cr = cr(0,0+2*1); cr(0,0+2*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM // Check ASSUME(active[cr(0,0+2*1)] == 0); ASSUME(cr(0,0+2*1) >= iw(0,0+2*1)); ASSUME(cr(0,0+2*1) >= 0); ASSUME(cr(0,0+2*1) >= cdy[0]); ASSUME(cr(0,0+2*1) >= cisb[0]); ASSUME(cr(0,0+2*1) >= cdl[0]); ASSUME(cr(0,0+2*1) >= cl[0]); // Update creg_r18 = cr(0,0+2*1); crmax(0,0+2*1) = max(crmax(0,0+2*1),cr(0,0+2*1)); caddr[0] = max(caddr[0],0); if(cr(0,0+2*1) < cw(0,0+2*1)) { r18 = buff(0,0+2*1); } else { if(pw(0,0+2*1) != co(0+2*1,cr(0,0+2*1))) { ASSUME(cr(0,0+2*1) >= old_cr); } pw(0,0+2*1) = co(0+2*1,cr(0,0+2*1)); r18 = mem(0+2*1,cr(0,0+2*1)); } ASSUME(creturn[0] >= cr(0,0+2*1)); // call void @llvm.dbg.value(metadata i64 %8, metadata !193, metadata !DIExpression()), !dbg !254 // %conv28 = trunc i64 %8 to i32, !dbg !147 // call void @llvm.dbg.value(metadata i32 %conv28, metadata !190, metadata !DIExpression()), !dbg !212 // %cmp29 = icmp eq i32 %conv28, 2, !dbg !148 // %conv30 = zext i1 %cmp29 to i32, !dbg !148 // call void @llvm.dbg.value(metadata i32 %conv30, metadata !194, metadata !DIExpression()), !dbg !212 // call void @llvm.dbg.value(metadata i64* @atom_1_X0_1, metadata !196, metadata !DIExpression()), !dbg !258 // %9 = load atomic i64, i64* @atom_1_X0_1 seq_cst, align 8, !dbg !150 // LD: Guess old_cr = cr(0,4); cr(0,4) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM // Check ASSUME(active[cr(0,4)] == 0); ASSUME(cr(0,4) >= iw(0,4)); ASSUME(cr(0,4) >= 0); ASSUME(cr(0,4) >= cdy[0]); ASSUME(cr(0,4) >= cisb[0]); ASSUME(cr(0,4) >= cdl[0]); ASSUME(cr(0,4) >= cl[0]); // Update creg_r19 = cr(0,4); crmax(0,4) = max(crmax(0,4),cr(0,4)); caddr[0] = max(caddr[0],0); if(cr(0,4) < cw(0,4)) { r19 = buff(0,4); } else { if(pw(0,4) != co(4,cr(0,4))) { ASSUME(cr(0,4) >= old_cr); } pw(0,4) = co(4,cr(0,4)); r19 = mem(4,cr(0,4)); } ASSUME(creturn[0] >= cr(0,4)); // call void @llvm.dbg.value(metadata i64 %9, metadata !198, metadata !DIExpression()), !dbg !258 // %conv34 = trunc i64 %9 to i32, !dbg !151 // call void @llvm.dbg.value(metadata i32 %conv34, metadata !195, metadata !DIExpression()), !dbg !212 // call void @llvm.dbg.value(metadata i64* @atom_1_X5_2, metadata !200, metadata !DIExpression()), !dbg !261 // %10 = load atomic i64, i64* @atom_1_X5_2 seq_cst, align 8, !dbg !153 // LD: Guess old_cr = cr(0,5); cr(0,5) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM // Check ASSUME(active[cr(0,5)] == 0); ASSUME(cr(0,5) >= iw(0,5)); ASSUME(cr(0,5) >= 0); ASSUME(cr(0,5) >= cdy[0]); ASSUME(cr(0,5) >= cisb[0]); ASSUME(cr(0,5) >= cdl[0]); ASSUME(cr(0,5) >= cl[0]); // Update creg_r20 = cr(0,5); crmax(0,5) = max(crmax(0,5),cr(0,5)); caddr[0] = max(caddr[0],0); if(cr(0,5) < cw(0,5)) { r20 = buff(0,5); } else { if(pw(0,5) != co(5,cr(0,5))) { ASSUME(cr(0,5) >= old_cr); } pw(0,5) = co(5,cr(0,5)); r20 = mem(5,cr(0,5)); } ASSUME(creturn[0] >= cr(0,5)); // call void @llvm.dbg.value(metadata i64 %10, metadata !202, metadata !DIExpression()), !dbg !261 // %conv38 = trunc i64 %10 to i32, !dbg !154 // call void @llvm.dbg.value(metadata i32 %conv38, metadata !199, metadata !DIExpression()), !dbg !212 // call void @llvm.dbg.value(metadata i64* @atom_1_X11_1, metadata !204, metadata !DIExpression()), !dbg !264 // %11 = load atomic i64, i64* @atom_1_X11_1 seq_cst, align 8, !dbg !156 // LD: Guess old_cr = cr(0,6); cr(0,6) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM // Check ASSUME(active[cr(0,6)] == 0); ASSUME(cr(0,6) >= iw(0,6)); ASSUME(cr(0,6) >= 0); ASSUME(cr(0,6) >= cdy[0]); ASSUME(cr(0,6) >= cisb[0]); ASSUME(cr(0,6) >= cdl[0]); ASSUME(cr(0,6) >= cl[0]); // Update creg_r21 = cr(0,6); crmax(0,6) = max(crmax(0,6),cr(0,6)); caddr[0] = max(caddr[0],0); if(cr(0,6) < cw(0,6)) { r21 = buff(0,6); } else { if(pw(0,6) != co(6,cr(0,6))) { ASSUME(cr(0,6) >= old_cr); } pw(0,6) = co(6,cr(0,6)); r21 = mem(6,cr(0,6)); } ASSUME(creturn[0] >= cr(0,6)); // call void @llvm.dbg.value(metadata i64 %11, metadata !206, metadata !DIExpression()), !dbg !264 // %conv42 = trunc i64 %11 to i32, !dbg !157 // call void @llvm.dbg.value(metadata i32 %conv42, metadata !203, metadata !DIExpression()), !dbg !212 // %and = and i32 %conv38, %conv42, !dbg !158 creg_r22 = max(creg_r20,creg_r21); ASSUME(active[creg_r22] == 0); r22 = r20 & r21; // call void @llvm.dbg.value(metadata i32 %and, metadata !207, metadata !DIExpression()), !dbg !212 // %and43 = and i32 %conv34, %and, !dbg !159 creg_r23 = max(creg_r19,creg_r22); ASSUME(active[creg_r23] == 0); r23 = r19 & r22; // call void @llvm.dbg.value(metadata i32 %and43, metadata !208, metadata !DIExpression()), !dbg !212 // %and44 = and i32 %conv30, %and43, !dbg !160 creg_r24 = max(max(creg_r18,0),creg_r23); ASSUME(active[creg_r24] == 0); r24 = (r18==2) & r23; // call void @llvm.dbg.value(metadata i32 %and44, metadata !209, metadata !DIExpression()), !dbg !212 // %and45 = and i32 %conv24, %and44, !dbg !161 creg_r25 = max(max(creg_r17,0),creg_r24); ASSUME(active[creg_r25] == 0); r25 = (r17==1) & r24; // call void @llvm.dbg.value(metadata i32 %and45, metadata !210, metadata !DIExpression()), !dbg !212 // %and46 = and i32 %conv18, %and45, !dbg !162 creg_r26 = max(max(creg_r16,0),creg_r25); ASSUME(active[creg_r26] == 0); r26 = (r16==2) & r25; // call void @llvm.dbg.value(metadata i32 %and46, metadata !211, metadata !DIExpression()), !dbg !212 // %cmp47 = icmp eq i32 %and46, 1, !dbg !163 // br i1 %cmp47, label %if.then, label %if.end, !dbg !165 old_cctrl = cctrl[0]; cctrl[0] = get_rng(0,NCONTEXT-1); ASSUME(cctrl[0] >= old_cctrl); ASSUME(cctrl[0] >= creg_r26); ASSUME(cctrl[0] >= 0); if((r26==1)) { goto T0BLOCK1; } else { goto T0BLOCK2; } T0BLOCK1: // call void @__assert_fail(i8* noundef getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* noundef getelementptr inbounds ([121 x i8], [121 x i8]* @.str.1, i64 0, i64 0), i32 noundef 89, i8* noundef getelementptr inbounds ([23 x i8], [23 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #8, !dbg !166 // unreachable, !dbg !166 r27 = 1; T0BLOCK2: // %12 = bitcast i64* %thr2 to i8*, !dbg !169 // call void @llvm.lifetime.end.p0i8(i64 8, i8* %12) #7, !dbg !169 // %13 = bitcast i64* %thr1 to i8*, !dbg !169 // call void @llvm.lifetime.end.p0i8(i64 8, i8* %13) #7, !dbg !169 // %14 = bitcast i64* %thr0 to i8*, !dbg !169 // call void @llvm.lifetime.end.p0i8(i64 8, i8* %14) #7, !dbg !169 // ret i32 0, !dbg !170 ret_thread_0 = 0; ASSERT(r27== 0); }
[ "tuan-phong.ngo@it.uu.se" ]
tuan-phong.ngo@it.uu.se
21c5ec31ea2176f5c95c1ade2f20f49c6a28d22e
deb09c2c51edd14cf5f27553d66643565b98a145
/CVATools/include/ql/cashflows/coupon.hpp
809629c2a6d10edea81fa21f3af3c71bee609271
[]
no_license
humeaua/CVATools
00edb01e83aff40bce21d789390009f1f7406eb1
405f7caaed597a63a63811d9fc3ff7759f4b1ba0
refs/heads/master
2020-06-01T00:54:56.046305
2015-07-19T19:12:08
2015-07-19T19:12:08
8,816,936
1
0
null
null
null
null
UTF-8
C++
false
false
3,690
hpp
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* Copyright (C) 2000, 2001, 2002, 2003 RiskMap srl Copyright (C) 2003, 2004, 2007 StatPro Italia srl This file is part of QuantLib, a free-software/open-source library for financial quantitative analysts and developers - http://quantlib.org/ QuantLib is free software: you can redistribute it and/or modify it under the terms of the QuantLib license. You should have received a copy of the license along with this program; if not, please email <quantlib-dev@lists.sf.net>. The license is also available online at <http://quantlib.org/license.shtml>. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. */ /*! \file coupon.hpp \brief Coupon accruing over a fixed period */ #ifndef quantlib_coupon_hpp #define quantlib_coupon_hpp #include <ql/cashflow.hpp> namespace QuantLib { class DayCounter; //! %coupon accruing over a fixed period /*! This class implements part of the CashFlow interface but it is still abstract and provides derived classes with methods for accrual period calculations. */ class Coupon : public CashFlow { public: /*! \warning the coupon does not adjust the payment date which must already be a business day. */ Coupon(const Date& paymentDate, Real nominal, const Date& accrualStartDate, const Date& accrualEndDate, const Date& refPeriodStart = Date(), const Date& refPeriodEnd = Date()); //! \name Event interface //@{ Date date() const { return paymentDate_; } //@} //! \name Inspectors //@{ Real nominal() const; //! start of the accrual period const Date& accrualStartDate() const; //! end of the accrual period const Date& accrualEndDate() const; //! start date of the reference period const Date& referencePeriodStart() const; //! end date of the reference period const Date& referencePeriodEnd() const; //! accrual period as fraction of year Time accrualPeriod() const; //! accrual period in days BigInteger accrualDays() const; //! accrued rate virtual Rate rate() const = 0; //! day counter for accrual calculation virtual DayCounter dayCounter() const = 0; //! accrued period as fraction of year at the given date Time accruedPeriod(const Date&) const; //! accrued days at the given date BigInteger accruedDays(const Date&) const; //! accrued amount at the given date virtual Real accruedAmount(const Date&) const = 0; //@} //! \name Visitability //@{ virtual void accept(AcyclicVisitor&); //@} protected: Date paymentDate_; Real nominal_; Date accrualStartDate_,accrualEndDate_, refPeriodStart_,refPeriodEnd_; }; // inline definitions inline Real Coupon::nominal() const { return nominal_; } inline const Date& Coupon::accrualStartDate() const { return accrualStartDate_; } inline const Date& Coupon::accrualEndDate() const { return accrualEndDate_; } inline const Date& Coupon::referencePeriodStart() const { return refPeriodStart_; } inline const Date& Coupon::referencePeriodEnd() const { return refPeriodEnd_; } } #endif
[ "alexandre.humeau@student.ecp.fr" ]
alexandre.humeau@student.ecp.fr
a223535b0cae466e986dbca612aecbd0b7f907c3
c8bbd39e8d5c5e3673ed87febd7a10086e665435
/C/myxmlrpc/TestValues/stdafx.cpp
dd04caa2b0eb21e0ee68b5d9a9ae29421407c943
[]
no_license
chohan/Test
912dc6e575a7e855f3b24bbfd958460542c0992e
1feda99f5f1d9a5f2e912597ac62fa3182f74d81
refs/heads/master
2020-06-14T05:57:58.752589
2020-02-07T02:21:56
2020-02-07T02:21:56
194,926,022
0
0
null
null
null
null
UTF-8
C++
false
false
297
cpp
// stdafx.cpp : source file that includes just the standard includes // TestValues.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" // TODO: reference any additional headers you need in STDAFX.H // and not in this file
[ "shchohan@gmail.com" ]
shchohan@gmail.com
bb3e732489ffe5bd2f8cf7fa7110849c7f396cf7
770615a5009de0f84468aad1cbad41b54263fad7
/test/wangyi1.cpp
ab30d5f121e973e12263d14fbd49c9261092bfcd
[]
no_license
fengzi2023/leetcode
f20788f73545388329f786d2b85b5b51b0f2832f
3a9c12015f3e2288431ec7e2b34107076f6a5424
refs/heads/master
2023-03-04T20:48:39.303172
2017-11-09T14:18:52
2017-11-09T14:18:52
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,261
cpp
// 回溯 & 剪枝可以实现 // 回溯法搜索全排列树 #include<stdio.h> #include<string> #include<set> using namespace std; set<string> string_set; void swap(char *a, char *b)//交换a,b { char t; t = *a; *a = *b; *b = t; } bool is_perfect(char *str,int size) { int i = 0; int cnt = 0; while ( i < size-1 ) { if (str[i] != str[i+1]) { cnt++; } if (cnt > 1) { return false; } i++; } return true; } void backtrack(char *str,int len,int cur) { int i; if (!is_perfect(str,cur)) { return; } if(cur == len)// 找到 输出全排列 { string_set.insert(string(str)); } else { // 将集合中的所有元素分别与第一个交换,这样就总是在 // 处理剩下元素的全排列(即用递归) for(i=cur; i<len; i++) { swap(&str[cur], &str[i]); backtrack(str,len,cur+1); swap(&str[cur], &str[i]);//回溯 } } } int main() { char a[] = {'A','B','A','B'}; backtrack(a,4,0); printf("string_set_size:%d\n",string_set.size()); return 0; }
[ "fengyuwei@baidu.com" ]
fengyuwei@baidu.com
172df62feaf7e1f9f05d1254c67286a93c81fdec
bb6ebff7a7f6140903d37905c350954ff6599091
/net/quic/quic_server_id_test.cc
4a9c0f3cd8011cb70e3b49e2dfc25a74eddcdc2f
[ "BSD-3-Clause" ]
permissive
PDi-Communication-Systems-Inc/lollipop_external_chromium_org
faa6602bd6bfd9b9b6277ce3cd16df0bd26e7f2f
ccadf4e63dd34be157281f53fe213d09a8c66d2c
refs/heads/master
2022-12-23T18:07:04.568931
2016-04-11T16:03:36
2016-04-11T16:03:36
53,677,925
0
1
BSD-3-Clause
2022-12-09T23:46:46
2016-03-11T15:49:07
C++
UTF-8
C++
false
false
15,799
cc
// Copyright 2014 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 "net/quic/quic_server_id.h" #include "testing/gtest/include/gtest/gtest.h" using std::string; namespace net { namespace { TEST(QuicServerIdTest, ToString) { HostPortPair google_host_port_pair("google.com", 10); QuicServerId google_http_server_id(google_host_port_pair, false, PRIVACY_MODE_DISABLED); string google_http_server_id_str = google_http_server_id.ToString(); EXPECT_EQ("http://google.com:10", google_http_server_id_str); QuicServerId google_https_server_id(google_host_port_pair, true, PRIVACY_MODE_DISABLED); string google_https_server_id_str = google_https_server_id.ToString(); EXPECT_EQ("https://google.com:10", google_https_server_id_str); QuicServerId private_http_server_id(google_host_port_pair, false, PRIVACY_MODE_ENABLED); string private_http_server_id_str = private_http_server_id.ToString(); EXPECT_EQ("http://google.com:10/private", private_http_server_id_str); QuicServerId private_https_server_id(google_host_port_pair, true, PRIVACY_MODE_ENABLED); string private_https_server_id_str = private_https_server_id.ToString(); EXPECT_EQ("https://google.com:10/private", private_https_server_id_str); } TEST(QuicServerIdTest, LessThan) { QuicServerId a_10_http(HostPortPair("a.com", 10), false, PRIVACY_MODE_DISABLED); QuicServerId a_10_https(HostPortPair("a.com", 10), true, PRIVACY_MODE_DISABLED); QuicServerId a_11_http(HostPortPair("a.com", 11), false, PRIVACY_MODE_DISABLED); QuicServerId a_11_https(HostPortPair("a.com", 11), true, PRIVACY_MODE_DISABLED); QuicServerId b_10_http(HostPortPair("b.com", 10), false, PRIVACY_MODE_DISABLED); QuicServerId b_10_https(HostPortPair("b.com", 10), true, PRIVACY_MODE_DISABLED); QuicServerId b_11_http(HostPortPair("b.com", 11), false, PRIVACY_MODE_DISABLED); QuicServerId b_11_https(HostPortPair("b.com", 11), true, PRIVACY_MODE_DISABLED); QuicServerId a_10_http_private(HostPortPair("a.com", 10), false, PRIVACY_MODE_ENABLED); QuicServerId a_10_https_private(HostPortPair("a.com", 10), true, PRIVACY_MODE_ENABLED); QuicServerId a_11_http_private(HostPortPair("a.com", 11), false, PRIVACY_MODE_ENABLED); QuicServerId a_11_https_private(HostPortPair("a.com", 11), true, PRIVACY_MODE_ENABLED); QuicServerId b_10_http_private(HostPortPair("b.com", 10), false, PRIVACY_MODE_ENABLED); QuicServerId b_10_https_private(HostPortPair("b.com", 10), true, PRIVACY_MODE_ENABLED); QuicServerId b_11_http_private(HostPortPair("b.com", 11), false, PRIVACY_MODE_ENABLED); QuicServerId b_11_https_private(HostPortPair("b.com", 11), true, PRIVACY_MODE_ENABLED); // Test combinations of host, port, https and privacy being same on left and // right side of less than. EXPECT_FALSE(a_10_http < a_10_http); EXPECT_TRUE(a_10_http < a_10_https); EXPECT_FALSE(a_10_https < a_10_http); EXPECT_FALSE(a_10_https < a_10_https); EXPECT_TRUE(a_10_http < a_10_http_private); EXPECT_TRUE(a_10_http < a_10_https_private); EXPECT_FALSE(a_10_https < a_10_http_private); EXPECT_TRUE(a_10_https < a_10_https_private); EXPECT_FALSE(a_10_http_private < a_10_http); EXPECT_TRUE(a_10_http_private < a_10_https); EXPECT_FALSE(a_10_https_private < a_10_http); EXPECT_FALSE(a_10_https_private < a_10_https); EXPECT_FALSE(a_10_http_private < a_10_http_private); EXPECT_TRUE(a_10_http_private < a_10_https_private); EXPECT_FALSE(a_10_https_private < a_10_http_private); EXPECT_FALSE(a_10_https_private < a_10_https_private); // Test with either host, port or https being different on left and right side // of less than. PrivacyMode left_privacy; PrivacyMode right_privacy; for (int i = 0; i < 4; i++) { switch (i) { case 0: left_privacy = PRIVACY_MODE_DISABLED; right_privacy = PRIVACY_MODE_DISABLED; break; case 1: left_privacy = PRIVACY_MODE_DISABLED; right_privacy = PRIVACY_MODE_ENABLED; break; case 2: left_privacy = PRIVACY_MODE_ENABLED; right_privacy = PRIVACY_MODE_DISABLED; break; case 3: left_privacy = PRIVACY_MODE_ENABLED; right_privacy = PRIVACY_MODE_ENABLED; break; } QuicServerId a_10_http_left_private(HostPortPair("a.com", 10), false, left_privacy); QuicServerId a_10_http_right_private(HostPortPair("a.com", 10), false, right_privacy); QuicServerId a_10_https_left_private(HostPortPair("a.com", 10), true, left_privacy); QuicServerId a_10_https_right_private(HostPortPair("a.com", 10), true, right_privacy); QuicServerId a_11_http_left_private(HostPortPair("a.com", 11), false, left_privacy); QuicServerId a_11_http_right_private(HostPortPair("a.com", 11), false, right_privacy); QuicServerId a_11_https_left_private(HostPortPair("a.com", 11), true, left_privacy); QuicServerId a_11_https_right_private(HostPortPair("a.com", 11), true, right_privacy); QuicServerId b_10_http_left_private(HostPortPair("b.com", 10), false, left_privacy); QuicServerId b_10_http_right_private(HostPortPair("b.com", 10), false, right_privacy); QuicServerId b_10_https_left_private(HostPortPair("b.com", 10), true, left_privacy); QuicServerId b_10_https_right_private(HostPortPair("b.com", 10), true, right_privacy); QuicServerId b_11_http_left_private(HostPortPair("b.com", 11), false, left_privacy); QuicServerId b_11_http_right_private(HostPortPair("b.com", 11), false, right_privacy); QuicServerId b_11_https_left_private(HostPortPair("b.com", 11), true, left_privacy); QuicServerId b_11_https_right_private(HostPortPair("b.com", 11), true, right_privacy); EXPECT_TRUE(a_10_http_left_private < a_11_http_right_private); EXPECT_TRUE(a_10_http_left_private < a_11_https_right_private); EXPECT_TRUE(a_10_https_left_private < a_11_http_right_private); EXPECT_TRUE(a_10_https_left_private < a_11_https_right_private); EXPECT_TRUE(a_10_http_left_private < b_10_http_right_private); EXPECT_TRUE(a_10_http_left_private < b_10_https_right_private); EXPECT_TRUE(a_10_https_left_private < b_10_http_right_private); EXPECT_TRUE(a_10_https_left_private < b_10_https_right_private); EXPECT_TRUE(a_10_http_left_private < b_11_http_right_private); EXPECT_TRUE(a_10_http_left_private < b_11_https_right_private); EXPECT_TRUE(a_10_https_left_private < b_11_http_right_private); EXPECT_TRUE(a_10_https_left_private < b_11_https_right_private); EXPECT_FALSE(a_11_http_left_private < a_10_http_right_private); EXPECT_FALSE(a_11_http_left_private < a_10_https_right_private); EXPECT_FALSE(a_11_https_left_private < a_10_http_right_private); EXPECT_FALSE(a_11_https_left_private < a_10_https_right_private); EXPECT_FALSE(a_11_http_left_private < b_10_http_right_private); EXPECT_FALSE(a_11_http_left_private < b_10_https_right_private); EXPECT_FALSE(a_11_https_left_private < b_10_http_right_private); EXPECT_FALSE(a_11_https_left_private < b_10_https_right_private); EXPECT_TRUE(a_11_http_left_private < b_11_http_right_private); EXPECT_TRUE(a_11_http_left_private < b_11_https_right_private); EXPECT_TRUE(a_11_https_left_private < b_11_http_right_private); EXPECT_TRUE(a_11_https_left_private < b_11_https_right_private); EXPECT_FALSE(b_10_http_left_private < a_10_http_right_private); EXPECT_FALSE(b_10_http_left_private < a_10_https_right_private); EXPECT_FALSE(b_10_https_left_private < a_10_http_right_private); EXPECT_FALSE(b_10_https_left_private < a_10_https_right_private); EXPECT_TRUE(b_10_http_left_private < a_11_http_right_private); EXPECT_TRUE(b_10_http_left_private < a_11_https_right_private); EXPECT_TRUE(b_10_https_left_private < a_11_http_right_private); EXPECT_TRUE(b_10_https_left_private < a_11_https_right_private); EXPECT_TRUE(b_10_http_left_private < b_11_http_right_private); EXPECT_TRUE(b_10_http_left_private < b_11_https_right_private); EXPECT_TRUE(b_10_https_left_private < b_11_http_right_private); EXPECT_TRUE(b_10_https_left_private < b_11_https_right_private); EXPECT_FALSE(b_11_http_left_private < a_10_http_right_private); EXPECT_FALSE(b_11_http_left_private < a_10_https_right_private); EXPECT_FALSE(b_11_https_left_private < a_10_http_right_private); EXPECT_FALSE(b_11_https_left_private < a_10_https_right_private); EXPECT_FALSE(b_11_http_left_private < a_11_http_right_private); EXPECT_FALSE(b_11_http_left_private < a_11_https_right_private); EXPECT_FALSE(b_11_https_left_private < a_11_http_right_private); EXPECT_FALSE(b_11_https_left_private < a_11_https_right_private); EXPECT_FALSE(b_11_http_left_private < b_10_http_right_private); EXPECT_FALSE(b_11_http_left_private < b_10_https_right_private); EXPECT_FALSE(b_11_https_left_private < b_10_http_right_private); EXPECT_FALSE(b_11_https_left_private < b_10_https_right_private); } } TEST(QuicServerIdTest, Equals) { PrivacyMode left_privacy; PrivacyMode right_privacy; for (int i = 0; i < 2; i++) { switch (i) { case 0: left_privacy = PRIVACY_MODE_DISABLED; right_privacy = PRIVACY_MODE_DISABLED; break; case 1: left_privacy = PRIVACY_MODE_ENABLED; right_privacy = PRIVACY_MODE_ENABLED; break; } QuicServerId a_10_http_right_private(HostPortPair("a.com", 10), false, right_privacy); QuicServerId a_10_https_right_private(HostPortPair("a.com", 10), true, right_privacy); QuicServerId a_11_http_right_private(HostPortPair("a.com", 11), false, right_privacy); QuicServerId a_11_https_right_private(HostPortPair("a.com", 11), true, right_privacy); QuicServerId b_10_http_right_private(HostPortPair("b.com", 10), false, right_privacy); QuicServerId b_10_https_right_private(HostPortPair("b.com", 10), true, right_privacy); QuicServerId b_11_http_right_private(HostPortPair("b.com", 11), false, right_privacy); QuicServerId b_11_https_right_private(HostPortPair("b.com", 11), true, right_privacy); QuicServerId new_a_10_http_left_private(HostPortPair("a.com", 10), false, left_privacy); QuicServerId new_a_10_https_left_private(HostPortPair("a.com", 10), true, left_privacy); QuicServerId new_a_11_http_left_private(HostPortPair("a.com", 11), false, left_privacy); QuicServerId new_a_11_https_left_private(HostPortPair("a.com", 11), true, left_privacy); QuicServerId new_b_10_http_left_private(HostPortPair("b.com", 10), false, left_privacy); QuicServerId new_b_10_https_left_private(HostPortPair("b.com", 10), true, left_privacy); QuicServerId new_b_11_http_left_private(HostPortPair("b.com", 11), false, left_privacy); QuicServerId new_b_11_https_left_private(HostPortPair("b.com", 11), true, left_privacy); EXPECT_EQ(new_a_10_http_left_private, a_10_http_right_private); EXPECT_EQ(new_a_10_https_left_private, a_10_https_right_private); EXPECT_EQ(new_a_11_http_left_private, a_11_http_right_private); EXPECT_EQ(new_a_11_https_left_private, a_11_https_right_private); EXPECT_EQ(new_b_10_http_left_private, b_10_http_right_private); EXPECT_EQ(new_b_10_https_left_private, b_10_https_right_private); EXPECT_EQ(new_b_11_http_left_private, b_11_http_right_private); EXPECT_EQ(new_b_11_https_left_private, b_11_https_right_private); } for (int i = 0; i < 2; i++) { switch (i) { case 0: right_privacy = PRIVACY_MODE_DISABLED; break; case 1: right_privacy = PRIVACY_MODE_ENABLED; break; } QuicServerId a_10_http_right_private(HostPortPair("a.com", 10), false, right_privacy); QuicServerId a_10_https_right_private(HostPortPair("a.com", 10), true, right_privacy); QuicServerId a_11_http_right_private(HostPortPair("a.com", 11), false, right_privacy); QuicServerId a_11_https_right_private(HostPortPair("a.com", 11), true, right_privacy); QuicServerId b_10_http_right_private(HostPortPair("b.com", 10), false, right_privacy); QuicServerId b_10_https_right_private(HostPortPair("b.com", 10), true, right_privacy); QuicServerId b_11_http_right_private(HostPortPair("b.com", 11), false, right_privacy); QuicServerId b_11_https_right_private(HostPortPair("b.com", 11), true, right_privacy); QuicServerId new_a_10_http_left_private(HostPortPair("a.com", 10), false, PRIVACY_MODE_DISABLED); EXPECT_FALSE(new_a_10_http_left_private == a_10_https_right_private); EXPECT_FALSE(new_a_10_http_left_private == a_11_http_right_private); EXPECT_FALSE(new_a_10_http_left_private == b_10_http_right_private); EXPECT_FALSE(new_a_10_http_left_private == a_11_https_right_private); EXPECT_FALSE(new_a_10_http_left_private == b_10_https_right_private); EXPECT_FALSE(new_a_10_http_left_private == b_11_http_right_private); EXPECT_FALSE(new_a_10_http_left_private == b_11_https_right_private); } QuicServerId a_10_http_private(HostPortPair("a.com", 10), false, PRIVACY_MODE_ENABLED); QuicServerId new_a_10_http_no_private(HostPortPair("a.com", 10), false, PRIVACY_MODE_DISABLED); EXPECT_FALSE(new_a_10_http_no_private == a_10_http_private); } } // namespace } // namespace net
[ "mrobbeloth@pdiarm.com" ]
mrobbeloth@pdiarm.com
e0cbfcaec1a5a7718cbe57375b122bf751951a30
77f95099bbc4f58bf42c8bc0d4e42aa625d09c7e
/inc/eco_aco.hpp
6900d4494d58d3fadbd29cef6b0d06fcfac6eaf2
[ "MIT" ]
permissive
CandyMi/libeco
d3eaca9585b91f852a83fbc16315636bf63ac3b6
09770093b0ceaefe6143d817a451e5f19a260d32
refs/heads/master
2023-08-26T11:29:24.672222
2021-11-05T07:13:46
2021-11-05T07:13:46
424,258,818
3
1
null
null
null
null
UTF-8
C++
false
false
5,880
hpp
// Copyright 2018 Sen Han <00hnes@gmail.com> // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef ACO_H #define ACO_H #include "eco.hpp" #include <string.h> #include <stdint.h> #include <limits.h> #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <time.h> #include <sys/mman.h> #ifdef ECO_USE_VALGRIND #include <valgrind/valgrind.h> #endif #ifdef __cplusplus extern "C" { #endif #define ACO_VERSION_MAJOR 1 #define ACO_VERSION_MINOR 2 #define ACO_VERSION_PATCH 4 #ifdef __i386__ #define ACO_REG_IDX_RETADDR 0 #define ACO_REG_IDX_SP 1 #define ACO_REG_IDX_BP 2 #define ACO_REG_IDX_FPU 6 #elif __x86_64__ #define ACO_REG_IDX_RETADDR 4 #define ACO_REG_IDX_SP 5 #define ACO_REG_IDX_BP 7 #define ACO_REG_IDX_FPU 8 #elif __aarch64__ #define ACO_REG_IDX_RETADDR 13 #define ACO_REG_IDX_SP 14 #define ACO_REG_IDX_BP 12 #define ACO_REG_IDX_FPU 15 #else #error "platform no support yet" #endif typedef struct { void* ptr; size_t sz; size_t valid_sz; // max copy size in bytes size_t max_cpsz; // copy from share stack to this save stack size_t ct_save; // copy from this save stack to share stack size_t ct_restore; } aco_save_stack_t; struct aco_s; typedef struct aco_s aco_t; typedef struct { void* ptr; size_t sz; void* align_highptr; void* align_retptr; size_t align_validsz; size_t align_limit; aco_t* owner; char guard_page_enabled; void* real_ptr; size_t real_sz; #ifdef ECO_USE_VALGRIND unsigned long valgrind_stk_id; #endif } aco_share_stack_t; typedef void (*aco_cofuncp_t)(void); struct aco_s{ // cpu registers' state #ifdef __i386__ #ifdef ACO_CONFIG_SHARE_FPU_MXCSR_ENV void* reg[6]; #else void* reg[8]; #endif #elif __x86_64__ #ifdef ACO_CONFIG_SHARE_FPU_MXCSR_ENV void* reg[8]; #else void* reg[9]; #endif #elif __aarch64__ #ifdef ACO_CONFIG_SHARE_FPU_MXCSR_ENV void* reg[15]; #else void* reg[16]; #endif #else #error "platform no support yet" #endif aco_t* main_co; void* arg; char is_end; aco_cofuncp_t fp; aco_save_stack_t save_stack; aco_share_stack_t* share_stack; }; #define aco_likely(x) (__builtin_expect(!!(x), 1)) #define aco_unlikely(x) (__builtin_expect(!!(x), 0)) #define aco_assert(EX) ((aco_likely(EX))?((void)0):(abort())) #define aco_assertptr(ptr) ((aco_likely((ptr) != NULL))?((void)0):(abort())) #define aco_assertalloc_bool(b) do { \ if(aco_unlikely(!(b))){ \ fprintf(stderr, "Aborting: failed to allocate memory: %s:%d:%s\n", \ __FILE__, __LINE__, __PRETTY_FUNCTION__); \ abort(); \ } \ } while(0) #define aco_assertalloc_ptr(ptr) do { \ if(aco_unlikely((ptr) == NULL)){ \ fprintf(stderr, "Aborting: failed to allocate memory: %s:%d:%s\n", \ __FILE__, __LINE__, __PRETTY_FUNCTION__); \ abort(); \ } \ } while(0) #if defined(aco_attr_no_asan) #error "aco_attr_no_asan already defined" #endif #if defined(ACO_USE_ASAN) #if defined(__has_feature) #if __has_feature(__address_sanitizer__) #define aco_attr_no_asan \ __attribute__((__no_sanitize_address__)) #endif #endif #if defined(__SANITIZE_ADDRESS__) && !defined(aco_attr_no_asan) #define aco_attr_no_asan \ __attribute__((__no_sanitize_address__)) #endif #endif #ifndef aco_attr_no_asan #define aco_attr_no_asan #endif extern void aco_runtime_test(void); extern void aco_thread_init(aco_cofuncp_t last_word_co_fp); extern void* acosw(aco_t* from_co, aco_t* to_co) __asm__("acosw"); // asm extern void aco_save_fpucw_mxcsr(void* p) __asm__("aco_save_fpucw_mxcsr"); // asm extern void aco_funcp_protector_asm(void) __asm__("aco_funcp_protector_asm"); // asm extern void aco_funcp_protector(void); extern aco_share_stack_t* aco_share_stack_new(size_t sz); aco_share_stack_t* aco_share_stack_new2(size_t sz, char guard_page_enabled); extern void aco_share_stack_destroy(aco_share_stack_t* sstk); extern aco_t* aco_create( aco_t* main_co, aco_share_stack_t* share_stack, size_t save_stack_sz, aco_cofuncp_t fp, void* arg ); // aco's Global Thread Local Storage variable `co` extern __thread aco_t* aco_gtls_co; aco_attr_no_asan extern void aco_resume(aco_t* resume_co); extern void aco_destroy(aco_t* co); static inline void aco_yield1(aco_t* yield_co) { aco_assertptr((yield_co)); aco_assertptr((yield_co)->main_co); acosw((yield_co), (yield_co)->main_co); } static inline void aco_yield() { return aco_yield1(aco_gtls_co); } static inline void* aco_get_arg() { return aco_gtls_co->arg; } static inline aco_t* aco_get_co() { return aco_gtls_co; } static inline aco_t* aco_co() { return aco_get_co(); } #define aco_is_main_co(co) (((co)->main_co) == NULL) static inline void aco_exit1(aco_t* co) { (co)->is_end = 1; aco_assert((co)->share_stack->owner == (co)); (co)->share_stack->owner = NULL; (co)->share_stack->align_validsz = 0; aco_yield1((co)); aco_assert(0); } static inline void aco_exit() { return aco_exit1(aco_gtls_co); } #ifdef __cplusplus } #endif #endif
[ "869646063@qq.com" ]
869646063@qq.com
e0c3d1794c585aed8683829a31b61e5ea4d90026
27515c7b60b71f4fabf86c1e080b66d6b10cca03
/J04/ex01/PlasmaRifle.cpp
449b8bc288a3e5063999d3fdd5d5b47fdca0ba3f
[]
no_license
bvan-dyc/CPPPool
ff6e4a054385c6506f8bdf1d0fb5ea9758982bbf
67057d3717b4794dfe2729bc0966e52f32563006
refs/heads/master
2021-05-08T22:36:38.304435
2018-02-28T13:11:09
2018-02-28T13:11:09
119,678,302
0
0
null
null
null
null
UTF-8
C++
false
false
451
cpp
#include "PlasmaRifle.hpp" PlasmaRifle::PlasmaRifle(void) : AWeapon("Plasma Rifle", 5, 21) { } PlasmaRifle::PlasmaRifle(PlasmaRifle const &other) : AWeapon("Plasma Rifle", 5, 21) { *this = other; } PlasmaRifle::~PlasmaRifle(void) { } PlasmaRifle& PlasmaRifle::operator=(PlasmaRifle const &other) { AWeapon::operator=(other); return (*this); } void PlasmaRifle::attack(void) const { std::cout << "* piouuu piouuu piouuu *" << std::endl; }
[ "bvan-dyc@student.42.fr" ]
bvan-dyc@student.42.fr
d48c15b43b0808800e89d61679d835a098f23b46
6832a29c646eb3756b442ec52834f3bb48d22be1
/kernel/bidir_node.cpp
6c810d07c1df74e27e25a9092f89074e9c095056
[ "BSD-3-Clause" ]
permissive
m-asama/soma
c2c43c9b1dc65d871bcd05c52104045a7b8ed033
8fc5dd04ba14dead536b280efc4e18c7b97283bd
refs/heads/master
2021-01-09T20:33:18.344172
2017-04-12T04:48:24
2017-04-12T04:48:24
63,848,841
13
1
null
null
null
null
UTF-8
C++
false
false
1,240
cpp
/** * @file bidir_node.cpp * @brief 双方向リンクリストのノード。 * @author Masakazu Asama <m-asama@ginzado.co.jp> */ #include "print.h" template<class V> bidir_node<V>::bidir_node(V &v) : m_v(v) { //printstr("bidir_node<V>::bidir_node(V &v)\n"); m_next = nullptr; m_prev = nullptr; } template<class V> bidir_node<V>::~bidir_node() { //printstr("bidir_node<V>::~bidir_node()\n"); m_next = nullptr; m_prev = nullptr; } template<class V> void * bidir_node<V>::operator new(size_t size) { //printstr("bidir_node<V>::operator new\n"); return s_mem_pool.alloc(); } template<class V> void bidir_node<V>::operator delete(void *ptr) { s_mem_pool.free((bidir_node<V> *)ptr); } template<class V> V & bidir_node<V>::v() { return m_v; } template<class V> void bidir_node<V>::next(bidir_node<V> *next) { m_next = next; } template<class V> bidir_node<V> * bidir_node<V>::next() { return m_next; } template<class V> void bidir_node<V>::prev(bidir_node<V> *prev) { m_prev = prev; } template<class V> bidir_node<V> * bidir_node<V>::prev() { return m_prev; } template<class V> uint64_t bidir_node<V>::count() { return s_mem_pool.count(); } template<class V> memory_pool<bidir_node<V>> bidir_node<V>::s_mem_pool;
[ "m-asama@ginzado.co.jp" ]
m-asama@ginzado.co.jp
4c1d93eb74121bb8eb737e1c77f7eac5af8612c1
d8805c5b8712cffb4429ab832846a9ce4aa95039
/src/resonanceReconstruction/rmatrix/src/makeChannelRadiusTable.hpp
b63f4cc9b847681176a456d4392cd70fcfcd15b6
[ "BSD-2-Clause" ]
permissive
njoy/resonanceReconstruction
da62c1ff2ac0a1feaa708bc64cd97b43b2b4ab7b
074f009f9aea672286e8673352744b23a8ce54cb
refs/heads/master
2023-03-21T05:52:22.519282
2020-10-30T16:26:16
2020-10-30T16:26:16
99,273,455
3
0
NOASSERTION
2022-08-15T20:21:46
2017-08-03T20:43:33
C++
UTF-8
C++
false
false
2,115
hpp
std::optional< ChannelRadiusTable > makeChannelRadiusTable( const std::optional< endf::ScatteringRadius >& radius ) { if ( radius ) { auto makeTable = [] ( auto&& region, int interpolant ) -> TableVariant< Energy, ChannelRadius > { auto toEnergy = [] ( const auto& value ) { return value * electronVolt; }; auto toRadius = [] ( const auto& value ) { return value * rootBarn; }; std::vector< Energy > energies = region.first | ranges::view::transform( toEnergy ); std::vector< ChannelRadius > radii = region.second | ranges::view::transform( toRadius ); switch( interpolant ) { case 1: { return HistogramTable< Energy, ChannelRadius >( std::move( energies ), std::move( radii ) ); } case 2: { return LinLinTable< Energy, ChannelRadius >( std::move( energies ), std::move( radii ) ); } case 3: { return LinLogTable< Energy, ChannelRadius >( std::move( energies ), std::move( radii ) ); } case 4: { return LogLinTable< Energy, ChannelRadius >( std::move( energies ), std::move( radii ) ); } case 5: { return LogLogTable< Energy, ChannelRadius >( std::move( energies ), std::move( radii ) ); } default : { throw std::runtime_error( "You somehow reached unreachable code" ); } } }; const auto regions = radius->regions(); const auto interpolants = radius->interpolants(); std::vector< TableVariant< Energy, ChannelRadius > > tables = ranges::view::zip_with( makeTable, regions, interpolants ); ChannelRadiusTable table( MultiRegionTable< Energy, ChannelRadius >( std::move( tables ) ) ); return std::make_optional( std::move( table ) ); } return std::nullopt; }
[ "whaeck@gmail.com" ]
whaeck@gmail.com
94d734b8d2c92f5891e475d4cbc4096e6d049db9
7f88f6ef7fe43cdcfe41984a8952f876dec1cd47
/2443.cpp
97359c3cff8ebff6fa51326c232860334c0c4ace
[]
no_license
skleee/boj-ps
7498ca4b1fc892caafec6a6620bd9968aff0f6f0
818e36754d20c2dccfcf641a7d47dd1f0c087fd1
refs/heads/master
2020-07-25T22:14:10.971137
2020-03-08T17:11:38
2020-03-08T17:11:38
208,439,076
2
0
null
null
null
null
UTF-8
C++
false
false
375
cpp
#include <iostream> #pragma warning(disable:4996) /* 2443. 별찍기6 출력 */ using namespace std; int N; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL); cin >> N; for (int i = 0; i <= N; i++) { for (int k = 0; k < i; k++) { cout << " "; } for (int j = 0; j < 2*(N-i)-1; j++) { cout << "*"; } cout << "\n"; } return 0; }
[ "leesk1027@gmail.com" ]
leesk1027@gmail.com
afbcc9748a95a3332e8450f5632c41ed3d5395a8
500968dd9044ef4d9a64e73f2e78e32a03f03cd2
/videoOnDemand/src/frameManager.h
e0a8f3f8ea71344af79e7da02deba8a7e9e1f419
[]
no_license
olgen2013/videoCoding
6f4ca95998fe6200973f53f70d8041401ef51b3f
e641fbdf978e0c3dca694d76dcac1ad164546644
refs/heads/master
2020-05-17T02:58:45.325535
2013-05-31T13:53:51
2013-05-31T13:53:51
13,319,547
0
2
null
null
null
null
UTF-8
C++
false
false
1,914
h
/* * frameManager.h * * Created on: 21.02.2013 * Author: Johannes Goth (cmm-jg) */ #ifndef FRAMEMANAGER_H_ #define FRAMEMANAGER_H_ // own stuff #include "frameManager.h" #include "videoRecorder.h" #include "videoRecorder.cpp" // libraries #include <boost/thread.hpp> #include <vector> // ROS includes #include "ros/ros.h" #include "sensor_msgs/Image.h" // openCV includes #include <cv_bridge/cv_bridge.h> #include "opencv2/core/core.hpp" #include "opencv2/opencv.hpp" #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/highgui/highgui.hpp> class FrameManager { public: FrameManager(); FrameManager(ros::NodeHandle &nHandler); virtual ~FrameManager(); void processFrame(const sensor_msgs::Image& img); int getVideo(); private: // private memeber functions void cacheFrame(cv::Mat frame); void verifyCacheSize(); void storeCache(std::vector<cv::Mat>* cache, bool* threadActive); int createVideo(); std::vector<cv::Mat>* getCurrentCache(); void storeFrame(cv::Mat frame); void displayFrame(cv::Mat* mat); // cache attributes and references (memory buffers) u_int fpv; // frames per video u_int fpc; // frames per cache u_int fpb; // frames per binary bool fullVideoAvailable; bool createVideoActive; bool usingCacheA; bool usingCacheB; std::vector<cv::Mat>* cacheA; std::vector<cv::Mat>* cacheB; // file storage parameters std::string binaryFilePath; std::string videoFilePath; u_int binaryFileIndex; std::vector<boost::mutex*> binaryFileMutexes; // output video parameters u_int vfr; // video frame rate int videoCodec; // Codec for video coding eg. CV_FOURCC('D','I','V','X') bool showFrame; // threads parameters boost::thread storingThreadA; boost::thread storingThreadB; boost::thread tCaching; bool storingCacheA; bool storingCacheB; boost::thread creatingVideoThread; boost::thread cachingThread; }; #endif /* FRAMEMANAGERH_ */
[ "Johannes.Goth@ipa.fraunhofer.de" ]
Johannes.Goth@ipa.fraunhofer.de
72785d6abc51f795addb87bd7730d5e5c8eeddb5
397f7112a994a3abe10f27967368a6a11d9d5f07
/milk3_v1.cpp
a5f80f37f9e64cfbd42e03d9ad39d3f504425146
[]
no_license
wxx5433/USACO
4d15dfb631524de0e848573899c047cba09b94bc
00547b2c7742c6a35491f853d10b80c317a7bc37
refs/heads/master
2016-08-03T10:30:34.245419
2014-01-26T15:07:44
2014-01-26T15:07:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,423
cpp
/* ID: wxx54331 PROG: milk3 LANG: C++ */ /* 使用DFS搜索所有情况,对于已经出现过的状态进行剪枝 用一个bool数组pattern来记录三个桶的状态 再用一个bool数组result来记录当a桶为空时,c桶内牛奶的数量 最后结果主要扫描一遍result输出就可以了。 */ #include<iostream> #include<fstream> using namespace std; int a, b, c; const int MAX = 21; bool pattern[MAX][MAX]; //只要确定了两个桶就能确定整个状态 bool result[MAX]; void DFS(int A, int B, int C); int main() { ifstream fin("milk3.in"); ofstream fout("milk3.out"); fin >> a >> b >> c; DFS(0,0,c); int flag = true; for(int i = 0; i < MAX; ++i) if(result[i]) { if(flag) { flag = false; fout << i; } else fout << " " << i; } fout << endl; fin.close(); fout.close(); return 0; } void DFS(int A, int B, int C) { if(pattern[A][B]) //对于已经出现过的状态进行剪枝 return; pattern[A][B] = true; if(A == 0) { if(!result[C]) result[C] = true; } //a->b if(A+B<=b) DFS(0,A+B,C); else DFS(A-(b-B),b,C); //a->c if(A+C<=c) DFS(0,B,A+C); else DFS(A-(c-C),B,c); //b->a if(A+B<=a) DFS(A+B,0,C); else DFS(a,B-(a-A),C); //b->c if(B+C<=c) DFS(A,0,B+C); else DFS(A,B-(c-C),c); //c->a if(A+C<=a) DFS(A+C,B,0); else DFS(a,B,C-(a-A)); //c->b if(B+C<=b) DFS(A,B+C,0); else DFS(A,b,C-(b-B)); }
[ "wxx5433@gmail.com" ]
wxx5433@gmail.com
a179d03dc6b3f098acf75e152ca3ba1216b7311b
e2b80c517b4b0ab3051bb95a3b695b424b80bf66
/剑指offer/链表中环的入口结点/main.cpp
e66683f67bf3676aa82e0cac53d6e0960f84c32b
[]
no_license
TheBeatles1994/BlueBridge
738df4932d4c65a0c9bcd5e762645753f0a06430
10aa67a6b54a64a707b531d96f25a6b6b89f445f
refs/heads/master
2021-04-27T00:04:52.319108
2018-09-04T08:51:04
2018-09-04T08:51:04
123,747,735
7
3
null
null
null
null
UTF-8
C++
false
false
1,442
cpp
#include <iostream> #include <map> #include <algorithm> #include <vector> #include <set> #include <utility> #include <string> using namespace std; struct ListNode { int val; struct ListNode *next; ListNode(int x) : val(x), next(NULL) { } }; ListNode *pHead; ListNode *pCur; ListNode *pNew; /* 练习用:创建表 */ void createList() { bool isHead=true; int n; while(cin>>n) { if(n!=-1) { pNew = new ListNode(n); if(isHead) { pHead = pNew; pCur = pNew; isHead = false; } else { pCur->next = pNew; pCur = pNew; } } else break; } } /* 练习用:输出链表 */ void showList() { ListNode *temp = pHead; while(temp) { cout << temp->val<<" "; temp = temp->next; } cout<<endl; } ListNode* EntryNodeOfLoop(ListNode* pHead) { if(!pHead) return NULL; ListNode *fast = pHead->next->next; ListNode *slow = pHead->next; while(fast != slow) { fast = fast->next->next; slow = slow->next; } slow = pHead; while(fast != slow) { fast = fast->next; slow = slow->next; } return slow; } int main(int argc, char *argv[]) { createList(); showList(); return 0; }
[ "479488209@qq.com" ]
479488209@qq.com
bb649fdba68326c578ed46ac985bd491b048d348
09a4962b93c196f2f8a70c2384757142793612fd
/Dripdoctors/build/Android/Debug/Dripdoctors/app/src/main/include/Fuse.Scaling.h
204124d57330d432d881054991df98ceb77b5671
[]
no_license
JimmyRodriguez/apps-fuse
169779ff2827a6e35be91d9ff17e0c444ba7f8cd
14114328c3cea08c1fd766bf085bbf5a67f698ae
refs/heads/master
2020-12-03T09:25:26.566750
2016-09-24T14:24:49
2016-09-24T14:24:49
65,154,944
0
0
null
null
null
null
UTF-8
C++
false
false
1,768
h
// This file was generated based on C:\ProgramData\Uno\Packages\FuseCore\0.32.14\$.uno. // WARNING: Changes might be lost if you edit this file directly. #pragma once #include <Fuse.Binding.h> #include <Fuse.Scripting.IScriptObject.h> #include <Fuse.Transform.h> #include <Uno.Collections.ICollection-1.h> #include <Uno.Collections.IEnumerable-1.h> #include <Uno.Collections.IList-1.h> #include <Uno.Float3.h> namespace g{namespace Fuse{struct FastMatrix;}} namespace g{namespace Fuse{struct Scaling;}} namespace g{ namespace Fuse{ // public sealed class Scaling :8193 // { ::g::Fuse::Transform_type* Scaling_typeof(); void Scaling__ctor_3_fn(Scaling* __this); void Scaling__AppendTo_fn(Scaling* __this, ::g::Fuse::FastMatrix* m, float* weight); void Scaling__get_EffectiveVector_fn(Scaling* __this, ::g::Uno::Float3* __retval); void Scaling__get_IsFlat_fn(Scaling* __this, bool* __retval); void Scaling__IsIdentity_fn(Scaling* __this, ::g::Uno::Float3* v, bool* __retval); void Scaling__New2_fn(Scaling** __retval); void Scaling__PrependTo_fn(Scaling* __this, ::g::Fuse::FastMatrix* m); void Scaling__get_RelativeTo_fn(Scaling* __this, uObject** __retval); void Scaling__set_RelativeTo_fn(Scaling* __this, uObject* value); void Scaling__get_Vector_fn(Scaling* __this, ::g::Uno::Float3* __retval); void Scaling__set_Vector_fn(Scaling* __this, ::g::Uno::Float3* value); struct Scaling : ::g::Fuse::Transform { uStrong<uObject*> _relativeTo; ::g::Uno::Float3 _vector; void ctor_3(); ::g::Uno::Float3 EffectiveVector(); bool IsIdentity(::g::Uno::Float3 v); uObject* RelativeTo(); void RelativeTo(uObject* value); ::g::Uno::Float3 Vector(); void Vector(::g::Uno::Float3 value); static Scaling* New2(); }; // } }} // ::g::Fuse
[ "jimmy_sidney@hotmail.es" ]
jimmy_sidney@hotmail.es
fe250d3c6a229614a32f013b50834c4c829ff148
1dc7c229808de2e1e62065e44c8ef12dc6d83345
/commandfile.cc
cb4545c5e798135e1e8870865f6002c9aa494a67
[]
no_license
nthallen/arp-scopex-sim
a95d779acf6e3a5d4429b40f0887e84b5bad0be8
66afa54767d7c79b8e22584295f0a1b185859b79
refs/heads/master
2021-01-19T03:34:27.973995
2020-03-25T17:37:07
2020-03-25T17:37:07
87,323,647
0
0
null
null
null
null
UTF-8
C++
false
false
2,659
cc
/* commandfile.cpp */ #include <strings.h> #include "commandfile.h" #include "nl.h" #include "nl_assert.h" variableDef::variableDef(dReal* ptr, const char *name) { this->ptr = ptr; this->name = name; } commandFile::commandFile(const char *filename) { nl_assert(filename != 0); ifp = fopen(filename, "r"); if (ifp == 0) { msg(3, "Unable to open command file %s", filename); } ibuf[0] = '\0'; lineNumber = 0; cmdfilename = filename; } commandFile::~commandFile() { if (ifp != 0) { fclose(ifp); ifp = 0; } } void commandFile::addVariable(dReal *ptr, const char *name) { nl_assert(ptr && name); variableDef var(ptr, name); vars.push_back(var); } /** * If a command is pending, execute it, then read the next line * and report its time offset. * Command Syntax: * <time> Set|Adjust <var> <value> * <time> and <value> are real numbers. * <time> must be non-negative and represents elapsed seconds since * the previous command. * <var> corresponds to whatever values are defined. * @return The number of seconds before the next command or -1 on * EOF or Quit */ double commandFile::eval() { if (ifp == 0) return -1; if (lineNumber > 0) { if (strcasecmp("quit",command) == 0) return (-1.); if (strcasecmp("noop",command) != 0) { // Must be 'Set' or 'Adjust' std::list<variableDef>::const_iterator ivar; for (ivar = vars.begin(); ivar != vars.end(); ++ivar) { if (strncasecmp(ivar->name, varname, IBUFLEN) == 0) { if (strcasecmp("set",command) == 0) { *(ivar->ptr) = commandValue; } else if (strcasecmp("adjust", command) == 0) { *(ivar->ptr) += commandValue; } else { msg(3, "%s:%d: Invalid command '%s'", cmdfilename, lineNumber, command); } break; } } if (ivar == vars.end()) { msg(2, "%s:%d: Unknown variable: '%s'", cmdfilename, lineNumber, command); } } } for (;;) { double Tdelta; ++lineNumber; if (fgets(ibuf, IBUFLEN, ifp) == 0) return -1; if (ibuf[0] != '#' && ibuf[0] != '\n') { int nconv = sscanf(ibuf, "%lf %s %s %lf", &Tdelta, &command, &varname, &commandValue); if (nconv == 2 && (strcasecmp("Quit", command) == 0 || strcasecmp("Noop", command) == 0)) { varname[0] = '\0'; } else if (nconv < 4) { msg(3, "%s:%d: Syntax error '%s'", cmdfilename, lineNumber, ibuf); } if (Tdelta < 0) { msg(3, "%s:%d: Invalid negative time delta", cmdfilename, lineNumber); } return Tdelta; } } }
[ "allen@huarp.harvard.edu" ]
allen@huarp.harvard.edu
870d5bba95e7e7bd25054b0e442bb0442c482ecb
a9ab72c3dd7fdfe8b6e0b1b5e296bf4c39b9989d
/round1/leetcode164.cpp
767f966d99bf2ece5e9ca2d79457a7e63271e80e
[]
no_license
keqhe/leetcode
cd82fc3d98b7fc71a9a08c5e438aa1f82737d76f
86b2a453255c909f94f9ea3be7f2a97a6680a854
refs/heads/master
2020-12-24T06:38:15.444432
2016-12-07T19:15:02
2016-12-07T19:15:02
48,405,123
0
0
null
null
null
null
UTF-8
C++
false
false
1,929
cpp
class Solution { public: //O(nlogn) solution int __maximumGap(vector<int>& nums) { if (nums.size() <= 1) return 0; sort(nums.begin(), nums.end()); int gap = 0; for (int i = 1; i < nums.size(); i ++) { int diff = nums[i] - nums[i-1]; gap = max(gap, diff); } return gap; } //O(n), radix sort which uses couting sort (which is stable sort) //ref: https://leetcode.com/discuss/53636/radix-sort-solution-in-java-with-explanation //O(d*(n+k)) where k = 9 in this case and is at most ~10 vector<int> radixSort(vector<int> & nums) { if (nums.size() <= 1) return nums; int base = 1; //1, 10, 100, 1000... vector<int> B(nums.size()); int m = 0; //max in the nums vector for (auto x: nums) { m = max(m, x); } while (m / base > 0) {//go through all digits, from LSB to MSB vector<int> C(10); for (int i = 0; i < nums.size(); i ++) { int digit = (nums[i]/base) % 10; C[digit] += 1; } for (int i = 1; i < 10; i ++) { C[i] = C[i] + C[i-1]; } for (int i = nums.size() - 1; i >= 0; i --) { int digit = (nums[i]/base) % 10; int pos = --C[digit]; B[pos] = nums[i]; } for (int i = 0; i < nums.size(); i ++) nums[i] = B[i]; base *= 10; } return B; } int maximumGap(vector<int>& nums) { if (nums.size() <= 1) return 0; vector<int> tmp = radixSort(nums); int gap = 0; for (int i = 1; i < tmp.size(); i ++) { int diff = tmp[i] - tmp[i-1]; gap = max(gap, diff); } return gap; } };
[ "keqhe@cs.wisc.edu" ]
keqhe@cs.wisc.edu
18a7a27082fbc3c0a0700adf53f6f51cd2cc5b2f
00a2411cf452a3f1b69a9413432233deb594f914
/include/sqthird/soui/components/TaskLoop/TaskLoop.cpp
420ba564fa89e43f913a2a0ce1ee469802aba279
[]
no_license
willing827/lyCommon
a16aa60cd6d1c6ec84c109c17ce2b26197a57550
206651ca3022eda45c083bbf6e796d854ae808fc
refs/heads/master
2021-06-26T21:01:21.314451
2020-11-06T05:34:23
2020-11-06T05:34:23
156,497,356
4
0
null
null
null
null
UTF-8
C++
false
false
4,192
cpp
#include "TaskLoop.h" #include <unknown/obj-ref-impl.hpp> #include <algorithm> #include <cassert> #include <deque> #include <limits> namespace SOUI { STaskLoop::STaskLoop() : _lock(), _runningLock(), _thread(), _itemsSem(), _items(), _hasRunningItem(false), _runningItem(0), _nextTaskID(0) { } STaskLoop::~STaskLoop() { stop(); } void STaskLoop::start(const char * pszName,Priority priority) { { SAutoLock autoLock(_lock); _items.clear(); if(pszName) _name = pszName; } _start(this, &STaskLoop::runLoopProc, priority); } void STaskLoop::stop() { int taskNum = getTaskCount(); _thread.stop(); _itemsSem.notify(); _thread.waitForStop(); } bool STaskLoop::isRunning() { return !_thread.isStopped(); } long STaskLoop::postTask(const IRunnable *runnable, bool waitUntilDone) { if (_thread.isStopped()) { delete runnable; return -1; } IRunnable *pCloneRunnable = runnable->clone(); if (Thread::getCurrentThreadID() == _thread.getThreadID() && waitUntilDone) { pCloneRunnable->run(); delete pCloneRunnable; return -1; } Semaphore semaphore; TaskItem item(pCloneRunnable); if (waitUntilDone) { item.semaphore = &semaphore; } _lock.Enter(); item.taskID = _nextTaskID; _nextTaskID = (_nextTaskID + 1) & ((std::numeric_limits<long>::max)()); _items.push_back(item); size_t totalSize = _items.size(); _lock.Leave(); _itemsSem.notify(); if (waitUntilDone) { int ret = semaphore.wait(); if (ret == RETURN_ERROR) { } } return item.taskID; } void STaskLoop::runLoopProc() { while (true) { if (_thread.isStopping()) { break; } _itemsSem.wait(10); { SAutoLock autoLock(_lock); SAutoLock autoRunningLock(_runningLock); _hasRunningItem = false; _runningItem = TaskItem(0); if (!_items.empty()) { _hasRunningItem = true; _runningItem = _items.front(); _items.pop_front(); } } { //执行一个task SAutoLock autoRunningLock(_runningLock); if (_hasRunningItem) { TaskItem item = _runningItem; item.runnable->run(); if (item.semaphore) { //通知一个task执行完毕 item.semaphore->notify(); } _hasRunningItem = false; _runningItem = TaskItem(0); } } }// end of while SAutoLock autoLock(_lock); size_t itemsSize = _items.size(); while (itemsSize > 0) { TaskItem item = _items.front(); _items.pop_front(); itemsSize--; if (item.semaphore) { item.semaphore->notify(); } } _items.clear(); } bool STaskLoop::getName(char * pszBuf, int nBufLen) { SAutoLock autoLock(_lock); if (_name.length() >= (size_t)nBufLen) return false; strcpy_s(pszBuf, nBufLen, _name.c_str()); return true; } void STaskLoop::cancelTasksForObject(void *object) { if (object == NULL) { return; } { SAutoLock autoLock(_lock); std::list<TaskItem>::iterator iter = _items.begin(); while (iter != _items.end()) { TaskItem &item = *iter; if (item.runnable->getObject() == object) { iter = _items.erase(iter); } else { ++iter; } } } { if (Thread::getCurrentThreadID() != _thread.getThreadID()) { _runningLock.Enter(); } if (Thread::getCurrentThreadID() != _thread.getThreadID()) { _runningLock.Leave(); } } { if (Thread::getCurrentThreadID() != _thread.getThreadID()) { _runningLock.Enter(); } if (Thread::getCurrentThreadID() != _thread.getThreadID()) { _runningLock.Leave(); } } } bool STaskLoop::cancelTask(long taskId) { SAutoLock autoLock(_lock); std::list<TaskItem>::iterator itemIt = _items.begin(); while (itemIt != _items.end()) { if (itemIt->taskID == taskId) { itemIt = _items.erase(itemIt); return true; } else { ++itemIt; } } return false; } int STaskLoop::getTaskCount() const { SAutoLock autoLock(_lock); return (int)_items.size(); } } SOUI_COM_C BOOL SOUI_COM_API SOUI::TASKLOOP::SCreateInstance(IObjRef **ppTaskLoop) { *ppTaskLoop = new STaskLoop(); return TRUE; }
[ "willing827@163.com" ]
willing827@163.com
c5c0f30d5361baf82e1bc037cca7558f6727eaea
20c9c11b8400c6605d869c84e69c41c5faa3f260
/2019/prac-2017-r2/D.cc
aa8ea2e04fc77b55a452d0c28d1d1041e215fc61
[]
no_license
blmarket/icpc
312ea2c667ec08d16864c1faa6fe75d3864dedbe
febfc2b758b7a4a4d6e5a6f05d24e3a964a3213a
refs/heads/master
2021-07-23T20:20:19.780664
2021-05-15T13:39:04
2021-05-15T13:39:04
4,029,598
3
1
null
null
null
null
UTF-8
C++
false
false
3,646
cc
#include <iostream> #include <algorithm> #include <unordered_set> #include <unordered_map> #include <cstdlib> #include <cstring> #include <cstdio> #include <sstream> #include <numeric> #include <iterator> #include <queue> #include <set> #include <map> #include <vector> #define mp make_pair #define each(it, v) for(auto &it: v) #define pb emplace_back using namespace std; typedef vector<int> VI; typedef vector<VI> VVI; typedef pair<int,int> PII; typedef long long LL; template<typename T> int size(const T &a) { return a.size(); } struct edge { int n, c, f; }; const int dx[] = {-1, 0, 0, 1}; const int dy[] = {0, -1, 1, 0}; int C, R, M; char D[105][105]; int ST[105][105]; vector<PII> VS, VT; vector<edge> net[205]; bool bound(int x, int y) { return x >= 0 && y >= 0 && x < R && y < C; } void add_edge(int s, int e, int c, int f) { for(auto &it: net[s]) { if(it.n == e && it.c == c) { it.f += f; return; } } net[s].pb(edge { e, c, f }); } bool mcmf(int s, int e) { int dist[205]; int back[205]; memset(dist, -1, sizeof(dist)); memset(back, -1, sizeof(back)); dist[s] = 0; priority_queue<PII> Q; Q.push(mp(0, s)); while(!Q.empty()) { int d, n; tie(d, n) = Q.top(); Q.pop(); if(dist[n] != -d) continue; for(auto &it: net[n]) { if(it.f == 0) continue; int dd = -d + it.c; if(dist[it.n] == -1 || dist[it.n] > dd) { back[it.n] = n; dist[it.n] = dd; Q.push(mp(-dd, it.n)); } } } if(dist[e] == -1) return false; while(e != s) { // cerr << e << " "; int ee = back[e]; int c = dist[e] - dist[ee]; add_edge(ee, e, c, -1); add_edge(e, ee, -c, 1); e = ee; } // cerr << s << endl; return true; } void process() { for(int i=0;i<205;i++) net[i].clear(); VS.clear(); VT.clear(); scanf(" %d %d %d", &C, &R, &M); memset(ST, 0, sizeof(ST)); for(int i=0;i<R;i++) { scanf(" %s", D[i]); for(int j=0;j<C;j++) { if(D[i][j] == 'S') { VS.pb(i,j); ST[i][j] = VS.size(); } if(D[i][j] == 'T') { VT.pb(i,j); ST[i][j] = -VT.size(); } } } int visit[105][105]; for(int ss=0;ss<VS.size();ss++) { net[203].pb(edge { ss+1, 0, 1 }); unordered_map<int, int> links {}; memset(visit, -1, sizeof(visit)); queue<PII> Q; visit[VS[ss].first][VS[ss].second] = 0; Q.push(mp(VS[ss].first, VS[ss].second)); while(!Q.empty()) { int x, y; tie(x, y) = Q.front(); Q.pop(); if(D[x][y] == '#') continue; int d = visit[x][y]; for(int i=0;i<4;i++) { int xx = x + dx[i], yy = y + dy[i]; if(d < M && bound(xx, yy) && visit[xx][yy] == -1) { visit[xx][yy] = visit[x][y] + 1; Q.push(mp(xx, yy)); } while(bound(xx, yy)) { if(D[xx][yy] == '#') break; if(D[xx][yy] == 'T') { int tt = -ST[xx][yy]; if (links[tt] == 0 || links[tt] > d) links[tt] = d; } xx += dx[i]; yy += dy[i]; } } } for(auto jt: links) { net[ss+1].pb(edge { jt.first + 100, jt.second, 1 }); } } for(int i=1;i<=VT.size();i++) { net[i + 100].pb(edge { 204, 0, 1 }); } int tot = 0; while(mcmf(203, 204)) { tot++; } cout << tot << endl; for(int i=1;i<=VS.size();i++) { for(auto &it: net[i]) { if(it.f == 0) { cout << i << " " << it.n - 100 << endl; } } } } int main(void) { int T; scanf(" %d", &T); for(int i=1;i<=T;i++) { printf("Case #%d: ", i); process(); } return 0; }
[ "heojeong@amazon.com" ]
heojeong@amazon.com
5521b39bbeac2b5a33170f2100ae99cd6524ac4d
c8b39acfd4a857dc15ed3375e0d93e75fa3f1f64
/Engine/Source/Programs/UnrealFrontend/Private/Commands/PackageCommand.cpp
c3fb74292f823ee1e6cbc091ca8ccf32d8b878f2
[ "MIT", "LicenseRef-scancode-proprietary-license" ]
permissive
windystrife/UnrealEngine_NVIDIAGameWorks
c3c7863083653caf1bc67d3ef104fb4b9f302e2a
b50e6338a7c5b26374d66306ebc7807541ff815e
refs/heads/4.18-GameWorks
2023-03-11T02:50:08.471040
2022-01-13T20:50:29
2022-01-13T20:50:29
124,100,479
262
179
MIT
2022-12-16T05:36:38
2018-03-06T15:44:09
C++
UTF-8
C++
false
false
652
cpp
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved. #include "PackageCommand.h" #include "Interfaces/ITargetPlatform.h" #include "Interfaces/ITargetPlatformManagerModule.h" #include "Misc/CommandLine.h" #include "Misc/CoreMisc.h" void FPackageCommand::Run( ) { FString SourceDir; FParse::Value(FCommandLine::Get(), TEXT("-SOURCEDIR="), SourceDir); ITargetPlatformManagerModule* TPM = GetTargetPlatformManager(); if (TPM) { const TArray<ITargetPlatform*>& Platforms = TPM->GetActiveTargetPlatforms(); for (int32 Index = 0; Index < Platforms.Num(); ++Index) { if (Platforms[Index]->PackageBuild(SourceDir)) { } } } }
[ "tungnt.rec@gmail.com" ]
tungnt.rec@gmail.com
edf90f3dc3e569d4b901f26bbe29053b0ced5bbb
ce4a3f0f6fad075b6bd2fe7d84fd9b76b9622394
/CWADReader.h
2ff3ab11a1f68a6e3d7dbefe3214976467ff5219
[]
no_license
codetiger/IrrNacl
c630187dfca857c15ebfa3b73fd271ef6bad310f
dd0bda2fb1c2ff46813fac5e11190dc87f83add7
refs/heads/master
2021-01-13T02:10:24.919588
2012-07-22T06:27:29
2012-07-22T06:27:29
4,461,459
5
2
null
null
null
null
UTF-8
C++
false
false
4,546
h
// Copyright (C) 2002-2011 Thomas Alten // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h #ifndef __C_WAD_READER_H_INCLUDED__ #define __C_WAD_READER_H_INCLUDED__ #include "IrrCompileConfig.h" #ifdef __IRR_COMPILE_WITH_WAD_ARCHIVE_LOADER_ #include "IReferenceCounted.h" #include "IReadFile.h" #include "irrArray.h" #include "irrString.h" #include "IFileSystem.h" #include "CFileList.h" namespace irr { namespace io { #if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) # pragma pack( push, packing ) # pragma pack( 1 ) # define PACK_STRUCT #elif defined( __GNUC__ ) # define PACK_STRUCT __attribute__((packed)) #else # error compiler not supported #endif enum eWADFileTypes { WAD_FORMAT_UNKNOWN = 0, WAD_FORMAT_QUAKE2 = 1, WAD_FORMAT_HALFLIFE = 2, WAD_CMP_NONE = 0, WAD_CMP_LZSS = 1, WAD_TYP_NONE = 0, WAD_TYP_LABEL = 1, WAD_TYP_LUMPY = 64, // 64 + grab command number WAD_TYP_PALETTE = 64, WAD_TYP_QTEX = 65, WAD_TYP_QPIC = 66, WAD_TYP_SOUND = 67, WAD_TYP_MIPTEX = 68, WAD_TYP_MIPTEX_HALFLIFE = 67, WAD_TYP_FONT = 70, }; struct SWADFileHeader { c8 tag[4]; // type of WAD format WAD2 = quake2, WAD3 = halflife u32 numlumps; u32 infotableofs; } PACK_STRUCT; struct SWADFileEntryOriginal { u32 filepos; u32 disksize; u32 size; // uncompressed u8 type; u8 compression; u8 pad[2]; u8 name[16]; // must be null terminated } PACK_STRUCT; // Default alignment #if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) # pragma pack( pop, packing ) #endif #undef PACK_STRUCT struct SWADFileEntry { io::path simpleFileName; bool operator < (const SWADFileEntry& other) const { return simpleFileName < other.simpleFileName; } io::path wadFileName; SWADFileEntryOriginal header; }; //! Archiveloader capable of loading WAD Archives class CArchiveLoaderWAD : public IArchiveLoader { public: //! Constructor CArchiveLoaderWAD(io::IFileSystem* fs); //! returns true if the file maybe is able to be loaded by this class //! based on the file extension (e.g. ".zip") virtual bool isALoadableFileFormat(const io::path& filename) const; //! Check if the file might be loaded by this class /** Check might look into the file. \param file File handle to check. \return True if file seems to be loadable. */ virtual bool isALoadableFileFormat(io::IReadFile* file) const; //! Check to see if the loader can create archives of this type. /** Check based on the archive type. \param fileType The archive type to check. \return True if the archile loader supports this type, false if not */ virtual bool isALoadableFileFormat(E_FILE_ARCHIVE_TYPE fileType) const; //! Creates an archive from the filename /** \param file File handle to check. \return Pointer to newly created archive, or 0 upon error. */ virtual IFileArchive* createArchive(const io::path& filename, bool ignoreCase, bool ignorePaths) const; //! creates/loads an archive from the file. //! \return Pointer to the created archive. Returns 0 if loading failed. virtual io::IFileArchive* createArchive(io::IReadFile* file, bool ignoreCase, bool ignorePaths) const; private: io::IFileSystem* FileSystem; }; //! reads from WAD class CWADReader : public IFileArchive, virtual CFileList { public: CWADReader(IReadFile* file, bool ignoreCase, bool ignorePaths); virtual ~CWADReader(); // file archive methods //! return the id of the file Archive virtual const io::path& getArchiveName() const; //! opens a file by file name virtual IReadFile* createAndOpenFile(const io::path& filename); //! opens a file by index virtual IReadFile* createAndOpenFile(u32 index); //! returns the list of files virtual const IFileList* getFileList() const; //! get the class Type virtual E_FILE_ARCHIVE_TYPE getType() const { return EFAT_WAD; } private: io::path Type; //! scans for a local header, returns false if there is no more local file header. bool scanLocalHeader(); //! splits filename from zip file into useful filenames and paths void extractFilename(SWADFileEntry* entry); io::path Base; io::path MountPoint; IReadFile* File; eWADFileTypes WadType; SWADFileHeader Header; //core::array<SWADFileEntry> FileInfo; io::IFileSystem* FileSystem; }; } // end namespace io } // end namespace irr #endif #endif // #ifdef __IRR_COMPILE_WITH_WAD_ARCHIVE_LOADER_
[ "smackallgames@smackall-2bbd93.(none)" ]
smackallgames@smackall-2bbd93.(none)
613b6ac1521073ccd27dc6199c9d7426f38e1e20
cd4a412ce5519c733492b593e12e2a8369e6ee74
/Test_app/src/main/jni/InfoFrameList.h
0551ee8edc2b4c863f1cd00628f48a1510157797
[]
no_license
xtremi/TowerDefenceApp
f15e2030e65c07016606dae8e143e47fb9a0011f
91d91fbe60b2f6495618c4710745d74356e00609
refs/heads/master
2023-03-10T07:19:35.125248
2019-06-15T10:17:45
2019-06-15T10:17:45
189,074,010
1
0
null
null
null
null
UTF-8
C++
false
false
1,011
h
#pragma once #include "InfoFrame.h" #include <iostream> #include <map> class InfoFrameList : public InfoFrame { public: InfoFrameList(const glm::vec2& size, int headerCorner = 0, char* name = NULL) : InfoFrame(size, headerCorner, name){ }; public: void setListItemValue(const uString& key, const uString& val); void setListItemValue(const uString& key, float val, int prec = 2); void setListItemValue(const uString& key, int val); void setListItemValue(const uString& key, bool val); private: /*struct LoggedItem { TextSprite* nameSpr = NULL; TextSprite* valueSpr = NULL; };*/ glm::vec2 txtOffset = glm::vec2(10.0f); float textSize = 15.0f; float dx1 = 120.0f; float dx2 = 60.0f; float dy1 = 10.0f; float dy2 = 10.0f; int rows = 0; glm::vec3 textColor = glm::vec3(0.22f, 1.0f, 0.8f); glm::vec3 backgroundColor = glm::vec3(0.0f); float backgroundAlpha = 0.5f; void addListItem(const uString& name); void resizeBackground(); //std::map<const char*, LoggedItem> dataMap; };
[ "remi.lanza@jotne.com" ]
remi.lanza@jotne.com
aa061b17a447352f22e7a1e5f7ad5abbdda78028
a3b2d9b592787810c6c10f2b4e886d2e1f7652fe
/data/protein.cpp
a043ff5e5c45c0bab22dca89a545f19417345ed5
[]
no_license
emptyewer/Interlink
4e7c87a0ed52af091d8c2ccbdb973b39a0515048
7d4874e3c810c23ebdf0bbb8dde109e40d122d7a
refs/heads/master
2021-01-19T13:47:00.107221
2018-07-20T23:16:51
2018-07-20T23:16:51
87,597,951
0
1
null
2017-04-27T19:28:12
2017-04-08T00:58:20
C++
UTF-8
C++
false
false
1,237
cpp
#include "protein.h" /* When any Protein instance is initialized with a filename, the sequence is * automatically digested with the default enzyme (Trypsin). Alternately, diget * can also be called as a public method if a different enzyme is chosen.*/ Protein::Protein(QString filename) { this->filename = filename; // All protein sequence processing is perfomed using PProcessor protein_processor = new PProcessor(); // Parse and obtain protein sequence and name from fasta files NameSequence ns = protein_processor->parse_fasta(filename); name = ns.name; sequence = ns.sequence; } // Only digests Trypsin. #### Future To Do: Need to implement other preteases void Protein::digest(int missed, QList<int> charges) { peptides = protein_processor->digest(sequence, missed, charges); } void Protein::fragment_ions(QList<int> charges, QList<FragmentType> n_types, QList<FragmentType> c_types) { protein_processor->fragment(&peptides, charges, n_types, c_types); } QString Protein::get_sequence() { return sequence; } void Protein::set_sequence(QString seq) { sequence = seq; } QVector<Peptide *> Protein::get_peptides() { return peptides; } QString Protein::get_name() { return name; }
[ "venky.krishna@icloud.com" ]
venky.krishna@icloud.com
3202081a98ddcb0294e5eec0fe7f56c98ee45cf9
78a8eef4cd5c07366fdea34865fca31e61e6278c
/VehicleTemplate/Source/VehicleTemplate/SacrificePlayerState.cpp
5c5904fde8678dd406ef00d2ee507f5740406e74
[]
no_license
dynamiquel/Sacrifice
d5e55592324bab14db3203455e20740d12c69099
8aa36017340c1e9586583c5d7499cb3dc43892e6
refs/heads/main
2023-02-20T02:18:45.043062
2021-01-23T20:49:31
2021-01-23T20:49:31
312,891,366
0
0
null
null
null
null
UTF-8
C++
false
false
116
cpp
// Fill out your copyright notice in the Description page of Project Settings. #include "SacrificePlayerState.h"
[ "50085636+dynamiquel@users.noreply.github.com" ]
50085636+dynamiquel@users.noreply.github.com
ba82b6c9f0dbffbe45fa09646f03eca5960c3c28
ec9ba9e2d7219ba1ff73e21f97693697cd3b0d1a
/plugins/modelInfo/modelInfo.cpp
79ba93cd28d5ba21be5b3791734f0205b7dd9a88
[]
no_license
nilfm/fib-grafics
d7935a42f785ddc42032ccd65234b8c103faaed6
826f93ede89a5495703ddda2304818626518001e
refs/heads/master
2022-07-19T00:16:07.324551
2020-05-23T21:31:40
2020-05-23T21:31:40
242,142,681
0
0
null
null
null
null
UTF-8
C++
false
false
1,133
cpp
#include "modelInfo.h" #include "glwidget.h" void ModelInfo::writeModelInfo() { cout << "Total number of loaded objects: " << scene()->objects().size() << endl; int polygons = 0; int vertices = 0; int triangles = 0; for (const auto& obj : scene()->objects()) { polygons += obj.faces().size(); for (const auto& face : obj.faces()) { vertices += face.numVertices(); triangles += face.numVertices() == 3; } } cout << "Total number of polygons: " << polygons << endl; cout << "Total number of vertices: " << vertices << endl; cout << "Percentage of polygons that are triangles: " << 100.0*triangles/polygons << "%" << endl; } void ModelInfo::onPluginLoad() { writeModelInfo(); } void ModelInfo::onObjectAdd() { writeModelInfo(); } bool ModelInfo::drawScene() { return false; // return true only if implemented } bool ModelInfo::drawObject(int) { return false; // return true only if implemented } bool ModelInfo::paintGL() { return false; // return true only if implemented } void ModelInfo::keyPressEvent(QKeyEvent *) { } void ModelInfo::mouseMoveEvent(QMouseEvent *) { }
[ "nil.fons@gmail.com" ]
nil.fons@gmail.com
662c97e99273296c4e01a995bb3a60f6995c1d3f
0f44aa77e5c0f115826c3a2704199dba340da256
/ural/1082.cpp
bda45bc16ae37204334091da9fec911c0f172e50
[]
no_license
aswmtjdsj/oj-code
79952149cab8cdc1ab88e7aba1a8670d49d9726c
bb0fed587246687d2e9461408a029f0727da9e11
refs/heads/master
2020-12-24T16:32:26.674883
2017-01-10T00:08:29
2017-01-10T00:08:29
18,274,815
0
0
null
null
null
null
UTF-8
C++
false
false
255
cpp
#include <iostream> #include <cstdio> using namespace std; int main() { int n; while(scanf("%d",&n) == 1) { for(int i = 1;i <= n;i++) { printf("%d",i); printf("%c",(i == n) ? '\n':' '); } } }
[ "bupt.aswmtjdsj@gmail.com" ]
bupt.aswmtjdsj@gmail.com
07b4a5e0799f54f903237fbea0981fce5b6dc8e4
365913bcc02bfdf6b6f6c246855144663f7e052b
/Code/GraphMol/MolDraw2D/MolDraw2DQt.cpp
6b209208dc6a0b9f6a46c20f0145c2c8a846b7e9
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
permissive
UnixJunkie/rdkit
d8458eadca78ba1714be5c55ba75c8e164fc1479
3ddb54aeef0666aeaa2200d2137884ec05cb6451
refs/heads/master
2021-06-01T22:26:53.201525
2017-08-15T17:00:30
2017-08-15T17:00:30
100,572,461
2
0
NOASSERTION
2019-05-29T00:58:25
2017-08-17T07:03:53
C++
UTF-8
C++
false
false
5,680
cpp
// // @@ All Rights Reserved @@ // This file is part of the RDKit. // The contents are covered by the terms of the BSD license // which is included in the file license.txt, found at the root // of the RDKit source tree. // // Original author: David Cosgrove (AstraZeneca) // 19th June 2014 // #include "MolDraw2DQt.h" #include <QPainter> #include <QString> using namespace boost; using namespace std; namespace RDKit { // **************************************************************************** MolDraw2DQt::MolDraw2DQt(int width, int height, QPainter &qp, int panelWidth, int panelHeight) : MolDraw2D(width, height, panelWidth, panelHeight), qp_(qp) {} // **************************************************************************** void MolDraw2DQt::setColour(const DrawColour &col) { MolDraw2D::setColour(col); QColor this_col(int(255.0 * col.get<0>()), int(255.0 * col.get<1>()), int(255.0 * col.get<2>())); QPen pen(this_col); pen.setJoinStyle(Qt::RoundJoin); pen.setColor(this_col); qp_.setPen(pen); QBrush brush(this_col); brush.setStyle(Qt::SolidPattern); qp_.setBrush(brush); } // **************************************************************************** void MolDraw2DQt::drawLine(const Point2D &cds1, const Point2D &cds2) { Point2D c1 = getDrawCoords(cds1); Point2D c2 = getDrawCoords(cds2); const DashPattern &dashes = dash(); QPen pen = qp_.pen(); if (dashes.size()) { QVector<qreal> dd; for (unsigned int di = 0; di < dashes.size(); ++di) dd << dashes[di]; pen.setDashPattern(dd); } else { pen.setStyle(Qt::SolidLine); } pen.setWidth(lineWidth()); qp_.setPen(pen); qp_.drawLine(QPointF(c1.x, c1.y), QPointF(c2.x, c2.y)); } // **************************************************************************** // draw the char, with the bottom left hand corner at cds void MolDraw2DQt::drawChar(char c, const Point2D &cds) { QRectF br = qp_.boundingRect(0, 0, 100, 100, Qt::AlignLeft | Qt::AlignBottom, QString(c)); qp_.drawText(QRectF(cds.x, cds.y - br.height(), br.width(), br.height()), Qt::AlignLeft | Qt::AlignBottom, QString(c), &br); } // **************************************************************************** void MolDraw2DQt::drawPolygon(const vector<Point2D> &cds) { PRECONDITION(cds.size() >= 3, "must have at least three points"); #ifdef NOTYET QBrush brush("Black"); brush.setStyle(Qt::SolidPattern); DrawColour cc = colour(); brush.setColor( QColor(255.0 * cc.get<0>(), 255.0 * cc.get<1>(), 255.0 * cc.get<2>())); #endif qp_.save(); QBrush brush = qp_.brush(); if (fillPolys()) brush.setStyle(Qt::SolidPattern); else brush.setStyle(Qt::NoBrush); qp_.setBrush(brush); QPointF points[cds.size()]; for (unsigned int i = 0; i < cds.size(); ++i) { Point2D lc = getDrawCoords(cds[i]); points[i] = QPointF(lc.x, lc.y); } qp_.drawConvexPolygon(points, cds.size()); qp_.restore(); } // **************************************************************************** void MolDraw2DQt::clearDrawing() { QColor this_col(int(255.0 * drawOptions().backgroundColour.get<0>()), int(255.0 * drawOptions().backgroundColour.get<1>()), int(255.0 * drawOptions().backgroundColour.get<2>())); qp_.setBackground(QBrush(this_col)); qp_.fillRect(0, 0, width(), height(), this_col); } // **************************************************************************** void MolDraw2DQt::setFontSize(double new_size) { MolDraw2D::setFontSize(new_size); double font_size_in_points = fontSize() * scale(); #ifdef NOTYET cout << "initial font size in points : " << qp_.font().pointSizeF() << endl; cout << "font_size_in_points : " << font_size_in_points << endl; #endif QFont font(qp_.font()); font.setPointSizeF(font_size_in_points); qp_.setFont(font); while (1) { double old_font_size_in_points = font_size_in_points; double font_size_in_points = fontSize() * scale(); if (fabs(font_size_in_points - old_font_size_in_points) < 0.1) { break; } QFont font(qp_.font()); font.setPointSizeF(font_size_in_points); qp_.setFont(font); calculateScale(); } } // **************************************************************************** // using the current scale, work out the size of the label in molecule // coordinates void MolDraw2DQt::getStringSize(const string &label, double &label_width, double &label_height) const { label_width = 0.0; label_height = 0.0; TextDrawType draw_mode = TextDrawNormal; // 0 for normal, 1 for superscript, 2 for subscript QString next_char(" "); bool had_a_super = false; for (int i = 0, is = label.length(); i < is; ++i) { // setStringDrawMode moves i along to the end of any <sub> or <sup> // markup if ('<' == label[i] && setStringDrawMode(label, draw_mode, i)) { continue; } next_char[0] = label[i]; QRectF br = qp_.boundingRect(0, 0, 100, 100, Qt::AlignBottom | Qt::AlignLeft, next_char); label_height = br.height() / scale(); double char_width = br.width() / scale(); if (TextDrawSubscript == draw_mode) { char_width *= 0.5; } else if (TextDrawSuperscript == draw_mode) { char_width *= 0.5; had_a_super = true; } label_width += char_width; } // subscript keeps its bottom in line with the bottom of the bit chars, // superscript goes above the original char top by a quarter if (had_a_super) { label_height *= 1.25; } } } // EO namespace RDKit
[ "greg.landrum@gmail.com" ]
greg.landrum@gmail.com
1f00b190e911bc49ea9d6306d2c7b1542528f127
798b1f598416bea9b95c094fcee4cc0c0b63a67a
/hpp-7ddce130c9d7/hpp/menu.h
941542b97ed4cc935abf33964260efe4cfbc21f3
[]
no_license
YuhBoyMatty/hpphack
87e0d90869f93efb5342b27cce2d8c28e78f3069
2b18000ec3bce8db49c3ff84c1ea68e2bf0d3e7e
refs/heads/master
2023-05-27T02:42:49.503107
2021-06-10T17:30:05
2021-06-10T17:30:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,922
h
namespace Menu { enum TabsList { Tab_RageBot, Tab_LegitBot, Tab_Visuals, Tab_Kreedz, Tab_Misc, Tab_GUI, Tab_Settings }; enum WeaponGroupsList { WeaponGroup_Pistol, WeaponGroup_SubMachineGun, WeaponGroup_Rifle, WeaponGroup_Shotgun, WeaponGroup_Sniper }; enum FilesList { File_RageBot, File_LegitBot, File_Visuals, File_Kreedz, File_Misc, File_Gui }; static const char* const pcszFilesList[] = { "ragebot.ini", "legitbot.ini", "visuals.ini", "kreedz.ini", "misc.ini", "gui.ini" }; class Tab { public: static TabsList GetCurrentTab(); static void ClearCurrentWeaponId(); static bool Labels(); static void RageBot(); static void LegitBot(); static void Visuals(); static void Misc(); static void Kreedz(); static void GUI(); static void Settings(); private: static TabsList m_CurrentTabId; static WeaponIdType m_CurrentWeaponId; }; class Settings { public: static void Load(); static void Save(); static void RestorePopupOpen(); static void SaveAsPopupOpen(); static void RemovePopupOpen(); static void RenamePopupOpen(); static void OpenSettingsFolder(); static void OpenSettingsFile(); static void OpenSettingsPath(); }; class ModalPopup { public: static void SettingsSaveAs(); static void SettingsRename(); static void SettingsRemove(); static void SettingsRestore(); }; struct window_parameters_s { ImVec2 WindowSize; ImVec2 ModalSize; ImVec2 ModalButtonSize; char* Title; float ChildWidth; float NextChildPosX; float ChildCenterPos; float ItemWidth; }; void RefreshSettings(); void DrawCursor(); void DrawMenuFade(); void DrawMenu(); void DrawPlayerList(); extern char szSettingsBuffer[40]; extern unsigned int iSelectedSettings; extern unsigned int iSelectedIniFile; extern std::vector<std::string> sSettingsList; extern bool bUpdateFileContent; }
[ "31269663+mr-nv@users.noreply.github.com" ]
31269663+mr-nv@users.noreply.github.com
9a88e2b0b621693433e1da2274d3b766e50c01db
9fbb4f4fcf1ba449279773b5244664d3dbbfa335
/UnitTests/PrimitiveTypes/4_7_Tests.cpp
a0ae26336cc463db59b1cb7b9ca2df0f8fdb3dcb
[]
no_license
ChrisMurimPark/EPI
39f7ace21ff0a239e099f09fa09820d67dea4d6c
f38071d3b138b9449c9e73d7b12ec09ac06f134a
refs/heads/master
2021-05-01T12:25:28.124726
2018-08-06T01:39:45
2018-08-06T01:39:45
121,065,706
0
0
null
null
null
null
UTF-8
C++
false
false
837
cpp
// // 4_7_Tests.cpp // UnitTests // // Created by Chris (Murim) Park on 7/31/18. // Copyright © 2018 Chris (Murim) Park. All rights reserved. // #include <gtest/gtest.h> #include "../../EPI/PrimitiveTypes/4.7/Solution1.hpp" const double tolerance = 1e-10; TEST(ExponentTest, TestPowerOfZero) { EXPECT_NEAR(1, S1::exp(5, 0), tolerance); EXPECT_NEAR(1, S1::exp(999, 0), tolerance); } TEST(ExponentTest, TestPowerOfOne) { EXPECT_NEAR(42, S1::exp(42, 1), tolerance); EXPECT_NEAR(723, S1::exp(723, 1), tolerance); } TEST(ExponentTest, TestPositivePowers) { EXPECT_NEAR(32, S1::exp(2, 5), tolerance); EXPECT_NEAR(2097152, S1::exp(8, 7), tolerance); } TEST(ExponentTest, TestNegativePowers) { EXPECT_NEAR(0.125, S1::exp(2, -3), tolerance); EXPECT_NEAR(0.000003814697266, S1::exp(8, -6), tolerance); }
[ "chrispark@wustl.edu" ]
chrispark@wustl.edu
27ac3c8795bc871047f98a301355d770b380e09f
3574cef2feec7fc6a651e22f6d772dcc06833428
/Engine_Algorithms/mge_v18_student_version/src/mge/behaviours/RotatingBehaviour.cpp
93dcbf8d3ae2d4b1b9f07288806cd2d0d3baf86f
[]
no_license
MerryLovasz/advanced-tools
c91a950e14469308f96fbdc7abe2fb617ec100dd
c50f3c59a07ef42978adb317fe65df16e37926a9
refs/heads/master
2021-06-12T21:25:27.122909
2020-04-16T16:42:40
2020-04-16T16:42:40
254,403,611
0
0
null
null
null
null
UTF-8
C++
false
false
998
cpp
#include "mge/behaviours/RotatingBehaviour.hpp" #include "mge/core/GameObject.hpp" #include <cstdlib> MovingBehaviour::MovingBehaviour(glm::vec3 pVelocity) :AbstractBehaviour(), velocity(pVelocity) { //ctor velocity = pVelocity; float x = static_cast <float> (rand()) / static_cast <float> (RAND_MAX); float y = static_cast <float> (rand()) / static_cast <float> (RAND_MAX); float z = static_cast <float> (rand()) / static_cast <float> (RAND_MAX); velocity = glm::vec3(x, y, z); } MovingBehaviour::~MovingBehaviour() { //dtor } void MovingBehaviour::update(float pStep) { //Taken from Quadtree project by Eelco Jannick float radius = 15; glm::vec3 worldPosition = _owner->getWorldPosition(); if (worldPosition.x < -radius || worldPosition.x > radius) velocity.x = -velocity.x; if (worldPosition.y < -radius || worldPosition.y > radius) velocity.y = -velocity.y; if (worldPosition.z < -radius || worldPosition.z > radius) velocity.z = -velocity.z; _owner->translate(velocity); }
[ "a.arisci@hotmail.com" ]
a.arisci@hotmail.com
e6fcb1e5d00e2f41d3bdb4c0749fc51a7c96b84f
924763dfaa833a898a120c411a5ed3b2d9b2f8c7
/compiled/cpp_stl_11/bits_enum.h
96b6bed326a6173f2a0d57387e19c895ca1f7fbc
[ "MIT" ]
permissive
kaitai-io/ci_targets
31257dfdf77044d32a659ab7b8ec7da083f12d25
2f06d144c5789ae909225583df32e2ceb41483a3
refs/heads/master
2023-08-25T02:27:30.233334
2023-08-04T18:54:45
2023-08-04T18:54:45
87,530,818
4
6
MIT
2023-07-28T22:12:01
2017-04-07T09:44:44
C++
UTF-8
C++
false
false
1,071
h
#pragma once // This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild #include "kaitai/kaitaistruct.h" #include <stdint.h> #include <memory> #if KAITAI_STRUCT_VERSION < 9000L #error "Incompatible Kaitai Struct C++/STL API: version 0.9 or later is required" #endif class bits_enum_t : public kaitai::kstruct { public: enum animal_t { ANIMAL_CAT = 0, ANIMAL_DOG = 1, ANIMAL_HORSE = 4, ANIMAL_PLATYPUS = 5 }; bits_enum_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent = nullptr, bits_enum_t* p__root = nullptr); private: void _read(); void _clean_up(); public: ~bits_enum_t(); private: animal_t m_one; animal_t m_two; animal_t m_three; bits_enum_t* m__root; kaitai::kstruct* m__parent; public: animal_t one() const { return m_one; } animal_t two() const { return m_two; } animal_t three() const { return m_three; } bits_enum_t* _root() const { return m__root; } kaitai::kstruct* _parent() const { return m__parent; } };
[ "kaitai-bot@kaitai.io" ]
kaitai-bot@kaitai.io
0cf9e7f2f1d625fef3aae1d372575b4d467b5e9d
59dcbe703e0f4f7edb65d29da6163baf6c46a75d
/STM32F7-MISS-TouchGFX_WRK/Application/Gui/generated/images/src/__designer/blue_icons_user_48.cpp
cb7576cbd1496deefc48894995cab16f14569585
[]
no_license
sphinxyun/STM32F7-MISS-TouchGFX
65fb99d877696fd80ef018aee4dfa70a29c99228
9cc1fd80d2086fa6a76cea5cc323672e62cc6fb6
refs/heads/master
2020-04-18T13:33:18.202134
2019-01-18T23:49:38
2019-01-18T23:49:38
null
0
0
null
null
null
null
UTF-8
C++
false
false
51,812
cpp
// -alpha_dither yes -dither 2 -non_opaque_image_format ARGB8888 -opaque_image_format RGB565 0x8149ae46 // Generated by imageconverter. Please, do not edit! #include <touchgfx/hal/Config.hpp> LOCATION_EXTFLASH_PRAGMA KEEP extern const unsigned char _blue_icons_user_48[] LOCATION_EXTFLASH_ATTRIBUTE = // 46x46 ARGB8888 pixels. { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x08, 0x48, 0x44, 0x48, 0x51, 0x48, 0x48, 0x48, 0x9a, 0x48, 0x44, 0x48, 0xcb, 0x48, 0x44, 0x48, 0xe7, 0x48, 0x48, 0x48, 0xfb, 0x48, 0x44, 0x48, 0xfb, 0x48, 0x44, 0x48, 0xe7, 0x48, 0x48, 0x48, 0xcb, 0x48, 0x44, 0x48, 0x96, 0x48, 0x44, 0x48, 0x51, 0x48, 0x48, 0x48, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x04, 0x48, 0x48, 0x48, 0x75, 0x48, 0x44, 0x48, 0xeb, 0x40, 0x48, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xe7, 0x48, 0x44, 0x48, 0x75, 0x48, 0x44, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x24, 0x48, 0x48, 0x48, 0xcf, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xcf, 0x48, 0x48, 0x48, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x2c, 0x48, 0x48, 0x48, 0xe7, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xef, 0x48, 0x44, 0x48, 0xdb, 0x48, 0x48, 0x48, 0xdb, 0x48, 0x44, 0x48, 0xef, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x44, 0x40, 0xe7, 0x48, 0x48, 0x48, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x14, 0x48, 0x48, 0x48, 0xe3, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xd3, 0x48, 0x48, 0x48, 0x61, 0x40, 0x48, 0x40, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x44, 0x40, 0x1c, 0x48, 0x48, 0x48, 0x65, 0x48, 0x48, 0x48, 0xcf, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xdf, 0x48, 0x48, 0x48, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0xaa, 0x40, 0x48, 0x40, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xfb, 0x40, 0x44, 0x40, 0x75, 0x48, 0x48, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x04, 0x48, 0x48, 0x48, 0x75, 0x48, 0x44, 0x48, 0xfb, 0x40, 0x48, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x44, 0x40, 0xa2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x34, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x44, 0x40, 0x61, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0xa2, 0x40, 0x44, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0x9e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0xa2, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x04, 0x48, 0x48, 0x48, 0xef, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xfb, 0x40, 0x48, 0x40, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0x20, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xef, 0x48, 0x44, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x28, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0xcb, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x48, 0x40, 0x45, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0x9a, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0x4d, 0x48, 0x44, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x48, 0x40, 0x8e, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x41, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0x9e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x9e, 0x40, 0x48, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x48, 0x40, 0x28, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xae, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0xb2, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x49, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xc7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0xcb, 0x48, 0x44, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x96, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x48, 0x40, 0x82, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x44, 0x48, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x48, 0x40, 0xba, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x48, 0x48, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x24, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x48, 0x40, 0xb6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0xba, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x28, 0x40, 0x44, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xb6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x9a, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0x51, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x48, 0x40, 0x61, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xcb, 0x48, 0x48, 0x48, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x10, 0x48, 0x48, 0x48, 0xcb, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0x14, 0x48, 0x44, 0x48, 0xf7, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xdf, 0x40, 0x44, 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x48, 0x40, 0x08, 0x48, 0x44, 0x48, 0xe3, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x44, 0x48, 0xf3, 0x48, 0x48, 0x48, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0x82, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0x41, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x44, 0x40, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x04, 0x48, 0x44, 0x48, 0xae, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x79, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xa2, 0x48, 0x44, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x44, 0x40, 0x41, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xcf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x44, 0x40, 0xcf, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0x04, 0x48, 0x44, 0x48, 0xe7, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0x61, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xe7, 0x48, 0x44, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x44, 0x40, 0x86, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xf7, 0x48, 0x48, 0x48, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x2c, 0x40, 0x48, 0x40, 0xf7, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x10, 0x40, 0x48, 0x40, 0xe7, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0x65, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x44, 0x40, 0xe7, 0x48, 0x48, 0x48, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x10, 0x48, 0x48, 0x48, 0x69, 0x48, 0x44, 0x48, 0xcf, 0x48, 0x44, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x4d, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xcb, 0x48, 0x44, 0x48, 0x65, 0x48, 0x48, 0x48, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x00, 0x48, 0x48, 0x48, 0x3c, 0x48, 0x44, 0x48, 0x9e, 0x40, 0x48, 0x40, 0xf3, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xeb, 0x48, 0x48, 0x48, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x44, 0x40, 0x0c, 0x48, 0x48, 0x48, 0xef, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xf3, 0x48, 0x48, 0x48, 0x9e, 0x48, 0x44, 0x48, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x08, 0x48, 0x44, 0x48, 0x69, 0x40, 0x48, 0x40, 0xd7, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xef, 0x48, 0x48, 0x48, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x45, 0x48, 0x48, 0x48, 0xef, 0x40, 0x44, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x48, 0x48, 0xd7, 0x48, 0x44, 0x48, 0x65, 0x40, 0x44, 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x04, 0x48, 0x48, 0x48, 0x6d, 0x48, 0x48, 0x48, 0xe7, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xeb, 0x48, 0x44, 0x48, 0x86, 0x48, 0x48, 0x48, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0x14, 0x48, 0x44, 0x48, 0x8a, 0x40, 0x44, 0x40, 0xef, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xe7, 0x48, 0x48, 0x48, 0x6d, 0x48, 0x44, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x34, 0x48, 0x44, 0x48, 0xcf, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xfb, 0x48, 0x48, 0x48, 0xb6, 0x48, 0x48, 0x48, 0x55, 0x40, 0x44, 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0x08, 0x48, 0x44, 0x48, 0x55, 0x40, 0x48, 0x40, 0xb6, 0x48, 0x44, 0x48, 0xfb, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xcf, 0x48, 0x48, 0x48, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x59, 0x48, 0x48, 0x48, 0xf7, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xe7, 0x40, 0x48, 0x40, 0x82, 0x48, 0x44, 0x48, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x48, 0x40, 0x1c, 0x48, 0x44, 0x48, 0x86, 0x48, 0x48, 0x48, 0xe7, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xf7, 0x48, 0x44, 0x48, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x55, 0x48, 0x48, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x48, 0x40, 0xdb, 0x48, 0x44, 0x48, 0x5d, 0x48, 0x48, 0x48, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0x04, 0x48, 0x48, 0x48, 0x5d, 0x48, 0x44, 0x48, 0xdf, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0x51, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0x20, 0x48, 0x48, 0x48, 0xf3, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xf3, 0x40, 0x48, 0x40, 0x71, 0x48, 0x48, 0x48, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x44, 0x40, 0x04, 0x48, 0x44, 0x48, 0x75, 0x48, 0x48, 0x48, 0xf3, 0x40, 0x44, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xef, 0x48, 0x44, 0x48, 0x20, 0x48, 0x44, 0x48, 0x96, 0x40, 0x48, 0x40, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xe3, 0x40, 0x44, 0x40, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0x28, 0x48, 0x44, 0x48, 0xe7, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0x92, 0x48, 0x44, 0x48, 0xdf, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x44, 0x40, 0x38, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xdb, 0x48, 0x48, 0x48, 0xfb, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xdf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0xe3, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xf7, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xd3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x44, 0x48, 0xe3, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xd3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x44, 0x40, 0xdf, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xfb, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x44, 0x48, 0xdf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0xe7, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xfb, 0x48, 0x48, 0x48, 0xdb, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0x59, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xdb, 0x48, 0x44, 0x48, 0x8a, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xdb, 0x40, 0x48, 0x40, 0xcb, 0x48, 0x44, 0x48, 0xcb, 0x48, 0x48, 0x48, 0xcb, 0x48, 0x44, 0x48, 0xcb, 0x48, 0x44, 0x48, 0xcb, 0x48, 0x48, 0x48, 0xcb, 0x48, 0x44, 0x48, 0xcb, 0x40, 0x48, 0x40, 0xcb, 0x48, 0x44, 0x48, 0xcb, 0x48, 0x48, 0x48, 0xcb, 0x48, 0x44, 0x48, 0xcb, 0x40, 0x48, 0x40, 0xcb, 0x48, 0x44, 0x48, 0xcb, 0x48, 0x44, 0x48, 0xcb, 0x40, 0x48, 0x40, 0xcb, 0x48, 0x44, 0x48, 0xcb, 0x48, 0x48, 0x48, 0xcb, 0x40, 0x44, 0x40, 0xcb, 0x48, 0x44, 0x48, 0xcb, 0x48, 0x48, 0x48, 0xcb, 0x40, 0x44, 0x40, 0xcb, 0x48, 0x48, 0x48, 0xcb, 0x48, 0x44, 0x48, 0xcb, 0x40, 0x48, 0x40, 0xcb, 0x48, 0x44, 0x48, 0xcb, 0x48, 0x48, 0x48, 0xcb, 0x40, 0x44, 0x40, 0xcb, 0x48, 0x48, 0x48, 0xcb, 0x48, 0x44, 0x48, 0xcb, 0x48, 0x44, 0x48, 0xcb, 0x40, 0x48, 0x40, 0xcb, 0x48, 0x44, 0x48, 0xcb, 0x48, 0x48, 0x48, 0xcb, 0x40, 0x44, 0x40, 0xcb, 0x48, 0x44, 0x48, 0xdf, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0x86, 0x48, 0x44, 0x48, 0x14, 0x48, 0x48, 0x48, 0xeb, 0x40, 0x44, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xeb, 0x40, 0x48, 0x40, 0x14, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0x3c, 0x48, 0x44, 0x48, 0xeb, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xeb, 0x40, 0x48, 0x40, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0x18, 0x48, 0x44, 0x48, 0x8a, 0x40, 0x48, 0x40, 0xdb, 0x40, 0x48, 0x40, 0xfb, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x40, 0x48, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x44, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xff, 0x48, 0x48, 0x48, 0xff, 0x40, 0x44, 0x40, 0xff, 0x48, 0x48, 0x48, 0xfb, 0x48, 0x48, 0x48, 0xdb, 0x48, 0x44, 0x48, 0x8a, 0x40, 0x48, 0x40, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
[ "poryzala@gmail.com" ]
poryzala@gmail.com
493fd54866d3c346cd96c81a14a77f4639214f57
92d4587306dc66cd9e86b3edf447ead7ba197837
/N6LYT/ghpsdr3/trunk/src/HPSDRProgrammer/mainwindow.h
68d4b0a5bf4eb15a719a1466ec9d8c610077aa7f
[]
no_license
ZHJEE/OpenHPSDR-SVN
6b469826054356da4607097d17a00aa234e1924b
efe1cc275cdeaf7e0314e0eba068c2033ceb16f6
refs/heads/master
2022-01-23T07:21:43.714129
2019-05-11T07:18:33
2019-05-11T07:18:33
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,231
h
/* * File: mainwindow.h * Author: John Melton, G0ORX/N6LYT * * Created on 23 November 2010 */ /* Copyright (C) * 2009 - John Melton, G0ORX/N6LYT * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <pcap.h> #include <QMainWindow> #include <QUdpSocket> #include <QHostAddress> #include "Interfaces.h" #include "ReceiveThread.h" #include "RawReceiveThread.h" #include "Discovery.h" #include "Metis.h" #include "AboutDialog.h" #include "Version.h" // states #define IDLE 0 #define ERASING 1 #define PROGRAMMING 2 #define ERASING_ONLY 3 #define READ_MAC 4 #define READ_IP 5 #define WRITE_IP 6 #define JTAG_INTERROGATE 7 #define JTAG_PROGRAM 8 #define FLASH_ERASING 9 #define FLASH_PROGRAM 10 #define TIMEOUT 10 // ms #define MAX_ERASE_TIMEOUTS (2000) // 20 seconds namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); #ifdef Q_WS_MAC void setPath(char* path); #endif public slots: void quit(); void about(); void interfaceSelected(int); void metisSelected(); void hermesSelected(); void browse(); void program(); void erase(); void getMAC(); void getIP(); void setIP(); void discover(); void discovery_timeout(); // SLOTS for RawReceiveThread void erase_timeout(); void eraseCompleted(); void nextBuffer(); void timeout(); void macAddress(unsigned char*); void ipAddress(unsigned char*); void fpgaId(unsigned char*); void metis_found(Metis*); void metisSelected(int); void tabChanged(int); void jtagInterrogate(); void jtagBrowse(); void jtagProgram(); void jtagFlashBrowse(); void jtagFlashProgram(); void nextJTAGBuffer(); void startJTAGFlashErase(); private: Ui::MainWindow *ui; //void loadPOF(QString filename); int loadRBF(QString filename); void eraseData(); void readMAC(); void readIP(); void writeIP(); void sendRawCommand(unsigned char command); void sendCommand(unsigned char command); void sendRawData(); void sendData(); void sendJTAGData(); void sendJTAGFlashData(); void idle(); void status(QString text); void bootloaderProgram(); void flashProgram(); void bootloaderErase(); void flashErase(); int loadMercuryRBF(QString filename); int loadPenelopeRBF(QString filename); void jtagBootloaderProgram(); void jtagEraseData(); //void jtagFlashProgram(); void loadFlash(); #ifdef Q_WS_MAC char* myPath; #endif QString text; bool isMetis; Interfaces interfaces; long ip; QString interfaceName; QString hwAddress; unsigned char hw[6]; long metisIP; QString metisHostAddress; int s; char* data; int offset; int start; int end; int blocks; int size; //depending on how and what we are programming // 0 if programming flash on metis in raw modfe // blocks if programming flash on metis in command mode // bytes (blocks*256) if programming flash on JTAG (Mercury or Penelope) unsigned char data_command; pcap_t *handle; QList<Metis*> metis; int state; int percent; int eraseTimeouts; QUdpSocket socket; Discovery* discovery; ReceiveThread* receiveThread; RawReceiveThread* rawReceiveThread; bool bootloader; long fpga_id; AboutDialog aboutDialog; }; #endif // MAINWINDOW_H
[ "john.d.melton@googlemail.com" ]
john.d.melton@googlemail.com
f2cdcc9bd5d27e074e13d841688482cf6bb2c9d2
c074c5a4277a3632c144238a057ad00f7057f025
/TeamMembers.h
878de2294cc704ef8c22b0ab31ac08268c10150d
[]
no_license
CDDDJ-A-2015/Project
7d15eaf64c9ab044e078bda266fc1196782c674e
ef1a83521fc5385cfa16901cbb9b36a57cd53396
refs/heads/master
2018-12-28T15:36:21.521073
2015-05-26T14:37:59
2015-05-26T14:37:59
32,861,354
0
0
null
null
null
null
UTF-8
C++
false
false
760
h
/* * File: TeamMembers.h * Author: dm940 * * Created on 21 May 2015, 10:10 PM */ #ifndef _TEAMMEMBERS_H #define _TEAMMEMBERS_H #include "ui_TeamMembers.h" #include "Packets.h" #include "Client_Side.h" #include <vector> extern int sockfd; class TeamMembers : public QDialog { Q_OBJECT public: TeamMembers(); virtual ~TeamMembers(); void setID(int, int); int getGID(); QString getGName(); public slots: void clickbAssign(); void clickbRemove(); protected: void accept(); private: Ui::TeamMembers widget; void getUserList(); std::vector<User_List> Global_User_List; int type; int id; std::vector<Task_Assignment> tAssigned; void getTaskAssignments(); void saveTaskAssignment(); void saveProjectTeam(); }; #endif /* _TEAMMEMBERS_H */
[ "dm940@uowmail.edu.au" ]
dm940@uowmail.edu.au
1bef120039e58c93605e14e409e7b185eb1dd89b
168b8e5a1522c7ab93698804490c3b1a7a24191c
/顺时针打印二维数组.cpp
d53bcfc59ded47a1c115c1416a788901688695bd
[]
no_license
Dianmu/Code-for-daily-practices
8b98924f78bde8321bd1a0345cc579b5c511bc48
bf29e4b0ab06bb4cf551f9100ba89852534749b8
refs/heads/master
2021-01-21T16:34:52.079293
2017-06-12T08:54:42
2017-06-12T08:54:42
91,895,484
0
0
null
null
null
null
UTF-8
C++
false
false
1,825
cpp
#include <iostream> #include <ctime> #include <cstdlib> #include <cstdio> #include <unordered_map> #include <vector> #include <algorithm> #include <set> #include <stack> using namespace std; //This is to try file manipulations //===================================================================== void clockvise_print(const vector<vector<int> >&vec,FILE*fp){ int m=vec.size(),n=vec[0].size(); int loop=min(m,n)/2+1; for(int i=0;i<loop;++i){ for(int j=i;j<n-i;++j){ cout<<vec[i][j]<<"->"; fprintf(fp,"%i->",vec[i][j]); } for(int j=i+1;j<m-i;++j){ cout<<vec[j][n-1-i]<<"->"; fprintf(fp,"%i->",vec[j][n-1-i]); } for(int j=n-2-i;j>=i&&m-1-i!=i;--j){ cout<<vec[m-1-i][j]<<"->"; fprintf(fp,"%i->",vec[m-1-i][j]); } for(int j=m-2-i;j>i&&i!=n-1-i;--j){ cout<<vec[j][i]<<"->"; fprintf(fp,"%i->",vec[j][i]); } } cout<<"NULL"<<endl; } //===================================================================== int main(){ time_t start=clock(); srand(time(NULL)); //===================================================================== const int r=3; const int c=3; FILE*fp; fp=fopen("test1.txt","w"); vector<vector<int> >vec(r,vector<int>(c)); int ele=0; for(int i=0;i<r;++i) for(int j=0;j<c;++j) vec[i][j]=ele++; for(int i=0;i<r;++i){ for(int j=0;j<c;++j) cout<<vec[i][j]<<'\t'; cout<<endl; } clockvise_print(vec,fp); fclose(fp); //===================================================================== time_t end=clock(); cout<<'\n'<<"【Running time : "; cout<<(double)(end-start)*1000/CLOCKS_PER_SEC<<" ms】\n\n"; return 0; }
[ "Dianmu@users.noreply.github.com" ]
Dianmu@users.noreply.github.com
6fa3c3038579faf47d8b33a31bd2d58a195e2724
13064a8616cb26abb103f046ffe563d5a66876c6
/Codejam/unsolved/CodeJam2017QualificationD_FashionShow/CodeJam2017QualificationD_FashionShow/solve2.cpp
e5eee61cd616fdb1de53987c2ff0a9ef8575ff73
[ "MIT" ]
permissive
PuppyRush/Algorithms
edfb9ea3745342ebfe24e0c92c3cce59f6e461c7
9adfa86b915e50ca25e610db3f3bb66d602ec0e7
refs/heads/master
2022-10-09T12:05:56.530860
2022-09-28T14:41:18
2022-09-28T14:41:18
88,719,709
1
0
null
null
null
null
UTF-8
C++
false
false
4,791
cpp
#define _CRT_SECURE_NO_WARNINGS #define MIN(a,b) ((a>b)?b:a) #define MAX(a,b) ((a>b)?b:a) #define FOR(i,size) for(i ; i < size ; ++i) #define FOR_IN(i,size) for(i ; i <= size ; ++i) #define FOR_REV(i) for(i ; i >=0 ; --i) #define FOR_REV_SIZE(i,size) for(i ; i >=size ; --i) #include <iostream> #include <cstring> #include <cmath> #include <algorithm> #include <vector> #include <stack> #include <queue> #include <map> using namespace std; typedef const int C_INT; typedef unsigned int UINT; typedef const unsigned int C_UINT; typedef unsigned char UCHAR; typedef const unsigned char C_UCHAR; typedef const char C_CHAR; typedef const unsigned long long C_ULL; typedef unsigned long long ULL; typedef std::pair<int, int> PINT; typedef std::vector<std::vector<int>> V2INT; typedef std::vector<int> VINT; typedef std::vector<string> VSTR; #define X 'x' #define O 'o' #define P '+' #define EMPTY '.' #define WALL 'w' #define m mul[y][x] #define p plus[y][x] #define g grid[y][x] C_INT LINE[][2] = { { 1,0 },{ -1,0 },{0,1},{0,-1} }; C_INT DIAG[][2] = { { 1,1 },{ -1,-1 },{ -1,1 },{ 1,-1 } }; using namespace std; char** copyGrid(char** src,C_INT size,char c) { char **grid = new char*[size]; int i = 0; FOR(i, size) { grid[i] = new char[size]; memset(grid[i] + 1, EMPTY, size - 2); } int y, x; y = x = 1; FOR(y, size-1) { x = 1; FOR(x, size-1) { if (src[y][x] == c || src[y][x] == O) g = c; } } return grid; } bool diag(char** src, C_INT y, C_INT x) { bool empty = true; int l = 0; int i = 0; FOR(i, 4) { int _y = y + LINE[i][0]; int _x = x + LINE[i][1]; if (src[_y][_x] == X) return true; else if (src[_y][_x] != EMPTY &&src[_y][_x] != WALL) empty = false; } if (empty) true; return false; } bool line(char** src, C_INT y, C_INT x) { bool empty = true; int l = 0; int i = 0; FOR(i, 4) { int _y = y + DIAG[i][0]; int _x = x + DIAG[i][1]; if (src[_y][_x] == P) return true; else if (src[_y][_x] != EMPTY && src[_y][_x] != WALL) empty = false; } if (empty) true; return false; } void set(char **src, C_INT y, C_INT x, C_INT comp[4][2], char c, map<PINT, char> &s) { int i = 0; FOR(i, 4) { int _y = y + comp[i][0]; int _x = x + comp[i][1]; if (src[_y][_x] == c) break; } if (i == 4) { //cout << y << " " << x << " " << c << endl; src[y][x] = c; s[PINT(x, y)] = c; } } void print(char **grid, C_INT size) { int y, x = 0; y = x = 1; FOR(y, size-1) { x = 1; FOR(x, size-1 ) cout << g; cout << endl; } cout << "-------------" << endl; } int main() { freopen("C:\\Users\\goodd\\Downloads\\D-small-practice.in", "r", stdin); //freopen("C:\\Users\\goodd\\Desktop\\D-small.out", "w", stdout); int size = 0; ios::sync_with_stdio(false); cin.tie(nullptr); cout.precision(10); int caseSize = 0; scanf("%d", &caseSize); for (int t = 0; t < caseSize; ++t) { int i = 0; int added = 0; map<PINT, char> s; int number, cloths; scanf("%d %d", &number, &cloths); //init char **grid = new char*[number + 2]; i = 0; grid = new char*[number + 2]; FOR(i, number + 2) { grid[i] = new char[number + 2]; int l = 0; FOR(l, number + 2) grid[i][l] = EMPTY; } i = 0; FOR(i, number + 2) { grid[i][0] = WALL; grid[i][number + 1] = WALL; grid[0][i] = WALL; grid[number + 1][i] = WALL; } i = 0; FOR(i, cloths) { int x, y; char c; scanf("%s %d %d", &c, &y, &x); grid[y][x] = c; } //copy auto plus = copyGrid(grid, number + 2,P); auto mul = copyGrid(grid, number + 2,X); //subtitute int x = 1, y = 1; FOR(y, number + 1) { x = 1; FOR(x, number + 1) { if ((g != X ) && line(grid, y, x)) p = P; if ((g != P ) &&diag(grid, y, x)) m = X; } } print(plus, number + 2); print(mul, number + 2); //fill x = 1, y = 1; FOR(y, number + 1) { x = 1; FOR(x, number + 1) { if (p == EMPTY && g == EMPTY) { set(plus, y, x, DIAG, X, s); } } } x = 1, y = 1; FOR(y, number + 1) { x = 1; FOR(x, number + 1) { if (m == EMPTY && g == EMPTY) set(mul, y, x, LINE, X, s); } } //merge int score = 0; x = 1, y = 1; FOR(y, number + 1) { x = 1; FOR(x, number + 1) { if (p == P && m == X) { added++; score += 2; auto it = s.find(PINT(x, y)); if (it != s.end()) s.erase(it); if (!(g == O && p == P)) { s[PINT(x, y)] = O; } } else if (p == P) { score += 1; } else if (m == X) { score += 1; } } } cout << "Case #" << (t + 1) << ": " << score << " " << s.size() << endl; i = 0; auto it = s.begin(); while (it != s.end()) { cout << it->second << " " << it->first.second << " " << it->first.first << endl; it++; } } return 0; }
[ "gooddaumi@naver.com" ]
gooddaumi@naver.com
ac5e45506dbea97abbe5ff64f9e3e4da7d9e5d06
97d1bfba6adafc0fbdd68bdfbeb314d33aa364be
/CodeForces/91/a/a.cpp
fbff259947512c8b43ca16e52ecb5cfea40e2256
[]
no_license
github188/MyCode-1
26069f08222b154c08308a72a61f8e9f879a447e
2227b9dd9a13114a1b2b294c3e70253b16f88538
refs/heads/master
2020-12-24T11:24:54.215740
2014-04-21T04:15:54
2014-04-21T04:15:54
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,067
cpp
#include<stdio.h> #include<iostream> using namespace std; long long a[10000]; int num; int main() { num=1;a[0]=0; for (int i=1;i<=9;i++) { long long fou=4,thr=3,ten=10,base=0; for (int j=1;j<=i;j++) {base=base*ten+fou;} for (int j=0;j<(1<<i);j++) { long long ans=base,b=j,rk=1; while (b!=0) { if ((b&1)==1) {ans+=rk*thr;} rk=rk*ten; b=b/2; } a[num]=ans;num++; } } long long fou=4,thr=3,ten=10,base=0,ans=0,one=1; for (int j=1;j<=10;j++) {base=base*ten+fou;} a[num]=base;num++; long long l,r; cin>>l>>r; for (int i=1;i<num;i++) { if ((a[i-1]<l)&&(l<=a[i])) { if ((a[i-1]<r)&&(r<=a[i])) {ans=(r-l+one)*a[i];break;} ans+=(a[i]-l+one)*a[i]; } if ((l<a[i-1])&&(a[i]<=r)) {ans+=(a[i]-a[i-1])*a[i];if (r==a[i]) break;} if ((a[i-1]<r)&&(r<=a[i])) {ans+=(r-a[i-1])*a[i];} } cout<<ans<<endl; return 0; }
[ "wcwswswws@gmail.com" ]
wcwswswws@gmail.com
38ea4b03829bda49febfc986303f399a4fff7778
1753eaec1e236d043c3e9dc7f163c4790ba699df
/src/kitti_writer.cpp
f6c0f738ef5e71e225c042758be010ded8f73bb5
[]
no_license
SignalImageCV/ROSKittiWriter
4b028810b52f00cd54dea22086cae7e8d92109ec
888dc429c7239d4e32857eef2630c9a21f48b72a
refs/heads/master
2020-06-07T14:41:22.718934
2019-04-20T13:34:43
2019-04-20T13:34:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
9,651
cpp
/*====================================================================== * Author : Haiming Zhang * Email : zhanghm_1995@qq.com * Version : 2018年12月7日 * Copyright : * Descriptoin : * References : ======================================================================*/ #include <ros_kitti_writer/kitti_writer.h> // C++ #include <chrono> #include <fstream> #include <cv_bridge/cv_bridge.h> #include <sensor_msgs/image_encodings.h> #include <cstdio> // Boost #include <boost/filesystem/operations.hpp> #include <boost/format.hpp> // Opencv #include <opencv2/opencv.hpp> // PCL #include <pcl_conversions/pcl_conversions.h> #include <pcl_ros/point_cloud.h> #include <pcl/point_types.h> using namespace std; static string folder_image_02 = "image_02/"; static string folder_image_03 = "image_03/"; static string folder_velodyne_points = "velodyne_points/"; static string format_image = "%|010|.png"; static string formate_velo = "%|010|.bin"; /*! * @brief From ROS Nano second time to date time * Example: * uint64_t ros_tt = image->header.stamp.toNSec(); string date = toDateTime(ros_tt);// 2011-09-26 13:04:32.351950336 * @param ros_time * @return */ static string toDateTime(uint64_t ros_time) { // Convert to chrono nanoseconds type chrono::nanoseconds tp(ros_time), tt_nano(ros_time); // Get nanoseconds part tp -= chrono::duration_cast<chrono::seconds>(tp); //to_time_t方法把时间点转化为time_t time_t tt = std::time_t(chrono::duration_cast<chrono::seconds>(chrono::nanoseconds(tt_nano)).count()); //把time_t转化为tm tm *localTm = localtime(&tt); //tm格式化输出 char buffer[20]; char format[] = "%Y-%m-%d %H:%M:%S"; strftime(buffer, sizeof(buffer), format, localTm); string nanosec_format = "%|09|"; stringstream ss; ss<<buffer<<"."<<(boost::format(nanosec_format) % tp.count()).str(); return ss.str(); } KittiWriter::KittiWriter(ros::NodeHandle nh, ros::NodeHandle private_nh): count_(0), processthread_(NULL), processthreadfinished_(false), is_one_image_(false) { // Define lidar parameters if (!private_nh.getParam("root_directory", root_directory_)) { ROS_ERROR("Have't set $(root_directory) or $(velo_topic) parameters valid value!"); ros::shutdown(); } // Define semantic parameters string velo_topic(""), left_camera_topic(""), right_camera_topic(""); private_nh.param("velo_topic",velo_topic, velo_topic); private_nh.param("left_camera_topic", left_camera_topic, left_camera_topic); private_nh.param("right_camera_topic", right_camera_topic, right_camera_topic); // Mush have point cloud topic if (velo_topic.empty()) { ROS_ERROR("Must set $(velo_topic) parameter valid value!"); ros::shutdown(); } // Print parameters ROS_INFO_STREAM("root_directory: " << root_directory_); ROS_INFO_STREAM("velo_topic: " << velo_topic); ROS_INFO_STREAM("left_camera_topic: " << left_camera_topic); ROS_INFO_STREAM("right_camera_topic: " << right_camera_topic); /// -----According to input topics to decide sync which messages----- if (left_camera_topic.empty() ^ right_camera_topic.empty()) { // if only has one camera image topic string image_topic = left_camera_topic.empty() ? right_camera_topic : left_camera_topic; imageCloudSync_ = new sensors_fusion::ImageCloudMessagesSync(nh, image_topic, velo_topic); is_one_image_ = true; ROS_WARN_STREAM("Only one image topic... "); } else if (!left_camera_topic.empty() && !right_camera_topic.empty()) {// has two camera image topic stereoCloudSync_ = new sensors_fusion::StereoMessagesSync(nh, left_camera_topic,right_camera_topic, velo_topic); } else { ROS_ERROR("Must set one of left_camera_topic or right_camera_topic parameter valid value!"); ros::shutdown(); } // Create formatted folders createFormatFolders(); processthread_ = new boost::thread(boost::bind(&KittiWriter::process,this)); } KittiWriter::~KittiWriter() { processthreadfinished_ = true; processthread_->join(); } void KittiWriter::process() { // main loop while(!processthreadfinished_&&ros::ok()) { sensors_fusion::SynchronizedMessages imagePair; bool flag = false; if (is_one_image_) { flag = imageCloudSync_->is_valid(); imagePair = imageCloudSync_->getSyncMessages(); } else { flag = stereoCloudSync_->is_valid(); imagePair = stereoCloudSync_->getSyncMessages(); } // Get synchronized image with bboxes and cloud data if (!flag) { ROS_ERROR_THROTTLE(1,"Waiting for image and lidar topics!!!"); continue; } ROS_WARN_STREAM("Begin saving data "<<count_); // process image saveImage02(imagePair.image1_ptr); saveImage03(imagePair.image2_ptr); // Preprocess point cloud saveVelodyne(imagePair.cloud_ptr); ++ count_; }// end while } void KittiWriter::createFormatFolders() { // Create image 02 and 03 folder image_02_dir_path_ = boost::filesystem::path(root_directory_) / folder_image_02 / "data"; if(!boost::filesystem::exists(image_02_dir_path_)) { boost::filesystem::create_directories(image_02_dir_path_); } timestamp_image02_path_ = boost::filesystem::path(root_directory_) / folder_image_02 / "timestamps.txt"; image_03_dir_path_ = boost::filesystem::path(root_directory_) / folder_image_03 / "data"; if(!boost::filesystem::exists(image_03_dir_path_)) { boost::filesystem::create_directories(image_03_dir_path_); } timestamp_image03_path_ = boost::filesystem::path(root_directory_) / folder_image_03 / "timestamps.txt"; // Create velodyne_points folder velo_dir_path_ = boost::filesystem::path(root_directory_) / folder_velodyne_points / "data"; if(!boost::filesystem::exists(velo_dir_path_)) { boost::filesystem::create_directories(velo_dir_path_); } timestamp_velo_path_ = boost::filesystem::path(root_directory_) / folder_velodyne_points / "timestamps.txt"; } void KittiWriter::saveImage02(const sensor_msgs::Image::ConstPtr & image) { // Convert image detection grid to cv mat cv_bridge::CvImagePtr cv_det_grid_ptr; try{ cv_det_grid_ptr = cv_bridge::toCvCopy(image, sensor_msgs::image_encodings::BGR8); } catch (cv_bridge::Exception& e){ ROS_ERROR("cv_bridge exception: %s", e.what()); return; } cv::Mat raw_image = cv_det_grid_ptr->image; // Get image name boost::filesystem::path image_02_file_path = image_02_dir_path_ /(boost::format(format_image)%count_).str(); string image_02_file_name = image_02_file_path.string(); // 1) Save image cv::imwrite(image_02_file_name, raw_image); // 2) Save timestamps fstream filestr; filestr.open (timestamp_image02_path_.string().c_str(), fstream::out|fstream::app); uint64_t ros_tt = image->header.stamp.toNSec(); string date = toDateTime(ros_tt); filestr<<date<<std::endl; filestr.close(); } void KittiWriter::saveImage03(const sensor_msgs::Image::ConstPtr & image) { // Convert image detection grid to cv mat cv_bridge::CvImagePtr cv_det_grid_ptr; try{ cv_det_grid_ptr = cv_bridge::toCvCopy(image, sensor_msgs::image_encodings::BGR8); } catch (cv_bridge::Exception& e){ ROS_ERROR("cv_bridge exception: %s", e.what()); return; } cv::Mat raw_image = cv_det_grid_ptr->image; // Get image name boost::filesystem::path image_03_file_path = image_03_dir_path_ /(boost::format(format_image)%count_).str(); string image_03_file_name = image_03_file_path.string(); // 1) Save image cv::imwrite(image_03_file_name, raw_image); // 2) Save timestamps fstream filestr; filestr.open (timestamp_image03_path_.string().c_str(), fstream::out|fstream::app); uint64_t ros_tt = image->header.stamp.toNSec(); string date = toDateTime(ros_tt); filestr<<date<<std::endl; filestr.close(); } void KittiWriter::saveVelodyne(const sensor_msgs::PointCloud2::ConstPtr& cloud) { // Convert to pcl cloud pcl::PointCloud<pcl::PointXYZI>::Ptr pcl_in(new pcl::PointCloud<pcl::PointXYZI>); sensor_msgs::PointCloud2Ptr cloudMsg(new sensor_msgs::PointCloud2(*cloud)); cloudMsg->fields[3].name = "intensity"; pcl::fromROSMsg(*cloudMsg, *pcl_in); // cout size_t num = pcl_in->size(); // Get cloud name boost::filesystem::path velodyne_file_path = velo_dir_path_ /(boost::format(formate_velo)%count_).str(); string velodyne_file_name = velodyne_file_path.string(); // Begin save data FILE* stream = fopen(velodyne_file_name.c_str(), "wb"); if(stream == NULL) { cout<<"error open "<<velodyne_file_name<<endl; return ; } float* data = (float*)malloc(4*num*sizeof(float)); float* px = data + 0; float* py = data + 1; float* pz = data + 2; float* pI = data + 3; for(int i = 0; i < num; ++i) { *px = (float)pcl_in->points[i].x; *py = (float)pcl_in->points[i].y; *pz = (float)pcl_in->points[i].z; *pI = (float)pcl_in->points[i].intensity; px += 4; py += 4; pz += 4; pI += 4; } fwrite(data, sizeof(float), 4*num, stream); fclose(stream); // Save timestamps fstream filestr; filestr.open (timestamp_velo_path_.string().c_str(), fstream::out|fstream::app); uint64_t ros_tt = cloud->header.stamp.toNSec(); string date = toDateTime(ros_tt); filestr<<date<<std::endl; filestr.close(); }
[ "zhanghm_1995@qq.com" ]
zhanghm_1995@qq.com
207ab3833541a3e64f8fa6591b389ec1585e1273
dee9762ef3c35c9cd3b31578b827f4348250969f
/thrift/compiler/test/fixtures/stream/gen-cpp2/PubSubStreamingService.h
28a03a2cbc65531fb3344d01e7452f911eee9f10
[ "Apache-2.0" ]
permissive
spacehopy/fbthrift
fa6296ef4cbe4ca01286da512dec5a096939e992
e26d115692be0a8c899c70c11853e1e26d86aba1
refs/heads/master
2023-02-08T07:36:27.082814
2020-12-28T13:50:33
2020-12-28T13:52:45
null
0
0
null
null
null
null
UTF-8
C++
false
false
12,420
h
/** * Autogenerated by Thrift for src/module.thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ #pragma once #include <thrift/lib/cpp2/gen/service_h.h> #include "thrift/compiler/test/fixtures/stream/gen-cpp2/PubSubStreamingServiceAsyncClient.h" #include "thrift/compiler/test/fixtures/stream/gen-cpp2/module_types.h" #include <thrift/lib/cpp2/async/ServerStream.h> namespace folly { class IOBuf; class IOBufQueue; } namespace apache { namespace thrift { class Cpp2RequestContext; class BinaryProtocolReader; class CompactProtocolReader; namespace transport { class THeader; } }} namespace cpp2 { class PubSubStreamingServiceSvAsyncIf { public: virtual ~PubSubStreamingServiceSvAsyncIf() {} virtual void async_tm_returnstream(std::unique_ptr<apache::thrift::HandlerCallback<apache::thrift::ServerStream<int32_t>>> callback, int32_t i32_from, int32_t i32_to) = 0; virtual folly::Future<apache::thrift::ServerStream<int32_t>> future_returnstream(int32_t i32_from, int32_t i32_to) = 0; virtual folly::SemiFuture<apache::thrift::ServerStream<int32_t>> semifuture_returnstream(int32_t i32_from, int32_t i32_to) = 0; virtual void async_tm_streamthrows(std::unique_ptr<apache::thrift::HandlerCallback<apache::thrift::ServerStream<int32_t>>> callback, int32_t foo) = 0; virtual folly::Future<apache::thrift::ServerStream<int32_t>> future_streamthrows(int32_t foo) = 0; virtual folly::SemiFuture<apache::thrift::ServerStream<int32_t>> semifuture_streamthrows(int32_t foo) = 0; virtual void async_tm_boththrows(std::unique_ptr<apache::thrift::HandlerCallback<apache::thrift::ServerStream<int32_t>>> callback, int32_t foo) = 0; virtual folly::Future<apache::thrift::ServerStream<int32_t>> future_boththrows(int32_t foo) = 0; virtual folly::SemiFuture<apache::thrift::ServerStream<int32_t>> semifuture_boththrows(int32_t foo) = 0; virtual void async_tm_responseandstreamthrows(std::unique_ptr<apache::thrift::HandlerCallback<apache::thrift::ResponseAndServerStream<int32_t,int32_t>>> callback, int32_t foo) = 0; virtual folly::Future<apache::thrift::ResponseAndServerStream<int32_t,int32_t>> future_responseandstreamthrows(int32_t foo) = 0; virtual folly::SemiFuture<apache::thrift::ResponseAndServerStream<int32_t,int32_t>> semifuture_responseandstreamthrows(int32_t foo) = 0; virtual void async_eb_returnstreamFast(std::unique_ptr<apache::thrift::HandlerCallback<apache::thrift::ServerStream<int32_t>>> callback, int32_t i32_from, int32_t i32_to) = 0; }; class PubSubStreamingServiceAsyncProcessor; class PubSubStreamingServiceSvIf : public PubSubStreamingServiceSvAsyncIf, public apache::thrift::ServerInterface { public: typedef PubSubStreamingServiceAsyncProcessor ProcessorType; std::unique_ptr<apache::thrift::AsyncProcessor> getProcessor() override; virtual apache::thrift::ServerStream<int32_t> returnstream(int32_t /*i32_from*/, int32_t /*i32_to*/); folly::Future<apache::thrift::ServerStream<int32_t>> future_returnstream(int32_t i32_from, int32_t i32_to) override; folly::SemiFuture<apache::thrift::ServerStream<int32_t>> semifuture_returnstream(int32_t i32_from, int32_t i32_to) override; void async_tm_returnstream(std::unique_ptr<apache::thrift::HandlerCallback<apache::thrift::ServerStream<int32_t>>> callback, int32_t i32_from, int32_t i32_to) override; virtual apache::thrift::ServerStream<int32_t> streamthrows(int32_t /*foo*/); folly::Future<apache::thrift::ServerStream<int32_t>> future_streamthrows(int32_t foo) override; folly::SemiFuture<apache::thrift::ServerStream<int32_t>> semifuture_streamthrows(int32_t foo) override; void async_tm_streamthrows(std::unique_ptr<apache::thrift::HandlerCallback<apache::thrift::ServerStream<int32_t>>> callback, int32_t foo) override; virtual apache::thrift::ServerStream<int32_t> boththrows(int32_t /*foo*/); folly::Future<apache::thrift::ServerStream<int32_t>> future_boththrows(int32_t foo) override; folly::SemiFuture<apache::thrift::ServerStream<int32_t>> semifuture_boththrows(int32_t foo) override; void async_tm_boththrows(std::unique_ptr<apache::thrift::HandlerCallback<apache::thrift::ServerStream<int32_t>>> callback, int32_t foo) override; virtual apache::thrift::ResponseAndServerStream<int32_t,int32_t> responseandstreamthrows(int32_t /*foo*/); folly::Future<apache::thrift::ResponseAndServerStream<int32_t,int32_t>> future_responseandstreamthrows(int32_t foo) override; folly::SemiFuture<apache::thrift::ResponseAndServerStream<int32_t,int32_t>> semifuture_responseandstreamthrows(int32_t foo) override; void async_tm_responseandstreamthrows(std::unique_ptr<apache::thrift::HandlerCallback<apache::thrift::ResponseAndServerStream<int32_t,int32_t>>> callback, int32_t foo) override; void async_eb_returnstreamFast(std::unique_ptr<apache::thrift::HandlerCallback<apache::thrift::ServerStream<int32_t>>> callback, int32_t i32_from, int32_t i32_to) override; }; class PubSubStreamingServiceSvNull : public PubSubStreamingServiceSvIf { public: }; class PubSubStreamingServiceAsyncProcessor : public ::apache::thrift::GeneratedAsyncProcessor { public: const char* getServiceName() override; void getServiceMetadata(apache::thrift::metadata::ThriftServiceMetadataResponse& response) override; using BaseAsyncProcessor = void; protected: PubSubStreamingServiceSvIf* iface_; public: void processSerializedRequest(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedRequest&& serializedRequest, apache::thrift::protocol::PROTOCOL_TYPES protType, apache::thrift::Cpp2RequestContext* context, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm) override; protected: std::shared_ptr<folly::RequestContext> getBaseContextForRequest() override; public: using ProcessFunc = GeneratedAsyncProcessor::ProcessFunc<PubSubStreamingServiceAsyncProcessor>; using ProcessMap = GeneratedAsyncProcessor::ProcessMap<ProcessFunc>; static const PubSubStreamingServiceAsyncProcessor::ProcessMap& getBinaryProtocolProcessMap(); static const PubSubStreamingServiceAsyncProcessor::ProcessMap& getCompactProtocolProcessMap(); private: static const PubSubStreamingServiceAsyncProcessor::ProcessMap binaryProcessMap_; static const PubSubStreamingServiceAsyncProcessor::ProcessMap compactProcessMap_; private: template <typename ProtocolIn_, typename ProtocolOut_> void setUpAndProcess_returnstream(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm); template <typename ProtocolIn_, typename ProtocolOut_> void process_returnstream(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx,folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm); template <class ProtocolIn_, class ProtocolOut_> static apache::thrift::ResponseAndServerStreamFactory return_returnstream(int32_t protoSeqId, apache::thrift::ContextStack* ctx, folly::Executor::KeepAlive<> executor, apache::thrift::ServerStream<int32_t>&& _return); template <class ProtocolIn_, class ProtocolOut_> static void throw_wrapped_returnstream(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx); template <typename ProtocolIn_, typename ProtocolOut_> void setUpAndProcess_streamthrows(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm); template <typename ProtocolIn_, typename ProtocolOut_> void process_streamthrows(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx,folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm); template <class ProtocolIn_, class ProtocolOut_> static apache::thrift::ResponseAndServerStreamFactory return_streamthrows(int32_t protoSeqId, apache::thrift::ContextStack* ctx, folly::Executor::KeepAlive<> executor, apache::thrift::ServerStream<int32_t>&& _return); template <class ProtocolIn_, class ProtocolOut_> static void throw_wrapped_streamthrows(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx); template <typename ProtocolIn_, typename ProtocolOut_> void setUpAndProcess_boththrows(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm); template <typename ProtocolIn_, typename ProtocolOut_> void process_boththrows(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx,folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm); template <class ProtocolIn_, class ProtocolOut_> static apache::thrift::ResponseAndServerStreamFactory return_boththrows(int32_t protoSeqId, apache::thrift::ContextStack* ctx, folly::Executor::KeepAlive<> executor, apache::thrift::ServerStream<int32_t>&& _return); template <class ProtocolIn_, class ProtocolOut_> static void throw_wrapped_boththrows(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx); template <typename ProtocolIn_, typename ProtocolOut_> void setUpAndProcess_responseandstreamthrows(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm); template <typename ProtocolIn_, typename ProtocolOut_> void process_responseandstreamthrows(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx,folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm); template <class ProtocolIn_, class ProtocolOut_> static apache::thrift::ResponseAndServerStreamFactory return_responseandstreamthrows(int32_t protoSeqId, apache::thrift::ContextStack* ctx, folly::Executor::KeepAlive<> executor, apache::thrift::ResponseAndServerStream<int32_t,int32_t>&& _return); template <class ProtocolIn_, class ProtocolOut_> static void throw_wrapped_responseandstreamthrows(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx); template <typename ProtocolIn_, typename ProtocolOut_> void setUpAndProcess_returnstreamFast(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx, folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm); template <typename ProtocolIn_, typename ProtocolOut_> void process_returnstreamFast(apache::thrift::ResponseChannelRequest::UniquePtr req, apache::thrift::SerializedRequest&& serializedRequest, apache::thrift::Cpp2RequestContext* ctx,folly::EventBase* eb, apache::thrift::concurrency::ThreadManager* tm); template <class ProtocolIn_, class ProtocolOut_> static apache::thrift::ResponseAndServerStreamFactory return_returnstreamFast(int32_t protoSeqId, apache::thrift::ContextStack* ctx, folly::Executor::KeepAlive<> executor, apache::thrift::ServerStream<int32_t>&& _return); template <class ProtocolIn_, class ProtocolOut_> static void throw_wrapped_returnstreamFast(apache::thrift::ResponseChannelRequest::UniquePtr req,int32_t protoSeqId,apache::thrift::ContextStack* ctx,folly::exception_wrapper ew,apache::thrift::Cpp2RequestContext* reqCtx); public: PubSubStreamingServiceAsyncProcessor(PubSubStreamingServiceSvIf* iface) : iface_(iface) {} virtual ~PubSubStreamingServiceAsyncProcessor() {} }; } // cpp2
[ "facebook-github-bot@users.noreply.github.com" ]
facebook-github-bot@users.noreply.github.com
6a185211c4ca4719c9f7aa22b42e97eb0cb72541
1722686f8139aca7d6927ec7a6dfed13a5d319fb
/pc-client/player/painterboard.h
6afb40e5cf3fccc833650941d1af8d2b6f7288e1
[]
no_license
oamates/clientmy
610ca1c825e503e0b477a9a579248d608435a5d0
b3618b2225da198f338a3f2981c841dde010cd8d
refs/heads/main
2022-12-30T14:53:43.037242
2020-10-21T01:01:12
2020-10-21T01:01:12
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,770
h
#ifndef PAINTERBOARD_H #define PAINTERBOARD_H #include <QMap> #include <QObject> #include <QTimer> #include <QPainter> #include <QMutex> #include <QJsonArray> #include <QQuickPaintedItem> #include <QJsonObject> #include <QJsonArray> #include <QJsonDocument> #include "cloudclassroom/cloudclassManager/imageprovider.h" #ifdef USE_OSS_AUTHENTICATION #include "cloudclassroom/cloudclassManager/YMHttpClient.h" #endif //一条消息model class Msg { public: Msg(QString msg = "", QString uid = "", long long t = 0, QString m_currentPage = "") : message(msg), userId(uid), timestamp(t), currentPage(m_currentPage) {} QString message; QString userId; QString currentPage; long long timestamp; }; //一页消息model class PageModel { public: #ifdef USE_OSS_AUTHENTICATION PageModel(QString bg = "", int isCourware = 0, QString questionId = "", QString columnType = "0", double offSetY = 0.0, long expiredTime = 0) : bgimg(bg), isCourware(isCourware), questionId(questionId), columnType(columnType), offsetY(offSetY), expiredTime(expiredTime) #else PageModel(QString bg = "", int isCourware = 0, QString questionId = "", QString columnType = "0", double offSetY = 0.0) : bgimg(bg), isCourware(isCourware), questionId(questionId), columnType(columnType), offsetY(offSetY) #endif //#ifdef USE_OSS_AUTHENTICATION { } QList<Msg> getMsgs() { return this->m_msg; } void addMsg(QString userId, QString msg, QString currentPage) { Msg m; m.message = msg; m.userId = userId; m.currentPage = currentPage; m_msg.append(m); } void clear() { m_msg.clear(); } QList<Msg> m_msg; QVector<Msg> msgs; int isCourware; QString bgimg; double width, height; int totalPage; int currentPage; QString questionId; QString columnType; double offsetY; #ifdef USE_OSS_AUTHENTICATION long expiredTime; #endif }; class PainterBoard : public QQuickPaintedItem { Q_OBJECT public: explicit PainterBoard(QQuickPaintedItem *parent = 0);//QString lessonId,QString filePath,QString trailName,QSize size, ~PainterBoard(); protected: void paint(QPainter *painter); signals: void changeBgimg(QString url, double width, double height, QString questionId); void sigSetCurrentTime(int time); void sigChangePlayBtnStatus(int status);//1播放状态显示暂停 0暂停状态 显示播放 void sigSetTotalTime(int seconds); void sigPlayerMedia(QString startTime, QString vaType, QString fileUrl, QString controlType); void sigPlayerAudio(QString audioPaht); void sigSeek(long long values); void sigPlayer(); void sigPlanInfo(QJsonObject planInfo, QString planId,QString planType); //获取讲义信息 void sigColumnInfo(QString columnId, QString planId, QString pageIndex); //栏目选择信号 void sigQuestionInfo(QString questionId, QString planId, QString columnId); //做题信号 void sigIsOpenAnswer(bool answerStatus, QString questionId, QString childQuestionId); //打开关闭答案解析面板 (打开:true,关闭:false) void sigIsOpenCorrect(bool correctStatus);//打开关闭批改面板 (打开:true,关闭:false) void sigCommitImage(QString imageUrl, int imageHeight); //学生提交图片 void sigZoomInOut(double offsetX, double offsetY, double zoomRate); //滚动信号 void sigCurrentQuestionId(QString planId, QString columnId, QString questionId); //当前题目显示 void sigCurrentImageHeight(double height); void sigCursorPointer(double pointx, double pointy); public: //增加播放时间 Q_INVOKABLE void incrementTime(); //播放命令 Q_INVOKABLE void play(); //暂停播放 Q_INVOKABLE void pause(); //开始播放 Q_INVOKABLE void start(); //停止播放 Q_INVOKABLE void stop(); //快进快退跳转 Q_INVOKABLE void redirect(int time, bool playStatus); //设置课件相关参数 Q_INVOKABLE void setVideoPram(QString lessonId, QString date, QString filePath, QString trailName); //根据图片偏移量获取图片位置进行显示 Q_INVOKABLE void getOffsetImage(QString imageUrl, double offsetY); //设置 当前图片的高度 Q_INVOKABLE void setCurrentImgHeight(double height); public: QString m_lessonId; QString m_filePath;//轨迹文件所在目录 QString m_trailName;//轨迹文件名 QString m_date;// bool m_isPlayer; double m_currentImageHeight; private: void clear(); Msg getThisMsg();//获取本次需要播放的轨迹 Msg getNextMsg();//获取下次需要播放的轨迹 void readTrailFile();//读取解析轨迹文件 void drawLine(QString line);//解析处理命令 //画贝塞尔曲线 void drawBezier(const QVector<QPointF> &points, double size, QColor penColor, int type); //画一页 此页上的所有轨迹 void drawPage(PageModel model); //处理消息 给消息分页 void excuteMsg(QString msg, QString fromUser, bool isDraw = false, long long currentTime = 0); //画一条线 void drawLine(const QVector<QPointF> &points, double brushWidth, QColor color, int type); //画椭圆 void drawEllipse(const QRectF &rect, double brushWidth, QColor color, double angle); #ifdef USE_OSS_AUTHENTICATION QString getOssSignUrl(QString key);//获取OSS重新签名的URL QString checkOssSign(QString imgUrl);//检查是否需要验签 #endif public: QPixmap trailPixmap; QVector<QVector<Msg> > trails;//此课时所有轨迹 按上课时的分段保存 int currentSectionIndex, currentMessageIndex; //trails当前分段索引,trails当前分段当前消息索引 QSize boardSize; QMap<QString, QVector<PageModel> > pages;//每个课件每一页的内容 QMap<QString, int> pageSave;//每个课件的当前显示页码 int currentPage;//当前页 QString currentCourse;//当前课件 QTimer *task;//播放命令任务 QTimer *timeTask;//播放时间任务 QVector<int> times;//每段上课时间 QVector<QString> audios;//每段音频 int playTime;//当前已播放时间 QMutex m_tempTrailMutex; QString m_startTime; QString m_avType; QString m_controlType; QString m_avUrl; long long m_currentTime; QString m_currentUrl; double currentImagaeOffSetY;//还原轨迹属性 PageModel bufferModel; static PainterBoard * m_painterBoard; QVector<QPointF> m_listr; #ifdef USE_OSS_AUTHENTICATION YMHttpClient * m_httpClient; QString m_httpUrl; #endif public: int videoTotalTime;//录播总时间时间 double changeYPoinToLocal(double pointY);// 转换Y坐标 将接收到的坐标转换为当前坐标 double changeYPoinToSend(double pointY);// 将当前坐标转换为 发送时的坐标 public slots: void onCtentsSizeChanged(); //根据滚动坐标获取图片 void getOffSetImage(double offsetX, double offsetY, double zoomRate); }; #endif // PAINTERBOARD_H
[ "shaohua.zhang@yimifudao.com" ]
shaohua.zhang@yimifudao.com
90a0fb7fff24e12cbf06dc49b5c77ff53ac28822
84a19fe0b89bb19caa1641aeadc9623c1a181767
/codeforces/636_div3/c.cpp
02b39ec302c28066c8cb362a22bf54537e357ad5
[ "MIT" ]
permissive
wotsushi/competitive-programming
75abae653cff744189c53ad7e6dbd2ca1a62e3a8
17ec8fd5e1c23aee626aee70b1c0da8d7f8b8c86
refs/heads/master
2021-06-10T06:42:40.846666
2021-05-31T10:32:51
2021-05-31T10:32:51
175,002,279
3
0
null
null
null
null
UTF-8
C++
false
false
2,343
cpp
#pragma region template 2.4 #include <bits/stdc++.h> using namespace std; template <typename T> using pq_asc = priority_queue<T, vector<T>, greater<T>>; typedef long long ll; typedef vector<ll> vi; typedef vector<vi> vvi; typedef pair<ll, ll> ii; typedef vector<ii> vii; typedef vector<string> vs; #define REP(i, n) for (ll i = 0; i < (n); ++i) #define REP1(i, n) for (ll i = 1; i <= (n); ++i) #define FOR(i, a) for (auto &i : a) #define CH(f, x, y) x = f(x, y) #define IN(T, x) \ T x; \ cin >> x; #define AIN(T, a, n) \ vector<T> a(n); \ FOR(i, a) \ cin >> i; #define A2IN(T1, a, T2, b, n) \ vector<T1> a(n); \ vector<T2> b(n); \ REP(i, n) \ cin >> a[i] >> b[i]; #define OUT(x) cout << (x) << endl; #define FOUT(x) cout << fixed << setprecision(15) << (x) << endl; #define ALL(a) (a).begin(), (a).end() #define SORT(a) sort(ALL(a)) #define RSORT(a) \ SORT(a); \ reverse(ALL(a)) #define DUMP(x) cout << #x << " = " << (x) << endl; #define DUMPA(a) \ cout << #a << " = {"; \ JOUT(ALL(a), ", ", cout) << "}" << endl; template <typename T> ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout) { if (s != e) { os << *s; ++s; } while (s != e) { os << sep << *s; ++s; } return os; } ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout) { if (cond) { os << yes << endl; } else { os << no << endl; } return os; } template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << '(' << p.first << ", " << p.second << ')'; return os; } template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) { os << '['; JOUT(ALL(v), ", ", os) << ']'; return os; } const ll INF = 1e18; const ll MOD = 1e9 + 7; #pragma endregion template void solve() { IN(ll, n); AIN(ll, a, n); ll ans = 0; ll m = 0; ll sign = 0; FOR(x, a) { if (sign * x <= 0) { ans += m; m = x; sign = x; } else { CH(max, m, x); } } ans += m; OUT(ans); } int main() { IN(ll, t); REP(_, t) { solve(); } }
[ "wotsushi@gmail.com" ]
wotsushi@gmail.com
07251f73135a4adb4ed5d6b7a49034f73fcee4e6
4c6d4aadfad76986f2ee5d62fa2e10263d7d2788
/Source/JavascriptUMG/JavascriptWindow.h
d78a0f2c9621c6957ac5e29ad23efe1b92796e96
[ "BSD-3-Clause", "MIT" ]
permissive
nicecapj/Unreal.js-core
53ad04b7b363d878d868f5f699cda113cac1c407
e19ffae8fe39768d7f30b373d21661fb798b52e0
refs/heads/master
2021-01-18T22:46:06.889285
2017-03-15T13:03:40
2017-03-15T13:03:40
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,103
h
#pragma once #include "JavascriptWindow.generated.h" class SWindow; /** Enumeration to specify different window types for SWindows */ UENUM() enum class EJavascriptWindowType : uint8 { /** Value indicating that this is a standard, general-purpose window */ Normal, /** Value indicating that this is a window used for a popup menu */ Menu, /** Value indicating that this is a window used for a tooltip */ ToolTip, /** Value indicating that this is a window used for a notification toast */ Notification, /** Value indicating that this is a window used for a cursor decorator */ CursorDecorator }; /** Enum to describe how to auto-center an SWindow */ UENUM() enum class EJavascriptAutoCenter : uint8 { /** Don't auto-center the window */ None, /** Auto-center the window on the primary work area */ PrimaryWorkArea, /** Auto-center the window on the preferred work area, determined using GetPreferredWorkArea() */ PreferredWorkArea, }; UENUM() enum class EJavascriptSizingRule : uint8 { /* The windows size fixed and cannot be resized **/ FixedSize, /** The window size is computed from its content and cannot be resized by users */ Autosized, /** The window can be resized by users */ UserSized, }; /** Enumeration to specify different transparency options for SWindows */ UENUM() enum class EJavascriptWindowTransparency : uint8 { /** Value indicating that a window does not support transparency */ None, /** Value indicating that a window supports transparency at the window level (one opacity applies to the entire window) */ PerWindow, #if ALPHA_BLENDED_WINDOWS /** Value indicating that a window supports per-pixel alpha blended transparency */ PerPixel, #endif }; UCLASS(Experimental) class JAVASCRIPTUMG_API UJavascriptWindow : public UContentWidget { GENERATED_UCLASS_BODY() public: /** Type of this window */ UPROPERTY() EJavascriptWindowType Type; UPROPERTY() FWindowStyle Style; UPROPERTY() FText Title; UPROPERTY() bool bDragAnywhere; UPROPERTY() EJavascriptAutoCenter AutoCenter; /** Screen-space position where the window should be initially located. */ UPROPERTY() FVector2D ScreenPosition; /** What the initial size of the window should be. */ UPROPERTY() FVector2D ClientSize; /** Should this window support transparency */ UPROPERTY() EJavascriptWindowTransparency SupportsTransparency; UPROPERTY() float InitialOpacity; /** Is the window initially maximized */ UPROPERTY() bool IsInitiallyMaximized; UPROPERTY() EJavascriptSizingRule SizingRule; /** True if this should be a 'pop-up' window */ UPROPERTY() bool IsPopupWindow; /** Should this window be focused immediately after it is shown? */ UPROPERTY() bool FocusWhenFirstShown; /** Should this window be activated immediately after it is shown? */ UPROPERTY() bool ActivateWhenFirstShown; /** Use the default os look for the border of the window */ UPROPERTY() bool UseOSWindowBorder; /** Does this window have a close button? */ UPROPERTY() bool HasCloseButton; /** Can this window be maximized? */ UPROPERTY() bool SupportsMaximize; /** Can this window be minimized? */ UPROPERTY() bool SupportsMinimize; /** True if we should initially create a traditional title bar area. If false, the user must embed the title area content into the window manually, taking into account platform-specific considerations! Has no effect for certain types of windows (popups, tool-tips, etc.) */ UPROPERTY() bool CreateTitleBar; /** If the window appears off screen or is too large to safely fit this flag will force realistic constraints on the window and bring it back into view. */ UPROPERTY() bool SaneWindowPlacement; /** The padding around the edges of the window applied to it's content. */ UPROPERTY() FMargin LayoutBorder; /** The margin around the edges of the window that will be detected as places the user can grab to resize the window. */ UPROPERTY() FMargin UserResizeBorder; // UWidget interface virtual TSharedRef<SWidget> RebuildWidget() override; // End of UWidget interface UFUNCTION(BlueprintCallable, Category = "Javascript") void MoveWindowTo(FVector2D NewPosition); UFUNCTION(BlueprintCallable, Category = "Javascript") void ReshapeWindow(FVector2D NewPosition, FVector2D NewSize); UFUNCTION(BlueprintCallable, Category = "Javascript") void Resize(FVector2D NewSize); UFUNCTION(BlueprintCallable, Category = "Javascript") void FlashWindow(); UFUNCTION(BlueprintCallable, Category = "Javascript") void BringToFront(); UFUNCTION(BlueprintCallable, Category = "Javascript") void RequestDestroyWindow(); UFUNCTION(BlueprintCallable, Category = "Javascript") void DestroyWindowImmediately(); UFUNCTION(BlueprintCallable, Category = "Javascript") void ShowWindow(); UFUNCTION(BlueprintCallable, Category = "Javascript") void HideWindow(); UFUNCTION(BlueprintCallable, Category = "Javascript") void EnableWindow(bool bEnable); UFUNCTION(BlueprintCallable, Category = "Javascript") void SetOpacity(const float InOpacity); protected: TSharedPtr<SWindow> MyWindow; };
[ "nakosung@ncsoft.com" ]
nakosung@ncsoft.com
cbe0c6df54bdfa5714d342c4454a00f2246053bb
f1c01a3b5b35b59887bf326b0e2b317510deef83
/SDK/SoT_GhostShipEncounterVoyageCategory_classes.hpp
25255cc48bb6f2491f9a1538dfe571f44eddc549
[]
no_license
codahq/SoT-SDK
0e4711e78a01f33144acf638202d63f573fa78eb
0e6054dddb01a83c0c1f3ed3e6cdad5b34b9f094
refs/heads/master
2023-03-02T05:00:26.296260
2021-01-29T13:03:35
2021-01-29T13:03:35
null
0
0
null
null
null
null
UTF-8
C++
false
false
791
hpp
#pragma once // Sea of Thieves (2.0) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "SoT_GhostShipEncounterVoyageCategory_structs.hpp" namespace SDK { //--------------------------------------------------------------------------- //Classes //--------------------------------------------------------------------------- // BlueprintGeneratedClass GhostShipEncounterVoyageCategory.GhostShipEncounterVoyageCategory_C // 0x0000 (0x0078 - 0x0078) class UGhostShipEncounterVoyageCategory_C : public UVoyageCategory_C { public: static UClass* StaticClass() { static auto ptr = UObject::FindObject<UClass>(_xor_("BlueprintGeneratedClass GhostShipEncounterVoyageCategory.GhostShipEncounterVoyageCategory_C")); return ptr; } }; } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "igromanru@yahoo.de" ]
igromanru@yahoo.de
8e94f61142f5323653ad112afbabe45a5c371375
eb663d5c73c9d74f0b5de618cdb0579587e86928
/test/src/Utils_test.cpp
ee6cc5a11d00424b7edefa7de09c4319686c925c
[ "MIT" ]
permissive
andrsd/godzilla
e849bf5b66966d017437a2af5cf0dcc11cf543f9
296a10b39603a22a54053b009b3cb1c0b24d2008
refs/heads/main
2023-09-03T20:23:06.445778
2023-08-30T20:23:37
2023-08-30T20:23:37
123,453,473
5
0
MIT
2023-09-06T18:36:27
2018-03-01T15:27:17
C++
UTF-8
C++
false
false
1,600
cpp
#include "gmock/gmock.h" #include "Utils.h" using namespace godzilla; TEST(UtilsTest, to_lower) { EXPECT_EQ(utils::to_lower("ASDF"), "asdf"); } TEST(UtilsTest, to_upper) { EXPECT_EQ(utils::to_upper("asdf"), "ASDF"); } TEST(UtilsTest, has_suffix) { EXPECT_TRUE(utils::has_suffix("asdf", "df")); EXPECT_FALSE(utils::has_suffix("asdf", "long_string")); EXPECT_FALSE(utils::has_suffix("asdf", "as")); } TEST(UtilsTest, has_prefix) { EXPECT_TRUE(utils::has_prefix("asdf", "as")); EXPECT_FALSE(utils::has_prefix("asdf", "long_string")); EXPECT_FALSE(utils::has_prefix("asdf", "df")); } TEST(UtilsTest, map_keys) { std::map<int, int> m = { { 1, 200 }, { 2, 201 }, { 5, 203 }, { 9, 204 } }; std::vector<int> keys = utils::map_keys(m); EXPECT_THAT(keys, testing::UnorderedElementsAre(1, 2, 5, 9)); } TEST(UtilsTest, map_values) { std::map<int, int> m = { { 1, 200 }, { 2, 201 }, { 5, 203 }, { 9, 204 } }; std::vector<int> keys = utils::map_values(m); EXPECT_THAT(keys, testing::UnorderedElementsAre(200, 201, 203, 204)); } TEST(UtilsTest, human_time) { EXPECT_EQ(utils::human_time(0), "0s"); EXPECT_EQ(utils::human_time(0.5), "0.500s"); EXPECT_EQ(utils::human_time(10), "10s"); EXPECT_EQ(utils::human_time(60), "1m"); EXPECT_EQ(utils::human_time(70), "1m 10s"); EXPECT_EQ(utils::human_time(70.5), "1m 10.500s"); EXPECT_EQ(utils::human_time(3600), "1h"); EXPECT_EQ(utils::human_time(3720), "1h 2m"); EXPECT_EQ(utils::human_time(3725), "1h 2m 5s"); EXPECT_EQ(utils::human_time(3725.2), "1h 2m 5.200s"); }
[ "andrsd@gmail.com" ]
andrsd@gmail.com
a4c8619c261000c0a6152dafaa4e54bac09da248
255c4886a061c0e17fbc458db3998637d058a0d0
/code/msvis/MSVis/statistics/Vi2ChunkFieldIdDataProvider.h
56c82357b19929e37fa78921b82a125ea59b8d6c
[]
no_license
keflavich/casa
9f8aed7d3a1e7e944dedb57228b3f42665e7a245
175b53c57b66aa7a47aa90fdf3d76d33a99415d6
refs/heads/master
2021-01-17T11:03:24.350141
2016-05-25T21:07:56
2016-05-25T21:07:56
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,969
h
// -*- mode: c++ -*- //# Copyright (C) 1996,1997,1998,1999,2000,2002,2003,2015 //# Associated Universities, Inc. Washington DC, USA. //# //# This library is free software; you can redistribute it and/or modify it //# under the terms of the GNU Library General Public License as published by //# the Free Software Foundation; either version 2 of the License, or (at your //# option) any later version. //# //# This library is distributed in the hope that it will be useful, but WITHOUT //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public //# License for more details. //# //# You should have received a copy of the GNU Library General Public License //# along with this library; if not, write to the Free Software Foundation, //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. //# //# Correspondence concerning AIPS++ should be addressed as follows: //# Internet email: aips2-request@nrao.edu. //# Postal address: AIPS++ Project Office //# National Radio Astronomy Observatory //# 520 Edgemont Road //# Charlottesville, VA 22903-2475 USA //# // // Data provider for field id column // #ifndef MSVIS_STATISTICS_VI2_CHUNK_FIELD_ID_DATA_PROVIDER_H_ #define MSVIS_STATISTICS_VI2_CHUNK_FIELD_ID_DATA_PROVIDER_H_ #include <casacore/casa/aips.h> #include <casacore/casa/Arrays/Vector.h> #include <msvis/MSVis/VisibilityIterator2.h> #include <msvis/MSVis/statistics/Vi2ChunkDataProvider.h> #include <msvis/MSVis/statistics/Vi2StatsDataIterator.h> namespace casa { class Vi2ChunkFieldIdDataProvider final : public Vi2ChunkWeightsRowDataProvider<Vi2StatsIntIterator> { public: Vi2ChunkFieldIdDataProvider( vi::VisibilityIterator2 *vi2, Bool omit_flagged_data); const Vector<Int>& dataArray(); }; } // namespace casa #endif // MSVIS_STATISTICS_VI2_CHUNK_FIELD_ID_DATA_PROVIDER_H_
[ "mpokorny@nrao.edu" ]
mpokorny@nrao.edu
c89482efa314dd40521f89dea4c595579a3ae236
2e2ab873cfdd65885e2a29c8ad6d2deb9ed0a13e
/include/visiongraph/VisionGraph.h
497d8252a87248d4d1a8393a15fb9d84fb54fd6c
[ "MIT" ]
permissive
xzrunner/visiongraph
01e7f8df1e52837235a71190545b648e9a8ca4e9
476ea49bbf56d6a2caa062d05677e768575d7ea1
refs/heads/master
2021-01-09T19:45:10.540888
2020-09-01T00:44:10
2020-09-01T00:44:10
242,437,708
0
0
null
null
null
null
UTF-8
C++
false
false
138
h
#pragma once #include <cu/cu_macro.h> namespace vg { class VisionGraph { CU_SINGLETON_DECLARATION(VisionGraph) }; // VisionGraph }
[ "xzrunner@gmail.com" ]
xzrunner@gmail.com
680c61caa838496ecd667578b9012316f16d9073
f6f0f87647e23507dca538760ab70e26415b8313
/6.1.0/msvc2019_64/include/QtWidgets/qtextedit.h
184631b0c74264df04be13b0e7b0e29beb8b80f1
[]
no_license
stenzek/duckstation-ext-qt-minimal
a942c62adc5654c03d90731a8266dc711546b268
e5c412efffa3926f7a4d5bf0ae0333e1d6784f30
refs/heads/master
2023-08-17T16:50:21.478373
2023-08-15T14:53:43
2023-08-15T14:53:43
233,179,313
3
1
null
2021-11-16T15:34:28
2020-01-11T05:05:34
C++
UTF-8
C++
false
false
12,424
h
/**************************************************************************** ** ** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 3 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL3 included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 3 requirements ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 2.0 or (at your option) the GNU General ** Public license version 3 or any later version approved by the KDE Free ** Qt Foundation. The licenses are as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-2.0.html and ** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QTEXTEDIT_H #define QTEXTEDIT_H #include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qabstractscrollarea.h> #include <QtGui/qtextdocument.h> #include <QtGui/qtextoption.h> #include <QtGui/qtextcursor.h> #include <QtGui/qtextformat.h> QT_REQUIRE_CONFIG(textedit); QT_BEGIN_NAMESPACE class QStyleSheet; class QTextDocument; class QMenu; class QTextEditPrivate; class QMimeData; class QPagedPaintDevice; class QRegularExpression; class Q_WIDGETS_EXPORT QTextEdit : public QAbstractScrollArea { Q_OBJECT Q_DECLARE_PRIVATE(QTextEdit) Q_PROPERTY(AutoFormatting autoFormatting READ autoFormatting WRITE setAutoFormatting) Q_PROPERTY(bool tabChangesFocus READ tabChangesFocus WRITE setTabChangesFocus) Q_PROPERTY(QString documentTitle READ documentTitle WRITE setDocumentTitle) Q_PROPERTY(bool undoRedoEnabled READ isUndoRedoEnabled WRITE setUndoRedoEnabled) Q_PROPERTY(LineWrapMode lineWrapMode READ lineWrapMode WRITE setLineWrapMode) QDOC_PROPERTY(QTextOption::WrapMode wordWrapMode READ wordWrapMode WRITE setWordWrapMode) Q_PROPERTY(int lineWrapColumnOrWidth READ lineWrapColumnOrWidth WRITE setLineWrapColumnOrWidth) Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) #if QT_CONFIG(textmarkdownreader) && QT_CONFIG(textmarkdownwriter) Q_PROPERTY(QString markdown READ toMarkdown WRITE setMarkdown NOTIFY textChanged) #endif #ifndef QT_NO_TEXTHTMLPARSER Q_PROPERTY(QString html READ toHtml WRITE setHtml NOTIFY textChanged USER true) #endif Q_PROPERTY(QString plainText READ toPlainText WRITE setPlainText DESIGNABLE false) Q_PROPERTY(bool overwriteMode READ overwriteMode WRITE setOverwriteMode) Q_PROPERTY(qreal tabStopDistance READ tabStopDistance WRITE setTabStopDistance) Q_PROPERTY(bool acceptRichText READ acceptRichText WRITE setAcceptRichText) Q_PROPERTY(int cursorWidth READ cursorWidth WRITE setCursorWidth) Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags WRITE setTextInteractionFlags) Q_PROPERTY(QTextDocument *document READ document WRITE setDocument DESIGNABLE false) Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText) public: enum LineWrapMode { NoWrap, WidgetWidth, FixedPixelWidth, FixedColumnWidth }; Q_ENUM(LineWrapMode) enum AutoFormattingFlag { AutoNone = 0, AutoBulletList = 0x00000001, AutoAll = 0xffffffff }; Q_DECLARE_FLAGS(AutoFormatting, AutoFormattingFlag) Q_FLAG(AutoFormatting) explicit QTextEdit(QWidget *parent = nullptr); explicit QTextEdit(const QString &text, QWidget *parent = nullptr); virtual ~QTextEdit(); void setDocument(QTextDocument *document); QTextDocument *document() const; void setPlaceholderText(const QString &placeholderText); QString placeholderText() const; void setTextCursor(const QTextCursor &cursor); QTextCursor textCursor() const; bool isReadOnly() const; void setReadOnly(bool ro); void setTextInteractionFlags(Qt::TextInteractionFlags flags); Qt::TextInteractionFlags textInteractionFlags() const; qreal fontPointSize() const; QString fontFamily() const; int fontWeight() const; bool fontUnderline() const; bool fontItalic() const; QColor textColor() const; QColor textBackgroundColor() const; QFont currentFont() const; Qt::Alignment alignment() const; void mergeCurrentCharFormat(const QTextCharFormat &modifier); void setCurrentCharFormat(const QTextCharFormat &format); QTextCharFormat currentCharFormat() const; AutoFormatting autoFormatting() const; void setAutoFormatting(AutoFormatting features); bool tabChangesFocus() const; void setTabChangesFocus(bool b); inline void setDocumentTitle(const QString &title) { document()->setMetaInformation(QTextDocument::DocumentTitle, title); } inline QString documentTitle() const { return document()->metaInformation(QTextDocument::DocumentTitle); } inline bool isUndoRedoEnabled() const { return document()->isUndoRedoEnabled(); } inline void setUndoRedoEnabled(bool enable) { document()->setUndoRedoEnabled(enable); } LineWrapMode lineWrapMode() const; void setLineWrapMode(LineWrapMode mode); int lineWrapColumnOrWidth() const; void setLineWrapColumnOrWidth(int w); QTextOption::WrapMode wordWrapMode() const; void setWordWrapMode(QTextOption::WrapMode policy); bool find(const QString &exp, QTextDocument::FindFlags options = QTextDocument::FindFlags()); #if QT_CONFIG(regularexpression) bool find(const QRegularExpression &exp, QTextDocument::FindFlags options = QTextDocument::FindFlags()); #endif QString toPlainText() const; #ifndef QT_NO_TEXTHTMLPARSER QString toHtml() const; #endif #if QT_CONFIG(textmarkdownwriter) QString toMarkdown(QTextDocument::MarkdownFeatures features = QTextDocument::MarkdownDialectGitHub) const; #endif void ensureCursorVisible(); Q_INVOKABLE virtual QVariant loadResource(int type, const QUrl &name); #ifndef QT_NO_CONTEXTMENU QMenu *createStandardContextMenu(); QMenu *createStandardContextMenu(const QPoint &position); #endif QTextCursor cursorForPosition(const QPoint &pos) const; QRect cursorRect(const QTextCursor &cursor) const; QRect cursorRect() const; QString anchorAt(const QPoint& pos) const; bool overwriteMode() const; void setOverwriteMode(bool overwrite); qreal tabStopDistance() const; void setTabStopDistance(qreal distance); int cursorWidth() const; void setCursorWidth(int width); bool acceptRichText() const; void setAcceptRichText(bool accept); struct ExtraSelection { QTextCursor cursor; QTextCharFormat format; }; void setExtraSelections(const QList<ExtraSelection> &selections); QList<ExtraSelection> extraSelections() const; void moveCursor(QTextCursor::MoveOperation operation, QTextCursor::MoveMode mode = QTextCursor::MoveAnchor); bool canPaste() const; void print(QPagedPaintDevice *printer) const; QVariant inputMethodQuery(Qt::InputMethodQuery property) const override; Q_INVOKABLE QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const; public Q_SLOTS: void setFontPointSize(qreal s); void setFontFamily(const QString &fontFamily); void setFontWeight(int w); void setFontUnderline(bool b); void setFontItalic(bool b); void setTextColor(const QColor &c); void setTextBackgroundColor(const QColor &c); void setCurrentFont(const QFont &f); void setAlignment(Qt::Alignment a); void setPlainText(const QString &text); #ifndef QT_NO_TEXTHTMLPARSER void setHtml(const QString &text); #endif #if QT_CONFIG(textmarkdownreader) void setMarkdown(const QString &markdown); #endif void setText(const QString &text); #ifndef QT_NO_CLIPBOARD void cut(); void copy(); void paste(); #endif void undo(); void redo(); void clear(); void selectAll(); void insertPlainText(const QString &text); #ifndef QT_NO_TEXTHTMLPARSER void insertHtml(const QString &text); #endif // QT_NO_TEXTHTMLPARSER void append(const QString &text); void scrollToAnchor(const QString &name); void zoomIn(int range = 1); void zoomOut(int range = 1); Q_SIGNALS: void textChanged(); void undoAvailable(bool b); void redoAvailable(bool b); void currentCharFormatChanged(const QTextCharFormat &format); void copyAvailable(bool b); void selectionChanged(); void cursorPositionChanged(); protected: virtual bool event(QEvent *e) override; virtual void timerEvent(QTimerEvent *e) override; virtual void keyPressEvent(QKeyEvent *e) override; virtual void keyReleaseEvent(QKeyEvent *e) override; virtual void resizeEvent(QResizeEvent *e) override; virtual void paintEvent(QPaintEvent *e) override; virtual void mousePressEvent(QMouseEvent *e) override; virtual void mouseMoveEvent(QMouseEvent *e) override; virtual void mouseReleaseEvent(QMouseEvent *e) override; virtual void mouseDoubleClickEvent(QMouseEvent *e) override; virtual bool focusNextPrevChild(bool next) override; #ifndef QT_NO_CONTEXTMENU virtual void contextMenuEvent(QContextMenuEvent *e) override; #endif #if QT_CONFIG(draganddrop) virtual void dragEnterEvent(QDragEnterEvent *e) override; virtual void dragLeaveEvent(QDragLeaveEvent *e) override; virtual void dragMoveEvent(QDragMoveEvent *e) override; virtual void dropEvent(QDropEvent *e) override; #endif virtual void focusInEvent(QFocusEvent *e) override; virtual void focusOutEvent(QFocusEvent *e) override; virtual void showEvent(QShowEvent *) override; virtual void changeEvent(QEvent *e) override; #if QT_CONFIG(wheelevent) virtual void wheelEvent(QWheelEvent *e) override; #endif virtual QMimeData *createMimeDataFromSelection() const; virtual bool canInsertFromMimeData(const QMimeData *source) const; virtual void insertFromMimeData(const QMimeData *source); virtual void inputMethodEvent(QInputMethodEvent *) override; QTextEdit(QTextEditPrivate &dd, QWidget *parent); virtual void scrollContentsBy(int dx, int dy) override; virtual void doSetTextCursor(const QTextCursor &cursor); void zoomInF(float range); private: Q_DISABLE_COPY(QTextEdit) Q_PRIVATE_SLOT(d_func(), void _q_repaintContents(const QRectF &r)) Q_PRIVATE_SLOT(d_func(), void _q_currentCharFormatChanged(const QTextCharFormat &)) Q_PRIVATE_SLOT(d_func(), void _q_adjustScrollbars()) Q_PRIVATE_SLOT(d_func(), void _q_ensureVisible(const QRectF &)) Q_PRIVATE_SLOT(d_func(), void _q_cursorPositionChanged()) #if QT_CONFIG(cursor) Q_PRIVATE_SLOT(d_func(), void _q_hoveredBlockWithMarkerChanged(const QTextBlock &)) #endif friend class QTextEditControl; friend class QTextDocument; friend class QWidgetTextControl; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QTextEdit::AutoFormatting) QT_END_NAMESPACE #endif // QTEXTEDIT_H
[ "stenzek@gmail.com" ]
stenzek@gmail.com
513f1445107f7dd896285557e2aadf51729f3538
33552f5a5f9734edfb2463f7086ef36495c69017
/temp_ver/CG-Project/ViewFrame.cpp
f062a6319329ca5ca737e2dd25afcb6e432454bf
[]
no_license
ZJUZWT/CGProject
6bbcb131521774015ab739a5ddca9e18a6be4e8d
92699bf6a1c0cffd67b8c35c904911d986462b4e
refs/heads/main
2023-02-17T20:01:39.856859
2021-01-20T12:20:11
2021-01-20T12:20:11
309,895,603
0
1
null
null
null
null
UTF-8
C++
false
false
1,233
cpp
#include "ViewFrame.h" std::map<std::string, GLuint> ViewFramePool::_nameFBOMap; std::map<GLuint, std::shared_ptr<ViewFrame>> ViewFramePool::_FBOFrameMap; GLuint ViewFramePool::GetFrameFBO(const std::string& name) { auto target = _nameFBOMap.find(name); if (target != _nameFBOMap.end()) return target->second; else throw(std::string("No Frame Name = ") + name); } std::shared_ptr<ViewFrame> ViewFramePool::GetFrame(const GLuint& FBO) { auto target = _FBOFrameMap.find(FBO); if (target != _FBOFrameMap.end()) return target->second; else throw(std::string("No Frame FBO = ") + std::to_string(FBO)); } std::shared_ptr<ViewFrame> ViewFramePool::GetFrame(const std::string& name) { return GetFrame(GetFrameFBO(name)); } GLuint ViewFramePool::AddFrame(const std::shared_ptr<ViewFrame> frame, const std::string& name) { _FBOFrameMap.insert(std::pair<GLuint, std::shared_ptr<ViewFrame>>(frame->GetFBO(), frame)); if (name == DefaultName) { std::string&& nameDefault = name + std::to_string(_nameFBOMap.size()) + "___"; _nameFBOMap.insert(std::pair<std::string, GLuint>(nameDefault, frame->GetFBO())); } else _nameFBOMap.insert(std::pair<std::string, GLuint>(name, frame->GetFBO())); return frame->GetFBO(); }
[ "zty61211@gmail.com" ]
zty61211@gmail.com
8f5e910ed6af38b7984c2f1d2178d3bcda8291bf
23961bb4570827602c2d0022a8f80ce5197d79be
/SensorTests/Microphone/MicPlot/MicPlot.ino
06881571cb8c14ebae4828e7a7b48739fc5b4863
[]
no_license
noblegasses/SOFT564z
3bfb40a2d36ad09cf585238f32e1ccdce7d822db
48472b0fda75ae1a0dd6846d70c56a7574a0408a
refs/heads/master
2023-02-24T19:06:13.407696
2021-01-26T14:07:05
2021-01-26T14:07:05
299,572,186
0
0
null
null
null
null
UTF-8
C++
false
false
411
ino
int analog = A0; int digital = 7; void setup() { // put your setup code here, to run once: pinMode(analog, INPUT); pinMode(digital, INPUT); Serial.begin(9600); } void loop() { // put your main code here, to run repeatedly: int analogData = analogRead(analog); int digitalData= digitalRead(digital); Serial.print(digitalData); Serial.print(" , "); Serial.println(analogData); delay(20); }
[ "nicholascoiro@gmail.com" ]
nicholascoiro@gmail.com
f236b85e1970b33a26e2804833b839e5a829ef6d
383513e0f782735e4ffb3e94b214172e3280363a
/ABC/152/B.cpp
aca7a36b5f5dbf2d1f00511e8a1be6b7f7d0230b
[]
no_license
face4/AtCoder
e07c123a604f56901b186c41aa318c93b115d8d1
9c81387cb0ee7f669b50d5cc591e05c87670ee36
refs/heads/master
2021-06-27T01:07:33.806176
2020-11-20T03:47:25
2020-11-20T03:47:25
137,498,533
0
0
null
null
null
null
UTF-8
C++
false
false
260
cpp
#include<iostream> using namespace std; int main(){ int a, b; cin >> a >> b; string s = "", t = ""; for(int i = 0; i < b; i++) s += to_string(a); for(int i = 0; i < a; i++) t += to_string(b); cout << min(s,t) << endl; return 0; }
[ "s1611361@u.tsukuba.ac.jp" ]
s1611361@u.tsukuba.ac.jp
fad458b4b3452ab4cdf28d9429fa44f8fdc0f672
6c6e37259da0f0db8ff932bb6895ca19c24f7385
/plugins/SSLStrategy/src/ssl/skill/PenaltyDefV2.cpp
c612cad3ef4e494c44f6fd33a86d85f695dfa3ec
[]
no_license
yuliangzhong/robokit_ssl2017
a06cf174b71337a896f980af01cec0cc82443713
2e109ba31b693024aaa2065151acda8fd39a561c
refs/heads/master
2021-09-18T17:18:31.654955
2018-07-17T01:51:45
2018-07-17T01:51:45
140,365,116
1
1
null
null
null
null
GB18030
C++
false
false
17,473
cpp
#include "PenaltyDefV2.h" #include "skill/Factory.h" #include <VisionModule.h> #include <PlayerCommand.h> #include <CommandFactory.h> #include <ControlModel.h> #include "BallStatus.h" #include <BestPlayer.h> #include <robot_power.h> #include "RobotCapability.h" #include "GDebugEngine.h" #include "GoaliePosV1.h" namespace { bool VERBOSE_MODE = false; int maxPenaltyNum = 100; double self_x = -Param::Field::PITCH_LENGTH / 2.0 + 11.0; int defaultAverageCycle = 90; double defaultVariance = 0.0; CGeoPoint leftPos = CGeoPoint(-Param::Field::PITCH_LENGTH / 2.0 + 11.0, -30); CGeoPoint rightPos = CGeoPoint(-Param::Field::PITCH_LENGTH / 2.0 + 11.0, -2); CGeoPoint randomLeft = CGeoPoint(-Param::Field::PITCH_LENGTH / 2.0 + 11.0, -30); CGeoPoint randomRight = CGeoPoint(-Param::Field::PITCH_LENGTH / 2.0 + 11.0, 30); CGeoPoint randomLeftArrive = CGeoPoint(-Param::Field::PITCH_LENGTH / 2.0 + 11.0, -35); CGeoPoint randomRightArrive = CGeoPoint(-Param::Field::PITCH_LENGTH / 2.0 + 11.0 , 35); int AHEAD = 18; // 提前移动的帧数 int CATEGORY = 0; bool resetFlag = false; int FRAME = 0; // 从zeus2005.xml读入的defaultAverageCycle } CPenaltyDefV2::CPenaltyDefV2() { DECLARE_PARAM_READER_BEGIN(PENALTY_DEFENCE) READ_PARAM(CATEGORY) READ_PARAM(FRAME) READ_PARAM(AHEAD) DECLARE_PARAM_READER_END _category = CATEGORY; _theirPenaltyNum = 0; _isFirst = false; for (int i = 0; i < maxPenaltyNum; i++) { _stillCycle[i] = -1; } _averageStillCycle = defaultAverageCycle; _stillCycleCnt = 0; _isNormalStartLastCycle = false; _initOppDir = Param::Math::PI; _readyCnt = 0; _readyFlag = false; _variance = defaultVariance; switchCnt = 0; double self_x = -Param::Field::PITCH_LENGTH / 2.0 + 10.0; CGeoPoint leftPos = CGeoPoint(-Param::Field::PITCH_LENGTH / 2.0 + 11.0, -20); CGeoPoint rightPos = CGeoPoint(-Param::Field::PITCH_LENGTH / 2.0 + 11.0, -2); } CPenaltyDefV2::~CPenaltyDefV2() {} void CPenaltyDefV2::plan(const CVisionModule* pVision) { if (resetFlag && (CATEGORY == 3 || _state == CATEGORY_3)) { VisionModule::Instance()->ResetTheirPenaltyNum(); resetData(); resetFlag = false; } if ( pVision->Cycle() - _lastCycle > Param::Vision::FRAME_RATE * 0.1 ) { _state = BEGINNING; } // 视觉预处理 const MobileVisionT& ball = pVision->Ball(); const int runner = task().executor; const int flag = task().player.flag; const PlayerVisionT& self = pVision->OurPlayer(runner); const PlayerVisionT& enemy = pVision->TheirPlayer(this->GetNearestEnemy(pVision)); if (VERBOSE_MODE) { GDebugEngine::Instance()->gui_debug_line(ball.Pos(), CGeoPoint(-Param::Field::PITCH_LENGTH / 2, Param::Field::GOAL_WIDTH / 2), COLOR_WHITE); GDebugEngine::Instance()->gui_debug_line(ball.Pos(), CGeoPoint(-Param::Field::PITCH_LENGTH / 2, -Param::Field::GOAL_WIDTH / 2), COLOR_WHITE); } static double face_dir = 0.0; bool isNormalStart = VisionModule::Instance()->gameState().canEitherKickBall(); bool isGameOn = VisionModule::Instance()->gameState().gameOn(); static int leftOrRight = 1; // 1为left, -1为right if (isNormalStart && !_isNormalStartLastCycle) { // 收到normal start的那一帧 captureFlag = true; } _theirPenaltyNum = VisionModule::Instance()->GetTheirPenaltyNum(); if (VERBOSE_MODE) { cout << "_theirPenaltyNum: " << _theirPenaltyNum << endl; } if (_theirPenaltyNum == 1) { _isFirst = true; } else { _isFirst = false; } if (_isFirst == true && VERBOSE_MODE) { cout << "First get into CPenaltyDefV2 !" << endl; } if (_readyFlag == false && captureFlag) { _readyFlag = isOppReady(pVision); _initOppDir = enemy.Dir(); } if (isNormalStart && _readyFlag && !isOppTurn(pVision) && captureFlag) { _stillCycleCnt++; } if (isOppTurn(pVision) && captureFlag) { _stillCycle[_theirPenaltyNum - 1] = _stillCycleCnt; if (_state == CATEGORY_1) { _stillCycle[_theirPenaltyNum - 1] = 0; } for (int i = 0; i < _theirPenaltyNum - 1; i++) { if (_stillCycle[i] == -1) { _stillCycle[i] = 0; } } _stillCycleCnt = 0; _readyFlag = false; captureFlag = false; } //if (true || VERBOSE_MODE) { printStillCycle(); } if (FRAME == 0 || CATEGORY != 2) { calAverageStillCycle(); // 计算平均时间 calVariance(); // 计算时间的方差 if (_variance > 50) { resetFlag = true; } else { resetFlag = false; } } else { _averageStillCycle = FRAME; _variance = defaultVariance; } cout << "_averageStillCycle: " << _averageStillCycle << endl; //cout << "_variance: " << _variance << endl; //cout << "AHEAD: " << AHEAD << endl; if(false || VERBOSE_MODE) { cout << "isGameOn: " << isGameOn << endl; } if(false || VERBOSE_MODE) { cout << "isNormalStart:" << isNormalStart << " still Cycle count: " << _stillCycleCnt << endl; } static CGeoPoint RandomPos = CGeoPoint(-Param::Field::PITCH_LENGTH / 2.0 + 10.0, 0); static int randomCnt = 0; switch (_state) { case BEGINNING: { //cout << "_category: " << _category << endl; if (_category == 1) { _state = CATEGORY_1; if (VERBOSE_MODE) { cout << "BEGINNING --> CATEGORY_1" << endl; } } else if (_category == 2) { _state = CATEGORY_2; if (VERBOSE_MODE) { cout << "BEGINNING --> CATEGORY_2" << endl; } } else if (_category == 3) { _state = CATEGORY_3; if (VERBOSE_MODE) { cout << "BEGINNING --> CATEGORY_3" << endl; } } else if (_category == 0) { _state = CATEGORY_0; if (VERBOSE_MODE) { cout << "BEGINNING --> CATEGORY_0" << endl; } } } break; // CATEGORY_0 分支---------------------------------------------------------------------------- case CATEGORY_0: { int num = rand() % 3 + 1; //cout << "num: " << num << endl; if (num == 1) { _state = CATEGORY_1; } else if (num == 2) { _state = CATEGORY_2; } else if (num == 3) { _state = CATEGORY_3; } else { _state = CATEGORY_0; } } break; // CATEGORY_1 分支---------------------------------------------------------------------------- case CATEGORY_1: { _state = WAIT0; if (VERBOSE_MODE) { cout << "CATEGORY_1 --> RANDOM1" << endl; } } break; case RANDOM1: { if (self.Pos().dist(randomLeftArrive) < 5) { _state = RANDOM2; } switchCnt++; if (switchCnt >= rand() % 30 + 15) { _state = WAIT0; switchCnt = 0; } } break; case RANDOM2: { if (self.Pos().dist(randomRightArrive) < 5) { _state = RANDOM1; } switchCnt++; if (switchCnt >= rand() % 30 + 15) { _state = WAIT0; switchCnt = 0; } } break; case WAIT0: { switchCnt++; if (switchCnt >= 60) { _state = RANDOM1; switchCnt = 0; } } break; // CATEGORY_2 分支---------------------------------------------------------------------------- case CATEGORY_2: if (_isFirst) { _state = POS_1; if (VERBOSE_MODE) { cout << "CATEGORY_2 --> POS_1" << endl; } } else { _state = WAIT; if (VERBOSE_MODE) { cout << "CATEGORY_2 --> WAIT" << endl; } } break; case POS_1: if (self.Pos().dist(leftPos) < 2) { _state = POS_2; if (VERBOSE_MODE) { cout << "POS_1 --> POS_2" << endl; } } if (_theirPenaltyNum != 1) { _state = WAIT; if (VERBOSE_MODE) { cout << "POS_1 --> WAIT" << endl; } } break; case POS_2: if (self.Pos().dist(rightPos) < 2) { _state = POS_1; if (VERBOSE_MODE) { cout << "POS_2 --> POS_1" << endl; } } if (_theirPenaltyNum != 1) { _state = WAIT; if (VERBOSE_MODE) { cout << "POS_2 --> WAIT" << endl; } } break; case WAIT: if (_stillCycleCnt >= _averageStillCycle - AHEAD) { _state = RUSH; if (VERBOSE_MODE) { cout << "WAIT --> RUSH" << endl; } } if (_theirPenaltyNum == 1) { _state = POS_1; if (VERBOSE_MODE) { cout << "WAIT --> POS_1" << endl; } } if (self.Pos().y() < 0) { leftOrRight = 1; } else { leftOrRight = -1; } break; case RUSH: if (self.Pos().dist(CGeoPoint(self_x, leftOrRight * 22)) < 5) { leftOrRight = 0; } break; // CATEGORY_3 分支---------------------------------------------------------------------------- case CATEGORY_3: if (_isFirst) { _state = POS_3; if (VERBOSE_MODE) { cout << "CATEGORY_2 --> POS_3" << endl; } } else { _state = WAIT2; if (VERBOSE_MODE) { cout << "CATEGORY_2 --> WAIT2" << endl; } } break; case POS_3: if (self.Pos().dist(leftPos) < 2) { _state = POS_4; if (VERBOSE_MODE) { cout << "POS_3 --> POS_4" << endl; } } if (_theirPenaltyNum != 1) { _state = WAIT2; if (VERBOSE_MODE) { cout << "POS_3 --> WAIT2" << endl; } } break; case POS_4: if (self.Pos().dist(rightPos) < 2) { _state = POS_3; if (VERBOSE_MODE) { cout << "POS_4 --> POS_3" << endl; } } if (_theirPenaltyNum != 1) { _state = WAIT2; if (VERBOSE_MODE) { cout << "POS_4 --> WAIT2" << endl; } } break; case WAIT2: if (_stillCycleCnt >= _averageStillCycle - AHEAD) { _state = RUSH2; if (VERBOSE_MODE) { cout << "WAIT2 --> RUSH2" << endl; } } if (_theirPenaltyNum == 1) { _state = POS_3; if (VERBOSE_MODE) { cout << "WAIT2 --> POS_3" << endl; } } if (self.Pos().y() < 0) { leftOrRight = 1; } else { leftOrRight = -1; } break; case RUSH2: if (self.Pos().dist(CGeoPoint(self_x, leftOrRight * 22)) < 5) { leftOrRight = 0; } break; //--------------------------------------------------------------------------------------------- case STOP: setSubTask(PlayerRole::makeItStop(runner)); break; default: _state = BEGINNING; break; } //cout << "_state: " << _state << endl; switch(_state) { // CATEGORY_0 分支---------------------------------------------------------------------------- // CATEGORY_1 分支---------------------------------------------------------------------------- case RANDOM1: { face_dir = 0.0; TaskT new_task; new_task.executor = runner; new_task.player.pos = randomLeft; new_task.player.angle = face_dir; new_task.player.max_acceleration = 1400; setSubTask(TaskFactoryV2::Instance()->GotoPosition(new_task)); } break; case RANDOM2: { face_dir = 0.0; TaskT new_task; new_task.executor = runner; new_task.player.pos = randomRight; new_task.player.angle = face_dir; new_task.player.max_acceleration = 1400; setSubTask(TaskFactoryV2::Instance()->GotoPosition(new_task)); } break; case WAIT0: { CGeoPoint waitPos = GoaliePosV1::Instance()->GetPenaltyShootPos(pVision); if (waitPos.y() > 17) { waitPos.setY(17); } if (waitPos.y() < -17) { waitPos.setY(-17); } face_dir = 0.0; TaskT new_task; new_task.executor = runner; new_task.player.pos = waitPos; new_task.player.angle = face_dir; new_task.player.max_acceleration = 1400; setSubTask(TaskFactoryV2::Instance()->GotoPosition(new_task)); } // CATEGORY_2 分支---------------------------------------------------------------------------- case POS_1: { if ( Utils::Normalize(enemy.Dir() - Param::Math::PI) < -0.03 ) { leftPos.setY(20); rightPos.setY(2); } else { leftPos.setY(-20); rightPos.setY(-2); } face_dir = 0.0; TaskT new_task; new_task.executor = runner; new_task.player.pos = leftPos; new_task.player.angle = face_dir; new_task.player.max_acceleration = 1400; setSubTask(TaskFactoryV2::Instance()->GotoPosition(new_task)); } break; case POS_2: { face_dir = 0.0; TaskT new_task; new_task.executor = runner; new_task.player.pos = rightPos; new_task.player.angle = face_dir; new_task.player.max_acceleration = 150; setSubTask(TaskFactoryV2::Instance()->GotoPosition(new_task)); } break; case WAIT: { CGeoPoint waitPos = GoaliePosV1::Instance()->GetPenaltyShootPos(pVision); if (waitPos.y() > 17) { waitPos.setY(17); } if (waitPos.y() < -17) { waitPos.setY(-17); } face_dir = 0.0; TaskT new_task; new_task.executor = runner; new_task.player.pos = waitPos; new_task.player.angle = face_dir; new_task.player.max_acceleration = 1400; setSubTask(TaskFactoryV2::Instance()->GotoPosition(new_task)); } break; case RUSH: { CGeoPoint rushPos = CGeoPoint(self_x, leftOrRight * 200.0); face_dir = 0.0; TaskT new_task; new_task.executor = runner; new_task.player.pos = rushPos; new_task.player.angle = face_dir; new_task.player.max_acceleration = 1400; setSubTask(TaskFactoryV2::Instance()->GotoPosition(new_task)); } break; // CATEGORY_3 分支---------------------------------------------------------------------------- case POS_3: { if ( Utils::Normalize(enemy.Dir() - Param::Math::PI) < -0.03 ) { leftPos.setY(20); rightPos.setY(2); } else { leftPos.setY(-20); rightPos.setY(-2); } face_dir = 0.0; TaskT new_task; new_task.executor = runner; new_task.player.pos = leftPos; new_task.player.angle = face_dir; new_task.player.max_acceleration = 1400; setSubTask(TaskFactoryV2::Instance()->GotoPosition(new_task)); } break; case POS_4: { face_dir = 0.0; TaskT new_task; new_task.executor = runner; new_task.player.pos = rightPos; new_task.player.angle = face_dir; new_task.player.max_acceleration = 150; setSubTask(TaskFactoryV2::Instance()->GotoPosition(new_task)); } break; case WAIT2: { CGeoPoint waitPos = GoaliePosV1::Instance()->GetPenaltyShootPos(pVision); if (waitPos.y() > 17) { waitPos.setY(17); } if (waitPos.y() < -17) { waitPos.setY(-17); } face_dir = 0.0; TaskT new_task; new_task.executor = runner; new_task.player.pos = waitPos; new_task.player.angle = face_dir; new_task.player.max_acceleration = 1400; setSubTask(TaskFactoryV2::Instance()->GotoPosition(new_task)); } break; case RUSH2: { face_dir = 0.0; CGeoPoint rushPos = CGeoPoint(self_x, leftOrRight * 200.0); TaskT new_task; new_task.executor = runner; new_task.player.pos = rushPos; new_task.player.angle = face_dir; new_task.player.max_acceleration = 1400; setSubTask(TaskFactoryV2::Instance()->GotoPosition(new_task)); } break; } _lastCycle = pVision->Cycle(); _isNormalStartLastCycle = VisionModule::Instance()->gameState().canEitherKickBall(); CStatedTask::plan(pVision); } CPlayerCommand* CPenaltyDefV2::execute(const CVisionModule* pVision) { if( subTask() ) { return subTask()->execute(pVision); } if( _directCommand ) { return _directCommand; } return 0; } bool CPenaltyDefV2::isOppTurn(const CVisionModule *pVision) { const PlayerVisionT& enemy = pVision->TheirPlayer(this->GetNearestEnemy(pVision)); double currentOppDir = enemy.Dir(); if (fabs(Utils::Normalize(currentOppDir - _initOppDir)) > Param::Math::PI / 90) { return true; } return false; } // 当球距地方车一定距离范围内,并保持一定时间时,返回ture bool CPenaltyDefV2::isOppReady(const CVisionModule *pVision) { const PlayerVisionT& enemy = pVision->TheirPlayer(this->GetNearestEnemy(pVision)); const MobileVisionT& ball = pVision->Ball(); CVector opp2ball = ball.Pos() - enemy.Pos(); double opp2ballDist = opp2ball.mod(); //cout << "opp2ballDist: " << opp2ballDist << endl; if (opp2ballDist < 11.5) { _readyCnt++; } //cout << "_readyCnt: " << _readyCnt << endl; if (_readyCnt > 5) { _readyCnt = 0; return true; } return false; } bool CPenaltyDefV2::isOppDribble(const CVisionModule *pVision) { return false; } int CPenaltyDefV2::GetNearestEnemy(const CVisionModule *pVision) { CGeoPoint goal_center(- Param::Field::PITCH_LENGTH / 2, 0); double nearest_dist = Param::Field::PITCH_LENGTH; int enemy_num = 1; for (int i = 1; i <= Param::Field::MAX_PLAYER; i++) { if (pVision->TheirPlayer(i).Valid() == true) { if (pVision->TheirPlayer(i).Pos().dist(goal_center) < nearest_dist) { nearest_dist = pVision->TheirPlayer(i).Pos().dist(goal_center); enemy_num = i; } } } return enemy_num; } void CPenaltyDefV2::printStillCycle() { cout << "Still Cycle is : ------------------------------------------------------------" << endl; for (int i = 0; i < maxPenaltyNum; i++) { if (_stillCycle[i] == -1) { break; } cout << "No." << i+1 << ": " << _stillCycle[i] << " | "; if ( (i+1) % 7 == 0) { cout << endl; } } cout << endl; cout << "-----------------------------------------------------------------------------" << endl; } void CPenaltyDefV2::calAverageStillCycle() { int temp = 0; int j = 0; for (int i = 0; i < maxPenaltyNum; i++) { if (_stillCycle[i] == -1) { break; } if (_stillCycle[i] > 30) { temp += _stillCycle[i]; j++; } } if (j == 0) { _averageStillCycle = defaultAverageCycle; } else { _averageStillCycle = temp / j; } } void CPenaltyDefV2::calVariance() { int j = 0; double temp = 0; for (int i = 0; i < maxPenaltyNum; i++) { if (_stillCycle[i] == -1) { break; } if (fabs((double)_stillCycle[i] - _averageStillCycle) < 20 && _stillCycle[i] != 0) { temp += (_averageStillCycle - _stillCycle[i]) * (_averageStillCycle - _stillCycle[i]); j++; } else { _stillCycle[i] = 0; } } if (j == 0) { _variance = defaultVariance; } else { _variance = temp / j; } } void CPenaltyDefV2::resetData() { _theirPenaltyNum = 0; for (int i = 0; i < maxPenaltyNum; i++) { _stillCycle[i] = -1; } _averageStillCycle = defaultAverageCycle; _stillCycleCnt = 0; _variance = defaultVariance; _readyFlag = false; captureFlag = false; }
[ "zhongyuliang@sjtu.edu.cn" ]
zhongyuliang@sjtu.edu.cn
cf5918596bb9b9115a90cd3357374a2e4e6942ea
1e976ee65d326c2d9ed11c3235a9f4e2693557cf
/SimpleSearchCHdlg.h
a03bd157ea410b2de78183cc294d99e1eca60e28
[]
no_license
outcast1000/Jaangle
062c7d8d06e058186cb65bdade68a2ad8d5e7e65
18feb537068f1f3be6ecaa8a4b663b917c429e3d
refs/heads/master
2020-04-08T20:04:56.875651
2010-12-25T10:44:38
2010-12-25T10:44:38
19,334,292
3
0
null
null
null
null
UTF-8
C++
false
false
1,974
h
// /* // * // * Copyright (C) 2003-2010 Alexandros Economou // * // * This file is part of Jaangle (http://www.jaangle.com) // * // * This Program is free software; you can redistribute it and/or modify // * it under the terms of the GNU General Public License as published by // * the Free Software Foundation; either version 2, or (at your option) // * any later version. // * // * This Program is distributed in the hope that it will be useful, // * but WITHOUT ANY WARRANTY; without even the implied warranty of // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // * GNU General Public License for more details. // * // * You should have received a copy of the GNU General Public License // * along with GNU Make; see the file COPYING. If not, write to // * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. // * http://www.gnu.org/copyleft/gpl.html // * // */ #ifndef _CSimpleSearchCHdlg_h_ #define _CSimpleSearchCHdlg_h_ // CSimpleSearchCHdlg dialog #include "SearchPropertyPages.h" class CSimpleSearchCHdlg : public CSearchPropertyPages { DECLARE_DYNAMIC(CSimpleSearchCHdlg) public: CSimpleSearchCHdlg(); virtual ~CSimpleSearchCHdlg(); enum FILETYPE_OPTIONS { FTO_First, FTO_All, FTO_Audio, FTO_Video, FTO_Last }; // Dialog Data enum { IDD = IDD_PPSIMPLESEARCH }; void GetSimpleSearchText(LPTSTR bf, UINT len); void SetSimpleSearchText(LPCTSTR bf); FILETYPE_OPTIONS GetFileTypeOption(); void SetFileTypeOption(FILETYPE_OPTIONS fto); //void SetRealParent(CWnd* pParent){m_pParent = pParent;} virtual void ApplyTranslation(ITranslation& skin); //ICtrlStrings protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support virtual BOOL OnInitDialog(); DECLARE_MESSAGE_MAP() private: //void ShowAllCheckChanged(); FILETYPE_OPTIONS m_fto; public: afx_msg void OnBnClickedSearch(); }; #endif
[ "outcast1000@dc1b949e-fa36-4f9e-8e5c-de004ec35678" ]
outcast1000@dc1b949e-fa36-4f9e-8e5c-de004ec35678
45a154dc71fbf078d586af66f7c3a1bd2fbcd4c6
2e2c142919b728417f464b1834bdab929693d85a
/Problem Solving/Algorithms/Implementation/Minimum Distances/minimum distances.cpp
8c863c46690bca302f32bb2d69f24185ec885b0e
[ "MIT" ]
permissive
ryderdo/HackerRank
d6ce2fbe18375fb666b6611897179915e2203ebf
072c5796eb5907f45f214f1af45338d0c6830893
refs/heads/main
2023-04-25T06:09:04.331931
2021-05-17T03:48:15
2021-05-17T03:48:15
368,132,040
1
0
MIT
2021-05-17T09:39:40
2021-05-17T09:39:39
null
UTF-8
C++
false
false
1,327
cpp
/* Author: Isaac Asante * HackerRank URL for this exercise: https://www.hackerrank.com/challenges/minimum-distances/problem * Original video explanation: https://www.youtube.com/watch?v=TgcJHlu64zo * Last verified on: March 26, 2021 */ /* IMPORTANT: * This code is meant to be used as a solution on HackerRank (link above). * It is not meant to be executed as a standalone program. */ // Complete the minimumDistances function below. int minimumDistances(vector<int> a) { map<int, pair<int, int>> m; int minimum = INT_MAX; for (unsigned long i = 0; i < a.size(); i++) { if (m.find(a[i]) == m.end()) { m.insert({ a[i], {i, INT_MAX} }); } else { int first = get<0>(m[a[i]]); int second = get<1>(m[a[i]]); if (second == INT_MAX) { second = i; if (i - first < minimum) minimum = i - first; } else { int new_diff = i - second; if (second - first > new_diff) { first = second; second = i; if (new_diff < minimum) minimum = new_diff; } } } } if (minimum == INT_MAX) return -1; else return minimum; }
[ "isaac.editor16@gmail.com" ]
isaac.editor16@gmail.com
ccf60710bdc4701ab1a42115b9ced0651392ca87
e6c80d747be1496b9c0ebcc8a8bc33bd64eb17dd
/Codes/C++ Programs/Others/Student.cpp
e69dd8898f28e569d77ea194f697168eae12b4a3
[]
no_license
developersbk/Universal_Code_Snippets
56b25fb43cc2c67113e97e691cc48f8a0b0193f6
0001535476a5743c0557c5ce2c3ffc13c6ee8791
refs/heads/master
2023-02-24T08:16:57.240264
2020-02-29T01:21:46
2020-02-29T01:21:46
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,709
cpp
Student #include<iostream.h> #define NUM_TEST 10 #define NUM_STUDENTS 4 int test_grades [NUM_STUDENTS][NUM_TEST]; void enter_Grade() { int student, test, more=1, grade; char yorn; cout << "\nenter a test grade\n"; while(more) { cout <<"\Student #"; cin>>student; cin.ignore(80,'\n'); cout << "\ntest #"; cin>>test; cin.ignore(80,'\n'); cout << "\ngrade #"; cin>>grade; cin.ignore(80,'\n'); test_grades[student-1][test-1] =grade; cout << "\nanother grade?"; cin >>yorn; cin.ignore(80,'\n'); if (yorn=='n') more=0; } } void test_Avarege() { int student=0, anotherA=1, testdid, testNum, Total; while(anotherA) { student=0; Total=0; testdid=0; cout << "\nTest Avarege\n\n"; cout << "\nNumber of the Student"; cin >>student; for (testNum=0; testNum<=3; testNum++) { if (test_grades[student-1][testNum]) { testdid++; Total+= test_grades[student-1][testNum]; cout << "\nTest #: "<<testNum+1 <<" Grade: "<<test_grades[student-1][testNum]<<"\n"; } else cout << "\n\n Student "<<student<<"did not take the test" <<testNum+1<<"\n"; } cout << "\n Student has the avarege of " <<Total/testdid; cout << "\nDo you want to see another avarege? 0 to end or 1 to continue . "; cin>>anotherA; } return; } get_Help() { cout << "\nThank you for enter this program. This is that way it works:"; cout << "\n\n1st Option, Enter Grade:"; cout << "\nIf you choose this option you will be able to enter a gradeto a "; cout << "\ndisere student, just remenber that is only 4 students"; cout << "\n\n2nd option, Test Avarege: "; cout << "\nif you choose this option you will be anle to see the overroll "; cout << "\navarege of the student that you chose"; cout << "\n\n3er option, Help:"; cout << "\nif you chose this optionthe user will be able to see the insatruction"; cout << "\nabout how this program works"; cout << "\n\n4th option, Exit"; cout << "\nif you chosse this option the user will be able to exit the program"; cout << "\nI hope you like what i did"; return 0; } int main() { int option=0; int hold; while (option!=4) { while ((option<1)||(option>4)) { cout << "\nWelcome to my 3th program by Cecilio O. Uribe"; cout << "\nChose any option follow by the enter key\n\n"; cout << "\n1. Enter Grade"; cout << "\n2. Test Avarege"; cout << "\n3. Help"; cout << "\n4. Exit\n\n"; cin >> option; } if(option==1) { enter_Grade(); option=0; } if(option==2) { test_Avarege(); option=0; } if(option==3) { get_Help(); option=0; } } cout << "LATER!"; cin >> hold; return 0; }
[ "sbkannath1996@gmail.com" ]
sbkannath1996@gmail.com
8764952baf221e2e85ab9fd5fbf17436e823382a
523968c38a94a953c204bfc8a3992779ae549ae3
/Gameplay.h
f99172f465d474d4daf5eb74a710537634cba359
[]
no_license
andy805/Battle
8892c5106d457f2c5c9f69bca5c9ff992a1094d1
0240e99e5031e7f884f3c6a4fe6ef323b5998132
refs/heads/master
2020-09-14T09:20:18.181990
2019-11-21T04:26:57
2019-11-21T04:26:57
223,088,435
0
0
null
null
null
null
UTF-8
C++
false
false
1,727
h
#ifndef _GAMEPLAY_H #define _GAMEPLAY_H #include <vector> #include "Level.h" #include "Player.h" #include "NPC.h" #include "PauseMenu.h" #include "GameplayObject.h" class Gameplay { public: Gameplay(); ~Gameplay(); static int frame; static Gameplay * instance; Level * level; std::vector<Player*> * players; std::vector<NPC*> * npcs; std::vector<GameplayObject*> * objects; void run(); void set_level(Level * level); void add_player(Player * player); void add_npc(NPC * npc); void add_object(GameplayObject * obj); void bounce_up_players_and_npcs(SDL_Rect * rect, SDL_Rect * source); static bool is_intersecting(SDL_Rect * one, SDL_Rect * two); protected: virtual void initialize(); virtual void deinitialize(); void reset_game(); virtual void pause(Player * p); void process_countdown(); virtual void draw_pause_screen(); virtual void draw_score(); virtual void draw_game_ended(); virtual void draw_countdown(); virtual void on_game_reset() = 0; virtual void on_pre_processing() = 0; virtual void on_post_processing() = 0; void process_player_collission(); void process_npc_collission(); void process_player_npc_collission(); void handle_pause_input(SDL_Event * event); bool game_running; PauseMenu * pause_menu; bool countdown; int countdown_sec_left; int countdown_start; char countdown_pre_text[20]; bool ended; int end_start; bool music_playing; SDL_Surface * screen; // Do players collide with each other? bool players_collide; // Do NPC's collide with each other? bool npcs_collide; // Do players collide with NPC's? bool players_npcs_collide; }; #endif
[ "alshan@calpoly.edu" ]
alshan@calpoly.edu
e50ca395ffad915690808fb4ed06bab683e86792
600df3590cce1fe49b9a96e9ca5b5242884a2a70
/chrome/browser/extensions/api/webstore_widget_private/app_installer.cc
3c1af8493f77af3bb0fe4235ea901de4c50afe41
[ "BSD-3-Clause" ]
permissive
metux/chromium-suckless
efd087ba4f4070a6caac5bfbfb0f7a4e2f3c438a
72a05af97787001756bae2511b7985e61498c965
refs/heads/orig
2022-12-04T23:53:58.681218
2017-04-30T10:59:06
2017-04-30T23:35:58
89,884,931
5
3
BSD-3-Clause
2022-11-23T20:52:53
2017-05-01T00:09:08
null
UTF-8
C++
false
false
3,195
cc
// Copyright 2013 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/webstore_widget_private/app_installer.h" #include "base/macros.h" #include "chrome/common/extensions/webstore_install_result.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_observer.h" namespace { const char kWebContentsDestroyedError[] = "WebContents is destroyed."; } // namespace namespace webstore_widget { class AppInstaller::WebContentsObserver : public content::WebContentsObserver { public: WebContentsObserver(content::WebContents* web_contents, AppInstaller* parent) : content::WebContentsObserver(web_contents), parent_(parent) {} protected: // content::WebContentsObserver implementation. void WebContentsDestroyed() override { parent_->OnWebContentsDestroyed(web_contents()); } private: AppInstaller* parent_; DISALLOW_IMPLICIT_CONSTRUCTORS(WebContentsObserver); }; AppInstaller::AppInstaller(content::WebContents* web_contents, const std::string& item_id, Profile* profile, bool silent_installation, const Callback& callback) : extensions::WebstoreStandaloneInstaller(item_id, profile, callback), silent_installation_(silent_installation), callback_(callback), web_contents_(web_contents), web_contents_observer_(new WebContentsObserver(web_contents, this)) { } AppInstaller::~AppInstaller() { } bool AppInstaller::CheckRequestorAlive() const { // The tab may have gone away - cancel installation in that case. return web_contents_ != NULL; } const GURL& AppInstaller::GetRequestorURL() const { return GURL::EmptyGURL(); } std::unique_ptr<ExtensionInstallPrompt::Prompt> AppInstaller::CreateInstallPrompt() const { if (silent_installation_) return nullptr; std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt( new ExtensionInstallPrompt::Prompt( ExtensionInstallPrompt::INLINE_INSTALL_PROMPT)); prompt->SetWebstoreData(localized_user_count(), show_user_count(), average_rating(), rating_count()); return prompt; } bool AppInstaller::ShouldShowPostInstallUI() const { return false; } bool AppInstaller::ShouldShowAppInstalledBubble() const { return false; } content::WebContents* AppInstaller::GetWebContents() const { return web_contents_; } bool AppInstaller::CheckInlineInstallPermitted( const base::DictionaryValue& webstore_data, std::string* error) const { DCHECK(error != NULL); DCHECK(error->empty()); return true; } bool AppInstaller::CheckRequestorPermitted( const base::DictionaryValue& webstore_data, std::string* error) const { DCHECK(error != NULL); DCHECK(error->empty()); return true; } void AppInstaller::OnWebContentsDestroyed(content::WebContents* web_contents) { callback_.Run(false, kWebContentsDestroyedError, extensions::webstore_install::OTHER_ERROR); AbortInstall(); } } // namespace webstore_widget
[ "enrico.weigelt@gr13.net" ]
enrico.weigelt@gr13.net
5876014a68e851bf4fae94d446177315e82f34c5
e659689f77a4c8e34428b56c30d135be741fa2d7
/Code/Common/Control/Action.h
45bf9f97cfd89cedc1ecbbc56c162e701b11bb80
[]
no_license
skyxiao/acmrcsh
01db2823b2ae495abddb47ef296c0fb97b99a374
3d52585d4311e71812b1976818752c81f497b569
refs/heads/master
2020-04-10T11:55:37.268992
2014-09-18T07:41:25
2014-09-18T07:41:25
21,031,185
2
0
null
null
null
null
WINDOWS-1252
C++
false
false
2,596
h
/* * WaitCondition.h * * Created on: 2014Äê2ÔÂ19ÈÕ * Author: acm */ #ifndef ACTION_H_ #define ACTION_H_ #include "boost/chrono.hpp" #include "boost/function.hpp" const int RESULT_UNFINISHED = 1; const int RESULT_OK = 0; const int RESULT_FAILED = -1; class WaitCondition { public: WaitCondition(boost::function<bool ()> f, unsigned int timeout, boost::function<void ()> evt_f) : m_flag(true), m_timeout(timeout), m_f(f), m_evt_f(evt_f) { } ~WaitCondition() {}; int operator ()() { if(m_flag) { m_expired_time = boost::chrono::system_clock::now() + boost::chrono::milliseconds(m_timeout); m_flag = false; } if(m_f()) { m_flag = true; return RESULT_OK; } if(boost::chrono::system_clock::now() > m_expired_time) { m_flag = true; if(m_evt_f) { m_evt_f(); } return RESULT_FAILED; } return RESULT_UNFINISHED; } private: bool m_flag; unsigned int m_timeout; boost::chrono::time_point<boost::chrono::system_clock> m_expired_time; boost::function<bool ()> m_f; boost::function<void ()> m_evt_f; }; class Wait { public: Wait(unsigned int timeout) : m_flag(true), m_timeout(timeout) { } ~Wait() {}; int operator ()() { if(m_flag) { m_expired_time = boost::chrono::system_clock::now() + boost::chrono::milliseconds(m_timeout); m_flag = false; } if(boost::chrono::system_clock::now() > m_expired_time) { m_flag = true; return RESULT_OK; } return RESULT_UNFINISHED; } private: bool m_flag; unsigned int m_timeout; boost::chrono::time_point<boost::chrono::system_clock> m_expired_time; }; class Command { public: Command(boost::function<void ()> f) : m_f(f) { } ~Command() {}; int operator ()() { m_f(); return RESULT_OK; } private: boost::function<void ()> m_f; }; class Expect { public: Expect(boost::function<bool ()> f, unsigned int duration, boost::function<void ()> evt_f) : m_flag(true), m_duration(duration), m_f(f), m_evt_f(evt_f) { } ~Expect() {}; int operator ()() { if(m_flag) { m_expired_time = boost::chrono::system_clock::now() + boost::chrono::milliseconds(m_duration); m_flag = false; } if(boost::chrono::system_clock::now() > m_expired_time) { m_flag = true; return RESULT_OK; } if(!m_f()) { m_flag = true; return RESULT_FAILED; } return RESULT_UNFINISHED; } private: bool m_flag; unsigned int m_duration; boost::chrono::time_point<boost::chrono::system_clock> m_expired_time; boost::function<bool ()> m_f; boost::function<void ()> m_evt_f; }; #endif /* WAITCONDITION_H_ */
[ "sundongyan@gmail.com" ]
sundongyan@gmail.com
7c36be16716b6ef993ed07b75aeac7bed8d350f7
30bdd8ab897e056f0fb2f9937dcf2f608c1fd06a
/DP/2958.cpp
112aa284624bc70c45b05be1f5921f1f1459a67e
[]
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
607
cpp
#include <bits/stdc++.h> using namespace std; int n, k, tk; string s; int i, l, r; deque<int>q; int mx; void solve(char c){ l = 0; r = 0; while(l < n){ r = max(r, l); while(r < n){ if(s[r] != c && q.size() < k){q.push_back(r);} else if(s[r] != c && q.size() >= k)break; r++; } mx = max(mx, r - l); l++; while(q.size() > 0){ int x = q.front(); if(x < l)q.pop_front(); else break; } } } int main(){ cin >> n >> k; cin >> s; solve('a'); solve('b'); cout << mx << endl; return 0; }
[ "mukeshchugani10@gmail.com" ]
mukeshchugani10@gmail.com
af250913d93ea0dc6ae1bc22dddf1432d53d832c
11f3c2bce3736b7e650bc66ef57cb15687da5d74
/Classes/AppDelegate.cpp
94ceeb7d8a385cd9c9aac2b511a4e2d51330265f
[]
no_license
holybomb/ComboGem
3cab3fe156884340e27a15f49ebebbdada270980
79e0c9ce5829e145476e28329a73ae13c95436e6
refs/heads/master
2021-01-25T00:16:10.330776
2013-10-10T10:01:08
2013-10-10T10:01:08
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,848
cpp
#include "AppDelegate.h" #include "MainMenuScene.h" #include "GameScene.h" #include "GameDefine.h" USING_NS_CC; AppDelegate::AppDelegate() { } AppDelegate::~AppDelegate() { if(SimpleAudioEngine::sharedEngine()->isBackgroundMusicPlaying()) SimpleAudioEngine::sharedEngine()->stopBackgroundMusic(true); } bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector* pDirector = CCDirector::sharedDirector(); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); pDirector->setOpenGLView(pEGLView); // pEGLView->setFrameSize(480,800); pEGLView->setDesignResolutionSize(DESIGN_SCREEN_SIZE_W,DESIGN_SCREEN_SIZE_H, kResolutionShowAll); // turn on display FPS pDirector->setDisplayStats(!true); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); // create a scene. it's an autorelease object CCScene *pScene = MainMenuLoadingScene::scene(); // run pDirector->runWithScene(pScene); return true; } // This function will be called when the app is inactive. When comes a phone call,it's be invoked too void AppDelegate::applicationDidEnterBackground() { CCDirector::sharedDirector()->stopAnimation(); if(SimpleAudioEngine::sharedEngine()->isBackgroundMusicPlaying()) SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic(); // if you use SimpleAudioEngine, it must be pause // SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic(); } // this function will be called when the app is active again void AppDelegate::applicationWillEnterForeground() { CCDirector::sharedDirector()->startAnimation(); SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic(); // if you use SimpleAudioEngine, it must resume here // SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic(); }
[ "holybomb@163.com" ]
holybomb@163.com
bb691c1bf433414466110388a961f5d644680b7f
fc2bbde24d8ec2e67526fcb0dfc34e52304a1f18
/duct/IO/multistream.hpp
2e298d06fffed2ae518591f1dd2cd63b5403caab
[ "MIT" ]
permissive
komiga/duct-cpp
f07d8d54ae12f6e1d297e8a2e3e828e958deb280
65862a832d497e55e8a6dd1df8dab2801e698a6e
refs/heads/master
2020-06-08T09:50:43.703408
2015-10-31T19:15:14
2015-10-31T19:15:14
1,194,357
1
2
null
null
null
null
UTF-8
C++
false
false
7,390
hpp
/** @copyright MIT license; see @ref index or the accompanying LICENSE file. @file @brief Multicast stream. */ #pragma once #include "../config.hpp" #include "../aux.hpp" #include "./memstream.hpp" #include <type_traits> #include <utility> #include <ostream> namespace duct { namespace IO { // Forward declarations template< class CharT, class TraitsT = std::char_traits<CharT> > class basic_multistreambuf; template< class CharT, class TraitsT = std::char_traits<CharT> > class basic_omultistream; /** @addtogroup io @{ */ /** Vector of output streams. @remarks The element type is a pointer so that stream disabling is more efficient. @c basic_memstreambuf::multicast() will ignore @c nullptr elements. */ using multicast_vector_type = aux::vector<std::ostream*>; /** @name Multicast stream type aliases @{ */ /** Multicast streambuf. */ using multistreambuf = basic_multistreambuf<char>; /** Output multicast stream. */ using omultistream = basic_omultistream<char>; /** @} */ // end of name-group Multicast stream type aliases /** Multicast output streambuf. @remarks The data in this streambuf will be flushed to the multicast streams when @c overflow() or @c pubsync() are called. By extension, flushing a @c basic_omultistream will call @c pubsync(). @sa basic_omultistream */ template<class CharT, class TraitsT> class basic_multistreambuf : public basic_memstreambuf<CharT, TraitsT> { private: using base_type = basic_memstreambuf<CharT, TraitsT>; public: /** @name Types */ /// @{ /** Character type. */ using typename base_type::char_type; // FIXME [TRAITS_TYPE] /** Traits type. */ using traits_type = typename base_type::traits_type; /** @c traits_type::int_type. */ using typename base_type::int_type; /** @c traits_type::pos_type. */ using typename base_type::pos_type; /** @c traits_type::off_type. */ using typename base_type::off_type; /// @} private: multicast_vector_type& m_streams; public: /** @name Constructors and destructor */ /// @{ /** Default constructor (deleted). */ basic_multistreambuf() = delete; /** Constructor with output buffer. @param streams Streams to multicast to. @param buffer Data buffer. @param size Size of @a buffer. @param mode @c openmode for the streambuf; defaults to and forces @c std::ios_base::out. */ basic_multistreambuf( multicast_vector_type& streams, void* const buffer, std::size_t const size, std::ios_base::openmode const mode = std::ios_base::out ) : base_type(buffer, size, mode) , m_streams(streams) {} /** Destructor. */ virtual ~basic_multistreambuf() override = default; /// @} /** @name Properties */ /// @{ /** Set multicast stream vector. @param streams New multicast stream vector (reference). */ void set_streams( multicast_vector_type& streams ) noexcept { m_streams = streams; } /** Get multicast stream vector. @returns The multicast stream vector. */ multicast_vector_type& streams() noexcept { return m_streams; } /** @copydoc basic_multistreambuf::streams() noexcept */ multicast_vector_type const& streams() const noexcept { return m_streams; } /// @} /** @name Operations */ /// @{ /** Write data in put area to all streams and reset put area. @remarks This does not explicitly @c flush() the multicast streams. */ void multicast() { if (this->pbase() != this->pptr()) { for (std::ostream* stream : m_streams) { if (nullptr != stream) { stream->write( this->pbase(), this->pptr() - this->pbase() ); } } // Reset put area to beginning of data buffer this->setp_all(this->pbase(), this->pbase(), this->epptr()); } } /// @} protected: /** @cond INTERNAL */ virtual int_type overflow( int_type c = traits_type::eof() ) override { multicast(); if (traits_type::not_eof(c) == c) { (*this->pptr()) = traits_type::to_char_type(c); this->pbump(1); } return traits_type::not_eof(c); } virtual int_type sync() override { multicast(); return 0; } /** @endcond */ // INTERNAL }; /** Output multicast stream. @remarks If the streambuf does not overflow or sync before the stream is destroyed, no data will be multicast. Thus, multicast streams must be flushed manually to ensure data propagates. @sa basic_multistreambuf */ template<class CharT, class TraitsT> class basic_omultistream final : public std::basic_ostream<CharT, TraitsT> { private: using base_type = std::basic_ostream<CharT, TraitsT>; public: /** @name Types */ /// @{ /** Character type. */ using typename base_type::char_type; /** Traits type. */ using typename base_type::traits_type; /** @c traits_type::int_type. */ using typename base_type::int_type; /** @c traits_type::pos_type. */ using typename base_type::pos_type; /** @c traits_type::off_type. */ using typename base_type::off_type; /** Multistream buffer type. */ using multistreambuf_type = basic_multistreambuf<char_type, traits_type>; /// @} private: multicast_vector_type m_streams; multistreambuf_type m_streambuf; public: /** @name Constructors and destructor */ /// @{ /** Default constructor (deleted). */ basic_omultistream() = delete; /** Constructor with buffer. @param streams Streams to multicast to. @param buffer Data buffer. @param size Size of data buffer. @param mode @c openmode for the stream; defaults to and forces @c std::ios_base::out; removes @c std::ios_base::in. */ basic_omultistream( multicast_vector_type&& streams, void* const buffer, std::size_t const size, std::ios_base::openmode const mode = std::ios_base::out ) : base_type(&m_streambuf) , m_streams(std::move(streams)) , m_streambuf( m_streams, buffer, size, (mode & ~std::ios_base::in) | std::ios_base::out ) {} /** Copy constructor (deleted). */ basic_omultistream(basic_omultistream const&) = delete; /** Move constructor. */ basic_omultistream(basic_omultistream&&) = default; /** Destructor. */ ~basic_omultistream() override = default; /// @} /** @name Operators */ /// @{ /** Copy assignment operator (deleted). */ basic_omultistream& operator=(basic_omultistream const&) = delete; /** Move assignment operator. */ basic_omultistream& operator=(basic_omultistream&&) = default; /// @} /** @name Properties */ /// @{ /** Set multicast stream vector. @note This does not update the streambuf's multicast stream vector reference. If the streambuf's vector reference was not changed externally, it will still point to the stream's vector. This function moves @a streams into the stream's vector. @param streams New multicast stream vector. */ void set_streams( multicast_vector_type streams ) noexcept { // FIXME: Defect in libstdc++ 4.7.3: missing move variant m_streams.assign(std::move(streams)); } /** Get multicast stream vector. @returns Multicast stream vector. */ multicast_vector_type& streams() noexcept { return m_streams; } /** @copydoc basic_omultistream::streams() noexcept */ multicast_vector_type const& streams() const noexcept { return m_streams; } /** Get streambuf. @returns Pointer to the stream's streambuf (never @c nullptr). */ multistreambuf_type* rdbuf() const noexcept { return const_cast<multistreambuf_type*>(&m_streambuf); } /// @} }; /** @} */ // end of doc-group io } // namespace IO } // namespace duct
[ "me@komiga.com" ]
me@komiga.com
fa2e097d3af2767c530ba34c9a75a1f1fdd4d1c5
d1d6252e5cf049175dae97504fb3d263b614c8ae
/lib_color.h
102990d611ce50080e6366096102300af69db306
[ "MIT" ]
permissive
MathsionYang/Bag-of-Words_OpenCV
d333735065138d940b9d439b62e2788800d64a41
1de74762f030b6174555e41ef5297c4a478b1476
refs/heads/master
2021-06-04T03:57:32.539262
2016-07-24T19:01:18
2016-07-24T19:01:18
null
0
0
null
null
null
null
UTF-8
C++
false
false
719
h
#include <opencv2\core\core.hpp> // include core.hpp to use MAT #include <vector> /* * class that includes some color methods * * * written by Cagatay Odabasi * */ // The name is to prevent from confusion class Colorful { public: Colorful(){}; // void constructor // method to extract BGR channels from a picture std::vector<cv::Mat> extractRGB(cv::Mat); // method to convert BGR to HSV // and returns the each HSV channel seperately std::vector<cv::Mat> convertBGR2HSV(cv::Mat); // method to convert HSV to BGR // and returns the each BGR channel seperately std::vector<cv::Mat> convertHSV2BGR(cv::Mat); };
[ "cagatayodabasi91@gmail.com" ]
cagatayodabasi91@gmail.com
ee71aa1d382830242b9745950923b3b09607e549
fab88a9d23aec744b7b4e409b05558783521659f
/Lesson_2/Task_4/main.cpp
e62664ef7ed78141bc0d9614fee2dc0af5efbaed
[]
no_license
ulairon/NG_2021_Kravchenko_Vladyslav
a43adef708b8bcbd022ab749e999ba4abeff4ced
82002b260e8b4abbfa440f81f685a580a457dadb
refs/heads/master
2023-06-26T19:30:25.588117
2021-07-30T06:35:05
2021-07-30T06:35:05
384,914,996
0
0
null
null
null
null
UTF-8
C++
false
false
992
cpp
#include <iostream> using namespace std; int main() { int dlina, for_dlina, for_dlina_2 ; cout << "vvedite dlinnu pravilnogo treugolnika: " ; cin >> dlina ; cout << endl ; //to make free space. if (dlina <= 1) { cout << "dlinna dolzhna bit bolshe chem 1" ; } else { for (int i = 0; i <2; i++) { for(for_dlina = 1; for_dlina <= dlina; for_dlina++) { for(for_dlina_2 = 1; for_dlina_2 <= for_dlina; for_dlina_2++) { cout << "* "; } cout << endl ; } cout << endl ; for(for_dlina_2 = dlina; for_dlina_2 >= 1; for_dlina_2--) { for(for_dlina = 1; for_dlina <= for_dlina_2; for_dlina++) { cout << "* " ; } cout << endl ; } cout << endl ; } } return 0 ; }
[ "wwmoonrage@gmail.com" ]
wwmoonrage@gmail.com
c8005404b7a2e32cb1ae429936ab6dda9f72164a
e1dd28ef63548cceeab7353988336be30b7c6db5
/BroadcastIPAddr/BroadcastIPAddrClient.h
e7ce95e71c97acae228be11a3e4ff338905df8a0
[]
no_license
liangqidong/BroadcastIPAddr
f6a8979545783a32672a25d35e6ab99ab5eb974c
c24b9c8d6898dbc5e82e3ea4e8450b42a835efae
refs/heads/master
2020-06-28T10:16:19.989525
2019-08-27T09:18:58
2019-08-27T09:18:58
200,207,742
0
0
null
null
null
null
UTF-8
C++
false
false
655
h
#ifndef BROADCAST_IP_ADDR_CLENT_H #define BROADCAST_IP_ADDR_CLENT_H #include "BroadcastComDefine.h" class BroadcastIPAddrClient { public: BroadcastIPAddrClient(); ~BroadcastIPAddrClient(); long RegRecFun(BroadcastRecDataFun recDataFun); long BindBroadcastServerPort(unsigned int port); long SendData(const char* data, unsigned int& dataLen, const char* addrIP = "0.0.0.0"); long Process(); private: void* obj; }; #ifdef __cplusplus extern "C" { #endif EXPORTDLL_API void CreateClientObj(BroadcastIPAddrClient* obj); EXPORTDLL_API void DestroyClientObj(BroadcastIPAddrClient* obj); #ifdef __cplusplus } #endif #endif//BROADCAST_IP_ADDR_CLENT_H
[ "18088708700@163.com" ]
18088708700@163.com
41ca4508651e2848b6ab93a2614b46631a7898dd
37921f2bce42c9618a50fa298df7cfb82e1abc7c
/Code/RHI/BerserkRHI/RHIDevice.hpp
32c7393e7092b65ae684b170ec20b87a9cfb5ab6
[ "MIT" ]
permissive
checkioso/Berserk
17e7ee812f6685e92a447209b0874dcec3a44976
92c574aa01c5885857e4742f33183b75941b7b24
refs/heads/master
2023-05-04T23:33:27.883883
2021-05-20T18:25:03
2021-05-20T18:25:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,698
hpp
/**********************************************************************************/ /* This file is part of Berserk Engine project */ /* https://github.com/EgorOrachyov/Berserk */ /**********************************************************************************/ /* MIT License */ /* */ /* Copyright (c) 2018 - 2021 Egor Orachyov */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining a copy */ /* of this software and associated documentation files (the "Software"), to deal */ /* in the Software without restriction, including without limitation the rights */ /* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell */ /* copies of the Software, and to permit persons to whom the Software is */ /* furnished to do so, subject to the following conditions: */ /* */ /* The above copyright notice and this permission notice shall be included in all */ /* copies or substantial portions of the Software. */ /* */ /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR */ /* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, */ /* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE */ /* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER */ /* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, */ /* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */ /* SOFTWARE. */ /**********************************************************************************/ #ifndef BERSERK_RHIDEVICE_HPP #define BERSERK_RHIDEVICE_HPP #include <BerserkRHI/RHIDefs.hpp> #include <BerserkRHI/RHISampler.hpp> #include <BerserkRHI/RHIProgram.hpp> #include <BerserkRHI/RHIVertexBuffer.hpp> #include <BerserkRHI/RHIIndexBuffer.hpp> #include <BerserkRHI/RHIUniformBuffer.hpp> #include <BerserkRHI/RHIVertexDeclaration.hpp> #include <BerserkRHI/RHITexture.hpp> #include <BerserkRHI/RHIFramebuffer.hpp> #include <BerserkRHI/RHICmdList.hpp> namespace Berserk { namespace RHI { /** * @brief RHI device * * Device object exposes common object creation api. * * Device provided objects can be safely created from any thread. Create functions * immediately return the created object reference, but actual object creation * on the GPU side is deferred, until the RHI execution thread reaches * object creation and does it its side. * * From user side, created objects can be safely and immediately used in * the drawing and update api via command buffers. */ class Device { public: virtual ~Device() = default; virtual RefCounted<VertexDeclaration> CreateVertexDeclaration(const VertexDeclaration::Desc& desc) = 0; virtual RefCounted<VertexBuffer> CreateVertexBuffer(const VertexBuffer::Desc& desc) = 0; virtual RefCounted<IndexBuffer> CreateIndexBuffer(const IndexBuffer::Desc& desc) = 0; virtual RefCounted<UniformBuffer> CreateUniformBuffer(const UniformBuffer::Desc& desc) = 0; virtual RefCounted<Sampler> CreateSampler(const Sampler::Desc& desc) = 0; virtual RefCounted<Texture> CreateTexture(const Texture::Desc& desc) = 0; virtual RefCounted<Framebuffer> CreateFramebuffer(const Framebuffer::Desc& desc) = 0; virtual RefCounted<Program> CreateProgram(const Program::Desc& desc) = 0; virtual RefCounted<CmdList> CreateCmdList() = 0; virtual const Array<TextureFormat> &GetSupportedFormats() const; virtual const Array<ShaderLanguage> &GetSupportedShaderLanguages() const; virtual Type GetDriverType() const = 0; virtual const DeviceCaps &GetCaps() const = 0; protected: Array<TextureFormat> mSupportedTextureFormats; Array<ShaderLanguage> mSupportedShaderLanguages; }; } } #endif //BERSERK_RHIDEVICE_HPP
[ "egororachyov5@gmail.com" ]
egororachyov5@gmail.com
48dc3e559c3919b4959d6ec561b98a1531019e4f
2e619c8e2b667640989c6703a39fde3e4485679b
/2. Leetcode/easy level/311. number of rectangles that can form the largest square.cpp
211703d9456b07787e25abaa4c25d590f0416f0b
[]
no_license
satyampandey9811/competitive-programming
76957cde72ba217894ba18370f6489d7c481ba55
8ca1e2608f5d221f4be87529052c8eb3b0713386
refs/heads/master
2022-10-14T11:13:16.704203
2022-09-20T18:24:09
2022-09-20T18:24:09
203,355,790
0
0
null
null
null
null
UTF-8
C++
false
false
490
cpp
// link to question - https://leetcode.com/problems/number-of-rectangles-that-can-form-the-largest-square/ class Solution { public: int countGoodRectangles(vector<vector<int>>& a) { int maxl = 0, n = a.size(); for(int i = 0; i < n; i++) { maxl = max(maxl, min(a[i][0], a[i][1])); } int ans = 0; for(int i = 0; i < n; i++) { if(min(a[i][0], a[i][1]) == maxl) ans++; } return ans; } };
[ "satyampandey9811@gmail.com" ]
satyampandey9811@gmail.com
7d74e91ee9cf26c3cab921c70d7413c2c6857fdb
60cbfe82da04f4c8c1d1505986b815da098335e2
/core/sqf/src/seabed/src/npvmap.cpp
8fb62d2d47cc747805a7b22ed9c8df28d254ee6b
[ "Apache-2.0" ]
permissive
alchen99/traf-merged
596fdd637c843960aa9d28b90afa1a01ae2de4f3
cfd94433098b02ec5394c96b8b76adbf50403abe
refs/heads/master
2020-12-03T00:00:57.962489
2015-06-04T21:43:43
2015-06-04T21:43:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,768
cpp
//------------------------------------------------------------------ // // (C) Copyright 2006-2013 Hewlett-Packard Development Company, L.P. // //-@@@-END-COPYRIGHT-@@@-------------------------------------------- #include "seabed/int/opts.h" #ifdef SQ_PHANDLE_VERIFIER #include <stdio.h> #include <string.h> #include "npvmap.h" #include "util.h" #ifndef USE_SB_INLINE #include "npvmap.inl" #endif // // Implement long-long map // SB_NPVmap::SB_NPVmap(int pv_buckets, float pv_lf) : SB_Map_Comm(SB_ECID_MAP_LL, "npvmap", pv_buckets, pv_lf) { init(); } SB_NPVmap::SB_NPVmap(const char *pp_name, int pv_buckets, float pv_lf) : SB_Map_Comm(SB_ECID_MAP_LL, "npvmap", pp_name, pv_buckets, pv_lf) { init(); } SB_NPVmap::~SB_NPVmap() { delete [] ipp_HT; } #ifdef NPVMAP_CHECK void SB_NPVmap::check_integrity() { SB_NPVML_Type *lp_item; int lv_count; int lv_hash; lv_count = 0; for (lv_hash = 0; lv_hash < iv_buckets; lv_hash++) { lp_item = ipp_HT[lv_hash]; while (lp_item != NULL) { lp_item = lp_item->ip_next; lv_count++; SB_util_assert_ile(lv_count, iv_count); } } SB_util_assert_ieq(iv_count, lv_count); } #endif // NPVMAP_CHECK void SB_NPVmap::init() { int lv_hash; iv_buckets = SB_Map_Comm::calc_buckets(iv_buckets); set_buckets(iv_buckets); ipp_HT = new SB_NPVML_Type *[iv_buckets + 1]; for (lv_hash = 0; lv_hash <= iv_buckets; lv_hash++) ipp_HT[lv_hash] = NULL; #ifdef USE_SB_MAP_STATS SB_Map_Comm::init(this); #endif } void SB_NPVmap::printself(bool pv_traverse) { SB_NPVML_Type *lp_item; int lv_hash; int lv_inx; printf("this=%p, type=npvmap, name=%s, size=%d, buckets=%d\n", pfp(this), ia_map_name, iv_count, iv_buckets); if (pv_traverse) { lv_inx = 0; for (lv_hash = 0; lv_hash < iv_buckets; lv_hash++) { lp_item = ipp_HT[lv_hash]; for (; lp_item != NULL; lp_item = lp_item->ip_next) { printf(" inx=%d, Item=%p, Hash=%d, id=%d/%d/" PFVY ")\n", lv_inx, pfp(lp_item), lv_hash, lp_item->iv_id.npv.iv_nid, lp_item->iv_id.npv.iv_pid, lp_item->iv_id.npv.iv_verif); lv_inx++; } } } } void *SB_NPVmap::remove(Key_Type pv_id) { SB_NPVML_Type *lp_item; SB_NPVML_Type *lp_prev; int lv_hash; lv_hash = hash(pv_id, iv_buckets); lp_item = ipp_HT[lv_hash]; lp_prev = NULL; while (lp_item != NULL) { if ((lp_item->iv_id.npv.iv_nid == pv_id.iv_nid) && (lp_item->iv_id.npv.iv_pid == pv_id.iv_pid) && (lp_item->iv_id.npv.iv_verif == pv_id.iv_verif)) { if (lp_prev == NULL) ipp_HT[lv_hash] = lp_item->ip_next; else lp_prev->ip_next = lp_item->ip_next; #ifdef USE_SB_MAP_STATS ip_stats->chain_del(lv_hash); // remove #endif iv_count--; iv_mod++; #ifdef NPVMAP_CHECK check_integrity(); #endif // NPVMAP_CHECK return lp_item; } lp_prev = lp_item; lp_item = lp_item->ip_next; } return NULL; } void SB_NPVmap::removeall() { SB_NPVML_Type *lp_item; int lv_hash; for (lv_hash = 0; lv_hash < iv_buckets; lv_hash++) { for (;;) { lp_item = ipp_HT[lv_hash]; if (lp_item == NULL) break; ipp_HT[lv_hash] = lp_item->ip_next; #ifdef USE_SB_MAP_STATS ip_stats->chain_del(lv_hash); // removeall #endif delete lp_item; } } } void SB_NPVmap::resize(int pv_buckets) { int lv_bucketsn; int lv_bucketso; int lv_hashn; int lv_hasho; SB_NPVML_Type *lp_item; SB_NPVML_Type **lpp_HTn; SB_NPVML_Type **lpp_HTo; // create new set of buckets and swap lv_bucketsn = calc_buckets(pv_buckets); if (lv_bucketsn <= iv_buckets) return; // forget it lpp_HTn = new SB_NPVML_Type *[lv_bucketsn + 1]; for (lv_hashn = 0; lv_hashn <= lv_bucketsn; lv_hashn++) lpp_HTn[lv_hashn] = NULL; lpp_HTo = ipp_HT; ipp_HT = lpp_HTn; iv_count = 0; lv_bucketso = iv_buckets; #ifdef USE_SB_MAP_STATS ip_stats->resize(lv_bucketsn); #endif set_buckets(lv_bucketsn); // copy old buckets to new buckets for (lv_hasho = 0; lv_hasho < lv_bucketso; lv_hasho++) { for (;;) { lp_item = lpp_HTo[lv_hasho]; if (lp_item == NULL) break; lpp_HTo[lv_hasho] = lp_item->ip_next; lv_hashn = hash(lp_item->iv_id.npv, iv_buckets); lp_item->ip_next = ipp_HT[lv_hashn]; ipp_HT[lv_hashn] = lp_item; iv_count++; iv_mod++; #ifdef USE_SB_MAP_STATS ip_stats->chain_add(lv_hashn); // put #endif } } // delete old buckets delete [] lpp_HTo; } SB_NPVML_Type *SB_NPVmap_Enum::next() { SB_NPVML_Type *lp_item; int lv_buckets; int lv_hash; lp_item = ip_item; lv_hash = iv_hash; SB_util_assert_ieq(iv_mod, ip_map->iv_mod); // sw fault if (iv_inx >= iv_count) return NULL; lv_buckets = ip_map->iv_buckets; for (; lv_hash < lv_buckets; lv_hash++) { if (lp_item != NULL) { iv_inx++; break; } lp_item = ip_map->ipp_HT[lv_hash+1]; } ip_item = lp_item; iv_hash = lv_hash; if (lp_item != NULL) ip_item = lp_item->ip_next; return lp_item; } #endif
[ "gonzalo.correa@hp.com" ]
gonzalo.correa@hp.com
39e7c66735816fc1cbb701a1a3539efdcae16785
0dbaa12e7fcc562322d9a51f60a56ce60e1bb6c7
/Source/Main.cpp
85fd497e0e66430562178d970a54ad02aa63ac52
[]
no_license
jacobmilligan/Robot-Navigation-Problem
f6ea9ce64cb30c94979c223738352f772d3ff6f7
495c29021dd11166c27ad492bcaf65ef766fb31f
refs/heads/master
2021-01-20T04:37:29.379999
2017-04-20T02:54:25
2017-04-20T02:54:25
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,713
cpp
// // Main.cpp // COS30019 Intro To AI - Assignment 1 // Robot Navigation // // -------------------------------------------------------------- // // Created by // Jacob Milligan 100660682 // 19/03/2017 // #include "Parsers/CLIParser.hpp" #include "Parsers/FileParser.hpp" #include "Visualizer/VisualizerApp.hpp" int main(int argc, char** argv) { // Create search method map auto methods = robo::generate_method_map(); // Generate the command line description used for the -h flag std::string description = "Searches for solutions to the Robot Navigation " "problem.\nThe following search algorithms are supported for <method>:" "\n\n"; for ( auto& m : methods ) { description += "[" + std::string(m.first) + "]\t\t" + m.second->name() + "\n"; } // Parse the command line and check for an error in input robo::CLIParser cli(description.c_str()); auto results = cli.parse(argc, argv); if ( results.error ) { return 1; } // Checks if the search method string was entered if ( results.method.size() <= 0 ) { return 0; } // Check if the -v flag was used (returning VISUALIZER as method) and launch // the visualizer instead of the command line app if ( results.method == "VISUALIZER" ) { robo::VisualizerApp app("Robo-visualizer", 1, 32, argv); app.run(); return 0; } // Check for valid search method if ( methods.find(results.method) == methods.end() ) { auto error = "'" + results.method + "' is not a supported search method"; cli.print_error(error.c_str()); return 0; } // Parse the specified file and generate a search environment robo::FileParser parser(cli.app_name()); auto& method = *(methods.find(results.method)->second); auto env = parser.parse(results.filepath); // Exit if the file input was bad if ( !env.valid() ) return 0; // Set step cost to a uniform 1 as according to the assignment spec env.step_cost = 1; auto path = method.search(env); // execute search using the specified search method // Check if the path was successful and print results if so, otherwise print // "No solution found" if ( !path.success ) { printf("No solution found \n"); } else { printf("%s %s %d %s\n", results.filename.c_str(), results.method.c_str(), path.node_count, path.to_string().c_str()); } // If the -s flag was used, print the largest frontier if ( results.with_stats ) printf("largest_frontier: %d\n", path.largest_frontier); return 0; }
[ "jacobpmilligan@gmail.com" ]
jacobpmilligan@gmail.com
9eb004f272dd582482152bdff6cc19f1868eb2b5
db0cdf27fc0d46bb5cc0c1b2e1945be63ce70c4d
/test/get_all_puyo_test.cpp
bc5b8c926471e2cdcd29711f7dc22eff30c28bc1
[]
no_license
sirogamichandayo/puyo_recognition
7315bcf24fbed8357dbe0dc52537f32b3964e12a
ce8c4cff175ee200b8a4ae48ede76ab5e72ae397
refs/heads/master
2022-11-25T03:27:25.999316
2020-07-30T12:30:07
2020-07-30T12:30:07
210,817,377
0
0
null
null
null
null
UTF-8
C++
false
false
1,018
cpp
#define DEBUG_YELLOW 1 #include "../src/recognition/state_main.h" #include "../src/recognition/screen_shot.h" #include "../src/log/log.h" #include "opencv2/opencv.hpp" #include "opencv2/highgui.hpp" #include <vector> #include <string> #include <iostream> namespace pic_ = pic::gst; int main(int argc, char **argv) { debug::initializeDir("/home/sirogami/programming/cota_Puyoai/screenshot_check/gst_yellow"); ScreenShot scr(pic_::X, pic_::Y, pic_::WIDTH, pic_::HEIGHT); State env(&scr, &pic_::PIC_RECT_LIST); std::vector<int> all_puyo_1p(game::ALL_PUYO_NUM); std::vector<std::string> all_puyo_str_1p(game::ALL_PUYO_NUM); env.step(); env.getState(get_mode::ALL_PUYO_1P, &all_puyo_1p); env.bitNum2ColorStringForVec(all_puyo_1p, &all_puyo_str_1p); cout << game::ALL_PUYO_NUM << endl; for (unsigned int i = 1; i <= game::ALL_PUYO_NUM; ++i) { std::cout << i << ": " << all_puyo_str_1p[i-1]<< std::endl; if (i % 12 == 0) std::cout << "------------------------------" << std::endl; } }
[ "sirogamiemacs@gmail.com" ]
sirogamiemacs@gmail.com
c1e801910ff00bde44287ffd2b09e16061957270
340a78d1175b71aceed68bdc80262360eb077c23
/opsin-core/main/opsin-core/AmbiguityChecker.h
9aa9e8401ce2894b797409327bd6704c8c06656f
[]
no_license
voddan/opsin-cpp
c1e41986dbc9a7289a01df44c15982044a148f3d
5af1c1f4f63169033e4ce727b4356a5de786cbab
refs/heads/master
2021-07-01T10:35:01.481583
2017-09-22T11:48:28
2017-09-22T11:48:28
103,264,497
0
0
null
null
null
null
UTF-8
C++
false
false
1,712
h
#pragma once #include <string> #include <unordered_map> #include <vector> #include <stdexcept> #include <boost/optional.hpp> #include <set> #include "stringhelper.h" #include <base_c/bitarray.h> //JAVA TO C++ CONVERTER NOTE: Forward class declarations: class Atom; class Bond; class StereoAnalyser; //JAVA TO C++ CONVERTER TODO TASK: The Java 'import static' statement cannot be converted to C++: // import static uk.ac.cam.ch.wwmm.opsin.XmlDeclarations.ELEMENTARYATOM_SUBTYPE_VAL; class AmbiguityChecker { public: static bool isSubstitutionAmbiguous(std::vector<Atom *> &substitutableAtoms, int numberToBeSubstituted); static bool allAtomsEquivalent(std::vector<Atom *> &atoms); static bool allBondsEquivalent(std::vector<Bond *> *bonds); private: static std::wstring bondToCanonicalEnvironString(StereoAnalyser *analyser, Bond *b); public: static std::wstring getAtomEnviron(StereoAnalyser *analyser, Atom *a); private: static bool allAtomsConnectToDefaultInAtom(std::vector<Atom *> &substitutableAtoms, int numberToBeSubstituted); public: static StereoAnalyser *analyseRelevantAtomsAndBonds(std::vector<Atom *> &startingAtoms); static std::vector<Atom *> useAtomEnvironmentsToGivePlausibleSubstitution(std::vector<Atom *> &substitutableAtoms, int numberToBeSubstituted); private: static std::vector<Atom *> findPlausibleSubstitutionPatternUsingSymmmetry(std::vector<Atom *> &substitutableAtoms, int numberToBeSubstituted); static std::vector<Atom *> findPlausibleSubstitutionPatternUsingLocalEnvironment(std::vector<Atom *> &substitutableAtoms, int numberToBeSubstituted); };
[ "dgvodopyan@gmail.com" ]
dgvodopyan@gmail.com
9c9b805ec59aac8f795352c9eff2fe275d6282b7
ece34e2eeb4d6a0b3c9867591c667c39bfbf3a7f
/server/Flatbuffer/message_generated.h
319f24625b456dda60862207e497d33c0258f39f
[]
no_license
brucelevis/networked-physics-simulation
b94d679373af530442b9d80c8c11d53a29b0db22
0de584413facb391a9c11865af76f7c67bb20a89
refs/heads/master
2022-01-04T15:17:49.729578
2019-06-19T01:40:07
2019-06-19T01:40:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
20,609
h
// automatically generated by the FlatBuffers compiler, do not modify #ifndef FLATBUFFERS_GENERATED_MESSAGE_NETWORKEDPHYSICS_H_ #define FLATBUFFERS_GENERATED_MESSAGE_NETWORKEDPHYSICS_H_ #include "flatbuffers/flatbuffers.h" namespace NetworkedPhysics { struct Message; struct MessageAck; struct ClientConnectMessage; struct ClientDisconnectMessage; struct ResetSimulationMessage; struct KeepAliveMessage; struct ClientInputMessage; struct ServerSnapshotMessage; struct Entity; struct Transform; struct Vec3; struct Vec4; enum InputType { InputType_NONE = 0, InputType_Forward = 1, InputType_Backward = 2, InputType_Leftward = 3, InputType_Rightward = 4, InputType_MIN = InputType_NONE, InputType_MAX = InputType_Rightward }; inline const char **EnumNamesInputType() { static const char *names[] = { "NONE", "Forward", "Backward", "Leftward", "Rightward", nullptr }; return names; } inline const char *EnumNameInputType(InputType e) { return EnumNamesInputType()[static_cast<int>(e)]; } enum EntityType { EntityType_NONE = 0, EntityType_Cube = 1, EntityType_Sphere = 2, EntityType_MIN = EntityType_NONE, EntityType_MAX = EntityType_Sphere }; inline const char **EnumNamesEntityType() { static const char *names[] = { "NONE", "Cube", "Sphere", nullptr }; return names; } inline const char *EnumNameEntityType(EntityType e) { return EnumNamesEntityType()[static_cast<int>(e)]; } enum MessageType { MessageType_NONE = 0, MessageType_MessageAck = 1, MessageType_ClientConnectMessage = 2, MessageType_ClientDisconnectMessage = 3, MessageType_ClientInputMessage = 4, MessageType_ServerSnapshotMessage = 5, MessageType_ResetSimulationMessage = 6, MessageType_KeepAliveMessage = 7, MessageType_MIN = MessageType_NONE, MessageType_MAX = MessageType_KeepAliveMessage }; inline const char **EnumNamesMessageType() { static const char *names[] = { "NONE", "MessageAck", "ClientConnectMessage", "ClientDisconnectMessage", "ClientInputMessage", "ServerSnapshotMessage", "ResetSimulationMessage", "KeepAliveMessage", nullptr }; return names; } inline const char *EnumNameMessageType(MessageType e) { return EnumNamesMessageType()[static_cast<int>(e)]; } inline bool VerifyMessageType(flatbuffers::Verifier &verifier, const void *union_obj, MessageType type); struct Message FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { enum { VT_ID = 4, VT_DATA_TYPE = 6, VT_DATA = 8 }; int32_t id() const { return GetField<int32_t>(VT_ID, 0); } MessageType data_type() const { return static_cast<MessageType>(GetField<uint8_t>(VT_DATA_TYPE, 0)); } const void *data() const { return GetPointer<const void *>(VT_DATA); } bool Verify(flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && VerifyField<int32_t>(verifier, VT_ID) && VerifyField<uint8_t>(verifier, VT_DATA_TYPE) && VerifyField<flatbuffers::uoffset_t>(verifier, VT_DATA) && VerifyMessageType(verifier, data(), data_type()) && verifier.EndTable(); } }; struct MessageBuilder { flatbuffers::FlatBufferBuilder &fbb_; flatbuffers::uoffset_t start_; void add_id(int32_t id) { fbb_.AddElement<int32_t>(Message::VT_ID, id, 0); } void add_data_type(MessageType data_type) { fbb_.AddElement<uint8_t>(Message::VT_DATA_TYPE, static_cast<uint8_t>(data_type), 0); } void add_data(flatbuffers::Offset<void> data) { fbb_.AddOffset(Message::VT_DATA, data); } MessageBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } MessageBuilder &operator=(const MessageBuilder &); flatbuffers::Offset<Message> Finish() { auto o = flatbuffers::Offset<Message>(fbb_.EndTable(start_, 3)); return o; } }; inline flatbuffers::Offset<Message> CreateMessage(flatbuffers::FlatBufferBuilder &_fbb, int32_t id = 0, MessageType data_type = MessageType_NONE, flatbuffers::Offset<void> data = 0) { MessageBuilder builder_(_fbb); builder_.add_data(data); builder_.add_id(id); builder_.add_data_type(data_type); return builder_.Finish(); } struct MessageAck FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { enum { VT_MESSAGEID = 4 }; int32_t messageId() const { return GetField<int32_t>(VT_MESSAGEID, 0); } bool Verify(flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && VerifyField<int32_t>(verifier, VT_MESSAGEID) && verifier.EndTable(); } }; struct MessageAckBuilder { flatbuffers::FlatBufferBuilder &fbb_; flatbuffers::uoffset_t start_; void add_messageId(int32_t messageId) { fbb_.AddElement<int32_t>(MessageAck::VT_MESSAGEID, messageId, 0); } MessageAckBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } MessageAckBuilder &operator=(const MessageAckBuilder &); flatbuffers::Offset<MessageAck> Finish() { auto o = flatbuffers::Offset<MessageAck>(fbb_.EndTable(start_, 1)); return o; } }; inline flatbuffers::Offset<MessageAck> CreateMessageAck(flatbuffers::FlatBufferBuilder &_fbb, int32_t messageId = 0) { MessageAckBuilder builder_(_fbb); builder_.add_messageId(messageId); return builder_.Finish(); } struct ClientConnectMessage FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { bool Verify(flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && verifier.EndTable(); } }; struct ClientConnectMessageBuilder { flatbuffers::FlatBufferBuilder &fbb_; flatbuffers::uoffset_t start_; ClientConnectMessageBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } ClientConnectMessageBuilder &operator=(const ClientConnectMessageBuilder &); flatbuffers::Offset<ClientConnectMessage> Finish() { auto o = flatbuffers::Offset<ClientConnectMessage>(fbb_.EndTable(start_, 0)); return o; } }; inline flatbuffers::Offset<ClientConnectMessage> CreateClientConnectMessage(flatbuffers::FlatBufferBuilder &_fbb) { ClientConnectMessageBuilder builder_(_fbb); return builder_.Finish(); } struct ClientDisconnectMessage FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { bool Verify(flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && verifier.EndTable(); } }; struct ClientDisconnectMessageBuilder { flatbuffers::FlatBufferBuilder &fbb_; flatbuffers::uoffset_t start_; ClientDisconnectMessageBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } ClientDisconnectMessageBuilder &operator=(const ClientDisconnectMessageBuilder &); flatbuffers::Offset<ClientDisconnectMessage> Finish() { auto o = flatbuffers::Offset<ClientDisconnectMessage>(fbb_.EndTable(start_, 0)); return o; } }; inline flatbuffers::Offset<ClientDisconnectMessage> CreateClientDisconnectMessage(flatbuffers::FlatBufferBuilder &_fbb) { ClientDisconnectMessageBuilder builder_(_fbb); return builder_.Finish(); } struct ResetSimulationMessage FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { bool Verify(flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && verifier.EndTable(); } }; struct ResetSimulationMessageBuilder { flatbuffers::FlatBufferBuilder &fbb_; flatbuffers::uoffset_t start_; ResetSimulationMessageBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } ResetSimulationMessageBuilder &operator=(const ResetSimulationMessageBuilder &); flatbuffers::Offset<ResetSimulationMessage> Finish() { auto o = flatbuffers::Offset<ResetSimulationMessage>(fbb_.EndTable(start_, 0)); return o; } }; inline flatbuffers::Offset<ResetSimulationMessage> CreateResetSimulationMessage(flatbuffers::FlatBufferBuilder &_fbb) { ResetSimulationMessageBuilder builder_(_fbb); return builder_.Finish(); } struct KeepAliveMessage FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { bool Verify(flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && verifier.EndTable(); } }; struct KeepAliveMessageBuilder { flatbuffers::FlatBufferBuilder &fbb_; flatbuffers::uoffset_t start_; KeepAliveMessageBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } KeepAliveMessageBuilder &operator=(const KeepAliveMessageBuilder &); flatbuffers::Offset<KeepAliveMessage> Finish() { auto o = flatbuffers::Offset<KeepAliveMessage>(fbb_.EndTable(start_, 0)); return o; } }; inline flatbuffers::Offset<KeepAliveMessage> CreateKeepAliveMessage(flatbuffers::FlatBufferBuilder &_fbb) { KeepAliveMessageBuilder builder_(_fbb); return builder_.Finish(); } struct ClientInputMessage FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { enum { VT_TYPE = 4 }; InputType type() const { return static_cast<InputType>(GetField<int8_t>(VT_TYPE, 0)); } bool Verify(flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && VerifyField<int8_t>(verifier, VT_TYPE) && verifier.EndTable(); } }; struct ClientInputMessageBuilder { flatbuffers::FlatBufferBuilder &fbb_; flatbuffers::uoffset_t start_; void add_type(InputType type) { fbb_.AddElement<int8_t>(ClientInputMessage::VT_TYPE, static_cast<int8_t>(type), 0); } ClientInputMessageBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } ClientInputMessageBuilder &operator=(const ClientInputMessageBuilder &); flatbuffers::Offset<ClientInputMessage> Finish() { auto o = flatbuffers::Offset<ClientInputMessage>(fbb_.EndTable(start_, 1)); return o; } }; inline flatbuffers::Offset<ClientInputMessage> CreateClientInputMessage(flatbuffers::FlatBufferBuilder &_fbb, InputType type = InputType_NONE) { ClientInputMessageBuilder builder_(_fbb); builder_.add_type(type); return builder_.Finish(); } struct ServerSnapshotMessage FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { enum { VT_ENTITIES = 4 }; const flatbuffers::Vector<flatbuffers::Offset<Entity>> *entities() const { return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<Entity>> *>(VT_ENTITIES); } bool Verify(flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && VerifyField<flatbuffers::uoffset_t>(verifier, VT_ENTITIES) && verifier.Verify(entities()) && verifier.VerifyVectorOfTables(entities()) && verifier.EndTable(); } }; struct ServerSnapshotMessageBuilder { flatbuffers::FlatBufferBuilder &fbb_; flatbuffers::uoffset_t start_; void add_entities(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Entity>>> entities) { fbb_.AddOffset(ServerSnapshotMessage::VT_ENTITIES, entities); } ServerSnapshotMessageBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } ServerSnapshotMessageBuilder &operator=(const ServerSnapshotMessageBuilder &); flatbuffers::Offset<ServerSnapshotMessage> Finish() { auto o = flatbuffers::Offset<ServerSnapshotMessage>(fbb_.EndTable(start_, 1)); return o; } }; inline flatbuffers::Offset<ServerSnapshotMessage> CreateServerSnapshotMessage(flatbuffers::FlatBufferBuilder &_fbb, flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Entity>>> entities = 0) { ServerSnapshotMessageBuilder builder_(_fbb); builder_.add_entities(entities); return builder_.Finish(); } inline flatbuffers::Offset<ServerSnapshotMessage> CreateServerSnapshotMessageDirect(flatbuffers::FlatBufferBuilder &_fbb, const std::vector<flatbuffers::Offset<Entity>> *entities = nullptr) { return CreateServerSnapshotMessage(_fbb, entities ? _fbb.CreateVector<flatbuffers::Offset<Entity>>(*entities) : 0); } struct Entity FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { enum { VT_ID = 4, VT_TYPE = 6, VT_INTERACTING = 8, VT_TRANSFORM = 10 }; int32_t id() const { return GetField<int32_t>(VT_ID, 0); } EntityType type() const { return static_cast<EntityType>(GetField<int8_t>(VT_TYPE, 0)); } bool interacting() const { return GetField<uint8_t>(VT_INTERACTING, 0) != 0; } const Transform *transform() const { return GetPointer<const Transform *>(VT_TRANSFORM); } bool Verify(flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && VerifyField<int32_t>(verifier, VT_ID) && VerifyField<int8_t>(verifier, VT_TYPE) && VerifyField<uint8_t>(verifier, VT_INTERACTING) && VerifyField<flatbuffers::uoffset_t>(verifier, VT_TRANSFORM) && verifier.VerifyTable(transform()) && verifier.EndTable(); } }; struct EntityBuilder { flatbuffers::FlatBufferBuilder &fbb_; flatbuffers::uoffset_t start_; void add_id(int32_t id) { fbb_.AddElement<int32_t>(Entity::VT_ID, id, 0); } void add_type(EntityType type) { fbb_.AddElement<int8_t>(Entity::VT_TYPE, static_cast<int8_t>(type), 0); } void add_interacting(bool interacting) { fbb_.AddElement<uint8_t>(Entity::VT_INTERACTING, static_cast<uint8_t>(interacting), 0); } void add_transform(flatbuffers::Offset<Transform> transform) { fbb_.AddOffset(Entity::VT_TRANSFORM, transform); } EntityBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } EntityBuilder &operator=(const EntityBuilder &); flatbuffers::Offset<Entity> Finish() { auto o = flatbuffers::Offset<Entity>(fbb_.EndTable(start_, 4)); return o; } }; inline flatbuffers::Offset<Entity> CreateEntity(flatbuffers::FlatBufferBuilder &_fbb, int32_t id = 0, EntityType type = EntityType_NONE, bool interacting = false, flatbuffers::Offset<Transform> transform = 0) { EntityBuilder builder_(_fbb); builder_.add_transform(transform); builder_.add_id(id); builder_.add_interacting(interacting); builder_.add_type(type); return builder_.Finish(); } struct Transform FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { enum { VT_POSITION = 4, VT_ROTATION = 6, VT_SCALE = 8 }; const Vec3 *position() const { return GetPointer<const Vec3 *>(VT_POSITION); } const Vec4 *rotation() const { return GetPointer<const Vec4 *>(VT_ROTATION); } const Vec3 *scale() const { return GetPointer<const Vec3 *>(VT_SCALE); } bool Verify(flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && VerifyField<flatbuffers::uoffset_t>(verifier, VT_POSITION) && verifier.VerifyTable(position()) && VerifyField<flatbuffers::uoffset_t>(verifier, VT_ROTATION) && verifier.VerifyTable(rotation()) && VerifyField<flatbuffers::uoffset_t>(verifier, VT_SCALE) && verifier.VerifyTable(scale()) && verifier.EndTable(); } }; struct TransformBuilder { flatbuffers::FlatBufferBuilder &fbb_; flatbuffers::uoffset_t start_; void add_position(flatbuffers::Offset<Vec3> position) { fbb_.AddOffset(Transform::VT_POSITION, position); } void add_rotation(flatbuffers::Offset<Vec4> rotation) { fbb_.AddOffset(Transform::VT_ROTATION, rotation); } void add_scale(flatbuffers::Offset<Vec3> scale) { fbb_.AddOffset(Transform::VT_SCALE, scale); } TransformBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } TransformBuilder &operator=(const TransformBuilder &); flatbuffers::Offset<Transform> Finish() { auto o = flatbuffers::Offset<Transform>(fbb_.EndTable(start_, 3)); return o; } }; inline flatbuffers::Offset<Transform> CreateTransform(flatbuffers::FlatBufferBuilder &_fbb, flatbuffers::Offset<Vec3> position = 0, flatbuffers::Offset<Vec4> rotation = 0, flatbuffers::Offset<Vec3> scale = 0) { TransformBuilder builder_(_fbb); builder_.add_scale(scale); builder_.add_rotation(rotation); builder_.add_position(position); return builder_.Finish(); } struct Vec3 FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { enum { VT_X = 4, VT_Y = 6, VT_Z = 8 }; float x() const { return GetField<float>(VT_X, 0.0f); } float y() const { return GetField<float>(VT_Y, 0.0f); } float z() const { return GetField<float>(VT_Z, 0.0f); } bool Verify(flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && VerifyField<float>(verifier, VT_X) && VerifyField<float>(verifier, VT_Y) && VerifyField<float>(verifier, VT_Z) && verifier.EndTable(); } }; struct Vec3Builder { flatbuffers::FlatBufferBuilder &fbb_; flatbuffers::uoffset_t start_; void add_x(float x) { fbb_.AddElement<float>(Vec3::VT_X, x, 0.0f); } void add_y(float y) { fbb_.AddElement<float>(Vec3::VT_Y, y, 0.0f); } void add_z(float z) { fbb_.AddElement<float>(Vec3::VT_Z, z, 0.0f); } Vec3Builder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } Vec3Builder &operator=(const Vec3Builder &); flatbuffers::Offset<Vec3> Finish() { auto o = flatbuffers::Offset<Vec3>(fbb_.EndTable(start_, 3)); return o; } }; inline flatbuffers::Offset<Vec3> CreateVec3(flatbuffers::FlatBufferBuilder &_fbb, float x = 0.0f, float y = 0.0f, float z = 0.0f) { Vec3Builder builder_(_fbb); builder_.add_z(z); builder_.add_y(y); builder_.add_x(x); return builder_.Finish(); } struct Vec4 FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { enum { VT_X = 4, VT_Y = 6, VT_Z = 8, VT_W = 10 }; float x() const { return GetField<float>(VT_X, 0.0f); } float y() const { return GetField<float>(VT_Y, 0.0f); } float z() const { return GetField<float>(VT_Z, 0.0f); } float w() const { return GetField<float>(VT_W, 0.0f); } bool Verify(flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && VerifyField<float>(verifier, VT_X) && VerifyField<float>(verifier, VT_Y) && VerifyField<float>(verifier, VT_Z) && VerifyField<float>(verifier, VT_W) && verifier.EndTable(); } }; struct Vec4Builder { flatbuffers::FlatBufferBuilder &fbb_; flatbuffers::uoffset_t start_; void add_x(float x) { fbb_.AddElement<float>(Vec4::VT_X, x, 0.0f); } void add_y(float y) { fbb_.AddElement<float>(Vec4::VT_Y, y, 0.0f); } void add_z(float z) { fbb_.AddElement<float>(Vec4::VT_Z, z, 0.0f); } void add_w(float w) { fbb_.AddElement<float>(Vec4::VT_W, w, 0.0f); } Vec4Builder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } Vec4Builder &operator=(const Vec4Builder &); flatbuffers::Offset<Vec4> Finish() { auto o = flatbuffers::Offset<Vec4>(fbb_.EndTable(start_, 4)); return o; } }; inline flatbuffers::Offset<Vec4> CreateVec4(flatbuffers::FlatBufferBuilder &_fbb, float x = 0.0f, float y = 0.0f, float z = 0.0f, float w = 0.0f) { Vec4Builder builder_(_fbb); builder_.add_w(w); builder_.add_z(z); builder_.add_y(y); builder_.add_x(x); return builder_.Finish(); } inline bool VerifyMessageType(flatbuffers::Verifier &verifier, const void *union_obj, MessageType type) { switch (type) { case MessageType_NONE: return true; case MessageType_MessageAck: return verifier.VerifyTable(reinterpret_cast<const MessageAck *>(union_obj)); case MessageType_ClientConnectMessage: return verifier.VerifyTable(reinterpret_cast<const ClientConnectMessage *>(union_obj)); case MessageType_ClientDisconnectMessage: return verifier.VerifyTable(reinterpret_cast<const ClientDisconnectMessage *>(union_obj)); case MessageType_ClientInputMessage: return verifier.VerifyTable(reinterpret_cast<const ClientInputMessage *>(union_obj)); case MessageType_ServerSnapshotMessage: return verifier.VerifyTable(reinterpret_cast<const ServerSnapshotMessage *>(union_obj)); case MessageType_ResetSimulationMessage: return verifier.VerifyTable(reinterpret_cast<const ResetSimulationMessage *>(union_obj)); case MessageType_KeepAliveMessage: return verifier.VerifyTable(reinterpret_cast<const KeepAliveMessage *>(union_obj)); default: return false; } } inline const NetworkedPhysics::Message *GetMessage(const void *buf) { return flatbuffers::GetRoot<NetworkedPhysics::Message>(buf); } inline bool VerifyMessageBuffer(flatbuffers::Verifier &verifier) { return verifier.VerifyBuffer<NetworkedPhysics::Message>(nullptr); } inline void FinishMessageBuffer(flatbuffers::FlatBufferBuilder &fbb, flatbuffers::Offset<NetworkedPhysics::Message> root) { fbb.Finish(root); } } // namespace NetworkedPhysics #endif // FLATBUFFERS_GENERATED_MESSAGE_NETWORKEDPHYSICS_H_
[ "joel.r.hays@live.com" ]
joel.r.hays@live.com
e1e65c79cb291cc175c0457f0d667e059daa2c8d
3880ed9e62d9849e811b5de2d29522ddf0f8ad2c
/uva/374.cpp
6e0be957b20a1dd9e914e39d621462743419f563
[]
no_license
Krythz43/CP-Archieve
936b028f9f0f90e555dc7c19c11d3939f7532b2f
36b5f7449bbd93135f4f09b7564b8ada94ef99e6
refs/heads/master
2020-08-31T18:42:47.954906
2020-05-12T05:18:00
2020-05-12T05:18:00
218,757,326
0
0
null
2020-05-12T05:18:02
2019-10-31T12:08:54
C++
UTF-8
C++
false
false
1,267
cpp
#include <bits/stdc++.h> using namespace std; #define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL) #define rep(i,n,z) for(int i=z;i<n;i++) #define rrep(i,z) for(int i=z;i>=0;i--) #define lli long long int #define nl cout<<endl #define vi vector<int> #define vlli vector<long long int> #define umap unordered_map #define pb push_back #define mp make_pair #define ss second #define ff first #define ipair pair <int,int> #define llipair pair <lli,lli> #define pq priority_queue #define displaymatrix(a,m,n) for(int i=0;i<m;i++){for(int j=0;j<n;j++)cout<<a[i][j]<<" ";cout<<endl;} #define printarray(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}nl; #define vinput(a,n) vi a(n);rep(i,n,0)cin>>a[i] #define ainput(a,n) rep(i,n,0)cin>>a[i] #define SO(a) sort(a.begin(),a.end()) #define SOP(a,comp) sort(a.begin(),a.end(),comp) #define inf INT_MAX lli llmax(lli a,lli b){if(a>b)return a; return b;} lli llmin(lli a,lli b){if(a<b)return a; return b;} lli mod; lli multi(lli x,lli y) { x%=mod; if(y==0) return 1; if(y==1) return x; if(y%2) return (x*multi((x*x)%mod,y/2))%mod; else return multi((x*x)%mod,y/2); } int main() { fastio; lli x,y; while(cin>>x) { cin>>y>>mod; cout<<multi(x,y)<<endl; } }
[ "krithickrockz@gmail.com" ]
krithickrockz@gmail.com
27d0d864c969e3ce8cf4abffa5aaaec61943cfbf
5a59003fedc37bd2a371d0e04cea6b15802e61b0
/include/turtlebot_common/parameter_accessor.h
a3e3ed8d22461e4af8f7311f67730b5b58a36a98
[]
no_license
daniel-bencic/turtlebot_common
123c2a761d1bf8385402514570c9b14082eef842
61112f4a6606f82b30dac52933351cdaea710464
refs/heads/master
2020-05-27T18:04:43.931722
2019-05-30T18:07:55
2019-05-30T18:07:55
188,735,799
0
0
null
null
null
null
UTF-8
C++
false
false
867
h
#ifndef PARAMETER_ACCESSOR_H #define PARAMETER_ACCESSOR_H #include <string> #include <ros/ros.h> #include "logging.h" namespace turtlebot_common { class ParameterAccessor { public: ParameterAccessor(ros::NodeHandle& nh); template <typename T> T GetParameter(const std::string& name) const; private: ros::NodeHandle nh_; }; ParameterAccessor::ParameterAccessor(ros::NodeHandle& nh) : nh_{ nh } {} template <typename T> T ParameterAccessor::GetParameter(const std::string& name) const { T val; if (!nh_.getParam(name, val)) { ROS_ERROR_STREAM("Retrieving value for parameter [" << name << "]: failed!"); } else { TURTLEBOT_LOG("Retrieving value for parameter %s: done.", name.c_str()); } return val; } } #endif /* PARAMETER_ACCESSOR_H */
[ "d.bencic@protonmail.com" ]
d.bencic@protonmail.com
bf6558148db13fa12176ff06ec9c057137bc49c0
8b4244f8b8dc18973d2afd18f26202bbac9cd9c0
/main/zzz.ForMiyamoto/test/test_potential.cpp
c1c8e1b7d67602cfa9692e66561898914cee37d4
[]
no_license
miiya369/analysis_code-set
e6f4cd1f9ae603876d8c444d18cfe0b7af496919
6ba1885028834eab2ff0702675060f4efa802e2f
refs/heads/master
2021-01-21T04:44:35.058958
2017-08-01T16:13:34
2017-08-01T16:13:34
48,170,670
0
0
null
null
null
null
UTF-8
C++
false
false
13,580
cpp
//-------------------------------------------------------------------------- /** * @file * @ingroup potential * @brief Main part for potential calculation * @author Takaya Miyamoto * @since Mon Jan 30 08:58:23 JST 2017 */ //-------------------------------------------------------------------------- #include <potential/potential.h> #define PROJECT CALC_POTENTIAL // <- Project name static CHANNEL_TYPE channel; static int time_min; static int time_max; static SPIN_TYPE spin; static double HAD1_mass; static double HAD2_mass; static char conf_list[MAX_LEN_PATH]; static char outfile_path[MAX_LEN_PATH]; static bool calc_flg_fit = false; static bool calc_flg_pot = false; static bool calc_flg_lap = false; static bool calc_flg_t1 = false; static bool calc_flg_t2 = false; static bool take_JK_flg = false; static bool use_JK_data = false; static bool out_all_datas = false; static bool arguments_check = false; static int set_args(int, char**); static int set_args_from_file(char*); static string ofname(string, const char*, int); //========================================================================// int main(int argc, char **argv) { if (set_args(argc, argv) == 1) return 0; time_t start_time, end_time; time(&start_time); /// Input 2pt-correlators /// CONFIG<CORRELATOR> *Corr1 = new CONFIG<CORRELATOR>; CONFIG<CORRELATOR> *Corr2 = new CONFIG<CORRELATOR>; for (int conf=0; conf<analysis::Nconf; conf++) { (*Corr1)(conf).set(channel.hadron1, conf, 0, "PS"); (*Corr2)(conf).set(channel.hadron2, conf, 0, "PS"); } if (take_JK_flg) { Corr1 -> make_JK_sample(); Corr2 -> make_JK_sample(); } /// Input NBS wave functions & Construct R-correlators /// NBSwave::rot_matrix_init(); NBS_WAVE_ORG *Wave_org = NULL; CONFIG<NBS_WAVE> *Wave = new CONFIG<NBS_WAVE>; CONFIG<R_CORRELATOR> *Rcorr = new CONFIG<R_CORRELATOR>[3]; if (channel.flg_spin_proj) spin.set(channel.spin_name); else Wave_org = new NBS_WAVE_ORG; int count = 0; for (int it=time_min-1; it<=time_min; it++) { for (int conf=0; conf<analysis::Nconf; conf++) { if (channel.flg_spin_proj) (*Wave)(conf).set(channel, it, conf); else { Wave_org -> set(channel, it, conf); NBSwave::spin_projection(*Wave_org, (*Wave)(conf), spin); } NBSwave::LP_projection((*Wave)(conf)); } if (take_JK_flg) Wave -> make_JK_sample(); for (int conf=0; conf<analysis::Nconf; conf++) Rcorr[count](conf).set((*Wave)(conf),(*Corr1)(conf),(*Corr2)(conf), it); count++; } // it /// Calculate and output the potentials /// CONFIG<R_CORRELATOR> *K_Rcorr = new CONFIG<R_CORRELATOR>; CONFIG<POTENTIAL> *potential = new CONFIG<POTENTIAL>; string pot_type; for (int it=time_min; it<=time_max; it++) { for (int conf=0; conf<analysis::Nconf; conf++) { if (channel.flg_spin_proj) (*Wave)(conf).set(channel, it+1, conf); else { Wave_org -> set(channel, it+1, conf); NBSwave::spin_projection(*Wave_org, (*Wave)(conf), spin); } NBSwave::LP_projection((*Wave)(conf)); } if (take_JK_flg) Wave->make_JK_sample(); for (int conf=0; conf<analysis::Nconf; conf++) Rcorr[count%3](conf).set( (*Wave) (conf) ,(*Corr1)(conf),(*Corr2)(conf), it+1 ); //-------------------- Selection of output potential type --------------------// for (int conf=0; conf<analysis::Nconf; conf++) { pot_type = potential::laplacian_bare((*K_Rcorr)(conf) , Rcorr[(count+2)%3](conf)); (*potential)(conf).set((*K_Rcorr)(conf), Rcorr[(count+2)%3](conf)); } analysis::output_data_fit( *Rcorr , ofname("Rcorr", "bin", it).c_str() , use_JK_data ); analysis::output_data_fit( *K_Rcorr , ofname("LapRcorr", "bin", it).c_str() , use_JK_data ); for (int conf=0; conf<analysis::Nconf; conf++) { pot_type = potential::kernel( (*K_Rcorr)(conf) , Rcorr[(count+1)%3](conf) , Rcorr[(count+2)%3](conf) , Rcorr[(count+3)%3](conf) , HAD1_mass, HAD2_mass ); (*potential)(conf).set((*K_Rcorr)(conf), Rcorr[(count+2)%3](conf)); } analysis::output_data_fit( *potential , ofname(pot_type, "bin", it).c_str() , use_JK_data ); //----------------------------------------------------------------------------// count++; } // it if (Wave_org != NULL) delete Wave_org; delete Wave; delete Corr1; delete Corr2; delete [] Rcorr; delete K_Rcorr; delete potential; time(&end_time); printf("\n @ JOB END : ELAPSED TIME [s] = %d\n\n" ,(int)difftime(end_time,start_time) ); return 0; } static string ofname(string POT_TYPE, const char* OFTYPE, int IT) { char outfile_name[1024]; snprintf( outfile_name, sizeof(outfile_name) , "%s/%s_%s_%s_%s_t%03d" , outfile_path, channel.name.c_str(), POT_TYPE.c_str() , spin.name.c_str(), OFTYPE, IT ); string ret(outfile_name); return ret; } //========================================================================// static int set_args(int argc, char** argv) { if (argc == 1) { analysis::usage(PROJECT); return 1; } bool infile_flg = false; for (int loop=1; loop<argc; loop++) if (strcmp(argv[loop],"-f")==0) { if (set_args_from_file(argv[loop+1]) == 1) return 1; infile_flg = true; } if (!infile_flg) { printf("\n @@@@@@ no input arguments file\n"); analysis::usage(PROJECT); return 1; } for (int loop=1; loop<argc; loop++) { if (argv[loop][0] == '-'){ if ( strcmp(argv[loop],"-f" )==0){} //****** You may set additional potion in here ******// else if (strcmp(argv[loop],"-idir" )==0) analysis::set_data_list(MAIN_PATH, "%s", argv[loop+1]); else if (strcmp(argv[loop],"-conf_list" )==0) snprintf(conf_list,sizeof(conf_list),"%s",argv[loop+1]); else if (strcmp(argv[loop],"-odir" )==0) snprintf(outfile_path,sizeof(outfile_path),"%s",argv[loop+1]); else if (strcmp(argv[loop],"-t_max" )==0) time_max = atoi(argv[loop+1]); else if (strcmp(argv[loop],"-t_min" )==0) time_min = atoi(argv[loop+1]); else if (strcmp(argv[loop],"-channel" )==0) channel.set(argv[loop+1]); else if (strcmp(argv[loop],"-spin" )==0) spin.set(argv[loop+1]); else if (strcmp(argv[loop],"-mass_had1")==0) HAD1_mass = atof(argv[loop+1]); else if (strcmp(argv[loop],"-mass_had2")==0) HAD2_mass = atof(argv[loop+1]); else if (strcmp(argv[loop],"-src_t" )==0) analysis::set_data_list(N_T_SHIFT, "%s", argv[loop+1]); else if (strcmp(argv[loop],"-src_rela" )==0) analysis::set_data_list(SRC_RELA, "%s", argv[loop+1]); else if (strcmp(argv[loop],"-snk_rela" )==0) analysis::set_data_list(SNK_RELA, "%s", argv[loop+1]); else if (strcmp(argv[loop],"-take_JK" )==0) take_JK_flg = true; else if (strcmp(argv[loop],"-check" )==0) arguments_check = true; //***************************************************// else { printf("\n @@@@@@ invalid option \"%s\"\n", argv[loop]); analysis::usage(PROJECT); return 1; } } } if (take_JK_flg) use_JK_data = true; analysis::Nconf = analysis::set_data_list(conf_list); printf("\n @ Arguments set :\n"); printf(" @ conf list = %s\n",conf_list); printf(" @ #. conf = %d\n",analysis::Nconf); printf(" @ time size = %d\n",analysis::tSIZE); printf(" @ space size = %d\n",analysis::xSIZE); printf(" @ input dir = %s\n",analysis::data_list[MAIN_PATH]); printf(" @ channel = %s\n",channel.name.c_str()); printf(" @ t shift = %s\n",analysis::data_list[N_T_SHIFT]); printf(" @ x shift = %s\n",analysis::data_list[N_X_SHIFT]); printf(" @ y shift = %s\n",analysis::data_list[N_Y_SHIFT]); printf(" @ z shift = %s\n",analysis::data_list[N_Z_SHIFT]); printf(" @ snk rela = %s\n",analysis::data_list[SNK_RELA]); printf(" @ src rela = %s\n",analysis::data_list[SRC_RELA]); printf(" @ output dir = %s\n",outfile_path); printf(" @ time_min = %d\n",time_min); printf(" @ time_max = %d\n",time_max); printf(" @ HAD1 mass = %lf\n",HAD1_mass); printf(" @ HAD2 mass = %lf\n",HAD2_mass); printf(" @ spin = %s\n",spin.name.c_str()); printf(" @ use JK data = %s\n",analysis::bool_to_str(use_JK_data).c_str()); printf(" @ take JK = %s\n",analysis::bool_to_str(take_JK_flg).c_str()); printf(" @ out pot = %s\n",analysis::bool_to_str(calc_flg_pot).c_str()); printf(" @ out lap = %s\n",analysis::bool_to_str(calc_flg_lap).c_str()); printf(" @ out t1 dif = %s\n",analysis::bool_to_str(calc_flg_t1).c_str()); printf(" @ out t2 dif = %s\n",analysis::bool_to_str(calc_flg_t2).c_str()); printf(" @ out fit = %s\n",analysis::bool_to_str(calc_flg_fit).c_str()); printf(" @ out all = %s\n\n",analysis::bool_to_str(out_all_datas).c_str()); fflush(stdout); if (arguments_check) return 1; return 0; } static int set_args_from_file(char* file_name) { ifstream ifs(file_name, ios::in); if (!ifs) { printf("\n @@@@@@ the file \"%s\" is not exist\n\n", file_name); return 1; } char tmp_str[MAX_N_DATA][MAX_LEN_PATH]; char tmp_c1[32]; char tmp_c2[MAX_LEN_PATH]; int count = 0; while (ifs.getline(tmp_str[count],sizeof(tmp_str[count]))) count++; for (int loop=0; loop<count; loop++) { if (sscanf(tmp_str[loop]," %s = %s ",tmp_c1,tmp_c2) != 2) continue; //****** You may set additional potion in here ******// if ( strcmp(tmp_c1,"POT_Size_of_space" )==0){ analysis::xSIZE = atoi(tmp_c2); analysis::ySIZE = atoi(tmp_c2); analysis::zSIZE = atoi(tmp_c2); } else if (strcmp(tmp_c1,"POT_Min_time_slice" )==0) time_min = atoi(tmp_c2); else if (strcmp(tmp_c1,"POT_Max_time_slice" )==0) time_max = atoi(tmp_c2); else if (strcmp(tmp_c1,"POT_Channel_name" )==0) channel.set(tmp_c2); else if (strcmp(tmp_c1,"POT_Spin_projection" )==0) spin.set(tmp_c2); else if (strcmp(tmp_c1,"POT_Gauge_confs_list" )==0) snprintf(conf_list,sizeof(conf_list),"%s",tmp_c2); else if (strcmp(tmp_c1,"POT_Path_to_output_dir")==0) snprintf(outfile_path,sizeof(outfile_path),"%s",tmp_c2); else if (strcmp(tmp_c1,"POT_Out_sum_pot" )==0) calc_flg_pot = analysis::str_to_bool(tmp_c2); else if (strcmp(tmp_c1,"POT_Out_laplacian" )==0) calc_flg_lap = analysis::str_to_bool(tmp_c2); else if (strcmp(tmp_c1,"POT_Out_1st_t_diff" )==0) calc_flg_t1 = analysis::str_to_bool(tmp_c2); else if (strcmp(tmp_c1,"POT_Out_2nd_t_diff" )==0) calc_flg_t2 = analysis::str_to_bool(tmp_c2); else if (strcmp(tmp_c1,"POT_Out_fit_data" )==0) calc_flg_fit = analysis::str_to_bool(tmp_c2); else if (strcmp(tmp_c1,"POT_Path_to_input_dir" )==0) analysis::set_data_list(MAIN_PATH, "%s", tmp_c2); else if (strcmp(tmp_c1,"POT_T_shift" )==0) analysis::set_data_list(N_T_SHIFT, "%s", tmp_c2); else if (strcmp(tmp_c1,"POT_X_shift" )==0) analysis::set_data_list(N_X_SHIFT, "%s", tmp_c2); else if (strcmp(tmp_c1,"POT_Y_shift" )==0) analysis::set_data_list(N_Y_SHIFT, "%s", tmp_c2); else if (strcmp(tmp_c1,"POT_Z_shift" )==0) analysis::set_data_list(N_Z_SHIFT, "%s", tmp_c2); else if (strcmp(tmp_c1,"POT_Size_of_time" )==0) analysis::tSIZE = atoi(tmp_c2); else if (strcmp(tmp_c1,"POT_Snk_relativistic" )==0) analysis::set_data_list(SNK_RELA, "%s", tmp_c2); else if (strcmp(tmp_c1,"POT_Src_relativistic" )==0) analysis::set_data_list(SRC_RELA, "%s", tmp_c2); else if (strcmp(tmp_c1,"POT_Take_jack_knife" )==0) take_JK_flg = analysis::str_to_bool(tmp_c2); else if (strcmp(tmp_c1,"POT_Use_jack_knife_data")==0) use_JK_data = analysis::str_to_bool(tmp_c2); else if (strcmp(tmp_c1,"POT_Out_all_datas")==0) out_all_datas = analysis::str_to_bool(tmp_c2); else if (strcmp(tmp_c1,"POT_Had1_mass" )==0) HAD1_mass = atof(tmp_c2); else if (strcmp(tmp_c1,"POT_Had2_mass" )==0) HAD2_mass = atof(tmp_c2); //***************************************************// else{ printf("\n @@@@@@ invalid option \"%s\" in arguments file \"%s\"\n\n" , tmp_c1, file_name); return 1; } } return 0; }
[ "miiya369@gmail.com" ]
miiya369@gmail.com
a6005e838b87e5d38ae9437fc4c2b5006d330dd5
bd0d4f4e9441fc919691d0342d97984b8222f1cb
/HTML/html_maker.cpp
59295331a3e6fe04f2d86aa42eec585784e947f4
[]
no_license
heavyflavor/script
6fb57f36e9e46f699f3090453a76e54a355197fa
6264604adafa35405b0a726a37b938fcef23fefc
refs/heads/master
2021-01-10T10:39:00.146848
2016-03-17T15:57:04
2016-03-17T15:57:04
54,131,201
0
0
null
null
null
null
UTF-8
C++
false
false
12,199
cpp
#include<iomanip> void html_maker() { //*********************************************************// specify RunNumber & info. int RunNumber = 15053001; char trgSetup[50] = {"production_15GeV_2014"}; // char trgSetup[20] = {"pp500production"}; char typeEnergy[10]={"AuAu15"}; //********************************************************* int RunYear=int(RunNumber/1000000)-1; char root_file_path[200]={"/star/u/xyf/protected_lfspectra/ZDC_Calibration"}; char work_dir[200]; sprintf(work_dir,"%s/run%d.%s.%s",root_file_path,RunYear,trgSetup,typeEnergy); char data_file[200];sprintf(data_file,"%s/analysis/%d/%d_gain_ratio.dat",work_dir,RunNumber,RunNumber); char html_file[200];sprintf(html_file,"%s/analysis.%d.htm",work_dir,RunNumber); cout<<data_file<<endl; cout<<html_file<<endl; int east_1=0; int west_1=0; int east_2=0; int west_2=0; int east_3=0; int west_3=0; int east_sum=0; int west_sum=0; int east_att=0; int west_att=0; double east_ratio_13=0; double west_ratio_13=0; double east_ratio_23=0; double west_ratio_23=0; double east_percentage_1=0; double west_percentage_1=0; double east_percentage_2=0; double west_percentage_2=0; double east_percentage_3=0; double west_percentage_3=0; ifstream ifile; ifile.open(data_file,ios::in);if(!ifile){cerr<<"ifile.open failed"<<endl;return 0;} ifile>>east_1>>east_2>>east_3>>east_sum>>east_att; ifile>>west_1>>west_2>>west_3>>west_sum>>west_att; ifile.close(); east_ratio_13 = double(east_1)/double(east_3); east_ratio_23 = double(east_2)/double(east_3); east_percentage_1 = double(east_1)/(double(east_1)+double(east_2)+double(east_3)); east_percentage_2 = double(east_2)/(double(east_1)+double(east_2)+double(east_3)); east_percentage_3 = double(east_3)/(double(east_1)+double(east_2)+double(east_3)); west_ratio_13 = double(west_1)/double(west_3); west_ratio_23 = double(west_2)/double(west_3); west_percentage_1 = double(west_1)/(double(west_1)+double(west_2)+double(west_3)); west_percentage_2 = double(west_2)/(double(west_1)+double(west_2)+double(west_3)); west_percentage_3 = double(west_3)/(double(west_1)+double(west_2)+double(west_3)); //***************************************************************************** // We have every number we need, start to generate html file //***************************************************************************** ofstream ofile; ofile.open(html_file,ios::out); if(!ofile) {cerr<<"ofile.open failed"<<endl;return 0;} ofile<<"<!DOCTYPE HTML>"<<endl; ofile<<"<!-- This webpage is craeted by Yifei Xu -->"<<endl; ofile<<"<html>"<<endl; ofile<<"<!-- Head xuyifei --><!-- **************************************** -->"<<endl; ofile<<"<head>"<<endl; ofile<<"<title>Run"<<RunNumber<<" ZDC</title>"<<endl; ofile<<"<style type=\"text/css\">"<<endl; ofile<<"body {color:black;}"<<endl; ofile<<"body {background-color:white;}"<<endl; ofile<<"h1 {color:#9370DB;}"<<endl; ofile<<"h1 {text-align:center;}"<<endl; ofile<<"h2 {color:#FF8C00;}"<<endl; ofile<<"h2 {text-align:left;}"<<endl; ofile<<"p.p1 {color:green;"<<endl; ofile<<" font-size:1.5em;}"<<endl; ofile<<"p.p2 {color:blue;"<<endl; ofile<<" font-size:1em;}"<<endl; ofile<<""<<endl; ofile<<"table,th,td"<<endl; ofile<<" {border-width:2px;"<<endl; ofile<<" border-style:solid;"<<endl; ofile<<" border-color:#6A8A29;}"<<endl; ofile<<"th {background-color:#85AD33;"<<endl; ofile<<" color:white;}"<<endl; ofile<<""<<endl; ofile<<"</style>"<<endl; ofile<<"</head>"<<endl; ofile<<"<!-- Body xuyifei --><!-- **************************************** -->"<<endl; ofile<<"<body>"<<endl; ofile<<"<h1><p>Run "<<RunNumber<<" Analysis</p></h1>"<<endl; ofile<<"<h2><p>Trgsetup : ZdcPolarimetry</p></h2>"<<endl; ofile<<"<h2><p>BeamType@Energy : pp@500GeV</p></h2>"<<endl; ofile<<"<br />"<<endl; ofile<<"<hr />"<<endl; ofile<<"<p class=\"p1\">For the ratio between 3 towers :</p>"<<endl; ofile<<" <A href=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_gain_east.gif\">"<<endl; ofile<<"<img src=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_gain_east.gif\" alt=\""<<RunNumber<<"_gain_east.gif\" width=\"480\" height \"360\"/></A>"<<endl; ofile<<" <A href=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_gain_west.gif\">"<<endl; ofile<<"<img src=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_gain_west.gif\" alt=\""<<RunNumber<<"_gain_west.gif\" width=\"480\" height \"360\"/></A>"<<endl; ofile<<"<p class=\"p1\">The ratio and percentage between 3 towers : </p>"<<endl; ofile<<"<p class=\"p1\">percentage = towerX/(tower1+tower2+tower3)</p>"<<endl; ofile<<"<!-- Table 2 ---------------------------------------------------- -->"<<endl; ofile<<"<table width=\"500\" border=\"1\" bordercolor=\"#000000\" cellspacing=\"0\" cellpadding=\"10\" style=\"border-collapse:collapse;\">"<<endl; ofile<<" <tr>"<<endl; ofile<<" <th rowspan=\"2\">Beam-Direction</th>"<<endl; ofile<<" <th colspan=\"3\">Ratio</th>"<<endl; ofile<<" <th colspan=\"3\">Percentage</th>"<<endl; ofile<<" </tr>"<<endl; ofile<<" <tr>"<<endl; ofile<<" <th>Tower-1</th>"<<endl; ofile<<" <th>Tower-2</th>"<<endl; ofile<<" <th>Tower-3</th>"<<endl; ofile<<" <th>Tower-1</th>"<<endl; ofile<<" <th>Tower-2</th>"<<endl; ofile<<" <th>Tower-3</th>"<<endl; ofile<<" </tr>"<<endl; ofile<<" <tr>"<<endl; //************************************************************************* East Ratio & Percentage // xuyifei ofile<<setiosflags(ios::fixed)<<setprecision(2)<<endl; ofile<<" <td align=\"center\">East</td>"<<endl; ofile<<" <td align=\"center\">"<<east_ratio_13<<"</td>"<<endl; ofile<<" <td align=\"center\">"<<east_ratio_23<<"</td>"<<endl; ofile<<" <td align=\"center\">1.00</td>"<<endl; ofile<<" <td align=\"center\">"<<east_percentage_1*100<<"%</td>"<<endl; ofile<<" <td align=\"center\">"<<east_percentage_2*100<<"%</td>"<<endl; ofile<<" <td align=\"center\">"<<east_percentage_3*100<<"%</td>"<<endl; //************************************************************************* ofile<<" </tr>"<<endl; ofile<<" <tr>"<<endl; //************************************************************************* West Ratio & Percentage // xuyifei ofile<<" <td align=\"center\">West</td>"<<endl; ofile<<" <td align=\"center\">"<<west_ratio_13<<"</td>"<<endl; ofile<<" <td align=\"center\">"<<west_ratio_23<<"</td>"<<endl; ofile<<" <td align=\"center\">1.00</td>"<<endl; ofile<<" <td align=\"center\">"<<west_percentage_1*100<<"%</td>"<<endl; ofile<<" <td align=\"center\">"<<west_percentage_2*100<<"%</td>"<<endl; ofile<<" <td align=\"center\">"<<west_percentage_3*100<<"%</td>"<<endl; ofile<<resetiosflags(ios::fixed)<<endl; //************************************************************************* ofile<<" </tr>"<<endl; ofile<<"</table>"<<endl; ofile<<"<br />"<<endl; ofile<<"<p class=\"p1\">Gain of towers are:</p>"<<endl; ofile<<"<br />"<<endl; ofile<<"<table width=\"500\" border=\"1\" bordercolor=\"#000000\" cellspacing=\"0\" cellpadding=\"10\" style=\"border-collapse:collapse;\">"<<endl; ofile<<" <tr>"<<endl; ofile<<" <th>Beam-Direction</th>"<<endl; ofile<<" <th>Gain Tower-1</th>"<<endl; ofile<<" <th>Gain Tower-2</th>"<<endl; ofile<<" <th>Gain Tower-3</th>"<<endl; ofile<<" <th>Gain Sum</th>"<<endl; ofile<<" <th>Gain Attenuated</th>"<<endl; ofile<<" </tr>"<<endl; ofile<<" <tr>"<<endl; //************************************************************************* East Gain // xuyifei ofile<<" <td align=\"center\">East</td>"<<endl; ofile<<" <td align=\"center\">"<<east_1<<"</td>"<<endl; ofile<<" <td align=\"center\">"<<east_2<<"</td>"<<endl; ofile<<" <td align=\"center\">"<<east_3<<"</td>"<<endl; ofile<<" <td align=\"center\">"<<east_sum<<"</td>"<<endl; ofile<<" <td align=\"center\">"<<east_att<<"</td>"<<endl; //************************************************************************* ofile<<" </tr>"<<endl; ofile<<" <tr>"<<endl; //************************************************************************* West Gain // xuyifei ofile<<" <td align=\"center\">West</td>"<<endl; ofile<<" <td align=\"center\">"<<west_1<<"</td>"<<endl; ofile<<" <td align=\"center\">"<<west_2<<"</td>"<<endl; ofile<<" <td align=\"center\">"<<west_3<<"</td>"<<endl; ofile<<" <td align=\"center\">"<<west_sum<<"</td>"<<endl; ofile<<" <td align=\"center\">"<<west_att<<"</td>"<<endl; //************************************************************************* ofile<<" </tr>"<<endl; ofile<<"</table>"<<endl; ofile<<""<<endl; ofile<<"<br />"<<endl; ofile<<"<br />"<<endl; ofile<<"<!-- Table 2 ---------------------------------------------------- -->"<<endl; ofile<<"<hr />"<<endl; ofile<<"<p class=\"p1\">For the sum and attenuated signal :</p>"<<endl; ofile<<" <A href=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_east_att.gif\">"<<endl; ofile<<"<img src=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_east_att.gif\" alt=\""<<RunNumber<<"_east_att.gif\" width=\"360\" height \"240\"/></A>"<<endl; ofile<<" <A href=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_east_sum.gif\">"<<endl; ofile<<"<img src=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_east_sum.gif\" alt=\""<<RunNumber<<"_east_sum.gif\" width=\"360\" height \"240\"/></A>"<<endl; ofile<<" <A href=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_west_att.gif\">"<<endl; ofile<<"<img src=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_west_att.gif\" alt=\""<<RunNumber<<"_west_att.gif\" width=\"360\" height \"240\"/></A>"<<endl; ofile<<" <A href=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_west_sum.gif\">"<<endl; ofile<<"<img src=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_west_sum.gif\" alt=\""<<RunNumber<<"_west_sum.gif\" width=\"360\" height \"240\"/></A>"<<endl; ofile<<"<br />"<<endl; ofile<<"<p class=\"p1\">For the individual tower :</p>"<<endl; ofile<<" <A href=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_east_1.gif\">"<<endl; ofile<<"<img src=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_east_1.gif\" alt=\""<<RunNumber<<"_east_1.gif\" width=\"360\" height \"240\"/></A>"<<endl; ofile<<" <A href=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_east_2.gif\">"<<endl; ofile<<"<img src=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_east_2.gif\" alt=\""<<RunNumber<<"_east_2.gif\" width=\"360\" height \"240\"/></A>"<<endl; ofile<<" <A href=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_east_3.gif\">"<<endl; ofile<<"<img src=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_east_3.gif\" alt=\""<<RunNumber<<"_east_3.gif\" width=\"360\" height \"240\"/></A>"<<endl; ofile<<"<br />"<<endl; ofile<<" <A href=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_west_1.gif\">"<<endl; ofile<<"<img src=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_west_1.gif\" alt=\""<<RunNumber<<"_west_1.gif\" width=\"360\" height \"240\"/></A>"<<endl; ofile<<" <A href=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_west_2.gif\">"<<endl; ofile<<"<img src=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_west_2.gif\" alt=\""<<RunNumber<<"_west_2.gif\" width=\"360\" height \"240\"/></A>"<<endl; ofile<<" <A href=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_west_3.gif\">"<<endl; ofile<<"<img src=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_west_3.gif\" alt=\""<<RunNumber<<"_west_3.gif\" width=\"360\" height \"240\"/></A>"<<endl; ofile<<"<br />"<<endl; ofile<<"<br />"<<endl; ofile<<"<hr />"<<endl; ofile<<"<br />"<<endl; ofile<<"<p class=\"p1\">The difference between sum and tow1+tow2+tow3 :</p>"<<endl; ofile<<"<br />"<<endl; ofile<<" <A href=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_east_sum_diff.gif\">"<<endl; ofile<<"<img src=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_east_sum_diff.gif\" alt=\""<<RunNumber<<"_east_sum_diff.gif\" width=\"480\" height \"360\"/></A>"<<endl; ofile<<" <A href=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_west_sum_diff.gif\">"<<endl; ofile<<"<img src=\"./analysis/"<<RunNumber<<"/"<<RunNumber<<"_west_sum_diff.gif\" alt=\""<<RunNumber<<"_west_sum_diff.gif\" width=\"480\" height \"360\"/></A>"<<endl; ofile<<"</body>"<<endl; ofile<<"<!-- End xuyifei --><!-- **************************************** -->"<<endl; ofile<<"</html>"<<endl; }
[ "zhoulong07@hotmail.com" ]
zhoulong07@hotmail.com
bd159aae1897fc72249a171dbabb04d21e8aab79
12f1f467a16782a79d1071408ae76fc254e084b9
/include/iunoplugin.h
fb8b143e9ce4caa9365ee6a28de32d7439a680d4
[]
no_license
dkhaleev/uno_bridge
7e692885e9994e6ccfb89df74b25a6b09ceec37d
02f88f03aaec4314d53d3a961f9d66c8768d7475
refs/heads/master
2023-07-17T17:09:11.278796
2021-08-30T18:46:30
2021-08-30T18:46:30
346,133,571
1
1
null
null
null
null
UTF-8
C++
false
false
742
h
#pragma once #ifdef _WIN32 #define ADD_EXPORTS #ifdef ADD_EXPORTS #define UNOPLUGINAPI __declspec(dllexport) #else #define UNOPLUGINAPI __declspec(dllimport) #endif #define UNOPLUGINCALL __cdecl #else #define UNOPLUGINAPI #define UNOPLUGINCALL #endif #define UNOPLUGINAPIVERSION (0x00000002) class IUnoPluginController; class UnoEvent; typedef unsigned short channel_t; class IUnoPlugin { public: IUnoPlugin(IUnoPluginController& controller) : m_controller(controller) { } virtual ~IUnoPlugin() { } virtual const char* GetPluginName() const { return "Untitled Plugin"; } virtual void HandleEvent(const UnoEvent& ev) { } virtual bool IsEnabled() { return true; } protected: IUnoPluginController& m_controller; };
[ "dkhaleev@gmail.com" ]
dkhaleev@gmail.com
d2b87b04f085bdee968f037ffdd64242df120754
dd8bc1a8dfcea7a0d8efea5fb1a9418e8385f017
/suffix_array.cpp
09a7afc75078f07b738c0e38d0cefa0d10b70a75
[]
no_license
tanmoymollik/algos
a6d1228d5d9d6ac83b1e9b49ed3107883d11496e
c3be193dca05fcea1b78d02c925489079426957e
refs/heads/master
2021-10-24T22:14:18.184890
2019-03-29T10:24:50
2019-03-29T10:24:50
106,557,409
4
2
null
null
null
null
UTF-8
C++
false
false
1,692
cpp
#include <bits/stdc++.h> using namespace std; #define MAX 100005 int Count[MAX], output[MAX]; struct suffixArray { #define MAX_lg 17 #define minchar 'a' #define Index(a) (((a) < len) ? index[mlgn][a] : -1) int pos[MAX], index[MAX_lg][MAX], lcp[MAX], len, mlgn; suffixArray() {} suffixArray(const char *S) { create(S); } void CountSort(int add) { int to = max(len, 26); memset(Count, 0, sizeof(Count)); for(int i = 0; i < len; i++) ++Count[ Index(pos[i] + add) + 1 ]; for(int i = 1; i <= to; i++) Count[i] += Count[i-1]; for(int i = len-1; i >= 0; i--) output[ --Count[ Index(pos[i] + add) + 1 ] ] = pos[i]; for(int i = 0; i < len; i++) pos[i] = output[i]; } int Lcp(int x, int y) { int ret = 0; for(int i = mlgn; i >= 0 && x < len && y < len; i--) if(index[i][x] == index[i][y]) x += (1 << i), y += (1 << i), ret += (1 << i); return ret; } void create(const char *S) { len = strlen(S), mlgn = 0; for(int i = 0; i < len; i++) index[0][i] = S[i] - minchar; for(int done = 1; done < len; done <<= 1) { for(int i = 0; i < len; i++) pos[i] = i; CountSort(done); CountSort(0); for(int i = 0; i < len; i++) { int sc1 = (i > 0) ? Index(pos[i-1] + done) : -1; int sc2 = Index(pos[i] + done); index[mlgn+1][pos[i]] = (i > 0 && index[mlgn][pos[i]] == index[mlgn][pos[i-1]] && sc1 == sc2) ? index[mlgn+1][pos[i-1]] : i; } mlgn++; } lcp[0] = 0; for(int i = 1; i < len; i++) lcp[i] = Lcp(pos[i], pos[i-1]); } };
[ "fnd.shuvo22@gmail.com" ]
fnd.shuvo22@gmail.com
6e4cfe5bd8d20340172aa48d7a4237c96c4f9276
1f0bad4cac3ab62d9dc5d281b551d07c4db3f41a
/17.11/17.11/hashtable.h
f7692317f0b29446b83fdbd1d34e563f0a074c61
[]
no_license
GF2595/HW_First_Semester
29ca634a5222c74cacb11f219a78edb973dd63d3
556ee19d3868ded13aed1acbec7a8db00d3dd93b
refs/heads/master
2021-01-23T03:52:55.131458
2015-04-01T18:15:02
2015-04-01T18:15:02
33,264,038
0
0
null
null
null
null
UTF-8
C++
false
false
452
h
#pragma once struct Hashtable; //Makes new hashtable //Returns hashtable pointer Hashtable* makeTable(); //Adds new word to hash table //Receives table pointer and string void addHashElement(Hashtable *table, std::string element); //Prints hashtable with noting times, each word was added //Receives table pointer void printTable(Hashtable *table); //Deletes hashtable //Receives table pointer void deleteTable(Hashtable *table);
[ "gf2595@gmail.com" ]
gf2595@gmail.com
670830ceaa4d40fcada6bf3ef176a901b3e911a6
447b81945f16274ecefc9df61f64f99931b71dab
/Arduino/stepper_speedControl/stepper_speedControl.ino
1c98ccc542ab855030edf107a03b37777c4905e4
[]
no_license
aglomeradoaberto/barn_door_tracker
5abf6f6f229445bfa746e9cc5c63f5b0ba76285c
d382d00e2c5b27734d26ff30bf9e75ff6bb54df4
refs/heads/master
2022-12-02T20:22:04.340697
2020-08-25T00:23:21
2020-08-25T00:23:21
290,064,704
0
0
null
null
null
null
UTF-8
C++
false
false
771
ino
/* * Barn door tracker * Gustavo Retuci Pinheiro * https://github.com/GustavoRP * * 28BYJ-48 stepper * one revolution per day on 200mm platform, 8/1 reduction and M5-0.8mm curved threaded rod * */ #include <Stepper.h> #define STEPS 2048 Stepper stepper(STEPS, 8, 9, 10, 11); void setup() { // one revolution per day. //stepper.setSpeed(8.3775); stepper.setSpeed(8.72665); } void loop() { stepper.step(2048); } /* * 2*pi*200 = 1.256,63706143591729538505mm -> one revolution * 1.256,63706143591729538505mm/24h = 0.87266462599716478846184538424431mm/min * thread step = 0,8mm * gear reduction = 8x * nut speed = 0.872664625997/0,8 = 1,090830782496455985577306730305rev/min * stepper speed = nut speed * 8 = 8,7266462599716478846184538424431 */
[ "gustavo_r_p@hotmail.com" ]
gustavo_r_p@hotmail.com
80f19efa4645d75990facd7e594fd9036fd6991d
5fd336b1e29a2a439ec16f81b0ed6fd38a9538de
/Ncurses.cpp
7d9b6eda0fc8f731c5a2b1ce0e714a349a8e8a0c
[]
no_license
itsmekate/ft_gkrellm
58a7924cf0f5d77cf6f8e0fcf26a43942bec34c8
698101198a89cb759619e579807a5b935c44a295
refs/heads/master
2020-04-01T04:22:00.289774
2018-10-14T14:14:27
2018-10-14T14:14:27
152,860,364
1
0
null
null
null
null
UTF-8
C++
false
false
3,746
cpp
// // Created by Kateryna PRASOL on 13.10.2018. // #include "Ncurses.h" Ncurses::Ncurses() { initscr(); clear(); noecho(); cbreak(); keypad(stdscr, TRUE); curs_set(FALSE); start_color(); initwindows(); initpairs(); drawborders(); } Ncurses::Ncurses(Ncurses &rhs) { *this = rhs; } Ncurses const & Ncurses::operator=(Ncurses & rhs) { if(this != &rhs) { _winHost = rhs._winHost; _winNetwork = rhs._winNetwork; _winOSInfo = rhs._winOSInfo; _winCPU = rhs._winCPU; _winREM = rhs._winREM; _winCAT = rhs._winCAT; } return (*this); } Ncurses::~Ncurses() { delwin(_winHost); delwin(_winNetwork); delwin(_winOSInfo); delwin(_winCPU); delwin(_winREM); delwin(_winCAT); endwin(); } void Ncurses::initwindows() { _winHost = newwin(5, 60, 0, 0); _winNetwork = newwin(5, 60, 10, 0); _winOSInfo = newwin(5, 60, 5, 0); _winCPU = newwin(5, 60, 15, 0); _winREM = newwin(5, 60, 20, 0); _winCAT = newwin(20, 60, 25, 0); nodelay(_winHost, true); nodelay(_winNetwork, true); nodelay(_winOSInfo, true); nodelay(_winCPU, true); nodelay(_winREM, true); nodelay(_winCAT, true); } void Ncurses::initpairs() { init_pair(1, COLOR_WHITE, COLOR_BLACK); init_pair(2, COLOR_GREEN, COLOR_BLACK); init_pair(3, COLOR_MAGENTA, COLOR_BLACK); init_pair(4, COLOR_CYAN, COLOR_BLACK); init_pair(5, COLOR_RED, COLOR_BLACK); init_pair(6, COLOR_YELLOW, COLOR_BLACK); init_pair(7, COLOR_BLACK, COLOR_BLACK); init_pair(8, COLOR_RED, COLOR_RED); init_pair(9, COLOR_CYAN, COLOR_CYAN); init_pair(10, COLOR_YELLOW, COLOR_YELLOW); } void Ncurses::drawborders() { wattron(_winHost, COLOR_PAIR(1)); box(_winHost, 0, 0); box(_winNetwork, 0, 0); box(_winOSInfo, 0, 0); box(_winCPU, 0, 0); box(_winREM, 0, 0); box(_winCAT, 0, 0); wattroff(_winHost, COLOR_PAIR(1)); wrefresh(_winHost); wrefresh(_winNetwork); wrefresh(_winOSInfo); wrefresh(_winCPU); wrefresh(_winREM); wrefresh(_winCAT); } void Ncurses::runNcurses() { try { Hostname *hn = new Hostname(); DateTime *dt = new DateTime(); OSInfo *info = new OSInfo(); Network *n = new Network(); CPU *cp = new CPU(); REM *rm = new REM(); Cat *c = new Cat(); int i = 0; while(1) { i++; outputHostWindow(*dt, *hn); info->outputOSInfoWindow(_winOSInfo); n->outputNetwork(_winNetwork); cp->outputCPU(_winCPU); rm->outputREM(_winREM); if (i % 2 == 0) c->print_cat1(_winCAT); else c->print_cat2(_winCAT); if (wgetch(_winHost) == 'q' || wgetch(_winNetwork) == 'q' || wgetch(_winOSInfo) == 'q' || wgetch(_winCPU) == 'q' || wgetch(_winREM) == 'q' || wgetch(_winCAT) == 'q') { break; } } } catch(std::exception &e) { std::cout << "\\033[0;31m'Warning: Don't change terminal size during program run!\\033[0m" << std::endl; } } void Ncurses::outputHostWindow(DateTime dt, Hostname hn) { wattron(_winHost, A_BOLD); wattron(_winHost, COLOR_PAIR(2)); mvwprintw(_winHost, 1, 2, "Date and Time: %s", dt.getDateTime().c_str()); mvwprintw(_winHost, 2, 2, "Host name: %s", hn.getHostName()); mvwprintw(_winHost, 3, 2, "User name: %s", hn.getUserName()); wattroff(_winHost, COLOR_PAIR(2)); wattroff(_winHost, A_BOLD); wattron(_winHost, COLOR_PAIR(1)); box(_winHost, 0, 0); wattroff(_winHost, COLOR_PAIR(1)); wrefresh(_winHost); }
[ "prasolkaterina@knu.ua" ]
prasolkaterina@knu.ua
93464b1a16c17d23cc8187d5a20e4e3c749d1716
5fb67a5f965d5522cd0eccbf6f366d4304de782f
/Neon/src/Neon/Platform/Vulkan/VulkanDevice.h
84d1a1d0e628910e31a47ffc706eea22cf40e84d
[ "Apache-2.0" ]
permissive
FilipHusnjak/Neon
52bb2a14c4fc93c1ad5f0eb9e8f67415904b3168
3981a76f4a35302e0fc70d4e32b2b2ac19b53089
refs/heads/master
2023-08-04T10:44:12.250060
2021-09-14T21:31:33
2021-09-14T21:31:33
280,649,766
5
1
null
null
null
null
UTF-8
C++
false
false
3,293
h
#pragma once #include "Core/Core.h" #include "Vulkan.h" namespace Neon { class VulkanPhysicalDevice : public RefCounted { public: VulkanPhysicalDevice(); ~VulkanPhysicalDevice() = default; uint32 GetMemoryTypeIndex(uint32 typeBits, vk::MemoryPropertyFlags properties) const; vk::PhysicalDevice GetHandle() const { return m_Handle; } int32 GetGraphicsQueueIndex() const { return m_QueueFamilyIndices.Graphics; } int32 GetComputeQueueIndex() const { return m_QueueFamilyIndices.Compute; } int32 GetTransferQueueIndex() const { return m_QueueFamilyIndices.Transfer; } vk::Format GetDepthFormat() const { return m_DepthFormat; } vk::PhysicalDeviceProperties GetProperties() { return m_Properties; } vk::PhysicalDeviceFeatures GetSupportedFeatures() const { return m_SupportedFeatures; } static SharedRef<VulkanPhysicalDevice> Select(); private: struct QueueFamilyIndices { int32 Graphics = -1; int32 Compute = -1; int32 Transfer = -1; }; QueueFamilyIndices GetQueueFamilyIndices(vk::QueueFlags queueFlags); vk::Format FindDepthFormat(); private: QueueFamilyIndices m_QueueFamilyIndices; vk::PhysicalDevice m_Handle; vk::PhysicalDeviceProperties m_Properties; vk::PhysicalDeviceFeatures m_SupportedFeatures; vk::PhysicalDeviceMemoryProperties m_MemoryProperties; vk::Format m_DepthFormat = vk::Format::eUndefined; std::vector<vk::ExtensionProperties> m_SupportedExtensions; std::vector<vk::QueueFamilyProperties> m_QueueFamilyProperties; std::vector<vk::DeviceQueueCreateInfo> m_QueueCreateInfos; const std::vector<const char*> m_RequiredPhysicalDeviceExtensions = {VK_KHR_SWAPCHAIN_EXTENSION_NAME, VK_KHR_MAINTENANCE2_EXTENSION_NAME, VK_EXT_SCALAR_BLOCK_LAYOUT_EXTENSION_NAME, VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME, VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME, VK_KHR_DEPTH_STENCIL_RESOLVE_EXTENSION_NAME, VK_KHR_CREATE_RENDERPASS_2_EXTENSION_NAME, VK_KHR_MULTIVIEW_EXTENSION_NAME}; friend class VulkanDevice; }; class VulkanDevice : public RefCounted { public: VulkanDevice(SharedRef<VulkanPhysicalDevice>& physicalDevice); ~VulkanDevice() = default; vk::Device GetHandle() const { return m_Handle.get(); } SharedRef<VulkanPhysicalDevice> GetPhysicalDevice() const { return m_PhysicalDevice; } vk::Queue GetGraphicsQueue() const { return m_GraphicsQueue; } vk::Queue GetComputeQueue() const { return m_ComputeQueue; } vk::Queue GetTransferQueue() const { return m_TransferQueue; } vk::CommandPool GetGraphicsCommandPool() const { return m_GraphicsCommandPool.get(); } static SharedRef<VulkanDevice> Create(SharedRef<VulkanPhysicalDevice>& physicalDevice); private: vk::UniqueDevice m_Handle; SharedRef<VulkanPhysicalDevice> m_PhysicalDevice; vk::Queue m_GraphicsQueue; vk::Queue m_ComputeQueue; vk::Queue m_TransferQueue; vk::UniqueCommandPool m_GraphicsCommandPool; vk::UniqueCommandPool m_ComputeCommandPool; const std::vector<const char*> m_ValidationLayers = {"VK_LAYER_KHRONOS_validation"}; }; } // namespace Neon
[ "filip.husnjak@fer.hr" ]
filip.husnjak@fer.hr
84d5d69a7512fe76eb850a2bd57423146c1d30bd
b9593d1a32fb132de18a9ffe36c826b1b26eaffb
/win32/boost/boost/mpl/size.hpp
1c4efa166444e10ea436d00373c9bdd5e019b869
[ "BSL-1.0" ]
permissive
autofax/sfftobmp_copy
8f8b3b0d9bec2cff6d81bb6855e34f4d54f9d7eb
6058b7c0df917af19b4b27003a189cf71bade801
refs/heads/master
2020-12-02T16:36:16.956519
2017-07-07T17:10:57
2017-07-07T17:10:57
96,559,550
0
0
null
null
null
null
UTF-8
C++
false
false
1,087
hpp
#ifndef BOOST_MPL_SIZE_HPP_INCLUDED #define BOOST_MPL_SIZE_HPP_INCLUDED // Copyright Aleksey Gurtovoy 2000-2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/mpl for documentation. // $Id: size.hpp,v 1.1 2009/08/23 12:38:09 pschaefer Exp $ // $Date: 2009/08/23 12:38:09 $ // $Revision: 1.1 $ #include <boost/mpl/size_fwd.hpp> #include <boost/mpl/sequence_tag.hpp> #include <boost/mpl/aux_/size_impl.hpp> #include <boost/mpl/aux_/na_spec.hpp> #include <boost/mpl/aux_/lambda_support.hpp> #include <boost/mpl/aux_/msvc_eti_base.hpp> namespace boost { namespace mpl { template< typename BOOST_MPL_AUX_NA_PARAM(Sequence) > struct size : aux::msvc_eti_base< typename size_impl< typename sequence_tag<Sequence>::type > ::template apply< Sequence >::type >::type { BOOST_MPL_AUX_LAMBDA_SUPPORT(1, size, (Sequence)) }; BOOST_MPL_AUX_NA_SPEC(1, size) }} #endif // BOOST_MPL_SIZE_HPP_INCLUDED
[ "gerald.schade@gmx.de" ]
gerald.schade@gmx.de
62cbc514c3e1a0aa4378294ecd4117f32e120f3c
3b8fdeaa2f7b137bb8a2e0cf0beaa158831288e0
/adapter/qt/metacall.h
cf34e5a43a51d499b0502ac94d03c94f02055864
[ "MIT" ]
permissive
internetbroker/CoolerCppIdiom
b03153bf53dcda0d4bb56f5dc6ba0b4a36d9ee58
48883a40825166931fce61f98665ed6a806b3691
refs/heads/master
2020-09-20T04:52:02.604586
2019-07-12T19:00:15
2019-07-12T19:00:15
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,709
h
#pragma once #include <QtCore/QtCore> namespace Qx { inline QVariant metaCall(QObject* object, QMetaMethod metaMethod, QVariantList args) { QList<QGenericArgument> arguments; for (int i = 0; i < args.size(); i++) { // Notice that we have to take a reference to the argument. A // const_cast is needed because calling data() would detach // the QVariant. QVariant& argument = args[i]; QGenericArgument genericArgument( QMetaType::typeName(argument.userType()), const_cast<void*>(argument.constData()) ); arguments << genericArgument; } QVariant returnValue(QMetaType::type(metaMethod.typeName()), static_cast<void*>(NULL)); QGenericReturnArgument returnArgument(metaMethod.typeName(), const_cast<void*>(returnValue.constData())); bool ok = metaMethod.invoke( object, Qt::AutoConnection, returnArgument, arguments.value(0), arguments.value(1), arguments.value(2), arguments.value(3), arguments.value(4), arguments.value(5), arguments.value(6), arguments.value(7), arguments.value(8), arguments.value(9) ); if (!ok) { #if QT_VERSION >= 0x050000 qWarning() << "Calling" << metaMethod.methodSignature() << "failed."; #else qWarning() << "Calling" << metaMethod.signature() << "failed."; #endif return QVariant(); } else { return returnValue; } } }
[ "lushang@outlook.com" ]
lushang@outlook.com
aba85448537729a78e4b8e4b7d17089bb696400d
12505544ce8084691b5ec1c423bb571aae641f95
/third_party/rust/rlbox_lucet_sandbox/include/rlbox_lucet_sandbox.hpp
715c72c533f74fcf6ab79504680e3b3f0b482b2f
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
privacytoolkit/gecko-dev
6a56a94f78022ff4435a0dbbafc9deaf28b93783
50745139bc9f4aa43af299a2420c1911a18b63f8
refs/heads/master
2022-04-05T13:49:23.463007
2020-02-12T07:56:43
2020-02-12T07:56:43
230,883,564
0
0
NOASSERTION
2019-12-30T09:04:53
2019-12-30T09:04:52
null
UTF-8
C++
false
false
31,730
hpp
#pragma once #include "lucet_sandbox.h" #include <cstdint> #include <iostream> #include <limits> #include <map> #include <memory> #include <mutex> // RLBox allows applications to provide a custom shared lock implementation #ifndef RLBOX_USE_CUSTOM_SHARED_LOCK # include <shared_mutex> #endif #include <type_traits> #include <utility> #include <vector> #define RLBOX_LUCET_UNUSED(...) (void)__VA_ARGS__ // Use the same convention as rlbox to allow applications to customize the // shared lock #ifndef RLBOX_USE_CUSTOM_SHARED_LOCK # define RLBOX_SHARED_LOCK(name) std::shared_timed_mutex name # define RLBOX_ACQUIRE_SHARED_GUARD(name, ...) \ std::shared_lock<std::shared_timed_mutex> name(__VA_ARGS__) # define RLBOX_ACQUIRE_UNIQUE_GUARD(name, ...) \ std::unique_lock<std::shared_timed_mutex> name(__VA_ARGS__) #else # if !defined(RLBOX_SHARED_LOCK) || !defined(RLBOX_ACQUIRE_SHARED_GUARD) || \ !defined(RLBOX_ACQUIRE_UNIQUE_GUARD) # error \ "RLBOX_USE_CUSTOM_SHARED_LOCK defined but missing definitions for RLBOX_SHARED_LOCK, RLBOX_ACQUIRE_SHARED_GUARD, RLBOX_ACQUIRE_UNIQUE_GUARD" # endif #endif namespace rlbox { namespace detail { // relying on the dynamic check settings (exception vs abort) in the rlbox lib inline void dynamic_check(bool check, const char* const msg); } namespace lucet_detail { template<typename T> constexpr bool false_v = false; // https://stackoverflow.com/questions/6512019/can-we-get-the-type-of-a-lambda-argument namespace return_argument_detail { template<typename Ret, typename... Rest> Ret helper(Ret (*)(Rest...)); template<typename Ret, typename F, typename... Rest> Ret helper(Ret (F::*)(Rest...)); template<typename Ret, typename F, typename... Rest> Ret helper(Ret (F::*)(Rest...) const); template<typename F> decltype(helper(&F::operator())) helper(F); } // namespace return_argument_detail template<typename T> using return_argument = decltype(return_argument_detail::helper(std::declval<T>())); /////////////////////////////////////////////////////////////// // https://stackoverflow.com/questions/37602057/why-isnt-a-for-loop-a-compile-time-expression namespace compile_time_for_detail { template<std::size_t N> struct num { static const constexpr auto value = N; }; template<class F, std::size_t... Is> inline void compile_time_for_helper(F func, std::index_sequence<Is...>) { (func(num<Is>{}), ...); } } // namespace compile_time_for_detail template<std::size_t N, typename F> inline void compile_time_for(F func) { compile_time_for_detail::compile_time_for_helper( func, std::make_index_sequence<N>()); } /////////////////////////////////////////////////////////////// template<typename T, typename = void> struct convert_type_to_wasm_type { static_assert(std::is_void_v<T>, "Missing specialization"); using type = void; static constexpr enum LucetValueType lucet_type = LucetValueType_Void; }; template<typename T> struct convert_type_to_wasm_type< T, std::enable_if_t<(std::is_integral_v<T> || std::is_enum_v<T>)&&sizeof(T) <= sizeof(uint32_t)>> { using type = uint32_t; static constexpr enum LucetValueType lucet_type = LucetValueType_I32; }; template<typename T> struct convert_type_to_wasm_type< T, std::enable_if_t<(std::is_integral_v<T> || std::is_enum_v<T>)&&sizeof(uint32_t) < sizeof(T) && sizeof(T) <= sizeof(uint64_t)>> { using type = uint64_t; static constexpr enum LucetValueType lucet_type = LucetValueType_I64; }; template<typename T> struct convert_type_to_wasm_type<T, std::enable_if_t<std::is_same_v<T, float>>> { using type = T; static constexpr enum LucetValueType lucet_type = LucetValueType_F32; }; template<typename T> struct convert_type_to_wasm_type<T, std::enable_if_t<std::is_same_v<T, double>>> { using type = T; static constexpr enum LucetValueType lucet_type = LucetValueType_F64; }; template<typename T> struct convert_type_to_wasm_type< T, std::enable_if_t<std::is_pointer_v<T> || std::is_class_v<T>>> { // pointers are 32 bit indexes in wasm // class paramters are passed as a pointer to an object in the stack or heap using type = uint32_t; static constexpr enum LucetValueType lucet_type = LucetValueType_I32; }; /////////////////////////////////////////////////////////////// namespace prepend_arg_type_detail { template<typename T, typename T_ArgNew> struct helper; template<typename T_ArgNew, typename T_Ret, typename... T_Args> struct helper<T_Ret(T_Args...), T_ArgNew> { using type = T_Ret(T_ArgNew, T_Args...); }; } template<typename T_Func, typename T_ArgNew> using prepend_arg_type = typename prepend_arg_type_detail::helper<T_Func, T_ArgNew>::type; /////////////////////////////////////////////////////////////// namespace change_return_type_detail { template<typename T, typename T_RetNew> struct helper; template<typename T_RetNew, typename T_Ret, typename... T_Args> struct helper<T_Ret(T_Args...), T_RetNew> { using type = T_RetNew(T_Args...); }; } template<typename T_Func, typename T_RetNew> using change_return_type = typename change_return_type_detail::helper<T_Func, T_RetNew>::type; /////////////////////////////////////////////////////////////// namespace change_class_arg_types_detail { template<typename T, typename T_ArgNew> struct helper; template<typename T_ArgNew, typename T_Ret, typename... T_Args> struct helper<T_Ret(T_Args...), T_ArgNew> { using type = T_Ret(std::conditional_t<std::is_class_v<T_Args>, T_ArgNew, T_Args>...); }; } template<typename T_Func, typename T_ArgNew> using change_class_arg_types = typename change_class_arg_types_detail::helper<T_Func, T_ArgNew>::type; } // namespace lucet_detail class rlbox_lucet_sandbox; struct rlbox_lucet_sandbox_thread_data { rlbox_lucet_sandbox* sandbox; uint32_t last_callback_invoked; }; #ifdef RLBOX_EMBEDDER_PROVIDES_TLS_STATIC_VARIABLES rlbox_lucet_sandbox_thread_data* get_rlbox_lucet_sandbox_thread_data(); # define RLBOX_LUCET_SANDBOX_STATIC_VARIABLES() \ thread_local rlbox::rlbox_lucet_sandbox_thread_data \ rlbox_lucet_sandbox_thread_info{ 0, 0 }; \ namespace rlbox { \ rlbox_lucet_sandbox_thread_data* get_rlbox_lucet_sandbox_thread_data() \ { \ return &rlbox_lucet_sandbox_thread_info; \ } \ } \ static_assert(true, "Enforce semi-colon") #endif class rlbox_lucet_sandbox { public: using T_LongLongType = int32_t; using T_LongType = int32_t; using T_IntType = int32_t; using T_PointerType = uint32_t; using T_ShortType = int16_t; private: LucetSandboxInstance* sandbox = nullptr; uintptr_t heap_base; void* malloc_index = 0; void* free_index = 0; size_t return_slot_size = 0; T_PointerType return_slot = 0; static const size_t MAX_CALLBACKS = 128; RLBOX_SHARED_LOCK(callback_mutex); void* callback_unique_keys[MAX_CALLBACKS]{ 0 }; void* callbacks[MAX_CALLBACKS]{ 0 }; uint32_t callback_slot_assignment[MAX_CALLBACKS]{ 0 }; using TableElementRef = LucetFunctionTableElement*; struct FunctionTable { TableElementRef elements[MAX_CALLBACKS]; uint32_t slot_number[MAX_CALLBACKS]; }; inline static std::mutex callback_table_mutex; // We need to share the callback slot info across multiple sandbox instances // that may load the same sandboxed library. Thus if the sandboxed library is // already in the memory space, we should just use the previously saved info // as the load is destroys the callback info. Once all instances of the // library is unloaded, the sandboxed library is removed from the address // space and thus we can "reset" our state. The semantics of shared and weak // pointers ensure this and will automatically release the memory after all // instances are released. inline static std::map<void*, std::weak_ptr<FunctionTable>> shared_callback_slots; std::shared_ptr<FunctionTable> callback_slots = nullptr; // However, if the library is also loaded externally in the application, then // we don't know when we can ever "reset". In such scenarios, we are better of // never throwing away the callback info, rather than figuring out // what/why/when the application is loading or unloading the sandboxed // library. An extra reference to the shared_ptr will ensure this. inline static std::vector<std::shared_ptr<FunctionTable>> saved_callback_slot_info; #ifndef RLBOX_EMBEDDER_PROVIDES_TLS_STATIC_VARIABLES thread_local static inline rlbox_lucet_sandbox_thread_data thread_data{ 0, 0 }; #endif template<typename T_FormalRet, typename T_ActualRet> inline auto serialize_to_sandbox(T_ActualRet arg) { if constexpr (std::is_class_v<T_FormalRet>) { // structs returned as pointers into wasm memory/wasm stack auto ptr = reinterpret_cast<T_FormalRet*>( impl_get_unsandboxed_pointer<T_FormalRet*>(arg)); T_FormalRet ret = *ptr; return ret; } else { return arg; } } inline std::shared_ptr<FunctionTable> get_callback_ref_data( LucetFunctionTable& functionPointerTable) { auto callback_slots = std::make_shared<FunctionTable>(); for (size_t i = 0; i < MAX_CALLBACKS; i++) { uintptr_t reservedVal = lucet_get_reserved_callback_slot_val(sandbox, i + 1); bool found = false; for (size_t j = 0; j < functionPointerTable.length; j++) { if (functionPointerTable.data[j].rf == reservedVal) { functionPointerTable.data[j].rf = 0; callback_slots->elements[i] = &(functionPointerTable.data[j]); callback_slots->slot_number[i] = static_cast<uint32_t>(j); found = true; break; } } detail::dynamic_check(found, "Unable to intialize callback tables"); } return callback_slots; } inline void reinit_callback_ref_data( LucetFunctionTable& functionPointerTable, std::shared_ptr<FunctionTable>& callback_slots) { for (size_t i = 0; i < MAX_CALLBACKS; i++) { uintptr_t reservedVal = lucet_get_reserved_callback_slot_val(sandbox, i + 1); for (size_t j = 0; j < functionPointerTable.length; j++) { if (functionPointerTable.data[j].rf == reservedVal) { functionPointerTable.data[j].rf = 0; detail::dynamic_check( callback_slots->elements[i] == &(functionPointerTable.data[j]) && callback_slots->slot_number[i] == static_cast<uint32_t>(j), "Sandbox creation error: Error when checking the values of " "callback slot data"); break; } } } } inline void set_callbacks_slots_ref(bool external_loads_exist) { LucetFunctionTable functionPointerTable = lucet_get_function_pointer_table(sandbox); void* key = functionPointerTable.data; std::lock_guard<std::mutex> lock(callback_table_mutex); std::weak_ptr<FunctionTable> slots = shared_callback_slots[key]; if (auto shared_slots = slots.lock()) { // pointer exists callback_slots = shared_slots; // Sometimes, dlopen and process forking seem to act a little weird. // Writes to the writable page of the dynamic lib section seem to not // always be propogated (possibly when the dynamic library is opened // externally - "external_loads_exist")). This occurred in when RLBox was // used in ASAN builds of Firefox. In general, we take the precaustion of // rechecking this on each sandbix creation. reinit_callback_ref_data(functionPointerTable, callback_slots); return; } callback_slots = get_callback_ref_data(functionPointerTable); shared_callback_slots[key] = callback_slots; if (external_loads_exist) { saved_callback_slot_info.push_back(callback_slots); } } template<uint32_t N, typename T_Ret, typename... T_Args> static typename lucet_detail::convert_type_to_wasm_type<T_Ret>::type callback_interceptor( void* /* vmContext */, typename lucet_detail::convert_type_to_wasm_type<T_Args>::type... params) { #ifdef RLBOX_EMBEDDER_PROVIDES_TLS_STATIC_VARIABLES auto& thread_data = *get_rlbox_lucet_sandbox_thread_data(); #endif thread_data.last_callback_invoked = N; using T_Func = T_Ret (*)(T_Args...); T_Func func; { RLBOX_ACQUIRE_SHARED_GUARD(lock, thread_data.sandbox->callback_mutex); func = reinterpret_cast<T_Func>(thread_data.sandbox->callbacks[N]); } // Callbacks are invoked through function pointers, cannot use std::forward // as we don't have caller context for T_Args, which means they are all // effectively passed by value return func(thread_data.sandbox->serialize_to_sandbox<T_Args>(params)...); } template<uint32_t N, typename T_Ret, typename... T_Args> static void callback_interceptor_promoted( void* /* vmContext */, typename lucet_detail::convert_type_to_wasm_type<T_Ret>::type ret, typename lucet_detail::convert_type_to_wasm_type<T_Args>::type... params) { #ifdef RLBOX_EMBEDDER_PROVIDES_TLS_STATIC_VARIABLES auto& thread_data = *get_rlbox_lucet_sandbox_thread_data(); #endif thread_data.last_callback_invoked = N; using T_Func = T_Ret (*)(T_Args...); T_Func func; { RLBOX_ACQUIRE_SHARED_GUARD(lock, thread_data.sandbox->callback_mutex); func = reinterpret_cast<T_Func>(thread_data.sandbox->callbacks[N]); } // Callbacks are invoked through function pointers, cannot use std::forward // as we don't have caller context for T_Args, which means they are all // effectively passed by value auto ret_val = func(thread_data.sandbox->serialize_to_sandbox<T_Args>(params)...); // Copy the return value back auto ret_ptr = reinterpret_cast<T_Ret*>( thread_data.sandbox->template impl_get_unsandboxed_pointer<T_Ret*>(ret)); *ret_ptr = ret_val; } template<typename T_Ret, typename... T_Args> inline T_PointerType get_lucet_type_index( T_Ret (*/* dummy for template inference */)(T_Args...) = nullptr) const { // Class return types as promoted to args constexpr bool promoted = std::is_class_v<T_Ret>; int32_t type_index; if constexpr (promoted) { LucetValueType ret_type = LucetValueType::LucetValueType_Void; LucetValueType param_types[] = { lucet_detail::convert_type_to_wasm_type<T_Ret>::lucet_type, lucet_detail::convert_type_to_wasm_type<T_Args>::lucet_type... }; LucetFunctionSignature signature{ ret_type, sizeof(param_types) / sizeof(LucetValueType), &(param_types[0]) }; type_index = lucet_get_function_type_index(sandbox, signature); } else { LucetValueType ret_type = lucet_detail::convert_type_to_wasm_type<T_Ret>::lucet_type; LucetValueType param_types[] = { lucet_detail::convert_type_to_wasm_type<T_Args>::lucet_type... }; LucetFunctionSignature signature{ ret_type, sizeof(param_types) / sizeof(LucetValueType), &(param_types[0]) }; type_index = lucet_get_function_type_index(sandbox, signature); } return type_index; } void ensure_return_slot_size(size_t size) { if (size > return_slot_size) { if (return_slot_size) { impl_free_in_sandbox(return_slot); } return_slot = impl_malloc_in_sandbox(size); detail::dynamic_check( return_slot != 0, "Error initializing return slot. Sandbox may be out of memory!"); return_slot_size = size; } } protected: // Set external_loads_exist to true, if the host application loads the // library lucet_module_path outside of rlbox_lucet_sandbox such as via dlopen // or the Windows equivalent inline void impl_create_sandbox(const char* lucet_module_path, bool external_loads_exist) { detail::dynamic_check(sandbox == nullptr, "Sandbox already initialized"); sandbox = lucet_load_module(lucet_module_path); detail::dynamic_check(sandbox != nullptr, "Sandbox could not be created"); heap_base = reinterpret_cast<uintptr_t>(impl_get_memory_location()); // Check that the address space is larger than the sandbox heap i.e. 4GB // sandbox heap, host has to have more than 4GB static_assert(sizeof(uintptr_t) > sizeof(T_PointerType)); // Check that the heap is aligned to the pointer size i.e. 32-bit pointer => // aligned to 4GB. The implementations of // impl_get_unsandboxed_pointer_no_ctx and impl_get_sandboxed_pointer_no_ctx // below rely on this. uintptr_t heap_offset_mask = std::numeric_limits<T_PointerType>::max(); detail::dynamic_check((heap_base & heap_offset_mask) == 0, "Sandbox heap not aligned to 4GB"); // cache these for performance malloc_index = impl_lookup_symbol("malloc"); free_index = impl_lookup_symbol("free"); set_callbacks_slots_ref(external_loads_exist); } inline void impl_create_sandbox(const char* lucet_module_path) { // Default is to assume that no external code will load the wasm library as // this is usually the case const bool external_loads_exist = false; impl_create_sandbox(lucet_module_path, external_loads_exist); } inline void impl_destroy_sandbox() { lucet_drop_module(sandbox); } template<typename T> inline void* impl_get_unsandboxed_pointer(T_PointerType p) const { if constexpr (std::is_function_v<std::remove_pointer_t<T>>) { LucetFunctionTable functionPointerTable = lucet_get_function_pointer_table(sandbox); if (p >= functionPointerTable.length) { // Received out of range function pointer return nullptr; } auto ret = functionPointerTable.data[p].rf; return reinterpret_cast<void*>(static_cast<uintptr_t>(ret)); } else { return reinterpret_cast<void*>(heap_base + p); } } template<typename T> inline T_PointerType impl_get_sandboxed_pointer(const void* p) const { if constexpr (std::is_function_v<std::remove_pointer_t<T>>) { // p is a pointer to a function internal to the lucet module // we need to either // 1) find the indirect function slot this is registered and return the // slot number. For this we need to scan the full indirect function table, // not just the portion we have reserved for callbacks. // 2) in the scenario this function has not ever been listed as an // indirect function, we need to register this like a normal callback. // However, unlike callbacks, we will not require the user to unregister // this. Instead, this permenantly takes up a callback slot. LucetFunctionTable functionPointerTable = lucet_get_function_pointer_table(sandbox); std::lock_guard<std::mutex> lock(callback_table_mutex); // Scenario 1 described above ssize_t empty_slot = -1; for (size_t i = 0; i < functionPointerTable.length; i++) { if (functionPointerTable.data[i].rf == reinterpret_cast<uintptr_t>(p)) { return static_cast<T_PointerType>(i); } else if (functionPointerTable.data[i].rf == 0 && empty_slot == -1) { // found an empty slot. Save it, as we may use it later. empty_slot = i; } } // Scenario 2 described above detail::dynamic_check( empty_slot != -1, "Could not find an empty slot in sandbox function table. This would " "happen if you have registered too many callbacks, or unsandboxed " "too many function pointers. You can file a bug if you want to " "increase the maximum allowed callbacks or unsadnboxed functions " "pointers"); T dummy = nullptr; int32_t type_index = get_lucet_type_index(dummy); functionPointerTable.data[empty_slot].ty = type_index; functionPointerTable.data[empty_slot].rf = reinterpret_cast<uintptr_t>(p); return empty_slot; } else { return static_cast<T_PointerType>(reinterpret_cast<uintptr_t>(p)); } } template<typename T> static inline void* impl_get_unsandboxed_pointer_no_ctx( T_PointerType p, const void* example_unsandboxed_ptr, rlbox_lucet_sandbox* (*expensive_sandbox_finder)( const void* example_unsandboxed_ptr)) { if constexpr (std::is_function_v<std::remove_pointer_t<T>>) { // swizzling function pointers needs access to the function pointer tables // and thus cannot be done without context auto sandbox = expensive_sandbox_finder(example_unsandboxed_ptr); return sandbox->impl_get_unsandboxed_pointer<T>(p); } else { // grab the memory base from the example_unsandboxed_ptr uintptr_t heap_base_mask = std::numeric_limits<uintptr_t>::max() & ~(static_cast<uintptr_t>(std::numeric_limits<T_PointerType>::max())); uintptr_t computed_heap_base = reinterpret_cast<uintptr_t>(example_unsandboxed_ptr) & heap_base_mask; uintptr_t ret = computed_heap_base | p; return reinterpret_cast<void*>(ret); } } template<typename T> static inline T_PointerType impl_get_sandboxed_pointer_no_ctx( const void* p, const void* example_unsandboxed_ptr, rlbox_lucet_sandbox* (*expensive_sandbox_finder)( const void* example_unsandboxed_ptr)) { if constexpr (std::is_function_v<std::remove_pointer_t<T>>) { // swizzling function pointers needs access to the function pointer tables // and thus cannot be done without context auto sandbox = expensive_sandbox_finder(example_unsandboxed_ptr); return sandbox->impl_get_sandboxed_pointer<T>(p); } else { // Just clear the memory base to leave the offset RLBOX_LUCET_UNUSED(example_unsandboxed_ptr); uintptr_t ret = reinterpret_cast<uintptr_t>(p) & std::numeric_limits<T_PointerType>::max(); return static_cast<T_PointerType>(ret); } } static inline bool impl_is_in_same_sandbox(const void* p1, const void* p2) { uintptr_t heap_base_mask = std::numeric_limits<uintptr_t>::max() & ~(std::numeric_limits<T_PointerType>::max()); return (reinterpret_cast<uintptr_t>(p1) & heap_base_mask) == (reinterpret_cast<uintptr_t>(p2) & heap_base_mask); } inline bool impl_is_pointer_in_sandbox_memory(const void* p) { size_t length = impl_get_total_memory(); uintptr_t p_val = reinterpret_cast<uintptr_t>(p); return p_val >= heap_base && p_val < (heap_base + length); } inline bool impl_is_pointer_in_app_memory(const void* p) { return !(impl_is_pointer_in_sandbox_memory(p)); } inline size_t impl_get_total_memory() { return lucet_get_heap_size(sandbox); } inline void* impl_get_memory_location() { return lucet_get_heap_base(sandbox); } void* impl_lookup_symbol(const char* func_name) { return lucet_lookup_function(sandbox, func_name); } template<typename T, typename T_Converted, typename... T_Args> auto impl_invoke_with_func_ptr(T_Converted* func_ptr, T_Args&&... params) { #ifdef RLBOX_EMBEDDER_PROVIDES_TLS_STATIC_VARIABLES auto& thread_data = *get_rlbox_lucet_sandbox_thread_data(); #endif thread_data.sandbox = this; lucet_set_curr_instance(sandbox); // WASM functions are mangled in the following manner // 1. All primitive types are left as is and follow an LP32 machine model // (as opposed to the possibly 64-bit application) // 2. All pointers are changed to u32 types // 3. Returned class are returned as an out parameter before the actual // function parameters // 4. All class parameters are passed as pointers (u32 types) // 5. The heap address is passed in as the first argument to the function // // RLBox accounts for the first 2 differences in T_Converted type, but we // need to handle the rest // Handle point 3 using T_Ret = lucet_detail::return_argument<T_Converted>; if constexpr (std::is_class_v<T_Ret>) { using T_Conv1 = lucet_detail::change_return_type<T_Converted, void>; using T_Conv2 = lucet_detail::prepend_arg_type<T_Conv1, T_PointerType>; auto func_ptr_conv = reinterpret_cast<T_Conv2*>(reinterpret_cast<uintptr_t>(func_ptr)); ensure_return_slot_size(sizeof(T_Ret)); impl_invoke_with_func_ptr<T>(func_ptr_conv, return_slot, params...); auto ptr = reinterpret_cast<T_Ret*>( impl_get_unsandboxed_pointer<T_Ret*>(return_slot)); T_Ret ret = *ptr; return ret; } // Handle point 4 constexpr size_t alloc_length = [&] { if constexpr (sizeof...(params) > 0) { return ((std::is_class_v<T_Args> ? 1 : 0) + ...); } else { return 0; } }(); // 0 arg functions create 0 length arrays which is not allowed T_PointerType allocations_buff[alloc_length == 0 ? 1 : alloc_length]; T_PointerType* allocations = allocations_buff; auto serialize_class_arg = [&](auto arg) -> std::conditional_t<std::is_class_v<decltype(arg)>, T_PointerType, decltype(arg)> { using T_Arg = decltype(arg); if constexpr (std::is_class_v<T_Arg>) { auto slot = impl_malloc_in_sandbox(sizeof(T_Arg)); auto ptr = reinterpret_cast<T_Arg*>(impl_get_unsandboxed_pointer<T_Arg*>(slot)); *ptr = arg; allocations[0] = arg; allocations++; return ptr; } else { return arg; } }; // 0 arg functions don't use serialize RLBOX_LUCET_UNUSED(serialize_class_arg); using T_ConvNoClass = lucet_detail::change_class_arg_types<T_Converted, T_PointerType>; // Handle Point 5 using T_ConvHeap = lucet_detail::prepend_arg_type<T_ConvNoClass, uint64_t>; // Function invocation auto func_ptr_conv = reinterpret_cast<T_ConvHeap*>(reinterpret_cast<uintptr_t>(func_ptr)); using T_NoVoidRet = std::conditional_t<std::is_void_v<T_Ret>, uint32_t, T_Ret>; T_NoVoidRet ret; if constexpr (std::is_void_v<T_Ret>) { RLBOX_LUCET_UNUSED(ret); func_ptr_conv(heap_base, serialize_class_arg(params)...); } else { ret = func_ptr_conv(heap_base, serialize_class_arg(params)...); } for (size_t i = 0; i < alloc_length; i++) { impl_free_in_sandbox(allocations_buff[i]); } if constexpr (!std::is_void_v<T_Ret>) { return ret; } } inline T_PointerType impl_malloc_in_sandbox(size_t size) { detail::dynamic_check(size <= std::numeric_limits<uint32_t>::max(), "Attempting to malloc more than the heap size"); using T_Func = void*(size_t); using T_Converted = T_PointerType(uint32_t); T_PointerType ret = impl_invoke_with_func_ptr<T_Func, T_Converted>( reinterpret_cast<T_Converted*>(malloc_index), static_cast<uint32_t>(size)); return ret; } inline void impl_free_in_sandbox(T_PointerType p) { using T_Func = void(void*); using T_Converted = void(T_PointerType); impl_invoke_with_func_ptr<T_Func, T_Converted>( reinterpret_cast<T_Converted*>(free_index), p); } template<typename T_Ret, typename... T_Args> inline T_PointerType impl_register_callback(void* key, void* callback) { int32_t type_index = get_lucet_type_index<T_Ret, T_Args...>(); detail::dynamic_check( type_index != -1, "Could not find lucet type for callback signature. This can " "happen if you tried to register a callback whose signature " "does not correspond to any callbacks used in the library."); bool found = false; uint32_t found_loc = 0; uint32_t slot_number = 0; { std::lock_guard<std::mutex> lock(callback_table_mutex); // need a compile time for loop as we we need I to be a compile time value // this is because we are setting the I'th callback ineterceptor lucet_detail::compile_time_for<MAX_CALLBACKS>([&](auto I) { constexpr auto i = I.value; if (!found && callback_slots->elements[i]->rf == 0) { found = true; found_loc = i; slot_number = callback_slots->slot_number[i]; void* chosen_interceptor; if constexpr (std::is_class_v<T_Ret>) { chosen_interceptor = reinterpret_cast<void*>( callback_interceptor_promoted<i, T_Ret, T_Args...>); } else { chosen_interceptor = reinterpret_cast<void*>( callback_interceptor<i, T_Ret, T_Args...>); } callback_slots->elements[i]->ty = type_index; callback_slots->elements[i]->rf = reinterpret_cast<uintptr_t>(chosen_interceptor); } }); } detail::dynamic_check( found, "Could not find an empty slot in sandbox function table. This would " "happen if you have registered too many callbacks, or unsandboxed " "too many function pointers. You can file a bug if you want to " "increase the maximum allowed callbacks or unsadnboxed functions " "pointers"); { RLBOX_ACQUIRE_UNIQUE_GUARD(lock, callback_mutex); callback_unique_keys[found_loc] = key; callbacks[found_loc] = callback; callback_slot_assignment[found_loc] = slot_number; } return static_cast<T_PointerType>(slot_number); } static inline std::pair<rlbox_lucet_sandbox*, void*> impl_get_executed_callback_sandbox_and_key() { #ifdef RLBOX_EMBEDDER_PROVIDES_TLS_STATIC_VARIABLES auto& thread_data = *get_rlbox_lucet_sandbox_thread_data(); #endif auto sandbox = thread_data.sandbox; auto callback_num = thread_data.last_callback_invoked; void* key = sandbox->callback_unique_keys[callback_num]; return std::make_pair(sandbox, key); } template<typename T_Ret, typename... T_Args> inline void impl_unregister_callback(void* key) { bool found = false; uint32_t i = 0; { RLBOX_ACQUIRE_UNIQUE_GUARD(lock, callback_mutex); for (; i < MAX_CALLBACKS; i++) { if (callback_unique_keys[i] == key) { callback_unique_keys[i] = nullptr; callbacks[i] = nullptr; callback_slot_assignment[i] = 0; found = true; break; } } } detail::dynamic_check( found, "Internal error: Could not find callback to unregister"); std::lock_guard<std::mutex> shared_lock(callback_table_mutex); callback_slots->elements[i]->rf = 0; return; } }; } // namespace rlbox
[ "shravanrn@gmail.com" ]
shravanrn@gmail.com
3c82847c8d603cf64a9bd190b7b5946df5f85e55
f9b82549bc83a4987ca1cccfd63b44b517cac9b1
/tags/2.6.3/include/pqxx/transactor.hxx
ff6d990499460f08f56cc8b84072e1a619f454fd
[ "BSD-3-Clause" ]
permissive
svn2github/pqxx
fb98b0ed304c8df924811537f1348667d6a17f1f
8d6e296372618d6ffcc750cbd5ee417ab282f456
refs/heads/master
2020-12-25T17:25:32.765973
2016-08-19T16:16:30
2016-08-19T16:16:30
40,840,938
1
1
null
null
null
null
UTF-8
C++
false
false
8,048
hxx
/*------------------------------------------------------------------------- * * FILE * pqxx/transactor.hxx * * DESCRIPTION * definition of the pqxx::transactor class. * pqxx::transactor is a framework-style wrapper for safe transactions * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/transactor instead. * * Copyright (c) 2001-2005, Jeroen T. Vermeulen <jtv@xs4all.nl> * * See COPYING for copyright license. If you did not receive a file called * COPYING with this source code, please notify the distributor of this mistake, * or contact the author. * *------------------------------------------------------------------------- */ #include "pqxx/compiler-public.hxx" #include "pqxx/connection_base" #include "pqxx/transaction" /* Methods tested in eg. self-test program test001 are marked with "//[t1]" */ /// Support deprecated OnCommit(), OnAbort(), OnDoubt() for the time being #define PQXX_DEPRECATED_TRANSACTION_CALLBACKS namespace pqxx { /// Wrapper for transactions that automatically restarts them on failure /** * @addtogroup transactor Transactor framework * * Some transactions may be replayed if their connection fails, until they do * succeed. These can be encapsulated in a transactor-derived classes. The * transactor framework will take care of setting up a backend transaction * context for the operation, and of aborting and retrying if its connection * goes bad. * * The transactor framework also makes it easier for you to do this safely, * avoiding typical pitfalls and encouraging programmers to separate their * transaction definitions (essentially, business rules implementations) from * their higher-level code (application using those business rules). The * former go into the transactor-based class. * * Pass an object of your transactor-based class to connection_base::perform() * to execute the transaction code embedded in it (see the definitions in * pqxx/connection_base.hxx). * * connection_base::Perform() is actually a template, specializing itself to any * transactor type you pass to it. This means you will have to pass it a * reference of your object's ultimate static type; runtime polymorphism is * not allowed. Hence the absence of virtual methods in transactor. The * exact methods to be called at runtime *must* be resolved at compile time. * * Your transactor-derived class must define a copy constructor. This will be * used to create a "clean" copy of your transactor for every attempt that * Perform() makes to run it. */ template<typename TRANSACTION=transaction<read_committed> > class transactor : public PGSTD::unary_function<TRANSACTION, void> { public: explicit transactor(const PGSTD::string &TName="transactor") : //[t4] m_Name(TName) { } /// Overridable transaction definition; insert your database code here /** The operation will be retried if the connection to the backend is lost or * the operation fails, but not if the connection is broken in such a way as * to leave the library in doubt as to whether the operation succeeded. In * that case, an in_doubt_error will be thrown. * * Recommended practice is to allow this operator to modify only the * transactor itself, and the dedicated transaction object it is passed as an * argument. This is what makes side effects, retrying etc. controllable in * the transactor framework. * @param T Dedicated transaction context created to perform this operation. */ void operator()(TRANSACTION &T); //[t4] // Overridable member functions, called by connection_base::perform() if an // attempt to run transaction fails/succeeds, respectively, or if the // connection is lost at just the wrong moment, goes into an indeterminate // state. Use these to patch up runtime state to match events, if needed, or // to report failure conditions. /// Optional overridable function to be called if transaction is aborted /** This need not imply complete failure; the transactor will automatically * retry the operation a number of times before giving up. on_abort() will be * called for each of the failed attempts. * * One parameter is passed in by the framework: an error string describing why * the transaction failed. This will also be logged to the connection's * notice processor. */ void on_abort(const char[]) throw () {} //[t13] /// Optional overridable function to be called after successful commit /** If your on_commit() throws an exception, the actual back-end transaction * will remain committed, so any changes in the database remain regardless of * how this function terminates. */ void on_commit() {} //[t6] /// Overridable function to be called when "in doubt" about outcome /** This may happen if the connection to the backend is lost while attempting * to commit. In that case, the backend may have committed the transaction * but is unable to confirm this to the frontend; or the transaction may have * failed, causing it to be rolled back, but again without acknowledgement to * the client program. The best way to deal with this situation is typically * to wave red flags in the user's face and ask him to investigate. * * The robusttransaction class is intended to reduce the chances of this * error occurring, at a certain cost in performance. * @see robusttransaction */ void on_doubt() throw () {} //[t13] #ifdef PQXX_DEPRECATED_TRANSACTION_CALLBACKS /** * @name 1.x API */ //@{ /// @deprecated Define on_commit instead. /** @see on_commit */ void OnCommit() {} /// @deprecated Define on_abort instead. /** @see on_abort */ void OnAbort(const char[]) throw () {} /// @deprecated Define on_doubt instead. /** @see on_doubt */ void OnDoubt() throw () {} //@} #endif // TODO: Rename Name()--is there a compatible way? /// The transactor's name. PGSTD::string Name() const { return m_Name; } //[t13] private: PGSTD::string m_Name; }; } /** Invoke a transactor, making at most Attempts attempts to perform the * encapsulated code on the database. If the code throws any exception other * than broken_connection, it will be aborted right away. * * Take care: no member functions will be invoked on the original transactor you * pass into the function. It only serves as a prototype for the transaction to * be performed. The perform() function will copy-construct transactors from * the original you passed in, executing the copies only and retaining a "clean" * original. */ template<typename TRANSACTOR> inline void pqxx::connection_base::perform(const TRANSACTOR &T, int Attempts) { if (Attempts <= 0) return; bool Done = false; // Make attempts to perform T // TODO: Differentiate between db-related exceptions and other exceptions? do { --Attempts; // Work on a copy of T2 so we can restore the starting situation if need be TRANSACTOR T2(T); try { typename TRANSACTOR::argument_type X(*this, T2.Name()); T2(X); X.commit(); Done = true; } catch (const in_doubt_error &) { // Not sure whether transaction went through or not. The last thing in // the world that we should do now is retry. #ifdef PQXX_DEPRECATED_TRANSACTION_CALLBACKS T2.OnDoubt(); #endif T2.on_doubt(); throw; } catch (const PGSTD::exception &e) { // Could be any kind of error. #ifdef PQXX_DEPRECATED_TRANSACTION_CALLBACKS T2.OnAbort(e.what()); #endif T2.on_abort(e.what()); if (Attempts <= 0) throw; continue; } catch (...) { // Don't try to forge ahead if we don't even know what happened #ifdef PQXX_DEPRECATED_TRANSACTION_CALLBACKS T2.OnAbort("Unknown exception"); #endif T2.on_abort("Unknown exception"); throw; } #ifdef PQXX_DEPRECATED_TRANSACTION_CALLBACKS T2.OnCommit(); #endif T2.on_commit(); } while (!Done); }
[ "jtv@c3353b84-d008-0410-9ed9-b55c4f7fa7e8" ]
jtv@c3353b84-d008-0410-9ed9-b55c4f7fa7e8
4447fcd552ea85e0e7eabb91af107538d21d2daf
1c9d04a9352e6d86480f9e0947f930db042d8e80
/src/libs/utils/math/interpolation/interpolator.cpp
6617739fed03204b05004a7728a5e992e8c2dad8
[]
no_license
fawkesrobotics/fawkes
2c9de0cdb1dfcc951806434fe08458de5a670c8a
ad8adc34f9c73ace1e6a6517624f7c7089f62832
refs/heads/master
2023-08-31T01:36:15.690865
2023-07-04T17:05:55
2023-07-04T17:05:55
1,030,824
62
26
null
2023-07-04T17:05:57
2010-10-28T04:22:55
C++
UTF-8
C++
false
false
2,065
cpp
/*************************************************************************** * interpolator.cpp - Interpolator * * Created: Tue Nov 18 10:45:18 2008 * Copyright 2008 Tim Niemueller [www.niemueller.de] * ****************************************************************************/ /* This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. A runtime exception applies to * this software (see LICENSE.GPL_WRE file mentioned below for details). * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * Read the full text in the LICENSE.GPL_WRE file in the doc directory. */ #include <utils/math/interpolation/interpolator.h> namespace fawkes { /** @class Interpolator <utils/math/interpolation/interpolator.h> * Value interpolator. * The interpolator creates intermediate points given a starting and and * end point and time constraints. Times are supplied any chose time scale, it * only has to be a linear time measure. Common are miliseconds or seconds. * @author Tim Niemueller * * @fn float Interpolator::interpolate(float t_current, float t_end, float t_step, float v_start, float v_end) * Interpolate a point at a specific time. * @param t_current current time for which to calculate the intermediate point * @param t_end end time/total time. The start time is always 0. * @param t_step Time of a time slice for discrete intermediate interpolation * points. Set to 1 for maximum resolution. * @param v_start start value * @param v_end end value * @return interpolated value at time t_current between t_start and t_end. */ /** Virtual empty descructor. */ Interpolator::~Interpolator() { } } // end namespace fawkes
[ "niemueller@kbsg.rwth-aachen.de" ]
niemueller@kbsg.rwth-aachen.de
300a12e98b9d1a10e413dca04a47d6c04b2baaea
9d7a8d3e8d5df680c32fa70c73ef7c2820986187
/.history/D07/ex02/Array1_20210317193922.hpp
39e9c382d006fec175df0a74dfa9ffe9fa550377
[]
no_license
asleonova/cpp
dc2d606e361ffdfa2013953f68bd0da4530f34bc
adfaecc238cdb63053b34b106869d3185204d73a
refs/heads/master
2023-04-06T19:27:21.725162
2021-04-13T19:18:00
2021-04-13T19:18:00
337,834,070
0
0
null
null
null
null
UTF-8
C++
false
false
2,962
hpp
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* Array1.hpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: dbliss <dbliss@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/03/16 20:24:27 by dbliss #+# #+# */ /* Updated: 2021/03/17 19:39:22 by dbliss ### ########.fr */ /* */ /* ************************************************************************** */ #include <iostream> template <typename T> class Array { public: Array(); Array(unsigned int n); ~Array(void); Array(Array const &src); Array &operator=(Array const &rhs); unsigned int const size(void) const; T *getArr(void) const; T const &operator[](unsigned int index) const private : unsigned int _n; T *_arr; class ElementOutOfLimits : public std::exception { virtual const char *what() const throw() { return ("Element is out of limits"); } }; }; /* Constructors*/ template <typename T> Array<T>::Array() : _n(0), _arr(NULL) {} template <typename T> Array<T>::Array(unsigned int n) : _n(n) { this->_arr = new T[_n]; for (int i = 0; i < this->_n; i++) this->_arr[i] = i; } /* Destructor*/ template <typename T> Array<T>::~Array(void) { if (this->_arr != NULL) delete[] this->_arr; } /* Copy constructor*/ template <typename T> Array<T>::Array(Array const &src) { this->_arr = new T[src._n]; this->_n = src._n; for (int i = 0; i < this->_n; i++) this->_arr[i] = src._arr[i]; } /*Member functions*/ template <typename T> unsigned int const Array<T>::size(void) const { return this->_n; } template <typename T> T* Array<T>::getArr(void) const { return this->_arr; } /*Assignment operator*/ template <typename T> Array<T> & Array<T>::operator=(Array const &rhs) { if (*this != rhs) { delete[] this->_arr; this->_arr = new T[rhs._n]; this->_n = rhs._n; for (int i = 0; i < this->_n; i++) this->_arr[i] = rhs._arr[i]; } return (*this); } template <typename T> const T & Array<T>::operator[](unsigned int index) const { if (this->_n == 0 || index >= this->_n) throw ElementOutOfLimits(); return (this->_arr[index]); } template <typename T> std::ostream &operator<<(std::ostream &o, Array<T> const &p) { o << "Array ( " << p.size() << ", "; for (int i = 0; i < p.size(); i++) o << p.getArr()[i]; o << " )"; return o; }
[ "dbliss@oa-f5.msk.21-school.ru" ]
dbliss@oa-f5.msk.21-school.ru
39723f51238ee1ec56aedf527aca21b37741a3e2
3670f2ca6f5609e14cce8c31cb1348052d0b6358
/perception_pcl/pcl_ros/include/pcl_ros/features/feature.h
26bcfe6b0d3d3b44b6c48fe89eef3aa8f7ef042d
[]
no_license
jincheng-ai/ros-melodic-python3-opencv4
b0f4d3860ab7ae3d683ade8aa03e74341eff7fcf
47c74188560c2274b8304647722d0c9763299a4b
refs/heads/main
2023-05-28T17:37:34.345164
2021-06-17T09:59:25
2021-06-17T09:59:25
377,856,153
5
0
null
null
null
null
UTF-8
C++
false
false
10,846
h
/* * Software License Agreement (BSD License) * * Copyright (c) 2009, Willow Garage, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * Neither the name of Willow Garage, Inc. nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * $Id: feature.h 35422 2011-01-24 20:04:44Z rusu $ * */ #ifndef PCL_ROS_FEATURE_H_ #define PCL_ROS_FEATURE_H_ // PCL includes #include <pcl/features/feature.h> #include "pcl_ros/pcl_nodelet.h" #include <message_filters/pass_through.h> // Dynamic reconfigure #include <dynamic_reconfigure/server.h> #include "pcl_ros/FeatureConfig.h" // PCL conversions #include <pcl_conversions/pcl_conversions.h> namespace pcl_ros { namespace sync_policies = message_filters::sync_policies; /////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /** \brief @b Feature represents the base feature class. Some generic 3D operations that * are applicable to all features are defined here as static methods. * \author Radu Bogdan Rusu */ class Feature : public PCLNodelet { public: typedef pcl::KdTree<pcl::PointXYZ> KdTree; typedef pcl::KdTree<pcl::PointXYZ>::Ptr KdTreePtr; typedef pcl::PointCloud<pcl::PointXYZ> PointCloudIn; typedef PointCloudIn::Ptr PointCloudInPtr; typedef PointCloudIn::ConstPtr PointCloudInConstPtr; typedef boost::shared_ptr <std::vector<int> > IndicesPtr; typedef boost::shared_ptr <const std::vector<int> > IndicesConstPtr; /** \brief Empty constructor. */ Feature () : /*input_(), indices_(), surface_(), */tree_(), k_(0), search_radius_(0), use_surface_(false), spatial_locator_type_(-1) {}; protected: /** \brief The input point cloud dataset. */ //PointCloudInConstPtr input_; /** \brief A pointer to the vector of point indices to use. */ //IndicesConstPtr indices_; /** \brief An input point cloud describing the surface that is to be used for nearest neighbors estimation. */ //PointCloudInConstPtr surface_; /** \brief A pointer to the spatial search object. */ KdTreePtr tree_; /** \brief The number of K nearest neighbors to use for each point. */ int k_; /** \brief The nearest neighbors search radius for each point. */ double search_radius_; // ROS nodelet attributes /** \brief The surface PointCloud subscriber filter. */ message_filters::Subscriber<PointCloudIn> sub_surface_filter_; /** \brief The input PointCloud subscriber. */ ros::Subscriber sub_input_; /** \brief Set to true if the nodelet needs to listen for incoming point clouds representing the search surface. */ bool use_surface_; /** \brief Parameter for the spatial locator tree. By convention, the values represent: * 0: ANN (Approximate Nearest Neigbor library) kd-tree * 1: FLANN (Fast Library for Approximate Nearest Neighbors) kd-tree * 2: Organized spatial dataset index */ int spatial_locator_type_; /** \brief Pointer to a dynamic reconfigure service. */ boost::shared_ptr <dynamic_reconfigure::Server<FeatureConfig> > srv_; /** \brief Child initialization routine. Internal method. */ virtual bool childInit (ros::NodeHandle &nh) = 0; /** \brief Publish an empty point cloud of the feature output type. */ virtual void emptyPublish (const PointCloudInConstPtr &cloud) = 0; /** \brief Compute the feature and publish it. Internal method. */ virtual void computePublish (const PointCloudInConstPtr &cloud, const PointCloudInConstPtr &surface, const IndicesPtr &indices) = 0; /** \brief Dynamic reconfigure callback * \param config the config object * \param level the dynamic reconfigure level */ void config_callback (FeatureConfig &config, uint32_t level); /** \brief Null passthrough filter, used for pushing empty elements in the * synchronizer */ message_filters::PassThrough<PointIndices> nf_pi_; message_filters::PassThrough<PointCloudIn> nf_pc_; /** \brief Input point cloud callback. * Because we want to use the same synchronizer object, we push back * empty elements with the same timestamp. */ inline void input_callback (const PointCloudInConstPtr &input) { PointIndices indices; indices.header.stamp = pcl_conversions::fromPCL(input->header).stamp; PointCloudIn cloud; cloud.header.stamp = input->header.stamp; nf_pc_.add (cloud.makeShared ()); nf_pi_.add (boost::make_shared<PointIndices> (indices)); } private: /** \brief Synchronized input, surface, and point indices.*/ boost::shared_ptr <message_filters::Synchronizer<sync_policies::ApproximateTime<PointCloudIn, PointCloudIn, PointIndices> > > sync_input_surface_indices_a_; boost::shared_ptr <message_filters::Synchronizer<sync_policies::ExactTime<PointCloudIn, PointCloudIn, PointIndices> > > sync_input_surface_indices_e_; /** \brief Nodelet initialization routine. */ virtual void onInit (); /** \brief NodeletLazy connection routine. */ virtual void subscribe (); virtual void unsubscribe (); /** \brief Input point cloud callback. Used when \a use_indices and \a use_surface are set. * \param cloud the pointer to the input point cloud * \param cloud_surface the pointer to the surface point cloud * \param indices the pointer to the input point cloud indices */ void input_surface_indices_callback (const PointCloudInConstPtr &cloud, const PointCloudInConstPtr &cloud_surface, const PointIndicesConstPtr &indices); public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW }; ////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// class FeatureFromNormals : public Feature { public: typedef sensor_msgs::PointCloud2 PointCloud2; typedef pcl::PointCloud<pcl::Normal> PointCloudN; typedef PointCloudN::Ptr PointCloudNPtr; typedef PointCloudN::ConstPtr PointCloudNConstPtr; FeatureFromNormals () : normals_() {}; protected: /** \brief A pointer to the input dataset that contains the point normals of the XYZ dataset. */ PointCloudNConstPtr normals_; /** \brief Child initialization routine. Internal method. */ virtual bool childInit (ros::NodeHandle &nh) = 0; /** \brief Publish an empty point cloud of the feature output type. */ virtual void emptyPublish (const PointCloudInConstPtr &cloud) = 0; /** \brief Compute the feature and publish it. */ virtual void computePublish (const PointCloudInConstPtr &cloud, const PointCloudNConstPtr &normals, const PointCloudInConstPtr &surface, const IndicesPtr &indices) = 0; private: /** \brief The normals PointCloud subscriber filter. */ message_filters::Subscriber<PointCloudN> sub_normals_filter_; /** \brief Synchronized input, normals, surface, and point indices.*/ boost::shared_ptr<message_filters::Synchronizer<sync_policies::ApproximateTime<PointCloudIn, PointCloudN, PointCloudIn, PointIndices> > > sync_input_normals_surface_indices_a_; boost::shared_ptr<message_filters::Synchronizer<sync_policies::ExactTime<PointCloudIn, PointCloudN, PointCloudIn, PointIndices> > > sync_input_normals_surface_indices_e_; /** \brief Internal method. */ void computePublish (const PointCloudInConstPtr &, const PointCloudInConstPtr &, const IndicesPtr &) {} // This should never be called /** \brief Nodelet initialization routine. */ virtual void onInit (); /** \brief NodeletLazy connection routine. */ virtual void subscribe (); virtual void unsubscribe (); /** \brief Input point cloud callback. Used when \a use_indices and \a use_surface are set. * \param cloud the pointer to the input point cloud * \param cloud_normals the pointer to the input point cloud normals * \param cloud_surface the pointer to the surface point cloud * \param indices the pointer to the input point cloud indices */ void input_normals_surface_indices_callback (const PointCloudInConstPtr &cloud, const PointCloudNConstPtr &cloud_normals, const PointCloudInConstPtr &cloud_surface, const PointIndicesConstPtr &indices); public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW }; } #endif //#ifndef PCL_ROS_FEATURE_H_
[ "shuyuanhao@cetiti.com" ]
shuyuanhao@cetiti.com
ae6f5dab0e2c99f1e4acd3ecc16eea529d222f62
98cd78aad82b56adfe9e9658ffe299e9e8598b5b
/src/scenes/forms/FormCallback.hpp
61867c5392ad3a0ee9c4960479c142aaec2f7c44
[]
no_license
paul-maxime/bombercraft
6e6ac6bcd31f4f05db1593aa9a7a5b297e24194f
fb7bf2aaf57423a251607556e52a9d0ec7355a8c
refs/heads/master
2020-09-28T02:11:21.790785
2016-10-27T09:28:40
2016-10-27T09:28:40
67,894,054
2
0
null
null
null
null
UTF-8
C++
false
false
524
hpp
/** * \file FormCallback.hpp * Contains the templated-class FormCallback. */ #ifndef FORM_CALLBACK_HPP_ #define FORM_CALLBACK_HPP_ #include "AFormCallback.hpp" template <class T> class FormCallback : public AFormCallback { private: typedef void (T::*t_handler)(); T* m_instance; t_handler m_fct; public: FormCallback(T* instance, t_handler fct) : m_instance(instance), m_fct(fct) { } virtual ~FormCallback() {} virtual void operator()() { (m_instance->*m_fct)(); } }; #endif
[ "paulmaxime@openmailbox.org" ]
paulmaxime@openmailbox.org
46495ecb09c66fc1460b57cea69e08fc07c55981
521b1719c9d3da52dfb63635b638771075a095a6
/Ex8_FlappyBird/project/Box2DTestbed/Tests/Prismatic.h
bb0c714957583e42d29a7d0711996f322d690bf7
[ "MIT" ]
permissive
fdfragoso/GameEngines
836ea2787c9b90b3bb6e0593a0feda4ce44ab3a5
c1dfcb03e009b0aca9803a9de5806e003aaf364e
refs/heads/master
2020-07-16T20:29:40.503249
2019-09-02T14:00:28
2019-09-02T14:00:28
205,862,573
3
0
null
null
null
null
UTF-8
C++
false
false
2,804
h
/* * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org * * 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. */ #ifndef PRISMATIC_H #define PRISMATIC_H // The motor in this test gets smoother with higher velocity iterations. class Prismatic : public Test { public: Prismatic() { b2Body* ground = NULL; { b2BodyDef bd; ground = m_world->CreateBody(&bd); b2EdgeShape shape; shape.Set(b2Vec2(-40.0f, 0.0f), b2Vec2(40.0f, 0.0f)); ground->CreateFixture(&shape, 0.0f); } { b2PolygonShape shape; shape.SetAsBox(2.0f, 0.5f); b2BodyDef bd; bd.type = b2_dynamicBody; bd.position.Set(-10.0f, 10.0f); bd.angle = 0.5f * b2_pi; bd.allowSleep = false; b2Body* body = m_world->CreateBody(&bd); body->CreateFixture(&shape, 5.0f); b2PrismaticJointDef pjd; // Bouncy limit b2Vec2 axis(2.0f, 1.0f); axis.Normalize(); pjd.Initialize(ground, body, b2Vec2(0.0f, 0.0f), axis); // Non-bouncy limit //pjd.Initialize(ground, body, b2Vec2(-10.0f, 10.0f), b2Vec2(1.0f, 0.0f)); pjd.motorSpeed = 10.0f; pjd.maxMotorForce = 10000.0f; pjd.enableMotor = true; pjd.lowerTranslation = 0.0f; pjd.upperTranslation = 20.0f; pjd.enableLimit = true; m_joint = (b2PrismaticJoint*)m_world->CreateJoint(&pjd); } } void Keyboard(int key) { switch (key) { case SDLK_l: m_joint->EnableLimit(!m_joint->IsLimitEnabled()); break; case SDLK_m: m_joint->EnableMotor(!m_joint->IsMotorEnabled()); break; case SDLK_s: m_joint->SetMotorSpeed(-m_joint->GetMotorSpeed()); break; } } void Step(Settings* settings) { Test::Step(settings); g_debugDraw.DrawString(5, m_textLine, "Keys: (l) limits, (m) motors, (s) speed"); m_textLine += DRAW_STRING_NEW_LINE; float32 force = m_joint->GetMotorForce(settings->hz); g_debugDraw.DrawString(5, m_textLine, "Motor Force = %4.0f", (float) force); m_textLine += DRAW_STRING_NEW_LINE; } static Test* Create() { return new Prismatic; } b2PrismaticJoint* m_joint; }; #endif
[ "fefragoso@gmail.com" ]
fefragoso@gmail.com
122ee988e9ba9e7f0d29130d812526a2712c981b
9748c7ae9cf9c3f7e85c8eb98fe367d2c438f672
/AeSys/EoDbEllipse.cpp
91ed02b5ad62942b9cf6245deafe32e407370054
[ "MIT" ]
permissive
15831944/Eo
8e61bf009d499e08ed5f65af1a107b8d4f76b3c0
5652b68468c0bacd8e8da732befa2374360a4bbd
refs/heads/master
2022-01-24T22:54:01.518644
2019-08-14T19:46:06
2019-08-14T19:46:06
null
0
0
null
null
null
null
UTF-8
C++
false
false
38,054
cpp
#include "stdafx.h" #include <DbEllipse.h> #include <Ge/GeCircArc3d.h> #include "AeSys.h" #include "AeSysDoc.h" #include "AeSysView.h" #include "PrimState.h" #include "EoVaxFloat.h" #include "EoGePolyline.h" #include "EoDbFile.h" IMPLEMENT_DYNAMIC(EoDbEllipse, EoDbPrimitive) EoDbEllipse::EoDbEllipse(const OdGePoint3d& center, const OdGeVector3d& majorAxis, const OdGeVector3d& minorAxis, const double sweepAngle) noexcept : m_Center(center) , m_MajorAxis(majorAxis) , m_MinorAxis(minorAxis) , m_SweepAngle(sweepAngle) { m_ColorIndex = g_PrimitiveState.ColorIndex(); m_LinetypeIndex = g_PrimitiveState.LinetypeIndex(); } EoDbEllipse::EoDbEllipse(const OdGePoint3d& center, const OdGeVector3d& planeNormal, const double radius) : m_Center(center) { m_ColorIndex = g_PrimitiveState.ColorIndex(); m_LinetypeIndex = g_PrimitiveState.LinetypeIndex(); auto PlaneNormal(planeNormal); PlaneNormal.normalize(); m_MajorAxis = ComputeArbitraryAxis(PlaneNormal); m_MajorAxis.normalize(); m_MajorAxis *= radius; m_MinorAxis = PlaneNormal.crossProduct(m_MajorAxis); m_SweepAngle = Oda2PI; } EoDbEllipse::EoDbEllipse(const EoDbEllipse& other) { m_LayerId = other.m_LayerId; m_EntityObjectId = other.m_EntityObjectId; m_ColorIndex = other.m_ColorIndex; m_LinetypeIndex = other.m_LinetypeIndex; m_Center = other.m_Center; m_MajorAxis = other.m_MajorAxis; m_MinorAxis = other.m_MinorAxis; m_SweepAngle = other.m_SweepAngle; } EoDbEllipse& EoDbEllipse::operator=(const EoDbEllipse& other) noexcept { m_LayerId = other.m_LayerId; m_EntityObjectId = other.m_EntityObjectId; m_ColorIndex = other.m_ColorIndex; m_LinetypeIndex = other.m_LinetypeIndex; m_Center = other.m_Center; m_MajorAxis = other.m_MajorAxis; m_MinorAxis = other.m_MinorAxis; m_SweepAngle = other.m_SweepAngle; return *this; } void EoDbEllipse::AddReportToMessageList(const OdGePoint3d& /*point*/) const { CString Report; Report += L" Color:" + FormatColorIndex(); Report += L" Linetype:" + FormatLinetypeIndex(); const auto LengthAsString {theApp.FormatLength(m_MajorAxis.length(), theApp.GetUnits())}; if (fabs(m_MajorAxis.lengthSqrd() - m_MinorAxis.lengthSqrd()) <= FLT_EPSILON) { if (fabs(m_SweepAngle - Oda2PI) <= FLT_EPSILON) { Report = L"<Circle>" + Report; Report += L" Radius:" + LengthAsString; } else { Report = L"<Arc>" + Report; Report += L" Radius:" + LengthAsString; Report += L" SweepAngle:" + AeSys::FormatAngle(m_SweepAngle); } } else { Report = L"<Ellipse>" + Report; Report += L" MajorAxisLength:" + LengthAsString; } AeSys::AddStringToMessageList(Report); } void EoDbEllipse::AddToTreeViewControl(const HWND tree, const HTREEITEM parent) const noexcept { CMainFrame::InsertTreeViewControlItem(tree, parent, L"<Arc>", this); } EoDbPrimitive* EoDbEllipse::Clone(OdDbBlockTableRecordPtr blockTableRecord) const { OdDbEllipsePtr Ellipse {m_EntityObjectId.safeOpenObject()->clone()}; blockTableRecord->appendOdDbEntity(Ellipse); return Create(Ellipse); } void EoDbEllipse::CutAt(const OdGePoint3d& point, EoDbGroup* newGroup) { if (fabs(m_SweepAngle - Oda2PI) <= DBL_EPSILON) { // <tas="Never allowing a point cut on closed ellipse"</tas> } const auto Relationship {SwpAngToPt(point) / m_SweepAngle}; if (Relationship <= DBL_EPSILON || Relationship >= 1.0 - DBL_EPSILON) { return; } const auto SweepAngle {m_SweepAngle * Relationship}; OdDbDatabasePtr Database {this->m_EntityObjectId.database()}; OdDbBlockTableRecordPtr BlockTableRecord {Database->getModelSpaceId().safeOpenObject(OdDb::kForWrite)}; auto Arc {Create3(*this, BlockTableRecord)}; Arc->SetTo2(m_Center, m_MajorAxis, m_MinorAxis, SweepAngle); newGroup->AddTail(Arc); auto PlaneNormal {m_MajorAxis.crossProduct(m_MinorAxis)}; PlaneNormal.normalize(); m_MajorAxis.rotateBy(SweepAngle, PlaneNormal); m_MinorAxis.rotateBy(SweepAngle, PlaneNormal); m_SweepAngle -= SweepAngle; SetTo2(m_Center, m_MajorAxis, m_MinorAxis, m_SweepAngle); } void EoDbEllipse::CutAt2Points(OdGePoint3d* points, EoDbGroupList* groups, EoDbGroupList* newGroups, OdDbDatabasePtr database) { EoDbEllipse* pArc; double dRel[2]; dRel[0] = SwpAngToPt(points[0]) / m_SweepAngle; dRel[1] = SwpAngToPt(points[1]) / m_SweepAngle; if (dRel[0] <= DBL_EPSILON && dRel[1] >= 1.0 - DBL_EPSILON) { // Put entire arc in trap pArc = this; } else { // Something gets cut OdDbBlockTableRecordPtr BlockTableRecord {database->getModelSpaceId().safeOpenObject(OdDb::kForWrite)}; auto PlaneNormal {m_MajorAxis.crossProduct(m_MinorAxis)}; PlaneNormal.normalize(); if (fabs(m_SweepAngle - Oda2PI) <= DBL_EPSILON) { // Closed arc m_SweepAngle = (dRel[1] - dRel[0]) * Oda2PI; m_MajorAxis.rotateBy(dRel[0] * Oda2PI, PlaneNormal); m_MinorAxis.rotateBy(dRel[0] * Oda2PI, PlaneNormal); pArc = Create3(*this, BlockTableRecord); m_MajorAxis.rotateBy(m_SweepAngle, PlaneNormal); m_MinorAxis.rotateBy(m_SweepAngle, PlaneNormal); m_SweepAngle = Oda2PI - m_SweepAngle; } else { // Arc section with a cut pArc = Create3(*this, BlockTableRecord); const auto dSwpAng {m_SweepAngle}; const auto dAng1 {dRel[0] * m_SweepAngle}; const auto dAng2 {dRel[1] * m_SweepAngle}; if (isgreater(dRel[0], 0.0)) { } if (dRel[0] > DBL_EPSILON && dRel[1] < 1.0 - DBL_EPSILON) { // Cut section out of middle pArc->SetSweepAngle(dAng1); auto Group {new EoDbGroup}; Group->AddTail(pArc); groups->AddTail(Group); m_MajorAxis.rotateBy(dAng1, PlaneNormal); m_MinorAxis.rotateBy(dAng1, PlaneNormal); m_SweepAngle = dAng2 - dAng1; pArc = Create3(*this, BlockTableRecord); m_MajorAxis.rotateBy(m_SweepAngle, PlaneNormal); m_MinorAxis.rotateBy(m_SweepAngle, PlaneNormal); m_SweepAngle = dSwpAng - dAng2; } else if (dRel[1] < 1.0 - DBL_EPSILON) { // Cut section in two and place begin section in trap pArc->SetSweepAngle(dAng2); m_MajorAxis.rotateBy(dAng2, PlaneNormal); m_MinorAxis.rotateBy(dAng2, PlaneNormal); m_SweepAngle = dSwpAng - dAng2; } else { // Cut section in two and place end section in trap m_SweepAngle = dAng1; auto v {m_MajorAxis}; v.rotateBy(dAng1, PlaneNormal); pArc->SetMajorAxis(v); v = m_MinorAxis; v.rotateBy(dAng1, PlaneNormal); pArc->SetMinorAxis(v); pArc->SetSweepAngle(dSwpAng - dAng1); } } auto Group {new EoDbGroup}; Group->AddTail(this); groups->AddTail(Group); } auto NewGroup {new EoDbGroup}; NewGroup->AddTail(pArc); newGroups->AddTail(NewGroup); } void EoDbEllipse::Display(AeSysView* view, CDC* deviceContext) { if (fabs(m_SweepAngle) <= DBL_EPSILON) { return; } const auto ColorIndex {LogicalColorIndex()}; const auto LinetypeIndex {LogicalLinetypeIndex()}; g_PrimitiveState.SetPen(view, deviceContext, ColorIndex, LinetypeIndex); polyline::BeginLineStrip(); GenPts(OdGePlane(m_Center, m_MajorAxis, m_MinorAxis), m_SweepAngle); polyline::__End(view, deviceContext, LinetypeIndex); } void EoDbEllipse::FormatExtra(CString& extra) const { extra.Empty(); extra += L"Color;" + FormatColorIndex() + L"\t"; extra += L"Linetype;" + FormatLinetypeIndex() + L"\t"; extra += L"Sweep Angle;" + AeSys::FormatAngle(m_SweepAngle) + L"\t"; extra += L"Major Axis Length;" + theApp.FormatLength(m_MajorAxis.length(), theApp.GetUnits()) + L"\t"; } void EoDbEllipse::FormatGeometry(CString& geometry) const { const auto Normal {m_MajorAxis.crossProduct(m_MinorAxis)}; CString CenterString; CenterString.Format(L"Center Point;%f;%f;%f\t", m_Center.x, m_Center.y, m_Center.z); geometry += CenterString; CString MajorAxisString; MajorAxisString.Format(L"Major Axis;%f;%f;%f\t", m_MajorAxis.x, m_MajorAxis.y, m_MajorAxis.z); geometry += MajorAxisString; CString MinorAxisString; MinorAxisString.Format(L"Minor Axis;%f;%f;%f\t", m_MinorAxis.x, m_MinorAxis.y, m_MinorAxis.z); geometry += MinorAxisString; CString NormalString; NormalString.Format(L"Plane Normal;%f;%f;%f\t", Normal.x, Normal.y, Normal.z); geometry += NormalString; } void EoDbEllipse::GenPts(const OdGePlane& plane, const double sweepAngle) const { OdGeMatrix3d ScaleMatrix; ScaleMatrix.setToScaling(OdGeScale3d(m_MajorAxis.length(), m_MinorAxis.length(), 1.0)); OdGeMatrix3d PlaneToWorldTransform; PlaneToWorldTransform.setToPlaneToWorld(plane); // <tas=Builds a matrix which performs rotation and translation, but no scaling.</tas> // Number of points based on angle and a smoothness coefficient const auto Length {EoMax(m_MajorAxis.length(), m_MinorAxis.length())}; auto NumberOfPoints {EoMax(2L, labs(lround(sweepAngle / Oda2PI * 32.0)))}; NumberOfPoints = EoMin(128L, EoMax(NumberOfPoints, labs(lround(sweepAngle * Length / 0.25)))); const auto Angle {m_SweepAngle / (static_cast<double>(NumberOfPoints) - 1.0)}; const auto CosineAngle {cos(Angle)}; const auto SineAngle {sin(Angle)}; // Generate an origin-centered unit radial curve, then scale before transforming back the world OdGePoint3d Point(1.0, 0.0, 0.0); for (auto PointIndex = 0; PointIndex < NumberOfPoints; PointIndex++) { polyline::SetVertex(PlaneToWorldTransform * ScaleMatrix * Point); const auto X {Point.x}; Point.x = X * CosineAngle - Point.y * SineAngle; Point.y = Point.y * CosineAngle + X * SineAngle; Point.z = 0.0; } } void EoDbEllipse::GetAllPoints(OdGePoint3dArray& points) const { points.clear(); points.append(m_Center); } OdGePoint3d EoDbEllipse::GetCtrlPt() const noexcept { return m_Center; } OdGePoint3d EoDbEllipse::StartPoint() const { return m_Center + m_MajorAxis; } void EoDbEllipse::GetBoundingBox(OdGePoint3dArray& boundingBox) const { boundingBox.setLogicalLength(4); boundingBox[0] = OdGePoint3d(-1.0, -1.0, 0.0); boundingBox[1] = OdGePoint3d(1.0, -1.0, 0.0); boundingBox[2] = OdGePoint3d(1.0, 1.0, 0.0); boundingBox[3] = OdGePoint3d(-1.0, 1.0, 0.0); if (m_SweepAngle < 3.0 * Oda2PI / 4.0) { const auto EndX {cos(m_SweepAngle)}; const auto EndY {sin(m_SweepAngle)}; if (EndX >= 0.0) { if (EndY >= 0.0) { // Arc ends in quadrant one boundingBox[0].x = EndX; boundingBox[0].y = 0.0; boundingBox[1].y = 0.0; boundingBox[2].y = EndY; boundingBox[3].x = EndX; boundingBox[3].y = EndY; } } else { if (EndY >= 0.0) { // Arc ends in quadrant two boundingBox[0].x = EndX; boundingBox[0].y = 0.0; boundingBox[1].y = 0.0; boundingBox[3].x = EndX; } else { // Arc ends in quadrant three boundingBox[0].y = EndY; boundingBox[1].y = EndY; } } } OdGeMatrix3d ScaleMatrix; ScaleMatrix.setToScaling(OdGeScale3d(m_MajorAxis.length(), m_MinorAxis.length(), 1.0)); OdGeMatrix3d PlaneToWorldTransform; PlaneToWorldTransform.setToPlaneToWorld(OdGePlane(m_Center, m_MajorAxis, m_MinorAxis)); PlaneToWorldTransform.postMultBy(ScaleMatrix); for (unsigned w = 0; w < 4; w++) { boundingBox[w].transformBy(PlaneToWorldTransform); } } OdGePoint3d EoDbEllipse::EndPoint() const { OdGeMatrix3d ScaleMatrix; ScaleMatrix.setToScaling(OdGeScale3d(m_MajorAxis.length(), m_MinorAxis.length(), 1.0)); EoGeMatrix3d PlaneToWorldTransform; PlaneToWorldTransform.setToPlaneToWorld(OdGePlane(m_Center, m_MajorAxis, m_MinorAxis)); PlaneToWorldTransform.postMultBy(ScaleMatrix); OdGePoint3d Point(cos(m_SweepAngle), sin(m_SweepAngle), 0.0); Point.transformBy(PlaneToWorldTransform); return Point; } OdGeVector3d EoDbEllipse::MajorAxis() const noexcept { return m_MajorAxis; } OdGeVector3d EoDbEllipse::MinorAxis() const noexcept { return m_MinorAxis; } OdGePoint3d EoDbEllipse::Center() const noexcept { return m_Center; } double EoDbEllipse::SweepAngle() const noexcept { return m_SweepAngle; } void EoDbEllipse::GetXYExtents(const OdGePoint3d startPoint, const OdGePoint3d endPoint, OdGePoint3d* minimumPoint, OdGePoint3d* maximumPoint) const noexcept { const auto X {m_Center.x - startPoint.x}; const auto Y {m_Center.y - startPoint.y}; const auto Radius {sqrt(X * X + Y * Y)}; (*minimumPoint).x = m_Center.x - Radius; (*minimumPoint).y = m_Center.y - Radius; (*maximumPoint).x = m_Center.x + Radius; (*maximumPoint).y = m_Center.y + Radius; if (startPoint.x >= m_Center.x) { if (startPoint.y >= m_Center.y) { // Arc begins in quadrant one if (endPoint.x >= m_Center.x) { if (endPoint.y >= m_Center.y) { // Arc ends in quadrant one if (startPoint.x > endPoint.x) { // Arc in quadrant one only (*minimumPoint).x = endPoint.x; (*minimumPoint).y = startPoint.y; (*maximumPoint).x = startPoint.x; (*maximumPoint).y = endPoint.y; } } else { // Arc ends in quadrant four (*maximumPoint).x = EoMax(startPoint.x, endPoint.x); } } else { if (endPoint.y >= m_Center.y) { // Arc ends in quadrant two (*minimumPoint).x = endPoint.x; (*minimumPoint).y = EoMin(startPoint.y, endPoint.y); } else { // Arc ends in quadrant three (*minimumPoint).y = endPoint.y; } (*maximumPoint).x = startPoint.x; } } else { // Arc begins in quadrant four if (endPoint.x >= m_Center.x) { if (endPoint.y >= m_Center.y) { // Arc ends in quadrant one (*minimumPoint).x = EoMin(startPoint.x, endPoint.x); (*minimumPoint).y = startPoint.y; (*maximumPoint).y = endPoint.y; } else { // Arc ends in quadrant four if (startPoint.x < endPoint.x) { // Arc in quadrant one only (*minimumPoint).x = startPoint.x; (*minimumPoint).y = startPoint.y; (*maximumPoint).x = endPoint.x; (*maximumPoint).y = endPoint.y; } } } else { if (endPoint.y >= m_Center.y) { // Arc ends in quadrant two (*minimumPoint).x = endPoint.x; (*minimumPoint).y = startPoint.y; } else { // Arc ends in quadrant three (*minimumPoint).y = EoMin(startPoint.y, endPoint.y); } } } } else { if (startPoint.y >= m_Center.y) { // Arc begins in quadrant two if (endPoint.x >= m_Center.x) { if (endPoint.y >= m_Center.y) { // Arc ends in quadrant one (*maximumPoint).y = EoMax(startPoint.y, endPoint.y); } else { // Arc ends in quadrant four (*maximumPoint).x = endPoint.x; (*maximumPoint).y = startPoint.y; } } else { if (endPoint.y >= m_Center.y) { // Arc ends in quadrant two if (startPoint.x > endPoint.x) { // Arc in quadrant two only (*minimumPoint).x = endPoint.x; (*minimumPoint).y = endPoint.y; (*maximumPoint).x = startPoint.x; (*maximumPoint).y = startPoint.y; } } else { // Arc ends in quadrant three (*minimumPoint).y = endPoint.y; (*maximumPoint).x = EoMax(startPoint.x, endPoint.x); (*maximumPoint).y = startPoint.y; } } } else { // Arc begins in quadrant three if (endPoint.x >= m_Center.x) { if (endPoint.y >= m_Center.y) { // Arc ends in quadrant one (*maximumPoint).y = endPoint.y; } else { // Arc ends in quadrant four (*maximumPoint).x = endPoint.x; (*maximumPoint).y = EoMax(startPoint.y, endPoint.y); } (*minimumPoint).x = startPoint.x; } else { if (endPoint.y >= m_Center.y) { // Arc ends in quadrant two (*minimumPoint).x = EoMin(startPoint.x, endPoint.x); } else { // Arc ends in quadrant three if (startPoint.x < endPoint.x) { // Arc in quadrant three only (*minimumPoint).x = startPoint.x; (*minimumPoint).y = endPoint.y; (*maximumPoint).x = endPoint.x; (*maximumPoint).y = startPoint.y; } } } } } } void EoDbEllipse::GetExtents(AeSysView* /*view*/, OdGeExtents3d& extents) const { if (!m_EntityObjectId.isNull()) { auto Entity {m_EntityObjectId.safeOpenObject()}; OdGeExtents3d Extents; Entity->getGeomExtents(Extents); extents.addExt(Extents); } else { OdGePoint3dArray BoundingBox; GetBoundingBox(BoundingBox); for (unsigned w = 0; w < 4; w++) { extents.addPoint(BoundingBox[w]); } } } bool EoDbEllipse::IsPointOnControlPoint(AeSysView* view, const EoGePoint4d& point) const { EoGePoint4d Points[] {EoGePoint4d(StartPoint(), 1.0), EoGePoint4d(EndPoint(), 1.0)}; for (auto& Point : Points) { view->ModelViewTransformPoint(Point); if (point.DistanceToPointXY(Point) < ms_SelectApertureSize) { return true; } } return false; } int EoDbEllipse::IsWithinArea(const OdGePoint3d& lowerLeftCorner, const OdGePoint3d& upperRightCorner, OdGePoint3d* intersections) { auto PlaneNormal {m_MajorAxis.crossProduct(m_MinorAxis)}; PlaneNormal.normalize(); if (!OdGeVector3d::kZAxis.crossProduct(PlaneNormal).isZeroLength()) { return 0; } // not on plane normal to z-axis if (fabs(m_MajorAxis.length() - m_MinorAxis.length()) > FLT_EPSILON) { return 0; } // not radial OdGePoint3d ptMin; OdGePoint3d ptMax; auto ptBeg {StartPoint()}; auto ptEnd {EndPoint()}; if (PlaneNormal.z < 0.0) { const auto pt {ptBeg}; ptBeg = ptEnd; ptEnd = pt; PlaneNormal = -PlaneNormal; m_MajorAxis = ptBeg - m_Center; m_MinorAxis = PlaneNormal.crossProduct(m_MajorAxis); } GetXYExtents(ptBeg, ptEnd, &ptMin, &ptMax); if (ptMin.x >= lowerLeftCorner.x && ptMax.x <= upperRightCorner.x && ptMin.y >= lowerLeftCorner.y && ptMax.y <= upperRightCorner.y) { // Totally within window boundaries intersections[0] = ptBeg; intersections[1] = ptEnd; return 2; } if (ptMin.x >= upperRightCorner.x || ptMax.x <= lowerLeftCorner.x || ptMin.y >= upperRightCorner.y || ptMax.y <= lowerLeftCorner.y) { return 0; } OdGePoint3d ptWrk[8]; double dDis; double dOff; auto iSecs {0}; const auto dRad {OdGeVector3d(ptBeg - m_Center).length()}; if (ptMax.x > upperRightCorner.x) { // Arc may intersect with right window boundary dDis = upperRightCorner.x - m_Center.x; dOff = sqrt(dRad * dRad - dDis * dDis); if (m_Center.y - dOff >= lowerLeftCorner.y && m_Center.y - dOff <= upperRightCorner.y) { ptWrk[iSecs].x = upperRightCorner.x; ptWrk[iSecs++].y = m_Center.y - dOff; } if (m_Center.y + dOff <= upperRightCorner.y && m_Center.y + dOff >= lowerLeftCorner.y) { ptWrk[iSecs].x = upperRightCorner.x; ptWrk[iSecs++].y = m_Center.y + dOff; } } if (ptMax.y > upperRightCorner.y) { // Arc may intersect with top window boundary dDis = upperRightCorner.y - m_Center.y; dOff = sqrt(dRad * dRad - dDis * dDis); if (m_Center.x + dOff <= upperRightCorner.x && m_Center.x + dOff >= lowerLeftCorner.x) { ptWrk[iSecs].x = m_Center.x + dOff; ptWrk[iSecs++].y = upperRightCorner.y; } if (m_Center.x - dOff >= lowerLeftCorner.x && m_Center.x - dOff <= upperRightCorner.x) { ptWrk[iSecs].x = m_Center.x - dOff; ptWrk[iSecs++].y = upperRightCorner.y; } } if (ptMin.x < lowerLeftCorner.x) { // Arc may intersect with left window boundary dDis = m_Center.x - lowerLeftCorner.x; dOff = sqrt(dRad * dRad - dDis * dDis); if (m_Center.y + dOff <= upperRightCorner.y && m_Center.y + dOff >= lowerLeftCorner.y) { ptWrk[iSecs].x = lowerLeftCorner.x; ptWrk[iSecs++].y = m_Center.y + dOff; } if (m_Center.y - dOff >= lowerLeftCorner.y && m_Center.y - dOff <= upperRightCorner.y) { ptWrk[iSecs].x = lowerLeftCorner.x; ptWrk[iSecs++].y = m_Center.y - dOff; } } if (ptMin.y < lowerLeftCorner.y) { // Arc may intersect with bottom window boundary dDis = m_Center.y - lowerLeftCorner.y; dOff = sqrt(dRad * dRad - dDis * dDis); if (m_Center.x - dOff >= lowerLeftCorner.x && m_Center.x - dOff <= upperRightCorner.x) { ptWrk[iSecs].x = m_Center.x - dOff; ptWrk[iSecs++].y = lowerLeftCorner.y; } if (m_Center.x + dOff <= upperRightCorner.x && m_Center.x + dOff >= lowerLeftCorner.x) { ptWrk[iSecs].x = m_Center.x + dOff; ptWrk[iSecs++].y = lowerLeftCorner.y; } } if (iSecs == 0) { return 0; } const auto BeginAngle {atan2(ptBeg.y - m_Center.y, ptBeg.x - m_Center.x)}; // Arc begin angle (- pi to pi) double AngleIntersections[8] {0.0}; auto IntersectionIndex {0}; for (auto i2 = 0; i2 < iSecs; i2++) { // Loop thru possible intersections const auto CurrentIntersectionAngle {atan2(ptWrk[i2].y - m_Center.y, ptWrk[i2].x - m_Center.x)}; AngleIntersections[IntersectionIndex] = CurrentIntersectionAngle - BeginAngle; if (AngleIntersections[IntersectionIndex] < 0.0) { AngleIntersections[IntersectionIndex] += Oda2PI; } if (fabs(AngleIntersections[IntersectionIndex]) - m_SweepAngle < 0.0) { // Intersection lies on arc int i; for (i = 0; i < IntersectionIndex && ptWrk[i2] != intersections[i]; i++) { } if (i == IntersectionIndex) { // Unique intersection intersections[IntersectionIndex++] = ptWrk[i2]; } } } if (IntersectionIndex == 0) { return 0; } // None of the intersections are on sweep of arc for (auto i1 = 0; i1 < IntersectionIndex; i1++) { // Sort intersections from begin to end of sweep for (auto i2 = 1; i2 < IntersectionIndex - i1; i2++) { if (fabs(AngleIntersections[i2]) < fabs(AngleIntersections[i2 - 1])) { const auto AngleIntersection {AngleIntersections[i2 - 1]}; AngleIntersections[i2 - 1] = AngleIntersections[i2]; AngleIntersections[i2] = AngleIntersection; const auto pt {intersections[i2 - 1]}; intersections[i2 - 1] = intersections[i2]; intersections[i2] = pt; } } } if (fabs(m_SweepAngle - Oda2PI) <= DBL_EPSILON) { // Arc is a circle in disguise } else { if (ptBeg.x >= lowerLeftCorner.x && ptBeg.x <= upperRightCorner.x && ptBeg.y >= lowerLeftCorner.y && ptBeg.y <= upperRightCorner.y) { // Add beg point to int set for (auto i = IntersectionIndex; i > 0; i--) { intersections[i] = intersections[i - 1]; } intersections[0] = ptBeg; IntersectionIndex++; } if (ptEnd.x >= lowerLeftCorner.x && ptEnd.x <= upperRightCorner.x && ptEnd.y >= lowerLeftCorner.y && ptEnd.y <= upperRightCorner.y) { // Add end point to int set intersections[IntersectionIndex] = ptEnd; IntersectionIndex++; } } return IntersectionIndex; } OdGePoint3d EoDbEllipse::GoToNxtCtrlPt() const { const auto dAng {ms_RelationshipOfPoint <= DBL_EPSILON ? m_SweepAngle : 0.0}; return FindPointOnArc(m_Center, m_MajorAxis, m_MinorAxis, dAng); } bool EoDbEllipse::IsEqualTo(EoDbPrimitive* /*primitive*/) const noexcept { return false; } bool EoDbEllipse::IsInView(AeSysView* view) const { OdGePoint3dArray BoundingBox; GetBoundingBox(BoundingBox); EoGePoint4d ptBeg(BoundingBox[0], 1.0); view->ModelViewTransformPoint(ptBeg); for (unsigned w = 1; w < 4; w++) { EoGePoint4d ptEnd(BoundingBox[w], 1.0); view->ModelViewTransformPoint(ptEnd); if (EoGePoint4d::ClipLine(ptBeg, ptEnd)) { return true; } ptBeg = ptEnd; } return false; } OdGePoint3d EoDbEllipse::SelectAtControlPoint(AeSysView* view, const EoGePoint4d& point) const { ms_ControlPointIndex = SIZE_T_MAX; auto Aperture {ms_SelectApertureSize}; OdGePoint3d ptCtrl[] = {StartPoint(), EndPoint()}; for (unsigned w = 0; w < 2; w++) { EoGePoint4d pt(ptCtrl[w], 1.0); view->ModelViewTransformPoint(pt); const auto dDis {point.DistanceToPointXY(pt)}; if (dDis < Aperture) { ms_ControlPointIndex = w; Aperture = dDis; } } return ms_ControlPointIndex == SIZE_T_MAX ? OdGePoint3d::kOrigin : ptCtrl[ms_ControlPointIndex]; } bool EoDbEllipse::SelectUsingLineSeg(const EoGeLineSeg3d& lineSeg, AeSysView* view, OdGePoint3dArray& intersections) { polyline::BeginLineStrip(); GenPts(OdGePlane(m_Center, m_MajorAxis, m_MinorAxis), m_SweepAngle); return polyline::SelectUsingLineSeg(lineSeg, view, intersections); } bool EoDbEllipse::SelectUsingPoint(const EoGePoint4d& point, AeSysView* view, OdGePoint3d& projectedPoint) const { polyline::BeginLineStrip(); GenPts(OdGePlane(m_Center, m_MajorAxis, m_MinorAxis), m_SweepAngle); return polyline::SelectUsingPoint(point, view, ms_RelationshipOfPoint, projectedPoint); } bool EoDbEllipse::SelectUsingRectangle(const OdGePoint3d& lowerLeftCorner, const OdGePoint3d& upperRightCorner, AeSysView* view) const { polyline::BeginLineStrip(); GenPts(OdGePlane(m_Center, m_MajorAxis, m_MinorAxis), m_SweepAngle); return polyline::SelectUsingRectangle(lowerLeftCorner, upperRightCorner, view); } void EoDbEllipse::SetCenter(const OdGePoint3d& center) noexcept { m_Center = center; } void EoDbEllipse::SetMajorAxis(const OdGeVector3d& majorAxis) noexcept { m_MajorAxis = majorAxis; } void EoDbEllipse::SetMinorAxis(const OdGeVector3d& minorAxis) noexcept { m_MinorAxis = minorAxis; } void EoDbEllipse::SetSweepAngle(const double angle) noexcept { m_SweepAngle = angle; } EoDbEllipse& EoDbEllipse::SetTo2(const OdGePoint3d& center, const OdGeVector3d& majorAxis, const OdGeVector3d& minorAxis, const double sweepAngle) { auto PlaneNormal {majorAxis.crossProduct(minorAxis)}; if (!PlaneNormal.isZeroLength()) { m_Center = center; m_MajorAxis = majorAxis; m_MinorAxis = minorAxis; m_SweepAngle = sweepAngle; if (!m_EntityObjectId.isNull()) { OdDbEllipsePtr Ellipse {m_EntityObjectId.safeOpenObject(OdDb::kForWrite)}; const auto RadiusRatio {minorAxis.length() / majorAxis.length()}; PlaneNormal.normalize(); Ellipse->set(center, PlaneNormal, majorAxis, RadiusRatio, 0.0, sweepAngle); } } return *this; } EoDbEllipse& EoDbEllipse::SetTo3PointArc(const OdGePoint3d& startPoint, const OdGePoint3d& intermediatePoint, const OdGePoint3d& endPoint) { m_SweepAngle = 0.0; auto PlaneNormal {OdGeVector3d(intermediatePoint - startPoint).crossProduct(OdGeVector3d(endPoint - startPoint))}; if (PlaneNormal.isZeroLength()) { return *this; } PlaneNormal.normalize(); // Build transformation matrix which will get intermediate and end points to z=0 plane with start point as origin EoGeMatrix3d WorldToPlaneAtStartPoint; WorldToPlaneAtStartPoint.setToWorldToPlane(OdGePlane(startPoint, PlaneNormal)); OdGePoint3d pt[3]; pt[0] = startPoint; pt[1] = intermediatePoint; pt[2] = endPoint; pt[1].transformBy(WorldToPlaneAtStartPoint); pt[2].transformBy(WorldToPlaneAtStartPoint); const auto dDet {pt[1].x * pt[2].y - pt[2].x * pt[1].y}; if (fabs(dDet) > DBL_EPSILON) { // Three points are not colinear const auto dT {((pt[2].x - pt[1].x) * pt[2].x + pt[2].y * (pt[2].y - pt[1].y)) / dDet}; m_Center.x = (pt[1].x - pt[1].y * dT) * 0.5; m_Center.y = (pt[1].y + pt[1].x * dT) * 0.5; m_Center.z = 0.0; WorldToPlaneAtStartPoint.invert(); // Transform back to original plane m_Center.transformBy(WorldToPlaneAtStartPoint); // None of the points coincide with center point EoGeMatrix3d WorldToPlaneAtCenterPointTransform; WorldToPlaneAtCenterPointTransform.setToWorldToPlane(OdGePlane(m_Center, PlaneNormal)); double dAng[3]; pt[1] = intermediatePoint; pt[2] = endPoint; for (auto i = 0; i < 3; i++) { // Translate points into z=0 plane with center point at origin pt[i].transformBy(WorldToPlaneAtCenterPointTransform); dAng[i] = atan2(pt[i].y, pt[i].x); if (dAng[i] < 0.0) { dAng[i] += Oda2PI; } } const auto dMin {EoMin(dAng[0], dAng[2])}; const auto dMax {EoMax(dAng[0], dAng[2])}; if (fabs(dAng[1] - dMax) > DBL_EPSILON && fabs(dAng[1] - dMin) > DBL_EPSILON) { // Inside line is not colinear with outside lines m_SweepAngle = dMax - dMin; if (dAng[1] > dMin && dAng[1] < dMax) { if (dAng[0] == dMax) { m_SweepAngle = -m_SweepAngle; } } else { m_SweepAngle = Oda2PI - m_SweepAngle; if (dAng[2] == dMax) { m_SweepAngle = -m_SweepAngle; } } auto ptRot {startPoint}; ptRot.rotateBy(OdaPI2, PlaneNormal, m_Center); m_MajorAxis = OdGeVector3d(startPoint - m_Center); m_MinorAxis = OdGeVector3d(ptRot - m_Center); SetTo2(m_Center, m_MajorAxis, m_MinorAxis, m_SweepAngle); } } return *this; } EoDbEllipse& EoDbEllipse::SetToCircle(const OdGePoint3d& center, const OdGeVector3d& planeNormal, const double radius) { if (!planeNormal.isZeroLength()) { auto PlaneNormal(planeNormal); PlaneNormal.normalize(); m_Center = center; m_MajorAxis = ComputeArbitraryAxis(PlaneNormal); m_MajorAxis.normalize(); m_MajorAxis *= radius; m_MinorAxis = PlaneNormal.crossProduct(m_MajorAxis); m_SweepAngle = Oda2PI; SetTo2(m_Center, m_MajorAxis, m_MinorAxis, m_SweepAngle); } return *this; } double EoDbEllipse::SwpAngToPt(const OdGePoint3d& point) const { auto PlaneNormal {m_MajorAxis.crossProduct(m_MinorAxis)}; PlaneNormal.normalize(); EoGeMatrix3d WorldToPlaneTransform; WorldToPlaneTransform.setToWorldToPlane(OdGePlane(m_Center, PlaneNormal)); auto StartPoint {m_Center + m_MajorAxis}; auto Point {point}; // Translate points into z=0 plane StartPoint.transformBy(WorldToPlaneTransform); Point.transformBy(WorldToPlaneTransform); return EoGeLineSeg3d(OdGePoint3d::kOrigin, StartPoint).AngleBetween_xy(EoGeLineSeg3d(OdGePoint3d::kOrigin, Point)); } void EoDbEllipse::TransformBy(const EoGeMatrix3d& transformMatrix) { m_Center.transformBy(transformMatrix); m_MajorAxis.transformBy(transformMatrix); m_MinorAxis.transformBy(transformMatrix); } void EoDbEllipse::TranslateUsingMask(const OdGeVector3d& translate, const unsigned mask) { if (mask != 0) { m_Center += translate; } } bool EoDbEllipse::Write(EoDbFile& file) const { file.WriteUInt16(EoDb::kEllipsePrimitive); file.WriteInt16(m_ColorIndex); file.WriteInt16(m_LinetypeIndex); file.WriteDouble(m_Center.x); file.WriteDouble(m_Center.y); file.WriteDouble(m_Center.z); file.WriteDouble(m_MajorAxis.x); file.WriteDouble(m_MajorAxis.y); file.WriteDouble(m_MajorAxis.z); file.WriteDouble(m_MinorAxis.x); file.WriteDouble(m_MinorAxis.y); file.WriteDouble(m_MinorAxis.z); file.WriteDouble(m_SweepAngle); return true; } void EoDbEllipse::Write(CFile& file, unsigned char* buffer) const { buffer[3] = 2; *reinterpret_cast<unsigned short*>(& buffer[4]) = static_cast<unsigned short>(EoDb::kEllipsePrimitive); buffer[6] = static_cast<unsigned char>(m_ColorIndex == mc_ColorindexBylayer ? ms_LayerColorIndex : m_ColorIndex); buffer[7] = static_cast<unsigned char>(m_LinetypeIndex == mc_LinetypeBylayer ? ms_LayerLinetypeIndex : m_LinetypeIndex); if (buffer[7] >= 16) { buffer[7] = 2; } reinterpret_cast<EoVaxPoint3d*>(& buffer[8])->Convert(m_Center); reinterpret_cast<EoVaxVector3d*>(& buffer[20])->Convert(m_MajorAxis); reinterpret_cast<EoVaxVector3d*>(& buffer[32])->Convert(m_MinorAxis); reinterpret_cast<EoVaxFloat*>(& buffer[44])->Convert(m_SweepAngle); file.Write(buffer, 64); } EoDbEllipse* EoDbEllipse::Create3(const EoDbEllipse& ellipse, OdDbBlockTableRecordPtr& blockTableRecord) { // <tas="Possibly need additional typing of the ObjectId produced by cloning"></tas> OdDbEllipsePtr EllipseEntity {ellipse.EntityObjectId().safeOpenObject()->clone()}; blockTableRecord->appendOdDbEntity(EllipseEntity); auto Ellipse {new EoDbEllipse(ellipse)}; Ellipse->SetEntityObjectId(EllipseEntity->objectId()); return Ellipse; } EoDbEllipse* EoDbEllipse::Create(OdDbEllipsePtr& ellipse) { auto Ellipse {new EoDbEllipse()}; Ellipse->SetEntityObjectId(ellipse->objectId()); Ellipse->m_ColorIndex = static_cast<short>(ellipse->colorIndex()); Ellipse->m_LinetypeIndex = static_cast<short>(EoDbLinetypeTable::LegacyLinetypeIndex(ellipse->linetype())); auto MajorAxis(ellipse->majorAxis()); auto MinorAxis(ellipse->minorAxis()); auto StartAngle {ellipse->startAngle()}; auto EndAngle {ellipse->endAngle()}; if (StartAngle >= Oda2PI) { // need to rationalize angles to first period angles in range on (0 to twopi) StartAngle -= Oda2PI; EndAngle -= Oda2PI; } auto SweepAngle {EndAngle - StartAngle}; if (SweepAngle <= FLT_EPSILON) { SweepAngle += Oda2PI; } if (StartAngle != 0.0) { MajorAxis.rotateBy(StartAngle, ellipse->normal()); MinorAxis.rotateBy(StartAngle, ellipse->normal()); if (ellipse->radiusRatio() != 1.0) { TRACE0("Ellipse: Non radial with start parameter not 0.\n"); } } Ellipse->SetCenter(ellipse->center()); Ellipse->SetMajorAxis(MajorAxis); Ellipse->SetMinorAxis(MinorAxis); Ellipse->SetSweepAngle(SweepAngle); return Ellipse; } OdDbEllipsePtr EoDbEllipse::Create(OdDbBlockTableRecordPtr& blockTableRecord) { auto Ellipse {OdDbEllipse::createObject()}; Ellipse->setDatabaseDefaults(blockTableRecord->database()); blockTableRecord->appendOdDbEntity(Ellipse); Ellipse->setColorIndex(static_cast<unsigned short>(g_PrimitiveState.ColorIndex())); const auto Linetype {LinetypeObjectFromIndex(g_PrimitiveState.LinetypeIndex())}; Ellipse->setLinetype(Linetype); return Ellipse; } OdDbEllipsePtr EoDbEllipse::CreateCircle(OdDbBlockTableRecordPtr& blockTableRecord, const OdGePoint3d& center, const OdGeVector3d& normal, const double radius) { auto Ellipse {OdDbEllipse::createObject()}; Ellipse->setDatabaseDefaults(blockTableRecord->database()); blockTableRecord->appendOdDbEntity(Ellipse); const OdGeCircArc3d CircularArc {center, normal, radius}; Ellipse->set(center, CircularArc.normal(), CircularArc.refVec() * radius, 1.0); return Ellipse; } OdDbEllipsePtr EoDbEllipse::Create(OdDbBlockTableRecordPtr& blockTableRecord, EoDbFile& file) { const auto Database {blockTableRecord->database()}; auto Ellipse {OdDbEllipse::createObject()}; Ellipse->setDatabaseDefaults(Database); blockTableRecord->appendOdDbEntity(Ellipse); Ellipse->setColorIndex(static_cast<unsigned short>(file.ReadInt16())); const auto Linetype {LinetypeObjectFromIndex0(Database, file.ReadInt16())}; Ellipse->setLinetype(Linetype); const auto CenterPoint {file.ReadPoint3d()}; const auto MajorAxis {file.ReadVector3d()}; const auto MinorAxis {file.ReadVector3d()}; const auto SweepAngle {file.ReadDouble()}; auto PlaneNormal {MajorAxis.crossProduct(MinorAxis)}; if (!PlaneNormal.isZeroLength()) { PlaneNormal.normalize(); // <tas="Apparently some ellipse primitives have a RadiusRatio > 1."></tas> const auto RadiusRatio {MinorAxis.length() / MajorAxis.length()}; Ellipse->set(CenterPoint, PlaneNormal, MajorAxis, EoMin(1.0, RadiusRatio), 0.0, SweepAngle); } return Ellipse; } OdDbEllipsePtr EoDbEllipse::Create(OdDbBlockTableRecordPtr blockTableRecord, unsigned char* primitiveBuffer, const int versionNumber) { short ColorIndex; short LinetypeIndex; OdGePoint3d CenterPoint; OdGeVector3d MajorAxis; OdGeVector3d MinorAxis; double SweepAngle; if (versionNumber == 1) { ColorIndex = static_cast<short>(primitiveBuffer[4] & 0x000fU); LinetypeIndex = static_cast<short>((primitiveBuffer[4] & 0x00ffU) >> 4U); const auto BeginPoint {OdGePoint3d(reinterpret_cast<EoVaxFloat*>(&primitiveBuffer[8])->Convert(), reinterpret_cast<EoVaxFloat*>(&primitiveBuffer[12])->Convert(), 0.0) * 1.e-3}; CenterPoint = OdGePoint3d(reinterpret_cast<EoVaxFloat*>(& primitiveBuffer[20])->Convert(), reinterpret_cast<EoVaxFloat*>(& primitiveBuffer[24])->Convert(), 0.0) * 1.e-3; SweepAngle = reinterpret_cast<EoVaxFloat*>(& primitiveBuffer[28])->Convert(); if (SweepAngle < 0.0) { OdGePoint3d pt; pt.x = CenterPoint.x + ((BeginPoint.x - CenterPoint.x) * cos(SweepAngle) - (BeginPoint.y - CenterPoint.y) * sin(SweepAngle)); pt.y = CenterPoint.y + ((BeginPoint.x - CenterPoint.x) * sin(SweepAngle) + (BeginPoint.y - CenterPoint.y) * cos(SweepAngle)); MajorAxis = pt - CenterPoint; } else { MajorAxis = BeginPoint - CenterPoint; } MinorAxis = OdGeVector3d::kZAxis.crossProduct(MajorAxis); SweepAngle = fabs(SweepAngle); } else { ColorIndex = static_cast<short>(primitiveBuffer[6]); LinetypeIndex = static_cast<short>(primitiveBuffer[7]); CenterPoint = reinterpret_cast<EoVaxPoint3d*>(& primitiveBuffer[8])->Convert(); MajorAxis = reinterpret_cast<EoVaxVector3d*>(& primitiveBuffer[20])->Convert(); MinorAxis = reinterpret_cast<EoVaxVector3d*>(& primitiveBuffer[32])->Convert(); SweepAngle = reinterpret_cast<EoVaxFloat*>(& primitiveBuffer[44])->Convert(); if (SweepAngle > Oda2PI || SweepAngle < -Oda2PI) { SweepAngle = Oda2PI; } } const auto Database {blockTableRecord->database()}; auto Ellipse {OdDbEllipse::createObject()}; Ellipse->setDatabaseDefaults(Database); blockTableRecord->appendOdDbEntity(Ellipse); Ellipse->setColorIndex(static_cast<unsigned short>(ColorIndex)); Ellipse->setLinetype(LinetypeObjectFromIndex0(Database, LinetypeIndex)); auto PlaneNormal {MajorAxis.crossProduct(MinorAxis)}; if (!PlaneNormal.isZeroLength()) { PlaneNormal.normalize(); // <tas="Apparently some ellipse primitives have a RadiusRatio > 1."></tas> const auto RadiusRatio {MinorAxis.length() / MajorAxis.length()}; Ellipse->set(CenterPoint, PlaneNormal, MajorAxis, EoMin(1.0, RadiusRatio), 0.0, SweepAngle); } return Ellipse; } OdGePoint3d FindPointOnArc(const OdGePoint3d& center, const OdGeVector3d& majorAxis, const OdGeVector3d& minorAxis, const double angle) { OdGeMatrix3d ScaleMatrix; ScaleMatrix.setToScaling(OdGeScale3d(majorAxis.length(), minorAxis.length(), 1.0)); EoGeMatrix3d PlaneToWorldTransform; PlaneToWorldTransform.setToPlaneToWorld(OdGePlane(center, majorAxis, minorAxis)); PlaneToWorldTransform.postMultBy(ScaleMatrix); OdGePoint3d pt(cos(angle), sin(angle), 0.0); pt.transformBy(PlaneToWorldTransform); return pt; } int FindSweepAngleGivenPlaneAnd3Lines(const OdGeVector3d& planeNormal, const OdGePoint3d& firstPoint, const OdGePoint3d& secondPoint, const OdGePoint3d& thirdPoint, const OdGePoint3d& center, double& sweepAngle) { double dT[3]; OdGePoint3d rR[3]; if (firstPoint == center || secondPoint == center || thirdPoint == center) { return FALSE; } // None of the points coincide with center point EoGeMatrix3d WorldToPlaneTransform; WorldToPlaneTransform.setToWorldToPlane(OdGePlane(center, planeNormal)); rR[0] = firstPoint; rR[1] = secondPoint; rR[2] = thirdPoint; for (auto i = 0; i < 3; i++) { // Translate points into z=0 plane with center point at origin rR[i].transformBy(WorldToPlaneTransform); dT[i] = atan2(rR[i].y, rR[i].x); if (dT[i] < 0.0) { dT[i] += Oda2PI; } } const auto dTMin {EoMin(dT[0], dT[2])}; const auto dTMax {EoMax(dT[0], dT[2])}; if (fabs(dT[1] - dTMax) > DBL_EPSILON && fabs(dT[1] - dTMin) > DBL_EPSILON) { // Inside line is not colinear with outside lines auto dTheta {dTMax - dTMin}; if (dT[1] > dTMin && dT[1] < dTMax) { if (dT[0] == dTMax) { dTheta = -dTheta; } } else { dTheta = Oda2PI - dTheta; if (dT[2] == dTMax) { dTheta = -dTheta; } } sweepAngle = dTheta; return TRUE; } return FALSE; }
[ "t.smith@swbell.net" ]
t.smith@swbell.net
3ea524923165d6dc11aac0f655b65f328327e4cb
60bb67415a192d0c421719de7822c1819d5ba7ac
/blazetest/src/mathtest/dvecdvecinner/V3aVDb.cpp
4f31f6f757a95cd839272d151e3dde1d67599384
[ "BSD-3-Clause" ]
permissive
rtohid/blaze
48decd51395d912730add9bc0d19e617ecae8624
7852d9e22aeb89b907cb878c28d6ca75e5528431
refs/heads/master
2020-04-16T16:48:03.915504
2018-12-19T20:29:42
2018-12-19T20:29:42
165,750,036
0
0
null
null
null
null
UTF-8
C++
false
false
3,708
cpp
//================================================================================================= /*! // \file src/mathtest/dvecdvecinner/V3aVDb.cpp // \brief Source file for the V3aVDb dense vector/dense vector inner product math test // // Copyright (C) 2012-2018 Klaus Iglberger - All Rights Reserved // // This file is part of the Blaze library. You can redistribute it and/or modify it under // the terms of the New (Revised) BSD License. Redistribution and use in source and binary // forms, with or without modification, are permitted provided that the following conditions // are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of // conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, this list // of conditions and the following disclaimer in the documentation and/or other materials // provided with the distribution. // 3. Neither the names of the Blaze development group nor the names of its contributors // may be used to endorse or promote products derived from this software without specific // prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR // BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH // DAMAGE. */ //================================================================================================= //************************************************************************************************* // Includes //************************************************************************************************* #include <cstdlib> #include <iostream> #include <blaze/math/DynamicVector.h> #include <blaze/math/StaticVector.h> #include <blazetest/mathtest/Creator.h> #include <blazetest/mathtest/dvecdvecinner/OperationTest.h> #include <blazetest/system/MathTest.h> //================================================================================================= // // MAIN FUNCTION // //================================================================================================= //************************************************************************************************* int main() { std::cout << " Running 'V3aVDb'..." << std::endl; using blazetest::mathtest::TypeA; using blazetest::mathtest::TypeB; try { // Vector type definitions using V3a = blaze::StaticVector<TypeA,3UL>; using VDb = blaze::DynamicVector<TypeB>; // Creator type definitions using CV3a = blazetest::Creator<V3a>; using CVDb = blazetest::Creator<VDb>; // Running the tests RUN_DVECDVECINNER_OPERATION_TEST( CV3a(), CVDb( 3UL ) ); } catch( std::exception& ex ) { std::cerr << "\n\n ERROR DETECTED during dense vector/dense vector inner product:\n" << ex.what() << "\n"; return EXIT_FAILURE; } return EXIT_SUCCESS; } //*************************************************************************************************
[ "klaus.iglberger@gmail.com" ]
klaus.iglberger@gmail.com