hexsha
stringlengths
40
40
size
int64
7
1.05M
ext
stringclasses
13 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
4
269
max_stars_repo_name
stringlengths
5
109
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
9
max_stars_count
int64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
4
269
max_issues_repo_name
stringlengths
5
116
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
listlengths
1
9
max_issues_count
int64
1
48.5k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
4
269
max_forks_repo_name
stringlengths
5
116
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
listlengths
1
9
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
7
1.05M
avg_line_length
float64
1.21
330k
max_line_length
int64
6
990k
alphanum_fraction
float64
0.01
0.99
author_id
stringlengths
2
40
2dfb034ef23c7ede4e43dcbd4c84cc83f6de0e08
570
cpp
C++
C++/problem0070.cpp
1050669722/LeetCode-Answers
c8f4d1ccaac09cda63b60d75144335347b06dc81
[ "MIT" ]
null
null
null
C++/problem0070.cpp
1050669722/LeetCode-Answers
c8f4d1ccaac09cda63b60d75144335347b06dc81
[ "MIT" ]
null
null
null
C++/problem0070.cpp
1050669722/LeetCode-Answers
c8f4d1ccaac09cda63b60d75144335347b06dc81
[ "MIT" ]
null
null
null
//代码中使用的 \texttt{pow}pow 函数的时空复杂度与 CPU 支持的指令集相关; class Solution { public: int climbStairs(int n) { // if (n == 1) // { // return 1; // } // else if (n == 2) // { // return 2; // } // return climbStairs(n - 1) + climbStairs(n - 2); vector<int> v{1, 2}; for (int i = 2; i < n; ++i) { v.push_back(v[i - 1] + v[i - 2]); } // cout << n - 1 << ' ' << v.size() << endl; return v[n - 1]; // return v[v.size() - 1]; } };
21.923077
58
0.366667
1050669722
9301e5d243cf4f39b13265d1037851ae243d1e95
1,199
hpp
C++
source/Arguments.hpp
fstudio/Phoenix
28a7c6a3932fd7d6fea12770d0aa1e20bc70db7d
[ "MIT" ]
8
2015-01-23T05:41:46.000Z
2019-11-20T05:10:27.000Z
source/Arguments.hpp
fstudio/Phoenix
28a7c6a3932fd7d6fea12770d0aa1e20bc70db7d
[ "MIT" ]
null
null
null
source/Arguments.hpp
fstudio/Phoenix
28a7c6a3932fd7d6fea12770d0aa1e20bc70db7d
[ "MIT" ]
4
2015-05-05T05:15:43.000Z
2020-03-07T11:10:56.000Z
/********************************************************************************************************* * Arguments.hpp * Note: Phoenix CommandLine Arguments * Date: @2015.03 * E-mail:<forcemz@outlook.com> * Copyright (C) 2015 The ForceStudio All Rights Reserved. **********************************************************************************************************/ #ifndef COMMANDLINEARGUMENTS_HPP #define COMMANDLINEARGUMENTS_HPP #pragma once #include <string> #include <vector> enum OptionLevel{ OptionLevel_Normal=0x0000, OptionLevel_Foreground=0x0001, OptionLevel_Version=0x0002, OptionLevel_Usage=0x0004, OptionLevel_Reset=0x0008, OptionLevel_Setting=0x0010, OptionLevel_Init=0x0020, OptionLevel_New=0x0040, OptionLevel_UNKNOWN=0xF000 }; enum InstanceLevel{ InstanceLevel_UI=1, InstanceLevel_Task=2 }; //-Profile with setting profile struct ProcessParameters{ int cmdMode;////CMD md is mutex. int taskMode;////is bool isProfile; std::wstring profile; std::vector<std::wstring> vfile; std::vector<std::wstring> unknowns; }; bool ArgumentsFlow(ProcessParameters &pparam,bool isStoreUnknownOptions=false); #endif
26.644444
107
0.616347
fstudio
9301f55a1847c1cd83daeb4255a176415fd44397
738
hpp
C++
src/controllers/actions/npc_action_move.hpp
astrellon/simple-space
20e98d4f562a78b1efeaedb0a0012f3c9306ac7e
[ "MIT" ]
1
2020-09-23T11:17:35.000Z
2020-09-23T11:17:35.000Z
src/controllers/actions/npc_action_move.hpp
astrellon/simple-space
20e98d4f562a78b1efeaedb0a0012f3c9306ac7e
[ "MIT" ]
null
null
null
src/controllers/actions/npc_action_move.hpp
astrellon/simple-space
20e98d4f562a78b1efeaedb0a0012f3c9306ac7e
[ "MIT" ]
null
null
null
#pragma once #include <SFML/System.hpp> #include "npc_action.hpp" namespace space { class NpcActionMove : public NpcAction { public: // Fields // Constructor NpcActionMove(NpcController *controller, sf::Vector2f destination); // Methods static const std::string ActionType() { return "move-action"; } virtual std::string type() const { return ActionType(); } virtual void update(sf::Time dt); virtual bool isComplete() const; virtual void onComplete(); private: // Fields sf::Vector2f _destination; float _toDestination; // Methods }; } // space
22.363636
79
0.554201
astrellon
930822c3bd7b3c5b7d843281c62c2fcfad70ea0e
5,950
cpp
C++
tests/filesource.cpp
therocode/rexource
0de08b9cce20930b19ddcd6780e7e4a173e9782f
[ "MIT" ]
5
2016-02-07T21:39:50.000Z
2017-09-16T23:31:30.000Z
tests/filesource.cpp
therocode/rexource
0de08b9cce20930b19ddcd6780e7e4a173e9782f
[ "MIT" ]
null
null
null
tests/filesource.cpp
therocode/rexource
0de08b9cce20930b19ddcd6780e7e4a173e9782f
[ "MIT" ]
null
null
null
#include <catch.hpp> #include "helpers/treefilesource.hpp" SCENARIO("File sources set to a folder with a regex will find files recursively with the regex as a filter") { GIVEN("a file source which is set to read all files in a directory") { TreeFileSource treeSource("tests/data/trees", std::regex(".*")); WHEN("all contained resurces are listed by the source") { auto trees = treeSource.list(); THEN("the list contains the expected result") { REQUIRE(trees.size() == 1000); std::set<std::string> paths(trees.begin(), trees.end()); for(int32_t i = 0; i < 1000; ++i) { std::string expectedId = "tree" + std::to_string(i); CHECK(paths.count(expectedId) != 0); } } } } GIVEN("a file source which is set to read all files with a number in the 500s in a directory") { TreeFileSource treeSource("tests/data/trees", std::regex(".*5\\d\\d.*")); WHEN("all contained resurces are listed by the source") { auto trees = treeSource.list(); THEN("the list contains the expected result") { REQUIRE(trees.size() == 100); std::set<std::string> paths(trees.begin(), trees.end()); for(int32_t i = 500; i < 600; ++i) { std::string expectedId = "tree" + std::to_string(i); CHECK(paths.count(expectedId) != 0); } } } } GIVEN("a file source which is not given a regex") { TreeFileSource treeSource("tests/data/trees"); WHEN("all contained resurces are listed by the source") { auto trees = treeSource.list(); THEN("the list contains all the files") { REQUIRE(trees.size() == 1000); std::set<std::string> paths(trees.begin(), trees.end()); for(int32_t i = 0; i < 1000; ++i) { std::string expectedId = "tree" + std::to_string(i); CHECK(paths.count(expectedId) != 0); } } } } GIVEN("a file source which is set to read all files within a directory that doesn't exist") { WHEN("all contained resurces are listed by the source") { THEN("an exception is thrown") { CHECK_THROWS_AS(TreeFileSource("tests/data/tres", std::regex(".*")), rex::InvalidFileException); } } } } SCENARIO("File sources name resources differently based on the Naming flag. This affects ambiguity of resources") { GIVEN("") { WHEN("a file source is used to load a folder with entirely unique file names") { THEN("it doesn't throw with Naming::NO_EXT") { CHECK_NOTHROW(TreeFileSource("tests/data/unique", std::regex(".*"), rex::Naming::NO_EXT)); } THEN("it doesn't throw with Naming::FILE_NAME") { CHECK_NOTHROW(TreeFileSource("tests/data/unique", std::regex(".*"), rex::Naming::FILE_NAME)); } THEN("it doesn't throw with Naming::PATH") { CHECK_NOTHROW(TreeFileSource("tests/data/unique", std::regex(".*"), rex::Naming::PATH)); } } WHEN("a file source is used to load a folder with file names that collide with file extensions") { THEN("it throws with Naming::NO_EXT") { CHECK_THROWS_AS(TreeFileSource("tests/data/collide_ext", std::regex(".*"), rex::Naming::NO_EXT), rex::AmbiguousNameException); } THEN("it throws with Naming::FILE_NAME") { CHECK_THROWS_AS(TreeFileSource("tests/data/collide_ext", std::regex(".*"), rex::Naming::FILE_NAME), rex::AmbiguousNameException); } THEN("it doesn't throw with Naming::PATH") { CHECK_NOTHROW(TreeFileSource("tests/data/collide_ext", std::regex(".*"), rex::Naming::PATH)); } } WHEN("a file source is used to load a folder with file names that collide without file extensions") { THEN("it throws with Naming::NO_EXT") { CHECK_THROWS_AS(TreeFileSource("tests/data/collide_no_ext", std::regex(".*"), rex::Naming::NO_EXT), rex::AmbiguousNameException); } THEN("it doesn't throw with Naming::FILE_NAME") { CHECK_NOTHROW(TreeFileSource("tests/data/collide_no_ext", std::regex(".*"), rex::Naming::FILE_NAME)); } THEN("it doesn't throw with Naming::PATH") { CHECK_NOTHROW(TreeFileSource("tests/data/collide_no_ext", std::regex(".*"), rex::Naming::PATH)); } } } } SCENARIO("a file source can be used to access the resources it represents") { GIVEN("a file source setup to a directory with resources") { TreeFileSource treeSource("tests/data/trees"); WHEN("existing resources are accessed") { const Tree& tree1 = treeSource.load("tree1"); const Tree& tree2 = treeSource.load("tree2"); THEN("the resources have correct values") { CHECK(tree1.leafType == "gigantic"); CHECK(tree1.branchingFactor == Approx(65.7f)); CHECK(tree1.barkType == "naked"); CHECK(tree1.height == Approx(5.2f)); CHECK(tree2.leafType == "wide"); CHECK(tree2.branchingFactor == Approx(78.1f)); CHECK(tree2.barkType == "paper"); CHECK(tree2.height == Approx(43.2f)); } } } }
35
145
0.529748
therocode
93083a3238bf41db9f725c8a83e96c8256dc68f9
2,036
cpp
C++
src/WindowManager.cpp
jamiesyme/MoxelEd
b8ad87587057a79ce0324fd5e3c1290a760adc7a
[ "Unlicense" ]
1
2016-03-09T01:32:22.000Z
2016-03-09T01:32:22.000Z
src/WindowManager.cpp
jamiesyme/MoxelEd
b8ad87587057a79ce0324fd5e3c1290a760adc7a
[ "Unlicense" ]
null
null
null
src/WindowManager.cpp
jamiesyme/MoxelEd
b8ad87587057a79ce0324fd5e3c1290a760adc7a
[ "Unlicense" ]
null
null
null
#include "WindowManager.hpp" #include "Window.hpp" #include "GlHelper.hpp" #include "App.hpp" #include <iostream> WindowManager::WindowManager(App* app) { m_app = app; m_mouseX = 0; m_mouseY = 0; m_nextWindowY = 0; } WindowManager::~WindowManager() { while (m_windows.size() != 0) destroyWindow(m_windows[0]); } void WindowManager::draw() { GlHelper gl; gl.disableDepthTest(); gl.setWindowSize(m_app->getWindowWidth(), m_app->getWindowHeight()); gl.enableOrtho(); for (int i = (int)m_windows.size() - 1; i >= 0; i--) m_windows[i]->draw(); } bool WindowManager::mousePress(const int button) { int selectIndex = -1; bool quitEarly = false; for (unsigned int i = 0; i < m_windows.size(); i++) { if (selectIndex == -1 && m_windows[i]->isOver(m_mouseX, m_mouseY)) selectIndex = (int)i; if (m_windows[i]->mousePress(button)) { quitEarly = true; break; } } if (selectIndex != -1) { Window* newFront = m_windows[selectIndex]; for (int i = selectIndex; i > 0; i--) m_windows[i] = m_windows[i - 1]; m_windows[0] = newFront; } return quitEarly; } void WindowManager::mouseRelease(const int button) { for (unsigned int i = 0; i < m_windows.size(); i++) m_windows[i]->mouseRelease(button); return; } bool WindowManager::mouseMove(const int x, const int y) { m_mouseX = x; m_mouseY = y; for (unsigned int i = 0; i < m_windows.size(); i++) if (m_windows[i]->mouseMove(x, y)) return true; return false; } bool WindowManager::mouseWheelMove(const int w) { for (unsigned int i = 0; i < m_windows.size(); i++) if (m_windows[i]->mouseWheelMove(w)) return true; return false; } Window* WindowManager::createWindow() { Window* w = new Window(); w->setY(m_nextWindowY); m_nextWindowY += w->getHeadSizeY() + 1; m_windows.push_back(w); return w; } void WindowManager::destroyWindow(Window* w) { for (unsigned int i = 0; i < m_windows.size(); i++) { if (w == m_windows[i]) { delete w; m_windows.erase(m_windows.begin() + i); return; } } }
16.826446
69
0.649312
jamiesyme
9308b2575e79755371a4ea80004e21d00a4acdde
1,421
cpp
C++
src/main/cpp/logging/CSVUtil.cpp
frc3512/Robot-2020
c6811155900ccffba93ea9ba131192dcb9fcb1bd
[ "BSD-3-Clause" ]
10
2020-02-07T04:13:15.000Z
2022-02-26T00:13:39.000Z
src/main/cpp/logging/CSVUtil.cpp
frc3512/Robot-2020
c6811155900ccffba93ea9ba131192dcb9fcb1bd
[ "BSD-3-Clause" ]
82
2020-02-12T03:05:15.000Z
2022-02-18T02:14:38.000Z
src/main/cpp/logging/CSVUtil.cpp
frc3512/Robot-2020
c6811155900ccffba93ea9ba131192dcb9fcb1bd
[ "BSD-3-Clause" ]
5
2020-02-14T16:24:01.000Z
2022-03-31T09:10:01.000Z
// Copyright (c) 2020-2021 FRC Team 3512. All Rights Reserved. #include "logging/CSVUtil.hpp" #include <algorithm> #if __has_include(<filesystem>) #include <filesystem> #elif __has_include(<experimental/filesystem>) #include <experimental/filesystem> namespace std { namespace filesystem = experimental::filesystem; } // namespace std #endif #include <frc2/Timer.h> namespace frc3512 { constexpr bool ends_with(std::string_view str, std::string_view x) noexcept { return str.size() >= x.size() && str.compare(str.size() - x.size(), std::string_view::npos, x) == 0; } void DeleteCSVs() { #if !defined(__FRC_ROBORIO__) namespace fs = std::filesystem; // Delete CSV files for (auto& p : fs::recursive_directory_iterator(".")) { if (!p.is_directory() && ends_with(p.path().string(), ".csv")) { fs::remove(p.path()); } } // Delete empty directories for (auto& p : fs::directory_iterator(".")) { if (p.is_directory()) { auto childPath = fs::recursive_directory_iterator(p.path()); auto numFiles = std::count_if(fs::begin(childPath), fs::end(childPath), [](const auto& p) { return !p.is_directory(); }); if (numFiles == 0) { fs::remove_all(p.path()); } } } #endif // !defined(__FRC_ROBORIO__) } } // namespace frc3512
27.326923
79
0.599578
frc3512
93097b0e546672fa8fa1ee5491a5fd642ca8e8d0
2,029
cpp
C++
Plain/src/Runtime/Rendering/Backend/VulkanCommandRecording.cpp
Gaukler/PlainRenderer
cf0f41a2300bee9f29a886230c061776cb29ba5e
[ "MIT" ]
9
2021-04-09T14:07:45.000Z
2022-03-06T07:51:14.000Z
Plain/src/Runtime/Rendering/Backend/VulkanCommandRecording.cpp
Gaukler/PlainRenderer
cf0f41a2300bee9f29a886230c061776cb29ba5e
[ "MIT" ]
14
2021-04-10T11:06:06.000Z
2021-05-07T14:20:34.000Z
Plain/src/Runtime/Rendering/Backend/VulkanCommandRecording.cpp
Gaukler/PlainRenderer
cf0f41a2300bee9f29a886230c061776cb29ba5e
[ "MIT" ]
null
null
null
#include "pch.h" #include "VulkanCommandRecording.h" #include "VulkanContext.h" void resetCommandBuffer(const VkCommandBuffer buffer) { auto res = vkResetCommandBuffer(buffer, 0); checkVulkanResult(res); } void beginCommandBuffer(const VkCommandBuffer buffer, const VkCommandBufferUsageFlags usageFlags, const VkCommandBufferInheritanceInfo* pInheritance) { VkCommandBufferBeginInfo beginInfo = {}; beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; beginInfo.pNext = nullptr; beginInfo.flags = usageFlags; beginInfo.pInheritanceInfo = pInheritance; const auto res = vkBeginCommandBuffer(buffer, &beginInfo); checkVulkanResult(res); } void endCommandBufferRecording(const VkCommandBuffer cmdBuffer) { const auto result = vkEndCommandBuffer(cmdBuffer); checkVulkanResult; } VkCommandBufferInheritanceInfo createCommandBufferInheritanceInfo(const VkRenderPass renderPass, const VkFramebuffer framebuffer) { VkCommandBufferInheritanceInfo inheritanceInfo; inheritanceInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO; inheritanceInfo.pNext = nullptr; inheritanceInfo.renderPass = renderPass; inheritanceInfo.subpass = 0; inheritanceInfo.framebuffer = framebuffer; inheritanceInfo.occlusionQueryEnable = false; inheritanceInfo.queryFlags = 0; inheritanceInfo.pipelineStatistics = 0; return inheritanceInfo; } void recordSetViewportCommand(const VkCommandBuffer buffer, const float width, const float height) { VkViewport viewport; viewport.x = 0; viewport.y = 0; viewport.width = width; viewport.height = height; viewport.minDepth = 0.f; viewport.maxDepth = 1.f; vkCmdSetViewport(buffer, 0, 1, &viewport); } void recordSetScissorCommand(const VkCommandBuffer buffer, const float width, const float height) { VkRect2D scissor; scissor.offset = { 0, 0 }; scissor.extent.width = width; scissor.extent.height = height; vkCmdSetScissor(buffer, 0, 1, &scissor); }
34.982759
100
0.765402
Gaukler
930ddd595a06b78fcd816253870aa15d61e90d82
974
hpp
C++
LEDTableApps/include/LEDTableApps/pong.hpp
michaelbarbera/LEDTableEngine
d7f5fd1e3030c0833086269a6c462954c0fe4d18
[ "Apache-2.0" ]
53
2018-03-12T12:39:53.000Z
2021-08-21T02:41:10.000Z
LEDTableApps/include/LEDTableApps/pong.hpp
michaelbarbera/LEDTableEngine
d7f5fd1e3030c0833086269a6c462954c0fe4d18
[ "Apache-2.0" ]
29
2018-01-24T15:46:47.000Z
2021-05-14T12:04:06.000Z
LEDTableApps/include/LEDTableApps/pong.hpp
michaelbarbera/LEDTableEngine
d7f5fd1e3030c0833086269a6c462954c0fe4d18
[ "Apache-2.0" ]
5
2018-05-03T20:03:36.000Z
2020-01-18T02:35:51.000Z
#ifndef _H_PONG_APP_ #define _H_PONG_APP_ #include <LEDTableEngine/core/baseApplication.hpp> namespace ledApps{ class Pong : public led::BaseApplication { protected: std::default_random_engine m_generator; std::uniform_real_distribution<float> m_randFloat; led::Pointf m_ballSpeed; led::Pointf m_ballPos; int m_playerHeight; std::array<int, 2> m_playerPos; std::array<int, 2> m_playerScore; std::array<bool, 2> m_playerWonRound; float m_speedIncrease; led::TimeUnit m_movementSpeed; led::TimeUnit m_lastUpdateTime; led::TimeUnit m_deathTime; public: Pong(); virtual ~Pong(); void initialize(led::BaseController *ctrl); void processInput(const led::BaseInput::InputEvents& events, led::TimeUnit deltaTime); void draw(led::Image& frame); const std::string getName() const{ return "Pong"; } private: void resetRound(); }; } #endif // ifndef _H_PONG_APP_
20.723404
64
0.687885
michaelbarbera
931678f6c087b46d2355d1510252fd43c6bb1929
652
hpp
C++
src/engine/engine.hpp
MoriokaReimen/randballs
9566558524407ebce401afc6ef62b54b2057f86a
[ "MIT" ]
29
2018-05-17T14:08:16.000Z
2021-12-01T08:15:03.000Z
src/engine/engine.hpp
MoriokaReimen/randballs
9566558524407ebce401afc6ef62b54b2057f86a
[ "MIT" ]
4
2018-09-04T13:46:19.000Z
2020-05-15T16:05:35.000Z
src/engine/engine.hpp
MoriokaReimen/randballs
9566558524407ebce401afc6ef62b54b2057f86a
[ "MIT" ]
2
2020-03-30T05:19:37.000Z
2020-04-24T03:02:25.000Z
#pragma once #include <SFML/Graphics/RenderWindow.hpp> #include <SFML/Window/Event.hpp> #include "graphics/scenemanager.hpp" #include "graphics/texturemanager.hpp" #define UPDATES_PER_SEC 60 #define TIMESTEP_N 1000000000 / UPDATES_PER_SEC #define TIMESTEP_S 1.f / UPDATES_PER_SEC class Engine { bool isRunning = true; sf::RenderWindow window; SceneManager sceneMng; TextureManager textureMng; public: Engine(); ~Engine(); void start(); void stop(); inline sf::RenderWindow& getWindow() { return window; } inline SceneManager& getSceneManager() { return sceneMng; } inline TextureManager& getTextureManager() { return textureMng; } };
21.032258
66
0.760736
MoriokaReimen
931917a5ab54b49f9aae674635f95cef057eb835
1,493
hpp
C++
unlabeled_mapf/include/ten.hpp
Kei18/tswap
4f1fb59579c88de122d04a3760dbdda8aa82ba34
[ "MIT" ]
2
2022-02-13T23:31:31.000Z
2022-02-14T05:34:38.000Z
unlabeled_mapf/include/ten.hpp
AlbaIntelligence/unlabeled-MAPF
db60f8aa4a12dfee1d0736037372a6d3a93813ce
[ "MIT" ]
null
null
null
unlabeled_mapf/include/ten.hpp
AlbaIntelligence/unlabeled-MAPF
db60f8aa4a12dfee1d0736037372a6d3a93813ce
[ "MIT" ]
1
2022-03-18T00:07:47.000Z
2022-03-18T00:07:47.000Z
/* * Time Expanded Network, TEN */ #pragma once #include "lib_ten.hpp" #include "plan.hpp" #include "problem.hpp" class TEN { protected: Problem* const P; // original problem const Nodes V; // all nodes in G LibTEN::ResidualNetwork network; // main body bool valid_network; // Plan solution; // generate solutions int time_limit; // time limit Time::time_point t_start; // to measure computation time private: const int max_timestep; // max timestep protected: // extend time expanded network only for one timestep void extendGraphOneTimestep(const int t); // create time expanded network virtual void updateGraph(); // convert the flow to the plan of unlabeled-MAPF void createPlan(const int T); virtual void createPlan(); // check time limit bool overCompTime() const; public: TEN(Problem* const _P, const int _T, const bool _apply_filter = false); virtual ~TEN(); // update time expanded network virtual void update(); virtual void update(const int t); bool isValid() { return valid_network; } Plan getPlan() { return solution; } // clear all flows void resetFlow() { network.clearAllCapacity(); } // set time limit of computation time void setTimeLimit(int _time_limit); // return info of time expanded network int getNodesNum(); int getEdgesNum(); // return the number of visited nodes by the Ford Furlkerson algorithm int getDfsCnt(); };
23.698413
73
0.679169
Kei18
7938be70891636dc4b0e5c1c580bab7aa7e657ad
2,607
cpp
C++
Base/RenderUnit.cpp
CrusaderCrab/YugiohPhantomRealm
79bd1e9948d2d2d29acf042fd412804c30562a8e
[ "Zlib" ]
13
2018-04-13T22:10:00.000Z
2022-01-01T08:26:23.000Z
Base/RenderUnit.cpp
CrusaderCrab/YugiohPhantomRealm
79bd1e9948d2d2d29acf042fd412804c30562a8e
[ "Zlib" ]
null
null
null
Base/RenderUnit.cpp
CrusaderCrab/YugiohPhantomRealm
79bd1e9948d2d2d29acf042fd412804c30562a8e
[ "Zlib" ]
3
2017-02-22T16:35:06.000Z
2019-12-21T20:39:23.000Z
#include <GL\glew.h> #include <Utility\ErrorHandler.h> #include <Base\RenderUnit.h> #include <Game\Animation\Camera.h> #include <Utility\DebugUnit.h> #include <Utility\TextPrinter.h> #include <Game\Cursor.h> #include <Utility\Clock.h> #include <Game\Animation\FadeUnit.h> #include <iostream>//needed to print glew error #include <Game\Cards\CardDisplayUnit.h> #include <Game\Animation\ParticlesUnit.h> #define YUG_DEFAULT_SCREEN_WIDTH 800 #define YUG_DEFAULT_SCREEN_HEIGHT 600 #define YUG_WINDOW_ORIGIN_POINT 500,0 int frameCount; float timeCount; bool RenderUnit::initialize(){ frameCount = 0; timeCount = 0.0f; resize(YUG_DEFAULT_SCREEN_WIDTH,YUG_DEFAULT_SCREEN_HEIGHT); move(YUG_WINDOW_ORIGIN_POINT); oldRenderer = NULL; currentRenderer = NULL; show(); return true; } void RenderUnit::initializeGL(){ GLenum glewError = glewInit(); if(glewError != GLEW_OK) { errorHandler.printError( "glew Error: "); std::cout<<glewGetErrorString(glewError)<<std::endl; }else{ errorHandler.printError("glew on"); } glEnable(GL_DEPTH_TEST); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } bool RenderUnit::shutdown(){ return true; } void RenderUnit::render(){ glDraw(); } void RenderUnit::paintEvent(){ //blocks QT's auto/uncontrollable repainting } void RenderUnit::paintGL(){ frameCount ++; timeCount += gameClock.lastLoopTime(); glViewport(0, 0, width(), height() ); glClear(GL_COLOR_BUFFER_BIT); glClear(GL_DEPTH_BUFFER_BIT); if(currentRenderer != NULL) currentRenderer->render(); else errorHandler.printError("RenderUnit: paint: render call called on NULL currentRenderer."); puzzleCursor.render(); //cardDisplayUnit.render(); fadeUnit.render(YUG_FADE_GLOBAL); cardDisplayUnit.render(); //particleUnit.render(); } void RenderUnit::newRenderer(Game::YugiohUnit* newRenderer){ if(newRenderer == NULL){ errorHandler.printError("Render Unit: passed new renderer, ignoring it."); }else{ oldRenderer = currentRenderer; currentRenderer = newRenderer; } } void RenderUnit::swapBackToOldRenderer(){ if(oldRenderer == NULL){ errorHandler.printError("Render Unit: swapping in null pointer, ignoring it."); }else{ Game::YugiohUnit* temp; temp = oldRenderer; oldRenderer = currentRenderer; currentRenderer = temp; } } void RenderUnit::returnToOldRenderer(){ if(oldRenderer == NULL){ errorHandler.printError("Render Unit: returning to null pointer, ignoring it."); }else{ currentRenderer = oldRenderer; oldRenderer = NULL; } } void RenderUnit::setOldRenderer(Game::YugiohUnit* newRenderer){ oldRenderer = newRenderer; }
24.828571
92
0.752589
CrusaderCrab
7938e3f9690c6ba7b1894e70ff4f95ec7b61b649
200,701
inl
C++
2d_samples/pmj02_339.inl
st-ario/rayme
315c57c23f4aa4934a8a80e84e3243acd3400808
[ "MIT" ]
1
2021-12-10T23:35:04.000Z
2021-12-10T23:35:04.000Z
2d_samples/pmj02_339.inl
st-ario/rayme
315c57c23f4aa4934a8a80e84e3243acd3400808
[ "MIT" ]
null
null
null
2d_samples/pmj02_339.inl
st-ario/rayme
315c57c23f4aa4934a8a80e84e3243acd3400808
[ "MIT" ]
null
null
null
{std::array<float,2>{0.574865222f, 0.717404485f}, std::array<float,2>{0.296307385f, 0.468312413f}, std::array<float,2>{0.941933513f, 0.0187484808f}, std::array<float,2>{0.11922197f, 0.795354962f}, std::array<float,2>{0.818768919f, 0.979393661f}, std::array<float,2>{0.129698187f, 0.156977192f}, std::array<float,2>{0.631398022f, 0.334110439f}, std::array<float,2>{0.473468542f, 0.553345144f}, std::array<float,2>{0.925964475f, 0.572469115f}, std::array<float,2>{0.0311392322f, 0.251936048f}, std::array<float,2>{0.515046477f, 0.249719292f}, std::array<float,2>{0.360678077f, 0.921416342f}, std::array<float,2>{0.730757177f, 0.855530381f}, std::array<float,2>{0.392736465f, 0.0645302758f}, std::array<float,2>{0.788946688f, 0.41628328f}, std::array<float,2>{0.242388904f, 0.638908446f}, std::array<float,2>{0.656331658f, 0.516567111f}, std::array<float,2>{0.448360771f, 0.356319249f}, std::array<float,2>{0.844449699f, 0.130263314f}, std::array<float,2>{0.172349647f, 0.965618968f}, std::array<float,2>{0.987639844f, 0.761363268f}, std::array<float,2>{0.0899267495f, 0.0419757366f}, std::array<float,2>{0.610572577f, 0.496970057f}, std::array<float,2>{0.260642976f, 0.725859642f}, std::array<float,2>{0.76809907f, 0.65819627f}, std::array<float,2>{0.215689063f, 0.388817847f}, std::array<float,2>{0.709632635f, 0.0963326842f}, std::array<float,2>{0.406554639f, 0.822512805f}, std::array<float,2>{0.537742436f, 0.897008955f}, std::array<float,2>{0.316357315f, 0.201435238f}, std::array<float,2>{0.896971762f, 0.303479671f}, std::array<float,2>{0.0483416691f, 0.611747026f}, std::array<float,2>{0.691158354f, 0.643359244f}, std::array<float,2>{0.436261624f, 0.437380463f}, std::array<float,2>{0.764434338f, 0.0825595483f}, std::array<float,2>{0.197098747f, 0.86207521f}, std::array<float,2>{0.877071202f, 0.936236501f}, std::array<float,2>{0.0412744507f, 0.227158442f}, std::array<float,2>{0.560239732f, 0.278494716f}, std::array<float,2>{0.340263993f, 0.592089593f}, std::array<float,2>{0.867519259f, 0.533266902f}, std::array<float,2>{0.16267404f, 0.327519685f}, std::array<float,2>{0.673654735f, 0.181015462f}, std::array<float,2>{0.459414482f, 0.997300744f}, std::array<float,2>{0.594305277f, 0.807305396f}, std::array<float,2>{0.27109322f, 0.000365668675f}, std::array<float,2>{0.972803771f, 0.451303661f}, std::array<float,2>{0.0640586391f, 0.694086969f}, std::array<float,2>{0.525793254f, 0.604070306f}, std::array<float,2>{0.358297735f, 0.291210622f}, std::array<float,2>{0.907884538f, 0.205416933f}, std::array<float,2>{0.0111512942f, 0.883788943f}, std::array<float,2>{0.797655642f, 0.838402331f}, std::array<float,2>{0.219827667f, 0.116265036f}, std::array<float,2>{0.736936271f, 0.402922541f}, std::array<float,2>{0.387725115f, 0.681511164f}, std::array<float,2>{0.96076417f, 0.735006392f}, std::array<float,2>{0.0945170224f, 0.478844404f}, std::array<float,2>{0.579587877f, 0.0582726821f}, std::array<float,2>{0.306249768f, 0.781221569f}, std::array<float,2>{0.642655015f, 0.945026398f}, std::array<float,2>{0.492705464f, 0.155285299f}, std::array<float,2>{0.837920785f, 0.372981995f}, std::array<float,2>{0.15398635f, 0.507300019f}, std::array<float,2>{0.553153276f, 0.676552296f}, std::array<float,2>{0.329678893f, 0.393913329f}, std::array<float,2>{0.889332712f, 0.123025f}, std::array<float,2>{0.033399988f, 0.835747361f}, std::array<float,2>{0.753180683f, 0.880498052f}, std::array<float,2>{0.188160375f, 0.216321364f}, std::array<float,2>{0.697019756f, 0.287802547f}, std::array<float,2>{0.424526811f, 0.60060823f}, std::array<float,2>{0.97749716f, 0.514235854f}, std::array<float,2>{0.0729496256f, 0.366496682f}, std::array<float,2>{0.606095135f, 0.147889018f}, std::array<float,2>{0.27813375f, 0.948120356f}, std::array<float,2>{0.681295037f, 0.770755172f}, std::array<float,2>{0.462626666f, 0.0517690554f}, std::array<float,2>{0.866663218f, 0.469844311f}, std::array<float,2>{0.164911687f, 0.744846344f}, std::array<float,2>{0.744017661f, 0.583969295f}, std::array<float,2>{0.375090688f, 0.273277491f}, std::array<float,2>{0.80633688f, 0.222712636f}, std::array<float,2>{0.230807021f, 0.927909791f}, std::array<float,2>{0.919481933f, 0.872083485f}, std::array<float,2>{0.00337537681f, 0.0906701833f}, std::array<float,2>{0.522493005f, 0.425091475f}, std::array<float,2>{0.348991096f, 0.648473918f}, std::array<float,2>{0.832050025f, 0.700056016f}, std::array<float,2>{0.14186354f, 0.443541855f}, std::array<float,2>{0.65561974f, 0.013577749f}, std::array<float,2>{0.486920327f, 0.801965415f}, std::array<float,2>{0.593076169f, 0.991851151f}, std::array<float,2>{0.303381801f, 0.178469867f}, std::array<float,2>{0.966152668f, 0.318289727f}, std::array<float,2>{0.108540587f, 0.539505899f}, std::array<float,2>{0.634339511f, 0.731895149f}, std::array<float,2>{0.476795167f, 0.485354155f}, std::array<float,2>{0.82443732f, 0.0346256867f}, std::array<float,2>{0.134257451f, 0.753109872f}, std::array<float,2>{0.950788498f, 0.959072232f}, std::array<float,2>{0.116024546f, 0.138368666f}, std::array<float,2>{0.564961314f, 0.347079813f}, std::array<float,2>{0.28167671f, 0.52974987f}, std::array<float,2>{0.796082497f, 0.622403979f}, std::array<float,2>{0.2419153f, 0.308322221f}, std::array<float,2>{0.721773326f, 0.187796295f}, std::array<float,2>{0.402684212f, 0.900597095f}, std::array<float,2>{0.506359279f, 0.816543758f}, std::array<float,2>{0.374531865f, 0.107469074f}, std::array<float,2>{0.932688951f, 0.375584066f}, std::array<float,2>{0.0162427314f, 0.670210242f}, std::array<float,2>{0.621447384f, 0.558529198f}, std::array<float,2>{0.255995899f, 0.338855952f}, std::array<float,2>{0.995917439f, 0.1641507f}, std::array<float,2>{0.0815703347f, 0.972870111f}, std::array<float,2>{0.853403151f, 0.786115229f}, std::array<float,2>{0.187385932f, 0.0245542899f}, std::array<float,2>{0.671553493f, 0.45973292f}, std::array<float,2>{0.442979574f, 0.709599435f}, std::array<float,2>{0.899455905f, 0.627578855f}, std::array<float,2>{0.0596175902f, 0.412673861f}, std::array<float,2>{0.54341042f, 0.0755901635f}, std::array<float,2>{0.320541739f, 0.846417189f}, std::array<float,2>{0.714491487f, 0.908128917f}, std::array<float,2>{0.419971704f, 0.238633007f}, std::array<float,2>{0.776488245f, 0.265033543f}, std::array<float,2>{0.208478317f, 0.567237496f}, std::array<float,2>{0.510720789f, 0.748040617f}, std::array<float,2>{0.364993602f, 0.4763363f}, std::array<float,2>{0.924516082f, 0.0496831127f}, std::array<float,2>{0.026840277f, 0.768361211f}, std::array<float,2>{0.784908295f, 0.952033222f}, std::array<float,2>{0.249009058f, 0.142754316f}, std::array<float,2>{0.728183389f, 0.360621691f}, std::array<float,2>{0.396613061f, 0.511451781f}, std::array<float,2>{0.938517213f, 0.593937218f}, std::array<float,2>{0.123886749f, 0.283119917f}, std::array<float,2>{0.571710408f, 0.213404045f}, std::array<float,2>{0.291755706f, 0.876864612f}, std::array<float,2>{0.627394319f, 0.828498542f}, std::array<float,2>{0.469603568f, 0.120499663f}, std::array<float,2>{0.815245748f, 0.396097004f}, std::array<float,2>{0.127870575f, 0.673094809f}, std::array<float,2>{0.703943372f, 0.543393373f}, std::array<float,2>{0.41025427f, 0.316103131f}, std::array<float,2>{0.771558762f, 0.173369914f}, std::array<float,2>{0.212159023f, 0.985110641f}, std::array<float,2>{0.891879022f, 0.799529791f}, std::array<float,2>{0.052819714f, 0.00986124016f}, std::array<float,2>{0.533278883f, 0.437757641f}, std::array<float,2>{0.318246007f, 0.698111773f}, std::array<float,2>{0.849634886f, 0.653128564f}, std::array<float,2>{0.177901193f, 0.42750445f}, std::array<float,2>{0.661541104f, 0.0880113989f}, std::array<float,2>{0.449255049f, 0.870066583f}, std::array<float,2>{0.615168214f, 0.922127485f}, std::array<float,2>{0.261959195f, 0.219083667f}, std::array<float,2>{0.98987329f, 0.267349541f}, std::array<float,2>{0.0897947028f, 0.580653608f}, std::array<float,2>{0.67595315f, 0.667076111f}, std::array<float,2>{0.456397861f, 0.381221801f}, std::array<float,2>{0.873171806f, 0.102089018f}, std::array<float,2>{0.15940097f, 0.81618458f}, std::array<float,2>{0.97203064f, 0.902558804f}, std::array<float,2>{0.0677505881f, 0.192769095f}, std::array<float,2>{0.598644674f, 0.31235683f}, std::array<float,2>{0.267317504f, 0.618864059f}, std::array<float,2>{0.759569228f, 0.523456693f}, std::array<float,2>{0.202643394f, 0.348498404f}, std::array<float,2>{0.693722904f, 0.136489391f}, std::array<float,2>{0.430175275f, 0.954289198f}, std::array<float,2>{0.555392683f, 0.756718934f}, std::array<float,2>{0.339135349f, 0.0383173116f}, std::array<float,2>{0.880765557f, 0.491115689f}, std::array<float,2>{0.0459661558f, 0.726841211f}, std::array<float,2>{0.584551156f, 0.563737214f}, std::array<float,2>{0.308757961f, 0.260022193f}, std::array<float,2>{0.953385949f, 0.235629663f}, std::array<float,2>{0.101446763f, 0.914018512f}, std::array<float,2>{0.839982331f, 0.851514578f}, std::array<float,2>{0.152210236f, 0.0712790564f}, std::array<float,2>{0.64814955f, 0.409655333f}, std::array<float,2>{0.498035103f, 0.631432176f}, std::array<float,2>{0.914037704f, 0.706667364f}, std::array<float,2>{0.0127543267f, 0.454216778f}, std::array<float,2>{0.527551472f, 0.0311602149f}, std::array<float,2>{0.352114528f, 0.783442736f}, std::array<float,2>{0.740782559f, 0.972395778f}, std::array<float,2>{0.384252816f, 0.168644428f}, std::array<float,2>{0.803771257f, 0.343385428f}, std::array<float,2>{0.226256743f, 0.561304271f}, std::array<float,2>{0.601872087f, 0.633431852f}, std::array<float,2>{0.275075585f, 0.418797195f}, std::array<float,2>{0.982717872f, 0.0680200681f}, std::array<float,2>{0.0777087882f, 0.852504432f}, std::array<float,2>{0.859425426f, 0.915076435f}, std::array<float,2>{0.169531867f, 0.244813979f}, std::array<float,2>{0.68390739f, 0.254008412f}, std::array<float,2>{0.468593717f, 0.575149357f}, std::array<float,2>{0.885541439f, 0.549475968f}, std::array<float,2>{0.0382056348f, 0.330589652f}, std::array<float,2>{0.550763965f, 0.161416441f}, std::array<float,2>{0.334626734f, 0.982453704f}, std::array<float,2>{0.701604486f, 0.791286826f}, std::array<float,2>{0.428802818f, 0.0209147818f}, std::array<float,2>{0.754396021f, 0.462668359f}, std::array<float,2>{0.194334969f, 0.713638008f}, std::array<float,2>{0.649645269f, 0.616135478f}, std::array<float,2>{0.491076708f, 0.300045103f}, std::array<float,2>{0.831919312f, 0.197491303f}, std::array<float,2>{0.145554692f, 0.892030478f}, std::array<float,2>{0.962944508f, 0.827664614f}, std::array<float,2>{0.102277413f, 0.0992672443f}, std::array<float,2>{0.586633146f, 0.384360552f}, std::array<float,2>{0.298408121f, 0.66343838f}, std::array<float,2>{0.809518754f, 0.71926558f}, std::array<float,2>{0.228547662f, 0.495673716f}, std::array<float,2>{0.746389925f, 0.0436711982f}, std::array<float,2>{0.380366176f, 0.762311161f}, std::array<float,2>{0.519306958f, 0.962311685f}, std::array<float,2>{0.34555465f, 0.126476601f}, std::array<float,2>{0.914823651f, 0.353006423f}, std::array<float,2>{0.00431575393f, 0.519620299f}, std::array<float,2>{0.722805679f, 0.690409064f}, std::array<float,2>{0.400892317f, 0.446319968f}, std::array<float,2>{0.789747298f, 0.00658741361f}, std::array<float,2>{0.235363573f, 0.810699284f}, std::array<float,2>{0.934959352f, 0.993335605f}, std::array<float,2>{0.0217050221f, 0.184481308f}, std::array<float,2>{0.503539085f, 0.322568506f}, std::array<float,2>{0.369635373f, 0.53904891f}, std::array<float,2>{0.824041486f, 0.588523448f}, std::array<float,2>{0.137314022f, 0.275712341f}, std::array<float,2>{0.637438655f, 0.232787386f}, std::array<float,2>{0.483222276f, 0.931455791f}, std::array<float,2>{0.570148289f, 0.86657548f}, std::array<float,2>{0.288982004f, 0.0811474547f}, std::array<float,2>{0.948986053f, 0.429956287f}, std::array<float,2>{0.111388482f, 0.645340979f}, std::array<float,2>{0.540561199f, 0.500355005f}, std::array<float,2>{0.324895471f, 0.367733508f}, std::array<float,2>{0.90365386f, 0.149873301f}, std::array<float,2>{0.0565934926f, 0.939983964f}, std::array<float,2>{0.779526949f, 0.776172936f}, std::array<float,2>{0.204330042f, 0.0620782264f}, std::array<float,2>{0.715199888f, 0.481596142f}, std::array<float,2>{0.415768266f, 0.741126955f}, std::array<float,2>{0.998198628f, 0.686254263f}, std::array<float,2>{0.0823922381f, 0.400469631f}, std::array<float,2>{0.617841721f, 0.109981075f}, std::array<float,2>{0.25045675f, 0.840506136f}, std::array<float,2>{0.664965391f, 0.888292015f}, std::array<float,2>{0.441095918f, 0.210681602f}, std::array<float,2>{0.859307051f, 0.293234944f}, std::array<float,2>{0.180768147f, 0.607632697f}, std::array<float,2>{0.611901343f, 0.724144816f}, std::array<float,2>{0.258200735f, 0.499442339f}, std::array<float,2>{0.984450936f, 0.0407467186f}, std::array<float,2>{0.0926434919f, 0.758847952f}, std::array<float,2>{0.845882535f, 0.967150867f}, std::array<float,2>{0.173929498f, 0.131679118f}, std::array<float,2>{0.659230769f, 0.358639121f}, std::array<float,2>{0.446039796f, 0.518526077f}, std::array<float,2>{0.894585252f, 0.610954583f}, std::array<float,2>{0.0501743406f, 0.302269548f}, std::array<float,2>{0.536119938f, 0.199937075f}, std::array<float,2>{0.313081622f, 0.895546794f}, std::array<float,2>{0.708592832f, 0.822231948f}, std::array<float,2>{0.40859291f, 0.0945064947f}, std::array<float,2>{0.76579088f, 0.386982977f}, std::array<float,2>{0.217024297f, 0.659591317f}, std::array<float,2>{0.629504263f, 0.550796092f}, std::array<float,2>{0.475431144f, 0.333654404f}, std::array<float,2>{0.818278432f, 0.158290893f}, std::array<float,2>{0.131787807f, 0.977623165f}, std::array<float,2>{0.944604576f, 0.793218732f}, std::array<float,2>{0.119100228f, 0.0169266816f}, std::array<float,2>{0.578010857f, 0.464927793f}, std::array<float,2>{0.293780714f, 0.715779722f}, std::array<float,2>{0.786729157f, 0.637974381f}, std::array<float,2>{0.24417825f, 0.41491279f}, std::array<float,2>{0.73331064f, 0.0625197068f}, std::array<float,2>{0.391388595f, 0.859144807f}, std::array<float,2>{0.513567328f, 0.918628275f}, std::array<float,2>{0.36313194f, 0.247880563f}, std::array<float,2>{0.929140568f, 0.252913415f}, std::array<float,2>{0.0274734627f, 0.571007669f}, std::array<float,2>{0.736154258f, 0.682308078f}, std::array<float,2>{0.390272617f, 0.40470165f}, std::array<float,2>{0.799354911f, 0.11354465f}, std::array<float,2>{0.221449167f, 0.836125553f}, std::array<float,2>{0.908326149f, 0.886084497f}, std::array<float,2>{0.00785227492f, 0.203713283f}, std::array<float,2>{0.524338841f, 0.29061085f}, std::array<float,2>{0.356143206f, 0.602711976f}, std::array<float,2>{0.836794615f, 0.505141318f}, std::array<float,2>{0.154852986f, 0.373135358f}, std::array<float,2>{0.641434491f, 0.152993843f}, std::array<float,2>{0.496033281f, 0.942382932f}, std::array<float,2>{0.580927312f, 0.778483808f}, std::array<float,2>{0.308450937f, 0.0562524162f}, std::array<float,2>{0.95849824f, 0.47669816f}, std::array<float,2>{0.0958433747f, 0.737415671f}, std::array<float,2>{0.561776161f, 0.591210067f}, std::array<float,2>{0.343080431f, 0.28121531f}, std::array<float,2>{0.876281261f, 0.22959806f}, std::array<float,2>{0.0398339666f, 0.934755385f}, std::array<float,2>{0.76273936f, 0.859689832f}, std::array<float,2>{0.197939664f, 0.0854857266f}, std::array<float,2>{0.688844204f, 0.434823483f}, std::array<float,2>{0.434347421f, 0.640845716f}, std::array<float,2>{0.974765718f, 0.692039728f}, std::array<float,2>{0.0658296645f, 0.449969977f}, std::array<float,2>{0.59574753f, 0.00326033938f}, std::array<float,2>{0.273091495f, 0.80661571f}, std::array<float,2>{0.674496651f, 0.99826175f}, std::array<float,2>{0.458494037f, 0.183255091f}, std::array<float,2>{0.869709074f, 0.325200796f}, std::array<float,2>{0.160801589f, 0.531686544f}, std::array<float,2>{0.519688666f, 0.652234554f}, std::array<float,2>{0.350680888f, 0.423691481f}, std::array<float,2>{0.920191705f, 0.0931102186f}, std::array<float,2>{0.000825669907f, 0.873829305f}, std::array<float,2>{0.806861341f, 0.927374184f}, std::array<float,2>{0.232472882f, 0.225312665f}, std::array<float,2>{0.745556831f, 0.270571768f}, std::array<float,2>{0.378799796f, 0.585509539f}, std::array<float,2>{0.967650831f, 0.541052043f}, std::array<float,2>{0.106909841f, 0.319938034f}, std::array<float,2>{0.590041757f, 0.177297428f}, std::array<float,2>{0.301057696f, 0.989887893f}, std::array<float,2>{0.653837323f, 0.804035544f}, std::array<float,2>{0.485185206f, 0.0150083741f}, std::array<float,2>{0.834484756f, 0.443255454f}, std::array<float,2>{0.143097192f, 0.701399684f}, std::array<float,2>{0.697838306f, 0.599224448f}, std::array<float,2>{0.422431588f, 0.285965621f}, std::array<float,2>{0.751085162f, 0.217764631f}, std::array<float,2>{0.190962657f, 0.881668985f}, std::array<float,2>{0.886813998f, 0.833758652f}, std::array<float,2>{0.0322429575f, 0.123781942f}, std::array<float,2>{0.551780701f, 0.392531991f}, std::array<float,2>{0.330568194f, 0.679591119f}, std::array<float,2>{0.86491698f, 0.742213964f}, std::array<float,2>{0.166230679f, 0.471240789f}, std::array<float,2>{0.682545841f, 0.0537014231f}, std::array<float,2>{0.462919533f, 0.771766901f}, std::array<float,2>{0.608470798f, 0.946152747f}, std::array<float,2>{0.280515164f, 0.145400956f}, std::array<float,2>{0.979541004f, 0.364274651f}, std::array<float,2>{0.0710266382f, 0.512554586f}, std::array<float,2>{0.668985307f, 0.707706749f}, std::array<float,2>{0.444776416f, 0.458139211f}, std::array<float,2>{0.855292857f, 0.0270285662f}, std::array<float,2>{0.184699193f, 0.78806299f}, std::array<float,2>{0.992384493f, 0.97543335f}, std::array<float,2>{0.0787477121f, 0.167277664f}, std::array<float,2>{0.624834299f, 0.336498439f}, std::array<float,2>{0.253995031f, 0.555381f}, std::array<float,2>{0.774868071f, 0.569609284f}, std::array<float,2>{0.210854128f, 0.262764007f}, std::array<float,2>{0.711480618f, 0.242031857f}, std::array<float,2>{0.419662505f, 0.908569872f}, std::array<float,2>{0.546245813f, 0.843971729f}, std::array<float,2>{0.323735267f, 0.0768112242f}, std::array<float,2>{0.902168214f, 0.410906821f}, std::array<float,2>{0.0605778322f, 0.626121581f}, std::array<float,2>{0.563157022f, 0.528051913f}, std::array<float,2>{0.283430964f, 0.344275415f}, std::array<float,2>{0.952795744f, 0.139924526f}, std::array<float,2>{0.113911733f, 0.957234859f}, std::array<float,2>{0.827139676f, 0.751799345f}, std::array<float,2>{0.136039719f, 0.0325632691f}, std::array<float,2>{0.634853065f, 0.487318337f}, std::array<float,2>{0.480348021f, 0.733551383f}, std::array<float,2>{0.929755092f, 0.669364393f}, std::array<float,2>{0.0176013075f, 0.378219634f}, std::array<float,2>{0.504107893f, 0.106982477f}, std::array<float,2>{0.372848511f, 0.819304228f}, std::array<float,2>{0.71971947f, 0.89995569f}, std::array<float,2>{0.404475749f, 0.18968153f}, std::array<float,2>{0.7943542f, 0.30502665f}, std::array<float,2>{0.240017861f, 0.62480849f}, std::array<float,2>{0.53191793f, 0.695939064f}, std::array<float,2>{0.319328427f, 0.441062003f}, std::array<float,2>{0.894327581f, 0.00932040904f}, std::array<float,2>{0.050865259f, 0.798760772f}, std::array<float,2>{0.770543635f, 0.987612367f}, std::array<float,2>{0.214783147f, 0.175326928f}, std::array<float,2>{0.7059021f, 0.313119739f}, std::array<float,2>{0.413532853f, 0.545059562f}, std::array<float,2>{0.991906881f, 0.578163087f}, std::array<float,2>{0.0868168026f, 0.268023551f}, std::array<float,2>{0.61658597f, 0.220901281f}, std::array<float,2>{0.265250802f, 0.924725592f}, std::array<float,2>{0.662813067f, 0.869095683f}, std::array<float,2>{0.453046262f, 0.0876751095f}, std::array<float,2>{0.848137259f, 0.428094506f}, std::array<float,2>{0.1763504f, 0.655269444f}, std::array<float,2>{0.729035258f, 0.509056568f}, std::array<float,2>{0.395362079f, 0.362472832f}, std::array<float,2>{0.782572329f, 0.140810087f}, std::array<float,2>{0.247162923f, 0.950070918f}, std::array<float,2>{0.922195435f, 0.766548514f}, std::array<float,2>{0.0238083117f, 0.0480038077f}, std::array<float,2>{0.509046793f, 0.474586457f}, std::array<float,2>{0.36543411f, 0.748333454f}, std::array<float,2>{0.812867761f, 0.674206436f}, std::array<float,2>{0.126051396f, 0.397050321f}, std::array<float,2>{0.625259101f, 0.117253952f}, std::array<float,2>{0.471887469f, 0.830973566f}, std::array<float,2>{0.574020147f, 0.87868011f}, std::array<float,2>{0.289868504f, 0.212638617f}, std::array<float,2>{0.940199912f, 0.283939719f}, std::array<float,2>{0.122150712f, 0.595792532f}, std::array<float,2>{0.645980239f, 0.630253792f}, std::array<float,2>{0.498267829f, 0.407879323f}, std::array<float,2>{0.842890263f, 0.0728661865f}, std::array<float,2>{0.149261042f, 0.847807944f}, std::array<float,2>{0.956297934f, 0.910583258f}, std::array<float,2>{0.0976666138f, 0.237135425f}, std::array<float,2>{0.58222127f, 0.2586312f}, std::array<float,2>{0.311063021f, 0.565303087f}, std::array<float,2>{0.800887108f, 0.558651686f}, std::array<float,2>{0.224207729f, 0.3410981f}, std::array<float,2>{0.739342153f, 0.171808541f}, std::array<float,2>{0.386687249f, 0.970354736f}, std::array<float,2>{0.529828727f, 0.782184362f}, std::array<float,2>{0.35366869f, 0.0284865033f}, std::array<float,2>{0.912093043f, 0.456269652f}, std::array<float,2>{0.0144816255f, 0.704208016f}, std::array<float,2>{0.600509524f, 0.620623469f}, std::array<float,2>{0.269492775f, 0.309770316f}, std::array<float,2>{0.968971133f, 0.194349065f}, std::array<float,2>{0.0694011822f, 0.906237662f}, std::array<float,2>{0.871864676f, 0.812623084f}, std::array<float,2>{0.15668644f, 0.10373231f}, std::array<float,2>{0.678961694f, 0.379137248f}, std::array<float,2>{0.453131229f, 0.664427817f}, std::array<float,2>{0.882499278f, 0.730013609f}, std::array<float,2>{0.0444354564f, 0.488829046f}, std::array<float,2>{0.558077872f, 0.035784889f}, std::array<float,2>{0.337776124f, 0.754875124f}, std::array<float,2>{0.692593753f, 0.955946863f}, std::array<float,2>{0.432488382f, 0.133109838f}, std::array<float,2>{0.761114836f, 0.350480765f}, std::array<float,2>{0.200670436f, 0.526453197f}, std::array<float,2>{0.589709163f, 0.660355628f}, std::array<float,2>{0.300337493f, 0.385914862f}, std::array<float,2>{0.961339474f, 0.0997272432f}, std::array<float,2>{0.105173744f, 0.824921966f}, std::array<float,2>{0.828945756f, 0.892871141f}, std::array<float,2>{0.1480584f, 0.196408838f}, std::array<float,2>{0.651098073f, 0.297411174f}, std::array<float,2>{0.489795357f, 0.614021063f}, std::array<float,2>{0.916441083f, 0.523068547f}, std::array<float,2>{0.00777910836f, 0.354956746f}, std::array<float,2>{0.516282916f, 0.128238216f}, std::array<float,2>{0.347221494f, 0.964418292f}, std::array<float,2>{0.748822868f, 0.764265239f}, std::array<float,2>{0.381185174f, 0.0468454137f}, std::array<float,2>{0.811416566f, 0.49243632f}, std::array<float,2>{0.227619171f, 0.721045136f}, std::array<float,2>{0.685974181f, 0.577306151f}, std::array<float,2>{0.465503067f, 0.2576738f}, std::array<float,2>{0.862830222f, 0.243867591f}, std::array<float,2>{0.170786932f, 0.917061985f}, std::array<float,2>{0.981173396f, 0.854061425f}, std::array<float,2>{0.0756041482f, 0.0688239112f}, std::array<float,2>{0.603605151f, 0.421361029f}, std::array<float,2>{0.277270406f, 0.635092795f}, std::array<float,2>{0.756644428f, 0.71099025f}, std::array<float,2>{0.193167686f, 0.464205742f}, std::array<float,2>{0.699630082f, 0.0219100434f}, std::array<float,2>{0.426136762f, 0.790785432f}, std::array<float,2>{0.547050476f, 0.982015312f}, std::array<float,2>{0.333876252f, 0.162784755f}, std::array<float,2>{0.884206295f, 0.32832247f}, std::array<float,2>{0.0363537669f, 0.547283709f}, std::array<float,2>{0.717643976f, 0.738797665f}, std::array<float,2>{0.4169375f, 0.483366758f}, std::array<float,2>{0.779117227f, 0.0587918609f}, std::array<float,2>{0.206031322f, 0.774596214f}, std::array<float,2>{0.905491889f, 0.937502384f}, std::array<float,2>{0.0579264425f, 0.151572987f}, std::array<float,2>{0.542808414f, 0.369678706f}, std::array<float,2>{0.327676535f, 0.503751576f}, std::array<float,2>{0.857191741f, 0.605917573f}, std::array<float,2>{0.18290481f, 0.29580906f}, std::array<float,2>{0.667163551f, 0.20831646f}, std::array<float,2>{0.438357919f, 0.890510798f}, std::array<float,2>{0.620128989f, 0.842933476f}, std::array<float,2>{0.25343129f, 0.113018483f}, std::array<float,2>{0.996341169f, 0.400144488f}, std::array<float,2>{0.0849651769f, 0.683760345f}, std::array<float,2>{0.5010131f, 0.536123693f}, std::array<float,2>{0.368386865f, 0.322143584f}, std::array<float,2>{0.935969591f, 0.186261281f}, std::array<float,2>{0.0197710544f, 0.99604398f}, std::array<float,2>{0.792327464f, 0.809384108f}, std::array<float,2>{0.238242343f, 0.00548119005f}, std::array<float,2>{0.726013839f, 0.449052244f}, std::array<float,2>{0.399060458f, 0.687832594f}, std::array<float,2>{0.946347475f, 0.646741927f}, std::array<float,2>{0.110773109f, 0.431910485f}, std::array<float,2>{0.568337798f, 0.0794881731f}, std::array<float,2>{0.286955953f, 0.86428529f}, std::array<float,2>{0.639387488f, 0.93312937f}, std::array<float,2>{0.48124069f, 0.2308034f}, std::array<float,2>{0.820638418f, 0.273988426f}, std::array<float,2>{0.139275461f, 0.586939871f}, std::array<float,2>{0.578485727f, 0.737119496f}, std::array<float,2>{0.304912478f, 0.47791934f}, std::array<float,2>{0.959902227f, 0.0547223426f}, std::array<float,2>{0.0952911079f, 0.77794224f}, std::array<float,2>{0.83981806f, 0.941621304f}, std::array<float,2>{0.152507469f, 0.153529137f}, std::array<float,2>{0.643697977f, 0.374836922f}, std::array<float,2>{0.493323833f, 0.504529178f}, std::array<float,2>{0.907093525f, 0.601805031f}, std::array<float,2>{0.00989477243f, 0.289688647f}, std::array<float,2>{0.52692908f, 0.204310268f}, std::array<float,2>{0.359313399f, 0.884837508f}, std::array<float,2>{0.737846255f, 0.837210834f}, std::array<float,2>{0.386849016f, 0.114469782f}, std::array<float,2>{0.7981323f, 0.405739397f}, std::array<float,2>{0.219428957f, 0.683590651f}, std::array<float,2>{0.672688067f, 0.532612503f}, std::array<float,2>{0.459988028f, 0.324325532f}, std::array<float,2>{0.86825484f, 0.182094097f}, std::array<float,2>{0.163886577f, 0.999842107f}, std::array<float,2>{0.974000633f, 0.804795802f}, std::array<float,2>{0.0628864244f, 0.00265976181f}, std::array<float,2>{0.594848156f, 0.450606644f}, std::array<float,2>{0.269850016f, 0.693104029f}, std::array<float,2>{0.765612543f, 0.642264903f}, std::array<float,2>{0.196083173f, 0.434538662f}, std::array<float,2>{0.68998301f, 0.0842952058f}, std::array<float,2>{0.437053263f, 0.861256957f}, std::array<float,2>{0.559435129f, 0.933650076f}, std::array<float,2>{0.341626227f, 0.228684396f}, std::array<float,2>{0.878216326f, 0.279618561f}, std::array<float,2>{0.0422491245f, 0.590256989f}, std::array<float,2>{0.710609198f, 0.659152448f}, std::array<float,2>{0.408107847f, 0.388394803f}, std::array<float,2>{0.769390166f, 0.0953214839f}, std::array<float,2>{0.215954036f, 0.821251512f}, std::array<float,2>{0.898132145f, 0.894642293f}, std::array<float,2>{0.0478212647f, 0.20033358f}, std::array<float,2>{0.538647413f, 0.301086336f}, std::array<float,2>{0.315041423f, 0.609512031f}, std::array<float,2>{0.845304191f, 0.51881963f}, std::array<float,2>{0.173694551f, 0.357946306f}, std::array<float,2>{0.657460332f, 0.132092804f}, std::array<float,2>{0.448149145f, 0.968576729f}, std::array<float,2>{0.609783709f, 0.75789386f}, std::array<float,2>{0.26086691f, 0.0394814871f}, std::array<float,2>{0.986466348f, 0.498716086f}, std::array<float,2>{0.0908544809f, 0.72347033f}, std::array<float,2>{0.513945222f, 0.571518183f}, std::array<float,2>{0.359920144f, 0.253722161f}, std::array<float,2>{0.927020252f, 0.246550709f}, std::array<float,2>{0.0301664807f, 0.919322789f}, std::array<float,2>{0.788070023f, 0.857774615f}, std::array<float,2>{0.243666336f, 0.063955009f}, std::array<float,2>{0.732207298f, 0.41547358f}, std::array<float,2>{0.393752992f, 0.636865854f}, std::array<float,2>{0.942839265f, 0.716309845f}, std::array<float,2>{0.120300137f, 0.466332465f}, std::array<float,2>{0.57612139f, 0.0159470085f}, std::array<float,2>{0.295383573f, 0.7944628f}, std::array<float,2>{0.632206559f, 0.977538168f}, std::array<float,2>{0.474492908f, 0.159555644f}, std::array<float,2>{0.81970489f, 0.332372099f}, std::array<float,2>{0.130488202f, 0.55235815f}, std::array<float,2>{0.544066012f, 0.625803113f}, std::array<float,2>{0.321963578f, 0.411928087f}, std::array<float,2>{0.898955584f, 0.0775969923f}, std::array<float,2>{0.0591695644f, 0.845540285f}, std::array<float,2>{0.776236653f, 0.909657359f}, std::array<float,2>{0.207806215f, 0.241152734f}, std::array<float,2>{0.71367389f, 0.262396634f}, std::array<float,2>{0.421466559f, 0.568622649f}, std::array<float,2>{0.994168103f, 0.556240201f}, std::array<float,2>{0.0801108479f, 0.337036461f}, std::array<float,2>{0.622431159f, 0.166933149f}, std::array<float,2>{0.257363617f, 0.975657105f}, std::array<float,2>{0.67056042f, 0.788608491f}, std::array<float,2>{0.441855133f, 0.0263579432f}, std::array<float,2>{0.852530599f, 0.457942218f}, std::array<float,2>{0.185573623f, 0.708475232f}, std::array<float,2>{0.72129184f, 0.623290181f}, std::array<float,2>{0.404105186f, 0.305720061f}, std::array<float,2>{0.795304239f, 0.191212997f}, std::array<float,2>{0.240784898f, 0.898444772f}, std::array<float,2>{0.932024956f, 0.819626212f}, std::array<float,2>{0.016652042f, 0.106308647f}, std::array<float,2>{0.50728327f, 0.377345085f}, std::array<float,2>{0.373734981f, 0.668861985f}, std::array<float,2>{0.825550318f, 0.733300447f}, std::array<float,2>{0.133547455f, 0.486464411f}, std::array<float,2>{0.63343066f, 0.031885419f}, std::array<float,2>{0.478382528f, 0.750557005f}, std::array<float,2>{0.565748513f, 0.958402276f}, std::array<float,2>{0.282316566f, 0.138929039f}, std::array<float,2>{0.949229479f, 0.345691323f}, std::array<float,2>{0.117109962f, 0.529077947f}, std::array<float,2>{0.654593289f, 0.702537477f}, std::array<float,2>{0.488167405f, 0.44154337f}, std::array<float,2>{0.833024383f, 0.0143943895f}, std::array<float,2>{0.141512528f, 0.803330779f}, std::array<float,2>{0.965812862f, 0.98830539f}, std::array<float,2>{0.108316407f, 0.175897971f}, std::array<float,2>{0.592576027f, 0.319130391f}, std::array<float,2>{0.304676741f, 0.542295158f}, std::array<float,2>{0.80520457f, 0.584716976f}, std::array<float,2>{0.232268319f, 0.270467341f}, std::array<float,2>{0.742698491f, 0.226093605f}, std::array<float,2>{0.376449347f, 0.926311016f}, std::array<float,2>{0.52170974f, 0.874185443f}, std::array<float,2>{0.348140985f, 0.0917973593f}, std::array<float,2>{0.918805957f, 0.422188431f}, std::array<float,2>{0.00264782109f, 0.650529861f}, std::array<float,2>{0.606754184f, 0.513085365f}, std::array<float,2>{0.279002815f, 0.363807678f}, std::array<float,2>{0.978048563f, 0.146430254f}, std::array<float,2>{0.0733547658f, 0.947052181f}, std::array<float,2>{0.865249574f, 0.773275733f}, std::array<float,2>{0.16543968f, 0.0545049831f}, std::array<float,2>{0.680461526f, 0.472651154f}, std::array<float,2>{0.461103171f, 0.744057715f}, std::array<float,2>{0.890289903f, 0.678610921f}, std::array<float,2>{0.0348928161f, 0.391482651f}, std::array<float,2>{0.554237664f, 0.124167189f}, std::array<float,2>{0.329016209f, 0.832779408f}, std::array<float,2>{0.695970476f, 0.882470548f}, std::array<float,2>{0.425428838f, 0.218142346f}, std::array<float,2>{0.752066612f, 0.286773264f}, std::array<float,2>{0.188486576f, 0.598146856f}, std::array<float,2>{0.528954685f, 0.70405978f}, std::array<float,2>{0.352696836f, 0.455317497f}, std::array<float,2>{0.912992001f, 0.0281300526f}, std::array<float,2>{0.0120312274f, 0.782269597f}, std::array<float,2>{0.803353965f, 0.96954f}, std::array<float,2>{0.225551412f, 0.170564905f}, std::array<float,2>{0.741329014f, 0.340484977f}, std::array<float,2>{0.383216888f, 0.560269356f}, std::array<float,2>{0.954523027f, 0.566161573f}, std::array<float,2>{0.0996352807f, 0.25894931f}, std::array<float,2>{0.585401833f, 0.237748951f}, std::array<float,2>{0.310160547f, 0.911769152f}, std::array<float,2>{0.646564841f, 0.849427938f}, std::array<float,2>{0.497053474f, 0.0740563348f}, std::array<float,2>{0.840924382f, 0.406922936f}, std::array<float,2>{0.151124433f, 0.629758775f}, std::array<float,2>{0.695050359f, 0.525551438f}, std::array<float,2>{0.431448728f, 0.351047724f}, std::array<float,2>{0.758278549f, 0.133865818f}, std::array<float,2>{0.202105835f, 0.956916809f}, std::array<float,2>{0.879577279f, 0.75564301f}, std::array<float,2>{0.0449630022f, 0.0367370695f}, std::array<float,2>{0.55612421f, 0.4895989f}, std::array<float,2>{0.33877036f, 0.729432583f}, std::array<float,2>{0.874987483f, 0.665296435f}, std::array<float,2>{0.159108847f, 0.380144209f}, std::array<float,2>{0.677139759f, 0.104636937f}, std::array<float,2>{0.455395699f, 0.814255536f}, std::array<float,2>{0.597747445f, 0.90478766f}, std::array<float,2>{0.266544014f, 0.19430998f}, std::array<float,2>{0.970903635f, 0.309280396f}, std::array<float,2>{0.0665160418f, 0.619839489f}, std::array<float,2>{0.660535395f, 0.65599823f}, std::array<float,2>{0.450949341f, 0.428986013f}, std::array<float,2>{0.851135492f, 0.0859707296f}, std::array<float,2>{0.17958501f, 0.867589414f}, std::array<float,2>{0.988491714f, 0.925572872f}, std::array<float,2>{0.0887545124f, 0.221774876f}, std::array<float,2>{0.614139199f, 0.269056231f}, std::array<float,2>{0.263632298f, 0.579707026f}, std::array<float,2>{0.772982717f, 0.546214402f}, std::array<float,2>{0.211843193f, 0.313783288f}, std::array<float,2>{0.704202294f, 0.174188703f}, std::array<float,2>{0.411657363f, 0.987089157f}, std::array<float,2>{0.534851909f, 0.796945751f}, std::array<float,2>{0.317252517f, 0.00837953296f}, std::array<float,2>{0.890794337f, 0.439705282f}, std::array<float,2>{0.0544670336f, 0.696321428f}, std::array<float,2>{0.570970237f, 0.597192526f}, std::array<float,2>{0.292432576f, 0.284702957f}, std::array<float,2>{0.937970161f, 0.211609304f}, std::array<float,2>{0.124036014f, 0.877718866f}, std::array<float,2>{0.81564641f, 0.831338048f}, std::array<float,2>{0.128408805f, 0.11823801f}, std::array<float,2>{0.628019631f, 0.397871405f}, std::array<float,2>{0.470106661f, 0.674881399f}, std::array<float,2>{0.925692201f, 0.749755263f}, std::array<float,2>{0.026169857f, 0.472881854f}, std::array<float,2>{0.511324644f, 0.0474515893f}, std::array<float,2>{0.363411605f, 0.76708895f}, std::array<float,2>{0.727417827f, 0.950725675f}, std::array<float,2>{0.397879124f, 0.142048106f}, std::array<float,2>{0.783792436f, 0.36172241f}, std::array<float,2>{0.249932408f, 0.508085012f}, std::array<float,2>{0.618798435f, 0.684924066f}, std::array<float,2>{0.251765937f, 0.398936152f}, std::array<float,2>{0.999832988f, 0.11155539f}, std::array<float,2>{0.0833671838f, 0.842188835f}, std::array<float,2>{0.857490897f, 0.889005959f}, std::array<float,2>{0.179923356f, 0.207526922f}, std::array<float,2>{0.665636539f, 0.296446502f}, std::array<float,2>{0.440153658f, 0.607028186f}, std::array<float,2>{0.902631938f, 0.501983881f}, std::array<float,2>{0.0551153682f, 0.370356292f}, std::array<float,2>{0.53994143f, 0.151309058f}, std::array<float,2>{0.32611981f, 0.939074874f}, std::array<float,2>{0.716126323f, 0.773598731f}, std::array<float,2>{0.414718151f, 0.0597295761f}, std::array<float,2>{0.781221867f, 0.483931541f}, std::array<float,2>{0.203853935f, 0.739456654f}, std::array<float,2>{0.637806773f, 0.586216807f}, std::array<float,2>{0.484152049f, 0.274823606f}, std::array<float,2>{0.822434366f, 0.232308671f}, std::array<float,2>{0.138481349f, 0.931660652f}, std::array<float,2>{0.947607398f, 0.86329335f}, std::array<float,2>{0.112812705f, 0.0781328678f}, std::array<float,2>{0.569033921f, 0.433307081f}, std::array<float,2>{0.28779617f, 0.647738695f}, std::array<float,2>{0.79063195f, 0.688559592f}, std::array<float,2>{0.234704927f, 0.447448671f}, std::array<float,2>{0.724589467f, 0.00402845256f}, std::array<float,2>{0.401666582f, 0.809588134f}, std::array<float,2>{0.502135873f, 0.994501114f}, std::array<float,2>{0.37087658f, 0.187233359f}, std::array<float,2>{0.934265673f, 0.321284652f}, std::array<float,2>{0.023282066f, 0.536355436f}, std::array<float,2>{0.74775517f, 0.722359002f}, std::array<float,2>{0.37910229f, 0.493246406f}, std::array<float,2>{0.810008705f, 0.0456717014f}, std::array<float,2>{0.230044842f, 0.764751971f}, std::array<float,2>{0.915795326f, 0.963743567f}, std::array<float,2>{0.0049499562f, 0.12784557f}, std::array<float,2>{0.518537998f, 0.354233027f}, std::array<float,2>{0.344158411f, 0.522185028f}, std::array<float,2>{0.830290973f, 0.614511371f}, std::array<float,2>{0.144721299f, 0.297941536f}, std::array<float,2>{0.648953199f, 0.196222559f}, std::array<float,2>{0.49135083f, 0.89438802f}, std::array<float,2>{0.587342501f, 0.825421572f}, std::array<float,2>{0.297070503f, 0.100670993f}, std::array<float,2>{0.964388072f, 0.385045707f}, std::array<float,2>{0.102556109f, 0.661631346f}, std::array<float,2>{0.549059212f, 0.548824728f}, std::array<float,2>{0.335201472f, 0.3299281f}, std::array<float,2>{0.8865785f, 0.163833484f}, std::array<float,2>{0.037876498f, 0.980840862f}, std::array<float,2>{0.755396545f, 0.789162397f}, std::array<float,2>{0.195181444f, 0.0232773684f}, std::array<float,2>{0.702824175f, 0.46308893f}, std::array<float,2>{0.427959144f, 0.712768137f}, std::array<float,2>{0.983976126f, 0.636502862f}, std::array<float,2>{0.0767213851f, 0.420447975f}, std::array<float,2>{0.602824867f, 0.0695641115f}, std::array<float,2>{0.274127871f, 0.854571342f}, std::array<float,2>{0.685117722f, 0.916583419f}, std::array<float,2>{0.4676328f, 0.242851406f}, std::array<float,2>{0.860527813f, 0.256210297f}, std::array<float,2>{0.168593779f, 0.576713681f}, std::array<float,2>{0.596766114f, 0.695263386f}, std::array<float,2>{0.271758586f, 0.452413052f}, std::array<float,2>{0.97634387f, 0.00116722588f}, std::array<float,2>{0.064507477f, 0.807759464f}, std::array<float,2>{0.870651782f, 0.99633348f}, std::array<float,2>{0.161385581f, 0.180360988f}, std::array<float,2>{0.675004065f, 0.327006102f}, std::array<float,2>{0.457344472f, 0.535028219f}, std::array<float,2>{0.875591636f, 0.593738794f}, std::array<float,2>{0.0409256667f, 0.278070122f}, std::array<float,2>{0.560773611f, 0.227547631f}, std::array<float,2>{0.342027128f, 0.937101245f}, std::array<float,2>{0.687606096f, 0.862950921f}, std::array<float,2>{0.434928149f, 0.0838003978f}, std::array<float,2>{0.761903226f, 0.43636632f}, std::array<float,2>{0.198689714f, 0.643569171f}, std::array<float,2>{0.642015755f, 0.506351054f}, std::array<float,2>{0.495050043f, 0.37144357f}, std::array<float,2>{0.837687433f, 0.154685065f}, std::array<float,2>{0.156231046f, 0.943765163f}, std::array<float,2>{0.95741421f, 0.779610336f}, std::array<float,2>{0.0975483134f, 0.0575643219f}, std::array<float,2>{0.581291497f, 0.479850739f}, std::array<float,2>{0.307183832f, 0.735463679f}, std::array<float,2>{0.800708055f, 0.680103362f}, std::array<float,2>{0.222439274f, 0.403570443f}, std::array<float,2>{0.735096097f, 0.115589142f}, std::array<float,2>{0.389166206f, 0.838920653f}, std::array<float,2>{0.525209486f, 0.884632826f}, std::array<float,2>{0.356470466f, 0.206167445f}, std::array<float,2>{0.90954119f, 0.292770922f}, std::array<float,2>{0.00950142741f, 0.605350196f}, std::array<float,2>{0.734203219f, 0.640396237f}, std::array<float,2>{0.392005235f, 0.417452127f}, std::array<float,2>{0.785922706f, 0.0658847466f}, std::array<float,2>{0.245121792f, 0.856707633f}, std::array<float,2>{0.927875817f, 0.920125723f}, std::array<float,2>{0.029073555f, 0.248398542f}, std::array<float,2>{0.512588799f, 0.250371933f}, std::array<float,2>{0.361391038f, 0.574098587f}, std::array<float,2>{0.817110419f, 0.554380357f}, std::array<float,2>{0.132501215f, 0.33496657f}, std::array<float,2>{0.63059634f, 0.158003137f}, std::array<float,2>{0.475628793f, 0.979498446f}, std::array<float,2>{0.577053368f, 0.795960724f}, std::array<float,2>{0.294150263f, 0.0181202758f}, std::array<float,2>{0.943856537f, 0.466872305f}, std::array<float,2>{0.11794547f, 0.717860043f}, std::array<float,2>{0.536795735f, 0.612538159f}, std::array<float,2>{0.313980103f, 0.304610342f}, std::array<float,2>{0.89605397f, 0.202722147f}, std::array<float,2>{0.0494803116f, 0.897794425f}, std::array<float,2>{0.767229617f, 0.823610783f}, std::array<float,2>{0.21841222f, 0.0970126167f}, std::array<float,2>{0.707381606f, 0.389836997f}, std::array<float,2>{0.409857959f, 0.656375766f}, std::array<float,2>{0.986213624f, 0.724897861f}, std::array<float,2>{0.0935567021f, 0.497868568f}, std::array<float,2>{0.613274336f, 0.0420777649f}, std::array<float,2>{0.259518772f, 0.75979197f}, std::array<float,2>{0.658948183f, 0.966416419f}, std::array<float,2>{0.446710616f, 0.129035339f}, std::array<float,2>{0.847424865f, 0.35698992f}, std::array<float,2>{0.174991161f, 0.516946733f}, std::array<float,2>{0.505153894f, 0.67137301f}, std::array<float,2>{0.371446103f, 0.376857966f}, std::array<float,2>{0.930861294f, 0.108700208f}, std::array<float,2>{0.0185790285f, 0.818152547f}, std::array<float,2>{0.793311119f, 0.901618123f}, std::array<float,2>{0.238344803f, 0.189339817f}, std::array<float,2>{0.720093071f, 0.306960106f}, std::array<float,2>{0.405444503f, 0.621234059f}, std::array<float,2>{0.951304436f, 0.53038156f}, std::array<float,2>{0.114631996f, 0.345995605f}, std::array<float,2>{0.564351916f, 0.13747476f}, std::array<float,2>{0.284233272f, 0.960125327f}, std::array<float,2>{0.63623935f, 0.752023101f}, std::array<float,2>{0.478693187f, 0.034001112f}, std::array<float,2>{0.827224016f, 0.484656006f}, std::array<float,2>{0.135546416f, 0.731372714f}, std::array<float,2>{0.711965144f, 0.568358421f}, std::array<float,2>{0.418129027f, 0.264146656f}, std::array<float,2>{0.774166048f, 0.239272088f}, std::array<float,2>{0.209692061f, 0.906668186f}, std::array<float,2>{0.900528967f, 0.846705317f}, std::array<float,2>{0.0622300282f, 0.0749229267f}, std::array<float,2>{0.545106292f, 0.413874924f}, std::array<float,2>{0.322819918f, 0.628740907f}, std::array<float,2>{0.853675961f, 0.710117996f}, std::array<float,2>{0.184457108f, 0.460471034f}, std::array<float,2>{0.668787181f, 0.0234874487f}, std::array<float,2>{0.44383046f, 0.786767244f}, std::array<float,2>{0.623968124f, 0.974374592f}, std::array<float,2>{0.2549541f, 0.165590644f}, std::array<float,2>{0.994045258f, 0.339357793f}, std::array<float,2>{0.0792515874f, 0.557428598f}, std::array<float,2>{0.683333695f, 0.745962262f}, std::array<float,2>{0.46409604f, 0.468923211f}, std::array<float,2>{0.864229858f, 0.050882522f}, std::array<float,2>{0.167054906f, 0.769705594f}, std::array<float,2>{0.979084969f, 0.948466063f}, std::array<float,2>{0.0714541748f, 0.146996275f}, std::array<float,2>{0.608244836f, 0.365457416f}, std::array<float,2>{0.279779911f, 0.515534997f}, std::array<float,2>{0.750169396f, 0.599800229f}, std::array<float,2>{0.189472273f, 0.288517475f}, std::array<float,2>{0.69909209f, 0.21556972f}, std::array<float,2>{0.423201025f, 0.879192352f}, std::array<float,2>{0.551437974f, 0.834171414f}, std::array<float,2>{0.331341833f, 0.121198513f}, std::array<float,2>{0.88866055f, 0.393522739f}, std::array<float,2>{0.0322235152f, 0.677381575f}, std::array<float,2>{0.591640711f, 0.54071629f}, std::array<float,2>{0.301910877f, 0.317305505f}, std::array<float,2>{0.968259811f, 0.179030314f}, std::array<float,2>{0.105857641f, 0.990626216f}, std::array<float,2>{0.835367203f, 0.8011204f}, std::array<float,2>{0.144321308f, 0.0121574551f}, std::array<float,2>{0.652896106f, 0.4451859f}, std::array<float,2>{0.485389113f, 0.700671077f}, std::array<float,2>{0.921682477f, 0.650004029f}, std::array<float,2>{0.00181392906f, 0.424531996f}, std::array<float,2>{0.520725191f, 0.091691412f}, std::array<float,2>{0.350543141f, 0.871547103f}, std::array<float,2>{0.744191408f, 0.928778648f}, std::array<float,2>{0.377893865f, 0.224207938f}, std::array<float,2>{0.808242083f, 0.272162408f}, std::array<float,2>{0.23402229f, 0.582214117f}, std::array<float,2>{0.557478607f, 0.7277596f}, std::array<float,2>{0.335972756f, 0.492023051f}, std::array<float,2>{0.881017745f, 0.0371316299f}, std::array<float,2>{0.0432217941f, 0.756904244f}, std::array<float,2>{0.760149539f, 0.953335524f}, std::array<float,2>{0.199588895f, 0.135208368f}, std::array<float,2>{0.691735864f, 0.348835617f}, std::array<float,2>{0.433535844f, 0.524812043f}, std::array<float,2>{0.970699012f, 0.618031025f}, std::array<float,2>{0.068519555f, 0.31110853f}, std::array<float,2>{0.600998759f, 0.191876248f}, std::array<float,2>{0.267590851f, 0.904087126f}, std::array<float,2>{0.67862761f, 0.81489557f}, std::array<float,2>{0.454585254f, 0.102949716f}, std::array<float,2>{0.872587979f, 0.381943733f}, std::array<float,2>{0.157841995f, 0.666573882f}, std::array<float,2>{0.739186943f, 0.56192261f}, std::array<float,2>{0.384791642f, 0.342624277f}, std::array<float,2>{0.802705407f, 0.16911605f}, std::array<float,2>{0.223171383f, 0.970963836f}, std::array<float,2>{0.910898268f, 0.784677625f}, std::array<float,2>{0.0155506395f, 0.030259639f}, std::array<float,2>{0.530933022f, 0.453277707f}, std::array<float,2>{0.355359316f, 0.705423295f}, std::array<float,2>{0.841803193f, 0.632744551f}, std::array<float,2>{0.15002507f, 0.408928961f}, std::array<float,2>{0.645371795f, 0.0719817653f}, std::array<float,2>{0.499089718f, 0.849788487f}, std::array<float,2>{0.583257794f, 0.912641227f}, std::array<float,2>{0.311630398f, 0.234877095f}, std::array<float,2>{0.955389202f, 0.261308044f}, std::array<float,2>{0.0990526304f, 0.562984049f}, std::array<float,2>{0.626119494f, 0.672782004f}, std::array<float,2>{0.471385896f, 0.394758999f}, std::array<float,2>{0.814148247f, 0.11924392f}, std::array<float,2>{0.125318065f, 0.829396129f}, std::array<float,2>{0.94102174f, 0.875703514f}, std::array<float,2>{0.122044727f, 0.214529648f}, std::array<float,2>{0.572432101f, 0.281721503f}, std::array<float,2>{0.290887624f, 0.595558584f}, std::array<float,2>{0.781393647f, 0.509796739f}, std::array<float,2>{0.246270746f, 0.360257924f}, std::array<float,2>{0.729985178f, 0.143708825f}, std::array<float,2>{0.396368861f, 0.953045189f}, std::array<float,2>{0.508071899f, 0.7693609f}, std::array<float,2>{0.366754889f, 0.0501285978f}, std::array<float,2>{0.923119068f, 0.475079626f}, std::array<float,2>{0.0249225721f, 0.746436954f}, std::array<float,2>{0.615517139f, 0.58129549f}, std::array<float,2>{0.264157683f, 0.266194671f}, std::array<float,2>{0.990756512f, 0.220445111f}, std::array<float,2>{0.0873905048f, 0.923582435f}, std::array<float,2>{0.849460542f, 0.870511532f}, std::array<float,2>{0.177359566f, 0.0893167108f}, std::array<float,2>{0.664013207f, 0.426596403f}, std::array<float,2>{0.451805681f, 0.653408051f}, std::array<float,2>{0.893349171f, 0.699188709f}, std::array<float,2>{0.0518208779f, 0.43886897f}, std::array<float,2>{0.533024013f, 0.0111514553f}, std::array<float,2>{0.320095509f, 0.800680041f}, std::array<float,2>{0.706335366f, 0.985819578f}, std::array<float,2>{0.412385315f, 0.172595233f}, std::array<float,2>{0.770030797f, 0.315228552f}, std::array<float,2>{0.213844761f, 0.544633687f}, std::array<float,2>{0.566560447f, 0.645911992f}, std::array<float,2>{0.285633832f, 0.430986464f}, std::array<float,2>{0.945441663f, 0.0807253346f}, std::array<float,2>{0.109470457f, 0.865627229f}, std::array<float,2>{0.821488917f, 0.930109799f}, std::array<float,2>{0.139835462f, 0.234063879f}, std::array<float,2>{0.639921248f, 0.276808083f}, std::array<float,2>{0.481579542f, 0.589190781f}, std::array<float,2>{0.937423885f, 0.537329137f}, std::array<float,2>{0.0207091235f, 0.323870301f}, std::array<float,2>{0.500542343f, 0.185263649f}, std::array<float,2>{0.367315233f, 0.99294138f}, std::array<float,2>{0.72489506f, 0.811885893f}, std::array<float,2>{0.399470299f, 0.00723040197f}, std::array<float,2>{0.791157246f, 0.446016848f}, std::array<float,2>{0.236684099f, 0.691305995f}, std::array<float,2>{0.666338265f, 0.608724475f}, std::array<float,2>{0.439394921f, 0.294724613f}, std::array<float,2>{0.856007874f, 0.209395319f}, std::array<float,2>{0.181998506f, 0.887245357f}, std::array<float,2>{0.997375607f, 0.841001153f}, std::array<float,2>{0.0843901113f, 0.111006401f}, std::array<float,2>{0.619378269f, 0.40154621f}, std::array<float,2>{0.252268851f, 0.68691957f}, std::array<float,2>{0.777883589f, 0.74217993f}, std::array<float,2>{0.206191912f, 0.481390208f}, std::array<float,2>{0.718302548f, 0.0606776513f}, std::array<float,2>{0.417591512f, 0.777174294f}, std::array<float,2>{0.541181743f, 0.940778911f}, std::array<float,2>{0.326345474f, 0.149374351f}, std::array<float,2>{0.904799461f, 0.369101942f}, std::array<float,2>{0.0575006232f, 0.5013901f}, std::array<float,2>{0.700354755f, 0.714353681f}, std::array<float,2>{0.426946402f, 0.461215913f}, std::array<float,2>{0.757231295f, 0.0197224561f}, std::array<float,2>{0.192331791f, 0.792042613f}, std::array<float,2>{0.883578897f, 0.984320045f}, std::array<float,2>{0.0357665382f, 0.160577953f}, std::array<float,2>{0.548163831f, 0.33146295f}, std::array<float,2>{0.332300633f, 0.55020386f}, std::array<float,2>{0.861565769f, 0.576048434f}, std::array<float,2>{0.171699747f, 0.255086333f}, std::array<float,2>{0.687280357f, 0.245577767f}, std::array<float,2>{0.465896368f, 0.914163768f}, std::array<float,2>{0.604713321f, 0.853167653f}, std::array<float,2>{0.276114106f, 0.0666146874f}, std::array<float,2>{0.982243299f, 0.419864446f}, std::array<float,2>{0.0751566142f, 0.634700656f}, std::array<float,2>{0.517175913f, 0.520964861f}, std::array<float,2>{0.346389621f, 0.352310568f}, std::array<float,2>{0.917027056f, 0.125287071f}, std::array<float,2>{0.00622022757f, 0.961405933f}, std::array<float,2>{0.812167823f, 0.76272428f}, std::array<float,2>{0.227303326f, 0.0448251478f}, std::array<float,2>{0.749185085f, 0.495037913f}, std::array<float,2>{0.382173628f, 0.720303237f}, std::array<float,2>{0.962005258f, 0.662696779f}, std::array<float,2>{0.104104772f, 0.382892758f}, std::array<float,2>{0.588063359f, 0.0985876322f}, std::array<float,2>{0.299449354f, 0.826841235f}, std::array<float,2>{0.651584506f, 0.891236246f}, std::array<float,2>{0.488509804f, 0.198704556f}, std::array<float,2>{0.829958498f, 0.299231201f}, std::array<float,2>{0.147291437f, 0.616723239f}, std::array<float,2>{0.592184722f, 0.700973213f}, std::array<float,2>{0.303928584f, 0.444554418f}, std::array<float,2>{0.964953184f, 0.0125134848f}, std::array<float,2>{0.107678331f, 0.80137068f}, std::array<float,2>{0.833763599f, 0.990810275f}, std::array<float,2>{0.140973702f, 0.17936641f}, std::array<float,2>{0.655222416f, 0.316761792f}, std::array<float,2>{0.487725019f, 0.540151477f}, std::array<float,2>{0.918242872f, 0.582959592f}, std::array<float,2>{0.00210483209f, 0.271957487f}, std::array<float,2>{0.522247076f, 0.224047944f}, std::array<float,2>{0.348388612f, 0.929609239f}, std::array<float,2>{0.742299318f, 0.871806741f}, std::array<float,2>{0.376734257f, 0.0908406675f}, std::array<float,2>{0.80513382f, 0.424194485f}, std::array<float,2>{0.231566042f, 0.649607897f}, std::array<float,2>{0.679755807f, 0.514691472f}, std::array<float,2>{0.461461216f, 0.366188705f}, std::array<float,2>{0.865804195f, 0.146747842f}, std::array<float,2>{0.16553311f, 0.948854923f}, std::array<float,2>{0.977858424f, 0.770143867f}, std::array<float,2>{0.0737330094f, 0.0514142513f}, std::array<float,2>{0.607008278f, 0.469393075f}, std::array<float,2>{0.27866745f, 0.745353818f}, std::array<float,2>{0.752574742f, 0.677240074f}, std::array<float,2>{0.18911165f, 0.392793864f}, std::array<float,2>{0.695657015f, 0.121679522f}, std::array<float,2>{0.425127506f, 0.834934831f}, std::array<float,2>{0.554016769f, 0.879524529f}, std::array<float,2>{0.328150839f, 0.215181425f}, std::array<float,2>{0.88970834f, 0.288652122f}, std::array<float,2>{0.0345473327f, 0.600144327f}, std::array<float,2>{0.71306622f, 0.628053069f}, std::array<float,2>{0.420982242f, 0.413149834f}, std::array<float,2>{0.77546972f, 0.0745676756f}, std::array<float,2>{0.207076192f, 0.847489893f}, std::array<float,2>{0.898525238f, 0.906859756f}, std::array<float,2>{0.0590058789f, 0.240157932f}, std::array<float,2>{0.544520676f, 0.264447719f}, std::array<float,2>{0.321656883f, 0.567504883f}, std::array<float,2>{0.851681411f, 0.557049155f}, std::array<float,2>{0.186255187f, 0.338925809f}, std::array<float,2>{0.670406938f, 0.165093303f}, std::array<float,2>{0.442324191f, 0.974067152f}, std::array<float,2>{0.622884631f, 0.786372602f}, std::array<float,2>{0.25710398f, 0.0241877437f}, std::array<float,2>{0.994714081f, 0.460295171f}, std::array<float,2>{0.0808410496f, 0.710793555f}, std::array<float,2>{0.507710934f, 0.622047186f}, std::array<float,2>{0.373172075f, 0.307433426f}, std::array<float,2>{0.932284057f, 0.188535482f}, std::array<float,2>{0.0171145219f, 0.902310491f}, std::array<float,2>{0.795417011f, 0.817708492f}, std::array<float,2>{0.240687594f, 0.109206758f}, std::array<float,2>{0.721170247f, 0.376056284f}, std::array<float,2>{0.403794408f, 0.671592593f}, std::array<float,2>{0.950005531f, 0.730888128f}, std::array<float,2>{0.116694264f, 0.484946579f}, std::array<float,2>{0.566078544f, 0.0333015211f}, std::array<float,2>{0.282806903f, 0.752555609f}, std::array<float,2>{0.632926464f, 0.96061933f}, std::array<float,2>{0.477864295f, 0.137099698f}, std::array<float,2>{0.825684488f, 0.346605092f}, std::array<float,2>{0.133166894f, 0.530993581f}, std::array<float,2>{0.538532197f, 0.657067418f}, std::array<float,2>{0.314819843f, 0.390548617f}, std::array<float,2>{0.897910476f, 0.0971949846f}, std::array<float,2>{0.0469138362f, 0.82398349f}, std::array<float,2>{0.768592775f, 0.898331702f}, std::array<float,2>{0.216647536f, 0.202410877f}, std::array<float,2>{0.709990203f, 0.304082692f}, std::array<float,2>{0.407444209f, 0.613106906f}, std::array<float,2>{0.986844659f, 0.517164946f}, std::array<float,2>{0.0913360566f, 0.356458545f}, std::array<float,2>{0.610194564f, 0.129395366f}, std::array<float,2>{0.261464238f, 0.966286898f}, std::array<float,2>{0.658148587f, 0.760662973f}, std::array<float,2>{0.447636873f, 0.042547863f}, std::array<float,2>{0.845151663f, 0.497508913f}, std::array<float,2>{0.1730773f, 0.725325763f}, std::array<float,2>{0.731770337f, 0.573580086f}, std::array<float,2>{0.394175589f, 0.250891924f}, std::array<float,2>{0.787111282f, 0.248687074f}, std::array<float,2>{0.243231684f, 0.920600295f}, std::array<float,2>{0.927627802f, 0.85730058f}, std::array<float,2>{0.02930874f, 0.0659391209f}, std::array<float,2>{0.514496446f, 0.417567044f}, std::array<float,2>{0.359392732f, 0.640080631f}, std::array<float,2>{0.820163548f, 0.718362808f}, std::array<float,2>{0.130264714f, 0.46763733f}, std::array<float,2>{0.632547259f, 0.0178850181f}, std::array<float,2>{0.474056065f, 0.796751916f}, std::array<float,2>{0.575438559f, 0.980006874f}, std::array<float,2>{0.295817584f, 0.15768683f}, std::array<float,2>{0.943085372f, 0.335554391f}, std::array<float,2>{0.121078372f, 0.553880692f}, std::array<float,2>{0.644463003f, 0.736276984f}, std::array<float,2>{0.493744433f, 0.480237305f}, std::array<float,2>{0.839213967f, 0.0566999353f}, std::array<float,2>{0.152891591f, 0.779957592f}, std::array<float,2>{0.95909512f, 0.943980992f}, std::array<float,2>{0.0950927362f, 0.155118346f}, std::array<float,2>{0.578698874f, 0.37159586f}, std::array<float,2>{0.305227131f, 0.506175518f}, std::array<float,2>{0.79845798f, 0.604623318f}, std::array<float,2>{0.219220459f, 0.292183906f}, std::array<float,2>{0.737700403f, 0.206995085f}, std::array<float,2>{0.387217432f, 0.884125113f}, std::array<float,2>{0.526457846f, 0.839710593f}, std::array<float,2>{0.358802408f, 0.115727969f}, std::array<float,2>{0.90625006f, 0.404093534f}, std::array<float,2>{0.0107192481f, 0.68056792f}, std::array<float,2>{0.595696628f, 0.534421861f}, std::array<float,2>{0.270334989f, 0.326286823f}, std::array<float,2>{0.974298894f, 0.180127099f}, std::array<float,2>{0.0634254739f, 0.997013867f}, std::array<float,2>{0.868938625f, 0.808458805f}, std::array<float,2>{0.163464069f, 0.00156310224f}, std::array<float,2>{0.672321796f, 0.452666283f}, std::array<float,2>{0.460818827f, 0.694577813f}, std::array<float,2>{0.878789604f, 0.644248068f}, std::array<float,2>{0.0429656543f, 0.435689837f}, std::array<float,2>{0.558959126f, 0.0834498703f}, std::array<float,2>{0.340821862f, 0.862710893f}, std::array<float,2>{0.689661741f, 0.936763823f}, std::array<float,2>{0.436676681f, 0.228038102f}, std::array<float,2>{0.764919579f, 0.277652264f}, std::array<float,2>{0.19571431f, 0.592781067f}, std::array<float,2>{0.517802715f, 0.71980989f}, std::array<float,2>{0.344616681f, 0.494322717f}, std::array<float,2>{0.915521622f, 0.0441702046f}, std::array<float,2>{0.00564991869f, 0.763537347f}, std::array<float,2>{0.810064197f, 0.961468101f}, std::array<float,2>{0.229519174f, 0.125725403f}, std::array<float,2>{0.747083485f, 0.352031022f}, std::array<float,2>{0.379601002f, 0.521072328f}, std::array<float,2>{0.964229345f, 0.616304159f}, std::array<float,2>{0.103253759f, 0.299589664f}, std::array<float,2>{0.587841451f, 0.198915198f}, std::array<float,2>{0.297745556f, 0.890728891f}, std::array<float,2>{0.648650944f, 0.826200008f}, std::array<float,2>{0.491810769f, 0.0978069529f}, std::array<float,2>{0.830583572f, 0.383458465f}, std::array<float,2>{0.145050451f, 0.662510395f}, std::array<float,2>{0.702294528f, 0.550395787f}, std::array<float,2>{0.428709149f, 0.331553072f}, std::array<float,2>{0.755126834f, 0.161090583f}, std::array<float,2>{0.194581345f, 0.983493149f}, std::array<float,2>{0.885879636f, 0.792780042f}, std::array<float,2>{0.0372795463f, 0.0200269036f}, std::array<float,2>{0.549343824f, 0.461667746f}, std::array<float,2>{0.335899264f, 0.714758217f}, std::array<float,2>{0.860871196f, 0.63399899f}, std::array<float,2>{0.168090954f, 0.419184774f}, std::array<float,2>{0.684651673f, 0.0673624352f}, std::array<float,2>{0.466843307f, 0.853014946f}, std::array<float,2>{0.603245556f, 0.91468823f}, std::array<float,2>{0.273695856f, 0.245909989f}, std::array<float,2>{0.983771026f, 0.255683333f}, std::array<float,2>{0.0761951953f, 0.575502098f}, std::array<float,2>{0.665352285f, 0.687158287f}, std::array<float,2>{0.439547449f, 0.402236909f}, std::array<float,2>{0.858385086f, 0.110363096f}, std::array<float,2>{0.180434033f, 0.84142071f}, std::array<float,2>{0.999464571f, 0.886908293f}, std::array<float,2>{0.0839706063f, 0.209575787f}, std::array<float,2>{0.618307173f, 0.294389993f}, std::array<float,2>{0.251162469f, 0.609056056f}, std::array<float,2>{0.780348659f, 0.501722455f}, std::array<float,2>{0.203576028f, 0.36831519f}, std::array<float,2>{0.716439068f, 0.148704857f}, std::array<float,2>{0.414099962f, 0.941191733f}, std::array<float,2>{0.539499521f, 0.776617527f}, std::array<float,2>{0.32555151f, 0.0613594502f}, std::array<float,2>{0.903173387f, 0.480560005f}, std::array<float,2>{0.055292841f, 0.74122417f}, std::array<float,2>{0.568644702f, 0.589695573f}, std::array<float,2>{0.287419647f, 0.277075857f}, std::array<float,2>{0.948238969f, 0.233868703f}, std::array<float,2>{0.11254628f, 0.930252314f}, std::array<float,2>{0.82292068f, 0.865941882f}, std::array<float,2>{0.137924507f, 0.0805277005f}, std::array<float,2>{0.638279974f, 0.431207716f}, std::array<float,2>{0.483469218f, 0.646064281f}, std::array<float,2>{0.934053481f, 0.690726697f}, std::array<float,2>{0.0224902853f, 0.44557631f}, std::array<float,2>{0.502907693f, 0.00733040879f}, std::array<float,2>{0.370180994f, 0.812425971f}, std::array<float,2>{0.724090874f, 0.992473245f}, std::array<float,2>{0.40203169f, 0.185030937f}, std::array<float,2>{0.79026413f, 0.323480785f}, std::array<float,2>{0.234998628f, 0.537653625f}, std::array<float,2>{0.613675773f, 0.654077709f}, std::array<float,2>{0.263099015f, 0.425948352f}, std::array<float,2>{0.989024282f, 0.0893576965f}, std::array<float,2>{0.0883037075f, 0.870624185f}, std::array<float,2>{0.850778878f, 0.923156619f}, std::array<float,2>{0.178972587f, 0.21993576f}, std::array<float,2>{0.660968661f, 0.265665263f}, std::array<float,2>{0.450666428f, 0.581912339f}, std::array<float,2>{0.891560137f, 0.54440248f}, std::array<float,2>{0.054182902f, 0.314618468f}, std::array<float,2>{0.534531891f, 0.172150373f}, std::array<float,2>{0.316532552f, 0.986132741f}, std::array<float,2>{0.704986572f, 0.799835384f}, std::array<float,2>{0.411355555f, 0.0113139981f}, std::array<float,2>{0.772652268f, 0.439323843f}, std::array<float,2>{0.211062402f, 0.698393941f}, std::array<float,2>{0.628601193f, 0.594956815f}, std::array<float,2>{0.470280558f, 0.281814337f}, std::array<float,2>{0.816139042f, 0.214200661f}, std::array<float,2>{0.128526673f, 0.875144541f}, std::array<float,2>{0.938301802f, 0.829929233f}, std::array<float,2>{0.124536045f, 0.120083898f}, std::array<float,2>{0.570417464f, 0.395171046f}, std::array<float,2>{0.292583615f, 0.67199105f}, std::array<float,2>{0.78344816f, 0.74662292f}, std::array<float,2>{0.249508113f, 0.475430846f}, std::array<float,2>{0.726996124f, 0.0505867712f}, std::array<float,2>{0.398225576f, 0.768985391f}, std::array<float,2>{0.511221588f, 0.952179432f}, std::array<float,2>{0.364052594f, 0.144498214f}, std::array<float,2>{0.925165236f, 0.359628022f}, std::array<float,2>{0.0258476753f, 0.510413706f}, std::array<float,2>{0.742037535f, 0.705703735f}, std::array<float,2>{0.383618295f, 0.454065472f}, std::array<float,2>{0.802798688f, 0.0294235684f}, std::array<float,2>{0.224838153f, 0.78441602f}, std::array<float,2>{0.912116468f, 0.971545696f}, std::array<float,2>{0.0123244589f, 0.169814125f}, std::array<float,2>{0.528404593f, 0.342280567f}, std::array<float,2>{0.353062093f, 0.562097132f}, std::array<float,2>{0.841526985f, 0.563140094f}, std::array<float,2>{0.150709331f, 0.261125833f}, std::array<float,2>{0.647355676f, 0.234566823f}, std::array<float,2>{0.496265352f, 0.912163556f}, std::array<float,2>{0.58579582f, 0.850481629f}, std::array<float,2>{0.309648156f, 0.0717047602f}, std::array<float,2>{0.954871714f, 0.408236802f}, std::array<float,2>{0.100475937f, 0.631907105f}, std::array<float,2>{0.556362569f, 0.524951279f}, std::array<float,2>{0.337919265f, 0.349399835f}, std::array<float,2>{0.879209638f, 0.13556391f}, std::array<float,2>{0.0456234515f, 0.953666091f}, std::array<float,2>{0.758526742f, 0.75745666f}, std::array<float,2>{0.201202005f, 0.037604928f}, std::array<float,2>{0.694436967f, 0.491606385f}, std::array<float,2>{0.431025326f, 0.728064179f}, std::array<float,2>{0.971385419f, 0.66649878f}, std::array<float,2>{0.0672516525f, 0.382478118f}, std::array<float,2>{0.59847182f, 0.103352852f}, std::array<float,2>{0.266076595f, 0.815423489f}, std::array<float,2>{0.677713096f, 0.903335392f}, std::array<float,2>{0.455883503f, 0.192183614f}, std::array<float,2>{0.874428511f, 0.310986161f}, std::array<float,2>{0.158370748f, 0.617236614f}, std::array<float,2>{0.607621968f, 0.743600667f}, std::array<float,2>{0.280133694f, 0.471839041f}, std::array<float,2>{0.978897274f, 0.053906247f}, std::array<float,2>{0.0718642846f, 0.772923887f}, std::array<float,2>{0.863533199f, 0.946561456f}, std::array<float,2>{0.167551875f, 0.145624623f}, std::array<float,2>{0.682905197f, 0.363336802f}, std::array<float,2>{0.464542717f, 0.513572574f}, std::array<float,2>{0.887756944f, 0.597796321f}, std::array<float,2>{0.0317057893f, 0.286338389f}, std::array<float,2>{0.550807774f, 0.218657702f}, std::array<float,2>{0.331967384f, 0.882068634f}, std::array<float,2>{0.698445678f, 0.832093239f}, std::array<float,2>{0.423376977f, 0.124749199f}, std::array<float,2>{0.75056684f, 0.390859574f}, std::array<float,2>{0.190385908f, 0.677856266f}, std::array<float,2>{0.652435184f, 0.542560518f}, std::array<float,2>{0.486228615f, 0.318761677f}, std::array<float,2>{0.835615456f, 0.176357538f}, std::array<float,2>{0.143637791f, 0.989232838f}, std::array<float,2>{0.968375683f, 0.802867174f}, std::array<float,2>{0.106416546f, 0.0137586286f}, std::array<float,2>{0.5909006f, 0.442195028f}, std::array<float,2>{0.302303821f, 0.70284456f}, std::array<float,2>{0.807734251f, 0.65116936f}, std::array<float,2>{0.233678758f, 0.422602206f}, std::array<float,2>{0.744679391f, 0.092462115f}, std::array<float,2>{0.377299309f, 0.874574542f}, std::array<float,2>{0.521415949f, 0.926192403f}, std::array<float,2>{0.349832803f, 0.225948393f}, std::array<float,2>{0.921296239f, 0.269562542f}, std::array<float,2>{0.00133359246f, 0.584005713f}, std::array<float,2>{0.720301449f, 0.668008208f}, std::array<float,2>{0.406081408f, 0.377883703f}, std::array<float,2>{0.793708682f, 0.105743945f}, std::array<float,2>{0.239059538f, 0.820260704f}, std::array<float,2>{0.931160986f, 0.899284482f}, std::array<float,2>{0.0195287075f, 0.190666392f}, std::array<float,2>{0.505502641f, 0.306531966f}, std::array<float,2>{0.371884435f, 0.623822749f}, std::array<float,2>{0.82786572f, 0.528762043f}, std::array<float,2>{0.135240898f, 0.345175207f}, std::array<float,2>{0.635850072f, 0.139597178f}, std::array<float,2>{0.479293495f, 0.95878309f}, std::array<float,2>{0.563590646f, 0.750163794f}, std::array<float,2>{0.284976035f, 0.0316535905f}, std::array<float,2>{0.951672971f, 0.487140149f}, std::array<float,2>{0.114872299f, 0.732836485f}, std::array<float,2>{0.545533717f, 0.569226086f}, std::array<float,2>{0.322515815f, 0.261865437f}, std::array<float,2>{0.901050508f, 0.240559042f}, std::array<float,2>{0.0616450757f, 0.909874082f}, std::array<float,2>{0.773482502f, 0.845143914f}, std::array<float,2>{0.209122241f, 0.0778409392f}, std::array<float,2>{0.712736428f, 0.411138058f}, std::array<float,2>{0.418552369f, 0.625318348f}, std::array<float,2>{0.993507326f, 0.708526492f}, std::array<float,2>{0.0800717026f, 0.457358241f}, std::array<float,2>{0.623144448f, 0.0256189816f}, std::array<float,2>{0.255703777f, 0.788223863f}, std::array<float,2>{0.668456137f, 0.976474464f}, std::array<float,2>{0.443929881f, 0.166158706f}, std::array<float,2>{0.854061544f, 0.337857187f}, std::array<float,2>{0.18377611f, 0.555714667f}, std::array<float,2>{0.511897027f, 0.637459219f}, std::array<float,2>{0.36229068f, 0.415935338f}, std::array<float,2>{0.928597569f, 0.0641496703f}, std::array<float,2>{0.0283254534f, 0.858083546f}, std::array<float,2>{0.78519994f, 0.919636548f}, std::array<float,2>{0.245924219f, 0.246829256f}, std::array<float,2>{0.733675957f, 0.253268033f}, std::array<float,2>{0.392522097f, 0.572110176f}, std::array<float,2>{0.943400621f, 0.552210867f}, std::array<float,2>{0.117256261f, 0.332593501f}, std::array<float,2>{0.576364338f, 0.160091281f}, std::array<float,2>{0.294698268f, 0.976731479f}, std::array<float,2>{0.629890203f, 0.794402063f}, std::array<float,2>{0.476494879f, 0.0161510538f}, std::array<float,2>{0.816461265f, 0.465992898f}, std::array<float,2>{0.132185504f, 0.716160059f}, std::array<float,2>{0.707587361f, 0.610202193f}, std::array<float,2>{0.40942055f, 0.301628381f}, std::array<float,2>{0.767044902f, 0.200877488f}, std::array<float,2>{0.218017727f, 0.895052612f}, std::array<float,2>{0.895812929f, 0.820773005f}, std::array<float,2>{0.0489074811f, 0.0950585902f}, std::array<float,2>{0.536159575f, 0.38782084f}, std::array<float,2>{0.313539356f, 0.658355296f}, std::array<float,2>{0.846927583f, 0.722889543f}, std::array<float,2>{0.175567269f, 0.498324782f}, std::array<float,2>{0.65842241f, 0.0395524837f}, std::array<float,2>{0.446870774f, 0.758662164f}, std::array<float,2>{0.612356305f, 0.967850149f}, std::array<float,2>{0.259095281f, 0.13261874f}, std::array<float,2>{0.985710859f, 0.357780129f}, std::array<float,2>{0.0930910483f, 0.519457042f}, std::array<float,2>{0.675542772f, 0.692546904f}, std::array<float,2>{0.457535088f, 0.450951308f}, std::array<float,2>{0.870161891f, 0.00202868879f}, std::array<float,2>{0.161649525f, 0.80553174f}, std::array<float,2>{0.975936353f, 0.999501884f}, std::array<float,2>{0.065236859f, 0.182452261f}, std::array<float,2>{0.597597837f, 0.325000882f}, std::array<float,2>{0.272409976f, 0.533160567f}, std::array<float,2>{0.76262635f, 0.590738118f}, std::array<float,2>{0.198933795f, 0.279926062f}, std::array<float,2>{0.688213527f, 0.229461372f}, std::array<float,2>{0.435469657f, 0.934138536f}, std::array<float,2>{0.561517417f, 0.860728621f}, std::array<float,2>{0.342465281f, 0.0845842063f}, std::array<float,2>{0.875473201f, 0.434057355f}, std::array<float,2>{0.0400926173f, 0.641738415f}, std::array<float,2>{0.581600606f, 0.503952086f}, std::array<float,2>{0.306841969f, 0.374474019f}, std::array<float,2>{0.957620978f, 0.154273644f}, std::array<float,2>{0.0969076529f, 0.942086935f}, std::array<float,2>{0.836928129f, 0.777807772f}, std::array<float,2>{0.155465811f, 0.0552196503f}, std::array<float,2>{0.642472208f, 0.47813642f}, std::array<float,2>{0.494209588f, 0.736752033f}, std::array<float,2>{0.909788311f, 0.68277514f}, std::array<float,2>{0.00912938453f, 0.406098634f}, std::array<float,2>{0.524855673f, 0.115230732f}, std::array<float,2>{0.357109725f, 0.837492049f}, std::array<float,2>{0.734579742f, 0.885481834f}, std::array<float,2>{0.389101386f, 0.204609439f}, std::array<float,2>{0.800224721f, 0.289389193f}, std::array<float,2>{0.221960455f, 0.602258444f}, std::array<float,2>{0.548381567f, 0.712193012f}, std::array<float,2>{0.332544655f, 0.463861436f}, std::array<float,2>{0.883229792f, 0.0226090215f}, std::array<float,2>{0.0352725647f, 0.78959024f}, std::array<float,2>{0.757781684f, 0.981243014f}, std::array<float,2>{0.19161357f, 0.163114041f}, std::array<float,2>{0.700728834f, 0.329170644f}, std::array<float,2>{0.427370161f, 0.54798907f}, std::array<float,2>{0.981586099f, 0.576557279f}, std::array<float,2>{0.0746076182f, 0.256623745f}, std::array<float,2>{0.605265975f, 0.242660999f}, std::array<float,2>{0.275699347f, 0.916351736f}, std::array<float,2>{0.686727583f, 0.855168104f}, std::array<float,2>{0.466593415f, 0.0702985153f}, std::array<float,2>{0.862255216f, 0.420321167f}, std::array<float,2>{0.171326295f, 0.636221945f}, std::array<float,2>{0.749989092f, 0.521942735f}, std::array<float,2>{0.382592589f, 0.353856057f}, std::array<float,2>{0.81155026f, 0.1273496f}, std::array<float,2>{0.226914883f, 0.962982297f}, std::array<float,2>{0.917908192f, 0.765616953f}, std::array<float,2>{0.0066530318f, 0.0449389517f}, std::array<float,2>{0.516838968f, 0.493847668f}, std::array<float,2>{0.346036553f, 0.721979022f}, std::array<float,2>{0.829589784f, 0.661467493f}, std::array<float,2>{0.146617755f, 0.385580033f}, std::array<float,2>{0.651910365f, 0.10137184f}, std::array<float,2>{0.48923555f, 0.825911283f}, std::array<float,2>{0.588383615f, 0.893968344f}, std::array<float,2>{0.298884064f, 0.195681229f}, std::array<float,2>{0.96247077f, 0.298555017f}, std::array<float,2>{0.103654973f, 0.614913404f}, std::array<float,2>{0.640172243f, 0.648173928f}, std::array<float,2>{0.48201409f, 0.432717144f}, std::array<float,2>{0.822115719f, 0.0786232129f}, std::array<float,2>{0.140366092f, 0.864060283f}, std::array<float,2>{0.946162879f, 0.932502508f}, std::array<float,2>{0.110233054f, 0.231719762f}, std::array<float,2>{0.566900909f, 0.275169522f}, std::array<float,2>{0.285707682f, 0.586724937f}, std::array<float,2>{0.791586339f, 0.536819577f}, std::array<float,2>{0.236927778f, 0.320792228f}, std::array<float,2>{0.72545892f, 0.186618596f}, std::array<float,2>{0.400145233f, 0.994906485f}, std::array<float,2>{0.500404239f, 0.810132921f}, std::array<float,2>{0.367900819f, 0.00463970844f}, std::array<float,2>{0.936951697f, 0.448222995f}, std::array<float,2>{0.0214301348f, 0.68918097f}, std::array<float,2>{0.620060623f, 0.606527507f}, std::array<float,2>{0.25277245f, 0.296129733f}, std::array<float,2>{0.997600138f, 0.20746389f}, std::array<float,2>{0.084955357f, 0.88918525f}, std::array<float,2>{0.855736077f, 0.842615724f}, std::array<float,2>{0.182307363f, 0.111859731f}, std::array<float,2>{0.666880548f, 0.398473859f}, std::array<float,2>{0.438524157f, 0.685162544f}, std::array<float,2>{0.904540062f, 0.740202665f}, std::array<float,2>{0.0569239669f, 0.483427405f}, std::array<float,2>{0.541822016f, 0.0602965504f}, std::array<float,2>{0.326725036f, 0.774028242f}, std::array<float,2>{0.718138635f, 0.938631415f}, std::array<float,2>{0.417279214f, 0.15074648f}, std::array<float,2>{0.77769959f, 0.370629519f}, std::array<float,2>{0.206938431f, 0.502562165f}, std::array<float,2>{0.572866976f, 0.675528824f}, std::array<float,2>{0.290437996f, 0.397992551f}, std::array<float,2>{0.940709949f, 0.119071282f}, std::array<float,2>{0.121240564f, 0.831602931f}, std::array<float,2>{0.813894987f, 0.876965821f}, std::array<float,2>{0.125827342f, 0.21094951f}, std::array<float,2>{0.626804948f, 0.284215391f}, std::array<float,2>{0.470933884f, 0.59692049f}, std::array<float,2>{0.923363447f, 0.508700848f}, std::array<float,2>{0.024535507f, 0.36206302f}, std::array<float,2>{0.508757651f, 0.142158926f}, std::array<float,2>{0.366426855f, 0.950242579f}, std::array<float,2>{0.729522526f, 0.767568648f}, std::array<float,2>{0.395747721f, 0.0471983887f}, std::array<float,2>{0.782136381f, 0.473278612f}, std::array<float,2>{0.246698171f, 0.749373794f}, std::array<float,2>{0.663556039f, 0.579179823f}, std::array<float,2>{0.451434702f, 0.268762589f}, std::array<float,2>{0.849115789f, 0.222499594f}, std::array<float,2>{0.176880822f, 0.925157785f}, std::array<float,2>{0.990507782f, 0.868142366f}, std::array<float,2>{0.087726526f, 0.086719349f}, std::array<float,2>{0.615857542f, 0.429251105f}, std::array<float,2>{0.26435709f, 0.655583143f}, std::array<float,2>{0.769859612f, 0.696826041f}, std::array<float,2>{0.212952107f, 0.440042049f}, std::array<float,2>{0.706720173f, 0.00794885587f}, std::array<float,2>{0.412843198f, 0.797596872f}, std::array<float,2>{0.532460988f, 0.986486852f}, std::array<float,2>{0.319461465f, 0.174570456f}, std::array<float,2>{0.892862976f, 0.314380974f}, std::array<float,2>{0.0523501746f, 0.546728075f}, std::array<float,2>{0.692096949f, 0.728622675f}, std::array<float,2>{0.433069408f, 0.490076929f}, std::array<float,2>{0.760599613f, 0.0361965038f}, std::array<float,2>{0.200003743f, 0.755261004f}, std::array<float,2>{0.881590247f, 0.956537485f}, std::array<float,2>{0.0436998643f, 0.134757638f}, std::array<float,2>{0.556794107f, 0.351178914f}, std::array<float,2>{0.336563557f, 0.526181579f}, std::array<float,2>{0.872118711f, 0.619554996f}, std::array<float,2>{0.157512307f, 0.308967143f}, std::array<float,2>{0.678134322f, 0.193676665f}, std::array<float,2>{0.454912484f, 0.904470146f}, std::array<float,2>{0.601090074f, 0.81387192f}, std::array<float,2>{0.268445432f, 0.105074868f}, std::array<float,2>{0.969983399f, 0.380623728f}, std::array<float,2>{0.0691036209f, 0.665823519f}, std::array<float,2>{0.530694425f, 0.5600034f}, std::array<float,2>{0.354512721f, 0.340272248f}, std::array<float,2>{0.910415769f, 0.169996887f}, std::array<float,2>{0.0150548108f, 0.968901694f}, std::array<float,2>{0.80187434f, 0.782738507f}, std::array<float,2>{0.223014563f, 0.0275417622f}, std::array<float,2>{0.738667071f, 0.455991447f}, std::array<float,2>{0.385541528f, 0.703357279f}, std::array<float,2>{0.955687582f, 0.628989279f}, std::array<float,2>{0.0995638371f, 0.406339228f}, std::array<float,2>{0.583759606f, 0.0734285712f}, std::array<float,2>{0.312403262f, 0.848981202f}, std::array<float,2>{0.644875765f, 0.911230922f}, std::array<float,2>{0.499514401f, 0.237830967f}, std::array<float,2>{0.842669845f, 0.259556293f}, std::array<float,2>{0.149566859f, 0.565849185f}, std::array<float,2>{0.564656734f, 0.734175563f}, std::array<float,2>{0.281895399f, 0.488229811f}, std::array<float,2>{0.950589716f, 0.0328518115f}, std::array<float,2>{0.115608364f, 0.751335442f}, std::array<float,2>{0.825122535f, 0.957816541f}, std::array<float,2>{0.134484813f, 0.140288353f}, std::array<float,2>{0.634156823f, 0.343959987f}, std::array<float,2>{0.477147371f, 0.527503788f}, std::array<float,2>{0.933437765f, 0.62425667f}, std::array<float,2>{0.0159958098f, 0.305546433f}, std::array<float,2>{0.50634253f, 0.190389529f}, std::array<float,2>{0.374332577f, 0.899814308f}, std::array<float,2>{0.722359538f, 0.818364441f}, std::array<float,2>{0.403238028f, 0.106920026f}, std::array<float,2>{0.796554267f, 0.378426522f}, std::array<float,2>{0.241291001f, 0.669583499f}, std::array<float,2>{0.671295702f, 0.554994404f}, std::array<float,2>{0.442452729f, 0.335992366f}, std::array<float,2>{0.852993548f, 0.16755724f}, std::array<float,2>{0.186767206f, 0.974881649f}, std::array<float,2>{0.99524647f, 0.787520707f}, std::array<float,2>{0.0812176466f, 0.0268497448f}, std::array<float,2>{0.621660054f, 0.45858112f}, std::array<float,2>{0.256647766f, 0.707253516f}, std::array<float,2>{0.776967049f, 0.626782715f}, std::array<float,2>{0.208748788f, 0.410160869f}, std::array<float,2>{0.714320123f, 0.0766050592f}, std::array<float,2>{0.420436144f, 0.844244123f}, std::array<float,2>{0.543884754f, 0.909067452f}, std::array<float,2>{0.32094866f, 0.241503775f}, std::array<float,2>{0.900324821f, 0.263281226f}, std::array<float,2>{0.0605270676f, 0.570099294f}, std::array<float,2>{0.696656704f, 0.678947866f}, std::array<float,2>{0.424225867f, 0.391755998f}, std::array<float,2>{0.753511548f, 0.123223051f}, std::array<float,2>{0.187600181f, 0.833182454f}, std::array<float,2>{0.88908577f, 0.881258786f}, std::array<float,2>{0.034066245f, 0.217030779f}, std::array<float,2>{0.55328691f, 0.285179913f}, std::array<float,2>{0.329173565f, 0.598810554f}, std::array<float,2>{0.866705954f, 0.512175024f}, std::array<float,2>{0.164522186f, 0.364869088f}, std::array<float,2>{0.680820584f, 0.144919589f}, std::array<float,2>{0.461957693f, 0.945544124f}, std::array<float,2>{0.605679154f, 0.772064149f}, std::array<float,2>{0.277795196f, 0.0530302711f}, std::array<float,2>{0.976895988f, 0.471167564f}, std::array<float,2>{0.0724845454f, 0.74279058f}, std::array<float,2>{0.523304641f, 0.585043311f}, std::array<float,2>{0.349258989f, 0.271138757f}, std::array<float,2>{0.919075608f, 0.224807084f}, std::array<float,2>{0.00365172466f, 0.926910281f}, std::array<float,2>{0.805669427f, 0.873434365f}, std::array<float,2>{0.231038481f, 0.0934339911f}, std::array<float,2>{0.743540049f, 0.423068106f}, std::array<float,2>{0.375549167f, 0.651629567f}, std::array<float,2>{0.966709495f, 0.701814234f}, std::array<float,2>{0.109138139f, 0.44280076f}, std::array<float,2>{0.593528092f, 0.0153448097f}, std::array<float,2>{0.302950621f, 0.804556072f}, std::array<float,2>{0.655854344f, 0.989420414f}, std::array<float,2>{0.486749649f, 0.17703326f}, std::array<float,2>{0.832831085f, 0.319481403f}, std::array<float,2>{0.14226763f, 0.541826844f}, std::array<float,2>{0.559894741f, 0.641234517f}, std::array<float,2>{0.340667099f, 0.435439259f}, std::array<float,2>{0.877530158f, 0.0850268677f}, std::array<float,2>{0.0415576324f, 0.86010766f}, std::array<float,2>{0.76378876f, 0.935233891f}, std::array<float,2>{0.196403533f, 0.230114087f}, std::array<float,2>{0.690488696f, 0.280462712f}, std::array<float,2>{0.435797721f, 0.591420412f}, std::array<float,2>{0.973589242f, 0.53204298f}, std::array<float,2>{0.0636411533f, 0.325781763f}, std::array<float,2>{0.594045162f, 0.18270357f}, std::array<float,2>{0.270932406f, 0.998575151f}, std::array<float,2>{0.673078954f, 0.80583775f}, std::array<float,2>{0.459488869f, 0.00380839733f}, std::array<float,2>{0.868049979f, 0.449331701f}, std::array<float,2>{0.162135765f, 0.691657722f}, std::array<float,2>{0.736726761f, 0.60329622f}, std::array<float,2>{0.388418466f, 0.290259004f}, std::array<float,2>{0.797246039f, 0.203523085f}, std::array<float,2>{0.220469013f, 0.886454701f}, std::array<float,2>{0.907573819f, 0.836505473f}, std::array<float,2>{0.0115597202f, 0.11406032f}, std::array<float,2>{0.526170194f, 0.40496558f}, std::array<float,2>{0.35753563f, 0.682070792f}, std::array<float,2>{0.838716328f, 0.738114178f}, std::array<float,2>{0.153373644f, 0.477393717f}, std::array<float,2>{0.643329263f, 0.0556924194f}, std::array<float,2>{0.492264658f, 0.778967798f}, std::array<float,2>{0.579659998f, 0.942902029f}, std::array<float,2>{0.306017786f, 0.152553454f}, std::array<float,2>{0.960243225f, 0.37382403f}, std::array<float,2>{0.0937532783f, 0.505779505f}, std::array<float,2>{0.631095231f, 0.714922488f}, std::array<float,2>{0.472931355f, 0.465381891f}, std::array<float,2>{0.819184899f, 0.0175284911f}, std::array<float,2>{0.129152089f, 0.793716311f}, std::array<float,2>{0.941875219f, 0.978479624f}, std::array<float,2>{0.119836114f, 0.159111202f}, std::array<float,2>{0.574258089f, 0.333052218f}, std::array<float,2>{0.296833575f, 0.551521361f}, std::array<float,2>{0.788516223f, 0.570502758f}, std::array<float,2>{0.24275063f, 0.252240032f}, std::array<float,2>{0.731114447f, 0.247277379f}, std::array<float,2>{0.393139601f, 0.918064713f}, std::array<float,2>{0.515252471f, 0.8586694f}, std::array<float,2>{0.361160994f, 0.0633642524f}, std::array<float,2>{0.926639915f, 0.414206952f}, std::array<float,2>{0.0305416603f, 0.638468087f}, std::array<float,2>{0.610909581f, 0.517823756f}, std::array<float,2>{0.260007799f, 0.359334081f}, std::array<float,2>{0.98805213f, 0.131278917f}, std::array<float,2>{0.0905405656f, 0.96750617f}, std::array<float,2>{0.84412986f, 0.759569168f}, std::array<float,2>{0.172520354f, 0.0404574536f}, std::array<float,2>{0.657007277f, 0.499589473f}, std::array<float,2>{0.448759317f, 0.723861039f}, std::array<float,2>{0.897276402f, 0.659888983f}, std::array<float,2>{0.0482139699f, 0.387388617f}, std::array<float,2>{0.537456512f, 0.0938612297f}, std::array<float,2>{0.315699875f, 0.821505129f}, std::array<float,2>{0.709136009f, 0.896053553f}, std::array<float,2>{0.406992227f, 0.199661121f}, std::array<float,2>{0.767760694f, 0.302148223f}, std::array<float,2>{0.215157688f, 0.610785007f}, std::array<float,2>{0.503176212f, 0.688088059f}, std::array<float,2>{0.369536072f, 0.448311895f}, std::array<float,2>{0.935306668f, 0.00531654572f}, std::array<float,2>{0.0219843443f, 0.808891892f}, std::array<float,2>{0.789474964f, 0.995329261f}, std::array<float,2>{0.235883608f, 0.185909048f}, std::array<float,2>{0.723600686f, 0.321743876f}, std::array<float,2>{0.400618494f, 0.535467446f}, std::array<float,2>{0.948643506f, 0.587838769f}, std::array<float,2>{0.111981541f, 0.273640305f}, std::array<float,2>{0.569566488f, 0.231277987f}, std::array<float,2>{0.288175911f, 0.932799876f}, std::array<float,2>{0.636894703f, 0.864919007f}, std::array<float,2>{0.48282218f, 0.0798032135f}, std::array<float,2>{0.823629975f, 0.432423294f}, std::array<float,2>{0.136892334f, 0.647238731f}, std::array<float,2>{0.715396464f, 0.503227115f}, std::array<float,2>{0.415260941f, 0.369368106f}, std::array<float,2>{0.780149937f, 0.152224183f}, std::array<float,2>{0.204863623f, 0.938449204f}, std::array<float,2>{0.903979003f, 0.775063753f}, std::array<float,2>{0.0561266094f, 0.0594824739f}, std::array<float,2>{0.540126622f, 0.482784986f}, std::array<float,2>{0.324236095f, 0.738478899f}, std::array<float,2>{0.858794391f, 0.684082627f}, std::array<float,2>{0.181547076f, 0.399506509f}, std::array<float,2>{0.664088726f, 0.112557188f}, std::array<float,2>{0.440512508f, 0.843679428f}, std::array<float,2>{0.617192388f, 0.889949143f}, std::array<float,2>{0.25076583f, 0.208598822f}, std::array<float,2>{0.999013484f, 0.29513061f}, std::array<float,2>{0.0827076659f, 0.606107652f}, std::array<float,2>{0.684389889f, 0.635555923f}, std::array<float,2>{0.468049675f, 0.421623737f}, std::array<float,2>{0.860091925f, 0.0692173541f}, std::array<float,2>{0.169111326f, 0.853524923f}, std::array<float,2>{0.983210742f, 0.917887688f}, std::array<float,2>{0.0772041678f, 0.243284509f}, std::array<float,2>{0.602290988f, 0.2571114f}, std::array<float,2>{0.274511307f, 0.578057289f}, std::array<float,2>{0.754371464f, 0.547764778f}, std::array<float,2>{0.193514287f, 0.32878077f}, std::array<float,2>{0.70172441f, 0.162306353f}, std::array<float,2>{0.429420829f, 0.981690228f}, std::array<float,2>{0.550127804f, 0.790075302f}, std::array<float,2>{0.334254444f, 0.0224169455f}, std::array<float,2>{0.884988189f, 0.464553386f}, std::array<float,2>{0.039056845f, 0.711603045f}, std::array<float,2>{0.585983992f, 0.613643348f}, std::array<float,2>{0.298105478f, 0.297306359f}, std::array<float,2>{0.963738441f, 0.196979776f}, std::array<float,2>{0.101818942f, 0.893303871f}, std::array<float,2>{0.831292212f, 0.824667871f}, std::array<float,2>{0.146355152f, 0.100171119f}, std::array<float,2>{0.650208056f, 0.386272967f}, std::array<float,2>{0.490445912f, 0.660819411f}, std::array<float,2>{0.914471924f, 0.721505105f}, std::array<float,2>{0.0046125073f, 0.492877901f}, std::array<float,2>{0.519014359f, 0.0460107811f}, std::array<float,2>{0.345012993f, 0.763778567f}, std::array<float,2>{0.747039258f, 0.964327037f}, std::array<float,2>{0.380820394f, 0.128609985f}, std::array<float,2>{0.80888319f, 0.355459899f}, std::array<float,2>{0.229010046f, 0.522725165f}, std::array<float,2>{0.599166512f, 0.664726913f}, std::array<float,2>{0.2667436f, 0.379799008f}, std::array<float,2>{0.972640395f, 0.104183465f}, std::array<float,2>{0.0680368617f, 0.813226998f}, std::array<float,2>{0.873829842f, 0.90559566f}, std::array<float,2>{0.159733832f, 0.195179597f}, std::array<float,2>{0.676296055f, 0.310285628f}, std::array<float,2>{0.457005888f, 0.620184541f}, std::array<float,2>{0.880010903f, 0.527055562f}, std::array<float,2>{0.0464234762f, 0.349860579f}, std::array<float,2>{0.554848313f, 0.133668065f}, std::array<float,2>{0.339721024f, 0.955441713f}, std::array<float,2>{0.694130242f, 0.754109442f}, std::array<float,2>{0.430504709f, 0.0353623889f}, std::array<float,2>{0.758805096f, 0.488347381f}, std::array<float,2>{0.20226495f, 0.729764223f}, std::array<float,2>{0.647492111f, 0.564864576f}, std::array<float,2>{0.49709335f, 0.25806576f}, std::array<float,2>{0.84046793f, 0.236493587f}, std::array<float,2>{0.151498556f, 0.910758078f}, std::array<float,2>{0.954098284f, 0.848162591f}, std::array<float,2>{0.101060078f, 0.0723031312f}, std::array<float,2>{0.584046662f, 0.407645106f}, std::array<float,2>{0.309328705f, 0.63071084f}, std::array<float,2>{0.804272652f, 0.705018461f}, std::array<float,2>{0.226032227f, 0.456777155f}, std::array<float,2>{0.740699947f, 0.0288140159f}, std::array<float,2>{0.384472162f, 0.781566918f}, std::array<float,2>{0.527979851f, 0.970199525f}, std::array<float,2>{0.351689935f, 0.171102151f}, std::array<float,2>{0.913433433f, 0.341529876f}, std::array<float,2>{0.0134055521f, 0.559342265f}, std::array<float,2>{0.727792382f, 0.748880923f}, std::array<float,2>{0.39733094f, 0.473793507f}, std::array<float,2>{0.784447968f, 0.0484097749f}, std::array<float,2>{0.248391017f, 0.765891254f}, std::array<float,2>{0.924253345f, 0.949597538f}, std::array<float,2>{0.0271004289f, 0.141575053f}, std::array<float,2>{0.509940863f, 0.362869114f}, std::array<float,2>{0.364304215f, 0.509384692f}, std::array<float,2>{0.814500153f, 0.596488655f}, std::array<float,2>{0.127178475f, 0.283542633f}, std::array<float,2>{0.627581894f, 0.212358236f}, std::array<float,2>{0.468916386f, 0.878067851f}, std::array<float,2>{0.571862817f, 0.830344796f}, std::array<float,2>{0.291465521f, 0.117929555f}, std::array<float,2>{0.939425349f, 0.396722257f}, std::array<float,2>{0.123325408f, 0.674332976f}, std::array<float,2>{0.534120202f, 0.545621872f}, std::array<float,2>{0.317693353f, 0.312898993f}, std::array<float,2>{0.89255482f, 0.175258115f}, std::array<float,2>{0.0536922812f, 0.987908065f}, std::array<float,2>{0.772164404f, 0.798283577f}, std::array<float,2>{0.212523296f, 0.00922957715f}, std::array<float,2>{0.703145146f, 0.440787315f}, std::array<float,2>{0.41110757f, 0.695546627f}, std::array<float,2>{0.989587009f, 0.654336333f}, std::array<float,2>{0.0890939087f, 0.42827943f}, std::array<float,2>{0.614378929f, 0.0873476565f}, std::array<float,2>{0.262637675f, 0.868349791f}, std::array<float,2>{0.661764562f, 0.924274981f}, std::array<float,2>{0.44997701f, 0.221504748f}, std::array<float,2>{0.850504458f, 0.268425494f}, std::array<float,2>{0.178293109f, 0.578830719f}, std::array<float,2>{0.624433875f, 0.709104955f}, std::array<float,2>{0.254405677f, 0.459150702f}, std::array<float,2>{0.993094385f, 0.0253490042f}, std::array<float,2>{0.0782550052f, 0.785382271f}, std::array<float,2>{0.854634047f, 0.973423779f}, std::array<float,2>{0.185501948f, 0.164603099f}, std::array<float,2>{0.669746995f, 0.338085473f}, std::array<float,2>{0.444945514f, 0.557667255f}, std::array<float,2>{0.901446402f, 0.56684202f}, std::array<float,2>{0.061414402f, 0.265607148f}, std::array<float,2>{0.546809852f, 0.239246696f}, std::array<float,2>{0.323646188f, 0.907237887f}, std::array<float,2>{0.711068928f, 0.845759571f}, std::array<float,2>{0.41935876f, 0.0759933069f}, std::array<float,2>{0.774929106f, 0.41228196f}, std::array<float,2>{0.209965393f, 0.62741816f}, std::array<float,2>{0.635570347f, 0.52987349f}, std::array<float,2>{0.479493737f, 0.347521126f}, std::array<float,2>{0.826382816f, 0.137930304f}, std::array<float,2>{0.136329383f, 0.959943891f}, std::array<float,2>{0.952456534f, 0.753853261f}, std::array<float,2>{0.113545209f, 0.0349555463f}, std::array<float,2>{0.562882304f, 0.486161828f}, std::array<float,2>{0.283764362f, 0.732117116f}, std::array<float,2>{0.794633985f, 0.67048347f}, std::array<float,2>{0.239624888f, 0.375165641f}, std::array<float,2>{0.718780518f, 0.10792695f}, std::array<float,2>{0.405038148f, 0.817234039f}, std::array<float,2>{0.504642069f, 0.901216745f}, std::array<float,2>{0.372232586f, 0.188470006f}, std::array<float,2>{0.930333316f, 0.307970405f}, std::array<float,2>{0.0184977707f, 0.622941136f}, std::array<float,2>{0.746007621f, 0.649287224f}, std::array<float,2>{0.378205836f, 0.425514996f}, std::array<float,2>{0.807389498f, 0.0899097696f}, std::array<float,2>{0.23321791f, 0.872923732f}, std::array<float,2>{0.920813739f, 0.928404689f}, std::array<float,2>{0.000323337707f, 0.223520875f}, std::array<float,2>{0.520350218f, 0.272882134f}, std::array<float,2>{0.351558417f, 0.583469927f}, std::array<float,2>{0.834106207f, 0.539781392f}, std::array<float,2>{0.142682225f, 0.317393214f}, std::array<float,2>{0.653546751f, 0.178177744f}, std::array<float,2>{0.484395772f, 0.99152869f}, std::array<float,2>{0.590690136f, 0.802405953f}, std::array<float,2>{0.301627129f, 0.0129656037f}, std::array<float,2>{0.967070103f, 0.444015265f}, std::array<float,2>{0.106960461f, 0.699508607f}, std::array<float,2>{0.552447915f, 0.601456523f}, std::array<float,2>{0.330442995f, 0.287593186f}, std::array<float,2>{0.8875947f, 0.215887129f}, std::array<float,2>{0.0331293531f, 0.879942954f}, std::array<float,2>{0.751616001f, 0.834980607f}, std::array<float,2>{0.190607727f, 0.122431599f}, std::array<float,2>{0.697377622f, 0.39421159f}, std::array<float,2>{0.421955734f, 0.676200867f}, std::array<float,2>{0.980181813f, 0.74419874f}, std::array<float,2>{0.0704082549f, 0.470457822f}, std::array<float,2>{0.608961105f, 0.0523817651f}, std::array<float,2>{0.280900657f, 0.771002233f}, std::array<float,2>{0.681702077f, 0.94757545f}, std::array<float,2>{0.463546753f, 0.148406431f}, std::array<float,2>{0.864408731f, 0.366910398f}, std::array<float,2>{0.166725904f, 0.513991535f}, std::array<float,2>{0.523880363f, 0.681050897f}, std::array<float,2>{0.355559587f, 0.402349114f}, std::array<float,2>{0.909011543f, 0.116985202f}, std::array<float,2>{0.00850437302f, 0.837894201f}, std::array<float,2>{0.799192965f, 0.883231521f}, std::array<float,2>{0.220921054f, 0.205783412f}, std::array<float,2>{0.735598266f, 0.291895121f}, std::array<float,2>{0.389965743f, 0.603939235f}, std::array<float,2>{0.958010018f, 0.507702768f}, std::array<float,2>{0.0966223478f, 0.372267693f}, std::array<float,2>{0.580327511f, 0.156073555f}, std::array<float,2>{0.307797253f, 0.944681883f}, std::array<float,2>{0.641006052f, 0.780606806f}, std::array<float,2>{0.495449305f, 0.0578874163f}, std::array<float,2>{0.836250842f, 0.479308516f}, std::array<float,2>{0.154581621f, 0.734744906f}, std::array<float,2>{0.689204991f, 0.592539847f}, std::array<float,2>{0.433761805f, 0.279099822f}, std::array<float,2>{0.763390779f, 0.226731375f}, std::array<float,2>{0.197352648f, 0.935798645f}, std::array<float,2>{0.876546264f, 0.861540556f}, std::array<float,2>{0.0394310802f, 0.0825140625f}, std::array<float,2>{0.562201083f, 0.437006474f}, std::array<float,2>{0.343506515f, 0.64291203f}, std::array<float,2>{0.869155824f, 0.693600416f}, std::array<float,2>{0.160189286f, 0.451768726f}, std::array<float,2>{0.673925877f, 0.000704210368f}, std::array<float,2>{0.458637297f, 0.806685627f}, std::array<float,2>{0.596415639f, 0.99796766f}, std::array<float,2>{0.272623509f, 0.181283757f}, std::array<float,2>{0.975132525f, 0.327676177f}, std::array<float,2>{0.0664043203f, 0.533889413f}, std::array<float,2>{0.659916997f, 0.726183414f}, std::array<float,2>{0.445428252f, 0.496369898f}, std::array<float,2>{0.846421659f, 0.0412896648f}, std::array<float,2>{0.17447485f, 0.760844588f}, std::array<float,2>{0.984985411f, 0.965321958f}, std::array<float,2>{0.0922194198f, 0.130760849f}, std::array<float,2>{0.611441255f, 0.355529308f}, std::array<float,2>{0.25834012f, 0.515939295f}, std::array<float,2>{0.766227186f, 0.612215877f}, std::array<float,2>{0.21737045f, 0.302847594f}, std::array<float,2>{0.708451152f, 0.20214735f}, std::array<float,2>{0.408847719f, 0.896806955f}, std::array<float,2>{0.535465658f, 0.82295686f}, std::array<float,2>{0.312755227f, 0.0960923359f}, std::array<float,2>{0.895157993f, 0.389430046f}, std::array<float,2>{0.0504331179f, 0.657505929f}, std::array<float,2>{0.577622175f, 0.552947342f}, std::array<float,2>{0.293316811f, 0.334506899f}, std::array<float,2>{0.945081592f, 0.156493112f}, std::array<float,2>{0.118248723f, 0.978598177f}, std::array<float,2>{0.817402244f, 0.795631886f}, std::array<float,2>{0.131215513f, 0.0192423631f}, std::array<float,2>{0.628967404f, 0.467927784f}, std::array<float,2>{0.475003362f, 0.716804504f}, std::array<float,2>{0.929585814f, 0.639504433f}, std::array<float,2>{0.0279185735f, 0.416833639f}, std::array<float,2>{0.513034463f, 0.0653537437f}, std::array<float,2>{0.362484246f, 0.856292665f}, std::array<float,2>{0.732830763f, 0.921256423f}, std::array<float,2>{0.390669495f, 0.249290034f}, std::array<float,2>{0.786499739f, 0.251346916f}, std::array<float,2>{0.244945481f, 0.57320267f}, std::array<float,2>{0.542292655f, 0.740606487f}, std::array<float,2>{0.327182651f, 0.481999099f}, std::array<float,2>{0.905798674f, 0.0619874746f}, std::array<float,2>{0.0585935041f, 0.77544719f}, std::array<float,2>{0.778535068f, 0.939715266f}, std::array<float,2>{0.205197275f, 0.149936602f}, std::array<float,2>{0.716868043f, 0.367367387f}, std::array<float,2>{0.416178912f, 0.500971973f}, std::array<float,2>{0.99699086f, 0.60793364f}, std::array<float,2>{0.0856590793f, 0.293524414f}, std::array<float,2>{0.620995104f, 0.209972873f}, std::array<float,2>{0.253177792f, 0.888159096f}, std::array<float,2>{0.667890549f, 0.840004385f}, std::array<float,2>{0.437642634f, 0.109690972f}, std::array<float,2>{0.856635451f, 0.401115745f}, std::array<float,2>{0.183358192f, 0.685878158f}, std::array<float,2>{0.726205468f, 0.538543463f}, std::array<float,2>{0.398686022f, 0.323167592f}, std::array<float,2>{0.792919636f, 0.184027284f}, std::array<float,2>{0.237730294f, 0.99383986f}, std::array<float,2>{0.936161339f, 0.811278403f}, std::array<float,2>{0.0202035327f, 0.00632075267f}, std::array<float,2>{0.501736999f, 0.446806997f}, std::array<float,2>{0.368776411f, 0.689570248f}, std::array<float,2>{0.821253717f, 0.644643784f}, std::array<float,2>{0.13899824f, 0.430391312f}, std::array<float,2>{0.638679981f, 0.0820152462f}, std::array<float,2>{0.480685115f, 0.866773427f}, std::array<float,2>{0.567799509f, 0.931148291f}, std::array<float,2>{0.286382347f, 0.233150691f}, std::array<float,2>{0.946989775f, 0.276305139f}, std::array<float,2>{0.110851221f, 0.588270366f}, std::array<float,2>{0.650633633f, 0.66376996f}, std::array<float,2>{0.489456564f, 0.383897036f}, std::array<float,2>{0.828265905f, 0.0988357887f}, std::array<float,2>{0.147493795f, 0.827206254f}, std::array<float,2>{0.961849689f, 0.892272711f}, std::array<float,2>{0.104576506f, 0.198029563f}, std::array<float,2>{0.58932519f, 0.300565034f}, std::array<float,2>{0.299820304f, 0.615406156f}, std::array<float,2>{0.810928464f, 0.520192802f}, std::array<float,2>{0.228147596f, 0.353373498f}, std::array<float,2>{0.748186052f, 0.126378894f}, std::array<float,2>{0.381360024f, 0.962525725f}, std::array<float,2>{0.515696943f, 0.76214999f}, std::array<float,2>{0.346978158f, 0.0432422124f}, std::array<float,2>{0.916508913f, 0.49552992f}, std::array<float,2>{0.00728984503f, 0.71890372f}, std::array<float,2>{0.604102254f, 0.574248552f}, std::array<float,2>{0.276658535f, 0.254426271f}, std::array<float,2>{0.980937064f, 0.244282797f}, std::array<float,2>{0.0758789629f, 0.915771902f}, std::array<float,2>{0.862581968f, 0.851961672f}, std::array<float,2>{0.170049265f, 0.0675535724f}, std::array<float,2>{0.686048865f, 0.418082595f}, std::array<float,2>{0.465045303f, 0.633101285f}, std::array<float,2>{0.884444475f, 0.712946713f}, std::array<float,2>{0.037048813f, 0.461926967f}, std::array<float,2>{0.547578394f, 0.0212849267f}, std::array<float,2>{0.333016068f, 0.791890442f}, std::array<float,2>{0.700104535f, 0.983134866f}, std::array<float,2>{0.42634052f, 0.161684021f}, std::array<float,2>{0.756229758f, 0.330229104f}, std::array<float,2>{0.192685947f, 0.548954308f}, std::array<float,2>{0.582807243f, 0.631141663f}, std::array<float,2>{0.310566902f, 0.409908861f}, std::array<float,2>{0.956550896f, 0.0704068244f}, std::array<float,2>{0.0983417407f, 0.850892186f}, std::array<float,2>{0.843379617f, 0.913276911f}, std::array<float,2>{0.148909897f, 0.236053601f}, std::array<float,2>{0.646197379f, 0.260668963f}, std::array<float,2>{0.498999953f, 0.564254999f}, std::array<float,2>{0.911588669f, 0.56055671f}, std::array<float,2>{0.0138746332f, 0.343173563f}, std::array<float,2>{0.529683411f, 0.168091476f}, std::array<float,2>{0.354462743f, 0.972063303f}, std::array<float,2>{0.740120113f, 0.78374356f}, std::array<float,2>{0.385911137f, 0.0306732971f}, std::array<float,2>{0.8016029f, 0.454609513f}, std::array<float,2>{0.224111184f, 0.706417024f}, std::array<float,2>{0.679649711f, 0.618352413f}, std::array<float,2>{0.453975976f, 0.311696351f}, std::array<float,2>{0.871101856f, 0.192900494f}, std::array<float,2>{0.156755403f, 0.903111756f}, std::array<float,2>{0.969323397f, 0.815760374f}, std::array<float,2>{0.0700960532f, 0.101612434f}, std::array<float,2>{0.600024879f, 0.381609023f}, std::array<float,2>{0.268648028f, 0.667536199f}, std::array<float,2>{0.761616886f, 0.727076232f}, std::array<float,2>{0.200970352f, 0.490397096f}, std::array<float,2>{0.69322145f, 0.0390037112f}, std::array<float,2>{0.431842327f, 0.75629729f}, std::array<float,2>{0.558312535f, 0.954704642f}, std::array<float,2>{0.337036788f, 0.135967612f}, std::array<float,2>{0.882317007f, 0.348038793f}, std::array<float,2>{0.0441588648f, 0.52430439f}, std::array<float,2>{0.705455482f, 0.697342098f}, std::array<float,2>{0.413968831f, 0.438420206f}, std::array<float,2>{0.77141726f, 0.0103875231f}, std::array<float,2>{0.214100629f, 0.798880696f}, std::array<float,2>{0.894026518f, 0.984552264f}, std::array<float,2>{0.0513526052f, 0.172981545f}, std::array<float,2>{0.53139478f, 0.315481156f}, std::array<float,2>{0.318777531f, 0.543600976f}, std::array<float,2>{0.848543882f, 0.58023268f}, std::array<float,2>{0.175816357f, 0.266980857f}, std::array<float,2>{0.662456155f, 0.219488829f}, std::array<float,2>{0.452420145f, 0.922655523f}, std::array<float,2>{0.617068946f, 0.869332492f}, std::array<float,2>{0.265106648f, 0.0885694176f}, std::array<float,2>{0.991486073f, 0.426825821f}, std::array<float,2>{0.0861331895f, 0.652616918f}, std::array<float,2>{0.509386897f, 0.510861158f}, std::array<float,2>{0.366146505f, 0.361021936f}, std::array<float,2>{0.922642648f, 0.143488318f}, std::array<float,2>{0.0241779741f, 0.951415956f}, std::array<float,2>{0.782886744f, 0.767835081f}, std::array<float,2>{0.247616708f, 0.0492621623f}, std::array<float,2>{0.728961527f, 0.475876093f}, std::array<float,2>{0.394935459f, 0.747515798f}, std::array<float,2>{0.939752221f, 0.673516631f}, std::array<float,2>{0.122585118f, 0.395761937f}, std::array<float,2>{0.573445201f, 0.120763235f}, std::array<float,2>{0.289512217f, 0.828795195f}, std::array<float,2>{0.62584877f, 0.876343071f}, std::array<float,2>{0.472298563f, 0.213063896f}, std::array<float,2>{0.813316882f, 0.282477021f}, std::array<float,2>{0.12660481f, 0.594474375f}, std::array<float,2>{0.569771707f, 0.691034198f}, std::array<float,2>{0.288334072f, 0.446233779f}, std::array<float,2>{0.948337376f, 0.00694949133f}, std::array<float,2>{0.112191215f, 0.811524868f}, std::array<float,2>{0.823338509f, 0.992730081f}, std::array<float,2>{0.136976838f, 0.185497984f}, std::array<float,2>{0.637005866f, 0.324120045f}, std::array<float,2>{0.482520729f, 0.537463188f}, std::array<float,2>{0.935082257f, 0.589063048f}, std::array<float,2>{0.0223059971f, 0.276543319f}, std::array<float,2>{0.503057063f, 0.234225824f}, std::array<float,2>{0.369173408f, 0.929741681f}, std::array<float,2>{0.72332257f, 0.865273058f}, std::array<float,2>{0.40078336f, 0.0808598325f}, std::array<float,2>{0.789244056f, 0.430758774f}, std::array<float,2>{0.236198843f, 0.645635366f}, std::array<float,2>{0.664408445f, 0.50116992f}, std::array<float,2>{0.440857828f, 0.36879015f}, std::array<float,2>{0.858437598f, 0.149001285f}, std::array<float,2>{0.181349277f, 0.940485597f}, std::array<float,2>{0.998754323f, 0.776916802f}, std::array<float,2>{0.0827818587f, 0.0609694049f}, std::array<float,2>{0.617500484f, 0.48108831f}, std::array<float,2>{0.250534356f, 0.74174583f}, std::array<float,2>{0.779789448f, 0.686531842f}, std::array<float,2>{0.204630911f, 0.401763529f}, std::array<float,2>{0.715738773f, 0.111150414f}, std::array<float,2>{0.415466666f, 0.841224611f}, std::array<float,2>{0.540340483f, 0.887476921f}, std::array<float,2>{0.324476629f, 0.20899938f}, std::array<float,2>{0.904149234f, 0.294630498f}, std::array<float,2>{0.0557820462f, 0.608629644f}, std::array<float,2>{0.702109337f, 0.634290099f}, std::array<float,2>{0.429655969f, 0.419518232f}, std::array<float,2>{0.753914893f, 0.0668419152f}, std::array<float,2>{0.193843052f, 0.853317142f}, std::array<float,2>{0.885210454f, 0.914543867f}, std::array<float,2>{0.0387481563f, 0.245270684f}, std::array<float,2>{0.549940825f, 0.255216986f}, std::array<float,2>{0.334167957f, 0.575716674f}, std::array<float,2>{0.860243678f, 0.549840868f}, std::array<float,2>{0.169281393f, 0.331232905f}, std::array<float,2>{0.684312105f, 0.160244763f}, std::array<float,2>{0.467862248f, 0.984100103f}, std::array<float,2>{0.602400005f, 0.792297363f}, std::array<float,2>{0.274684012f, 0.0200098008f}, std::array<float,2>{0.983101428f, 0.461004525f}, std::array<float,2>{0.0774460584f, 0.713950217f}, std::array<float,2>{0.518775225f, 0.617073834f}, std::array<float,2>{0.344755232f, 0.298906446f}, std::array<float,2>{0.914215982f, 0.198255137f}, std::array<float,2>{0.00480982102f, 0.891494989f}, std::array<float,2>{0.808680475f, 0.82706815f}, std::array<float,2>{0.229422927f, 0.0982476398f}, std::array<float,2>{0.746748388f, 0.383154511f}, std::array<float,2>{0.380558312f, 0.662890375f}, std::array<float,2>{0.963472724f, 0.720460534f}, std::array<float,2>{0.101722471f, 0.494665742f}, std::array<float,2>{0.586365223f, 0.0446712859f}, std::array<float,2>{0.298013866f, 0.762975097f}, std::array<float,2>{0.650112152f, 0.960942447f}, std::array<float,2>{0.49055168f, 0.125033602f}, std::array<float,2>{0.831305742f, 0.352175206f}, std::array<float,2>{0.146186963f, 0.520548344f}, std::array<float,2>{0.555071354f, 0.666770041f}, std::array<float,2>{0.339449704f, 0.382156342f}, std::array<float,2>{0.880128205f, 0.102598228f}, std::array<float,2>{0.0466477796f, 0.814683378f}, std::array<float,2>{0.759216309f, 0.90391469f}, std::array<float,2>{0.202430174f, 0.191460118f}, std::array<float,2>{0.693993926f, 0.311427802f}, std::array<float,2>{0.430379838f, 0.617796779f}, std::array<float,2>{0.972306311f, 0.524565279f}, std::array<float,2>{0.0682571083f, 0.348925591f}, std::array<float,2>{0.59946245f, 0.134980723f}, std::array<float,2>{0.266925991f, 0.953523159f}, std::array<float,2>{0.676626205f, 0.757180393f}, std::array<float,2>{0.456636697f, 0.0375533439f}, std::array<float,2>{0.873684108f, 0.491802812f}, std::array<float,2>{0.159981281f, 0.727999389f}, std::array<float,2>{0.740350485f, 0.562536776f}, std::array<float,2>{0.384652764f, 0.261533141f}, std::array<float,2>{0.8044644f, 0.235291749f}, std::array<float,2>{0.225615337f, 0.913010299f}, std::array<float,2>{0.913224936f, 0.849996626f}, std::array<float,2>{0.0135244252f, 0.0722046942f}, std::array<float,2>{0.52822125f, 0.409064502f}, std::array<float,2>{0.351851583f, 0.632567286f}, std::array<float,2>{0.840702236f, 0.705289841f}, std::array<float,2>{0.15181838f, 0.453566253f}, std::array<float,2>{0.647736013f, 0.0298260562f}, std::array<float,2>{0.497388005f, 0.785114229f}, std::array<float,2>{0.584366381f, 0.970795214f}, std::array<float,2>{0.309105515f, 0.169285759f}, std::array<float,2>{0.953831911f, 0.342471898f}, std::array<float,2>{0.100697264f, 0.561658263f}, std::array<float,2>{0.627847672f, 0.746132255f}, std::array<float,2>{0.46908617f, 0.474725902f}, std::array<float,2>{0.814864457f, 0.0498681888f}, std::array<float,2>{0.127405673f, 0.769265234f}, std::array<float,2>{0.939102232f, 0.952765346f}, std::array<float,2>{0.123260394f, 0.144018129f}, std::array<float,2>{0.572256088f, 0.359943748f}, std::array<float,2>{0.291188896f, 0.51009804f}, std::array<float,2>{0.78431952f, 0.595377266f}, std::array<float,2>{0.248214453f, 0.281295836f}, std::array<float,2>{0.727661312f, 0.214781567f}, std::array<float,2>{0.397107005f, 0.875772178f}, std::array<float,2>{0.510222375f, 0.82921654f}, std::array<float,2>{0.364634812f, 0.11944636f}, std::array<float,2>{0.923858404f, 0.394916475f}, std::array<float,2>{0.0270820651f, 0.672490239f}, std::array<float,2>{0.614629686f, 0.544749677f}, std::array<float,2>{0.262230426f, 0.315064579f}, std::array<float,2>{0.989428043f, 0.172758967f}, std::array<float,2>{0.0891382694f, 0.985405207f}, std::array<float,2>{0.850116134f, 0.800435603f}, std::array<float,2>{0.178609252f, 0.0109711243f}, std::array<float,2>{0.661970139f, 0.438506663f}, std::array<float,2>{0.449762642f, 0.698744118f}, std::array<float,2>{0.892328501f, 0.653586984f}, std::array<float,2>{0.0533324331f, 0.426345974f}, std::array<float,2>{0.5338009f, 0.088894777f}, std::array<float,2>{0.317437917f, 0.87024343f}, std::array<float,2>{0.703515232f, 0.923652589f}, std::array<float,2>{0.410851389f, 0.220536858f}, std::array<float,2>{0.772290707f, 0.2665914f}, std::array<float,2>{0.212746024f, 0.581494927f}, std::array<float,2>{0.506064773f, 0.731083512f}, std::array<float,2>{0.374025881f, 0.484571159f}, std::array<float,2>{0.933290422f, 0.0337498412f}, std::array<float,2>{0.0157378018f, 0.752310753f}, std::array<float,2>{0.796654105f, 0.960382462f}, std::array<float,2>{0.241609454f, 0.13730213f}, std::array<float,2>{0.722541809f, 0.345767707f}, std::array<float,2>{0.40300107f, 0.530522943f}, std::array<float,2>{0.950311005f, 0.621368527f}, std::array<float,2>{0.115356989f, 0.306699485f}, std::array<float,2>{0.56483978f, 0.189164668f}, std::array<float,2>{0.282187819f, 0.901596606f}, std::array<float,2>{0.633966386f, 0.817889094f}, std::array<float,2>{0.477349252f, 0.108632043f}, std::array<float,2>{0.824841201f, 0.376682818f}, std::array<float,2>{0.134623319f, 0.671022594f}, std::array<float,2>{0.714083791f, 0.557330132f}, std::array<float,2>{0.420780987f, 0.339612991f}, std::array<float,2>{0.777114451f, 0.165962726f}, std::array<float,2>{0.208677083f, 0.974165738f}, std::array<float,2>{0.90007627f, 0.786902845f}, std::array<float,2>{0.0602233484f, 0.0237671155f}, std::array<float,2>{0.543521762f, 0.46081093f}, std::array<float,2>{0.321076632f, 0.710361958f}, std::array<float,2>{0.852684796f, 0.628457606f}, std::array<float,2>{0.186924547f, 0.413780987f}, std::array<float,2>{0.671015501f, 0.0750914961f}, std::array<float,2>{0.44263047f, 0.847164631f}, std::array<float,2>{0.62205261f, 0.906285882f}, std::array<float,2>{0.256368995f, 0.239692971f}, std::array<float,2>{0.995365143f, 0.263888717f}, std::array<float,2>{0.0813860372f, 0.568010747f}, std::array<float,2>{0.680970967f, 0.677650452f}, std::array<float,2>{0.462331146f, 0.393128633f}, std::array<float,2>{0.867059231f, 0.121398315f}, std::array<float,2>{0.164233014f, 0.834444284f}, std::array<float,2>{0.976704597f, 0.878968656f}, std::array<float,2>{0.0726744905f, 0.215665996f}, std::array<float,2>{0.605824828f, 0.28832978f}, std::array<float,2>{0.277503759f, 0.599914312f}, std::array<float,2>{0.753668487f, 0.515234113f}, std::array<float,2>{0.187919527f, 0.365533799f}, std::array<float,2>{0.696446598f, 0.147423029f}, std::array<float,2>{0.423857957f, 0.948684335f}, std::array<float,2>{0.553535759f, 0.769819796f}, std::array<float,2>{0.329529017f, 0.0512615927f}, std::array<float,2>{0.888714194f, 0.469227016f}, std::array<float,2>{0.0339263715f, 0.745643735f}, std::array<float,2>{0.593448281f, 0.58243984f}, std::array<float,2>{0.303011924f, 0.272258192f}, std::array<float,2>{0.966512144f, 0.224507168f}, std::array<float,2>{0.108979963f, 0.929014742f}, std::array<float,2>{0.83271277f, 0.87132293f}, std::array<float,2>{0.142419726f, 0.0914092287f}, std::array<float,2>{0.65611738f, 0.424802512f}, std::array<float,2>{0.486335218f, 0.650369525f}, std::array<float,2>{0.91939646f, 0.70033294f}, std::array<float,2>{0.00371105177f, 0.444934756f}, std::array<float,2>{0.523100376f, 0.0119369878f}, std::array<float,2>{0.349552095f, 0.800906658f}, std::array<float,2>{0.743180573f, 0.990395069f}, std::array<float,2>{0.375806987f, 0.178926989f}, std::array<float,2>{0.806009114f, 0.317065418f}, std::array<float,2>{0.231399029f, 0.540921092f}, std::array<float,2>{0.593855619f, 0.643910527f}, std::array<float,2>{0.270665199f, 0.436041325f}, std::array<float,2>{0.9733814f, 0.0835294947f}, std::array<float,2>{0.0637846142f, 0.863267481f}, std::array<float,2>{0.867730439f, 0.937476754f}, std::array<float,2>{0.162456676f, 0.228008762f}, std::array<float,2>{0.673327863f, 0.278196722f}, std::array<float,2>{0.459719867f, 0.593310237f}, std::array<float,2>{0.877747476f, 0.53474766f}, std::array<float,2>{0.0418573506f, 0.32676971f}, std::array<float,2>{0.559576929f, 0.180611566f}, std::array<float,2>{0.340393573f, 0.996412516f}, std::array<float,2>{0.690721452f, 0.807953119f}, std::array<float,2>{0.435728639f, 0.00127402879f}, std::array<float,2>{0.764145374f, 0.452374101f}, std::array<float,2>{0.196702808f, 0.694851279f}, std::array<float,2>{0.643200338f, 0.605086327f}, std::array<float,2>{0.492511749f, 0.292719305f}, std::array<float,2>{0.838439763f, 0.206488952f}, std::array<float,2>{0.153591111f, 0.884413898f}, std::array<float,2>{0.960105658f, 0.839252412f}, std::array<float,2>{0.0940622091f, 0.115276225f}, std::array<float,2>{0.579993904f, 0.403369874f}, std::array<float,2>{0.305734128f, 0.679813325f}, std::array<float,2>{0.796898544f, 0.735663533f}, std::array<float,2>{0.220406502f, 0.479540646f}, std::array<float,2>{0.736405611f, 0.0572891273f}, std::array<float,2>{0.388515472f, 0.779432833f}, std::array<float,2>{0.526016593f, 0.94337064f}, std::array<float,2>{0.357812047f, 0.15442428f}, std::array<float,2>{0.907325387f, 0.371218592f}, std::array<float,2>{0.0113468366f, 0.506748438f}, std::array<float,2>{0.731330991f, 0.718143165f}, std::array<float,2>{0.393526256f, 0.467050254f}, std::array<float,2>{0.788245142f, 0.0185148101f}, std::array<float,2>{0.242963016f, 0.79622376f}, std::array<float,2>{0.926415503f, 0.979878783f}, std::array<float,2>{0.0303185191f, 0.157803953f}, std::array<float,2>{0.51554811f, 0.335339338f}, std::array<float,2>{0.360911548f, 0.554510534f}, std::array<float,2>{0.818980932f, 0.573855817f}, std::array<float,2>{0.129068762f, 0.250027806f}, std::array<float,2>{0.631159723f, 0.248282f}, std::array<float,2>{0.472671211f, 0.920281351f}, std::array<float,2>{0.574490011f, 0.856598914f}, std::array<float,2>{0.296433151f, 0.0655606464f}, std::array<float,2>{0.941589892f, 0.417076826f}, std::array<float,2>{0.120083481f, 0.640285015f}, std::array<float,2>{0.537266672f, 0.51672262f}, std::array<float,2>{0.315551937f, 0.357347041f}, std::array<float,2>{0.897171974f, 0.129183576f}, std::array<float,2>{0.0479427315f, 0.966765046f}, std::array<float,2>{0.767829001f, 0.760139227f}, std::array<float,2>{0.215030283f, 0.0424341857f}, std::array<float,2>{0.709468961f, 0.497638553f}, std::array<float,2>{0.406766087f, 0.724775672f}, std::array<float,2>{0.98800081f, 0.656578779f}, std::array<float,2>{0.0907734856f, 0.389958948f}, std::array<float,2>{0.61116004f, 0.0967789963f}, std::array<float,2>{0.26018858f, 0.823247373f}, std::array<float,2>{0.656881571f, 0.897507608f}, std::array<float,2>{0.448992074f, 0.202994138f}, std::array<float,2>{0.843903124f, 0.304298162f}, std::array<float,2>{0.172701493f, 0.61270833f}, std::array<float,2>{0.620640993f, 0.739742219f}, std::array<float,2>{0.253039777f, 0.484202594f}, std::array<float,2>{0.996807158f, 0.059844628f}, std::array<float,2>{0.0857655331f, 0.773861766f}, std::array<float,2>{0.856744587f, 0.939379692f}, std::array<float,2>{0.183178544f, 0.150921747f}, std::array<float,2>{0.667606831f, 0.37048921f}, std::array<float,2>{0.437955439f, 0.502298117f}, std::array<float,2>{0.906222165f, 0.607386768f}, std::array<float,2>{0.0582402535f, 0.29683286f}, std::array<float,2>{0.54207319f, 0.207990855f}, std::array<float,2>{0.327409446f, 0.888706386f}, std::array<float,2>{0.71710211f, 0.841811836f}, std::array<float,2>{0.416366309f, 0.111732103f}, std::array<float,2>{0.778624713f, 0.399323553f}, std::array<float,2>{0.205456495f, 0.684749186f}, std::array<float,2>{0.638964891f, 0.536560476f}, std::array<float,2>{0.480851293f, 0.320821285f}, std::array<float,2>{0.82089293f, 0.187485293f}, std::array<float,2>{0.138733208f, 0.994261146f}, std::array<float,2>{0.947192311f, 0.809936881f}, std::array<float,2>{0.111190155f, 0.00420673564f}, std::array<float,2>{0.567571282f, 0.447644949f}, std::array<float,2>{0.286367834f, 0.688814938f}, std::array<float,2>{0.792528152f, 0.64748013f}, std::array<float,2>{0.237395108f, 0.433372676f}, std::array<float,2>{0.726513743f, 0.0783852264f}, std::array<float,2>{0.398596108f, 0.863697171f}, std::array<float,2>{0.501663685f, 0.93211019f}, std::array<float,2>{0.368997157f, 0.231957629f}, std::array<float,2>{0.936479509f, 0.274626255f}, std::array<float,2>{0.0202966798f, 0.586009562f}, std::array<float,2>{0.748365343f, 0.662007987f}, std::array<float,2>{0.381735712f, 0.384795487f}, std::array<float,2>{0.810755849f, 0.100966103f}, std::array<float,2>{0.228360444f, 0.825445831f}, std::array<float,2>{0.916757882f, 0.894050658f}, std::array<float,2>{0.00700597884f, 0.195901558f}, std::array<float,2>{0.51607275f, 0.298317939f}, std::array<float,2>{0.346808791f, 0.61428535f}, std::array<float,2>{0.828549504f, 0.522351861f}, std::array<float,2>{0.147933602f, 0.354330003f}, std::array<float,2>{0.650855899f, 0.127567038f}, std::array<float,2>{0.489639401f, 0.963426828f}, std::array<float,2>{0.589016795f, 0.765102983f}, std::array<float,2>{0.300201416f, 0.04544672f}, std::array<float,2>{0.961539865f, 0.493459404f}, std::array<float,2>{0.104753956f, 0.722551703f}, std::array<float,2>{0.547814548f, 0.577042043f}, std::array<float,2>{0.333489358f, 0.255895197f}, std::array<float,2>{0.884747565f, 0.243004084f}, std::array<float,2>{0.0368542336f, 0.91687423f}, std::array<float,2>{0.755900025f, 0.854943871f}, std::array<float,2>{0.192400768f, 0.0695977136f}, std::array<float,2>{0.699783206f, 0.420748204f}, std::array<float,2>{0.426725477f, 0.636255324f}, std::array<float,2>{0.980508447f, 0.712492108f}, std::array<float,2>{0.0761159211f, 0.463251352f}, std::array<float,2>{0.604300022f, 0.0230242014f}, std::array<float,2>{0.276520222f, 0.78942132f}, std::array<float,2>{0.686322153f, 0.980474651f}, std::array<float,2>{0.46528399f, 0.163730189f}, std::array<float,2>{0.862526834f, 0.329707801f}, std::array<float,2>{0.170171157f, 0.548419952f}, std::array<float,2>{0.529448032f, 0.62954551f}, std::array<float,2>{0.354075223f, 0.40702489f}, std::array<float,2>{0.911277294f, 0.0739569813f}, std::array<float,2>{0.0139401155f, 0.84923017f}, std::array<float,2>{0.801273108f, 0.912001789f}, std::array<float,2>{0.223740608f, 0.237533957f}, std::array<float,2>{0.739894211f, 0.259235978f}, std::array<float,2>{0.386087924f, 0.56640619f}, std::array<float,2>{0.956827939f, 0.560362935f}, std::array<float,2>{0.0984902456f, 0.340684026f}, std::array<float,2>{0.582663417f, 0.170863971f}, std::array<float,2>{0.311017722f, 0.969474077f}, std::array<float,2>{0.646313965f, 0.782494724f}, std::array<float,2>{0.498777419f, 0.0279136412f}, std::array<float,2>{0.843609095f, 0.455333531f}, std::array<float,2>{0.14844422f, 0.703650892f}, std::array<float,2>{0.693062961f, 0.620067179f}, std::array<float,2>{0.432012618f, 0.309532493f}, std::array<float,2>{0.761430323f, 0.194002882f}, std::array<float,2>{0.200895846f, 0.905237675f}, std::array<float,2>{0.88187778f, 0.814068139f}, std::array<float,2>{0.0443183444f, 0.10494379f}, std::array<float,2>{0.558574259f, 0.379917681f}, std::array<float,2>{0.337298244f, 0.665210605f}, std::array<float,2>{0.871495366f, 0.729217112f}, std::array<float,2>{0.157161266f, 0.48927322f}, std::array<float,2>{0.679296255f, 0.0369393677f}, std::array<float,2>{0.453780949f, 0.755575955f}, std::array<float,2>{0.599839866f, 0.956706464f}, std::array<float,2>{0.268809795f, 0.134073555f}, std::array<float,2>{0.969635844f, 0.350669712f}, std::array<float,2>{0.0699327067f, 0.525845885f}, std::array<float,2>{0.662268519f, 0.696674407f}, std::array<float,2>{0.452185392f, 0.439597875f}, std::array<float,2>{0.848158538f, 0.00876762252f}, std::array<float,2>{0.176078826f, 0.797262967f}, std::array<float,2>{0.991299212f, 0.987010062f}, std::array<float,2>{0.0863280892f, 0.173959687f}, std::array<float,2>{0.616844058f, 0.313678384f}, std::array<float,2>{0.264861882f, 0.546132624f}, std::array<float,2>{0.771188617f, 0.579919577f}, std::array<float,2>{0.214311466f, 0.269297421f}, std::array<float,2>{0.705276132f, 0.22209385f}, std::array<float,2>{0.413702518f, 0.925390005f}, std::array<float,2>{0.531722128f, 0.867192984f}, std::array<float,2>{0.318446249f, 0.0861973614f}, std::array<float,2>{0.893723369f, 0.42875576f}, std::array<float,2>{0.051661443f, 0.656046152f}, std::array<float,2>{0.573520601f, 0.507870317f}, std::array<float,2>{0.289110184f, 0.361342639f}, std::array<float,2>{0.939534664f, 0.141841337f}, std::array<float,2>{0.122997902f, 0.951045156f}, std::array<float,2>{0.813215673f, 0.766638398f}, std::array<float,2>{0.126736596f, 0.047824055f}, std::array<float,2>{0.625662327f, 0.472958714f}, std::array<float,2>{0.47252664f, 0.749943674f}, std::array<float,2>{0.922532916f, 0.67507267f}, std::array<float,2>{0.0241605937f, 0.397587657f}, std::array<float,2>{0.509650409f, 0.118473686f}, std::array<float,2>{0.365771085f, 0.831177711f}, std::array<float,2>{0.728680074f, 0.877543628f}, std::array<float,2>{0.394602001f, 0.211852267f}, std::array<float,2>{0.78315109f, 0.285005152f}, std::array<float,2>{0.248027638f, 0.597593665f}, std::array<float,2>{0.546521068f, 0.708196223f}, std::array<float,2>{0.323421925f, 0.45756942f}, std::array<float,2>{0.901675284f, 0.0259609632f}, std::array<float,2>{0.0611263178f, 0.78893429f}, std::array<float,2>{0.775275648f, 0.975924015f}, std::array<float,2>{0.210346788f, 0.166510746f}, std::array<float,2>{0.711250246f, 0.337168723f}, std::array<float,2>{0.418961197f, 0.556511998f}, std::array<float,2>{0.992790222f, 0.568388402f}, std::array<float,2>{0.0785703659f, 0.262572289f}, std::array<float,2>{0.624027073f, 0.240828708f}, std::array<float,2>{0.254664272f, 0.909230471f}, std::array<float,2>{0.66950053f, 0.845332801f}, std::array<float,2>{0.445220679f, 0.0772083104f}, std::array<float,2>{0.854852796f, 0.411821544f}, std::array<float,2>{0.185288191f, 0.625537753f}, std::array<float,2>{0.719044805f, 0.528816164f}, std::array<float,2>{0.405002177f, 0.345390111f}, std::array<float,2>{0.794700444f, 0.138789073f}, std::array<float,2>{0.23949948f, 0.958194375f}, std::array<float,2>{0.930518448f, 0.750824213f}, std::array<float,2>{0.0182279348f, 0.0322140716f}, std::array<float,2>{0.504625559f, 0.486793607f}, std::array<float,2>{0.372362256f, 0.733153582f}, std::array<float,2>{0.826475024f, 0.668482482f}, std::array<float,2>{0.136658981f, 0.377014399f}, std::array<float,2>{0.635495305f, 0.106172264f}, std::array<float,2>{0.479863703f, 0.819447935f}, std::array<float,2>{0.562521458f, 0.898807287f}, std::array<float,2>{0.283937365f, 0.19111149f}, std::array<float,2>{0.952351511f, 0.306130558f}, std::array<float,2>{0.113379091f, 0.623423696f}, std::array<float,2>{0.653595924f, 0.650691807f}, std::array<float,2>{0.484862804f, 0.421949834f}, std::array<float,2>{0.834243059f, 0.0922020003f}, std::array<float,2>{0.14284502f, 0.874452412f}, std::array<float,2>{0.966907144f, 0.926639676f}, std::array<float,2>{0.10734383f, 0.226516411f}, std::array<float,2>{0.590334475f, 0.270028502f}, std::array<float,2>{0.3014884f, 0.58469516f}, std::array<float,2>{0.807332337f, 0.542214692f}, std::array<float,2>{0.233025089f, 0.319078028f}, std::array<float,2>{0.745644569f, 0.176230222f}, std::array<float,2>{0.378158063f, 0.988570631f}, std::array<float,2>{0.520080328f, 0.803507328f}, std::array<float,2>{0.35112974f, 0.0144549105f}, std::array<float,2>{0.92051518f, 0.441782355f}, std::array<float,2>{0.000177284732f, 0.702226758f}, std::array<float,2>{0.609323621f, 0.598541081f}, std::array<float,2>{0.281221807f, 0.286926478f}, std::array<float,2>{0.980419993f, 0.217872441f}, std::array<float,2>{0.0706131086f, 0.882776737f}, std::array<float,2>{0.864691734f, 0.832554162f}, std::array<float,2>{0.166872218f, 0.124389835f}, std::array<float,2>{0.681920052f, 0.391116589f}, std::array<float,2>{0.463696927f, 0.678372145f}, std::array<float,2>{0.887397766f, 0.743673146f}, std::array<float,2>{0.0329259485f, 0.472277224f}, std::array<float,2>{0.55264765f, 0.0543280281f}, std::array<float,2>{0.330266505f, 0.772953153f}, std::array<float,2>{0.697569609f, 0.946899831f}, std::array<float,2>{0.422284722f, 0.146212608f}, std::array<float,2>{0.75178057f, 0.364115387f}, std::array<float,2>{0.190837309f, 0.512887836f}, std::array<float,2>{0.580140233f, 0.683144331f}, std::array<float,2>{0.308082223f, 0.405358583f}, std::array<float,2>{0.958484113f, 0.114567392f}, std::array<float,2>{0.0962404087f, 0.837035775f}, std::array<float,2>{0.836000144f, 0.885100126f}, std::array<float,2>{0.154309109f, 0.20439145f}, std::array<float,2>{0.640647709f, 0.290018916f}, std::array<float,2>{0.495313913f, 0.601995587f}, std::array<float,2>{0.908737898f, 0.504639566f}, std::array<float,2>{0.00878803339f, 0.374567032f}, std::array<float,2>{0.52352792f, 0.153573245f}, std::array<float,2>{0.355823755f, 0.941773951f}, std::array<float,2>{0.735512972f, 0.778293312f}, std::array<float,2>{0.389769703f, 0.0550352931f}, std::array<float,2>{0.798964441f, 0.4775711f}, std::array<float,2>{0.221132085f, 0.736891448f}, std::array<float,2>{0.674158037f, 0.590039253f}, std::array<float,2>{0.458934814f, 0.27947852f}, std::array<float,2>{0.869602621f, 0.228799924f}, std::array<float,2>{0.160589293f, 0.934069157f}, std::array<float,2>{0.975539088f, 0.860889852f}, std::array<float,2>{0.0661262125f, 0.0840801299f}, std::array<float,2>{0.596569836f, 0.434203714f}, std::array<float,2>{0.27284053f, 0.642386079f}, std::array<float,2>{0.763647616f, 0.69317162f}, std::array<float,2>{0.197742283f, 0.450351894f}, std::array<float,2>{0.689401448f, 0.00292624673f}, std::array<float,2>{0.43397963f, 0.805145025f}, std::array<float,2>{0.562328458f, 0.999622047f}, std::array<float,2>{0.343372494f, 0.18165271f}, std::array<float,2>{0.876806319f, 0.324681133f}, std::array<float,2>{0.0392475277f, 0.532365382f}, std::array<float,2>{0.708017826f, 0.72322762f}, std::array<float,2>{0.408960789f, 0.498902142f}, std::array<float,2>{0.766592085f, 0.039241001f}, std::array<float,2>{0.217595428f, 0.758173645f}, std::array<float,2>{0.895368159f, 0.96849978f}, std::array<float,2>{0.0505869202f, 0.131874576f}, std::array<float,2>{0.535228193f, 0.35827148f}, std::array<float,2>{0.31265834f, 0.518784642f}, std::array<float,2>{0.846438348f, 0.609624982f}, std::array<float,2>{0.174687609f, 0.300962269f}, std::array<float,2>{0.659671128f, 0.200449035f}, std::array<float,2>{0.445720673f, 0.894926727f}, std::array<float,2>{0.611688554f, 0.820872426f}, std::array<float,2>{0.258733153f, 0.0955974311f}, std::array<float,2>{0.985297978f, 0.388558656f}, std::array<float,2>{0.0918682441f, 0.658832371f}, std::array<float,2>{0.512869537f, 0.552499413f}, std::array<float,2>{0.362641037f, 0.332209229f}, std::array<float,2>{0.929249108f, 0.159271285f}, std::array<float,2>{0.0280953757f, 0.977200866f}, std::array<float,2>{0.786334097f, 0.794885933f}, std::array<float,2>{0.244689584f, 0.0156318508f}, std::array<float,2>{0.73245585f, 0.466677785f}, std::array<float,2>{0.390870333f, 0.716552794f}, std::array<float,2>{0.944948614f, 0.637083292f}, std::array<float,2>{0.118491083f, 0.415118307f}, std::array<float,2>{0.57736665f, 0.0637163669f}, std::array<float,2>{0.293121904f, 0.857508957f}, std::array<float,2>{0.629292905f, 0.919039071f}, std::array<float,2>{0.47465378f, 0.246130362f}, std::array<float,2>{0.817726433f, 0.253657758f}, std::array<float,2>{0.131030768f, 0.571554899f}, std::array<float,2>{0.58746779f, 0.720715582f}, std::array<float,2>{0.297578424f, 0.49230206f}, std::array<float,2>{0.963989675f, 0.0465391763f}, std::array<float,2>{0.103478521f, 0.764518678f}, std::array<float,2>{0.830825329f, 0.964627445f}, std::array<float,2>{0.145489201f, 0.128132522f}, std::array<float,2>{0.648807168f, 0.354648769f}, std::array<float,2>{0.492096066f, 0.523247063f}, std::array<float,2>{0.915040076f, 0.613943636f}, std::array<float,2>{0.00543666724f, 0.297638953f}, std::array<float,2>{0.517869771f, 0.196682692f}, std::array<float,2>{0.344449759f, 0.892787933f}, std::array<float,2>{0.747474849f, 0.824972332f}, std::array<float,2>{0.379696757f, 0.0998615697f}, std::array<float,2>{0.810510993f, 0.386160463f}, std::array<float,2>{0.229836255f, 0.660453498f}, std::array<float,2>{0.684920013f, 0.546962678f}, std::array<float,2>{0.467102379f, 0.32849887f}, std::array<float,2>{0.861290634f, 0.163026452f}, std::array<float,2>{0.168432742f, 0.982308567f}, std::array<float,2>{0.983568788f, 0.790535212f}, std::array<float,2>{0.0766560659f, 0.0216917545f}, std::array<float,2>{0.60348773f, 0.464070112f}, std::array<float,2>{0.273444057f, 0.711386085f}, std::array<float,2>{0.755271852f, 0.634976327f}, std::array<float,2>{0.194433481f, 0.420900673f}, std::array<float,2>{0.702475846f, 0.0685528964f}, std::array<float,2>{0.428431362f, 0.854370415f}, std::array<float,2>{0.549773335f, 0.917360187f}, std::array<float,2>{0.335551441f, 0.243922189f}, std::array<float,2>{0.886207581f, 0.257369846f}, std::array<float,2>{0.037516918f, 0.577587008f}, std::array<float,2>{0.716575146f, 0.684050083f}, std::array<float,2>{0.414500505f, 0.40026927f}, std::array<float,2>{0.780559659f, 0.113276713f}, std::array<float,2>{0.203248218f, 0.843159199f}, std::array<float,2>{0.902852178f, 0.890361607f}, std::array<float,2>{0.0556434132f, 0.208113f}, std::array<float,2>{0.539163768f, 0.295503736f}, std::array<float,2>{0.325382978f, 0.605534494f}, std::array<float,2>{0.858086348f, 0.503545761f}, std::array<float,2>{0.180334091f, 0.369950265f}, std::array<float,2>{0.665123284f, 0.151621938f}, std::array<float,2>{0.439911783f, 0.937903225f}, std::array<float,2>{0.618492782f, 0.774820566f}, std::array<float,2>{0.251364648f, 0.0589243658f}, std::array<float,2>{0.999148846f, 0.483028054f}, std::array<float,2>{0.0835150629f, 0.739203751f}, std::array<float,2>{0.502581954f, 0.587317824f}, std::array<float,2>{0.370372593f, 0.274401039f}, std::array<float,2>{0.933781147f, 0.23055023f}, std::array<float,2>{0.0228480063f, 0.933352172f}, std::array<float,2>{0.790433347f, 0.864640057f}, std::array<float,2>{0.235181943f, 0.0791698843f}, std::array<float,2>{0.723861814f, 0.431813568f}, std::array<float,2>{0.402235359f, 0.646669447f}, std::array<float,2>{0.947790444f, 0.687706172f}, std::array<float,2>{0.1125817f, 0.448947877f}, std::array<float,2>{0.568414271f, 0.00571246352f}, std::array<float,2>{0.287218899f, 0.809324145f}, std::array<float,2>{0.638446271f, 0.995716691f}, std::array<float,2>{0.483881831f, 0.186343431f}, std::array<float,2>{0.823036194f, 0.321945965f}, std::array<float,2>{0.138129592f, 0.535704553f}, std::array<float,2>{0.53432107f, 0.654965937f}, std::array<float,2>{0.316882342f, 0.427867621f}, std::array<float,2>{0.891304672f, 0.0875187814f}, std::array<float,2>{0.0539113395f, 0.868705571f}, std::array<float,2>{0.772931635f, 0.924373806f}, std::array<float,2>{0.21128571f, 0.220979825f}, std::array<float,2>{0.70466131f, 0.267746061f}, std::array<float,2>{0.411490411f, 0.578535736f}, std::array<float,2>{0.988823175f, 0.545275331f}, std::array<float,2>{0.0881156474f, 0.313356251f}, std::array<float,2>{0.61343956f, 0.175775886f}, std::array<float,2>{0.262892574f, 0.987525284f}, std::array<float,2>{0.660659432f, 0.798369348f}, std::array<float,2>{0.450344831f, 0.00971538294f}, std::array<float,2>{0.850945771f, 0.441364676f}, std::array<float,2>{0.178835973f, 0.696271598f}, std::array<float,2>{0.72659719f, 0.596160352f}, std::array<float,2>{0.398032248f, 0.283691734f}, std::array<float,2>{0.783258975f, 0.212727651f}, std::array<float,2>{0.249111667f, 0.87845248f}, std::array<float,2>{0.924983859f, 0.830743074f}, std::array<float,2>{0.0253958385f, 0.117563508f}, std::array<float,2>{0.510896742f, 0.397436887f}, std::array<float,2>{0.36384216f, 0.673903763f}, std::array<float,2>{0.816242397f, 0.74808234f}, std::array<float,2>{0.128708914f, 0.474154115f}, std::array<float,2>{0.628665805f, 0.0483201332f}, std::array<float,2>{0.470626622f, 0.766279042f}, std::array<float,2>{0.570729673f, 0.949852228f}, std::array<float,2>{0.292947203f, 0.140920237f}, std::array<float,2>{0.938221216f, 0.362570643f}, std::array<float,2>{0.12497402f, 0.50893259f}, std::array<float,2>{0.647104144f, 0.704387367f}, std::array<float,2>{0.496385813f, 0.456470788f}, std::array<float,2>{0.841785908f, 0.0286865253f}, std::array<float,2>{0.150446609f, 0.781951547f}, std::array<float,2>{0.954674423f, 0.970639825f}, std::array<float,2>{0.100238957f, 0.171417832f}, std::array<float,2>{0.58551836f, 0.340959072f}, std::array<float,2>{0.309822589f, 0.559035003f}, std::array<float,2>{0.802996099f, 0.56513989f}, std::array<float,2>{0.224912912f, 0.258334011f}, std::array<float,2>{0.741777241f, 0.236978725f}, std::array<float,2>{0.383544087f, 0.910277009f}, std::array<float,2>{0.52870506f, 0.847914815f}, std::array<float,2>{0.3535119f, 0.0731836781f}, std::array<float,2>{0.912475228f, 0.408143193f}, std::array<float,2>{0.0125309909f, 0.629970968f}, std::array<float,2>{0.598281205f, 0.526624262f}, std::array<float,2>{0.26573658f, 0.350159168f}, std::array<float,2>{0.971486926f, 0.13281633f}, std::array<float,2>{0.0670470819f, 0.955611587f}, std::array<float,2>{0.874130785f, 0.754558027f}, std::array<float,2>{0.158491671f, 0.0360778384f}, std::array<float,2>{0.677302659f, 0.489040673f}, std::array<float,2>{0.455760092f, 0.730432212f}, std::array<float,2>{0.879016042f, 0.664239585f}, std::array<float,2>{0.0456595905f, 0.37929517f}, std::array<float,2>{0.556532681f, 0.103923216f}, std::array<float,2>{0.338237315f, 0.812955558f}, std::array<float,2>{0.694591939f, 0.905776024f}, std::array<float,2>{0.430747956f, 0.194645792f}, std::array<float,2>{0.758609474f, 0.309899062f}, std::array<float,2>{0.201479167f, 0.620935559f}, std::array<float,2>{0.522135615f, 0.70155555f}, std::array<float,2>{0.348568052f, 0.443096787f}, std::array<float,2>{0.918069303f, 0.0146695636f}, std::array<float,2>{0.00236713351f, 0.803804338f}, std::array<float,2>{0.804731548f, 0.990005672f}, std::array<float,2>{0.231826454f, 0.177677244f}, std::array<float,2>{0.742575884f, 0.320290625f}, std::array<float,2>{0.376697123f, 0.541381121f}, std::array<float,2>{0.965257466f, 0.585819542f}, std::array<float,2>{0.107662208f, 0.270758212f}, std::array<float,2>{0.591999888f, 0.225440606f}, std::array<float,2>{0.304078043f, 0.92765063f}, std::array<float,2>{0.654825866f, 0.873542368f}, std::array<float,2>{0.487536371f, 0.0927951857f}, std::array<float,2>{0.83353585f, 0.423484027f}, std::array<float,2>{0.140705556f, 0.652049363f}, std::array<float,2>{0.695353568f, 0.512224853f}, std::array<float,2>{0.424912691f, 0.364621699f}, std::array<float,2>{0.752828777f, 0.145058572f}, std::array<float,2>{0.189322889f, 0.945971251f}, std::array<float,2>{0.890067399f, 0.771575093f}, std::array<float,2>{0.0343508944f, 0.0533708893f}, std::array<float,2>{0.553953946f, 0.471537799f}, std::array<float,2>{0.328384876f, 0.742460251f}, std::array<float,2>{0.866102695f, 0.679382682f}, std::array<float,2>{0.165882528f, 0.392297596f}, std::array<float,2>{0.680111647f, 0.123616233f}, std::array<float,2>{0.461716354f, 0.833651602f}, std::array<float,2>{0.607386768f, 0.881440222f}, std::array<float,2>{0.27836597f, 0.217414662f}, std::array<float,2>{0.977603674f, 0.285822183f}, std::array<float,2>{0.074090451f, 0.599443197f}, std::array<float,2>{0.66997385f, 0.62626189f}, std::array<float,2>{0.441963792f, 0.410855114f}, std::array<float,2>{0.851945817f, 0.0771294385f}, std::array<float,2>{0.186513394f, 0.844017386f}, std::array<float,2>{0.994978845f, 0.908252776f}, std::array<float,2>{0.080639407f, 0.241794229f}, std::array<float,2>{0.622563541f, 0.262963325f}, std::array<float,2>{0.256903768f, 0.569431126f}, std::array<float,2>{0.775865138f, 0.555574358f}, std::array<float,2>{0.207403108f, 0.336694777f}, std::array<float,2>{0.713281929f, 0.167015374f}, std::array<float,2>{0.421225429f, 0.975203753f}, std::array<float,2>{0.544820726f, 0.787806988f}, std::array<float,2>{0.321468204f, 0.0271301754f}, std::array<float,2>{0.898915112f, 0.458442599f}, std::array<float,2>{0.058717519f, 0.707882464f}, std::array<float,2>{0.566278875f, 0.62466085f}, std::array<float,2>{0.283190727f, 0.304906219f}, std::array<float,2>{0.949769676f, 0.189789519f}, std::array<float,2>{0.116312787f, 0.90032351f}, std::array<float,2>{0.826097846f, 0.818866909f}, std::array<float,2>{0.132893488f, 0.107343413f}, std::array<float,2>{0.633180439f, 0.377996594f}, std::array<float,2>{0.477567643f, 0.668968737f}, std::array<float,2>{0.932604671f, 0.733721793f}, std::array<float,2>{0.0174788926f, 0.487698108f}, std::array<float,2>{0.507523358f, 0.0324379355f}, std::array<float,2>{0.373371482f, 0.751683295f}, std::array<float,2>{0.720856488f, 0.957441866f}, std::array<float,2>{0.40340814f, 0.13979502f}, std::array<float,2>{0.795865536f, 0.34469682f}, std::array<float,2>{0.240255579f, 0.528089643f}, std::array<float,2>{0.609951794f, 0.659319282f}, std::array<float,2>{0.261698574f, 0.386839747f}, std::array<float,2>{0.987224996f, 0.0944222957f}, std::array<float,2>{0.0916033462f, 0.821821749f}, std::array<float,2>{0.844816446f, 0.895982206f}, std::array<float,2>{0.173116773f, 0.200046688f}, std::array<float,2>{0.657795966f, 0.302662194f}, std::array<float,2>{0.447304964f, 0.611158729f}, std::array<float,2>{0.897495389f, 0.518292964f}, std::array<float,2>{0.0473619103f, 0.358701468f}, std::array<float,2>{0.538283587f, 0.131471097f}, std::array<float,2>{0.314641327f, 0.966993213f}, std::array<float,2>{0.710359156f, 0.759083152f}, std::array<float,2>{0.407532573f, 0.040866483f}, std::array<float,2>{0.768855631f, 0.499177814f}, std::array<float,2>{0.216514707f, 0.724554062f}, std::array<float,2>{0.63259095f, 0.571117282f}, std::array<float,2>{0.473663092f, 0.252474189f}, std::array<float,2>{0.819931209f, 0.247801021f}, std::array<float,2>{0.129972935f, 0.918807864f}, std::array<float,2>{0.943167448f, 0.85912621f}, std::array<float,2>{0.120630175f, 0.0629583597f}, std::array<float,2>{0.575610161f, 0.414577544f}, std::array<float,2>{0.295548677f, 0.637745857f}, std::array<float,2>{0.78754735f, 0.715367317f}, std::array<float,2>{0.243530795f, 0.465323478f}, std::array<float,2>{0.731678605f, 0.0167416949f}, std::array<float,2>{0.394413501f, 0.792988718f}, std::array<float,2>{0.514191985f, 0.977965832f}, std::array<float,2>{0.359637678f, 0.158577487f}, std::array<float,2>{0.92747438f, 0.333838046f}, std::array<float,2>{0.0296537671f, 0.551128268f}, std::array<float,2>{0.737453401f, 0.737583101f}, std::array<float,2>{0.387501687f, 0.476848632f}, std::array<float,2>{0.798642874f, 0.0564416684f}, std::array<float,2>{0.21876663f, 0.77859813f}, std::array<float,2>{0.906674564f, 0.942820847f}, std::array<float,2>{0.0104919141f, 0.153156996f}, std::array<float,2>{0.526772618f, 0.373497546f}, std::array<float,2>{0.358636498f, 0.50509268f}, std::array<float,2>{0.839010537f, 0.602947474f}, std::array<float,2>{0.153123334f, 0.290989399f}, std::array<float,2>{0.644186199f, 0.204100713f}, std::array<float,2>{0.494128764f, 0.885889947f}, std::array<float,2>{0.579002082f, 0.836361229f}, std::array<float,2>{0.305640548f, 0.113455847f}, std::array<float,2>{0.959452987f, 0.404309243f}, std::array<float,2>{0.0949562714f, 0.682561934f}, std::array<float,2>{0.558710456f, 0.531371772f}, std::array<float,2>{0.341168731f, 0.325561434f}, std::array<float,2>{0.878594697f, 0.183404803f}, std::array<float,2>{0.0425347015f, 0.998436213f}, std::array<float,2>{0.764785826f, 0.806213558f}, std::array<float,2>{0.195486665f, 0.0031416358f}, std::array<float,2>{0.689906597f, 0.44988963f}, std::array<float,2>{0.436914861f, 0.692259431f}, std::array<float,2>{0.974437475f, 0.640905976f}, std::array<float,2>{0.0629953966f, 0.434751719f}, std::array<float,2>{0.595351875f, 0.0857675225f}, std::array<float,2>{0.270089328f, 0.859529495f}, std::array<float,2>{0.672094047f, 0.934983611f}, std::array<float,2>{0.460636884f, 0.229750574f}, std::array<float,2>{0.868768513f, 0.280776978f}, std::array<float,2>{0.163264111f, 0.590911567f}, std::array<float,2>{0.605127752f, 0.713416219f}, std::array<float,2>{0.275417358f, 0.462576568f}, std::array<float,2>{0.981924117f, 0.0205168519f}, std::array<float,2>{0.0743434876f, 0.791128457f}, std::array<float,2>{0.861991346f, 0.982728124f}, std::array<float,2>{0.170982435f, 0.161276281f}, std::array<float,2>{0.686909318f, 0.330968916f}, std::array<float,2>{0.466455162f, 0.54958272f}, std::array<float,2>{0.882830739f, 0.574841142f}, std::array<float,2>{0.03560609f, 0.254289746f}, std::array<float,2>{0.54879123f, 0.244945198f}, std::array<float,2>{0.332928956f, 0.915318966f}, std::array<float,2>{0.700976968f, 0.85206908f}, std::array<float,2>{0.427521318f, 0.0682084784f}, std::array<float,2>{0.757425487f, 0.418461472f}, std::array<float,2>{0.191706643f, 0.633763134f}, std::array<float,2>{0.652184129f, 0.519824803f}, std::array<float,2>{0.488932312f, 0.352699816f}, std::array<float,2>{0.829194844f, 0.126865655f}, std::array<float,2>{0.146797672f, 0.962143719f}, std::array<float,2>{0.962707818f, 0.762674749f}, std::array<float,2>{0.103788257f, 0.0438251235f}, std::array<float,2>{0.58865118f, 0.496073544f}, std::array<float,2>{0.299194753f, 0.719559193f}, std::array<float,2>{0.811792612f, 0.663212657f}, std::array<float,2>{0.22680594f, 0.384542465f}, std::array<float,2>{0.749685526f, 0.0994950384f}, std::array<float,2>{0.382405221f, 0.828075469f}, std::array<float,2>{0.516992688f, 0.891729295f}, std::array<float,2>{0.345850736f, 0.197718009f}, std::array<float,2>{0.917641878f, 0.300275862f}, std::array<float,2>{0.00641583232f, 0.615796387f}, std::array<float,2>{0.725114286f, 0.645210028f}, std::array<float,2>{0.400192499f, 0.429831356f}, std::array<float,2>{0.791850805f, 0.081365943f}, std::array<float,2>{0.237176627f, 0.866261303f}, std::array<float,2>{0.936664581f, 0.931369781f}, std::array<float,2>{0.021010939f, 0.232433885f}, std::array<float,2>{0.500141025f, 0.275578469f}, std::array<float,2>{0.368061513f, 0.588773668f}, std::array<float,2>{0.821984589f, 0.538754046f}, std::array<float,2>{0.140491113f, 0.322427362f}, std::array<float,2>{0.6405707f, 0.184300825f}, std::array<float,2>{0.482229531f, 0.993608475f}, std::array<float,2>{0.567187607f, 0.811008036f}, std::array<float,2>{0.286121607f, 0.00663019065f}, std::array<float,2>{0.946019113f, 0.446642458f}, std::array<float,2>{0.11000035f, 0.690024734f}, std::array<float,2>{0.541638494f, 0.607690096f}, std::array<float,2>{0.326953441f, 0.293142468f}, std::array<float,2>{0.904719234f, 0.210730374f}, std::array<float,2>{0.0567130558f, 0.888564885f}, std::array<float,2>{0.777503788f, 0.840800703f}, std::array<float,2>{0.206566215f, 0.110272616f}, std::array<float,2>{0.717912555f, 0.400660843f}, std::array<float,2>{0.417087942f, 0.686440825f}, std::array<float,2>{0.997904003f, 0.740837336f}, std::array<float,2>{0.0845702365f, 0.48172009f}, std::array<float,2>{0.61980176f, 0.0624894053f}, std::array<float,2>{0.252615988f, 0.776031911f}, std::array<float,2>{0.666582048f, 0.940294206f}, std::array<float,2>{0.438837141f, 0.14959918f}, std::array<float,2>{0.855587184f, 0.36812669f}, std::array<float,2>{0.182550639f, 0.50019604f}, std::array<float,2>{0.508405626f, 0.673208892f}, std::array<float,2>{0.366598874f, 0.396348774f}, std::array<float,2>{0.923827291f, 0.120339014f}, std::array<float,2>{0.0247109011f, 0.828291655f}, std::array<float,2>{0.781877935f, 0.87649399f}, std::array<float,2>{0.24706091f, 0.21370329f}, std::array<float,2>{0.72985822f, 0.282903582f}, std::array<float,2>{0.395882726f, 0.594017506f}, std::array<float,2>{0.940445483f, 0.511656463f}, std::array<float,2>{0.121521771f, 0.360411614f}, std::array<float,2>{0.57319653f, 0.142979354f}, std::array<float,2>{0.290054798f, 0.951698363f}, std::array<float,2>{0.626517355f, 0.768122733f}, std::array<float,2>{0.471017003f, 0.0493456982f}, std::array<float,2>{0.813602269f, 0.476269722f}, std::array<float,2>{0.125558928f, 0.747712255f}, std::array<float,2>{0.706950545f, 0.581040502f}, std::array<float,2>{0.412695438f, 0.267215192f}, std::array<float,2>{0.76955837f, 0.218835726f}, std::array<float,2>{0.213265166f, 0.921895862f}, std::array<float,2>{0.892769694f, 0.869687498f}, std::array<float,2>{0.0525157489f, 0.0883735344f}, std::array<float,2>{0.532662272f, 0.427300423f}, std::array<float,2>{0.319777727f, 0.653054357f}, std::array<float,2>{0.848670304f, 0.697980344f}, std::array<float,2>{0.177022874f, 0.437562436f}, std::array<float,2>{0.663251281f, 0.0101185599f}, std::array<float,2>{0.451348573f, 0.799627304f}, std::array<float,2>{0.616169155f, 0.984959304f}, std::array<float,2>{0.26451391f, 0.173653901f}, std::array<float,2>{0.990434468f, 0.316245943f}, std::array<float,2>{0.0875504762f, 0.543166876f}, std::array<float,2>{0.677788556f, 0.726777852f}, std::array<float,2>{0.454708189f, 0.490821272f}, std::array<float,2>{0.872471333f, 0.0384815037f}, std::array<float,2>{0.157452703f, 0.756543279f}, std::array<float,2>{0.969771922f, 0.954409897f}, std::array<float,2>{0.0690457895f, 0.136305898f}, std::array<float,2>{0.601330876f, 0.348186761f}, std::array<float,2>{0.26818946f, 0.523894787f}, std::array<float,2>{0.760314941f, 0.619001031f}, std::array<float,2>{0.199929088f, 0.312019289f}, std::array<float,2>{0.692323685f, 0.192446768f}, std::array<float,2>{0.432649106f, 0.902640045f}, std::array<float,2>{0.557034552f, 0.816030622f}, std::array<float,2>{0.336896032f, 0.102469914f}, std::array<float,2>{0.881661832f, 0.380913377f}, std::array<float,2>{0.0439219885f, 0.66732204f}, std::array<float,2>{0.583736002f, 0.561078012f}, std::array<float,2>{0.312215596f, 0.343533695f}, std::array<float,2>{0.955915093f, 0.168857485f}, std::array<float,2>{0.0992589965f, 0.972522974f}, std::array<float,2>{0.842418134f, 0.783609927f}, std::array<float,2>{0.14987947f, 0.0307833906f}, std::array<float,2>{0.644589126f, 0.454434961f}, std::array<float,2>{0.499842942f, 0.706916749f}, std::array<float,2>{0.910388887f, 0.631691873f}, std::array<float,2>{0.0147431865f, 0.409249634f}, std::array<float,2>{0.530323982f, 0.0708164722f}, std::array<float,2>{0.354974091f, 0.851179242f}, std::array<float,2>{0.738479972f, 0.913721502f}, std::array<float,2>{0.385317922f, 0.235456929f}, std::array<float,2>{0.802073598f, 0.2600016f}, std::array<float,2>{0.22276254f, 0.563619673f}, std::array<float,2>{0.551144898f, 0.744920313f}, std::array<float,2>{0.331586838f, 0.470186144f}, std::array<float,2>{0.888022482f, 0.0522365011f}, std::array<float,2>{0.0313717201f, 0.770558834f}, std::array<float,2>{0.750839114f, 0.947923601f}, std::array<float,2>{0.189954281f, 0.14754048f}, std::array<float,2>{0.698659897f, 0.366349667f}, std::array<float,2>{0.423688143f, 0.514431715f}, std::array<float,2>{0.978666425f, 0.601038158f}, std::array<float,2>{0.0721645132f, 0.287993848f}, std::array<float,2>{0.607746542f, 0.216726139f}, std::array<float,2>{0.280018896f, 0.880791485f}, std::array<float,2>{0.682656944f, 0.835542917f}, std::array<float,2>{0.464701593f, 0.122702949f}, std::array<float,2>{0.863446176f, 0.393631101f}, std::array<float,2>{0.167769223f, 0.676356077f}, std::array<float,2>{0.744987845f, 0.539268792f}, std::array<float,2>{0.37715289f, 0.317951113f}, std::array<float,2>{0.807863891f, 0.17843762f}, std::array<float,2>{0.233425289f, 0.992028236f}, std::array<float,2>{0.921117961f, 0.802034855f}, std::array<float,2>{0.00100285641f, 0.0133566838f}, std::array<float,2>{0.521226764f, 0.443681359f}, std::array<float,2>{0.34986493f, 0.699754536f}, std::array<float,2>{0.835749805f, 0.648718297f}, std::array<float,2>{0.144001335f, 0.424842179f}, std::array<float,2>{0.652658582f, 0.0904874429f}, std::array<float,2>{0.485955238f, 0.872401953f}, std::array<float,2>{0.591134131f, 0.928001583f}, std::array<float,2>{0.302630603f, 0.222985938f}, std::array<float,2>{0.968729615f, 0.273068428f}, std::array<float,2>{0.106020704f, 0.583553553f}, std::array<float,2>{0.636079311f, 0.670126498f}, std::array<float,2>{0.479014695f, 0.375933439f}, std::array<float,2>{0.827917278f, 0.107809149f}, std::array<float,2>{0.134810537f, 0.816659808f}, std::array<float,2>{0.951997042f, 0.900744259f}, std::array<float,2>{0.1151153f, 0.187636197f}, std::array<float,2>{0.56378758f, 0.308411568f}, std::array<float,2>{0.284796685f, 0.622111559f}, std::array<float,2>{0.793559372f, 0.529450059f}, std::array<float,2>{0.238920227f, 0.346775979f}, std::array<float,2>{0.720606565f, 0.1385746f}, std::array<float,2>{0.405767679f, 0.959264338f}, std::array<float,2>{0.505856693f, 0.753207564f}, std::array<float,2>{0.371784002f, 0.0342845097f}, std::array<float,2>{0.931429863f, 0.485798031f}, std::array<float,2>{0.0192182306f, 0.731484234f}, std::array<float,2>{0.623483658f, 0.566895127f}, std::array<float,2>{0.25551185f, 0.264834613f}, std::array<float,2>{0.993292987f, 0.238317251f}, std::array<float,2>{0.0798319727f, 0.907732725f}, std::array<float,2>{0.854327202f, 0.846506476f}, std::array<float,2>{0.184045434f, 0.0754252747f}, std::array<float,2>{0.667979538f, 0.412893146f}, std::array<float,2>{0.444296896f, 0.627863348f}, std::array<float,2>{0.901318133f, 0.709914505f}, std::array<float,2>{0.0618519448f, 0.459501863f}, std::array<float,2>{0.545799911f, 0.024803469f}, std::array<float,2>{0.322296858f, 0.785843074f}, std::array<float,2>{0.712641835f, 0.97292161f}, std::array<float,2>{0.418766737f, 0.164366007f}, std::array<float,2>{0.773713887f, 0.33838889f}, std::array<float,2>{0.20940645f, 0.558311462f}, std::array<float,2>{0.576467633f, 0.639086366f}, std::array<float,2>{0.294480771f, 0.416200668f}, std::array<float,2>{0.943800271f, 0.0648742914f}, std::array<float,2>{0.117639519f, 0.855801284f}, std::array<float,2>{0.81678921f, 0.921689093f}, std::array<float,2>{0.131968334f, 0.249894798f}, std::array<float,2>{0.630254269f, 0.251614302f}, std::array<float,2>{0.476205617f, 0.572650671f}, std::array<float,2>{0.928445756f, 0.553672552f}, std::array<float,2>{0.028707793f, 0.334467292f}, std::array<float,2>{0.512122273f, 0.157193661f}, std::array<float,2>{0.361922026f, 0.979138434f}, std::array<float,2>{0.73361659f, 0.795110524f}, std::array<float,2>{0.392216384f, 0.0188817903f}, std::array<float,2>{0.785627842f, 0.468735218f}, std::array<float,2>{0.245809764f, 0.717767715f}, std::array<float,2>{0.658581197f, 0.61145103f}, std::array<float,2>{0.447128952f, 0.303262234f}, std::array<float,2>{0.846899927f, 0.201351151f}, std::array<float,2>{0.175452083f, 0.897261798f}, std::array<float,2>{0.985593855f, 0.822291553f}, std::array<float,2>{0.092934154f, 0.0966653153f}, std::array<float,2>{0.612606645f, 0.388967544f}, std::array<float,2>{0.258848637f, 0.65793407f}, std::array<float,2>{0.766615212f, 0.725640059f}, std::array<float,2>{0.218003467f, 0.496649683f}, std::array<float,2>{0.707967281f, 0.0416286997f}, std::array<float,2>{0.409576774f, 0.761609137f}, std::array<float,2>{0.536593258f, 0.965505481f}, std::array<float,2>{0.313831806f, 0.130029246f}, std::array<float,2>{0.895596027f, 0.356136054f}, std::array<float,2>{0.0491467454f, 0.516145647f}, std::array<float,2>{0.688240528f, 0.694330752f}, std::array<float,2>{0.435293615f, 0.451601505f}, std::array<float,2>{0.762232959f, 5.0628274e-05f}, std::array<float,2>{0.199133664f, 0.80754894f}, std::array<float,2>{0.875158787f, 0.997437954f}, std::array<float,2>{0.0405215696f, 0.180666447f}, std::array<float,2>{0.561252177f, 0.327201247f}, std::array<float,2>{0.342608154f, 0.533647895f}, std::array<float,2>{0.870517254f, 0.591827691f}, std::array<float,2>{0.162051991f, 0.278663397f}, std::array<float,2>{0.675384641f, 0.227437466f}, std::array<float,2>{0.45788762f, 0.936462045f}, std::array<float,2>{0.597200453f, 0.862039685f}, std::array<float,2>{0.272127658f, 0.0827792883f}, std::array<float,2>{0.975794911f, 0.437066764f}, std::array<float,2>{0.0650532171f, 0.643274248f}, std::array<float,2>{0.524617493f, 0.507047296f}, std::array<float,2>{0.357185632f, 0.372756362f}, std::array<float,2>{0.909954309f, 0.155571595f}, std::array<float,2>{0.00879911426f, 0.945175469f}, std::array<float,2>{0.800047457f, 0.780930042f}, std::array<float,2>{0.221682683f, 0.0585102327f}, std::array<float,2>{0.734651625f, 0.478696465f}, std::array<float,2>{0.388848782f, 0.735197663f}, std::array<float,2>{0.957825422f, 0.681297123f}, std::array<float,2>{0.0970294997f, 0.403267086f}, std::array<float,2>{0.581988275f, 0.116507284f}, std::array<float,2>{0.307070583f, 0.838793278f}, std::array<float,2>{0.642223537f, 0.883417666f}, std::array<float,2>{0.494420588f, 0.205114946f}, std::array<float,2>{0.837252378f, 0.291285545f}, std::array<float,2>{0.15553683f, 0.604330242f}, std::array<float,2>{0.585182846f, 0.706268251f}, std::array<float,2>{0.310536057f, 0.454944402f}, std::array<float,2>{0.954286098f, 0.0304869656f}, std::array<float,2>{0.100014538f, 0.784128606f}, std::array<float,2>{0.841139317f, 0.971865356f}, std::array<float,2>{0.150975689f, 0.168438181f}, std::array<float,2>{0.646879613f, 0.34298712f}, std::array<float,2>{0.496680468f, 0.560885906f}, std::array<float,2>{0.912604153f, 0.564115226f}, std::array<float,2>{0.0119512221f, 0.260477245f}, std::array<float,2>{0.529128015f, 0.236085609f}, std::array<float,2>{0.352809578f, 0.913348913f}, std::array<float,2>{0.741545856f, 0.850812554f}, std::array<float,2>{0.38297388f, 0.0707751662f}, std::array<float,2>{0.803694367f, 0.410136551f}, std::array<float,2>{0.225120082f, 0.631029725f}, std::array<float,2>{0.676975071f, 0.524106205f}, std::array<float,2>{0.455159962f, 0.347818673f}, std::array<float,2>{0.874731958f, 0.136065811f}, std::array<float,2>{0.158917874f, 0.954890132f}, std::array<float,2>{0.971167326f, 0.755919993f}, std::array<float,2>{0.0667842329f, 0.0386931747f}, std::array<float,2>{0.598026335f, 0.490500212f}, std::array<float,2>{0.266356051f, 0.727321088f}, std::array<float,2>{0.757861555f, 0.667919874f}, std::array<float,2>{0.201721594f, 0.381521851f}, std::array<float,2>{0.695248365f, 0.101999842f}, std::array<float,2>{0.43116191f, 0.815541744f}, std::array<float,2>{0.55569315f, 0.9028548f}, std::array<float,2>{0.338541389f, 0.193259463f}, std::array<float,2>{0.879718125f, 0.311997622f}, std::array<float,2>{0.04519739f, 0.618422687f}, std::array<float,2>{0.704353869f, 0.652455509f}, std::array<float,2>{0.412076741f, 0.42724216f}, std::array<float,2>{0.773369491f, 0.0886828899f}, std::array<float,2>{0.211586252f, 0.869578481f}, std::array<float,2>{0.890936732f, 0.922498941f}, std::array<float,2>{0.0543637238f, 0.21941644f}, std::array<float,2>{0.534945726f, 0.266808301f}, std::array<float,2>{0.316922009f, 0.580403745f}, std::array<float,2>{0.851506829f, 0.543712378f}, std::array<float,2>{0.179375291f, 0.315770626f}, std::array<float,2>{0.660286427f, 0.173107103f}, std::array<float,2>{0.450875282f, 0.984713912f}, std::array<float,2>{0.613888264f, 0.799256027f}, std::array<float,2>{0.26319468f, 0.0106317895f}, std::array<float,2>{0.988692164f, 0.438031286f}, std::array<float,2>{0.08838211f, 0.69765538f}, std::array<float,2>{0.511659086f, 0.594528198f}, std::array<float,2>{0.363588035f, 0.282343864f}, std::array<float,2>{0.925476432f, 0.213171437f}, std::array<float,2>{0.0260551181f, 0.875997782f}, std::array<float,2>{0.784110069f, 0.829034269f}, std::array<float,2>{0.249594212f, 0.120951049f}, std::array<float,2>{0.727191746f, 0.395513386f}, std::array<float,2>{0.397604227f, 0.673673272f}, std::array<float,2>{0.93759793f, 0.747092605f}, std::array<float,2>{0.124326624f, 0.475733638f}, std::array<float,2>{0.571212828f, 0.0489643998f}, std::array<float,2>{0.29214555f, 0.767617702f}, std::array<float,2>{0.62840277f, 0.951579452f}, std::array<float,2>{0.469890714f, 0.143077388f}, std::array<float,2>{0.815917432f, 0.361249924f}, std::array<float,2>{0.128049016f, 0.511017501f}, std::array<float,2>{0.539687872f, 0.685583174f}, std::array<float,2>{0.325799167f, 0.40113163f}, std::array<float,2>{0.902385533f, 0.109536774f}, std::array<float,2>{0.0547384061f, 0.840090573f}, std::array<float,2>{0.780968249f, 0.887905419f}, std::array<float,2>{0.203904048f, 0.210291073f}, std::array<float,2>{0.715830863f, 0.293755174f}, std::array<float,2>{0.414902478f, 0.60829103f}, std::array<float,2>{0.999571562f, 0.500688136f}, std::array<float,2>{0.0831036568f, 0.367634594f}, std::array<float,2>{0.618929088f, 0.15036808f}, std::array<float,2>{0.251612544f, 0.939696908f}, std::array<float,2>{0.665858865f, 0.775704563f}, std::array<float,2>{0.440423757f, 0.0617181659f}, std::array<float,2>{0.857883751f, 0.482350707f}, std::array<float,2>{0.180018887f, 0.740392447f}, std::array<float,2>{0.724213481f, 0.588002324f}, std::array<float,2>{0.401438147f, 0.275951892f}, std::array<float,2>{0.790951252f, 0.233176202f}, std::array<float,2>{0.234496132f, 0.930849195f}, std::array<float,2>{0.934479475f, 0.867058158f}, std::array<float,2>{0.0229551997f, 0.0817676038f}, std::array<float,2>{0.502432942f, 0.430466861f}, std::array<float,2>{0.370779544f, 0.644949436f}, std::array<float,2>{0.822589159f, 0.689741731f}, std::array<float,2>{0.138353124f, 0.447201908f}, std::array<float,2>{0.638079286f, 0.00593402795f}, std::array<float,2>{0.483931273f, 0.811441362f}, std::array<float,2>{0.56933558f, 0.993936002f}, std::array<float,2>{0.28789866f, 0.183730781f}, std::array<float,2>{0.947334528f, 0.322804421f}, std::array<float,2>{0.113081619f, 0.53832531f}, std::array<float,2>{0.649173975f, 0.719227791f}, std::array<float,2>{0.491587311f, 0.495242566f}, std::array<float,2>{0.83052963f, 0.0431391187f}, std::array<float,2>{0.144787639f, 0.761846662f}, std::array<float,2>{0.964744508f, 0.962770164f}, std::array<float,2>{0.102876581f, 0.126050934f}, std::array<float,2>{0.586921513f, 0.353181899f}, std::array<float,2>{0.297182679f, 0.52034682f}, std::array<float,2>{0.809670866f, 0.615711987f}, std::array<float,2>{0.230428398f, 0.300452203f}, std::array<float,2>{0.747997224f, 0.197895169f}, std::array<float,2>{0.379170924f, 0.892349958f}, std::array<float,2>{0.518177688f, 0.827513516f}, std::array<float,2>{0.343855649f, 0.0990639254f}, std::array<float,2>{0.915717006f, 0.384088963f}, std::array<float,2>{0.00513294851f, 0.664059937f}, std::array<float,2>{0.602551579f, 0.549197555f}, std::array<float,2>{0.2743662f, 0.33039692f}, std::array<float,2>{0.984339476f, 0.162037209f}, std::array<float,2>{0.077063702f, 0.983303189f}, std::array<float,2>{0.860615253f, 0.791514158f}, std::array<float,2>{0.168838233f, 0.0210936535f}, std::array<float,2>{0.685400367f, 0.462394089f}, std::array<float,2>{0.467349231f, 0.713373899f}, std::array<float,2>{0.886363924f, 0.63300699f}, std::array<float,2>{0.0376905128f, 0.418214589f}, std::array<float,2>{0.54909879f, 0.0676565245f}, std::array<float,2>{0.335401893f, 0.851692319f}, std::array<float,2>{0.703097522f, 0.915536344f}, std::array<float,2>{0.427978516f, 0.244484738f}, std::array<float,2>{0.755741715f, 0.254829556f}, std::array<float,2>{0.194948241f, 0.574664891f}, std::array<float,2>{0.527240872f, 0.734598339f}, std::array<float,2>{0.359028876f, 0.479093403f}, std::array<float,2>{0.906930447f, 0.0578484796f}, std::array<float,2>{0.010244932f, 0.78038609f}, std::array<float,2>{0.798055053f, 0.94452548f}, std::array<float,2>{0.219576672f, 0.155997083f}, std::array<float,2>{0.738124967f, 0.372448266f}, std::array<float,2>{0.387143433f, 0.507431269f}, std::array<float,2>{0.9595263f, 0.603622973f}, std::array<float,2>{0.0955502391f, 0.29151839f}, std::array<float,2>{0.578336596f, 0.206033468f}, std::array<float,2>{0.305034131f, 0.883051097f}, std::array<float,2>{0.643910885f, 0.838152766f}, std::array<float,2>{0.493487149f, 0.116865627f}, std::array<float,2>{0.839556694f, 0.402804881f}, std::array<float,2>{0.152706355f, 0.680783153f}, std::array<float,2>{0.690417826f, 0.534101069f}, std::array<float,2>{0.437390745f, 0.328080118f}, std::array<float,2>{0.765180469f, 0.181458026f}, std::array<float,2>{0.195826471f, 0.997691214f}, std::array<float,2>{0.878016591f, 0.806897759f}, std::array<float,2>{0.0420761034f, 0.000915366225f}, std::array<float,2>{0.559088767f, 0.452134043f}, std::array<float,2>{0.341403574f, 0.693684042f}, std::array<float,2>{0.868515372f, 0.642702579f}, std::array<float,2>{0.163722098f, 0.436575413f}, std::array<float,2>{0.672364354f, 0.0820951834f}, std::array<float,2>{0.460307956f, 0.861581504f}, std::array<float,2>{0.595129967f, 0.935561001f}, std::array<float,2>{0.269594431f, 0.226960987f}, std::array<float,2>{0.97371757f, 0.278930545f}, std::array<float,2>{0.0627182871f, 0.59239161f}, std::array<float,2>{0.657616377f, 0.657318056f}, std::array<float,2>{0.447897851f, 0.389380246f}, std::array<float,2>{0.845665336f, 0.0957208648f}, std::array<float,2>{0.173568919f, 0.823041618f}, std::array<float,2>{0.986674368f, 0.896630764f}, std::array<float,2>{0.0913010985f, 0.201804683f}, std::array<float,2>{0.609548151f, 0.303102434f}, std::array<float,2>{0.260994852f, 0.611980319f}, std::array<float,2>{0.769062042f, 0.515846968f}, std::array<float,2>{0.216112211f, 0.355748743f}, std::array<float,2>{0.710804641f, 0.130542174f}, std::array<float,2>{0.407819241f, 0.964962423f}, std::array<float,2>{0.538842499f, 0.761056781f}, std::array<float,2>{0.315421343f, 0.0411297642f}, std::array<float,2>{0.898198307f, 0.496244311f}, std::array<float,2>{0.0475286171f, 0.72642684f}, std::array<float,2>{0.575708389f, 0.572826385f}, std::array<float,2>{0.295051038f, 0.251075089f}, std::array<float,2>{0.942390203f, 0.249260694f}, std::array<float,2>{0.120434187f, 0.921139717f}, std::array<float,2>{0.819446862f, 0.856039166f}, std::array<float,2>{0.130814403f, 0.0651112348f}, std::array<float,2>{0.632007778f, 0.416672558f}, std::array<float,2>{0.474216998f, 0.639214694f}, std::array<float,2>{0.927000999f, 0.717146099f}, std::array<float,2>{0.0299668629f, 0.468124241f}, std::array<float,2>{0.513807654f, 0.0194743089f}, std::array<float,2>{0.360345632f, 0.795897245f}, std::array<float,2>{0.73200351f, 0.978815079f}, std::array<float,2>{0.393875033f, 0.156601578f}, std::array<float,2>{0.787641823f, 0.334747374f}, std::array<float,2>{0.244115844f, 0.553186774f}, std::array<float,2>{0.622277498f, 0.627061129f}, std::array<float,2>{0.257589668f, 0.412388116f}, std::array<float,2>{0.994612575f, 0.0757430494f}, std::array<float,2>{0.0805361122f, 0.846073151f}, std::array<float,2>{0.852110684f, 0.907609463f}, std::array<float,2>{0.186021179f, 0.238784119f}, std::array<float,2>{0.67065835f, 0.265345335f}, std::array<float,2>{0.441609561f, 0.566453576f}, std::array<float,2>{0.899272263f, 0.557931423f}, std::array<float,2>{0.0594423413f, 0.338342994f}, std::array<float,2>{0.544281006f, 0.164952829f}, std::array<float,2>{0.322168052f, 0.973262668f}, std::array<float,2>{0.713478744f, 0.785578787f}, std::array<float,2>{0.421659559f, 0.0249760821f}, std::array<float,2>{0.775964558f, 0.459428102f}, std::array<float,2>{0.207527518f, 0.709273577f}, std::array<float,2>{0.633680642f, 0.622783899f}, std::array<float,2>{0.478176951f, 0.307836473f}, std::array<float,2>{0.825228572f, 0.188109547f}, std::array<float,2>{0.133386791f, 0.90096277f}, std::array<float,2>{0.949602664f, 0.816939592f}, std::array<float,2>{0.116852343f, 0.108238295f}, std::array<float,2>{0.565569878f, 0.375343651f}, std::array<float,2>{0.282489032f, 0.670718968f}, std::array<float,2>{0.795090199f, 0.73237592f}, std::array<float,2>{0.241138101f, 0.485960901f}, std::array<float,2>{0.721490204f, 0.0347476378f}, std::array<float,2>{0.403968215f, 0.753551602f}, std::array<float,2>{0.506854534f, 0.959663749f}, std::array<float,2>{0.373862714f, 0.138104677f}, std::array<float,2>{0.931822598f, 0.347305596f}, std::array<float,2>{0.0169314798f, 0.530108571f}, std::array<float,2>{0.742964387f, 0.699406266f}, std::array<float,2>{0.376112759f, 0.44424355f}, std::array<float,2>{0.805636644f, 0.0127190901f}, std::array<float,2>{0.23208639f, 0.802528858f}, std::array<float,2>{0.918634474f, 0.991251707f}, std::array<float,2>{0.00271798763f, 0.177899033f}, std::array<float,2>{0.521955907f, 0.317870557f}, std::array<float,2>{0.347762108f, 0.540005267f}, std::array<float,2>{0.833260119f, 0.583117485f}, std::array<float,2>{0.141140476f, 0.272647202f}, std::array<float,2>{0.654345691f, 0.223367602f}, std::array<float,2>{0.487889022f, 0.928648293f}, std::array<float,2>{0.592516661f, 0.872576892f}, std::array<float,2>{0.30428344f, 0.0901710466f}, std::array<float,2>{0.965384185f, 0.42577666f}, std::array<float,2>{0.108067065f, 0.649164855f}, std::array<float,2>{0.554593444f, 0.513698101f}, std::array<float,2>{0.328634351f, 0.366945177f}, std::array<float,2>{0.890426099f, 0.148097709f}, std::array<float,2>{0.0350831263f, 0.947425485f}, std::array<float,2>{0.752242863f, 0.771446109f}, std::array<float,2>{0.188760057f, 0.0526217446f}, std::array<float,2>{0.696273386f, 0.470538646f}, std::array<float,2>{0.425643563f, 0.744621277f}, std::array<float,2>{0.978385091f, 0.675909162f}, std::array<float,2>{0.0737079605f, 0.394527644f}, std::array<float,2>{0.606546938f, 0.122298695f}, std::array<float,2>{0.279204786f, 0.83534807f}, std::array<float,2>{0.680202484f, 0.880129695f}, std::array<float,2>{0.461300254f, 0.216181368f}, std::array<float,2>{0.865677297f, 0.287113696f}, std::array<float,2>{0.165253088f, 0.601302564f}, std::array<float,2>{0.600645423f, 0.729641736f}, std::array<float,2>{0.26799053f, 0.488689899f}, std::array<float,2>{0.970435739f, 0.0355134681f}, std::array<float,2>{0.068825908f, 0.754325151f}, std::array<float,2>{0.873014331f, 0.955094099f}, std::array<float,2>{0.158045426f, 0.133321792f}, std::array<float,2>{0.678356528f, 0.349686533f}, std::array<float,2>{0.454221874f, 0.527127385f}, std::array<float,2>{0.8811813f, 0.620380223f}, std::array<float,2>{0.0431062058f, 0.310529977f}, std::array<float,2>{0.557201266f, 0.195065111f}, std::array<float,2>{0.33630079f, 0.905472577f}, std::array<float,2>{0.691488564f, 0.813423336f}, std::array<float,2>{0.433154076f, 0.104325391f}, std::array<float,2>{0.759828389f, 0.379603326f}, std::array<float,2>{0.199341029f, 0.664865077f}, std::array<float,2>{0.645213544f, 0.559145808f}, std::array<float,2>{0.49940908f, 0.341764361f}, std::array<float,2>{0.842213869f, 0.17129153f}, std::array<float,2>{0.150178939f, 0.969783247f}, std::array<float,2>{0.955196917f, 0.781339467f}, std::array<float,2>{0.0986615643f, 0.0292370878f}, std::array<float,2>{0.583197713f, 0.45681265f}, std::array<float,2>{0.311890811f, 0.704831719f}, std::array<float,2>{0.80240047f, 0.630561888f}, std::array<float,2>{0.223458856f, 0.407413244f}, std::array<float,2>{0.738854766f, 0.0725776851f}, std::array<float,2>{0.385214627f, 0.848614991f}, std::array<float,2>{0.531186104f, 0.910941601f}, std::array<float,2>{0.354993045f, 0.236751959f}, std::array<float,2>{0.910874069f, 0.257984191f}, std::array<float,2>{0.0152029302f, 0.564626217f}, std::array<float,2>{0.730288327f, 0.674747646f}, std::array<float,2>{0.396001697f, 0.396865666f}, std::array<float,2>{0.781624496f, 0.117909238f}, std::array<float,2>{0.246389151f, 0.830235064f}, std::array<float,2>{0.922981739f, 0.878411889f}, std::array<float,2>{0.0253298078f, 0.211974889f}, std::array<float,2>{0.507882237f, 0.283350468f}, std::array<float,2>{0.367101133f, 0.596192241f}, std::array<float,2>{0.814397752f, 0.509598911f}, std::array<float,2>{0.125031322f, 0.363209546f}, std::array<float,2>{0.626367211f, 0.14123027f}, std::array<float,2>{0.471495688f, 0.949353516f}, std::array<float,2>{0.572612822f, 0.765862405f}, std::array<float,2>{0.290622741f, 0.0488071702f}, std::array<float,2>{0.941200852f, 0.474059612f}, std::array<float,2>{0.121789172f, 0.748758912f}, std::array<float,2>{0.532768548f, 0.57903868f}, std::array<float,2>{0.320066184f, 0.268159002f}, std::array<float,2>{0.893274784f, 0.22131519f}, std::array<float,2>{0.0521935374f, 0.924031615f}, std::array<float,2>{0.770335317f, 0.868590891f}, std::array<float,2>{0.213611066f, 0.0870956331f}, std::array<float,2>{0.706191361f, 0.428659886f}, std::array<float,2>{0.412115276f, 0.654595733f}, std::array<float,2>{0.991157293f, 0.695563138f}, std::array<float,2>{0.0870819837f, 0.440498382f}, std::array<float,2>{0.615440786f, 0.00900842249f}, std::array<float,2>{0.263784081f, 0.798034132f}, std::array<float,2>{0.663806438f, 0.988154173f}, std::array<float,2>{0.452120095f, 0.174883962f}, std::array<float,2>{0.849195898f, 0.312507838f}, std::array<float,2>{0.177572727f, 0.545753121f}, std::array<float,2>{0.500804782f, 0.646976888f}, std::array<float,2>{0.367627174f, 0.432171822f}, std::array<float,2>{0.937063217f, 0.0798916295f}, std::array<float,2>{0.0209105276f, 0.865088105f}, std::array<float,2>{0.791502655f, 0.932935297f}, std::array<float,2>{0.236343399f, 0.231135696f}, std::array<float,2>{0.724638104f, 0.273718327f}, std::array<float,2>{0.399886996f, 0.587477088f}, std::array<float,2>{0.945646346f, 0.535189092f}, std::array<float,2>{0.109788708f, 0.321312726f}, std::array<float,2>{0.566702127f, 0.185787797f}, std::array<float,2>{0.285349786f, 0.995559931f}, std::array<float,2>{0.639651299f, 0.808749318f}, std::array<float,2>{0.481741667f, 0.00499693351f}, std::array<float,2>{0.821537793f, 0.448519289f}, std::array<float,2>{0.140062973f, 0.688421667f}, std::array<float,2>{0.718599319f, 0.606299102f}, std::array<float,2>{0.417828947f, 0.295235395f}, std::array<float,2>{0.778110564f, 0.20893696f}, std::array<float,2>{0.206515417f, 0.889673591f}, std::array<float,2>{0.905109644f, 0.843417764f}, std::array<float,2>{0.0572484136f, 0.112522051f}, std::array<float,2>{0.541347623f, 0.399756968f}, std::array<float,2>{0.326601207f, 0.68432802f}, std::array<float,2>{0.856263697f, 0.738652647f}, std::array<float,2>{0.181722507f, 0.482554317f}, std::array<float,2>{0.666056097f, 0.0591470934f}, std::array<float,2>{0.439100385f, 0.775259435f}, std::array<float,2>{0.61940068f, 0.938144684f}, std::array<float,2>{0.252110243f, 0.151938438f}, std::array<float,2>{0.997227907f, 0.369472235f}, std::array<float,2>{0.0840989947f, 0.503043771f}, std::array<float,2>{0.68704617f, 0.71167475f}, std::array<float,2>{0.466085851f, 0.464689732f}, std::array<float,2>{0.861583531f, 0.0220724139f}, std::array<float,2>{0.171623886f, 0.790521324f}, std::array<float,2>{0.982101798f, 0.981608152f}, std::array<float,2>{0.0747642368f, 0.162581086f}, std::array<float,2>{0.604753554f, 0.329023361f}, std::array<float,2>{0.276183814f, 0.547570407f}, std::array<float,2>{0.756879091f, 0.577773988f}, std::array<float,2>{0.192107156f, 0.257069081f}, std::array<float,2>{0.700506628f, 0.243543699f}, std::array<float,2>{0.427214921f, 0.917501688f}, std::array<float,2>{0.548027992f, 0.853887975f}, std::array<float,2>{0.332225978f, 0.0688594505f}, std::array<float,2>{0.883541763f, 0.421725363f}, std::array<float,2>{0.0360497721f, 0.63536489f}, std::array<float,2>{0.588267386f, 0.522621572f}, std::array<float,2>{0.29979673f, 0.355158448f}, std::array<float,2>{0.962212622f, 0.128713086f}, std::array<float,2>{0.104408778f, 0.963927925f}, std::array<float,2>{0.829833448f, 0.764039576f}, std::array<float,2>{0.147075221f, 0.0462749712f}, std::array<float,2>{0.651753902f, 0.492967486f}, std::array<float,2>{0.488556892f, 0.721203506f}, std::array<float,2>{0.917338789f, 0.661044419f}, std::array<float,2>{0.00591217075f, 0.38667956f}, std::array<float,2>{0.517387688f, 0.100494318f}, std::array<float,2>{0.346593112f, 0.824408352f}, std::array<float,2>{0.749367177f, 0.893345058f}, std::array<float,2>{0.382078856f, 0.197130695f}, std::array<float,2>{0.812325895f, 0.297035575f}, std::array<float,2>{0.227122068f, 0.613336384f}, std::array<float,2>{0.561017752f, 0.691625595f}, std::array<float,2>{0.342192233f, 0.449621528f}, std::array<float,2>{0.875814736f, 0.00354485377f}, std::array<float,2>{0.0407164209f, 0.806090772f}, std::array<float,2>{0.762141347f, 0.99891448f}, std::array<float,2>{0.19825004f, 0.183025807f}, std::array<float,2>{0.687880337f, 0.326098472f}, std::array<float,2>{0.43458569f, 0.531974673f}, std::array<float,2>{0.976175249f, 0.591751397f}, std::array<float,2>{0.0647371113f, 0.280619085f}, std::array<float,2>{0.596944511f, 0.230238318f}, std::array<float,2>{0.271710515f, 0.935433745f}, std::array<float,2>{0.675218225f, 0.860060394f}, std::array<float,2>{0.457056969f, 0.0852419659f}, std::array<float,2>{0.870883107f, 0.435291499f}, std::array<float,2>{0.161282241f, 0.641387761f}, std::array<float,2>{0.735149205f, 0.505608797f}, std::array<float,2>{0.389585584f, 0.373633057f}, std::array<float,2>{0.800486922f, 0.152789086f}, std::array<float,2>{0.22225225f, 0.943243384f}, std::array<float,2>{0.9091959f, 0.77921176f}, std::array<float,2>{0.00973280426f, 0.0560800284f}, std::array<float,2>{0.524945498f, 0.477145821f}, std::array<float,2>{0.356743455f, 0.737894654f}, std::array<float,2>{0.837552786f, 0.681666255f}, std::array<float,2>{0.155893877f, 0.405099988f}, std::array<float,2>{0.641763628f, 0.113934383f}, std::array<float,2>{0.494712681f, 0.836895585f}, std::array<float,2>{0.581451416f, 0.886603057f}, std::array<float,2>{0.307561398f, 0.203176066f}, std::array<float,2>{0.957058549f, 0.290291607f}, std::array<float,2>{0.0971813276f, 0.6031124f}, std::array<float,2>{0.630732656f, 0.638210297f}, std::array<float,2>{0.476034671f, 0.414370954f}, std::array<float,2>{0.817345738f, 0.0631786212f}, std::array<float,2>{0.1325901f, 0.858456612f}, std::array<float,2>{0.944271088f, 0.91836518f}, std::array<float,2>{0.117910929f, 0.247391969f}, std::array<float,2>{0.576733708f, 0.252019078f}, std::array<float,2>{0.294260591f, 0.570699036f}, std::array<float,2>{0.785645068f, 0.551276803f}, std::array<float,2>{0.245372146f, 0.333472073f}, std::array<float,2>{0.734123111f, 0.158899471f}, std::array<float,2>{0.391825706f, 0.978034735f}, std::array<float,2>{0.512313008f, 0.79358691f}, std::array<float,2>{0.361801863f, 0.0170948282f}, std::array<float,2>{0.928049564f, 0.465580761f}, std::array<float,2>{0.0290237926f, 0.715208888f}, std::array<float,2>{0.613018155f, 0.610586822f}, std::array<float,2>{0.259679466f, 0.301932842f}, std::array<float,2>{0.986027718f, 0.199327767f}, std::array<float,2>{0.093314968f, 0.896303296f}, std::array<float,2>{0.847192764f, 0.82154727f}, std::array<float,2>{0.175109759f, 0.0942103043f}, std::array<float,2>{0.658878148f, 0.387471348f}, std::array<float,2>{0.44632557f, 0.660086513f}, std::array<float,2>{0.896402657f, 0.724051654f}, std::array<float,2>{0.0497996509f, 0.499839187f}, std::array<float,2>{0.537085831f, 0.0400666595f}, std::array<float,2>{0.314386755f, 0.759446323f}, std::array<float,2>{0.707231939f, 0.967652857f}, std::array<float,2>{0.409989417f, 0.131058738f}, std::array<float,2>{0.767554104f, 0.358987361f}, std::array<float,2>{0.218693689f, 0.517749727f}, std::array<float,2>{0.564059198f, 0.669855535f}, std::array<float,2>{0.284658343f, 0.378886551f}, std::array<float,2>{0.951444268f, 0.10648866f}, std::array<float,2>{0.114271909f, 0.818686366f}, std::array<float,2>{0.82757473f, 0.89941895f}, std::array<float,2>{0.135290921f, 0.190089539f}, std::array<float,2>{0.636606276f, 0.305253595f}, std::array<float,2>{0.478966773f, 0.624485791f}, std::array<float,2>{0.931130767f, 0.527661026f}, std::array<float,2>{0.0189250875f, 0.344158888f}, std::array<float,2>{0.50511533f, 0.14045687f}, std::array<float,2>{0.371180296f, 0.957571507f}, std::array<float,2>{0.719832599f, 0.751135468f}, std::array<float,2>{0.405698508f, 0.0330826417f}, std::array<float,2>{0.793172002f, 0.48796767f}, std::array<float,2>{0.238647029f, 0.733977973f}, std::array<float,2>{0.668619633f, 0.569900572f}, std::array<float,2>{0.44358018f, 0.263598263f}, std::array<float,2>{0.853930056f, 0.241287395f}, std::array<float,2>{0.184312701f, 0.908770442f}, std::array<float,2>{0.993694782f, 0.844578683f}, std::array<float,2>{0.0794386417f, 0.0762301907f}, std::array<float,2>{0.623661101f, 0.410576612f}, std::array<float,2>{0.255132586f, 0.626502097f}, std::array<float,2>{0.77418685f, 0.707411468f}, std::array<float,2>{0.20993793f, 0.45891875f}, std::array<float,2>{0.712346971f, 0.0264180098f}, std::array<float,2>{0.418308765f, 0.787170589f}, std::array<float,2>{0.545233309f, 0.974699378f}, std::array<float,2>{0.323162079f, 0.167846322f}, std::array<float,2>{0.900757492f, 0.336345136f}, std::array<float,2>{0.0624886192f, 0.554921567f}, std::array<float,2>{0.698831439f, 0.743083f}, std::array<float,2>{0.423020214f, 0.47083059f}, std::array<float,2>{0.750322878f, 0.0528148226f}, std::array<float,2>{0.189805403f, 0.772365153f}, std::array<float,2>{0.888312399f, 0.945630848f}, std::array<float,2>{0.0319713205f, 0.144758791f}, std::array<float,2>{0.55158478f, 0.365005732f}, std::array<float,2>{0.331073582f, 0.511939764f}, std::array<float,2>{0.863790393f, 0.59901154f}, std::array<float,2>{0.16726467f, 0.285567135f}, std::array<float,2>{0.683357894f, 0.21722582f}, std::array<float,2>{0.464113891f, 0.88093996f}, std::array<float,2>{0.608142674f, 0.833285451f}, std::array<float,2>{0.279368669f, 0.123312056f}, std::array<float,2>{0.979336083f, 0.39193964f}, std::array<float,2>{0.0717443749f, 0.679153085f}, std::array<float,2>{0.520859003f, 0.541723669f}, std::array<float,2>{0.350271404f, 0.319660783f}, std::array<float,2>{0.921393156f, 0.176980332f}, std::array<float,2>{0.00153772894f, 0.989705145f}, std::array<float,2>{0.808545828f, 0.804349661f}, std::array<float,2>{0.234372929f, 0.0154249845f}, std::array<float,2>{0.744480729f, 0.442526489f}, std::array<float,2>{0.377563477f, 0.702022493f}, std::array<float,2>{0.967933059f, 0.651539981f}, std::array<float,2>{0.105482481f, 0.423103452f}, std::array<float,2>{0.591342747f, 0.0936353281f}, std::array<float,2>{0.302198231f, 0.873236239f}, std::array<float,2>{0.653129458f, 0.92702204f}, std::array<float,2>{0.485634446f, 0.225020528f}, std::array<float,2>{0.835113704f, 0.271364868f}, std::array<float,2>{0.144052699f, 0.585314512f}, std::array<float,2>{0.571304739f, 0.749046147f}, std::array<float,2>{0.291647226f, 0.473492086f}, std::array<float,2>{0.938850462f, 0.047040049f}, std::array<float,2>{0.12369664f, 0.767288864f}, std::array<float,2>{0.815150797f, 0.95044595f}, std::array<float,2>{0.12761572f, 0.142571166f}, std::array<float,2>{0.626984298f, 0.361816943f}, std::array<float,2>{0.469256252f, 0.508519411f}, std::array<float,2>{0.924622655f, 0.59708792f}, std::array<float,2>{0.0265199207f, 0.2844899f}, std::array<float,2>{0.510399461f, 0.211375743f}, std::array<float,2>{0.364907384f, 0.877261162f}, std::array<float,2>{0.728284299f, 0.831952453f}, std::array<float,2>{0.396747053f, 0.11886242f}, std::array<float,2>{0.784916639f, 0.398213774f}, std::array<float,2>{0.248588741f, 0.675670385f}, std::array<float,2>{0.661318064f, 0.546490431f}, std::array<float,2>{0.449658811f, 0.314190745f}, std::array<float,2>{0.849996984f, 0.174406663f}, std::array<float,2>{0.178064674f, 0.986766577f}, std::array<float,2>{0.99004072f, 0.797681034f}, std::array<float,2>{0.0895415545f, 0.00814723596f}, std::array<float,2>{0.614983916f, 0.440368086f}, std::array<float,2>{0.262019098f, 0.697251201f}, std::array<float,2>{0.771825612f, 0.655293465f}, std::array<float,2>{0.212075964f, 0.429553568f}, std::array<float,2>{0.70378387f, 0.0864545554f}, std::array<float,2>{0.410434604f, 0.867885888f}, std::array<float,2>{0.533461392f, 0.92489785f}, std::array<float,2>{0.317898333f, 0.22218053f}, std::array<float,2>{0.891761899f, 0.268853635f}, std::array<float,2>{0.0531361923f, 0.57948792f}, std::array<float,2>{0.693457007f, 0.665661514f}, std::array<float,2>{0.429737926f, 0.380512834f}, std::array<float,2>{0.759449363f, 0.105457805f}, std::array<float,2>{0.203064919f, 0.813558638f}, std::array<float,2>{0.880476296f, 0.904613614f}, std::array<float,2>{0.0463545769f, 0.193472534f}, std::array<float,2>{0.55550921f, 0.308603913f}, std::array<float,2>{0.339103162f, 0.61930573f}, std::array<float,2>{0.873495817f, 0.526067197f}, std::array<float,2>{0.159439623f, 0.351455897f}, std::array<float,2>{0.676091075f, 0.13430129f}, std::array<float,2>{0.456078678f, 0.956096113f}, std::array<float,2>{0.598920405f, 0.754889429f}, std::array<float,2>{0.267350197f, 0.0363862067f}, std::array<float,2>{0.971875727f, 0.489860833f}, std::array<float,2>{0.0674554929f, 0.728985667f}, std::array<float,2>{0.527717292f, 0.565484226f}, std::array<float,2>{0.352378517f, 0.259506226f}, std::array<float,2>{0.913744807f, 0.238131881f}, std::array<float,2>{0.0131583419f, 0.911590338f}, std::array<float,2>{0.804036856f, 0.848795593f}, std::array<float,2>{0.226341933f, 0.0737016574f}, std::array<float,2>{0.74117434f, 0.406613201f}, std::array<float,2>{0.383996725f, 0.629335582f}, std::array<float,2>{0.953213215f, 0.703593552f}, std::array<float,2>{0.101200975f, 0.455704719f}, std::array<float,2>{0.584885001f, 0.0277237333f}, std::array<float,2>{0.309033573f, 0.783136427f}, std::array<float,2>{0.648207486f, 0.969187975f}, std::array<float,2>{0.497793496f, 0.170285895f}, std::array<float,2>{0.840193808f, 0.340087444f}, std::array<float,2>{0.151943907f, 0.559733152f}, std::array<float,2>{0.550304532f, 0.635952413f}, std::array<float,2>{0.334754229f, 0.420007885f}, std::array<float,2>{0.885414541f, 0.0700324997f}, std::array<float,2>{0.0383807048f, 0.855457783f}, std::array<float,2>{0.75468725f, 0.916059613f}, std::array<float,2>{0.194005534f, 0.242419064f}, std::array<float,2>{0.701334953f, 0.256524414f}, std::array<float,2>{0.429006904f, 0.576337397f}, std::array<float,2>{0.982468247f, 0.548237443f}, std::array<float,2>{0.0779883265f, 0.329395741f}, std::array<float,2>{0.601608574f, 0.163359478f}, std::array<float,2>{0.275280237f, 0.981142461f}, std::array<float,2>{0.683743f, 0.789966822f}, std::array<float,2>{0.468294203f, 0.0227659661f}, std::array<float,2>{0.859731436f, 0.463422656f}, std::array<float,2>{0.169829682f, 0.712137163f}, std::array<float,2>{0.746173024f, 0.615152776f}, std::array<float,2>{0.379915327f, 0.29873237f}, std::array<float,2>{0.80928272f, 0.195497587f}, std::array<float,2>{0.228764519f, 0.893561602f}, std::array<float,2>{0.914790869f, 0.826076686f}, std::array<float,2>{0.00404576259f, 0.10109999f}, std::array<float,2>{0.519190013f, 0.385457575f}, std::array<float,2>{0.345385492f, 0.661266744f}, std::array<float,2>{0.831550598f, 0.721721292f}, std::array<float,2>{0.14593488f, 0.493911445f}, std::array<float,2>{0.649659276f, 0.0451690704f}, std::array<float,2>{0.490859687f, 0.765225708f}, std::array<float,2>{0.586699903f, 0.963350594f}, std::array<float,2>{0.298656672f, 0.126999095f}, std::array<float,2>{0.96313554f, 0.353680283f}, std::array<float,2>{0.102352001f, 0.521529317f}, std::array<float,2>{0.6376279f, 0.689260185f}, std::array<float,2>{0.482938796f, 0.447875202f}, std::array<float,2>{0.823772073f, 0.00458578207f}, std::array<float,2>{0.137613371f, 0.810329497f}, std::array<float,2>{0.948879838f, 0.99485594f}, std::array<float,2>{0.111619167f, 0.18684493f}, std::array<float,2>{0.570041001f, 0.320446849f}, std::array<float,2>{0.288615078f, 0.537091553f}, std::array<float,2>{0.789937794f, 0.586631596f}, std::array<float,2>{0.235720336f, 0.27502507f}, std::array<float,2>{0.723078012f, 0.231517419f}, std::array<float,2>{0.401313156f, 0.932219803f}, std::array<float,2>{0.503750622f, 0.86398834f}, std::array<float,2>{0.369988889f, 0.0789884478f}, std::array<float,2>{0.934798539f, 0.432967126f}, std::array<float,2>{0.0219458994f, 0.648362458f}, std::array<float,2>{0.618114352f, 0.502883196f}, std::array<float,2>{0.250029057f, 0.370874196f}, std::array<float,2>{0.998465478f, 0.150565773f}, std::array<float,2>{0.082168296f, 0.938903213f}, std::array<float,2>{0.859118104f, 0.774381876f}, std::array<float,2>{0.181005925f, 0.0603312366f}, std::array<float,2>{0.664609492f, 0.48381272f}, std::array<float,2>{0.441239148f, 0.739955664f}, std::array<float,2>{0.903436422f, 0.6854918f}, std::array<float,2>{0.0561706088f, 0.3987948f}, std::array<float,2>{0.54101038f, 0.112282149f}, std::array<float,2>{0.325031906f, 0.842368782f}, std::array<float,2>{0.714975059f, 0.88962388f}, std::array<float,2>{0.415792346f, 0.207167462f}, std::array<float,2>{0.779745877f, 0.296378911f}, std::array<float,2>{0.204457954f, 0.606932521f}, std::array<float,2>{0.514740884f, 0.715925634f}, std::array<float,2>{0.360568583f, 0.466104358f}, std::array<float,2>{0.926133633f, 0.01638682f}, std::array<float,2>{0.0309043359f, 0.793997049f}, std::array<float,2>{0.788783073f, 0.976899624f}, std::array<float,2>{0.242477179f, 0.159776703f}, std::array<float,2>{0.730683565f, 0.332836002f}, std::array<float,2>{0.392896146f, 0.551826954f}, std::array<float,2>{0.94228071f, 0.571925104f}, std::array<float,2>{0.119409226f, 0.252940446f}, std::array<float,2>{0.575139046f, 0.246765435f}, std::array<float,2>{0.296059519f, 0.919879675f}, std::array<float,2>{0.631662488f, 0.85838306f}, std::array<float,2>{0.473302424f, 0.0642676204f}, std::array<float,2>{0.818507552f, 0.415585697f}, std::array<float,2>{0.129519343f, 0.637215197f}, std::array<float,2>{0.709806204f, 0.519092679f}, std::array<float,2>{0.406487107f, 0.357471198f}, std::array<float,2>{0.768475831f, 0.132478967f}, std::array<float,2>{0.215527996f, 0.968117118f}, std::array<float,2>{0.89663291f, 0.758542776f}, std::array<float,2>{0.0486161709f, 0.0398800224f}, std::array<float,2>{0.537910759f, 0.498157084f}, std::array<float,2>{0.316038221f, 0.723030984f}, std::array<float,2>{0.844691873f, 0.658515811f}, std::array<float,2>{0.172023594f, 0.388067603f}, std::array<float,2>{0.656736255f, 0.0948220044f}, std::array<float,2>{0.448589563f, 0.820330679f}, std::array<float,2>{0.610803127f, 0.89546454f}, std::array<float,2>{0.260314286f, 0.20106639f}, std::array<float,2>{0.987318695f, 0.301467776f}, std::array<float,2>{0.0902471468f, 0.610090137f}, std::array<float,2>{0.673461914f, 0.641851604f}, std::array<float,2>{0.459170997f, 0.433706671f}, std::array<float,2>{0.867268562f, 0.0847314596f}, std::array<float,2>{0.162981778f, 0.860486388f}, std::array<float,2>{0.972928882f, 0.934499383f}, std::array<float,2>{0.0643190891f, 0.229065552f}, std::array<float,2>{0.594494879f, 0.280224174f}, std::array<float,2>{0.271286875f, 0.590447366f}, std::array<float,2>{0.764328659f, 0.532778382f}, std::array<float,2>{0.196905002f, 0.32493943f}, std::array<float,2>{0.691249251f, 0.182217553f}, std::array<float,2>{0.436494082f, 0.999203861f}, std::array<float,2>{0.560466886f, 0.805203319f}, std::array<float,2>{0.339855283f, 0.00230703084f}, std::array<float,2>{0.877279937f, 0.450859547f}, std::array<float,2>{0.0410637148f, 0.692731798f}, std::array<float,2>{0.579243362f, 0.602415919f}, std::array<float,2>{0.306571931f, 0.289249182f}, std::array<float,2>{0.960457146f, 0.205074921f}, std::array<float,2>{0.0942742899f, 0.885669351f}, std::array<float,2>{0.838376582f, 0.837841094f}, std::array<float,2>{0.15424782f, 0.114986025f}, std::array<float,2>{0.642935216f, 0.405946821f}, std::array<float,2>{0.492961168f, 0.682955265f}, std::array<float,2>{0.90801084f, 0.736503065f}, std::array<float,2>{0.0109106591f, 0.478319615f}, std::array<float,2>{0.525478005f, 0.0555736795f}, std::array<float,2>{0.358000726f, 0.777429581f}, std::array<float,2>{0.737251401f, 0.942277074f}, std::array<float,2>{0.388044834f, 0.15400742f}, std::array<float,2>{0.797594249f, 0.374136388f}, std::array<float,2>{0.219992265f, 0.504379332f}, std::array<float,2>{0.606372893f, 0.678045154f}, std::array<float,2>{0.277897626f, 0.391112149f}, std::array<float,2>{0.977138042f, 0.124930352f}, std::array<float,2>{0.0732325539f, 0.832313418f}, std::array<float,2>{0.866379023f, 0.882087171f}, std::array<float,2>{0.164634302f, 0.218492046f}, std::array<float,2>{0.68159914f, 0.286412716f}, std::array<float,2>{0.46271199f, 0.598123968f}, std::array<float,2>{0.889543891f, 0.513225079f}, std::array<float,2>{0.0335779861f, 0.363764226f}, std::array<float,2>{0.552922785f, 0.145935923f}, std::array<float,2>{0.329864472f, 0.946452439f}, std::array<float,2>{0.697098076f, 0.772487819f}, std::array<float,2>{0.42473647f, 0.0541336834f}, std::array<float,2>{0.753168404f, 0.472166747f}, std::array<float,2>{0.18845737f, 0.743304729f}, std::array<float,2>{0.655364156f, 0.584401131f}, std::array<float,2>{0.487098724f, 0.269912571f}, std::array<float,2>{0.832357764f, 0.225660548f}, std::array<float,2>{0.141708732f, 0.925881267f}, std::array<float,2>{0.965891242f, 0.874914467f}, std::array<float,2>{0.108648941f, 0.0927127153f}, std::array<float,2>{0.59288758f, 0.422694892f}, std::array<float,2>{0.303563535f, 0.650929153f}, std::array<float,2>{0.806638598f, 0.703040183f}, std::array<float,2>{0.230607718f, 0.442124218f}, std::array<float,2>{0.743653774f, 0.0141242696f}, std::array<float,2>{0.375248313f, 0.802994549f}, std::array<float,2>{0.522745013f, 0.988839686f}, std::array<float,2>{0.348787963f, 0.176646203f}, std::array<float,2>{0.919818223f, 0.318501323f}, std::array<float,2>{0.00313229277f, 0.542790174f}, std::array<float,2>{0.72211194f, 0.732560396f}, std::array<float,2>{0.402406186f, 0.486860603f}, std::array<float,2>{0.796375692f, 0.0312656797f}, std::array<float,2>{0.2421747f, 0.750270367f}, std::array<float,2>{0.933039069f, 0.958657086f}, std::array<float,2>{0.0165135246f, 0.139390856f}, std::array<float,2>{0.506709158f, 0.344817281f}, std::array<float,2>{0.374840081f, 0.528391838f}, std::array<float,2>{0.824531317f, 0.623639345f}, std::array<float,2>{0.133982286f, 0.306356579f}, std::array<float,2>{0.634538472f, 0.190819949f}, std::array<float,2>{0.476867437f, 0.899114251f}, std::array<float,2>{0.565414131f, 0.820000172f}, std::array<float,2>{0.281415999f, 0.105490267f}, std::array<float,2>{0.950967252f, 0.377638698f}, std::array<float,2>{0.115783177f, 0.668262005f}, std::array<float,2>{0.543022335f, 0.55603385f}, std::array<float,2>{0.320789009f, 0.337489873f}, std::array<float,2>{0.899787188f, 0.166288808f}, std::array<float,2>{0.0599527173f, 0.976186693f}, std::array<float,2>{0.776816249f, 0.788553774f}, std::array<float,2>{0.208132505f, 0.0258146394f}, std::array<float,2>{0.714657605f, 0.457245022f}, std::array<float,2>{0.42017293f, 0.70874685f}, std::array<float,2>{0.995849431f, 0.625173271f}, std::array<float,2>{0.0818836316f, 0.411526978f}, std::array<float,2>{0.62113899f, 0.0778827891f}, std::array<float,2>{0.25624004f, 0.844888806f}, std::array<float,2>{0.67170006f, 0.9101125f}, std::array<float,2>{0.443155348f, 0.240306795f}, std::array<float,2>{0.853213549f, 0.262043267f}, std::array<float,2>{0.187025174f, 0.568923771f}, std::array<float,2>{0.616246819f, 0.69869566f}, std::array<float,2>{0.265584469f, 0.439143121f}, std::array<float,2>{0.992056608f, 0.0116868606f}, std::array<float,2>{0.0865660086f, 0.800090194f}, std::array<float,2>{0.847803414f, 0.985928476f}, std::array<float,2>{0.176600024f, 0.172036126f}, std::array<float,2>{0.662980497f, 0.314746767f}, std::array<float,2>{0.452861398f, 0.544053137f}, std::array<float,2>{0.894101679f, 0.581781089f}, std::array<float,2>{0.0512076952f, 0.266103804f}, std::array<float,2>{0.532181442f, 0.219982594f}, std::array<float,2>{0.318903297f, 0.92296052f}, std::array<float,2>{0.705579758f, 0.870916724f}, std::array<float,2>{0.413217187f, 0.0898307189f}, std::array<float,2>{0.770842373f, 0.426050276f}, std::array<float,2>{0.214501694f, 0.654020369f}, std::array<float,2>{0.62509501f, 0.510590136f}, std::array<float,2>{0.471992224f, 0.35952884f}, std::array<float,2>{0.812581837f, 0.144176111f}, std::array<float,2>{0.126346573f, 0.952535391f}, std::array<float,2>{0.940077424f, 0.768660665f}, std::array<float,2>{0.122544818f, 0.0502946675f}, std::array<float,2>{0.573756814f, 0.475150883f}, std::array<float,2>{0.289756864f, 0.746890545f}, std::array<float,2>{0.782361925f, 0.67223078f}, std::array<float,2>{0.247438654f, 0.395387262f}, std::array<float,2>{0.729444623f, 0.119810082f}, std::array<float,2>{0.395057887f, 0.829608083f}, std::array<float,2>{0.508980095f, 0.875442147f}, std::array<float,2>{0.365579247f, 0.214006171f}, std::array<float,2>{0.922097623f, 0.282105237f}, std::array<float,2>{0.0235591196f, 0.595188379f}, std::array<float,2>{0.739574671f, 0.63218534f}, std::array<float,2>{0.386393756f, 0.408504188f}, std::array<float,2>{0.801262736f, 0.07151746f}, std::array<float,2>{0.224567622f, 0.850293279f}, std::array<float,2>{0.911668777f, 0.912458718f}, std::array<float,2>{0.0143905655f, 0.234783784f}, std::array<float,2>{0.530137658f, 0.260761857f}, std::array<float,2>{0.353871882f, 0.563338041f}, std::array<float,2>{0.843251765f, 0.56234771f}, std::array<float,2>{0.149147317f, 0.342003018f}, std::array<float,2>{0.645646632f, 0.169661626f}, std::array<float,2>{0.498519927f, 0.971312046f}, std::array<float,2>{0.582473993f, 0.784546912f}, std::array<float,2>{0.311480343f, 0.0295443535f}, std::array<float,2>{0.956511199f, 0.453700632f}, std::array<float,2>{0.0980771184f, 0.705888867f}, std::array<float,2>{0.557640851f, 0.617471278f}, std::array<float,2>{0.33744365f, 0.310601562f}, std::array<float,2>{0.882634819f, 0.191937521f}, std::array<float,2>{0.0448949076f, 0.903669f}, std::array<float,2>{0.76081717f, 0.815038621f}, std::array<float,2>{0.200274274f, 0.103056394f}, std::array<float,2>{0.692631483f, 0.382695913f}, std::array<float,2>{0.432160467f, 0.666103899f}, std::array<float,2>{0.969045639f, 0.728326678f}, std::array<float,2>{0.0695906058f, 0.491276503f}, std::array<float,2>{0.60030812f, 0.0380173475f}, std::array<float,2>{0.269165367f, 0.757594407f}, std::array<float,2>{0.678931236f, 0.954013705f}, std::array<float,2>{0.453593463f, 0.135397956f}, std::array<float,2>{0.871814668f, 0.349140316f}, std::array<float,2>{0.156367674f, 0.525383115f}, std::array<float,2>{0.516414046f, 0.66222775f}, std::array<float,2>{0.347619593f, 0.383739293f}, std::array<float,2>{0.916029394f, 0.0979193524f}, std::array<float,2>{0.00750108343f, 0.826505542f}, std::array<float,2>{0.811232924f, 0.890913844f}, std::array<float,2>{0.227839172f, 0.199172303f}, std::array<float,2>{0.748564303f, 0.299492061f}, std::array<float,2>{0.380921215f, 0.616681099f}, std::array<float,2>{0.96102494f, 0.521481812f}, std::array<float,2>{0.105299674f, 0.351750016f}, std::array<float,2>{0.589364827f, 0.125824258f}, std::array<float,2>{0.300721914f, 0.961787522f}, std::array<float,2>{0.651270926f, 0.763371348f}, std::array<float,2>{0.490070701f, 0.0442126915f}, std::array<float,2>{0.828768909f, 0.494490385f}, std::array<float,2>{0.148235783f, 0.720182598f}, std::array<float,2>{0.699389279f, 0.57531929f}, std::array<float,2>{0.425943732f, 0.255391151f}, std::array<float,2>{0.756426096f, 0.245724916f}, std::array<float,2>{0.192980945f, 0.914890468f}, std::array<float,2>{0.883851349f, 0.852620423f}, std::array<float,2>{0.0364678167f, 0.0669899657f}, std::array<float,2>{0.547341347f, 0.419301927f}, std::array<float,2>{0.33357802f, 0.634229541f}, std::array<float,2>{0.86305207f, 0.714580536f}, std::array<float,2>{0.170537502f, 0.46174261f}, std::array<float,2>{0.685599923f, 0.0203586742f}, std::array<float,2>{0.465704411f, 0.792541921f}, std::array<float,2>{0.603826225f, 0.983828068f}, std::array<float,2>{0.27698043f, 0.160826743f}, std::array<float,2>{0.981415272f, 0.332017362f}, std::array<float,2>{0.0753897056f, 0.550702095f}, std::array<float,2>{0.667386711f, 0.741612852f}, std::array<float,2>{0.438059419f, 0.480879337f}, std::array<float,2>{0.857170939f, 0.06121061f}, std::array<float,2>{0.182845742f, 0.776478827f}, std::array<float,2>{0.99630326f, 0.941100597f}, std::array<float,2>{0.0852528438f, 0.14866589f}, std::array<float,2>{0.620484591f, 0.368625104f}, std::array<float,2>{0.253698349f, 0.501627743f}, std::array<float,2>{0.778983593f, 0.609319508f}, std::array<float,2>{0.205790818f, 0.293999612f}, std::array<float,2>{0.717360258f, 0.209750205f}, std::array<float,2>{0.416599184f, 0.887007773f}, std::array<float,2>{0.542607665f, 0.841777384f}, std::array<float,2>{0.327951491f, 0.110808164f}, std::array<float,2>{0.90561837f, 0.401988596f}, std::array<float,2>{0.0577614494f, 0.687273264f}, std::array<float,2>{0.567958891f, 0.537847579f}, std::array<float,2>{0.286645949f, 0.323654503f}, std::array<float,2>{0.946546078f, 0.184572935f}, std::array<float,2>{0.110427283f, 0.992248237f}, std::array<float,2>{0.820453882f, 0.812055469f}, std::array<float,2>{0.139454827f, 0.00774803245f}, std::array<float,2>{0.639648259f, 0.445343584f}, std::array<float,2>{0.481066257f, 0.690464199f}, std::array<float,2>{0.935743988f, 0.646384716f}, std::array<float,2>{0.0200174786f, 0.431557387f}, std::array<float,2>{0.501266062f, 0.0801277161f}, std::array<float,2>{0.368639886f, 0.866188884f}, std::array<float,2>{0.725720763f, 0.930538952f}, std::array<float,2>{0.399252057f, 0.233420834f}, std::array<float,2>{0.792201698f, 0.277337998f}, std::array<float,2>{0.238023207f, 0.589448154f}, std::array<float,2>{0.53578186f, 0.725538611f}, std::array<float,2>{0.313464224f, 0.497160137f}, std::array<float,2>{0.894967079f, 0.0428376086f}, std::array<float,2>{0.0499893986f, 0.760376036f}, std::array<float,2>{0.765929759f, 0.966046333f}, std::array<float,2>{0.217086792f, 0.129739285f}, std::array<float,2>{0.708942235f, 0.356837183f}, std::array<float,2>{0.408218265f, 0.517500997f}, std::array<float,2>{0.98471117f, 0.613018274f}, std::array<float,2>{0.0923420936f, 0.303826064f}, std::array<float,2>{0.612148166f, 0.202218547f}, std::array<float,2>{0.25796333f, 0.898132205f}, std::array<float,2>{0.659444392f, 0.82375598f}, std::array<float,2>{0.446069628f, 0.0974226519f}, std::array<float,2>{0.846187174f, 0.390345097f}, std::array<float,2>{0.174206033f, 0.656773865f}, std::array<float,2>{0.733008623f, 0.55411458f}, std::array<float,2>{0.391339958f, 0.335707814f}, std::array<float,2>{0.787088871f, 0.157385871f}, std::array<float,2>{0.244488105f, 0.980356157f}, std::array<float,2>{0.928893447f, 0.796414435f}, std::array<float,2>{0.0276381113f, 0.0177902784f}, std::array<float,2>{0.513360083f, 0.467309773f}, std::array<float,2>{0.362799555f, 0.71871376f}, std::array<float,2>{0.817891717f, 0.639763594f}, std::array<float,2>{0.131557032f, 0.417883664f}, std::array<float,2>{0.629678607f, 0.0662122443f}, std::array<float,2>{0.475296348f, 0.857021749f}, std::array<float,2>{0.577652335f, 0.920884907f}, std::array<float,2>{0.29345876f, 0.248798266f}, std::array<float,2>{0.944423795f, 0.250591248f}, std::array<float,2>{0.118697479f, 0.57332319f}, std::array<float,2>{0.641189814f, 0.680333972f}, std::array<float,2>{0.495809883f, 0.403983384f}, std::array<float,2>{0.836519122f, 0.116152681f}, std::array<float,2>{0.155129582f, 0.839365184f}, std::array<float,2>{0.958981812f, 0.883863807f}, std::array<float,2>{0.0961212441f, 0.206637755f}, std::array<float,2>{0.580774009f, 0.292383224f}, std::array<float,2>{0.30818826f, 0.604835212f}, std::array<float,2>{0.799590647f, 0.506049752f}, std::array<float,2>{0.22139965f, 0.371877521f}, std::array<float,2>{0.736019254f, 0.154787138f}, std::array<float,2>{0.390427589f, 0.944141209f}, std::array<float,2>{0.523999214f, 0.780140162f}, std::array<float,2>{0.356233746f, 0.0570089221f}, std::array<float,2>{0.908599317f, 0.480020165f}, std::array<float,2>{0.00812442414f, 0.736007631f}, std::array<float,2>{0.596176505f, 0.593049943f}, std::array<float,2>{0.273389935f, 0.277518064f}, std::array<float,2>{0.975029886f, 0.228328109f}, std::array<float,2>{0.0654314011f, 0.936919451f}, std::array<float,2>{0.869891822f, 0.862494886f}, std::array<float,2>{0.160934135f, 0.0830704644f}, std::array<float,2>{0.674591124f, 0.435945213f}, std::array<float,2>{0.458200604f, 0.64450407f}, std::array<float,2>{0.876093209f, 0.694670558f}, std::array<float,2>{0.039775081f, 0.452926844f}, std::array<float,2>{0.561566412f, 0.00191488652f}, std::array<float,2>{0.342844129f, 0.808262169f}, std::array<float,2>{0.688502491f, 0.996692538f}, std::array<float,2>{0.434128731f, 0.179703876f}, std::array<float,2>{0.762947977f, 0.326581687f}, std::array<float,2>{0.198110849f, 0.534484923f}, std::array<float,2>{0.590161264f, 0.649840593f}, std::array<float,2>{0.300825775f, 0.424031526f}, std::array<float,2>{0.967343748f, 0.0911929458f}, std::array<float,2>{0.106520779f, 0.871980011f}, std::array<float,2>{0.834809065f, 0.929255128f}, std::array<float,2>{0.143356845f, 0.223746285f}, std::array<float,2>{0.654239476f, 0.271624774f}, std::array<float,2>{0.485037804f, 0.582672477f}, std::array<float,2>{0.920036435f, 0.540343821f}, std::array<float,2>{0.000568694493f, 0.316571891f}, std::array<float,2>{0.519840777f, 0.179494485f}, std::array<float,2>{0.350988179f, 0.990991354f}, std::array<float,2>{0.745273352f, 0.801600218f}, std::array<float,2>{0.378569454f, 0.0123083992f}, std::array<float,2>{0.80705297f, 0.44480902f}, std::array<float,2>{0.23271428f, 0.70085901f}, std::array<float,2>{0.682150364f, 0.600398302f}, std::array<float,2>{0.463161498f, 0.289014399f}, std::array<float,2>{0.865013838f, 0.21490702f}, std::array<float,2>{0.166287959f, 0.879738152f}, std::array<float,2>{0.979861021f, 0.83468008f}, std::array<float,2>{0.0711982474f, 0.122067071f}, std::array<float,2>{0.608806968f, 0.393034726f}, std::array<float,2>{0.280686617f, 0.676914752f}, std::array<float,2>{0.751443386f, 0.745420337f}, std::array<float,2>{0.191304252f, 0.469633132f}, std::array<float,2>{0.698128164f, 0.0517221354f}, std::array<float,2>{0.422746509f, 0.770492733f}, std::array<float,2>{0.552141905f, 0.949020505f}, std::array<float,2>{0.330912024f, 0.146651626f}, std::array<float,2>{0.887155116f, 0.365793228f}, std::array<float,2>{0.0325419605f, 0.5151124f}, std::array<float,2>{0.711896896f, 0.710670233f}, std::array<float,2>{0.419810295f, 0.460161239f}, std::array<float,2>{0.774617553f, 0.0239424873f}, std::array<float,2>{0.210529774f, 0.786609232f}, std::array<float,2>{0.901864231f, 0.973729789f}, std::array<float,2>{0.0609018616f, 0.165362f}, std::array<float,2>{0.545926154f, 0.339247108f}, std::array<float,2>{0.32411921f, 0.556753159f}, std::array<float,2>{0.855038226f, 0.567715526f}, std::array<float,2>{0.184998736f, 0.264244199f}, std::array<float,2>{0.66935581f, 0.239758983f}, std::array<float,2>{0.444360346f, 0.907038212f}, std::array<float,2>{0.624554753f, 0.847306907f}, std::array<float,2>{0.254244596f, 0.0743816346f}, std::array<float,2>{0.992459238f, 0.413555443f}, std::array<float,2>{0.078884989f, 0.628195941f}, std::array<float,2>{0.50427115f, 0.531061351f}, std::array<float,2>{0.37275973f, 0.34637928f}, std::array<float,2>{0.930081487f, 0.136952594f}, std::array<float,2>{0.0179377478f, 0.960703135f}, std::array<float,2>{0.794037223f, 0.752830505f}, std::array<float,2>{0.239944369f, 0.0335941352f}, std::array<float,2>{0.719246089f, 0.485294998f}, std::array<float,2>{0.404625058f, 0.730633914f}, std::array<float,2>{0.952955663f, 0.671853364f}, std::array<float,2>{0.114113465f, 0.376448631f}, std::array<float,2>{0.563328147f, 0.109011285f}, std::array<float,2>{0.283509761f, 0.817595303f}, std::array<float,2>{0.635233045f, 0.902011037f}, std::array<float,2>{0.48009631f, 0.188927382f}, std::array<float,2>{0.826743305f, 0.30729872f}, std::array<float,2>{0.135915011f, 0.621687531f}}
48.999268
52
0.734685
st-ario
793a560eb76a88ec6330b05717b876b27a295a73
9,153
cc
C++
src/test/politetest.cc
aaszodi/multovl
00c5b74e65c7aa37cddea8b2ae277fe67fbc59a8
[ "MIT" ]
2
2018-03-06T02:36:25.000Z
2020-01-13T10:55:35.000Z
src/test/politetest.cc
aaszodi/multovl
00c5b74e65c7aa37cddea8b2ae277fe67fbc59a8
[ "MIT" ]
null
null
null
src/test/politetest.cc
aaszodi/multovl
00c5b74e65c7aa37cddea8b2ae277fe67fbc59a8
[ "MIT" ]
null
null
null
/* <LICENSE> License for the MULTOVL multiple genomic overlap tools Copyright (c) 2007-2012, Dr Andras Aszodi, Campus Science Support Facilities GmbH (CSF), Dr-Bohr-Gasse 3, A-1030 Vienna, Austria, Europe. 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 the Campus Science Support Facilities GmbH 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. </LICENSE> */ #define BOOST_TEST_MODULE politetest #include "boost/test/unit_test.hpp" // -- Standard headers -- #include <string> using namespace std; // -- Boost headers -- #include "boost/lexical_cast.hpp" // -- Library headers -- #include "polite.hh" using namespace multovl; // -- Derived classes -- // Because Polite is abstract, we need test classes. // Both simple and multiple (virtual) inheritance is tested. // simple inheritance class DerPolite: public Polite { public: DerPolite(): Polite(), _v(3) { add_option<unsigned int>("val", &_v, 3, "uint value, must be >= 3", 'v'); add_bool_switch("switch", &_s, "Boolean switch", 's'); } unsigned int v() const { return _v; } bool s() const { return _s; } /// make option_seen() publicly available & hence testable bool optseen(const std::string& param) const { return option_seen(param); } protected: virtual bool check_variables() { if (option_seen("val")) // non-mandatory { unsigned int _v = fetch_value<unsigned int>("val"); if (_v < 3) { add_error("val must be >= 3"); return false; } } return true; } private: unsigned int _v; // some value bool _s; }; // class DerPolite // complex: diamond inheritance class Aopt: public virtual Polite { public: Aopt(): Polite("A options help"), _a(3) { add_option<int>("aaa", &_a, 3, "integer value, must be >= 3", 'a'); } int a() const { return _a; } virtual ostream& print_version(ostream& out) const { Aopt::version_info(out); return Polite::version_info(out); } protected: virtual bool check_variables() { if (option_seen("aaa")) { int _a = fetch_value<int>("aaa"); if (_a < 3) { add_error("aaa must be >= 3"); return false; } return true; } return false; } virtual ostream& version_info(ostream& out) const { out << "Version A" << endl; return out; } private: int _a; }; // class Aopt class Bopt: public virtual Polite { public: Bopt(): Polite("B options help"), _b(4) { add_option<int>("bbb", &_b, 4, "integer value, must be >= 4", 'b'); } int b() const { return _b; } virtual ostream& print_version(ostream& out) const { Bopt::version_info(out); return Polite::version_info(out); } protected: virtual bool check_variables() { if (option_seen("bbb")) { int _b = fetch_value<int>("bbb"); if (_b < 4) { add_error("bbb must be >= 4"); return false; } return true; } return false; } virtual ostream& version_info(ostream& out) const { out << "Version B" << endl; return out; } private: int _b; }; // class Bopt class Copt: public Aopt, public Bopt { public: Copt(): Polite("C options help"), Aopt(), Bopt() { add_option<int>("ccc", &_c, 5, "integer value, must be >= 5", 'c'); } int c() const { return _c; } virtual ostream& print_version(ostream& out) const { Copt::version_info(out); Aopt::version_info(out); Bopt::version_info(out); return Polite::version_info(out); } protected: virtual bool check_variables() { bool oka = Aopt::check_variables(), okb = Bopt::check_variables(); // need side effects in both if (option_seen("ccc")) { int _c = fetch_value<int>("ccc"); if (_c < 5) { add_error("ccc must be >= 5"); return false; } return oka && okb; } return false; } virtual ostream& version_info(ostream& out) const { out << "Version C" << endl; return out; } private: int _c; }; // class Copt // gets rid of annoying "deprecated conversion from string constant blah blah" warning (StackOverflow tip) #pragma GCC diagnostic ignored "-Wwrite-strings" BOOST_AUTO_TEST_CASE(simple_test) { const int ARGC = 4; char *ARGV[] = { "politetest", "-v", "4", "--switch" }; DerPolite dp; bool ok = dp.parse_check(ARGC, ARGV); BOOST_CHECK(ok); BOOST_CHECK_EQUAL(dp.v(), 4); BOOST_CHECK(dp.optseen("val")); // -v option was given BOOST_CHECK(dp.s()); const int ARGC2 = 3; char *ARGV2[] = { "politetest", "-v", "2" }; DerPolite dp2; // need new, can't parse twice :-( ok = dp2.parse_check(ARGC2, ARGV2); BOOST_CHECK(!ok); BOOST_CHECK(dp2.optseen("val")); // -v option was given BOOST_CHECK_EQUAL(dp2.error_messages(), "ERROR: val must be >= 3\n"); const int ARGC3 = 2; char *ARGV3[] = { "politetest", "-s" }; DerPolite dp3; // need new again... ok = dp3.parse_check(ARGC3, ARGV3); BOOST_CHECK(ok); BOOST_CHECK(!dp3.optseen("val")); // -v option was not given BOOST_CHECK(dp3.optseen("switch")); // -s option was given BOOST_CHECK(!dp3.optseen("nosuch")); // some bogus option... } BOOST_AUTO_TEST_CASE(diamond_test) { const int ARGC = 7; char *ARGV[] = { "politetest", "-a", "6", "--bbb", "7", "--ccc", "8" }; Copt cp; bool ok = cp.parse_check(ARGC, ARGV); BOOST_CHECK(ok); BOOST_CHECK_EQUAL(cp.a(), 6); BOOST_CHECK_EQUAL(cp.b(), 7); BOOST_CHECK_EQUAL(cp.c(), 8); // not a real test cerr << "=== Help and version string tests ===" << endl; Aopt ap; ap.print_help(cerr); ap.print_version(cerr); Bopt bp; bp.print_help(cerr); bp.print_version(cerr); cp.print_help(cerr); cp.print_version(cerr); } #if 0 BOOST_AUTO_TEST_CASE(parse_test) { const int ARGC = 11; char *ARGV[] = {"prg", "-H","somehost","--user","Joe","-W","pwd","-D","db","--port","55432"}; // this is the most generic setup, must specify user and pwd DbOpts opts(DbOpts::OTHER); bool retval = opts.parse(ARGC, ARGV); BOOST_CHECK(retval); BOOST_CHECK_EQUAL(opts.host(), "somehost"); BOOST_CHECK_EQUAL(opts.user(), "Joe"); BOOST_CHECK_EQUAL(opts.password(), "pwd"); BOOST_CHECK_EQUAL(opts.database(), "db"); BOOST_CHECK(opts.port() == 55432); BOOST_CHECK_EQUAL(opts.conn_str(), "host=somehost dbname=db user=Joe password=pwd port=55432"); // readwrite user: needs password DbOpts rwopts(DbOpts::READWRITE); char *RWARGV[] = {"prg", "-H","somehost","-W","rwpwd","-D","db","--port","55432"}; retval = rwopts.parse(9, RWARGV); BOOST_CHECK_EQUAL(rwopts.user(), "readwrite"); BOOST_CHECK_EQUAL(rwopts.password(), "rwpwd"); // readonly user, no password needed DbOpts roopts; // default DbOpts::READONLY char *ROARGV[] = {"prg", "-H","somehost","-D","db","--port","55432"}; retval = roopts.parse(7, ROARGV); BOOST_CHECK_EQUAL(roopts.user(), "readonly"); BOOST_CHECK_EQUAL(roopts.password(), "rpass"); } #endif #pragma GCC diagnostic pop
26.763158
106
0.596526
aaszodi
793c3a394098bb31b07bb24892dfb35e0075e749
601
hpp
C++
src/threadpool.hpp
ASLeonard/pangenie
aeb0c2aa28bf69041755855306d32f5523371274
[ "MIT" ]
8
2021-12-10T10:30:08.000Z
2022-03-30T08:49:01.000Z
src/threadpool.hpp
ASLeonard/pangenie
aeb0c2aa28bf69041755855306d32f5523371274
[ "MIT" ]
7
2022-02-09T15:28:23.000Z
2022-03-22T10:12:50.000Z
src/threadpool.hpp
ASLeonard/pangenie
aeb0c2aa28bf69041755855306d32f5523371274
[ "MIT" ]
1
2022-02-08T09:56:36.000Z
2022-02-08T09:56:36.000Z
#ifndef THREADPOOL_HPP #define THREADPOOL_HPP #include <vector> #include <thread> #include <mutex> #include <condition_variable> #include <functional> #include <list> /** Code take from: http://www.mathematik.uni-ulm.de/numerik/pp/ss17/pp-folien-2017-05-18.pdf **/ class ThreadPool { public: using Job = std::function<void()>; ThreadPool (size_t nr_threads); ~ThreadPool (); void submit(Job job); private: size_t nr_threads; bool finished; std::vector<std::thread> threads; std::mutex m; std::condition_variable cv; std::list<Job> jobs; void process_jobs (); }; #endif //THREADPOOL_HPP
20.033333
97
0.727121
ASLeonard
7941ae64bdd430f7f8aa71de41033a2f13b7cf57
18,312
cpp
C++
Seidon/src/Physics/PhysicSystem.cpp
Soarex/Seidon
65a59783e6fddb02670b1ba8c4f1e2e231a06f50
[ "Apache-2.0" ]
null
null
null
Seidon/src/Physics/PhysicSystem.cpp
Soarex/Seidon
65a59783e6fddb02670b1ba8c4f1e2e231a06f50
[ "Apache-2.0" ]
null
null
null
Seidon/src/Physics/PhysicSystem.cpp
Soarex/Seidon
65a59783e6fddb02670b1ba8c4f1e2e231a06f50
[ "Apache-2.0" ]
null
null
null
#include "PhysicSystem.h" #include "../Core/Application.h" #include "../Ecs/Entity.h" using namespace physx; namespace Seidon { void PhysicSystem::Init() { api = Application::Get()->GetPhysicsApi(); physics = api->GetPhysics(); PxSceneDesc sceneDesc(physics->getTolerancesScale()); sceneDesc.gravity = PxVec3(0.0f, -9.81f, 0.0f); dispatcher = PxDefaultCpuDispatcherCreate(2); sceneDesc.cpuDispatcher = dispatcher; sceneDesc.filterShader = PxDefaultSimulationFilterShader; physxScene = physics->createScene(sceneDesc); physxScene->setFlag(PxSceneFlag::eENABLE_ACTIVE_ACTORS, true); physxScene->setFlag(PxSceneFlag::eEXCLUDE_KINEMATICS_FROM_ACTIVE_ACTORS, true); defaultMaterial = physics->createMaterial(0.5f, 0.5f, 0.6f); characterControllerManager = PxCreateControllerManager(*physxScene); characterControllerCallbacks = new CharacterControllerCallbacks(); /* Cube Colliders */ scene->CreateViewAndIterate<CubeColliderComponent> ( [&](EntityId id, CubeColliderComponent&) { SetupCubeCollider(id); } ); cubeColliderAddedCallbackId = scene->AddComponentAddedCallback<CubeColliderComponent>([&](EntityId id) { SetupCubeCollider(id); }); cubeColliderRemovedCallbackId = scene->AddComponentRemovedCallback<CubeColliderComponent>([&](EntityId id) { DeleteCubeCollider(id); }); /* Mesh Colliders */ scene->CreateViewAndIterate<MeshColliderComponent> ( [&](EntityId id, MeshColliderComponent&) { SetupMeshCollider(id); } ); meshColliderAddedCallbackId = scene->AddComponentAddedCallback<MeshColliderComponent>([&](EntityId id) { SetupMeshCollider(id); }); meshColliderRemovedCallbackId = scene->AddComponentRemovedCallback<MeshColliderComponent>([&](EntityId id) { DeleteMeshCollider(id); }); /* Static Rigidbodies */ scene->CreateViewAndIterate<StaticRigidbodyComponent> ( [&](EntityId id, StaticRigidbodyComponent&) { SetupStaticRigidbody(id); } ); staticRigidbodyAddedCallbackId = scene->AddComponentAddedCallback<StaticRigidbodyComponent>([&](EntityId id) { SetupStaticRigidbody(id); }); staticRigidbodyRemovedCallbackId = scene->AddComponentRemovedCallback<StaticRigidbodyComponent>([&](EntityId id) { DeleteStaticRigidbody(id); }); /* Dynamic Rigidbodies */ scene->CreateViewAndIterate<DynamicRigidbodyComponent> ( [&](EntityId id, DynamicRigidbodyComponent&) { SetupDynamicRigidbody(id); } ); dynamicRigidbodyAddedCallbackId = scene->AddComponentAddedCallback<DynamicRigidbodyComponent>([&](EntityId id) { SetupDynamicRigidbody(id); }); dynamicRigidbodyRemovedCallbackId = scene->AddComponentRemovedCallback<DynamicRigidbodyComponent>([&](EntityId id) { DeleteDynamicRigidbody(id); }); /* Character controllers */ scene->CreateViewAndIterate<CharacterControllerComponent> ( [&](EntityId id, CharacterControllerComponent&) { SetupCharacterController(id); } ); characterControllerAddedCallbackId = scene->AddComponentAddedCallback<CharacterControllerComponent>([&](EntityId id) { SetupCharacterController(id); }); characterControllerRemovedCallbackId = scene->AddComponentRemovedCallback<CharacterControllerComponent>([&](EntityId id) { DeleteCharacterController(id); }); } void PhysicSystem::Update(float deltaTime) { timeSinceLastStep += deltaTime; if (timeSinceLastStep < stepSize) return; timeSinceLastStep -= stepSize; scene->CreateGroupAndIterate<DynamicRigidbodyComponent> ( GetTypeList<TransformComponent>, [&](EntityId e, DynamicRigidbodyComponent& rigidbody, TransformComponent& localTransform) { TransformComponent transform; transform.SetFromMatrix(scene->GetEntityByEntityId(e).GetGlobalTransformMatrix()); PxTransform t; t.p = PxVec3(transform.position.x, transform.position.y, transform.position.z); glm::quat q = glm::quat(transform.rotation); t.q = PxQuat(q.x, q.y, q.z, q.w); PxRigidDynamic& actor = *rigidbody.actor.physxActor; if (rigidbody.kinematic) { actor.setRigidBodyFlag(PxRigidBodyFlag::eKINEMATIC, true); actor.setKinematicTarget(t); } else { actor.setRigidBodyFlag(PxRigidBodyFlag::eKINEMATIC, false); actor.setGlobalPose(t); } actor.setRigidDynamicLockFlag(PxRigidDynamicLockFlag::eLOCK_ANGULAR_X, rigidbody.lockXRotation); actor.setRigidDynamicLockFlag(PxRigidDynamicLockFlag::eLOCK_ANGULAR_Y, rigidbody.lockYRotation); actor.setRigidDynamicLockFlag(PxRigidDynamicLockFlag::eLOCK_ANGULAR_Z, rigidbody.lockZRotation); } ); scene->CreateGroupAndIterate<CharacterControllerComponent> ( GetTypeList<TransformComponent>, [&](EntityId e, CharacterControllerComponent& characterController, TransformComponent& transform) { characterController.collisions.clear(); } ); physxScene->simulate(stepSize); physxScene->fetchResults(true); uint32_t actorCount = 0; PxActor** activeActors = physxScene->getActiveActors(actorCount); for (int i = 0; i < actorCount; i++) { PxRigidActor* actor = (PxRigidActor*)activeActors[i]; PxTransform transform = actor->getGlobalPose(); EntityId id = (EntityId)(int)actor->userData; Entity e = scene->GetEntityByEntityId(id); TransformComponent& localTransform = e.GetComponent<TransformComponent>(); if (e.HasParent()) { TransformComponent worldTransform; worldTransform.SetFromMatrix(e.GetGlobalTransformMatrix()); worldTransform.position = glm::vec3(transform.p.x, transform.p.y, transform.p.z); worldTransform.rotation = glm::eulerAngles(glm::quat(transform.q.w, transform.q.x, transform.q.y, transform.q.z)); localTransform.SetFromMatrix(glm::inverse(e.GetParent().GetGlobalTransformMatrix()) * worldTransform.GetTransformMatrix()); } else { localTransform.position = glm::vec3(transform.p.x, transform.p.y, transform.p.z); localTransform.rotation = glm::eulerAngles(glm::quat(transform.q.w, transform.q.x, transform.q.y, transform.q.z)); } } } void PhysicSystem::Destroy() { scene->CreateViewAndIterate<StaticRigidbodyComponent> ( [&](EntityId id, StaticRigidbodyComponent&) { DeleteStaticRigidbody(id); } ); scene->CreateViewAndIterate<DynamicRigidbodyComponent> ( [&](EntityId id, DynamicRigidbodyComponent&) { DeleteDynamicRigidbody(id); } ); scene->CreateViewAndIterate<CubeColliderComponent> ( [&](EntityId id, CubeColliderComponent&) { DeleteCubeCollider(id); } ); scene->CreateViewAndIterate<CharacterControllerComponent> ( [&](EntityId id, CharacterControllerComponent&) { DeleteCharacterController(id); } ); physxScene->release(); scene->RemoveComponentAddedCallback<CubeColliderComponent>(cubeColliderAddedCallbackId); scene->RemoveComponentAddedCallback<MeshColliderComponent>(meshColliderAddedCallbackId); scene->RemoveComponentAddedCallback<StaticRigidbodyComponent>(staticRigidbodyAddedCallbackId); scene->RemoveComponentAddedCallback<DynamicRigidbodyComponent>(dynamicRigidbodyAddedCallbackId); scene->RemoveComponentAddedCallback<CharacterControllerComponent>(characterControllerAddedCallbackId); scene->RemoveComponentRemovedCallback<CubeColliderComponent>(cubeColliderRemovedCallbackId); scene->RemoveComponentRemovedCallback<MeshColliderComponent>(meshColliderRemovedCallbackId); scene->RemoveComponentRemovedCallback<StaticRigidbodyComponent>(staticRigidbodyRemovedCallbackId); scene->RemoveComponentRemovedCallback<DynamicRigidbodyComponent>(dynamicRigidbodyRemovedCallbackId); scene->RemoveComponentRemovedCallback<CharacterControllerComponent>(characterControllerRemovedCallbackId); } void PhysicSystem::SetupMeshCollider(EntityId id) { Entity e = scene->GetEntityByEntityId(id); MeshColliderComponent& collider = e.GetComponent<MeshColliderComponent>(); TransformComponent transform; transform.SetFromMatrix(e.GetGlobalTransformMatrix()); glm::vec3 position = transform.position; PxTransform t; t.p = PxVec3(position.x, position.y, position.z); glm::quat rot = glm::quat(transform.rotation); t.q = PxQuat(rot.x, rot.y, rot.z, rot.w); glm::vec3 size = transform.scale; int vertexCount = 0; int indexCount = 0; for (Submesh* submesh : collider.mesh->subMeshes) { vertexCount += submesh->vertices.size(); indexCount += submesh->indices.size(); } std::vector<Vertex> vertices; std::vector<uint32_t> indices; vertices.resize(vertexCount); indices.resize(indexCount); int vertexOffset = 0; int indexOffset = 0; for (Submesh* submesh : collider.mesh->subMeshes) { memcpy(&vertices[vertexOffset], &submesh->vertices[0], submesh->vertices.size() * sizeof(Vertex)); for (int i = 0; i < submesh->indices.size(); i++) indices[indexOffset + i] = submesh->indices[i] + vertexOffset; vertexOffset += submesh->vertices.size(); indexOffset += submesh->indices.size(); } PxTriangleMeshDesc meshDesc; meshDesc.points.count = vertices.size(); meshDesc.points.stride = sizeof(Vertex); meshDesc.points.data = &vertices[0]; meshDesc.triangles.count = indices.size(); meshDesc.triangles.stride = 3 * sizeof(int); meshDesc.triangles.data = &indices[0]; std::cout << meshDesc.isValid() << std::endl; PxDefaultMemoryOutputStream writeBuffer; PxTriangleMeshCookingResult::Enum result; bool status = api->GetCooker()->cookTriangleMesh(meshDesc, writeBuffer, &result); if (!status) { std::cerr << "Error cooking mesh " << collider.mesh->name << std::endl; return; } PxDefaultMemoryInputData readBuffer(writeBuffer.getData(), writeBuffer.getSize()); PxTriangleMesh* triangleMesh = physics->createTriangleMesh(readBuffer); PxMeshScale scale({ size.x, size.y, size.z }, PxQuat(PxIdentity)); PxTriangleMeshGeometry geometry(triangleMesh, scale); PxShape* shape = physics->createShape(geometry, *defaultMaterial, true); collider.shape.physxShape = shape; collider.shape.initialized = true; if (e.HasComponent<StaticRigidbodyComponent>()) { StaticRigidbodyComponent& r = e.GetComponent<StaticRigidbodyComponent>(); if (r.actor.IsInitialized() && r.actor.referenceScene == physxScene) r.actor.GetInternalActor()->attachShape(*shape); } if (e.HasComponent<DynamicRigidbodyComponent>()) { DynamicRigidbodyComponent& r = e.GetComponent<DynamicRigidbodyComponent>(); if (r.actor.IsInitialized() && r.actor.referenceScene == physxScene) r.actor.GetInternalActor()->attachShape(*shape); } } void PhysicSystem::SetupCharacterController(EntityId id) { Entity e = scene->GetEntityByEntityId(id); CharacterControllerComponent& controller = e.GetComponent<CharacterControllerComponent>(); TransformComponent transform; transform.SetFromMatrix(e.GetGlobalTransformMatrix()); PxCapsuleControllerDesc desc; desc.setToDefault(); desc.height = controller.colliderHeight; desc.radius = controller.colliderRadius; desc.material = defaultMaterial; desc.position = { transform.position.x, transform.position.y, transform.position.z }; desc.contactOffset = controller.contactOffset; desc.slopeLimit = glm::cos(glm::radians(controller.maxSlopeAngle)); desc.userData = (void*)id; desc.reportCallback = characterControllerCallbacks; PxController* c = characterControllerManager->createController(desc); c->getActor()->userData = (void*)id; controller.runtimeController.physxController = c; controller.runtimeController.referenceScene = physxScene; controller.runtimeController.initialized = true; } void PhysicSystem::SetupCubeCollider(EntityId id) { Entity e = scene->GetEntityByEntityId(id); CubeColliderComponent& cubeCollider = e.GetComponent<CubeColliderComponent>(); TransformComponent transform; transform.SetFromMatrix(e.GetGlobalTransformMatrix()); glm::vec3 size = cubeCollider.halfExtents * transform.scale; PxBoxGeometry geometry = PxBoxGeometry(size.x, size.y, size.z); PxShape* shape = physics->createShape(geometry, *defaultMaterial, true); PxTransform t; t.p = PxVec3(cubeCollider.offset.x, cubeCollider.offset.y, cubeCollider.offset.z); t.q = PxQuat(PxIDENTITY()); shape->setLocalPose(t); cubeCollider.shape.physxShape = shape; cubeCollider.shape.initialized = true; if (e.HasComponent<StaticRigidbodyComponent>()) { StaticRigidbodyComponent& r = e.GetComponent<StaticRigidbodyComponent>(); if (r.actor.IsInitialized() && r.actor.referenceScene == physxScene) r.actor.GetInternalActor()->attachShape(*shape); } if (e.HasComponent<DynamicRigidbodyComponent>()) { DynamicRigidbodyComponent& r = e.GetComponent<DynamicRigidbodyComponent>(); if (r.actor.IsInitialized() && r.actor.referenceScene == physxScene) r.actor.GetInternalActor()->attachShape(*shape); } } void PhysicSystem::SetupStaticRigidbody(EntityId id) { Entity e = scene->GetEntityByEntityId(id); StaticRigidbodyComponent& rigidbody = e.GetComponent<StaticRigidbodyComponent>(); TransformComponent transform; transform.SetFromMatrix(e.GetGlobalTransformMatrix()); PxTransform t; t.p = PxVec3(transform.position.x, transform.position.y, transform.position.z); glm::quat rot = glm::quat(transform.rotation); t.q = PxQuat(rot.x, rot.y, rot.z, rot.w); PxRigidStatic* actor = physics->createRigidStatic(t); actor->userData = (void*)id; if (e.HasComponent<CubeColliderComponent>()) { CubeColliderComponent& collider = e.GetComponent<CubeColliderComponent>(); if (collider.shape.IsInitialized()) actor->attachShape(*(collider.shape.GetInternalShape())); } if (e.HasComponent<MeshColliderComponent>()) { MeshColliderComponent& collider = e.GetComponent<MeshColliderComponent>(); if (collider.shape.IsInitialized()) actor->attachShape(*(collider.shape.GetInternalShape())); } physxScene->addActor(*actor); rigidbody.actor.physxActor = actor; rigidbody.actor.referenceScene = physxScene; rigidbody.actor.initialized = true; } void PhysicSystem::SetupDynamicRigidbody(EntityId id) { Entity e = scene->GetEntityByEntityId(id); DynamicRigidbodyComponent& rigidbody = e.GetComponent<DynamicRigidbodyComponent>(); TransformComponent transform; transform.SetFromMatrix(e.GetGlobalTransformMatrix()); PxTransform t; t.p = PxVec3(transform.position.x, transform.position.y, transform.position.z); glm::quat rot = glm::quat(transform.rotation); t.q = PxQuat(rot.x, rot.y, rot.z, rot.w); PxRigidDynamic* actor = physics->createRigidDynamic(t); PxRigidBodyExt::setMassAndUpdateInertia(*actor, rigidbody.mass); actor->userData = (void*)id; actor->setRigidDynamicLockFlag(PxRigidDynamicLockFlag::eLOCK_ANGULAR_X, rigidbody.lockXRotation); actor->setRigidDynamicLockFlag(PxRigidDynamicLockFlag::eLOCK_ANGULAR_Y, rigidbody.lockYRotation); actor->setRigidDynamicLockFlag(PxRigidDynamicLockFlag::eLOCK_ANGULAR_Z, rigidbody.lockZRotation); if (e.HasComponent<CubeColliderComponent>()) { CubeColliderComponent& collider = e.GetComponent<CubeColliderComponent>(); if (collider.shape.IsInitialized())actor->attachShape(*collider.shape.GetInternalShape()); } if (e.HasComponent<MeshColliderComponent>()) { MeshColliderComponent& collider = e.GetComponent<MeshColliderComponent>(); if (collider.shape.IsInitialized()) actor->attachShape(*(collider.shape.GetInternalShape())); } physxScene->addActor(*actor); rigidbody.actor.physxActor = actor; rigidbody.actor.referenceScene = physxScene; rigidbody.actor.initialized = true; } void PhysicSystem::DeleteCubeCollider(EntityId id) { Entity e = scene->GetEntityByEntityId(id); CubeColliderComponent& cubeCollider = e.GetComponent<CubeColliderComponent>(); PxShape* shape = cubeCollider.shape.GetInternalShape(); if (e.HasComponent<StaticRigidbodyComponent>()) { StaticRigidbodyComponent& r = e.GetComponent<StaticRigidbodyComponent>(); if (r.actor.IsInitialized()) r.actor.GetInternalActor()->detachShape(*shape); } if (e.HasComponent<DynamicRigidbodyComponent>()) { DynamicRigidbodyComponent& r = e.GetComponent<DynamicRigidbodyComponent>(); if (r.actor.IsInitialized()) r.actor.GetInternalActor()->detachShape(*shape); } shape->release(); cubeCollider.shape.initialized = false; cubeCollider.shape.physxShape = nullptr; } void PhysicSystem::DeleteMeshCollider(EntityId id) { Entity e = scene->GetEntityByEntityId(id); MeshColliderComponent& collider = e.GetComponent<MeshColliderComponent>(); PxShape* shape = collider.shape.GetInternalShape(); if (e.HasComponent<StaticRigidbodyComponent>()) { StaticRigidbodyComponent& r = e.GetComponent<StaticRigidbodyComponent>(); if (r.actor.IsInitialized()) r.actor.GetInternalActor()->detachShape(*shape); } if (e.HasComponent<DynamicRigidbodyComponent>()) { DynamicRigidbodyComponent& r = e.GetComponent<DynamicRigidbodyComponent>(); if (r.actor.IsInitialized()) r.actor.GetInternalActor()->detachShape(*shape); } shape->release(); collider.shape.initialized = false; collider.shape.physxShape = nullptr; } void PhysicSystem::DeleteStaticRigidbody(EntityId id) { Entity e = scene->GetEntityByEntityId(id); StaticRigidbodyComponent& rigidbody = e.GetComponent<StaticRigidbodyComponent>(); PxRigidActor* actor = rigidbody.actor.GetInternalActor(); actor->release(); rigidbody.actor.initialized = false; } void PhysicSystem::DeleteDynamicRigidbody(EntityId id) { Entity e = scene->GetEntityByEntityId(id); DynamicRigidbodyComponent& rigidbody = e.GetComponent<DynamicRigidbodyComponent>(); PxRigidActor* actor = rigidbody.actor.GetInternalActor(); actor->release(); rigidbody.actor.initialized = false; } void PhysicSystem::DeleteCharacterController(EntityId id) { Entity e = scene->GetEntityByEntityId(id); CharacterControllerComponent& controller = e.GetComponent<CharacterControllerComponent>(); PxController* c = controller.runtimeController.GetInternalController(); c->release(); controller.runtimeController.physxController = nullptr; controller.runtimeController.referenceScene = nullptr; controller.runtimeController.initialized = false; } }
31.195911
127
0.749563
Soarex
79455d04392be106a44bc3fcce19fdd8c41f677e
2,864
cpp
C++
dsp++/src/flt_biquad.cpp
andrzejc/dsp-
fd39d2395a37ade36e3b551d261de0177b78296b
[ "MIT" ]
null
null
null
dsp++/src/flt_biquad.cpp
andrzejc/dsp-
fd39d2395a37ade36e3b551d261de0177b78296b
[ "MIT" ]
null
null
null
dsp++/src/flt_biquad.cpp
andrzejc/dsp-
fd39d2395a37ade36e3b551d261de0177b78296b
[ "MIT" ]
null
null
null
#include <dsp++/flt/biquad_design.h> #include <dsp++/const.h> #include <stdexcept> #include <cmath> void dsp::biquad::design(double b[], double a[], biquad::type::spec type, double norm_freq, const double* gain_db, const double* q, const double* bw, const double* s) { if (norm_freq < 0. || norm_freq > 0.5) throw std::domain_error("dsp::biquad::design(): norm_freq outside [0, 0.5]"); double w0 = DSP_M_PI * 2. * norm_freq; // 2 * pi * f0 / Fs double cw0 = std::cos(w0); double A = 0, // sqrt(10^(gain_db/20)) alpha, Am1 = 0, // A - 1 Ap1 = 0, // A + 1 Am1c = 0, // (A-1)*cos(w0) Ap1c = 0, // (A+1)*cos(w0) sqAa2 = 0; // 2 * sqrt(A) * alpha bool is_eq; switch (type) { case biquad::type::peaking_eq: case biquad::type::low_shelf_eq: case biquad::type::high_shelf_eq: if (NULL == gain_db) throw std::invalid_argument("dsp::biquad::design(): gain_db not specified"); A = std::pow(10., *gain_db / 40.); Am1 = A - 1; Ap1 = A + 1; Am1c = Am1 * cw0; Ap1c = Ap1 * cw0; is_eq = true; break; default: is_eq = false; break; } double sw0 = std::sin(w0); if (NULL != q) alpha = sw0 / (2 * (*q)); else if (NULL != bw) alpha = sw0 * std::sinh(DSP_M_LN2 / 2 * (*bw) * w0/sw0); else if (is_eq && NULL != s) alpha = sw0 / 2 * std::sqrt((A + 1/A) * (1/(*s) -1) + 2); else throw std::invalid_argument("dsp::biquad::design(): q, bw, s not specified"); if (is_eq) sqAa2 = 2 * std::sqrt(A) * alpha; double n2c = -2 * cw0; // -2 * cos(w0) switch (type) { case biquad::type::lowpass: b[0] = (1 - cw0) / 2; b[1] = 1 - cw0; b[2] = b[0]; a[0] = 1 + alpha; a[1] = n2c; a[2] = 1 - alpha; break; case biquad::type::highpass: b[0] = (1 + cw0) / 2; b[1] = -(1 + cw0); b[2] = b[0]; a[0] = 1 + alpha; a[1] = n2c; a[2] = 1 - alpha; break; case biquad::type::bandpass: b[0] = alpha; b[1] = 0; b[2] = -alpha; a[0] = 1 + alpha; a[1] = n2c; a[2] = 1 - alpha; break; case biquad::type::notch: b[0] = 1; b[1] = n2c; b[2] = 1; a[0] = 1 + alpha; a[1] = n2c; a[2] = 1 - alpha; break; case biquad::type::allpass: b[0] = 1 - alpha; b[1] = n2c; b[2] = 1 + alpha; a[0] = b[2]; a[1] = n2c; a[2] = b[0]; break; case biquad::type::peaking_eq: b[0] = 1 + alpha * A; b[1] = n2c; b[2] = 1 - alpha * A; a[0] = 1 + alpha / A; a[1] = n2c; a[2] = 1 - alpha / A; break; case biquad::type::low_shelf_eq: b[0] = A * (Ap1 - Am1c + sqAa2); b[1] = 2 * A * (Am1 - Ap1c); b[2] = A * (Ap1 - Am1c - sqAa2); a[0] = (Ap1 + Am1c + sqAa2); a[1] = -2 * (Am1 + Ap1c); a[2] = Ap1 + Am1c - sqAa2; break; case biquad::type::high_shelf_eq: b[0] = A * (Ap1 + Am1c + sqAa2); b[1] = -2 * A * (Am1 + Ap1c); b[2] = A * (Ap1 + Am1c - sqAa2); a[0] = (Ap1 - Am1c + sqAa2); a[1] = 2 * (Am1 - Ap1c); a[2] = Ap1 - Am1c - sqAa2; break; } }
33.302326
167
0.519553
andrzejc
794796ffd91e2fbc8d202c6deab7eefc46fd98dc
5,076
cc
C++
towr/src/spline_holder.cc
IoannisDadiotis/towr
cbbe6d30d637b4271558e31bf522536451a9110c
[ "BSD-3-Clause" ]
null
null
null
towr/src/spline_holder.cc
IoannisDadiotis/towr
cbbe6d30d637b4271558e31bf522536451a9110c
[ "BSD-3-Clause" ]
null
null
null
towr/src/spline_holder.cc
IoannisDadiotis/towr
cbbe6d30d637b4271558e31bf522536451a9110c
[ "BSD-3-Clause" ]
null
null
null
/****************************************************************************** Copyright (c) 2018, Alexander W. Winkler. 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 the copyright holder 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. ******************************************************************************/ #include <towr/variables/spline_holder.h> #include <towr/variables/phase_spline.h> namespace towr{ SplineHolder::SplineHolder (NodesVariables::Ptr base_lin_nodes, NodesVariables::Ptr base_ang_nodes, const std::vector<double>& base_poly_durations, std::vector<NodesVariablesPhaseBased::Ptr> ee_motion_nodes, std::vector<NodesVariablesPhaseBased::Ptr> ee_force_nodes, std::vector<PhaseDurations::Ptr> phase_durations, bool durations_change) { base_linear_ = std::make_shared<NodeSpline>(base_lin_nodes.get(), base_poly_durations); base_angular_ = std::make_shared<NodeSpline>(base_ang_nodes.get(), base_poly_durations); phase_durations_ = phase_durations; for (uint ee=0; ee<ee_motion_nodes.size(); ++ee) { if (durations_change) { // spline that changes the polynomial durations (affects Jacobian) ee_motion_.push_back(std::make_shared<PhaseSpline>(ee_motion_nodes.at(ee), phase_durations.at(ee).get())); ee_force_.push_back(std::make_shared<PhaseSpline>(ee_force_nodes.at(ee), phase_durations.at(ee).get())); } else { // spline without changing the polynomial durations auto ee_motion_poly_durations = ee_motion_nodes.at(ee)->ConvertPhaseToPolyDurations(phase_durations.at(ee)->GetPhaseDurations()); auto ee_force_poly_durations = ee_force_nodes.at(ee)->ConvertPhaseToPolyDurations(phase_durations.at(ee)->GetPhaseDurations()); ee_motion_.push_back(std::make_shared<NodeSpline>(ee_motion_nodes.at(ee).get(), ee_motion_poly_durations)); ee_force_.push_back (std::make_shared<NodeSpline>(ee_force_nodes.at(ee).get(), ee_force_poly_durations)); } } } // Constructor for only linear base pose (not used until now) /*SplineHolder::SplineHolder (NodesVariables::Ptr base_lin_nodes, const std::vector<double>& base_poly_durations, std::vector<NodesVariablesPhaseBased::Ptr> ee_motion_nodes, std::vector<NodesVariablesPhaseBased::Ptr> ee_force_nodes, std::vector<PhaseDurations::Ptr> phase_durations, bool durations_change) { base_linear_ = std::make_shared<NodeSpline>(base_lin_nodes.get(), base_poly_durations); phase_durations_ = phase_durations; for (uint ee=0; ee<ee_motion_nodes.size(); ++ee) { if (durations_change) { // spline that changes the polynomial durations (affects Jacobian) ee_motion_.push_back(std::make_shared<PhaseSpline>(ee_motion_nodes.at(ee), phase_durations.at(ee).get())); ee_force_.push_back(std::make_shared<PhaseSpline>(ee_force_nodes.at(ee), phase_durations.at(ee).get())); } else { // spline without changing the polynomial durations auto ee_motion_poly_durations = ee_motion_nodes.at(ee)->ConvertPhaseToPolyDurations(phase_durations.at(ee)->GetPhaseDurations()); auto ee_force_poly_durations = ee_force_nodes.at(ee)->ConvertPhaseToPolyDurations(phase_durations.at(ee)->GetPhaseDurations()); ee_motion_.push_back(std::make_shared<NodeSpline>(ee_motion_nodes.at(ee).get(), ee_motion_poly_durations)); ee_force_.push_back (std::make_shared<NodeSpline>(ee_force_nodes.at(ee).get(), ee_force_poly_durations)); } } } */ } /* namespace towr */
55.173913
135
0.709811
IoannisDadiotis
794e9f968002a5779ef3c130f756770cfa6ba52a
1,918
cpp
C++
startalk_ui/messagebubble/MessageAddFriends.cpp
xuepingiw/open_source_startalk
44d962b04039f5660ec47a10313876a0754d3e72
[ "MIT" ]
34
2019-03-18T08:09:24.000Z
2022-03-15T02:03:25.000Z
startalk_ui/messagebubble/MessageAddFriends.cpp
venliong/open_source_startalk
51fda091a932a8adea626c312692836555753a9a
[ "MIT" ]
5
2019-05-29T09:32:05.000Z
2019-08-29T03:01:33.000Z
startalk_ui/messagebubble/MessageAddFriends.cpp
venliong/open_source_startalk
51fda091a932a8adea626c312692836555753a9a
[ "MIT" ]
32
2019-03-15T09:43:22.000Z
2021-08-10T08:26:02.000Z
#include "MessageAddFriends.h" #include "XmppMessage.h" MessageAddingFriend::MessageAddingFriend() { } MessageAddingFriend::~MessageAddingFriend() { } int MessageAddingFriend::getMessageMediaType() { return 0; } bool MessageAddingFriend::getTranslatedMessage(QSharedPointer<Biz::XmppMessage> spMessage, QString& htmlString) { #if 0 代码备份,暂时无实际功能,2016年7月13日10:23:37 if (msg.isNull()) { return false; } QString body = msg->Body(); QString strRefusebody = QStringLiteral("你已拒绝[%1]加为好友").arg(msg->SenderUserID()); QString strAgreebody = QStringLiteral("你已同意[%1]加为好友").arg(msg->SenderUserID()); QString strMsgid = QUuid::createUuid().toString().replace("{", "").replace("}", "").replace("-", ""); int status = msg->Flag(); QString timeStemp /*= GetCurrentTm(msg->UtcTime())*/; QString displaystyle = "inline_block"; int nMsgDirection = msg->MsgDirection(); if (nMsgDirection == Biz::ADDDIRECTION) // 自己主动添加别人为好友 { displaystyle = "none"; //不要下面的展示 } else if (nMsgDirection == Biz::BYADDDIRECTION) //别人邀请我,我要标题 { //displaystyle = "inline_block"; if (status == Biz::WAITSTATUS) { displaystyle = "inline_block"; } else if (status == Biz::REFUSESTATUS) { displaystyle = "none"; } else if (status == Biz::AGREESTATUS) { displaystyle = "none"; } } QString userid = msg->ConversationID(); QString clickagreefun = QString("onAgree(\"%1\",\"%2\")").arg(strMsgid).arg(userid); QString clickrefusefun = QString("onRefuse(\"%1\",\"%2\")").arg(strMsgid).arg(userid); htmlString = QString(AddFRIENDSINFO_BODY_HTML_TEMPLATE).arg(timeStemp).arg(strMsgid).arg(QStringLiteral("微软雅黑")). arg(body, displaystyle, QStringLiteral("同意"), QStringLiteral("拒绝"), clickagreefun, clickrefusefun, strAgreebody, strRefusebody); #endif return false; } bool MessageAddingFriend::getShotTranslatedMessage(QSharedPointer<Biz::XmppMessage> spMessage, QString& body) { return false; }
24.909091
130
0.707508
xuepingiw
7953225d9e5e5e2822bc499789723fb186804cc8
1,832
hpp
C++
src/utils.hpp
LiamPattinson/luaconfig
8f09b3176fcc08f5d212ca49f72a4da429716479
[ "MIT" ]
null
null
null
src/utils.hpp
LiamPattinson/luaconfig
8f09b3176fcc08f5d212ca49f72a4da429716479
[ "MIT" ]
null
null
null
src/utils.hpp
LiamPattinson/luaconfig
8f09b3176fcc08f5d212ca49f72a4da429716479
[ "MIT" ]
null
null
null
// utils.hpp // // Collection of reusable code bits for luaconfig #ifndef __LUACONFIG_UTILS_HPP #define __LUACONFIG_UTILS_HPP #include <tuple> #include <functional> namespace luaconfig { // Is type T a std::tuple? template<class T> struct is_tuple { static const bool value = false; }; template<class... Args> struct is_tuple<std::tuple<Args...>> { static const bool value = true; }; // Is type T a std::function? // Additionally provide function signature. template<class T> struct is_function { static const bool value = false; }; template<class Arg> struct is_function<std::function<Arg>> { static const bool value = true; using sig = Arg; }; // is_iterable trait class // Borrows from Stack Overflow: // * jarod42's answer to question 13830158 // * jrok's answer to question 87372 namespace is_iterable_ns { using std::begin; using std::end; template<class T> class is_iterable{ template<typename U=T> static constexpr auto impl(int) -> decltype( // test begin() and end() exist, and test != comparison begin(std::declval<U&>()) != end(std::declval<U&>()), // Deal with overloaded comma operator void(), // test prefix ++ exists ++std::declval<decltype(begin(std::declval<U&>()))&>(), // test dereference operator exists *begin(std::declval<U&>()), // Finally, return type. std::true_type{}); template<typename U=T> static constexpr std::false_type impl(...); using impltype = decltype(impl(0)); public: static constexpr bool value = impltype::value; }; } template<class T> struct is_iterable{ static constexpr bool value = is_iterable_ns::is_iterable<T>::value; }; } // end namespace #endif
22.617284
72
0.632096
LiamPattinson
795566e958e921525140d4e598fad45cb36429cb
2,117
cpp
C++
src/util/NetworkStatus.cpp
jdapena/webosose-wam
91a98e8ed267fa8b28f6223b9b540141eb675bb5
[ "Apache-2.0" ]
null
null
null
src/util/NetworkStatus.cpp
jdapena/webosose-wam
91a98e8ed267fa8b28f6223b9b540141eb675bb5
[ "Apache-2.0" ]
7
2018-10-18T14:08:39.000Z
2022-03-31T08:34:07.000Z
src/util/NetworkStatus.cpp
jdapena/webosose-wam
91a98e8ed267fa8b28f6223b9b540141eb675bb5
[ "Apache-2.0" ]
8
2018-10-17T11:33:09.000Z
2021-11-04T18:15:24.000Z
// Copyright (c) 2008-2018 LG Electronics, Inc. // // 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. // // SPDX-License-Identifier: Apache-2.0 #include <time.h> #include "NetworkStatus.h" NetworkStatus::NetworkStatus() : m_isInternetConnectionAvailable(false) , m_returnValue(false) { } void NetworkStatus::fromJsonObject(const QJsonObject& object) { m_returnValue = object["returnValue"].toBool(); m_isInternetConnectionAvailable = object["isInternetConnectionAvailable"].toBool(); if (m_returnValue) { if (!object["wired"].isUndefined()) { m_type = "wired"; m_information.fromJsonObject(object["wired"].toObject()); } else if (!object["wifi"].isUndefined()) { m_type = "wifi"; m_information.fromJsonObject(object["wifi"].toObject()); } else { m_type = "wifiDirect"; m_information.fromJsonObject(object["wifiDirect"].toObject()); } } time_t raw_time; time(&raw_time); m_savedDate = QString(ctime(&raw_time)); m_savedDate = m_savedDate.trimmed(); } void NetworkStatus::Information::fromJsonObject(const QJsonObject& info) { m_netmask = info["netmask"].toString(); m_dns1 = info["dns1"].toString(); if (!info["dns2"].isUndefined()) m_dns2 = info["dns2"].toString(); m_ipAddress = info["ipAddress"].toString(); m_method = info["method"].toString(); m_state = info["state"].toString(); m_gateway = info["gateway"].toString(); m_interfaceName = info["interfaceName"].toString(); m_onInternet = info["onInternet"].toString(); }
34.145161
87
0.674067
jdapena
7957f3d59aba96a1a8876a15bad3007dc32c9382
627
cpp
C++
UVa/01. Problem Set Volumes (100...1999)/Volume 04 - 06 (400 - 699)/uva573.cpp
bilibiliShen/CodeBank
49a69b2b2c3603bf105140a9d924946ed3193457
[ "MIT" ]
1
2017-08-19T16:02:15.000Z
2017-08-19T16:02:15.000Z
UVa/01. Problem Set Volumes (100...1999)/Volume 04 - 06 (400 - 699)/uva573.cpp
bilibiliShen/CodeBank
49a69b2b2c3603bf105140a9d924946ed3193457
[ "MIT" ]
null
null
null
UVa/01. Problem Set Volumes (100...1999)/Volume 04 - 06 (400 - 699)/uva573.cpp
bilibiliShen/CodeBank
49a69b2b2c3603bf105140a9d924946ed3193457
[ "MIT" ]
1
2018-01-05T23:37:23.000Z
2018-01-05T23:37:23.000Z
/**** *@PoloShen *Title:UVa 573 */ #include <iostream> #include <cstring> #include <cstdio> #include <cmath> using namespace std; double H, U, D, F; void solve(){ double height = 0, down = U * F / 100.0; int cnt = 1; while (1){ if (U > 0) height += U; if (height > H) {printf("success on day %d\n",cnt);break;} height -= D; U -= down; if (height < 0) {printf("failure on day %d\n",cnt);break;} cnt++; } } int main(){ while (scanf("%lf%lf%lf%lf",&H,&U,&D,&F) != EOF){ if (H==0 && U==0 && D==0 && F==0) break; solve(); } return 0; }
20.225806
66
0.484848
bilibiliShen
7958d866dc84702a234799126c4c173ad2931627
49
cpp
C++
Source/EngineStd/EventManager/BaseEvent.cpp
vivienneanthony/MyForkEditor
273e15ca3610b3d3b68fdf2efbac2ba1b3659e7f
[ "Apache-2.0" ]
2
2015-12-30T00:32:09.000Z
2016-02-27T14:50:06.000Z
Source/EngineStd/EventManager/BaseEvent.cpp
vivienneanthony/MyForkEditor
273e15ca3610b3d3b68fdf2efbac2ba1b3659e7f
[ "Apache-2.0" ]
null
null
null
Source/EngineStd/EventManager/BaseEvent.cpp
vivienneanthony/MyForkEditor
273e15ca3610b3d3b68fdf2efbac2ba1b3659e7f
[ "Apache-2.0" ]
null
null
null
#include "EngineStd.h" #include "BaseEvent.h"
8.166667
22
0.693878
vivienneanthony
7961d2155bc822e8edcde64ac63a6b6b5c91e1c7
971
cpp
C++
object_tracking/main.cpp
mmmfarrell/robotic_vision
3657b54578a7e2f7fbc899fbca39d991fe211c1e
[ "MIT" ]
null
null
null
object_tracking/main.cpp
mmmfarrell/robotic_vision
3657b54578a7e2f7fbc899fbca39d991fe211c1e
[ "MIT" ]
null
null
null
object_tracking/main.cpp
mmmfarrell/robotic_vision
3657b54578a7e2f7fbc899fbca39d991fe211c1e
[ "MIT" ]
null
null
null
/* * File: main.cpp * Author: sagar * * Created on 10 September, 2012, 7:48 PM */ #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <iostream> using namespace cv; using namespace std; int main() { VideoCapture vcap(0); //0 is the id of video device.0 if you have only one camera. if (!vcap.isOpened()) { //check if video device has been initialised cout << "cannot open camera"; } int frame_width = vcap.get(CV_CAP_PROP_FRAME_WIDTH); int frame_height = vcap.get(CV_CAP_PROP_FRAME_HEIGHT); VideoWriter video("webcam.avi", CV_FOURCC('M','J','P','G'), 10, Size(frame_width, frame_height), true); //unconditional loop while (true) { Mat cameraFrame; vcap.read(cameraFrame); video.write(cameraFrame); imshow("cam", cameraFrame); if (waitKey(2) >= 0) break; } vcap.release(); video.release(); return 0; }
24.275
107
0.624099
mmmfarrell
79655bde8a58ee06340ddf8635624d7121bc697e
88,325
cpp
C++
src/AdvCmpProc.cpp
FarPlugins/AdvCmpEx
f8f308b51dfd42b7f45766455370a066d10bfaee
[ "BSD-3-Clause" ]
6
2021-01-20T08:45:30.000Z
2022-01-23T09:39:58.000Z
src/AdvCmpProc.cpp
FarPlugins/AdvCmpEx
f8f308b51dfd42b7f45766455370a066d10bfaee
[ "BSD-3-Clause" ]
5
2021-01-04T19:02:34.000Z
2021-02-01T16:32:05.000Z
src/AdvCmpProc.cpp
FarPlugins/AdvCmpEx
f8f308b51dfd42b7f45766455370a066d10bfaee
[ "BSD-3-Clause" ]
null
null
null
/**************************************************************************** * AdvCmpProc.cpp * * Plugin module for Far Manager 3.0 * * Copyright (c) 2006 Alexey Samlyukov ****************************************************************************/ /* 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. The name of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #pragma hdrstop #include "AdvCmpProc.hpp" /**************************************************************************** * * Разные оччччень полезные функции :-) * ****************************************************************************/ /**************************************************************************** * Поиск и вырезание Substr в именах файлов. ****************************************************************************/ wchar_t* CutSubstr(string& strSrc, wchar_t* Substr) { if (!Substr) return strSrc.get(); int len = wcslen(Substr); if (!len) return strSrc.get(); int lenSrc = strSrc.length(); const wchar_t* src = strSrc.get(); string strBuf; // делаем замену { HANDLE re; int start_offset = 0; if (!Info.RegExpControl(0, RECTL_CREATE, 0, &re)) return false; string Search = L"/"; if (len > 0 && Substr[0] == L'/') Search += Substr + 1; else Search += Substr; if (Search.length() > 0 && Search[(size_t)(Search.length() - 1)] != L'/') Search += L"/i"; if (Info.RegExpControl(re, RECTL_COMPILE, 0, Search.get())) { int brackets = Info.RegExpControl(re, RECTL_BRACKETSCOUNT, 0, 0); if (!brackets) { Info.RegExpControl(re, RECTL_FREE, 0, 0); return false; } RegExpMatch* match = (RegExpMatch*) malloc(brackets * sizeof(RegExpMatch)); for (;;) { RegExpSearch search = {src, start_offset, lenSrc, match, brackets, 0}; if (Info.RegExpControl(re, RECTL_SEARCHEX, 0, &search)) { // копируем ДО паттерна for (int i = start_offset; i < match[0].start; i++) strBuf += src[i]; start_offset = match[0].end; if (match[0].start == match[0].end || start_offset >= lenSrc) break; } else break; } free(match); Info.RegExpControl(re, RECTL_FREE, 0, 0); } // копируем всё то что не вошло в паттерн for (int i = start_offset; i < lenSrc; i++) strBuf += src[i]; if (!FSF.Trim(strBuf.get())) return strSrc.get(); strSrc = strBuf.get(); } return strSrc.get(); } /**************************************************************************** * Центрирование строки и заполнение символом заполнителем ****************************************************************************/ void strcentr(wchar_t* Dest, const wchar_t* Src, int len, wchar_t sym) { int iLen, iLen2; iLen = wcslen(wcscpy(Dest, Src)); if (iLen < len) { iLen2 = (len - iLen) / 2; wmemmove(Dest + iLen2, Dest, iLen); wmemset(Dest, sym, iLen2); wmemset(Dest + iLen2 + iLen, sym, len - iLen2 - iLen); Dest[len] = L'\0'; } } /**************************************************************************** * Преобразует int в wchar_t поразрядно: из 1234567890 в "1 234 567 890" ****************************************************************************/ wchar_t* itoaa(__int64 num, wchar_t* buf) { wchar_t tmp[100]; FSF.itoa64(num, tmp, 10); int digits_count = 0; wchar_t* t = tmp; while (*t++) digits_count++; wchar_t* p = buf + digits_count + (digits_count - 1) / 3; digits_count = 0; *p-- = L'\0'; t--; //заметь, требуется дополнительное смещение! while (p != buf) { *p-- = *--t; if ((++digits_count) % 3 == 0) *p-- = L' '; } *p = *--t; return buf; } /**************************************************************************** * Рисует строку-прогресс ****************************************************************************/ void ProgressLine(wchar_t* Dest, unsigned __int64 nCurrent, unsigned __int64 nTotal) { int n = 0, len = WinInfo.TruncLen - 4; if (nTotal > 0) n = nCurrent * (unsigned __int64) len / nTotal; if (n > len) n = len; wchar_t* Buf = (wchar_t*) malloc(WinInfo.TruncLen * sizeof(wchar_t)); if (Buf) { wmemset(Buf, 0x00002588, n); wmemset(&Buf[n], 0x00002591, len - n); Buf[len] = L'\0'; FSF.sprintf(Dest, L"%s%3d%%", Buf, nTotal ? (nCurrent * 100 / nTotal) : 0); free(Buf); } else *Dest = 0; } /**************************************************************************** * Возвращает смещение начала файла, т.е. без префиксов "\\?\" ****************************************************************************/ wchar_t* GetPosToName(const wchar_t* FileName) { if (FileName && FileName[0] == L'\\' && FileName[1] == L'\\' && FileName[2] == L'?') { if (FileName[5] == L':') return (wchar_t*) &FileName[4]; else if (FileName[5] == L'N') return (wchar_t*) &FileName[7]; } return (wchar_t*) FileName; } /**************************************************************************** * Возвращает полное имя файла, и опционально без префиксов "\\?\" ****************************************************************************/ void GetFullFileName(string& strFullFileName, const wchar_t* Dir, const wchar_t* FileName, bool bNative) { if (Dir) strFullFileName = bNative ? Dir : GetPosToName(Dir); if ((strFullFileName.length() > 0 && strFullFileName[(size_t)(strFullFileName.length() - 1)] != L'\\') || ((LPanel.bTMP || RPanel.bTMP) ? false : !strFullFileName.length())) strFullFileName += L"\\"; strFullFileName += FileName; } /**************************************************************************** * Возвращает строку с временем файла ****************************************************************************/ wchar_t* GetStrFileTime(FILETIME* LastWriteTime, wchar_t* Time, bool FullYear) { SYSTEMTIME ModificTime; FILETIME LocalTime; FileTimeToLocalFileTime(LastWriteTime, &LocalTime); FileTimeToSystemTime(&LocalTime, &ModificTime); // для Time достаточно [20] !!! if (Time) FSF.sprintf(Time, FullYear ? L"%02d.%02d.%04d %02d:%02d:%02d" : L"%02d.%02d.%02d %02d:%02d:%02d", ModificTime.wDay, ModificTime.wMonth, FullYear ? ModificTime.wYear : ModificTime.wYear % 100, ModificTime.wHour, ModificTime.wMinute, ModificTime.wSecond); return Time; } /**************************************************************************** * Проверка на Esc. Возвращает true, если пользователь нажал Esc ****************************************************************************/ bool CheckForEsc() { if (hConInp == INVALID_HANDLE_VALUE) return false; static DWORD dwTicks; DWORD dwNewTicks = GetTickCount(); if (dwNewTicks - dwTicks < 500) return false; dwTicks = dwNewTicks; INPUT_RECORD rec; DWORD ReadCount; while (PeekConsoleInput(hConInp, &rec, 1, &ReadCount) && ReadCount) { ReadConsoleInput(hConInp, &rec, 1, &ReadCount); if (rec.EventType == KEY_EVENT && rec.Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE && rec.Event.KeyEvent.bKeyDown) { // Опциональное подтверждение прерывания по Esc if (GetFarSetting(FSSF_CONFIRMATIONS, L"Esc")) { if (YesNoMsg(MEscTitle, MEscBody)) return (bBrokenByEsc = true); } else return (bBrokenByEsc = true); } } return false; } /**************************************************************************** * Усекает начало длинных имен файлов (или дополняет короткие имена) * для правильного показа в сообщении сравнения ****************************************************************************/ void TruncCopy(wchar_t* Dest, const wchar_t* Src, int TruncLen, const wchar_t* FormatMsg) { string strSrc(Src); int iLen = 0; if (FormatMsg) // чего-нибудь допишем... { FSF.sprintf(Dest, FormatMsg, FSF.TruncPathStr(strSrc.get(), TruncLen - wcslen(FormatMsg) + 2)); iLen = wcslen(Dest); } else // иначе, тупо скопируем имя iLen = wcslen(wcscpy(Dest, FSF.TruncPathStr(strSrc.get(), TruncLen))); if (iLen < TruncLen) // для красивости дополним пробелами { wmemset(&Dest[iLen], L' ', TruncLen - iLen); Dest[TruncLen] = L'\0'; } } int GetArgv(const wchar_t* cmd, wchar_t*** argv) { if (!cmd) return 0; int l = wcslen(cmd); // settings for arguments vectors int* pos = (int*) malloc(l * sizeof(*pos) * sizeof(wchar_t)); int* len = (int*) malloc(l * sizeof(*pos) * sizeof(wchar_t)); int i, num = 0; for (i = 0; i < l;) { while (cmd[i] == L';' && i < l) i++; if (i >= l) break; // get argument pos[num] = i; while (cmd[i] != L';' && i < l) i++; len[num] = i - pos[num]; num++; } if (num) { *argv = (wchar_t**) malloc(num * sizeof(**argv)); for (i = 0; i < num; i++) { (*argv)[i] = (wchar_t*) malloc((len[i] + 2) * sizeof(***argv)); lstrcpyn((*argv)[i], cmd + pos[i], len[i] + 1); } } free(pos); free(len); return num; } void AdvCmpProc::Init() { hScreen = Info.SaveScreen(0, 0, -1, -1); bStartMsg = true; cFList.F = NULL; cFList.iCount = 0; cFList.Items = 0; cFList.Select = 0; cFList.Identical = 0; cFList.Different = 0; cFList.LNew = 0; cFList.RNew = 0; Opt.ShowListSelect = 1; Opt.ShowListIdentical = 1; Opt.ShowListDifferent = 1; Opt.ShowListLNew = 1; Opt.ShowListRNew = 1; Opt.SyncFlagClearUser = 0; Opt.SyncFlagCopy = Opt.SyncFlagIfNew = 0; Opt.SyncFlagLCopy = 1; Opt.SyncFlagRCopy = -1; dFList.F = NULL; dFList.iCount = 0; dFList.GroupItems = 0; dFList.Del = 0; Opt.BufSize = 65536 << 4; Opt.Buf[0] = NULL; Opt.Buf[1] = NULL; // создадим буферы сравнения if (Opt.CmpContents) { Opt.Buf[0] = (char*) malloc(Opt.BufSize * sizeof(char)); Opt.Buf[1] = (char*) malloc(Opt.BufSize * sizeof(char)); } LPanel.hFilter = RPanel.hFilter = INVALID_HANDLE_VALUE; Info.FileFilterControl(LPanel.hPanel, FFCTL_CREATEFILEFILTER, FFT_PANEL, &LPanel.hFilter); Info.FileFilterControl(RPanel.hPanel, FFCTL_CREATEFILEFILTER, FFT_PANEL, &RPanel.hFilter); Info.FileFilterControl(LPanel.hFilter, FFCTL_STARTINGTOFILTER, 0, 0); Info.FileFilterControl(RPanel.hFilter, FFCTL_STARTINGTOFILTER, 0, 0); if (Opt.Filter) Info.FileFilterControl(Opt.hCustomFilter, FFCTL_STARTINGTOFILTER, 0, 0); // На время сравнения изменим заголовок консоли ФАРа... TitleSaved = GetFarTitle(strFarTitle); SetConsoleTitle(GetMsg(MComparingFiles)); } void AdvCmpProc::Close() { if (Opt.Buf[0]) { free(Opt.Buf[0]); Opt.Buf[0] = NULL; } if (Opt.Buf[1]) { free(Opt.Buf[1]); Opt.Buf[1] = NULL; } Info.FileFilterControl(LPanel.hFilter, FFCTL_FREEFILEFILTER, 0, 0); Info.FileFilterControl(RPanel.hFilter, FFCTL_FREEFILEFILTER, 0, 0); if (hScreen) Info.RestoreScreen(hScreen); // Восстановим заголовок консоли ФАРа... if (TitleSaved) SetConsoleTitle(strFarTitle); for (int i = 0; i < cFList.iCount; i++) { if (cFList.F[i].L.FileName) free(cFList.F[i].L.FileName); if (cFList.F[i].R.FileName) free(cFList.F[i].R.FileName); if (cFList.F[i].L.Dir) free(cFList.F[i].L.Dir); if (cFList.F[i].R.Dir) free(cFList.F[i].R.Dir); } if (cFList.F) free(cFList.F); cFList.F = NULL; cFList.iCount = 0; for (int i = 0; i < dFList.iCount; i++) { if (dFList.F[i].fi.FileName) free(dFList.F[i].fi.FileName); if (dFList.F[i].fi.Dir) free(dFList.F[i].fi.Dir); if (dFList.F[i].PicPix) free(dFList.F[i].PicPix); if (dFList.F[i].MusicArtist) free(dFList.F[i].MusicArtist); if (dFList.F[i].MusicTitle) free(dFList.F[i].MusicTitle); } if (dFList.F) free(dFList.F); dFList.F = NULL; dFList.iCount = 0; } /**************************************************************************** * * Разные оччччень полезные функции :-) * ****************************************************************************/ /**************************************************************************** * Получить заголовок консоли ФАРа ****************************************************************************/ bool AdvCmpProc::GetFarTitle(string& strTitle) { DWORD dwSize = 0; DWORD dwBufferSize = MAX_PATH; wchar_t* lpwszTitle = NULL; do { dwBufferSize <<= 1; lpwszTitle = (wchar_t*) realloc(lpwszTitle, dwBufferSize * sizeof(wchar_t)); dwSize = GetConsoleTitle(lpwszTitle, dwBufferSize); } while (!dwSize && GetLastError() == ERROR_SUCCESS); if (dwSize) strTitle = lpwszTitle; free(lpwszTitle); return dwSize; } void AdvCmpProc::WFD2PPI(WIN32_FIND_DATA& wfd, PluginPanelItem& ppi) { ppi.FileAttributes = wfd.dwFileAttributes; ppi.LastAccessTime = wfd.ftLastAccessTime; ppi.LastWriteTime = wfd.ftLastWriteTime; ppi.FileSize = ((unsigned __int64) wfd.nFileSizeHigh << 32) | wfd.nFileSizeLow; ppi.FileName = (wchar_t*) malloc((wcslen(wfd.cFileName) + 1) * sizeof(wchar_t)); if (ppi.FileName) wcscpy((wchar_t*) ppi.FileName, wfd.cFileName); } /**************************************************************************** * Функция проверяет, входит ли файл из архива в заданную глубину вложенности ****************************************************************************/ bool AdvCmpProc::CheckScanDepth(const wchar_t* FileName, int ScanDepth) { int i = 0; while (*FileName++) if (*FileName == L'\\') i++; return i <= ScanDepth; } /**************************************************************************** * Перемещение указателя в файле для нужд Opt.Contents ****************************************************************************/ bool AdvCmpProc::mySetFilePointer(HANDLE hf, unsigned __int64 distance, DWORD MoveMethod) { bool bSet = true; LARGE_INTEGER li; li.QuadPart = distance; li.LowPart = SetFilePointer(hf, li.LowPart, &li.HighPart, MoveMethod); if (li.LowPart == 0xFFFFFFFF && GetLastError() != NO_ERROR) bSet = false; return bSet; } /**************************************************************************** * CRC32 со стандартным полиномом 0xEDB88320. ****************************************************************************/ DWORD AdvCmpProc::ProcessCRC(void* pData, register int iLen, DWORD FileCRC) { register unsigned char* pdata = (unsigned char*) pData; register DWORD crc = FileCRC; static unsigned TableCRC[256]; if (!TableCRC[1]) { // Инициализация CRC32 таблицы unsigned i, j, r; for (i = 0; i < 256; i++) { for (r = i, j = 8; j; j--) r = r & 1 ? (r >> 1) ^ 0xEDB88320 : r >> 1; TableCRC[i] = r; } } while (iLen--) { crc = TableCRC[(unsigned char) crc ^ *pdata++] ^ crc >> 8; crc ^= 0xD202EF8D; } return crc; } /**************************************************************************** * * COMPAREFILES FUNCTIONS * ****************************************************************************/ /**************************************************************************** * Замена сервисной функции Info.GetDirList(). В отличие от оной возвращает * список файлов только в каталоге Dir, без подкаталогов. * Умеет собирать информацию об элементах на заданную глубину. ****************************************************************************/ int AdvCmpProc::GetDirList(const wchar_t* Dir, int ScanDepth, bool OnlyInfo, struct DirList* pList) { bool ret = true; if (OnlyInfo && bBrokenByEsc) return ret; string strPathMask(Dir); if (Opt.ScanSymlink) { DWORD Attrib = GetFileAttributesW(Dir); if (Attrib != INVALID_FILE_ATTRIBUTES && (Attrib & FILE_ATTRIBUTE_REPARSE_POINT)) { // получим реальный путь size_t size = FSF.ConvertPath(CPM_REAL, Dir, 0, 0); wchar_t* buf = strPathMask.get(size); FSF.ConvertPath(CPM_REAL, Dir, buf, size); strPathMask.updsize(); // проверка на рекурсию - узнаем, может мы уже отсюда пришли wchar_t RealPrevDir[32768]; wcscpy(RealPrevDir, Dir); (wchar_t) * (FSF.PointToName(RealPrevDir)) = 0; FSF.ConvertPath(CPM_REAL, RealPrevDir, RealPrevDir, 32768); if (!FSF.LStricmp(strPathMask.get(), RealPrevDir)) // да, уже были тут! ret = false; } } if (!OnlyInfo) // заполняем DirList { pList->Dir = (wchar_t*) malloc((wcslen(Dir) + 1) * sizeof(wchar_t)); if (pList->Dir) wcscpy(pList->Dir, Dir); pList->PPI = 0; pList->ItemsNumber = 0; } if (Opt.ScanSymlink && !ret) // выходим return true; strPathMask += L"\\*"; WIN32_FIND_DATA wfdFindData; HANDLE hFind; if ((hFind = FindFirstFileW(strPathMask.get(), &wfdFindData)) != INVALID_HANDLE_VALUE) { do { if (OnlyInfo && CheckForEsc()) { ret = true; break; } if (!Opt.ProcessHidden && (wfdFindData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)) continue; if ((wfdFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && ((wfdFindData.cFileName[0] == L'.' && !wfdFindData.cFileName[1]) || (wfdFindData.cFileName[0] == L'.' && wfdFindData.cFileName[1] == L'.' && !wfdFindData.cFileName[2]))) continue; if (OnlyInfo && (wfdFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { if (Opt.Subfolders == 2 && Opt.MaxScanDepth < ScanDepth + 1) // не глубже заданного уровня! break; if (!Opt.Subfolders) continue; string strPath; GetFullFileName(strPath, Dir, wfdFindData.cFileName); ret = GetDirList(strPath.get(), ScanDepth + 1, OnlyInfo, 0); } else { if (OnlyInfo) { CmpInfo.Count += 1; CmpInfo.CountSize += ((unsigned __int64) wfdFindData.nFileSizeHigh << 32) | wfdFindData.nFileSizeLow; ShowCmpMsg(L"*", L"*", L"*", L"*", false); } else { auto* pPPI = (PluginPanelItem*) realloc(pList->PPI, (pList->ItemsNumber + 1) * sizeof(PluginPanelItem)); if (!pPPI) { ErrorMsg(MNoMemTitle, MNoMemBody); // !!! возможно тут требуется обнулить элементы и их кол-во ret = false; break; } pList->PPI = pPPI; WFD2PPI(wfdFindData, pList->PPI[pList->ItemsNumber++]); } } } while (FindNextFile(hFind, &wfdFindData)); FindClose(hFind); } else CmpInfo.Errors++; return ret; } /**************************************************************************** * Замена сервисной функции Info.FreeDirList(). ****************************************************************************/ void AdvCmpProc::FreeDirList(struct DirList* pList) { if (pList->PPI) { for (int i = 0; i < pList->ItemsNumber; i++) free((void*) pList->PPI[i].FileName); free(pList->PPI); pList->PPI = 0; } free(pList->Dir); pList->Dir = 0; pList->ItemsNumber = 0; } /**************************************************************************** * Функция сравнения имён файлов в двух структурах PluginPanelItem * для нужд qsort() ****************************************************************************/ int WINAPI PICompare(const void* el1, const void* el2, void* el3) { const PluginPanelItem *ppi1 = *(const PluginPanelItem**) el1, *ppi2 = *(const PluginPanelItem**) el2; if (ppi1->FileAttributes & FILE_ATTRIBUTE_DIRECTORY) { if (!(ppi2->FileAttributes & FILE_ATTRIBUTE_DIRECTORY)) return 1; } else { if (ppi2->FileAttributes & FILE_ATTRIBUTE_DIRECTORY) return -1; } string strLFileName(LPanel.bTMP || RPanel.bTMP ? FSF.PointToName(ppi1->FileName) : ppi1->FileName); string strRFileName(LPanel.bTMP || RPanel.bTMP ? FSF.PointToName(ppi2->FileName) : ppi2->FileName); int i = FSF.LStricmp(Opt.SkipSubstr ? CutSubstr(strLFileName, Opt.Substr) : strLFileName.get(), Opt.SkipSubstr ? CutSubstr(strRFileName, Opt.Substr) : strRFileName.get()); // DebugMsg(strLFileName.get(),L"PICompare-strLFileName",i); // DebugMsg(strRFileName.get(),L"PICompare-strRFileName",i); return i; } /**************************************************************************** * Построение сортированного списка элементов для быстрого сравнения ****************************************************************************/ bool AdvCmpProc::BuildItemsIndex(bool bLeftPanel, const struct DirList* pList, struct ItemsIndex* pIndex, int ScanDepth) { pIndex->pPPI = 0; pIndex->iCount = pList->ItemsNumber; if (!pIndex->iCount) return true; if (!(pIndex->pPPI = (PluginPanelItem**) malloc(pIndex->iCount * sizeof(pIndex->pPPI[0])))) return false; int j = 0; for (int i = pIndex->iCount - 1; i >= 0 && j < pIndex->iCount; i--) { // каталоги отсеиваем сразу... если надо if ((Opt.Subfolders || !(pList->PPI[i].FileAttributes & FILE_ATTRIBUTE_DIRECTORY)) && // выбираем только отмеченные элементы... если надо :) (!(Opt.ProcessSelected && ScanDepth == 0) || (pList->PPI[i].Flags & PPIF_SELECTED))) { if ((pList->PPI[i].FileAttributes & FILE_ATTRIBUTE_DIRECTORY) && ((pList->PPI[i].FileName[0] == L'.' && !pList->PPI[i].FileName[1]) || (pList->PPI[i].FileName[0] == L'.' && pList->PPI[i].FileName[1] == L'.' && !pList->PPI[i].FileName[2]))) continue; if (!Opt.ProcessHidden && (pList->PPI[i].FileAttributes & FILE_ATTRIBUTE_HIDDEN)) continue; if ((bLeftPanel ? LPanel.hFilter : RPanel.hFilter) != INVALID_HANDLE_VALUE && !Info.FileFilterControl((bLeftPanel ? LPanel.hFilter : RPanel.hFilter), FFCTL_ISFILEINFILTER, 0, &pList->PPI[i])) continue; if (Opt.Filter && !Info.FileFilterControl(Opt.hCustomFilter, FFCTL_ISFILEINFILTER, 0, &pList->PPI[i])) continue; if (ScanDepth && !(LPanel.bTMP || RPanel.bTMP)) { bool bLPanelPlug = (LPanel.PInfo.Flags & PFLAGS_PLUGIN), bRPanelPlug = (RPanel.PInfo.Flags & PFLAGS_PLUGIN); // плагин + панель || панель + плагин (элемент с панели) if ((bLPanelPlug && !bRPanelPlug && !bLeftPanel) || (!bLPanelPlug && bRPanelPlug && bLeftPanel)) { string srtFileName(pList->PPI[i].FileName); string strSubstr; wchar_t* p = pList->Dir + 4; while (*p++) // для экранирования спецсимволов в регэкспах { if (*p == L'\\' || *p == L'[' || *p == L']' || *p == L'+' || *p == L'{' || *p == L'}') strSubstr += L"\\"; strSubstr += *p; } // вырежем pList->Dir из имени файла, т.к. путь до текущей папки (и сама папка) нам не нужен wcscpy((wchar_t*) pList->PPI[i].FileName, CutSubstr(srtFileName, strSubstr.get()) + 2); if (Opt.Subfolders == 2 && !CheckScanDepth(pList->PPI[i].FileName, Opt.MaxScanDepth)) continue; } // плагин + панель || панель + плагин (элемент с плагина) else if ((bLPanelPlug && !bRPanelPlug && bLeftPanel) || (!bLPanelPlug && bRPanelPlug && !bLeftPanel)) { if (Opt.Subfolders == 2 && !CheckScanDepth(pList->PPI[i].FileName, Opt.MaxScanDepth)) continue; } } pIndex->pPPI[j++] = &pList->PPI[i]; } } if (pIndex->iCount = j) { FSF.qsort(pIndex->pPPI, j, sizeof(pIndex->pPPI[0]), PICompare, NULL); } else { free(pIndex->pPPI); pIndex->pPPI = 0; } return true; } /**************************************************************************** * Освобождение памяти ****************************************************************************/ void AdvCmpProc::FreeItemsIndex(struct ItemsIndex* pIndex) { if (pIndex->pPPI) free(pIndex->pPPI); pIndex->pPPI = 0; pIndex->iCount = 0; } /**************************************************************************** * Результат предыдущего сравнения "по содержимому". ****************************************************************************/ int AdvCmpProc::GetCacheResult(DWORD FullFileName1, DWORD FullFileName2, DWORD64 WriteTime1, DWORD64 WriteTime2) { for (int i = 0; i < Cache.ItemsNumber; i++) { if (((FullFileName1 == Cache.RCI[i].dwFullFileName[0] && FullFileName2 == Cache.RCI[i].dwFullFileName[1]) && (WriteTime1 == Cache.RCI[i].dwWriteTime[0] && WriteTime2 == Cache.RCI[i].dwWriteTime[1])) || ((FullFileName1 == Cache.RCI[i].dwFullFileName[1] && FullFileName2 == Cache.RCI[i].dwFullFileName[0]) && (WriteTime1 == Cache.RCI[i].dwWriteTime[1] && WriteTime2 == Cache.RCI[i].dwWriteTime[0]))) { return (int) Cache.RCI[i].dwFlags; } } return 0; // 0 - результат не определен, т.к. элемент не найден } /**************************************************************************** * Сохранение результата сравнения "по содержимому". ****************************************************************************/ bool AdvCmpProc::SetCacheResult(DWORD FullFileName1, DWORD FullFileName2, DWORD64 WriteTime1, DWORD64 WriteTime2, DWORD dwFlag) { for (int i = 0; i < Cache.ItemsNumber; i++) { if (((FullFileName1 == Cache.RCI[i].dwFullFileName[0] && FullFileName2 == Cache.RCI[i].dwFullFileName[1]) && (WriteTime1 == Cache.RCI[i].dwWriteTime[0] && WriteTime2 == Cache.RCI[i].dwWriteTime[1])) || ((FullFileName1 == Cache.RCI[i].dwFullFileName[1] && FullFileName2 == Cache.RCI[i].dwFullFileName[0]) && (WriteTime1 == Cache.RCI[i].dwWriteTime[1] && WriteTime2 == Cache.RCI[i].dwWriteTime[0]))) { Cache.RCI[i].dwFlags = dwFlag; // был такой, обновим. сделаем "тупо" :-) return true; } } struct ResultCmpItem* pRCI = (struct ResultCmpItem*) realloc(Cache.RCI, (Cache.ItemsNumber + 1) * sizeof(ResultCmpItem)); if (pRCI) { Cache.RCI = pRCI; struct ResultCmpItem* CurItem = &Cache.RCI[Cache.ItemsNumber++]; CurItem->dwFullFileName[0] = FullFileName1; CurItem->dwFullFileName[1] = FullFileName2; CurItem->dwWriteTime[0] = WriteTime1; CurItem->dwWriteTime[1] = WriteTime2; CurItem->dwFlags = dwFlag; } else { ErrorMsg(MNoMemTitle, MNoMemBody); free(Cache.RCI); Cache.RCI = 0; Cache.ItemsNumber = 0; return false; } return true; } /**************************************************************************** * Показывает сообщение о сравнении двух файлов ****************************************************************************/ void AdvCmpProc::ShowCmpMsg(const wchar_t* Dir1, const wchar_t* Name1, const wchar_t* Dir2, const wchar_t* Name2, bool bRedraw) { // Для перерисовки не чаще 3-х раз в 1 сек. if (!bRedraw) { static DWORD dwTicks; DWORD dwNewTicks = GetTickCount(); if (dwNewTicks - dwTicks < 350) return; dwTicks = dwNewTicks; } wchar_t Buf[MAX_PATH], ItemsOut[MAX_PATH]; wchar_t TruncDir1[MAX_PATH], TruncDir2[MAX_PATH], TruncName1[MAX_PATH], TruncName2[MAX_PATH]; TruncCopy(TruncDir1, GetPosToName(Dir1), WinInfo.TruncLen, GetMsg(MComparing)); TruncCopy(TruncName1, Name1, WinInfo.TruncLen); TruncCopy(TruncDir2, GetPosToName(Dir2), WinInfo.TruncLen, GetMsg(MComparingWith)); TruncCopy(TruncName2, Name2, WinInfo.TruncLen); wchar_t LDiff[64], RDiff[64], Errors[64], DiffOut[MAX_PATH]; FSF.sprintf(Buf, GetMsg(MComparingDiffN), itoaa(CmpInfo.LDiff, LDiff), itoaa(CmpInfo.RDiff, RDiff), itoaa(CmpInfo.Errors, Errors)); strcentr(DiffOut, Buf, WinInfo.TruncLen, 0x00002500); wchar_t ProgressLineCur[MAX_PATH], ProgressLineTotal[MAX_PATH]; if (!Opt.CmpContents || bStartMsg) wcscpy(ProgressLineCur, GetMsg(MWait)); else ProgressLine(ProgressLineCur, CmpInfo.CurProcSize, CmpInfo.CurCountSize); if (Opt.TotalProgress) { FSF.sprintf(Buf, GetMsg(MComparingFiles2), CmpInfo.CountSize && !((LPanel.PInfo.Flags & PFLAGS_PLUGIN) || (RPanel.PInfo.Flags & PFLAGS_PLUGIN)) ? (CmpInfo.ProcSize * 100 / CmpInfo.CountSize) : 0); SetConsoleTitle(Buf); wchar_t Count[64], CountSize[64]; FSF.sprintf(Buf, GetMsg(MComparingN), itoaa(CmpInfo.CountSize, CountSize), itoaa(CmpInfo.Count, Count)); strcentr(ItemsOut, Buf, WinInfo.TruncLen, 0x00002500); if ((LPanel.PInfo.Flags & PFLAGS_PLUGIN) || (RPanel.PInfo.Flags & PFLAGS_PLUGIN)) wcscpy(ProgressLineTotal, GetMsg(MWait)); else ProgressLine(ProgressLineTotal, CmpInfo.ProcSize, CmpInfo.CountSize); } strcentr(Buf, L"", WinInfo.TruncLen, 0x00002500); // просто сепаратор const wchar_t* MsgItems1[] = {GetMsg(MCmpTitle), TruncDir1, TruncName1, DiffOut, ProgressLineCur, Buf, TruncDir2, TruncName2}; const wchar_t* MsgItems2[] = {GetMsg(MCmpTitle), TruncDir1, TruncName1, DiffOut, ProgressLineCur, Buf, ProgressLineTotal, ItemsOut, TruncDir2, TruncName2}; Info.Message(&MainGuid, &CmpMsgGuid, bStartMsg ? FMSG_LEFTALIGN : FMSG_LEFTALIGN | FMSG_KEEPBACKGROUND, 0, Opt.TotalProgress ? MsgItems2 : MsgItems1, Opt.TotalProgress ? sizeof(MsgItems2) / sizeof(MsgItems2[0]) : sizeof(MsgItems1) / sizeof(MsgItems1[0]), 0); bStartMsg = false; } /**************************************************************************** * Показывает сообщение о сравнении двух файлов ****************************************************************************/ void AdvCmpProc::ShowDupMsg(const wchar_t* Dir, const wchar_t* Name, bool bRedraw) { // Для перерисовки не чаще 3-х раз в 1 сек. if (!bRedraw) { static DWORD dwTicks; DWORD dwNewTicks = GetTickCount(); if (dwNewTicks - dwTicks < 350) return; dwTicks = dwNewTicks; } wchar_t Buf[MAX_PATH], ItemsOut[MAX_PATH]; wchar_t TruncDir[MAX_PATH], TruncName[MAX_PATH]; TruncCopy(TruncDir, GetPosToName(Dir), WinInfo.TruncLen, GetMsg(MComparing)); TruncCopy(TruncName, Name, WinInfo.TruncLen); wchar_t CurProc[64], Errors[64], CurProcOut[MAX_PATH]; FSF.sprintf(Buf, GetMsg(MDupCurProc), itoaa(CmpInfo.Proc, CurProc), itoaa(CmpInfo.Errors, Errors)); strcentr(CurProcOut, Buf, WinInfo.TruncLen, 0x00002500); wchar_t ProgressLineCur[MAX_PATH], ProgressLineTotal[MAX_PATH]; if (!Opt.DupContents || bStartMsg) wcscpy(ProgressLineCur, GetMsg(MWait)); else ProgressLine(ProgressLineCur, CmpInfo.CurProcSize, CmpInfo.CurCountSize); if (Opt.TotalProgress) { FSF.sprintf(Buf, GetMsg(MComparingFiles2), CmpInfo.CountSize && !((LPanel.PInfo.Flags & PFLAGS_PLUGIN) || (RPanel.PInfo.Flags & PFLAGS_PLUGIN)) ? (CmpInfo.ProcSize * 100 / CmpInfo.CountSize) : 0); SetConsoleTitle(Buf); wchar_t Count[64], CountSize[64]; FSF.sprintf(Buf, GetMsg(MComparingN), itoaa(CmpInfo.CountSize, CountSize), itoaa(CmpInfo.Count, Count)); strcentr(ItemsOut, Buf, WinInfo.TruncLen, 0x00002500); if ((LPanel.PInfo.Flags & PFLAGS_PLUGIN) || (RPanel.PInfo.Flags & PFLAGS_PLUGIN)) wcscpy(ProgressLineTotal, GetMsg(MWait)); else ProgressLine(ProgressLineTotal, CmpInfo.ProcSize, CmpInfo.CountSize); } strcentr(Buf, L"", WinInfo.TruncLen, 0x00002500); // просто сепаратор const wchar_t* MsgItems1[] = {GetMsg(MCmpTitle), TruncDir, TruncName, CurProcOut, ProgressLineCur}; const wchar_t* MsgItems2[] = {GetMsg(MCmpTitle), TruncDir, TruncName, CurProcOut, ProgressLineCur, Buf, ProgressLineTotal, ItemsOut}; Info.Message(&MainGuid, &DupMsgGuid, bStartMsg ? FMSG_LEFTALIGN : FMSG_LEFTALIGN | FMSG_KEEPBACKGROUND, 0, Opt.TotalProgress ? MsgItems2 : MsgItems1, Opt.TotalProgress ? sizeof(MsgItems2) / sizeof(MsgItems2[0]) : sizeof(MsgItems1) / sizeof(MsgItems1[0]), 0); bStartMsg = false; } /**************************************************************************** * Сравнение атрибутов и прочего для двух одноимённых элементов (файлов или * подкаталогов). * Возвращает true, если они совпадают. ****************************************************************************/ bool AdvCmpProc::CompareFiles(const wchar_t* LDir, const PluginPanelItem* pLPPI, const wchar_t* RDir, const PluginPanelItem* pRPPI, int ScanDepth, DWORD* dwFlag) { if (pLPPI->FileAttributes & FILE_ATTRIBUTE_DIRECTORY) { // Здесь сравниваем два подкаталога if (Opt.Subfolders) { if (Opt.Subfolders == 2 && Opt.MaxScanDepth < ScanDepth + 1) return true; bool bLPanelPlug = (LPanel.PInfo.Flags & PFLAGS_PLUGIN), bRPanelPlug = (RPanel.PInfo.Flags & PFLAGS_PLUGIN); if (ScanDepth > 0 && (bLPanelPlug || bRPanelPlug)) return true; string strLFullDir, strRFullDir; GetFullFileName(strLFullDir, LDir, pLPPI->FileName); GetFullFileName(strRFullDir, RDir, pRPPI->FileName); // Составим списки элементов в подкаталогах struct DirList LList, RList; bool bEqual = true; if (!(bLPanelPlug || bRPanelPlug)) { if (!GetDirList(strLFullDir.get(), ScanDepth, false, &LList) || !GetDirList(strRFullDir.get(), ScanDepth, false, &RList)) { bBrokenByEsc = true; // То ли юзер прервал, то ли ошибка чтения bEqual = false; // Остановим сравнение } } else if (bLPanelPlug || bRPanelPlug) { LList.Dir = (wchar_t*) malloc((wcslen(LDir) + 1) * sizeof(wchar_t)); if (LList.Dir) wcscpy(LList.Dir, LDir); // DebugMsg(L"LList.Dir",LList.Dir); // DebugMsg(L"pLPPI->FileName",(wchar_t*)pLPPI->FileName); RList.Dir = (wchar_t*) malloc((wcslen(RDir) + 1) * sizeof(wchar_t)); if (RList.Dir) wcscpy(RList.Dir, RDir); // DebugMsg(L"RList.Dir",RList.Dir); // DebugMsg(L"pRPPI->FileName",(wchar_t*)pRPPI->FileName); if (bLPanelPlug && !bBrokenByEsc && !Info.GetPluginDirList(&MainGuid, LPanel.hPanel, pLPPI->FileName, &LList.PPI, (size_t*) &LList.ItemsNumber)) { bBrokenByEsc = true; bEqual = false; } if (bRPanelPlug && !bBrokenByEsc && !Info.GetPluginDirList(&MainGuid, RPanel.hPanel, pRPPI->FileName, &RList.PPI, (size_t*) &RList.ItemsNumber)) { bBrokenByEsc = true; bEqual = false; } if (!bLPanelPlug && !bBrokenByEsc && !Info.GetDirList(GetPosToName(strLFullDir.get()), &LList.PPI, (size_t*) &LList.ItemsNumber)) { bBrokenByEsc = true; bEqual = false; } if (!bRPanelPlug && !bBrokenByEsc && !Info.GetDirList(GetPosToName(strRFullDir.get()), &RList.PPI, (size_t*) &RList.ItemsNumber)) { bBrokenByEsc = true; bEqual = false; } // for (int i=0; bEqual && !LPanel.bARC && i<LList.ItemsNumber; i++) // DebugMsg(L"FAR",(wchar_t*)LList.PPI[i].FileName,i); // for (int i=0; bEqual && !RPanel.bARC && i<RList.ItemsNumber; i++) // DebugMsg(L"FAR",(wchar_t*)RList.PPI[i].FileName,i); // for (int i=0; bEqual && LPanel.bARC && i<LList.ItemsNumber; i++) // DebugMsg(L"ARC",(wchar_t*)LList.PPI[i].FileName,i); // for (int i=0; bEqual && RPanel.bARC && i<RList.ItemsNumber; i++) // DebugMsg(L"ARC",(wchar_t*)RList.PPI[i].FileName,i); } if (bEqual) bEqual = CompareDirs(&LList, &RList, Opt.Dialog, ScanDepth + 1); // Opt.Dialog==1 то всё сравним в подкаталоге, для показа в диалоге if (!(bLPanelPlug || bRPanelPlug)) { FreeDirList(&LList); FreeDirList(&RList); } else if (bLPanelPlug || bRPanelPlug) { free(LList.Dir); free(RList.Dir); if (bLPanelPlug) Info.FreePluginDirList(LPanel.hPanel, LList.PPI, LList.ItemsNumber); if (bRPanelPlug) Info.FreePluginDirList(RPanel.hPanel, RList.PPI, RList.ItemsNumber); if (!bLPanelPlug) Info.FreeDirList(LList.PPI, LList.ItemsNumber); if (!bRPanelPlug) Info.FreeDirList(RList.PPI, RList.ItemsNumber); } return bEqual; } } else // Здесь сравниваем два файла { CmpInfo.CurCountSize = pLPPI->FileSize + pRPPI->FileSize; CmpInfo.CurProcSize = 0; bool bFullCmp = (Opt.Mode == MODE_CMP || Opt.LightSync ? false : true); // покажем "работу" на прогрессе :) if (!Opt.CmpContents) // содержимое - особый случай... CmpInfo.ProcSize += CmpInfo.CurCountSize; //=========================================================================== // регистр имен if (Opt.CmpCase) { string strLFileName(LPanel.bTMP ? FSF.PointToName(pLPPI->FileName) : pLPPI->FileName); string strRFileName(RPanel.bTMP ? FSF.PointToName(pRPPI->FileName) : pRPPI->FileName); if (Strncmp(Opt.SkipSubstr ? CutSubstr(strLFileName, Opt.Substr) : strLFileName.get(), Opt.SkipSubstr ? CutSubstr(strRFileName, Opt.Substr) : strRFileName.get())) { if (bFullCmp) *dwFlag |= RCIF_NAMEDIFF; else return false; } else if (bFullCmp) *dwFlag |= RCIF_NAME; } //=========================================================================== // размер if (Opt.CmpSize) { if (pLPPI->FileSize != pRPPI->FileSize) { if (bFullCmp) *dwFlag |= RCIF_SIZEDIFF; else return false; } else if (bFullCmp) *dwFlag |= RCIF_SIZE; } //=========================================================================== // время if (Opt.CmpTime) { if (Opt.Seconds || Opt.IgnoreTimeZone) { union { __int64 num; struct { DWORD lo; DWORD hi; } hilo; } Precision, Difference, TimeDelta, temp; Precision.hilo.hi = 0; Precision.hilo.lo = (Opt.Seconds && Opt.LowPrecisionTime) ? 20000000 : 0; // 2s or 0s Difference.num = __int64(9000000000); // 15m FILETIME LLastWriteTime = pLPPI->LastWriteTime, RLastWriteTime = pRPPI->LastWriteTime; if (Opt.Seconds && !Opt.LowPrecisionTime) { SYSTEMTIME Time; FileTimeToSystemTime(&LLastWriteTime, &Time); Time.wSecond = Time.wMilliseconds = 0; SystemTimeToFileTime(&Time, &LLastWriteTime); FileTimeToSystemTime(&RLastWriteTime, &Time); Time.wSecond = Time.wMilliseconds = 0; SystemTimeToFileTime(&Time, &RLastWriteTime); } if (LLastWriteTime.dwHighDateTime > RLastWriteTime.dwHighDateTime) { TimeDelta.hilo.hi = LLastWriteTime.dwHighDateTime - RLastWriteTime.dwHighDateTime; TimeDelta.hilo.lo = LLastWriteTime.dwLowDateTime - RLastWriteTime.dwLowDateTime; if (TimeDelta.hilo.lo > LLastWriteTime.dwLowDateTime) --TimeDelta.hilo.hi; } else { if (LLastWriteTime.dwHighDateTime == RLastWriteTime.dwHighDateTime) { TimeDelta.hilo.hi = 0; TimeDelta.hilo.lo = max(RLastWriteTime.dwLowDateTime, LLastWriteTime.dwLowDateTime) - min(RLastWriteTime.dwLowDateTime, LLastWriteTime.dwLowDateTime); } else { TimeDelta.hilo.hi = RLastWriteTime.dwHighDateTime - LLastWriteTime.dwHighDateTime; TimeDelta.hilo.lo = RLastWriteTime.dwLowDateTime - LLastWriteTime.dwLowDateTime; if (TimeDelta.hilo.lo > RLastWriteTime.dwLowDateTime) --TimeDelta.hilo.hi; } } //игнорировать различия не больше чем 26 часов. if (Opt.IgnoreTimeZone) { int counter = 0; while (TimeDelta.hilo.hi > Difference.hilo.hi && counter <= 26 * 4) { temp.hilo.lo = TimeDelta.hilo.lo - Difference.hilo.lo; temp.hilo.hi = TimeDelta.hilo.hi - Difference.hilo.hi; if (temp.hilo.lo > TimeDelta.hilo.lo) --temp.hilo.hi; TimeDelta.hilo.lo = temp.hilo.lo; TimeDelta.hilo.hi = temp.hilo.hi; ++counter; } if (counter <= 26 * 4 && TimeDelta.hilo.hi == Difference.hilo.hi) { TimeDelta.hilo.hi = 0; TimeDelta.hilo.lo = max(TimeDelta.hilo.lo, Difference.hilo.lo) - min(TimeDelta.hilo.lo, Difference.hilo.lo); } } if (Precision.hilo.hi < TimeDelta.hilo.hi || (Precision.hilo.hi == TimeDelta.hilo.hi && Precision.hilo.lo < TimeDelta.hilo.lo)) { if (bFullCmp) *dwFlag |= RCIF_TIMEDIFF; else return false; } else if (bFullCmp) *dwFlag |= RCIF_TIME; } else if (pLPPI->LastWriteTime.dwLowDateTime != pRPPI->LastWriteTime.dwLowDateTime || pLPPI->LastWriteTime.dwHighDateTime != pRPPI->LastWriteTime.dwHighDateTime) { if (bFullCmp) *dwFlag |= RCIF_TIMEDIFF; else return false; } else if (bFullCmp) *dwFlag |= RCIF_TIME; } //=========================================================================== // содержимое if (Opt.CmpContents) { bool bEqual = true; string strLFullFileName, strRFullFileName; // экспресс-сравнение: сравним размер файлов if (!Opt.Ignore && (pLPPI->FileSize != pRPPI->FileSize)) { CmpInfo.ProcSize += CmpInfo.CurCountSize; // if (bFullCmp) *dwFlag|=RCIF_CONTDIFF; // return false; bEqual = false; goto End; } // экспресс-сравнение: время совпало - скажем "одинаковые" if (Opt.OnlyTimeDiff && (pLPPI->LastWriteTime.dwLowDateTime == pRPPI->LastWriteTime.dwLowDateTime && pLPPI->LastWriteTime.dwHighDateTime == pRPPI->LastWriteTime.dwHighDateTime)) { CmpInfo.ProcSize += CmpInfo.CurCountSize; // if (bFullCmp) *dwFlag|=RCIF_CONT; bEqual = true; // return true; goto End; } // сравним 2-е архивные панели if (LPanel.bARC && RPanel.bARC) { CmpInfo.ProcSize += CmpInfo.CurCountSize; // wchar_t buf[40]; // FSF.sprintf(buf, L"L - %X R- %X", pLPPI->CRC32,pRPPI->CRC32); // DebugMsg(buf, L""); if (pLPPI->CRC32 == pRPPI->CRC32) bEqual = true; // return true; else bEqual = false; // return false; goto End; } GetFullFileName(strLFullFileName, LDir, pLPPI->FileName); GetFullFileName(strRFullFileName, RDir, pRPPI->FileName); // получим NativeDir - "\\?\dir\" if (LPanel.bTMP || RPanel.bTMP) { size_t size = FSF.ConvertPath(CPM_NATIVE, LPanel.bTMP ? strLFullFileName.get() : strRFullFileName.get(), 0, 0); wchar_t* buf = (wchar_t*) malloc(size * sizeof(wchar_t)); if (buf) { FSF.ConvertPath(CPM_NATIVE, LPanel.bTMP ? strLFullFileName.get() : strRFullFileName.get(), buf, size); (LPanel.bTMP ? strLFullFileName : strRFullFileName) = buf; free(buf); } } // работа с кешем DWORD dwLFileName, dwRFileName; if (Opt.Cache && !Opt.Ignore && !(LPanel.bARC || RPanel.bARC)) { dwLFileName = ProcessCRC((void*) strLFullFileName.get(), strLFullFileName.length() * 2, 0); dwRFileName = ProcessCRC((void*) strRFullFileName.get(), strRFullFileName.length() * 2, 0); // Используем кешированные данные if (!Opt.CacheIgnore) { int Result = GetCacheResult(dwLFileName, dwRFileName, ((__int64) pLPPI->LastWriteTime.dwHighDateTime << 32) | pLPPI->LastWriteTime.dwLowDateTime, ((__int64) pRPPI->LastWriteTime.dwHighDateTime << 32) | pRPPI->LastWriteTime.dwLowDateTime); // wchar_t buf[200]; // FSF.sprintf(buf, L"GetCacheResult: L - %X R- %X", dwLFileName, dwRFileName); // DebugMsg(buf,(wchar_t*)pLPPI->FindData.lpwszFileName,Result?(Result==RCIF_EQUAL?RCIF_EQUAL:RCIF_DIFFER):0); if (Result == RCIF_EQUAL) { CmpInfo.ProcSize += CmpInfo.CurCountSize; // if (bFullCmp) *dwFlag|=RCIF_CONT; bEqual = true; // return true; goto End; } else if (Result == RCIF_DIFFER) { CmpInfo.ProcSize += CmpInfo.CurCountSize; // if (bFullCmp) *dwFlag|=RCIF_CONTDIFF; bEqual = false; // return false; goto End; } } } HANDLE hLFile, hRFile; FILETIME LAccess, RAccess; BY_HANDLE_FILE_INFORMATION LFileInfo, RFileInfo; bool bOkLFileInfo = false, bOkRFileInfo = false; if (!LPanel.bARC) { if ((hLFile = CreateFileW(strLFullFileName, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, 0)) == INVALID_HANDLE_VALUE) { CmpInfo.ProcSize += CmpInfo.CurCountSize; CmpInfo.Errors++; // if (bFullCmp) *dwFlag|=RCIF_CONTDIFF; bEqual = false; // return false; goto End; } bOkLFileInfo = GetFileInformationByHandle(hLFile, &LFileInfo); // Сохраним время последнего доступа к файлу LAccess = pLPPI->LastAccessTime; } if (!RPanel.bARC) { if ((hRFile = CreateFileW(strRFullFileName, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, 0)) == INVALID_HANDLE_VALUE) { if (hLFile) CloseHandle(hLFile); CmpInfo.ProcSize += CmpInfo.CurCountSize; CmpInfo.Errors++; // if (bFullCmp) *dwFlag|=RCIF_CONTDIFF; bEqual = false; // return false; goto End; } bOkRFileInfo = GetFileInformationByHandle(hRFile, &RFileInfo); RAccess = pRPPI->LastAccessTime; } //--------------------------------------------------------------------------- ShowCmpMsg(LDir, pLPPI->FileName, RDir, pRPPI->FileName, true); // экспресс-сравнение: FileIndex совпали - скажем "одинаковые" if (bOkLFileInfo && bOkRFileInfo && LFileInfo.dwVolumeSerialNumber == RFileInfo.dwVolumeSerialNumber && LFileInfo.nFileIndexHigh == RFileInfo.nFileIndexHigh && LFileInfo.nFileIndexLow == RFileInfo.nFileIndexLow) { CloseHandle(hLFile); CloseHandle(hRFile); CmpInfo.ProcSize += CmpInfo.CurCountSize; // if (bFullCmp) *dwFlag|=RCIF_CONT; bEqual = true; // return true; goto End; } DWORD LReadSize = 1, RReadSize = 1; DWORD LBufPos = 1, RBufPos = 1; // позиция в Opt.Buf const DWORD ReadBlock = 65536; __int64 LFilePos = 0, RFilePos = 0; // позиция в файле { char *LPtr = Opt.Buf[0] + LBufPos, *RPtr = Opt.Buf[1] + RBufPos; bool bLExpectNewLine = false, bRExpectNewLine = false; SHFILEINFO shinfo; bool bExe = false; if (!(LPanel.bARC || RPanel.bARC)) bExe = (SHGetFileInfoW(strLFullFileName, 0, &shinfo, sizeof(shinfo), SHGFI_EXETYPE) || SHGetFileInfoW(strRFullFileName, 0, &shinfo, sizeof(shinfo), SHGFI_EXETYPE)); DWORD dwFileCRC = 0; __int64 PartlyKbSize = (__int64) Opt.PartlyKbSize * 1024; // частичное сравнение bool bPartlyFull = (Opt.Partly && !Opt.Ignore && !(LPanel.bARC || RPanel.bARC) && (Opt.PartlyFull && pLPPI->FileSize > Opt.BufSize)); bool bPartlyKb = (Opt.Partly && !Opt.Ignore && !(LPanel.bARC || RPanel.bARC) && (!Opt.PartlyFull && PartlyKbSize && pLPPI->FileSize > (unsigned __int64) abs(PartlyKbSize))); unsigned int BlockIndex = pLPPI->FileSize / Opt.BufSize; unsigned int LCurBlockIndex = 0, RCurBlockIndex = 0; // если с минусом, отсчитаем с конца файла bool bFromEnd = (bPartlyKb && abs(PartlyKbSize) != PartlyKbSize); if (bFromEnd) { if (!mySetFilePointer(hLFile, PartlyKbSize, FILE_END) || !mySetFilePointer(hRFile, PartlyKbSize, FILE_END)) bEqual = false; } while (1) { // частичное сравнение, пропускаем блоками по Opt.BufSize if (bPartlyFull) { if (!mySetFilePointer(hLFile, Opt.BufSize, FILE_CURRENT) || !mySetFilePointer(hRFile, Opt.BufSize, FILE_CURRENT)) { bEqual = false; break; } // else DebugMsg(L"skip",L"",Opt.BufSize); } // читаем файл с активной панели if (!LPanel.bARC && LPtr >= Opt.Buf[0] + LBufPos) { LBufPos = 0; LPtr = Opt.Buf[0]; // читаем блоком Opt.BufSize while (LBufPos < (unsigned) Opt.BufSize) { if (CheckForEsc() || !ReadFile(hLFile, Opt.Buf[0] + LBufPos, (!bPartlyKb || bFromEnd || LFilePos + ReadBlock <= PartlyKbSize) ? ReadBlock : (PartlyKbSize - LFilePos), &LReadSize, 0)) { bEqual = false; break; } LBufPos += LReadSize; LFilePos += LReadSize; // DebugMsg(L"LReadSize",L"",LReadSize); CmpInfo.CurProcSize += LReadSize; CmpInfo.ProcSize += LReadSize; if (LReadSize < ReadBlock) break; } } if (!bEqual) break; // читаем файл с пассивной панели if (!RPanel.bARC && RPtr >= Opt.Buf[1] + RBufPos) { RBufPos = 0; RPtr = Opt.Buf[1]; // читаем блоком Opt.BufSize while (RBufPos < (unsigned) Opt.BufSize) { if (CheckForEsc() || !ReadFile(hRFile, Opt.Buf[1] + RBufPos, (!bPartlyKb || bFromEnd || RFilePos + ReadBlock <= PartlyKbSize) ? ReadBlock : (PartlyKbSize - RFilePos), &RReadSize, 0)) { bEqual = false; break; } RBufPos += RReadSize; RFilePos += RReadSize; // DebugMsg(L"RReadSize",L"",RReadSize); CmpInfo.CurProcSize += RReadSize; CmpInfo.ProcSize += RReadSize; if (RReadSize < ReadBlock) break; } } if (!bEqual) break; ShowCmpMsg(LDir, pLPPI->FileName, RDir, pRPPI->FileName, false); // сравниваем с архивом if (RPanel.bARC) { dwFileCRC = ProcessCRC(Opt.Buf[0], LBufPos, dwFileCRC); LPtr += LBufPos; CmpInfo.CurProcSize += LBufPos; CmpInfo.ProcSize += LBufPos; } else if (LPanel.bARC) { dwFileCRC = ProcessCRC(Opt.Buf[1], RBufPos, dwFileCRC); RPtr += RBufPos; CmpInfo.CurProcSize += RBufPos; CmpInfo.ProcSize += RBufPos; } if (LPanel.bARC || RPanel.bARC) { if ((RPanel.bARC && LBufPos != Opt.BufSize) || (LPanel.bARC && RBufPos != Opt.BufSize)) { if (!LPanel.bARC && RPanel.bARC && dwFileCRC != pRPPI->CRC32) bEqual = false; else if (LPanel.bARC && !RPanel.bARC && dwFileCRC != pLPPI->CRC32) bEqual = false; // wchar_t buf[40]; // FSF.sprintf(buf, L"L - %X R- %X", LPanel.bARC?pLPPI->CRC32:dwFileCRC, RPanel.bARC?pRPPI->CRC32:dwFileCRC); // if ((LPanel.bARC?pLPPI->CRC32:dwFileCRC)!=(RPanel.bARC?pRPPI->CRC32:dwFileCRC)) // DebugMsg(buf,(wchar_t*)pLPPI->FindData.lpwszFileName,(LPanel.bARC?pLPPI->CRC32:dwFileCRC)!=(RPanel.bARC?pRPPI->CRC32:dwFileCRC)); break; } else continue; } // обычное сравнение (фильтр отключен или файлы исполнимые) if (!Opt.Ignore || bExe) { if (memcmp(Opt.Buf[0], Opt.Buf[1], LBufPos)) { bEqual = false; break; } LPtr += LBufPos; RPtr += RBufPos; // считали всё, выходим if (LBufPos != Opt.BufSize || RBufPos != Opt.BufSize) break; } else // фильтр включен { if (Opt.IgnoreTemplates == 0) // '\n' & ' ' { while (LPtr < Opt.Buf[0] + LBufPos && RPtr < Opt.Buf[1] + RBufPos && !IsWhiteSpace(*LPtr) && !IsWhiteSpace(*RPtr)) { if (*LPtr != *RPtr) { bEqual = false; break; } ++LPtr; ++RPtr; } if (!bEqual) break; while (LPtr < Opt.Buf[0] + LBufPos && IsWhiteSpace(*LPtr)) ++LPtr; while (RPtr < Opt.Buf[1] + RBufPos && IsWhiteSpace(*RPtr)) ++RPtr; } else if (Opt.IgnoreTemplates == 1) // '\n' { if (bLExpectNewLine) { bLExpectNewLine = false; if (LPtr < Opt.Buf[0] + LBufPos && *LPtr == '\n') ++LPtr; } if (bRExpectNewLine) { bRExpectNewLine = false; if (RPtr < Opt.Buf[1] + RBufPos && *RPtr == '\n') ++RPtr; } while (LPtr < Opt.Buf[0] + LBufPos && RPtr < Opt.Buf[1] + RBufPos && !IsNewLine(*LPtr) && !IsNewLine(*RPtr)) { if (*LPtr != *RPtr) { bEqual = false; break; } ++LPtr; ++RPtr; } if (!bEqual) break; if (LPtr < Opt.Buf[0] + LBufPos && RPtr < Opt.Buf[1] + RBufPos && (!IsNewLine(*LPtr) || !IsNewLine(*RPtr))) { bEqual = false; break; } if (LPtr < Opt.Buf[0] + LBufPos && RPtr < Opt.Buf[1] + RBufPos) { if (*LPtr == '\r') bLExpectNewLine = true; if (*RPtr == '\r') bRExpectNewLine = true; ++LPtr; ++RPtr; } } else if (Opt.IgnoreTemplates == 2) // ' ' { while (LPtr < Opt.Buf[0] + LBufPos && RPtr < Opt.Buf[1] + RBufPos && !myIsSpace(*LPtr) && !myIsSpace(*RPtr)) { if (*LPtr != *RPtr) { bEqual = false; break; } ++LPtr; ++RPtr; } if (!bEqual) break; while (LPtr < Opt.Buf[0] + LBufPos && myIsSpace(*LPtr)) ++LPtr; while (RPtr < Opt.Buf[1] + RBufPos && myIsSpace(*RPtr)) ++RPtr; } if (!LReadSize && RReadSize || LReadSize && !RReadSize) { bEqual = false; break; } } if (!LReadSize && !RReadSize) break; } // поместим в кэш результат if (Opt.Cache && !(LPanel.bARC || RPanel.bARC) && (!Opt.Ignore || bExe) && !Opt.Partly) { Opt.Cache = SetCacheResult( dwLFileName, dwRFileName, ((__int64) pLPPI->LastWriteTime.dwHighDateTime << 32) | pLPPI->LastWriteTime.dwLowDateTime, ((__int64) pRPPI->LastWriteTime.dwHighDateTime << 32) | pRPPI->LastWriteTime.dwLowDateTime, bEqual ? RCIF_EQUAL : RCIF_DIFFER); // DebugMsg(L"SetCacheResult",(wchar_t*)pLPPI->FindData.lpwszFileName,bEqual?RCIF_EQUAL:RCIF_DIFFER); // wchar_t buf[200]; // FSF.sprintf(buf, L"SetCacheResult: L - %X R- %X", dwLFileName, dwRFileName); // DebugMsg(buf,(wchar_t*)pLPPI->FindData.lpwszFileName,bEqual?RCIF_EQUAL:RCIF_DIFFER); } } if (!(LPanel.bARC)) { CloseHandle(hLFile); if ((hLFile = CreateFileW(strLFullFileName, FILE_WRITE_ATTRIBUTES, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, 0)) != INVALID_HANDLE_VALUE) { SetFileTime(hLFile, 0, &LAccess, 0); CloseHandle(hLFile); } } if (!(RPanel.bARC)) { CloseHandle(hRFile); if ((hRFile = CreateFileW(strRFullFileName, FILE_WRITE_ATTRIBUTES, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, 0)) != INVALID_HANDLE_VALUE) { SetFileTime(hRFile, 0, &RAccess, 0); CloseHandle(hRFile); } } if (!bEqual) { CmpInfo.ProcSize += CmpInfo.CurCountSize - CmpInfo.CurProcSize; // if (bFullCmp) *dwFlag|=RCIF_CONTDIFF; // return false; } End: if (!bEqual) { if (bFullCmp) *dwFlag |= RCIF_CONTDIFF; else return false; } else if (bFullCmp) *dwFlag |= RCIF_CONT; } //=========================================================================== // если полное сравнение, то суммируем результаты сравнения if (bFullCmp && ((*dwFlag & RCIF_NAMEDIFF) || (*dwFlag & RCIF_TIMEDIFF) || (*dwFlag & RCIF_SIZEDIFF) || (*dwFlag & RCIF_CONTDIFF))) return false; } return true; } /**************************************************************************** * Сравнение двух каталогов, описанных структурами AInfo и PInfo. * Возвращает true, если они совпадают. * Параметр bCompareAll определяет, * надо ли сравнивать все файлы и взводить PPIF_SELECTED (bCompareAll == true) * или просто вернуть false при первом несовпадении (bCompareAll == false). ****************************************************************************/ bool AdvCmpProc::CompareDirs(const struct DirList* pLList, const struct DirList* pRList, bool bCompareAll, int ScanDepth) { // Стартуем с сообщением о сравнении ShowCmpMsg(pLList->Dir, L"*", pRList->Dir, L"*", true); // строим индексы элементов, для убыстрения сравнения struct ItemsIndex LII, RII; if (!BuildItemsIndex(true, pLList, &LII, ScanDepth) || !BuildItemsIndex(false, pRList, &RII, ScanDepth)) { ErrorMsg(MNoMemTitle, MNoMemBody); bBrokenByEsc = true; FreeItemsIndex(&LII); FreeItemsIndex(&RII); return true; } int i = 0, j = 0; // соберем информацию, сколько элементов будем сравнивать и их размер if (ScanDepth == 0 && Opt.TotalProgress) { while (i < LII.iCount && j < RII.iCount && !bBrokenByEsc) { switch (PICompare(&LII.pPPI[i], &RII.pPPI[j], NULL)) { case 0: { string strDir; if (LII.pPPI[i]->FileAttributes & FILE_ATTRIBUTE_DIRECTORY && !(LPanel.PInfo.Flags & PFLAGS_PLUGIN)) { GetFullFileName(strDir, pLList->Dir, LII.pPPI[i]->FileName); GetDirList(strDir.get(), ScanDepth, true); } else { CmpInfo.Count += 1; CmpInfo.CountSize += (unsigned __int64) LII.pPPI[i]->FileSize; } if (!bBrokenByEsc) { if (RII.pPPI[j]->FileAttributes & FILE_ATTRIBUTE_DIRECTORY && !(RPanel.PInfo.Flags & PFLAGS_PLUGIN)) { GetFullFileName(strDir, pRList->Dir, RII.pPPI[j]->FileName); GetDirList(strDir.get(), ScanDepth, true); } else { CmpInfo.Count += 1; CmpInfo.CountSize += (unsigned __int64) RII.pPPI[j]->FileSize; } } i++; j++; break; } case -1: { CmpInfo.Count += 1; CmpInfo.CountSize += (unsigned __int64) LII.pPPI[i]->FileSize; i++; break; } case 1: { CmpInfo.Count += 1; CmpInfo.CountSize += (unsigned __int64) RII.pPPI[j]->FileSize; j++; break; } } } } if (bBrokenByEsc) { FreeItemsIndex(&LII); FreeItemsIndex(&RII); return true; } // экспресс-сравнение вложенного каталога if (ScanDepth && !Opt.Dialog && !Opt.IgnoreMissing && LII.iCount != RII.iCount) { FreeItemsIndex(&LII); FreeItemsIndex(&RII); return false; } // вначале снимем выделение на панелях if (ScanDepth == 0) { for (i = 0; i < pLList->ItemsNumber; i++) pLList->PPI[i].Flags &= ~PPIF_SELECTED; for (i = 0; i < pRList->ItemsNumber; i++) pRList->PPI[i].Flags &= ~PPIF_SELECTED; } // начинаем сравнивать "наши" элементы... bool bDifferenceNotFound = true; i = 0; j = 0; DWORD dwFlag = 0; while (i < LII.iCount && j < RII.iCount && (bDifferenceNotFound || bCompareAll) && !bBrokenByEsc) { // проверка на ESC const int iMaxCounter = 256; static int iCounter = iMaxCounter; if (!--iCounter) { iCounter = iMaxCounter; if (CheckForEsc()) break; } bool bNextItem; dwFlag = RCIF_DIFFER; switch (PICompare(&LII.pPPI[i], &RII.pPPI[j], NULL)) { /******************************************************************************/ case 0: // Имена совпали - проверяем всё остальное { // wchar_t buf[512]; // FSF.sprintf(buf,L"Left: %s Right: %s, %d + %d", LII.pPPI[i]->FindData.lpwszFileName, RII.pPPI[j]->FindData.lpwszFileName, i,j); // DebugMsg(buf,L"case 0",bDifferenceNotFound); if (CompareFiles(pLList->Dir, LII.pPPI[i], pRList->Dir, RII.pPPI[j], ScanDepth, &dwFlag)) { // И остальное совпало i++; j++; dwFlag = RCIF_EQUAL; // просто установим } else { bDifferenceNotFound = false; // узнаем, новый кто? __int64 Delta = (((__int64) LII.pPPI[i]->LastWriteTime.dwHighDateTime << 32) | LII.pPPI[i]->LastWriteTime.dwLowDateTime) - (((__int64) RII.pPPI[j]->LastWriteTime.dwHighDateTime << 32) | RII.pPPI[j]->LastWriteTime.dwLowDateTime); if (Opt.CmpTime) { if (Delta > 0) { dwFlag &= ~RCIF_DIFFER; dwFlag |= RCIF_LNEW; } else if (Delta < 0) { dwFlag &= ~RCIF_DIFFER; dwFlag |= RCIF_RNEW; } } if (Opt.SelectedNew) { if (Delta > 0) { LII.pPPI[i]->Flags |= PPIF_SELECTED; } else if (Delta < 0) { RII.pPPI[j]->Flags |= PPIF_SELECTED; } else { LII.pPPI[i]->Flags |= PPIF_SELECTED; RII.pPPI[j]->Flags |= PPIF_SELECTED; } } else { LII.pPPI[i]->Flags |= PPIF_SELECTED; RII.pPPI[j]->Flags |= PPIF_SELECTED; } i++; j++; CmpInfo.LDiff++; CmpInfo.RDiff++; // dwFlag=RCIF_DIFFER; if (Opt.StopDiffDup && !bBrokenByEsc) { // нужно ли продолжать сравнивать bCompareAll = (Opt.ShowMsg && !YesNoMsg(MFirstDiffTitle, MFirstDiffBody)); Opt.StopDiffDup = 0; } } CmpInfo.Proc += 2; // добавим элемент в диалог результатов if (Opt.Dialog) MakeFileList(pLList->Dir, LII.pPPI[i - 1], pRList->Dir, RII.pPPI[j - 1], dwFlag); break; } /******************************************************************************/ case -1: // Элемент LII.pPPI[i] не имеет одноимённых в RII.pPPI { // wchar_t buf2[512]; // FSF.sprintf(buf2,L"Left: %s Right: %s", LII.pPPI[i]->FindData.lpwszFileName, RII.pPPI[j]->FindData.lpwszFileName); // DebugMsg(buf2,L"case -1",bDifferenceNotFound); CmpContinueL: dwFlag = RCIF_DIFFER; if (!Opt.IgnoreMissing || (Opt.IgnoreMissing == 2 && ScanDepth)) { if (!LPanel.bTMP) { bNextItem = true; goto FoundDiffL; } else { // ...но если с Темп-панели, то проверим с элементом RII.pPPI bNextItem = false; for (int k = 0; k < RII.iCount; k++) { if (!PICompare(&LII.pPPI[i], &RII.pPPI[k], NULL)) { bNextItem = true; if (CompareFiles(pLList->Dir, LII.pPPI[i], pRList->Dir, RII.pPPI[k], ScanDepth, &dwFlag)) { i++; break; } else FoundDiffL : { bDifferenceNotFound = false; LII.pPPI[i]->Flags |= PPIF_SELECTED; dwFlag = (RCIF_LNEW | RCIF_LUNIQ); // просто установим i++; CmpInfo.LDiff++; if (LPanel.bTMP && k < RII.iCount) { RII.pPPI[k]->Flags |= PPIF_SELECTED; CmpInfo.RDiff++; } if (Opt.StopDiffDup && !bBrokenByEsc) { bCompareAll = (Opt.ShowMsg && !YesNoMsg(MFirstDiffTitle, MFirstDiffBody)); Opt.StopDiffDup = 0; } break; } } } if (!bNextItem) { bNextItem = true; goto FoundDiffL; } } // добавим элемент в диалог результатов if (Opt.Dialog) MakeFileList(pLList->Dir, LII.pPPI[i - 1], pRList->Dir, NULL, dwFlag); } else { i++; } CmpInfo.Proc++; break; } /******************************************************************************/ case 1: // Элемент RII.pPPI[j] не имеет одноимённых в LII.pPPI { // wchar_t buf3[512]; // FSF.sprintf(buf3,L"Left: %s Right: %s", LII.pPPI[i]->FindData.lpwszFileName, RII.pPPI[j]->FindData.lpwszFileName); // DebugMsg(buf3,L"case 1",bDifferenceNotFound); CmpContinueR: dwFlag = RCIF_DIFFER; if (!Opt.IgnoreMissing || (Opt.IgnoreMissing == 2 && ScanDepth)) { if (!RPanel.bTMP) { bNextItem = true; goto FoundDiffR; } else { // ...но если с Темп-панели, то проверим с элементом LII.pPPI bNextItem = false; for (int k = 0; k < LII.iCount; k++) { if (!PICompare(&LII.pPPI[k], &RII.pPPI[j], NULL)) { bNextItem = true; if (CompareFiles(pLList->Dir, LII.pPPI[k], pRList->Dir, RII.pPPI[j], ScanDepth, &dwFlag)) { j++; break; } else FoundDiffR : { bDifferenceNotFound = false; RII.pPPI[j]->Flags |= PPIF_SELECTED; dwFlag = (RCIF_RNEW | RCIF_RUNIQ); // просто установим j++; CmpInfo.RDiff++; if (RPanel.bTMP && k < LII.iCount) { LII.pPPI[k]->Flags |= PPIF_SELECTED; CmpInfo.LDiff++; } if (Opt.StopDiffDup && !bBrokenByEsc) { bCompareAll = (Opt.ShowMsg && !YesNoMsg(MFirstDiffTitle, MFirstDiffBody)); Opt.StopDiffDup = 0; } break; } } } if (!bNextItem) { bNextItem = true; goto FoundDiffR; } } // добавим элемент в диалог результатов if (Opt.Dialog) MakeFileList(pLList->Dir, NULL, pRList->Dir, RII.pPPI[j - 1], dwFlag); } else { j++; } CmpInfo.Proc++; break; } } } if (!bBrokenByEsc) { // Собственно сравнение окончено. Пометим то, что осталось необработанным в массивах if ((!Opt.IgnoreMissing || (Opt.IgnoreMissing == 2 && ScanDepth)) && i < LII.iCount) { if (!LPanel.bTMP) bDifferenceNotFound = false; if (bCompareAll) goto CmpContinueL; } if ((!Opt.IgnoreMissing || (Opt.IgnoreMissing == 2 && ScanDepth)) && j < RII.iCount) { if (!RPanel.bTMP) bDifferenceNotFound = false; if (bCompareAll) goto CmpContinueR; } } // DebugMsg(L"LII.iCount",L"",LII.iCount); // DebugMsg(L"RII.iCount",L"",RII.iCount); FreeItemsIndex(&LII); FreeItemsIndex(&RII); return bDifferenceNotFound; } #include "AdvCmpProc_CLIST.cpp" #include "AdvCmpProc_DUP.cpp" #include "AdvCmpProc_SYNC.cpp" /*************************************************************************** * * ДИАЛОГ СРАВНЕНИЯ ТЕКУЩИХ ФАЙЛОВ * ***************************************************************************/ bool UpdateImage(PicData* data, bool CheckOnly = false) { if (!data->DibData && !data->Loaded) { // DrawImage { bool result = false; GFL_BITMAP* RawPicture = NULL; data->DibData = NULL; RECT RangedRect; GFL_LOAD_PARAMS load_params; pGflGetDefaultLoadParams(&load_params); load_params.Flags |= GFL_LOAD_SKIP_ALPHA; load_params.Flags |= GFL_LOAD_IGNORE_READ_ERROR; load_params.Origin = GFL_BOTTOM_LEFT; load_params.LinePadding = 4; load_params.ImageWanted = data->Page - 1; GFL_ERROR res = pGflLoadBitmapW(data->FileName, &RawPicture, &load_params, data->pic_info); if (res) RawPicture = NULL; if (RawPicture) { if (!pGflChangeColorDepth(RawPicture, NULL, GFL_MODE_TO_BGR, GFL_MODE_NO_DITHER) /* && !pGflRotate(RawPicture,NULL,data->Rotate,0)*/) { { int dx = WinInfo.Win.right / (WinInfo.Con.Right - WinInfo.Con.Left); int dy = WinInfo.Win.bottom / (WinInfo.Con.Bottom - WinInfo.Con.Top); RECT DCRect; DCRect.left = dx * (data->DrawRect.left - WinInfo.Con.Left); DCRect.right = dx * (data->DrawRect.right + 1 - WinInfo.Con.Left); DCRect.top = dy * (data->DrawRect.top /*-WinInfo.Con.Top*/); //костыль для запуска far.exe /w DCRect.bottom = dy * (data->DrawRect.bottom + 1 /*-WinInfo.Con.Top*/); //костыль для запуска far.exe /w float asp_dst = (float) (DCRect.right - DCRect.left) / (float) (DCRect.bottom - DCRect.top); float asp_src = (float) RawPicture->Width / (float) RawPicture->Height; int dst_w, dst_h; if (asp_dst < asp_src) { dst_w = min(DCRect.right - DCRect.left, RawPicture->Width); dst_h = (int) (dst_w / asp_src); } else { dst_h = min(DCRect.bottom - DCRect.top, RawPicture->Height); dst_w = (int) (asp_src * dst_h); } RangedRect.left = DCRect.left; RangedRect.top = DCRect.top; RangedRect.right = dst_w; RangedRect.bottom = dst_h; RangedRect.left += (DCRect.right - DCRect.left - RangedRect.right) / 2; RangedRect.top += (DCRect.bottom - DCRect.top - RangedRect.bottom) / 2; } data->MemSize = ((RawPicture->Width * 3 + 3) & -4) * RawPicture->Height; GFL_BITMAP* pic = NULL; pGflResize(RawPicture, &pic, RangedRect.right, RangedRect.bottom, GFL_RESIZE_BILINEAR, 0); if (pic) { data->DibData = NULL; memset(data->BmpHeader, 0, sizeof(BITMAPINFOHEADER)); data->BmpHeader->biSize = sizeof(BITMAPINFOHEADER); data->BmpHeader->biWidth = pic->Width; data->BmpHeader->biHeight = pic->Height; data->BmpHeader->biPlanes = 1; data->BmpHeader->biClrUsed = 0; data->BmpHeader->biBitCount = 24; data->BmpHeader->biCompression = BI_RGB; data->BmpHeader->biClrImportant = 0; int bytes_per_line = (pic->Width * 3 + 3) & -4; data->BmpHeader->biSizeImage = bytes_per_line * pic->Height; data->DibData = (unsigned char*) malloc(data->BmpHeader->biSizeImage); if (data->DibData) memcpy(data->DibData, pic->Data, data->BmpHeader->biSizeImage); pGflFreeBitmap(pic); } } } if (RawPicture && data->DibData) { result = true; data->GDIRect = RangedRect; } if (RawPicture) pGflFreeBitmap(RawPicture); if (result) { data->Loaded = true; if ((!(data->FirstRun)) && (!CheckOnly)) InvalidateRect(WinInfo.hFarWindow, NULL, TRUE); } } } if (!data->DibData || !data->Loaded) return false; if (CheckOnly) return true; HDC hDC = GetDC(WinInfo.hFarWindow); StretchDIBits(hDC, data->GDIRect.left, data->GDIRect.top, data->GDIRect.right, data->GDIRect.bottom, 0, 0, data->GDIRect.right, data->GDIRect.bottom, data->DibData, (BITMAPINFO*) data->BmpHeader, DIB_RGB_COLORS, SRCCOPY); ReleaseDC(WinInfo.hFarWindow, hDC); return true; } void FreeImage(PicData* data) { if (data && data->DibData) { free(data->DibData); data->DibData = NULL; pGflFreeFileInformation(data->pic_info); } } #if 0 void UpdateInfoText(HANDLE hDlg, PicData *data, bool left) { wchar_t str[64], str2[4096]; if (left) { FSF.sprintf(str,L"%d/%d %d x %d",data->Page,data->pic_info->NumberOfImages,data->pic_info->Width,data->pic_info->Height); FSF.sprintf(str2,L"%*.*s",WinInfo.Con.Right/2-1,WinInfo.Con.Right/2-1,str); } else FSF.sprintf(str,L"%d x %d %d/%d",data->pic_info->Width,data->pic_info->Height,data->Page,data->pic_info->NumberOfImages); Info.SendDlgMessage(hDlg,DM_SETTEXTPTR,left?3:4,(left?str2:str)); } intptr_t WINAPI ShowCmpCurDialogProc(HANDLE hDlg,intptr_t Msg,intptr_t Param1,void *Param2) { cmpPicFile *pPics=(cmpPicFile *)Info.SendDlgMessage(hDlg,DM_GETDLGDATA,0,0); switch(Msg) { case DN_CTLCOLORDLGITEM: if (Param1!=0) { FarColor Color; struct FarDialogItemColors *Colors=(FarDialogItemColors*)Param2; Info.AdvControl(&MainGuid,ACTL_GETCOLOR,COL_PANELSELECTEDTITLE,&Color); Colors->Colors[0] = Color; Info.AdvControl(&MainGuid,ACTL_GETCOLOR,COL_PANELTEXT,&Color); Colors->Colors[1] = Colors->Colors[2] = Color; } break; case DN_DRAWDLGITEM: pPics->L.Redraw=true; pPics->R.Redraw=true; break; case DN_ENTERIDLE: if (pPics->L.Redraw) { pPics->L.Redraw=false; UpdateImage(&pPics->L); if (pPics->L.FirstRun) { pPics->L.FirstRun=false; UpdateInfoText(hDlg,&pPics->L,true); UpdateInfoText(hDlg,&pPics->R,false); } } if (pPics->R.Redraw) { pPics->R.Redraw=false; UpdateImage(&pPics->R); if (pPics->R.FirstRun) { pPics->R.FirstRun=false; UpdateInfoText(hDlg,&pPics->L,true); UpdateInfoText(hDlg,&pPics->R,false); } } break; case 0x3FFF: if (Param1) { UpdateImage(&pPics->L); UpdateImage(&pPics->R); } break; /* case DN_GOTFOCUS: if(DlgParams->SelfKeys) Info.SendDlgMessage(hDlg,DM_SETFOCUS,2,0); break; case DN_GETDIALOGINFO: if(((DialogInfo*)(Param2))->StructSize != sizeof(DialogInfo)) return FALSE; ((DialogInfo*)(Param2))->Id=DlgGUID; return TRUE; case DN_KEY: if(!DlgParams->SelfKeys) { if((Param2&(KEY_CTRL|KEY_ALT|KEY_SHIFT|KEY_RCTRL|KEY_RALT))==Param2) break; switch(Param2) { case KEY_CTRLR: UpdateImage(DlgParams); return TRUE; case KEY_CTRLD: case KEY_CTRLS: case KEY_CTRLE: { FreeImage(DlgParams); if(Param2==KEY_CTRLD) DlgParams->Rotate-=90; else if (Param2==KEY_CTRLS) DlgParams->Rotate+=90; else DlgParams->Rotate+=180; DlgParams->Loaded=false; UpdateImage(DlgParams); UpdateInfoText(hDlg,DlgParams); return TRUE; } case KEY_TAB: DlgParams->SelfKeys=true; Info.SendDlgMessage(hDlg,DM_SETFOCUS,2,0); return TRUE; case KEY_BS: case KEY_SPACE: if(DlgParams->ShowingIn==VIEWER) Param2=Param2==KEY_BS?KEY_SUBTRACT:KEY_ADD; default: if(DlgParams->ShowingIn==VIEWER && Param2==KEY_F3) Param2=KEY_ESC; if(DlgParams->ShowingIn==QUICKVIEW && Param2==KEY_DEL) Param2=KEY_F8; DlgParams->ResKey=Param2; Info.SendDlgMessage(hDlg,DM_CLOSE,-1,0); return TRUE; } } else { switch(Param2) { case KEY_TAB: DlgParams->SelfKeys=false; Info.SendDlgMessage(hDlg,DM_SETFOCUS,1,0); return TRUE; case KEY_ADD: case KEY_SUBTRACT: if(DlgParams->DibData) { int Pages=DlgParams->pic_info->NumberOfImages; FreeImage(DlgParams); DlgParams->Loaded=false; if(Param2==KEY_ADD) DlgParams->Page++; else DlgParams->Page--; if(DlgParams->Page<1) DlgParams->Page=Pages; if(DlgParams->Page>Pages) DlgParams->Page=1; UpdateImage(DlgParams); UpdateInfoText(hDlg,DlgParams); } return TRUE; } } break; */ } return Info.DefDlgProc(hDlg,Msg,Param1,Param2); } int AdvCmpProc::ShowCmpCurDialog(const PluginPanelItem *pLPPI,const PluginPanelItem *pRPPI, bool bShowImage) { const unsigned int dW = WinInfo.Con.Right; // ширина const unsigned int dH = bShowImage?WinInfo.Con.Bottom-WinInfo.Con.Top:11; // высота wchar_t LTime[20]={0}, RTime[20]={0}; wchar_t LSize[65]={0}, RSize[65]={0}; struct FarDialogItem DialogItems[] = { // Type X1 Y1 X2 Y2 Selected History Mask Flags Data MaxLen UserParam /* 0*/{DI_USERCONTROL, 1, 1, dW-1,dH-11, 0, 0, 0, 0,0,0,0}, /* 1*/{DI_VTEXT, dW/2, 0, dW/2,dH-10, 0, 0, 0, DIF_SEPARATOR2,0,0,0}, /* 2*/{DI_TEXT, -1,dH-10, 0, 0, 0, 0, 0, DIF_SEPARATOR2,0,0,0}, /* 3*/{DI_DOUBLEBOX, 0, 0, dW, dH, 0, 0, 0, 0,0,0,0}, // инфо /* 4*/{DI_TEXT, 0, dH-9, 0, 0, 0, 0, 0, 0,pLPPI->AlternateFileName,0,0}, /* 5*/{DI_TEXT, 0, dH-8, 0, 0, 0, 0, 0, 0,0,0,0}, // mp3-трек /* 6*/{DI_TEXT, 0, dH-7, 18, 0, 0, 0, 0, 0,itoaa(pLPPI->FileSize,LSize),0,0}, /* 7*/{DI_TEXT, 19, dH-7, 38, 0, 0, 0, 0, 0,GetStrFileTime(&pLPPI->LastWriteTime,LTime),0,0}, /* 8*/{DI_TEXT, 39, dH-7, dW-1, 0, 0, 0, 0, 0,0,0,0}, // разрешение/длительность/... /* 9*/{DI_TEXT, -1, dH-6, 0, 0, 0, 0, 0, DIF_SEPARATOR,0,0,0}, // инфо /*10*/{DI_TEXT, 0, dH-5, 18, 0, 0, 0, 0, 0,itoaa(pRPPI->FileSize,RSize),0,0}, /*11*/{DI_TEXT, 19, dH-5, 38, 0, 0, 0, 0, 0,GetStrFileTime(&pRPPI->LastWriteTime,RTime),0,0}, /*12*/{DI_TEXT, 39, dH-5, dW-1, 0, 0, 0, 0, 0,0,0,0}, // разрешение/длительность/... /*13*/{DI_TEXT, 0, dH-4, 0, 0, 0, 0, 0, 0,0,0,0}, // mp3-трек /*14*/{DI_TEXT, 0, dH-3, 0, 0, 0, 0, 0, 0,pRPPI->AlternateFileName,0,0}, /*15*/{DI_TEXT, -1, dH-2, 0, 0, 0, 0, 0, DIF_SEPARATOR,0,0,0}, /*16*/{DI_BUTTON, 0, dH-1, 0, 0, 0, 0, 0, DIF_DEFAULTBUTTON|DIF_CENTERGROUP,GetMsg(MSkip),0,0}, /*17*/{DI_BUTTON, 0, dH-1, 0, 0, 0, 0, 0, DIF_CENTERGROUP,GetMsg(MDelLeft),0,0}, /*18*/{DI_BUTTON, 0, dH-1, 0, 0, 0, 0, 0, DIF_CENTERGROUP,GetMsg(MDelRight),0,0}, /*19*/{DI_BUTTON, 0, dH-1, 0, 0, 0, 0, 0, DIF_CENTERGROUP,GetMsg(MCancel),0,0} }; FAR_CHAR_INFO *VirtualBuffer=NULL; if (bShowImage) { FarColor Color; Info.AdvControl(&MainGuid,ACTL_GETCOLOR,COL_PANELTEXT,&Color); unsigned int VBufSize=(dW-1)*(dH-11); VirtualBuffer=(FAR_CHAR_INFO *)malloc(VBufSize*sizeof(FAR_CHAR_INFO)); if (VirtualBuffer) { DialogItems[0].VBuf=VirtualBuffer; for(int i=0;i<VBufSize;i++) { VirtualBuffer[i].Char=L' '; VirtualBuffer[i].Attributes=Color; } } } HANDLE hDlg=Info.DialogInit(&MainGuid,&CurDlgGuid,-1,-1,dW,dH,NULL,DialogItems, sizeof(DialogItems)/sizeof(DialogItems[0]),0,FDLG_SMALLDIALOG|FDLG_NODRAWSHADOW,ShowCmpCurDialogProc,&CmpPic); if (hDlg != INVALID_HANDLE_VALUE) { Info.DialogRun(hDlg); Info.DialogFree(hDlg); } if (VirtualBuffer) free(VirtualBuffer); return true; } #endif bool AdvCmpProc::CompareCurFile(const wchar_t* LDir, const wchar_t* LFileName, const wchar_t* RDir, const wchar_t* RFileName, int Method) { string strLFullFileName, strRFullFileName; GetFullFileName(strLFullFileName, LDir, LFileName); GetFullFileName(strRFullFileName, RDir, RFileName); WIN32_FIND_DATA LWFD, RWFD; if (!FileExists(strLFullFileName.get(), LWFD, 0) || !FileExists(strRFullFileName.get(), RWFD, 0)) return false; PluginPanelItem LPPI = {}, RPPI = {}; WFD2PPI(LWFD, LPPI); WFD2PPI(RWFD, RPPI); string strCommand; strCommand.get(32768); STARTUPINFO si; PROCESS_INFORMATION pi; WIN32_FIND_DATA wfdFindData; HANDLE hFind; wchar_t DiffProgram[MAX_PATH]; ExpandEnvironmentStringsW(Opt.WinMergePath, DiffProgram, (sizeof(DiffProgram) / sizeof(DiffProgram[0]))); bool bFindDiffProg = ((hFind = FindFirstFileW(DiffProgram, &wfdFindData)) != INVALID_HANDLE_VALUE); if (!bFindDiffProg) { ExpandEnvironmentStringsW(L"%ProgramFiles%\\WinMerge\\WinMergeU.exe", DiffProgram, (sizeof(DiffProgram) / sizeof(DiffProgram[0]))); bFindDiffProg = ((hFind = FindFirstFileW(DiffProgram, &wfdFindData)) != INVALID_HANDLE_VALUE); } if (bFindDiffProg) { FindClose(hFind); memset(&si, 0, sizeof(si)); memset(&pi, 0, sizeof(pi)); si.cb = sizeof(si); FSF.sprintf(strCommand.get(), L"\"%s\" -e \"%s\" \"%s\"", DiffProgram, GetPosToName(strLFullFileName.get()), GetPosToName(strRFullFileName.get())); strCommand.updsize(); } if (Method) // перебираем всё { bool bImage = false; bool bVisCmp = (pCompareFiles && GetModuleHandleW(L"VisComp.dll")); if (bGflLoaded) { CmpPic.L.FileName = strLFullFileName.get(); CmpPic.R.FileName = strRFullFileName.get(); CmpPic.L.DrawRect.left = 1; CmpPic.R.DrawRect.left = WinInfo.Con.Right / 2 + 2; CmpPic.L.DrawRect.top = CmpPic.R.DrawRect.top = 1; CmpPic.L.DrawRect.right = WinInfo.Con.Right / 2 - 1; CmpPic.R.DrawRect.right = WinInfo.Con.Right - 1; CmpPic.L.DrawRect.bottom = CmpPic.R.DrawRect.bottom = WinInfo.Con.Bottom - WinInfo.Con.Top - 2 - 2; CmpPic.L.FirstRun = CmpPic.R.FirstRun = true; CmpPic.L.Redraw = CmpPic.R.Redraw = false; CmpPic.L.Loaded = CmpPic.R.Loaded = false; BITMAPINFOHEADER BmpHeader1, BmpHeader2; CmpPic.L.BmpHeader = &BmpHeader1; CmpPic.R.BmpHeader = &BmpHeader2; CmpPic.L.DibData = CmpPic.R.DibData = NULL; GFL_FILE_INFORMATION pic_info1, pic_info2; CmpPic.L.pic_info = &pic_info1; CmpPic.R.pic_info = &pic_info2; CmpPic.L.Page = CmpPic.R.Page = 1; CmpPic.L.Rotate = CmpPic.R.Rotate = 0; bImage = (UpdateImage(&CmpPic.L, true) && UpdateImage(&CmpPic.R, true)); } struct FarMenuItem MenuItems[4]; memset(MenuItems, 0, sizeof(MenuItems)); MenuItems[0].Text = GetMsg(MDefault); MenuItems[1].Text = GetMsg(MWinMerge); MenuItems[2].Text = GetMsg(MPictures); MenuItems[3].Text = GetMsg(MVisCmp); if (!bVisCmp) MenuItems[3].Flags |= MIF_GRAYED; if (!bFindDiffProg) MenuItems[1].Flags |= MIF_GRAYED; if (!bImage) MenuItems[2].Flags |= MIF_GRAYED; if (bImage) MenuItems[2].Flags |= MIF_SELECTED; else if (bVisCmp) MenuItems[3].Flags |= MIF_SELECTED; int MenuCode = Info.Menu(&MainGuid, &CmpMethodMenuGuid, -1, -1, 0, FMENU_AUTOHIGHLIGHT | FMENU_WRAPMODE, GetMsg(MMethod), NULL, L"Contents", NULL, NULL, MenuItems, sizeof(MenuItems) / sizeof(MenuItems[0])); if (MenuCode == 0) { bool bDifferenceNotFound; Opt.TotalProgress = 0; if (Opt.CmpCase || Opt.CmpSize || Opt.CmpTime || Opt.CmpContents) { bDifferenceNotFound = CompareFiles(LDir, &LPPI, RDir, &RPPI, 0, 0); } else bDifferenceNotFound = !FSF.LStricmp(LFileName, RFileName); Info.PanelControl(LPanel.hPanel, FCTL_REDRAWPANEL, 0, 0); Info.PanelControl(RPanel.hPanel, FCTL_REDRAWPANEL, 0, 0); const wchar_t* MsgItems[] = {GetMsg(bDifferenceNotFound ? MNoDiffTitle : MFirstDiffTitle), GetPosToName(strLFullFileName.get()), GetPosToName(strRFullFileName.get()), GetMsg(MOK)}; Info.Message(&MainGuid, &CompareCurFileMsgGuid, bDifferenceNotFound ? 0 : FMSG_WARNING, 0, MsgItems, sizeof(MsgItems) / sizeof(MsgItems[0]), 1); } else if (MenuCode == 1 && bFindDiffProg) { if (CreateProcess(0, strCommand.get(), 0, 0, false, 0, 0, 0, &si, &pi)) { WaitForSingleObject(pi.hProcess, INFINITE); CloseHandle(pi.hProcess); CloseHandle(pi.hThread); } } else if (MenuCode == 2 && bImage) // ShowCmpCurDialog(&LPPI,&RPPI); ; else if (MenuCode == 3 && bVisCmp) pCompareFiles(strLFullFileName.get(), strRFullFileName.get(), 0); if (LPPI.FileName) free((void*) LPPI.FileName); if (RPPI.FileName) free((void*) RPPI.FileName); if (bGflLoaded) { FreeImage(&CmpPic.L); FreeImage(&CmpPic.R); } } else if (bFindDiffProg) // WinMerge { if (CreateProcess(0, strCommand.get(), 0, 0, false, 0, 0, 0, &si, &pi)) { WaitForSingleObject(pi.hProcess, INFINITE); CloseHandle(pi.hProcess); CloseHandle(pi.hThread); } } return true; }
35.217305
159
0.545044
FarPlugins
796aa03fe3dcccda61d9ae14f2afbd5bf64e3eef
9,496
hpp
C++
include/HoudiniEngineUnity/HEU_HandleParamBinding.hpp
RedBrumbler/BeatSaber-Quest-Codegen
73dda50b5a3e51f10d86b766dcaa24b0c6226e25
[ "Unlicense" ]
null
null
null
include/HoudiniEngineUnity/HEU_HandleParamBinding.hpp
RedBrumbler/BeatSaber-Quest-Codegen
73dda50b5a3e51f10d86b766dcaa24b0c6226e25
[ "Unlicense" ]
null
null
null
include/HoudiniEngineUnity/HEU_HandleParamBinding.hpp
RedBrumbler/BeatSaber-Quest-Codegen
73dda50b5a3e51f10d86b766dcaa24b0c6226e25
[ "Unlicense" ]
null
null
null
// Autogenerated from CppHeaderCreator // Created by Sc2ad // ========================================================================= #pragma once // Begin includes #include "beatsaber-hook/shared/utils/typedefs.h" #include "beatsaber-hook/shared/utils/byref.hpp" // Including type: HoudiniEngineUnity.IEquivable`1 #include "HoudiniEngineUnity/IEquivable_1.hpp" // Including type: System.Enum #include "System/Enum.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils-properties.hpp" #include "beatsaber-hook/shared/utils/il2cpp-utils-fields.hpp" #include "beatsaber-hook/shared/utils/utils.h" #include "beatsaber-hook/shared/utils/typedefs-array.hpp" #include "beatsaber-hook/shared/utils/typedefs-string.hpp" // Completed includes // Type namespace: HoudiniEngineUnity namespace HoudiniEngineUnity { // Forward declaring type: HEU_HandleParamBinding class HEU_HandleParamBinding; } #include "beatsaber-hook/shared/utils/il2cpp-type-check.hpp" NEED_NO_BOX(::HoudiniEngineUnity::HEU_HandleParamBinding); DEFINE_IL2CPP_ARG_TYPE(::HoudiniEngineUnity::HEU_HandleParamBinding*, "HoudiniEngineUnity", "HEU_HandleParamBinding"); // Type namespace: HoudiniEngineUnity namespace HoudiniEngineUnity { // Size: 0x30 #pragma pack(push, 1) // Autogenerated type: HoudiniEngineUnity.HEU_HandleParamBinding // [TokenAttribute] Offset: FFFFFFFF class HEU_HandleParamBinding : public ::Il2CppObject/*, public ::HoudiniEngineUnity::IEquivable_1<::HoudiniEngineUnity::HEU_HandleParamBinding*>*/ { public: // Nested type: ::HoudiniEngineUnity::HEU_HandleParamBinding::HEU_HandleParamType struct HEU_HandleParamType; // Size: 0x4 #pragma pack(push, 1) // Autogenerated type: HoudiniEngineUnity.HEU_HandleParamBinding/HoudiniEngineUnity.HEU_HandleParamType // [TokenAttribute] Offset: FFFFFFFF struct HEU_HandleParamType/*, public ::System::Enum*/ { public: public: // public System.Int32 value__ // Size: 0x4 // Offset: 0x0 int value; // Field size check static_assert(sizeof(int) == 0x4); public: // Creating value type constructor for type: HEU_HandleParamType constexpr HEU_HandleParamType(int value_ = {}) noexcept : value{value_} {} // Creating interface conversion operator: operator ::System::Enum operator ::System::Enum() noexcept { return *reinterpret_cast<::System::Enum*>(this); } // Creating conversion operator: operator int constexpr operator int() const noexcept { return value; } // static field const value: static public HoudiniEngineUnity.HEU_HandleParamBinding/HoudiniEngineUnity.HEU_HandleParamType TRANSLATE static constexpr const int TRANSLATE = 0; // Get static field: static public HoudiniEngineUnity.HEU_HandleParamBinding/HoudiniEngineUnity.HEU_HandleParamType TRANSLATE static ::HoudiniEngineUnity::HEU_HandleParamBinding::HEU_HandleParamType _get_TRANSLATE(); // Set static field: static public HoudiniEngineUnity.HEU_HandleParamBinding/HoudiniEngineUnity.HEU_HandleParamType TRANSLATE static void _set_TRANSLATE(::HoudiniEngineUnity::HEU_HandleParamBinding::HEU_HandleParamType value); // static field const value: static public HoudiniEngineUnity.HEU_HandleParamBinding/HoudiniEngineUnity.HEU_HandleParamType ROTATE static constexpr const int ROTATE = 1; // Get static field: static public HoudiniEngineUnity.HEU_HandleParamBinding/HoudiniEngineUnity.HEU_HandleParamType ROTATE static ::HoudiniEngineUnity::HEU_HandleParamBinding::HEU_HandleParamType _get_ROTATE(); // Set static field: static public HoudiniEngineUnity.HEU_HandleParamBinding/HoudiniEngineUnity.HEU_HandleParamType ROTATE static void _set_ROTATE(::HoudiniEngineUnity::HEU_HandleParamBinding::HEU_HandleParamType value); // static field const value: static public HoudiniEngineUnity.HEU_HandleParamBinding/HoudiniEngineUnity.HEU_HandleParamType SCALE static constexpr const int SCALE = 2; // Get static field: static public HoudiniEngineUnity.HEU_HandleParamBinding/HoudiniEngineUnity.HEU_HandleParamType SCALE static ::HoudiniEngineUnity::HEU_HandleParamBinding::HEU_HandleParamType _get_SCALE(); // Set static field: static public HoudiniEngineUnity.HEU_HandleParamBinding/HoudiniEngineUnity.HEU_HandleParamType SCALE static void _set_SCALE(::HoudiniEngineUnity::HEU_HandleParamBinding::HEU_HandleParamType value); // Get instance field reference: public System.Int32 value__ int& dyn_value__(); }; // HoudiniEngineUnity.HEU_HandleParamBinding/HoudiniEngineUnity.HEU_HandleParamType #pragma pack(pop) static check_size<sizeof(HEU_HandleParamBinding::HEU_HandleParamType), 0 + sizeof(int)> __HoudiniEngineUnity_HEU_HandleParamBinding_HEU_HandleParamTypeSizeCheck; static_assert(sizeof(HEU_HandleParamBinding::HEU_HandleParamType) == 0x4); #ifdef USE_CODEGEN_FIELDS public: #else #ifdef CODEGEN_FIELD_ACCESSIBILITY CODEGEN_FIELD_ACCESSIBILITY: #else protected: #endif #endif // public HoudiniEngineUnity.HEU_HandleParamBinding/HoudiniEngineUnity.HEU_HandleParamType _paramType // Size: 0x4 // Offset: 0x10 ::HoudiniEngineUnity::HEU_HandleParamBinding::HEU_HandleParamType paramType; // Field size check static_assert(sizeof(::HoudiniEngineUnity::HEU_HandleParamBinding::HEU_HandleParamType) == 0x4); // public System.Int32 _parmID // Size: 0x4 // Offset: 0x14 int parmID; // Field size check static_assert(sizeof(int) == 0x4); // public System.String _paramName // Size: 0x8 // Offset: 0x18 ::StringW paramName; // Field size check static_assert(sizeof(::StringW) == 0x8); // public System.Boolean _bDisabled // Size: 0x1 // Offset: 0x20 bool bDisabled; // Field size check static_assert(sizeof(bool) == 0x1); // Padding between fields: bDisabled and: boundChannels char __padding3[0x7] = {}; // public System.Boolean[] _boundChannels // Size: 0x8 // Offset: 0x28 ::ArrayW<bool> boundChannels; // Field size check static_assert(sizeof(::ArrayW<bool>) == 0x8); public: // Creating interface conversion operator: operator ::HoudiniEngineUnity::IEquivable_1<::HoudiniEngineUnity::HEU_HandleParamBinding*> operator ::HoudiniEngineUnity::IEquivable_1<::HoudiniEngineUnity::HEU_HandleParamBinding*>() noexcept { return *reinterpret_cast<::HoudiniEngineUnity::IEquivable_1<::HoudiniEngineUnity::HEU_HandleParamBinding*>*>(this); } // Get instance field reference: public HoudiniEngineUnity.HEU_HandleParamBinding/HoudiniEngineUnity.HEU_HandleParamType _paramType ::HoudiniEngineUnity::HEU_HandleParamBinding::HEU_HandleParamType& dyn__paramType(); // Get instance field reference: public System.Int32 _parmID int& dyn__parmID(); // Get instance field reference: public System.String _paramName ::StringW& dyn__paramName(); // Get instance field reference: public System.Boolean _bDisabled bool& dyn__bDisabled(); // Get instance field reference: public System.Boolean[] _boundChannels ::ArrayW<bool>& dyn__boundChannels(); // public System.Boolean IsEquivalentTo(HoudiniEngineUnity.HEU_HandleParamBinding other) // Offset: 0x18E2944 bool IsEquivalentTo(::HoudiniEngineUnity::HEU_HandleParamBinding* other); // public System.Void .ctor() // Offset: 0x18E185C // Implemented from: System.Object // Base method: System.Void Object::.ctor() template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary> static HEU_HandleParamBinding* New_ctor() { static auto ___internal__logger = ::Logger::get().WithContext("::HoudiniEngineUnity::HEU_HandleParamBinding::.ctor"); return THROW_UNLESS((::il2cpp_utils::New<HEU_HandleParamBinding*, creationType>())); } }; // HoudiniEngineUnity.HEU_HandleParamBinding #pragma pack(pop) static check_size<sizeof(HEU_HandleParamBinding), 40 + sizeof(::ArrayW<bool>)> __HoudiniEngineUnity_HEU_HandleParamBindingSizeCheck; static_assert(sizeof(HEU_HandleParamBinding) == 0x30); } #include "beatsaber-hook/shared/utils/il2cpp-type-check.hpp" DEFINE_IL2CPP_ARG_TYPE(::HoudiniEngineUnity::HEU_HandleParamBinding::HEU_HandleParamType, "HoudiniEngineUnity", "HEU_HandleParamBinding/HEU_HandleParamType"); #include "beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp" // Writing MetadataGetter for method: HoudiniEngineUnity::HEU_HandleParamBinding::IsEquivalentTo // Il2CppName: IsEquivalentTo template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<bool (HoudiniEngineUnity::HEU_HandleParamBinding::*)(::HoudiniEngineUnity::HEU_HandleParamBinding*)>(&HoudiniEngineUnity::HEU_HandleParamBinding::IsEquivalentTo)> { static const MethodInfo* get() { static auto* other = &::il2cpp_utils::GetClassFromName("HoudiniEngineUnity", "HEU_HandleParamBinding")->byval_arg; return ::il2cpp_utils::FindMethod(classof(HoudiniEngineUnity::HEU_HandleParamBinding*), "IsEquivalentTo", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{other}); } }; // Writing MetadataGetter for method: HoudiniEngineUnity::HEU_HandleParamBinding::New_ctor // Il2CppName: .ctor // Cannot get method pointer of value based method overload from template for constructor! // Try using FindMethod instead!
54.574713
233
0.760531
RedBrumbler
796aaf1229fc37e7335cca05666c6c6e8e1935fa
9,377
cpp
C++
CMinus/CMinus/type/type_object.cpp
benbraide/CMinusMinus
6e32b825f192634538b3adde6ca579a548ca3f7e
[ "MIT" ]
null
null
null
CMinus/CMinus/type/type_object.cpp
benbraide/CMinusMinus
6e32b825f192634538b3adde6ca579a548ca3f7e
[ "MIT" ]
null
null
null
CMinus/CMinus/type/type_object.cpp
benbraide/CMinusMinus
6e32b825f192634538b3adde6ca579a548ca3f7e
[ "MIT" ]
null
null
null
#include "../node/node_object.h" #include "../storage/global_storage.h" #include "../evaluator/initializer.h" #include "../evaluator/evaluator_object.h" #include "class_type.h" #include "primitive_type.h" cminus::type::object::object(const std::string &name, storage::object *parent) : name_(name), parent_(parent){} cminus::type::object::~object() = default; const std::string &cminus::type::object::get_name() const{ return name_; } std::string cminus::type::object::get_qname() const{ return ((parent_ == nullptr) ? name_ : (parent_->get_qname() + "::" + name_)); } cminus::storage::object *cminus::type::object::get_parent() const{ return parent_; } void cminus::type::object::construct(std::shared_ptr<memory::reference> target, std::shared_ptr<node::object> initialization) const{ if (initialization != nullptr){ std::vector<std::shared_ptr<memory::reference>> args; args.reserve(initialization->get_list_count()); initialization->traverse_list([&](const node::object &entry){ args.push_back(entry.evaluate()); }); construct_(target, args); } else//No initialization construct(target, std::vector<std::shared_ptr<memory::reference>>{}); } void cminus::type::object::construct(std::shared_ptr<memory::reference> target, const std::vector<std::shared_ptr<memory::reference>> &initialization) const{ if (initialization.empty()){ if (auto default_value = get_default_value(); default_value == nullptr) construct_(target, std::vector<std::shared_ptr<memory::reference>>{}); else construct_(target, std::vector<std::shared_ptr<memory::reference>>{ default_value }); } else construct_(target, initialization); } void cminus::type::object::construct(std::shared_ptr<memory::reference> target, std::shared_ptr<memory::reference> initialization) const{ if (initialization == nullptr) construct(target, std::vector<std::shared_ptr<memory::reference>>{}); else construct_(target, std::vector<std::shared_ptr<memory::reference>>{ initialization }); } void cminus::type::object::construct(std::shared_ptr<memory::reference> target) const{ construct(target, std::vector<std::shared_ptr<memory::reference>>{}); } void cminus::type::object::destruct(std::shared_ptr<memory::reference> target) const{} std::shared_ptr<cminus::memory::reference> cminus::type::object::get_default_value() const{ return runtime::object::global_storage->get_zero_value(*this); } std::size_t cminus::type::object::get_memory_size() const{ return get_size(); } bool cminus::type::object::is_exact(const object &target) const{ return (target.remove_proxy() == this || is_exact_(target)); } int cminus::type::object::get_score(const object &target, bool is_lval, bool is_const) const{ auto is_ref_target = target.is_ref(); auto is_const_target = target.is_const(); if (is_ref_target && !is_const_target && (!is_lval || is_const)) return get_score_value(score_result_type::nil); auto base_target = target.remove_const_ref(); if (target.is<auto_primitive>() || base_target->can_be_inferred_from(*this)) return get_score_value(score_result_type::inferable, ((is_const_target == is_const) ? 0 : -1)); if (remove_const_ref()->is_exact(*base_target)) return get_score_value(score_result_type::exact, ((is_const_target == is_const) ? 0 : -1)); if (is_ref_target && !is_const_target)//No conversions return get_no_conversion_score_(target, is_lval, is_const); if ((runtime::object::state & runtime::flags::ignore_constructible) == 0u){ if (auto class_target = target.as<class_>(); class_target != nullptr && class_target->is_constructible_from(*this, is_lval, is_const)) return get_score_value(score_result_type::class_compatible, ((is_const_target == is_const) ? 0 : -1)); } auto result = get_score_(target, is_lval, is_const); if (result == get_score_value(score_result_type::nil)) return result; return (result + ((is_const_target == is_const) ? 0 : -1)); } std::shared_ptr<cminus::memory::reference> cminus::type::object::cast(std::shared_ptr<memory::reference> data, std::shared_ptr<object> target_type, cast_type type) const{ return ((type == cast_type::static_rval && is_exact(*target_type->remove_const_ref())) ? data : cast_(data, target_type, type)); } std::shared_ptr<cminus::memory::reference> cminus::type::object::begin(std::shared_ptr<memory::reference> data) const{ return nullptr; } std::shared_ptr<cminus::memory::reference> cminus::type::object::rbegin(std::shared_ptr<memory::reference> data) const{ return nullptr; } std::shared_ptr<cminus::memory::reference> cminus::type::object::end(std::shared_ptr<memory::reference> data) const{ return nullptr; } std::shared_ptr<cminus::memory::reference> cminus::type::object::rend(std::shared_ptr<memory::reference> data) const{ return nullptr; } std::shared_ptr<cminus::evaluator::object> cminus::type::object::get_evaluator() const{ return runtime::object::global_storage->get_evaluator(evaluator::object::id_type::nil); } std::shared_ptr<cminus::evaluator::initializer> cminus::type::object::get_initializer() const{ return runtime::object::global_storage->get_default_initializer(); } std::shared_ptr<cminus::type::object> cminus::type::object::get_inferred(std::shared_ptr<object> target) const{ return nullptr; } const cminus::type::object *cminus::type::object::remove_proxy() const{ return this; } const cminus::type::object *cminus::type::object::remove_const_ref() const{ return this; } std::shared_ptr<cminus::type::object> cminus::type::object::remove_const_ref(std::shared_ptr<object> self) const{ return self; } bool cminus::type::object::is_default_constructible(bool ignore_callable) const{ return true; } bool cminus::type::object::is_copy_constructible(bool ignore_callable) const{ return true; } bool cminus::type::object::is_copy_assignable(bool ignore_callable) const{ return true; } bool cminus::type::object::is_forward_traversable() const{ return false; } bool cminus::type::object::is_reverse_traversable() const{ return false; } bool cminus::type::object::can_be_inferred_from(const object &target) const{ return false; } bool cminus::type::object::is_inferred() const{ return false; } bool cminus::type::object::is_const() const{ return false; } bool cminus::type::object::is_ref() const{ return false; } std::shared_ptr<cminus::memory::reference> cminus::type::object::copy_data(std::shared_ptr<memory::reference> data, std::shared_ptr<object> target_type){ auto copy = std::make_shared<memory::rval_reference>(target_type->remove_const_ref(target_type)); if (copy == nullptr) throw memory::exception::allocation_failure(); try{ copy->get_type()->construct(copy, data); } catch (const declaration::exception::function_not_found &){ throw runtime::exception::copy_failure(); } catch (const declaration::exception::function_not_defined &){ throw runtime::exception::copy_failure(); } return copy; } int cminus::type::object::get_score_value(score_result_type score, int offset){ switch (score){ case score_result_type::exact: return (100 + offset); case score_result_type::inferable: return (80 + offset); case score_result_type::assignable: return (50 + offset); case score_result_type::compatible: return (30 + offset); case score_result_type::ancestor: case score_result_type::class_compatible: return (20 + offset); default: break; } return 0; } bool cminus::type::object::is_static_cast(cast_type type){ switch (type){ case cast_type::static_: case cast_type::static_ref: case cast_type::static_const_ref: case cast_type::static_rval: return true; default: break; } return false; } bool cminus::type::object::is_static_rval_cast(cast_type type){ switch (type){ case cast_type::static_: case cast_type::static_const_ref: case cast_type::static_rval: return true; default: break; } return false; } bool cminus::type::object::is_ref_cast(cast_type type){ switch (type){ case cast_type::static_ref: case cast_type::static_const_ref: case cast_type::dynamic_ref: case cast_type::dynamic_const_ref: return true; default: break; } return false; } bool cminus::type::object::is_non_const_ref_cast(cast_type type){ switch (type){ case cast_type::static_ref: case cast_type::dynamic_ref: return true; default: break; } return false; } bool cminus::type::object::is_valid_static_cast(cast_type type, bool is_lval, bool is_const){ return (is_static_cast(type) && (!is_non_const_ref_cast(type) || (is_lval && !is_const))); } void cminus::type::object::construct_(std::shared_ptr<memory::reference> target, const std::vector<std::shared_ptr<memory::reference>> &args) const{ if (!args.empty()) get_initializer()->initialize(target, *args.rbegin()); else throw declaration::exception::initialization_required(); } bool cminus::type::object::is_exact_(const object &target) const{ return false; } int cminus::type::object::get_score_(const object &target, bool is_lval, bool is_const) const{ return get_score_value(score_result_type::nil); } int cminus::type::object::get_no_conversion_score_(const object &target, bool is_lval, bool is_const) const{ return get_score_value(score_result_type::nil); } std::shared_ptr<cminus::memory::reference> cminus::type::object::cast_(std::shared_ptr<memory::reference> data, std::shared_ptr<object> target_type, cast_type type) const{ return nullptr; }
30.845395
171
0.743948
benbraide
7970282347f5360f8a46d77d47cebe6e07d9675e
584
cpp
C++
PKU/Introduction to Calculation A/Homework/5-Phrase_1_Coding_Practice_(3)/5-2-no_of_4digits_num_satisfy_condition.cpp
sailinglove/personal-general
b2e932dcd7989bdf856d4852e38f96cbbfc9c907
[ "MIT" ]
1
2020-06-19T11:47:23.000Z
2020-06-19T11:47:23.000Z
PKU/Introduction to Calculation A/Homework/5-Phrase_1_Coding_Practice_(3)/5-2-no_of_4digits_num_satisfy_condition.cpp
sailinglove/personal-general
b2e932dcd7989bdf856d4852e38f96cbbfc9c907
[ "MIT" ]
null
null
null
PKU/Introduction to Calculation A/Homework/5-Phrase_1_Coding_Practice_(3)/5-2-no_of_4digits_num_satisfy_condition.cpp
sailinglove/personal-general
b2e932dcd7989bdf856d4852e38f96cbbfc9c907
[ "MIT" ]
null
null
null
#include<iostream> using namespace std; int main() { int num = 0, sum = 0; cin >> num; int array[32] = {0}; for (int i = 0; i < num; i++) { cin >> array[i]; } int thousands = 0, hundreds = 0, tens = 0; for (int i = 0; i < num; i++) { thousands = array[i] / 1000; array[i] %= 1000; hundreds = array[i] / 100; array[i] %= 100; tens = array[i] / 10; array[i] %= 10; if ((array[i] - thousands - hundreds - tens) > 0) { sum++; } } cout << sum; return 0; }
22.461538
59
0.429795
sailinglove
7971bc9a6662e77d376e350801981e9b77f8e166
701
cpp
C++
Qt/1/44_qundoview/command.cpp
alientek-openedv/Embedded-Qt-Tutorial
3c75142235b4d39c22e1ad56a5bd92d08c1a0d42
[ "MIT" ]
1
2022-02-21T03:19:36.000Z
2022-02-21T03:19:36.000Z
Qt/1/44_qundoview/command.cpp
alientek-openedv/Embedded-Qt-Tutorial
3c75142235b4d39c22e1ad56a5bd92d08c1a0d42
[ "MIT" ]
null
null
null
Qt/1/44_qundoview/command.cpp
alientek-openedv/Embedded-Qt-Tutorial
3c75142235b4d39c22e1ad56a5bd92d08c1a0d42
[ "MIT" ]
1
2021-10-19T04:03:56.000Z
2021-10-19T04:03:56.000Z
#include "command.h" #include <QDebug> addCommand::addCommand(int *value, QUndoCommand *parent) { /* 使用Q_UNUSED,避免未使用的数据类型 */ Q_UNUSED(parent); /* undoView显示的操作信息 */ setText("进行了加1操作"); /* value的地址赋值给new_count */ new_count = value; /* 让构造函数传过来的*new_count的值赋值给old_count */ old_count = *new_count; } /* 执行stack push时或者重做操作时会自动调用 */ void addCommand::redo() { /* 重新赋值给new_count */ *new_count = old_count; /* 打印出*new_count的值 */ qDebug()<<"redo:"<<*new_count<<endl; } /* 回撤操作时执行 */ void addCommand::undo() { /* 回撤操作每次应减一 */ (*new_count)--; /* 打印出*new_count的值 */ qDebug()<<"undo:"<<*new_count<<endl; } addCommand::~addCommand() { }
15.577778
56
0.616262
alientek-openedv
7974112d42495828b4d62405446e4d498f09aefa
1,127
cpp
C++
PC_Parcial_1/Parcial E.8/ADAPLANT.cpp
ElizabethYasmin/PC
e3cd03d7f80fae366df1181d5b87514ea8ee597c
[ "MIT" ]
null
null
null
PC_Parcial_1/Parcial E.8/ADAPLANT.cpp
ElizabethYasmin/PC
e3cd03d7f80fae366df1181d5b87514ea8ee597c
[ "MIT" ]
null
null
null
PC_Parcial_1/Parcial E.8/ADAPLANT.cpp
ElizabethYasmin/PC
e3cd03d7f80fae366df1181d5b87514ea8ee597c
[ "MIT" ]
null
null
null
#include <cstdio> #include <algorithm> #define MAXN 100010 using namespace std; const int INF = 1e9 + 1; int arvore[4*MAXN],vetor[MAXN],n; void build(int pos,int left,int right){ if(left == right){ arvore[pos] = vetor[left]; return; } int mid = (left + right)/2; build(2*pos,left,mid); build(2*pos+1,mid+1,right); arvore[pos] = min(arvore[2*pos],arvore[2*pos+1]); } int query(int pos,int left,int right,int i,int j){ if(left > right || left > j || right < i) return INF; if(left >= i && right <= j){ return arvore[pos]; } int mid = (left + right)/2; return min(query(2*pos,left,mid,i,j),query(2*pos+1,mid+1,right,i,j)); } //Entrada: //3 //5 0 //1 2 3 5 6 //4 6 //1 10 2 9 //10 1 //1 7 8 9 19 11 21 8 11 0 //Salida: //2 //9 //13 int main(){ int TC; scanf("%d",&TC); while(TC--){ int k; scanf("%d %d",&n,&k); for(int i=1;i<=n;i++){ scanf("%d",&vetor[i]); } int resp = 0; build(1,1,n); for(int i=1;i<=n;i++){ int menor = min(query(1,1,n,max(1,i - k - 1),max(i-1,1)), query(1,1,n,min(i+1,n),min(i+k+1,n))); resp = max(vetor[i] - menor,resp); } printf("%d\n",resp); } return 0; }
19.431034
99
0.570541
ElizabethYasmin
7979a594370db7520f2625c9eab9919298e59526
654
hpp
C++
test/StdUnorderedSetTester.hpp
andybui01/Bloom
20cc1bbb03f84c6f96a191f92e596013c9ac2da9
[ "MIT" ]
null
null
null
test/StdUnorderedSetTester.hpp
andybui01/Bloom
20cc1bbb03f84c6f96a191f92e596013c9ac2da9
[ "MIT" ]
null
null
null
test/StdUnorderedSetTester.hpp
andybui01/Bloom
20cc1bbb03f84c6f96a191f92e596013c9ac2da9
[ "MIT" ]
null
null
null
#ifndef TEST_STDUNORDEREDSETTESTER_HPP #define TEST_STDUNORDEREDSETTESTER_HPP #include <vector> #include <string> #include <unordered_set> #include "Tester.hpp" class StdUnorderedSetTester : public Tester { private: std::unordered_set<std::string> set; public: void insert_words(std::vector<std::string> insert_vec) { for (std::string &it: insert_vec) { set.insert(it); } } void check_words(std::vector<std::string> check_vec) { for (std::string &it: check_vec) { set.find(it); } } }; Tester *create_StdUnorderedSetTester() { return new StdUnorderedSetTester; } #endif
21.096774
60
0.665138
andybui01
797d0076aa32a4c6c064861da6620d03e30cabfe
592
cpp
C++
engine/kotek.core.defines.static.render.vk/src/main_core_defines_static_render_vk_dll.cpp
wh1t3lord/kotek
1e3eb61569974538661ad121ed8eb28c9e608ae6
[ "Apache-2.0" ]
null
null
null
engine/kotek.core.defines.static.render.vk/src/main_core_defines_static_render_vk_dll.cpp
wh1t3lord/kotek
1e3eb61569974538661ad121ed8eb28c9e608ae6
[ "Apache-2.0" ]
null
null
null
engine/kotek.core.defines.static.render.vk/src/main_core_defines_static_render_vk_dll.cpp
wh1t3lord/kotek
1e3eb61569974538661ad121ed8eb28c9e608ae6
[ "Apache-2.0" ]
null
null
null
#include "../include/kotek_core_defines_static_render_vk.h" namespace Kotek { namespace Core { bool InitializeModule_Core_Defines_Static_Render_Vulkan( ktkMainManager* p_manager) { return true; } bool ShutdownModule_Core_Defines_Static_Render_Vulkan( ktkMainManager* p_manager) { return true; } bool SerializeModule_Core_Defines_Static_Render_Vulkan( ktkMainManager* p_manager) { return true; } bool DeserializeModule_Core_Defines_Static_Render_Vulkan( ktkMainManager* p_manager) { return true; } } // namespace Core } // namespace Kotek
19.096774
59
0.760135
wh1t3lord
79816129fb95ffeb8cebc2ae22fd0f81a93f633b
6,886
cpp
C++
src/minami/so_routing.cpp
AlanPi1992/MAC-POSTS
4e4ed3bb6faa5ebd0aa5059b2dfff103fe8f1961
[ "MIT" ]
18
2017-03-02T20:12:11.000Z
2022-03-11T02:38:38.000Z
src/minami/so_routing.cpp
AlanPi1992/MAC-POSTS
4e4ed3bb6faa5ebd0aa5059b2dfff103fe8f1961
[ "MIT" ]
7
2019-02-26T04:11:49.000Z
2019-09-16T05:43:17.000Z
src/minami/so_routing.cpp
Lemma1/MAC-POSTS
7e3d0fe2d34a2f3d1edc8c33059e9c84868bd236
[ "MIT" ]
19
2017-08-18T04:11:25.000Z
2022-03-11T02:38:43.000Z
#include "routing.h" /************************************************************************** Pre determined Routing **************************************************************************/ MNM_Routing_Predetermined::MNM_Routing_Predetermined(PNEGraph &graph, MNM_OD_Factory *od_factory, MNM_Node_Factory *node_factory, MNM_Link_Factory *link_factory ,Path_Table *p_table, MNM_Pre_Routing *pre_routing, TInt max_int) : MNM_Routing::MNM_Routing(graph, od_factory, node_factory, link_factory){ m_tracker = std::unordered_map<MNM_Veh*, std::deque<TInt>*>(); m_path_table = p_table; m_pre_routing = pre_routing; m_total_assign_inter = max_int; } int MNM_Routing_Predetermined::init_routing(Path_Table *path_table) { // if (path_table == NULL){ // printf("Path table need to be set in Fixed routing.\n"); // exit(-1); // } // set_path_table(path_table); return 0; } MNM_Routing_Predetermined::~MNM_Routing_Predetermined() { for (auto _map_it : m_tracker){ _map_it.second -> clear(); delete _map_it.second; } m_tracker.clear(); // add by Xidong, for clearing the memory of path table if (m_path_table != NULL){ for (auto _it : *m_path_table){ for (auto _it_it : *(_it.second)){ delete _it_it.second; } _it.second -> clear(); delete _it.second; } m_path_table -> clear(); delete m_path_table; } } int MNM_Routing_Predetermined::update_routing(TInt timestamp){ // question: the releasing frequency of origin is not every assignment interval? TInt _release_freq = m_od_factory -> m_origin_map.begin() -> second -> m_frequency; MNM_Origin *_origin; MNM_DMOND *_origin_node; MNM_Destination *_destination; TInt _node_ID, _next_link_ID; MNM_Dlink *_next_link; MNM_Veh *_veh; MNM_Path *_route_path; TInt _ass_int = timestamp/_release_freq; if (timestamp % _release_freq ==0 ){ // need to register vehicles to m_tracker for (auto _origin_it = m_od_factory->m_origin_map.begin(); _origin_it != m_od_factory->m_origin_map.end(); _origin_it++){ _origin = _origin_it -> second; _origin_node = _origin -> m_origin_node; _node_ID = _origin_node -> m_node_ID; // here assume that the order of dest in veh deq is the same as in the mdemand of origin // this is ensured by the release function of Origin auto _demand_it = _origin -> m_demand.begin(); _destination = _demand_it -> first; TFlt _thisdemand = _demand_it ->second[_ass_int]; int _id_path = 0; TFlt _remain_demand = m_pre_routing -> routing_table -> find(_origin -> m_origin_node -> m_node_ID)-> second.find(_destination -> m_dest_node -> m_node_ID)->second.find(_id_path) -> second[_ass_int]; for (auto _veh_it = _origin_node -> m_in_veh_queue.begin(); _veh_it!=_origin_node -> m_in_veh_queue.end(); _veh_it++){ _veh = *_veh_it; if(_veh -> get_destination() != _destination &&_remain_demand<=0 ){ _destination = _veh -> get_destination(); _remain_demand = m_pre_routing -> routing_table -> find(_origin -> m_origin_node -> m_node_ID)-> second.find(_destination -> m_dest_node -> m_node_ID)->second.find(_id_path) -> second[_ass_int]; _thisdemand = _origin -> m_demand.find(_destination) -> second[_ass_int]; _id_path = 0; }else if(_remain_demand<=0 && _thisdemand > 0){ _id_path ++; std::cout << _id_path << "," <<_origin -> m_origin_node -> m_node_ID << "," << _destination -> m_dest_node -> m_node_ID << "," << std::endl; _remain_demand = m_pre_routing -> routing_table -> find(_origin -> m_origin_node -> m_node_ID)-> second.find(_destination -> m_dest_node -> m_node_ID)->second.find(_id_path) -> second[_ass_int]; }else if(_remain_demand >0 && _thisdemand <0){ std::cout<< "somthing wrong with the demand " <<std::endl; exit(1); } _thisdemand--; _remain_demand--; _route_path = m_path_table -> find(_veh -> get_origin() -> m_origin_node -> m_node_ID) -> second -> find(_veh -> get_destination() -> m_dest_node -> m_node_ID) -> second -> m_path_vec[_id_path]; std::deque<TInt> *_link_queue = new std::deque<TInt>(); std::copy(_route_path -> m_link_vec.begin(), _route_path -> m_link_vec.end(), std::back_inserter(*_link_queue)); m_tracker.insert(std::pair<MNM_Veh*, std::deque<TInt>*>(_veh, _link_queue)); } for (auto _veh_it = _origin_node -> m_in_veh_queue.begin(); _veh_it!=_origin_node -> m_in_veh_queue.end(); _veh_it++){ _veh = *_veh_it; _next_link_ID = m_tracker.find(_veh) -> second -> front(); _next_link = m_link_factory -> get_link(_next_link_ID); _veh -> set_next_link(_next_link); m_tracker.find(_veh) -> second -> pop_front(); // std::cout << "vehicle " << _veh->m_veh_ID<<" next link: " << _next_link ->m_link_ID <<std::endl; } } } // step 1: register vehilces in the Origin nodes to m_tracker, update their next link // step 2: update the next link of all vehicles in the last cell of links MNM_Destination *_veh_dest; MNM_Dlink *_link; for (auto _link_it = m_link_factory -> m_link_map.begin(); _link_it != m_link_factory -> m_link_map.end(); _link_it ++){ _link = _link_it -> second; _node_ID = _link -> m_to_node -> m_node_ID; // printf("2.1\n"); for (auto _veh_it = _link -> m_finished_array.begin(); _veh_it!=_link -> m_finished_array.end(); _veh_it++){ _veh = *_veh_it; _veh_dest = _veh -> get_destination(); // printf("2.2\n"); if (_veh_dest -> m_dest_node -> m_node_ID == _node_ID){ if (m_tracker.find(_veh) -> second -> size() != 0){ printf("Something wrong in fixed routing!\n"); exit(-1); } _veh -> set_next_link(NULL); // m_tracker.erase(m_tracker.find(_veh)); } else{ // printf("2.3\n"); if (m_tracker.find(_veh) == m_tracker.end()){ printf("Vehicle not registered in link, impossible!\n"); exit(-1); } if(_veh -> get_current_link() == _veh -> get_next_link()){ _next_link_ID = m_tracker.find(_veh) -> second -> front(); if (_next_link_ID == -1){ printf("Something wrong in routing, wrong next link 2\n"); printf("The node is %d, the vehicle should head to %d\n", (int)_node_ID, (int)_veh_dest -> m_dest_node -> m_node_ID); exit(-1); } _next_link = m_link_factory -> get_link(_next_link_ID); _veh -> set_next_link(_next_link); m_tracker.find(_veh) -> second -> pop_front(); } } } } return 0; }
40.034884
129
0.615452
AlanPi1992
7982d8a08bdb36fa2ff451f487c35e6603cf9251
6,065
cpp
C++
src/msix/pack/AppxBlockMapWriter.cpp
palenshus/msix-packaging
5883559c90f792f24e2237e9e4de10164548f2a2
[ "MIT" ]
486
2018-03-07T17:15:03.000Z
2019-05-06T20:05:44.000Z
src/msix/pack/AppxBlockMapWriter.cpp
palenshus/msix-packaging
5883559c90f792f24e2237e9e4de10164548f2a2
[ "MIT" ]
172
2019-05-14T18:56:36.000Z
2022-03-30T16:35:24.000Z
src/msix/pack/AppxBlockMapWriter.cpp
palenshus/msix-packaging
5883559c90f792f24e2237e9e4de10164548f2a2
[ "MIT" ]
83
2019-05-29T18:38:36.000Z
2022-03-17T07:34:16.000Z
// // Copyright (C) 2019 Microsoft. All rights reserved. // See LICENSE file in the project root for full license information. // #include "XmlWriter.hpp" #include "AppxBlockMapWriter.hpp" #include "StringHelper.hpp" #include <vector> namespace MSIX { /* <BlockMap HashMethod="http://www.w3.org/2001/04/xmlenc#sha256" xmlns="http://schemas.microsoft.com/appx/2010/blockmap" xmlns:b4="http://schemas.microsoft.com/appx/2021/blockmap" IgnorableNamespaces="b4"> <File Size="189440" Name="App1.exe" LfhSize="38"> <Block Size="29408" Hash="ORIk+3QF9mSpuOq51oT3Xqn0Gy0vcGbnBRn5lBg5irM="/> <Block Size="49487" Hash="BRIk+3QF9mSpuOq51oT3Xqn0jy0vcGbnBRn5lBg5irM="/> <Block Size="1487" Hash="CDIk+3QF9mSpuOq51oT3Xqn0jy0vcGbnBRn5lBg5iui="/> <b4:FileHash Hash="77hl7hZclsGViUCfuMMqsxsRNJW+PVnNblygNB2vxgE="/> </File> <File Size="1430" Name="Assets\LockScreenLogo.scale-200.png" LfhSize="65"> <Block Hash="pBoFOz/DsMEJcgzNQ3oZclrpFj6nWZAiKhK1lrnHynY="/> </File> ... */ static const char* blockMapElement = "BlockMap"; static const char* hashMethodAttribute = "HashMethod"; static const char* hashMethodAttributeValue = "http://www.w3.org/2001/04/xmlenc#sha256"; static const char* blockMapNamespace = "http://schemas.microsoft.com/appx/2010/blockmap"; static const char* blockMapNamespaceV4 = "http://schemas.microsoft.com/appx/2021/blockmap"; static const char* v4NamespacePrefix = "b4"; static const char* xmlnsAttributeV4 = "xmlns:b4"; static const char* ignorableNsAttribute = "IgnorableNamespaces"; static const char* fileElement = "File"; static const char* fileHashElementV4 = "b4:FileHash"; static const char* sizeAttribute = "Size"; static const char* nameAttribute = "Name"; static const char* lfhSizeAttribute = "LfhSize"; static const char* blockElement = "Block"; static const char* hashAttribute = "Hash"; // <BlockMap HashMethod="http://www.w3.org/2001/04/xmlenc#sha256" xmlns="http://schemas.microsoft.com/appx/2010/blockmap"> BlockMapWriter::BlockMapWriter() : m_xmlWriter(XmlWriter(blockMapElement)) { m_xmlWriter.AddAttribute(xmlnsAttribute, blockMapNamespace); // For now, we always use SHA256. m_xmlWriter.AddAttribute(hashMethodAttribute, hashMethodAttributeValue); } // Enable full file hash computation and create <b4:FileHash> element to the xml for files larger than DefaultBlockSize (64KB). // Must be called before first AddFile() is called to added the extra namesapce attribute to the <BlockMap> element so the resulted xml will be: // <BlockMap HashMethod="http://www.w3.org/2001/04/xmlenc#sha256" xmlns="http://schemas.microsoft.com/appx/2010/blockmap" // xmlns:b4 = "http://schemas.microsoft.com/appx/2021/blockmap" IgnorableNamespaces = "b4"> void BlockMapWriter::EnableFileHash() { m_enableFileHash = true; m_xmlWriter.AddAttribute(xmlnsAttributeV4, blockMapNamespaceV4); m_xmlWriter.AddAttribute(ignorableNsAttribute, v4NamespacePrefix); } // <File Size="18944" Name="App1.exe" LfhSize="38"> void BlockMapWriter::AddFile(const std::string& name, std::uint64_t uncompressedSize, std::uint32_t lfh) { // For the blockmap we always use the windows separator. std::string winName = Helper::toBackSlash(name); m_xmlWriter.StartElement(fileElement); m_xmlWriter.AddAttribute(nameAttribute, winName); m_xmlWriter.AddAttribute(sizeAttribute, std::to_string(uncompressedSize)); m_xmlWriter.AddAttribute(lfhSizeAttribute, std::to_string(lfh)); if (m_enableFileHash && (uncompressedSize > DefaultBlockSize)) { // If the file size is more than a block (64KB), we will add <FileHash> element after all the <Block> elements. // Otherwise, file hash is the same as the block hash, as there is only 1 block in the file. m_fileHashEngine.Reset(); m_addFileHash = true; } else { m_addFileHash = false; } } // <Block Size="2948" Hash="ORIk+3QF9mSpuOq51oT3Xqn0Gy0vcGbnBRn5lBg5irM="/> void BlockMapWriter::AddBlock(const std::vector<std::uint8_t>& block, ULONG size, bool isCompressed) { // hash block std::vector<std::uint8_t> hash; ThrowErrorIfNot(MSIX::Error::BlockMapInvalidData, MSIX::SHA256::ComputeHash(block.data(), static_cast<uint32_t>(block.size()), hash), "Failed computing hash"); m_xmlWriter.StartElement(blockElement); m_xmlWriter.AddAttribute(hashAttribute, Base64::ComputeBase64(hash)); // We only add the size attribute for compressed files, we cannot just check for the // size of the block because the last block is going to be smaller than the default. if(isCompressed) { m_xmlWriter.AddAttribute(sizeAttribute, std::to_string(size)); } m_xmlWriter.CloseElement(); if (m_addFileHash) { m_fileHashEngine.HashData(block.data(), static_cast<uint32_t>(block.size())); } } void BlockMapWriter::CloseFile() { if (m_addFileHash) { std::vector<std::uint8_t> hash; m_fileHashEngine.FinalizeAndGetHashValue(hash); // <b4:FileHash Hash="4EsIP4hU04SShLPR1KIiRBzuYpLVPcETqMp1HZaKdfc="/> m_xmlWriter.StartElement(fileHashElementV4); m_xmlWriter.AddAttribute(hashAttribute, Base64::ComputeBase64(hash)); m_xmlWriter.CloseElement(); } m_xmlWriter.CloseElement(); } void BlockMapWriter::Close() { m_xmlWriter.CloseElement(); ThrowErrorIf(Error::Unexpected, m_xmlWriter.GetState() != XmlWriter::Finish, "The blockmap didn't close correctly"); } }
44.925926
149
0.662325
palenshus
7985ad3ee126ec191ccc2f9055bf24c050a7af10
1,008
cpp
C++
openjudge/02/03/6262.cpp
TheBadZhang/OJ
b5407f2483aa630068343b412ecaf3a9e3303f7e
[ "Apache-2.0" ]
1
2020-07-22T16:54:07.000Z
2020-07-22T16:54:07.000Z
openjudge/02/03/6262.cpp
TheBadZhang/OJ
b5407f2483aa630068343b412ecaf3a9e3303f7e
[ "Apache-2.0" ]
1
2018-05-12T12:53:06.000Z
2018-05-12T12:53:06.000Z
openjudge/02/03/6262.cpp
TheBadZhang/OJ
b5407f2483aa630068343b412ecaf3a9e3303f7e
[ "Apache-2.0" ]
null
null
null
#include <cstdio> #include <iostream> int main () { char list [100][100]; char list2[100][100]; int n; scanf ("%d", &n); int d; for (int a = 0; a < n; a += 1) { scanf ("%c", &d); for (int b = 0; b < n; b += 1) scanf ("%c", &list [a][b]); } std::cin >> d; for (int f = 0; f < d-1; f += 1) { for (int a = 0; a < n; a += 1) for (int b = 0; b < n; b += 1) if (list [a][b] == '@') { if (list [a-1][b] != '#' && a-1 >= 0) list2 [a-1][b] = '@'; if (list [a+1][b] != '#' && a+1 <= n-1) list2 [a+1][b] = '@'; if (list [a][b-1] != '#' && b-1 >= 0) list2 [a][b-1] = '@'; if (list [a][b+1] != '#' && b+1 <= n-1) list2 [a][b+1] = '@'; } // 更新状态 for (int a = 0; a < n; a += 1) for (int b = 0; b < n; b += 1) if (list2 [a][b] == '@') list [a][b] = list2 [a][b]; // 拷贝数组 } int c = 0; for (int a = 0; a < n; a += 1) for (int b = 0; b < n; b += 1) if (list [a][b] == '@') c += 1; // 统计数量 printf ("%d", c); // 输出结果 return 0; }
21.913043
66
0.369048
TheBadZhang
7985bb529ecb9dde61be6dee805bd99363b5ea51
8,881
cpp
C++
examples/tartool/tartool.cpp
Vladimir-Lin/QtTAR
47a6757f5c072d9e0977658fbcc45be0471cb9b2
[ "MIT" ]
null
null
null
examples/tartool/tartool.cpp
Vladimir-Lin/QtTAR
47a6757f5c072d9e0977658fbcc45be0471cb9b2
[ "MIT" ]
null
null
null
examples/tartool/tartool.cpp
Vladimir-Lin/QtTAR
47a6757f5c072d9e0977658fbcc45be0471cb9b2
[ "MIT" ]
null
null
null
#include <QtCore> #include <QtTar> #if defined(Q_OS_WIN) #include <windows.h> #endif class TarBALL : public QtTarBall { public: explicit TarBALL (void) ; virtual ~TarBALL (void) ; protected: virtual bool Interval (void) ; virtual void Report (void * hiddenFileInfo) ; virtual bool setFileMode (QDir root,QIODevice & IO,void * hiddenFileInfo) ; private: } ; void nprintf(QString message,bool lf,bool cr) { QTextCodec * codec = QTextCodec::codecForLocale() ; QByteArray M = codec->fromUnicode(message) ; int L = M . size ( ) ; /////////////////////////////////////////////////// if ( L <= 0 ) { if (lf || cr) { char f [ 64 ] ; ::strcpy ( f , "" ) ; if (cr) ::strcat ( f , "\r" ) ; if (lf) ::strcat ( f , "\n" ) ; ::printf ( "%s" , f ) ; } ; return ; } ; /////////////////////////////////////////////////// char * p = new char[L+16] ; memset ( p , 0 , L+16 ) ; memcpy ( p , M.data() , L ) ; if (lf || cr) { char f [ 64 ] ; ::strcpy ( f , "" ) ; if (cr) ::strcat ( f , "\r" ) ; if (lf) ::strcat ( f , "\n" ) ; ::strcat ( p , f ) ; } ; ::printf ( "%s" , p ) ; delete [] p ; } TarBALL:: TarBALL (void) : QtTarBall ( ) { } TarBALL::~TarBALL (void) { } bool TarBALL::Interval(void) { return true ; } void TarBALL::Report(void * hiddenFileInfo) { HiddenFileInfo * hfi = (HiddenFileInfo *) hiddenFileInfo ; nprintf ( hfi -> Filename , true , true ) ; } bool TarBALL::setFileMode(QDir root,QIODevice & IO,void * hiddenFileInfo) { HiddenFileInfo * hfi = (HiddenFileInfo *) hiddenFileInfo ; return true ; } QStringList ToArgs(int argc,char ** argv) { QTextCodec * codec = QTextCodec::codecForLocale ( ) ; QStringList s ; for (int i = 0 ; i < argc ; i++ ) { s << codec -> toUnicode ( argv [ i ] ) ; } ; return s ; } bool LoadAll(QString filename,QByteArray & data) { QFile F ( filename ) ; if ( ! F . open ( QIODevice::ReadOnly ) ) return false ; data = F . readAll ( ) ; F . close ( ) ; return true ; } bool SaveAll(QString filename,QByteArray & data) { QFile F ( filename ) ; if ( ! F . open ( QIODevice::WriteOnly | QIODevice::Truncate ) ) return false ; F . write ( data ) ; F . close ( ) ; return true ; } void Help (void) { nprintf("List : tartool -l -t input.tar" ,true,true) ; nprintf("Extract : tartool -e -t input.tar -d rootdir",true,true) ; nprintf("Archive : tartool -a -t input.tar -d rootdir",true,true) ; } void ListTarBall(QString filename) { QDir d = QDir::current ( ) ; TarBALL tarball ; tarball . List ( d , filename ) ; } void ExtractTarBall(QString filename,QDir root) { TarBALL tarball ; tarball . Extract ( root , filename ) ; } void MakeTarBall(QString filename,QDir src) { TarBALL tarball ; QDir root = QDir::current ( ) ; tarball . TarBall ( filename , root , src ) ; } int Interpret(QStringList cmds) { if ( cmds . count ( ) < 2 ) { Help ( ) ; return 1 ; } ; int ioa = -1 ; ////////////////////////////////////////////////// cmds . takeAt ( 0 ) ; if ( "-l" == cmds [ 0 ] ) { ioa = 1 ; } ; if ( "-e" == cmds [ 0 ] ) { ioa = 2 ; } ; if ( "-a" == cmds [ 0 ] ) { ioa = 3 ; } ; if ( ( ioa < 1 ) || ( ioa > 3 ) ) { Help ( ) ; return 1 ; } ; ////////////////////////////////////////////////// QString tfile = "" ; QString rootdir = "" ; cmds . takeAt ( 0 ) ; while ( cmds . count ( ) > 0 ) { if ( "-t" == cmds [ 0 ] ) { cmds . takeAt ( 0 ) ; if ( cmds . count ( ) > 0 ) { tfile = cmds [ 0 ] ; cmds . takeAt ( 0 ) ; } else { Help ( ) ; return 1 ; } ; } else if ( "-d" == cmds [ 0 ] ) { cmds . takeAt ( 0 ) ; if ( cmds . count ( ) > 0 ) { rootdir = cmds [ 0 ] ; cmds . takeAt ( 0 ) ; } else { Help ( ) ; return 1 ; } ; } else if ( cmds . count ( ) > 0 ) { cmds . takeAt ( 0 ) ; } ; } ; ////////////////////////////////////////////////// switch ( ioa ) { case 1 : case 2 : case 3 : if ( ( tfile.length ( ) <= 0 ) ) { Help ( ) ; return 1 ; } ; break ; } ; ////////////////////////////////////////////////// QDir root = QDir::current ( ) ; switch ( ioa ) { case 1 : ListTarBall ( tfile ) ; return 0 ; case 2 : if ( rootdir . length ( ) > 0 ) { root = root . absoluteFilePath ( rootdir ) ; root = QDir ( rootdir ) ; } ; ExtractTarBall ( tfile , root ) ; return 0 ; case 3 : if ( rootdir . length ( ) > 0 ) { root = root . absoluteFilePath ( rootdir ) ; root = QDir ( rootdir ) ; } ; MakeTarBall ( tfile , root ) ; return 0 ; } ; ////////////////////////////////////////////////// Help ( ) ; return 1 ; } int main(int argc,char ** argv) { QStringList args = ToArgs ( argc , argv ) ; QCoreApplication core ( argc , argv ) ; return Interpret ( args ) ; }
37.952991
79
0.267988
Vladimir-Lin
7988ee511f1e67bc9e88b0662839c219bea8e89c
2,715
cpp
C++
src/generated/rpg_savepicture.cpp
BeWorld2018/liblcf
01b73de93cf80185fcdf3ffd4737dfdb9111a85e
[ "MIT" ]
72
2015-01-03T12:04:47.000Z
2022-03-14T23:40:24.000Z
src/generated/rpg_savepicture.cpp
BeWorld2018/liblcf
01b73de93cf80185fcdf3ffd4737dfdb9111a85e
[ "MIT" ]
207
2015-01-03T11:00:17.000Z
2022-02-25T15:50:25.000Z
src/generated/rpg_savepicture.cpp
BeWorld2018/liblcf
01b73de93cf80185fcdf3ffd4737dfdb9111a85e
[ "MIT" ]
42
2015-01-07T12:30:40.000Z
2022-02-11T12:05:05.000Z
/* !!!! GENERATED FILE - DO NOT EDIT !!!! * -------------------------------------- * * This file is part of liblcf. Copyright (c) 2021 liblcf authors. * https://github.com/EasyRPG/liblcf - https://easyrpg.org * * liblcf is Free/Libre Open Source Software, released under the MIT License. * For the full copyright and license information, please view the COPYING * file that was distributed with this source code. */ // Headers #include "lcf/rpg/savepicture.h" namespace lcf { namespace rpg { std::ostream& operator<<(std::ostream& os, const SavePicture::Flags& obj) { for (size_t i = 0; i < obj.flags.size(); ++i) { os << (i == 0 ? "[" : ", ") << obj.flags[i]; } os << "]"; return os; } std::ostream& operator<<(std::ostream& os, const SavePicture& obj) { os << "SavePicture{"; os << "name="<< obj.name; os << ", start_x="<< obj.start_x; os << ", start_y="<< obj.start_y; os << ", current_x="<< obj.current_x; os << ", current_y="<< obj.current_y; os << ", fixed_to_map="<< obj.fixed_to_map; os << ", current_magnify="<< obj.current_magnify; os << ", current_top_trans="<< obj.current_top_trans; os << ", use_transparent_color="<< obj.use_transparent_color; os << ", current_red="<< obj.current_red; os << ", current_green="<< obj.current_green; os << ", current_blue="<< obj.current_blue; os << ", current_sat="<< obj.current_sat; os << ", effect_mode="<< obj.effect_mode; os << ", current_effect_power="<< obj.current_effect_power; os << ", current_bot_trans="<< obj.current_bot_trans; os << ", spritesheet_cols="<< obj.spritesheet_cols; os << ", spritesheet_rows="<< obj.spritesheet_rows; os << ", spritesheet_frame="<< obj.spritesheet_frame; os << ", spritesheet_speed="<< obj.spritesheet_speed; os << ", frames="<< obj.frames; os << ", spritesheet_play_once="<< obj.spritesheet_play_once; os << ", map_layer="<< obj.map_layer; os << ", battle_layer="<< obj.battle_layer; os << ", flags="<< obj.flags; os << ", finish_x="<< obj.finish_x; os << ", finish_y="<< obj.finish_y; os << ", finish_magnify="<< obj.finish_magnify; os << ", finish_top_trans="<< obj.finish_top_trans; os << ", finish_bot_trans="<< obj.finish_bot_trans; os << ", finish_red="<< obj.finish_red; os << ", finish_green="<< obj.finish_green; os << ", finish_blue="<< obj.finish_blue; os << ", finish_sat="<< obj.finish_sat; os << ", finish_effect_power="<< obj.finish_effect_power; os << ", time_left="<< obj.time_left; os << ", current_rotation="<< obj.current_rotation; os << ", current_waver="<< obj.current_waver; os << ", easyrpg_flip="<< obj.easyrpg_flip; os << ", easyrpg_blend_mode="<< obj.easyrpg_blend_mode; os << "}"; return os; } } // namespace rpg } // namespace lcf
36.689189
77
0.641621
BeWorld2018
79897611df6eda188cd6c98bc4d5ac175a77bfe6
1,656
cc
C++
src/pks/mpc_pk/ChemistryMatrixFracture_PK.cc
fmyuan/amanzi
edb7b815ae6c22956c8519acb9d87b92a9915ed4
[ "RSA-MD" ]
37
2017-04-26T16:27:07.000Z
2022-03-01T07:38:57.000Z
src/pks/mpc_pk/ChemistryMatrixFracture_PK.cc
fmyuan/amanzi
edb7b815ae6c22956c8519acb9d87b92a9915ed4
[ "RSA-MD" ]
494
2016-09-14T02:31:13.000Z
2022-03-13T18:57:05.000Z
src/pks/mpc_pk/ChemistryMatrixFracture_PK.cc
fmyuan/amanzi
edb7b815ae6c22956c8519acb9d87b92a9915ed4
[ "RSA-MD" ]
43
2016-09-26T17:58:40.000Z
2022-03-25T02:29:59.000Z
/* This is the mpc_pk component of the Amanzi code. Copyright 2010-201x held jointly by LANS/LANL, LBNL, and PNNL. Amanzi is released under the three-clause BSD License. The terms of use and "as is" disclaimer for this license are provided in the top-level COPYRIGHT file. Authors: Konstantin Lipnikov Daniil Svyatskiy Process kernel that couples chemistry PKs in matrix and fracture. */ #include "ChemistryMatrixFracture_PK.hh" #include "PK_MPCWeak.hh" namespace Amanzi { /* ******************************************************************* * Constructor ******************************************************************* */ ChemistryMatrixFracture_PK::ChemistryMatrixFracture_PK(Teuchos::ParameterList& pk_tree, const Teuchos::RCP<Teuchos::ParameterList>& glist, const Teuchos::RCP<State>& S, const Teuchos::RCP<TreeVector>& soln) : glist_(glist), Amanzi::PK(pk_tree, glist, S, soln), Amanzi::PK_MPCWeak(pk_tree, glist, S, soln) { Teuchos::ParameterList vlist; vo_ = Teuchos::rcp(new VerboseObject("ChemistryMatrixFracture_PK", vlist)); } /* ******************************************************************* * Physics-based setup of PK. ******************************************************************* */ void ChemistryMatrixFracture_PK::Setup(const Teuchos::Ptr<State>& S) { mesh_domain_ = S->GetMesh(); mesh_fracture_ = S->GetMesh("fracture"); // setup the sub-PKs PK_MPCWeak::Setup(S); } } // namespace Amanzi
33.12
105
0.533816
fmyuan
798e1b5c6185a904dc0b297593fda4d8f09b7601
446
hpp
C++
src/centurion/detail/czstring_compare.hpp
twantonie/centurion
198b80f9e8a29da2ae7d3c15e48ffa1a046165c3
[ "MIT" ]
126
2020-12-05T00:05:56.000Z
2022-03-30T15:15:03.000Z
src/centurion/detail/czstring_compare.hpp
twantonie/centurion
198b80f9e8a29da2ae7d3c15e48ffa1a046165c3
[ "MIT" ]
46
2020-12-27T14:25:22.000Z
2022-01-26T13:58:11.000Z
src/centurion/detail/czstring_compare.hpp
twantonie/centurion
198b80f9e8a29da2ae7d3c15e48ffa1a046165c3
[ "MIT" ]
13
2021-01-20T20:50:18.000Z
2022-03-25T06:59:03.000Z
#ifndef CENTURION_DETAIL_CZSTRING_COMPARE_HEADER #define CENTURION_DETAIL_CZSTRING_COMPARE_HEADER #include "../core/str.hpp" #include "czstring_eq.hpp" /// \cond FALSE namespace cen::detail { struct czstring_compare final { auto operator()(const str lhs, const str rhs) const noexcept -> bool { return detail::czstring_eq(lhs, rhs); } }; } // namespace cen::detail /// \endcond #endif // CENTURION_DETAIL_CZSTRING_COMPARE_HEADER
20.272727
70
0.748879
twantonie
79907086e98fa3d21f45c1c9e02963e4a4d9fe2f
2,003
cpp
C++
Daa_Greedy1/A_3/program3.cpp
anuj0405/DAA
3ea853200317dd1b588d56e7d24f65d66821040c
[ "MIT" ]
1
2020-02-01T20:19:44.000Z
2020-02-01T20:19:44.000Z
Daa_Greedy1/A_3/program3.cpp
anuj0405/DAA
3ea853200317dd1b588d56e7d24f65d66821040c
[ "MIT" ]
null
null
null
Daa_Greedy1/A_3/program3.cpp
anuj0405/DAA
3ea853200317dd1b588d56e7d24f65d66821040c
[ "MIT" ]
null
null
null
#include<chrono> #include<vector> #include<fstream> #include<iostream> using namespace std::chrono; using namespace std; class sort { public: long a,cm=0; int i=0,j=0; vector<double> v1; void mergesort(int,int); void merge_count(int,int,int); void countingversion(int); }; static long long int count_merge=0; void sort::countingversion(int n) { int i,j; long long int count=0; for(j=0;j<n-1;j++) { for(i=1+j;i<n;i++) { if(v1[j]>v1[i]) { count++; } } } cout<<"\nNumber of inversion in countinversion: "<<count; } void sort::merge_count(int p,int q,int r) { int i,j,k,count=0; int n1=q-p+1,n2=r-q; int L[n1],R[n2]; for(i=0;i<n1;i++) L[i]=v1[p+i]; for(j=0;j<n2;j++) R[j]=v1[q+j+1]; i=0;j=0,k=p; while(i<n1 && j<n2) { if(L[i]<=R[j]) { v1[k]=L[i]; i++; } else { v1[k]=R[j]; j++; count_merge=count_merge+(n1-i); } k++; } while(i<n1) { v1[k]=L[i]; i++; k++; } while(j<n2) { v1[k]=R[j]; j++; k++; } } void sort::mergesort(int p,int r) { if(p<r) { int q=(p+r)/2; mergesort(p,q); mergesort(q+1,r); merge_count(p,q,r); } } int main() { sort s; int i,j; int n; cout<<"Enter the number of input\n"; cin>>n; for (j=0; j<n; j++) { i=(rand()%100000); s.v1.push_back(i) ; } auto start = high_resolution_clock::now(); s.countingversion(n); auto stop = high_resolution_clock::now(); auto duration = duration_cast<microseconds>(stop - start); cout << "\nTime taken by function: "<< duration.count() << " microseconds" << endl; auto start1 = high_resolution_clock::now(); s.mergesort(0,n-1); auto stop1 = high_resolution_clock::now(); auto duration1 = duration_cast<microseconds>(stop1 - start1); //for(i=0;i<n;i++) // cout<<"\n"<<s.v1[i]; cout<<"\nNumber of inversion in merge: "<<count_merge; cout << "\nTime taken by function: "<< duration1.count() << " microseconds" << endl; }
14.837037
86
0.560659
anuj0405
799a2031763ecbcf92a6d09dd52f2474a5dbe48b
11,954
cpp
C++
solClientThread.cpp
brandonto/topic-monitor
d3aa666e92e13e93abe8539799c98f985b79f1bb
[ "BSD-3-Clause" ]
2
2019-10-22T22:05:09.000Z
2020-02-02T05:42:19.000Z
solClientThread.cpp
brandonto/topic-monitor
d3aa666e92e13e93abe8539799c98f985b79f1bb
[ "BSD-3-Clause" ]
null
null
null
solClientThread.cpp
brandonto/topic-monitor
d3aa666e92e13e93abe8539799c98f985b79f1bb
[ "BSD-3-Clause" ]
null
null
null
//****************************************************************************** // // Copyright (c) 2019, Brandon To // 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 the author nor the names of its contributors may be // used to endorse or promote products derived from this software without // specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // //****************************************************************************** #include "solClientThread.hpp" #include "log.hpp" #include "monitoringThread.hpp" namespace topicMonitor { SolClientThread* SolClientThread::instance_mps = nullptr; static solClient_rxMsgCallback_returnCode_t sessionMessageReceiveCallback(solClient_opaqueSession_pt session_p, solClient_opaqueMsg_pt msg_p, void* user_p) { LOG(DEBUG, "SolClient message received callback invoked"); // Create a work entry and enqueue it to MonitoringThread's work queue // WorkEntryMessageReceived* entry_p = new WorkEntryMessageReceived(); entry_p->setMsg(msg_p); MonitoringThread::instance()->getWorkQueue()->push(entry_p); // Taking ownership of the message away from the context thread. We are // responsible for freeing the message when done processing. // return SOLCLIENT_CALLBACK_TAKE_MSG; } static void sessionEventCallback(solClient_opaqueSession_pt session_p, solClient_session_eventCallbackInfo_pt eventInfo_p, void* user_p) { LOG(DEBUG, "SolClient event callback invoked"); } static void contextTimerCallback(solClient_opaqueContext_pt context_p, void* user_p) { LOG(DEBUG, "SolClient timer callback invoked"); // Create a work entry and enqueue it to MonitoringThread's work queue // WorkEntryTimerTick* entry_p = new WorkEntryTimerTick(); MonitoringThread::instance()->getWorkQueue()->push(entry_p); } // See Messaging API Concepts from the Solace Developer Guide: // // https://docs.solace.com/Solace-PubSub-Messaging-APIs/Developer-Guide/Core-Messaging-API-Concepts.htm // SolClientThread::SolClientThread(void) : context_mp(nullptr), session_mp(nullptr) { solClient_returnCode_t rc; // solClient_initialize() is called here because SolClientThread is only // constructed once. // rc = solClient_initialize(SOLCLIENT_LOG_DEFAULT_FILTER, nullptr); if (rc != SOLCLIENT_OK) LOG(FATAL, "solClient initialization failed"); LOG(INFO, "solClient initialized"); // Contexts // // The messaging APIs use processing Contexts for organizing communication // between an application and a Solace PubSub+ message broker. Contexts act // as containers in which Sessions are created and Session-related events // can be handled. // // A Context encapsulates threads that drive network I/O and message // delivery notification for the Sessions and Session components associated // with that Context. For the Java API, one thread is used for I/O and // another for notification. For the Java RTO, C, and .NET APIs, a single // thread is used for both I/O and for notification. The life cycle of a // Context‑owned thread is bound to the life cycle of the Context. The // Javascript and Node.js APIs are single threaded and have a single global // context that is not exposed. // solClient_context_createFuncInfo_t contextFuncInfo = SOLCLIENT_CONTEXT_CREATEFUNC_INITIALIZER; rc = solClient_context_create( SOLCLIENT_CONTEXT_PROPS_DEFAULT_WITH_CREATE_THREAD, &context_mp, &contextFuncInfo, sizeof(contextFuncInfo)); if (rc != SOLCLIENT_OK) LOG(FATAL, "solClient context creation failed"); LOG(INFO, "solClient context created"); } SolClientThread::~SolClientThread(void) { solClient_returnCode_t rc; if (session_mp != nullptr) { rc = solClient_session_destroy(&session_mp); if (rc != SOLCLIENT_OK) LOG(FATAL, "solClient session destruction failed"); } if (context_mp != nullptr) { rc = solClient_context_destroy(&context_mp); if (rc != SOLCLIENT_OK) LOG(FATAL, "solClient context destruction failed"); } // solClient_cleanup() is called here because SolClientThread is only // destroyed at program termination. // rc = solClient_cleanup(); if (rc != SOLCLIENT_OK) LOG(FATAL, "solClient cleanup failed"); } returnCode_t SolClientThread::createSession(std::string host, std::string vpn, std::string username, std::string password) { solClient_returnCode_t rc; // Sessions // // When a Context is established, one or more Sessions can be created within // that Context. A Session creates a single, client connection to a message // broker for sending and receiving messages. // // A Session provides the following primary services: // // * client connection // * update and retrieve Session properties // * retrieve Session statistics // * add and remove subscriptions // * create destinations and endpoints // * publish and receive Direct messages // * publish Guaranteed messages // * make requests/replies (or create Requestors for the Java API) // * create Guaranteed message Flows to receive Guaranteed messages // * create Browsers (for the Java and .NET APIs only) // * create cache sessions // // When configuring a Session, the following must be provided: // // * Session properties to define the operating characteristics of the // client connection to the message broker. // * A message callback for Direct messages that are received. // * An event handling callback for events that occur for the Session // (optional for the Java API). // solClient_session_createFuncInfo_t sessionFuncInfo = SOLCLIENT_SESSION_CREATEFUNC_INITIALIZER; sessionFuncInfo.rxMsgInfo.callback_p = sessionMessageReceiveCallback; sessionFuncInfo.rxMsgInfo.user_p = nullptr; sessionFuncInfo.eventInfo.callback_p = sessionEventCallback; sessionFuncInfo.eventInfo.user_p = nullptr; int propIndex = 0; const char* sessionProps[20] = {0}; sessionProps[propIndex++] = SOLCLIENT_SESSION_PROP_HOST; sessionProps[propIndex++] = host.c_str(); sessionProps[propIndex++] = SOLCLIENT_SESSION_PROP_VPN_NAME; sessionProps[propIndex++] = vpn.c_str(); sessionProps[propIndex++] = SOLCLIENT_SESSION_PROP_USERNAME; sessionProps[propIndex++] = username.c_str(); sessionProps[propIndex++] = SOLCLIENT_SESSION_PROP_PASSWORD; sessionProps[propIndex++] = password.c_str(); rc = solClient_session_create( (char **)sessionProps, context_mp, &session_mp, &sessionFuncInfo, sizeof(sessionFuncInfo)); if (rc != SOLCLIENT_OK) { LOG(ERROR, "solClient session creation failed"); return returnCode_t::FAILURE; } LOG(INFO, "solClient session created"); return returnCode_t::SUCCESS; } returnCode_t SolClientThread::destroySession(void) { if (session_mp == nullptr) { return returnCode_t::NOTHING_TO_DO; } if (solClient_session_destroy(&session_mp) != SOLCLIENT_OK) { LOG(ERROR, "solClient session destruction failed"); return returnCode_t::FAILURE; } LOG(INFO, "solClient session destroyed"); return returnCode_t::SUCCESS; } returnCode_t SolClientThread::connectSession(void) { if (session_mp == nullptr) { return returnCode_t::FAILURE; } std::lock_guard<std::mutex> lock(mutex_m); if (solClient_session_connect(session_mp) != SOLCLIENT_OK) { LOG(ERROR, "solClient session connection failed"); return returnCode_t::FAILURE; } LOG(INFO, "solClient session connected"); return returnCode_t::SUCCESS; } returnCode_t SolClientThread::disconnectSession(void) { if (session_mp == nullptr) { return returnCode_t::FAILURE; } std::lock_guard<std::mutex> lock(mutex_m); if (solClient_session_disconnect(session_mp) != SOLCLIENT_OK) { LOG(ERROR, "solClient session disconnection failed"); return returnCode_t::FAILURE; } LOG(INFO, "solClient session disconnected"); return returnCode_t::SUCCESS; } returnCode_t SolClientThread::topicSubscribe(std::string topic) { solClient_returnCode_t rc; std::lock_guard<std::mutex> lock(mutex_m); rc = solClient_session_topicSubscribeExt( session_mp, SOLCLIENT_SUBSCRIBE_FLAGS_WAITFORCONFIRM, topic.c_str()); if (rc != SOLCLIENT_OK) { LOG(WARN, "solClient could not subscribe to topic '" << topic << "'"); return returnCode_t::FAILURE; } LOG(INFO, "solClient subscribed to topic '" << topic << "'"); return returnCode_t::SUCCESS; } returnCode_t SolClientThread::topicUnsubscribe(std::string topic) { solClient_returnCode_t rc; std::lock_guard<std::mutex> lock(mutex_m); rc = solClient_session_topicUnsubscribeExt( session_mp, SOLCLIENT_SUBSCRIBE_FLAGS_WAITFORCONFIRM, topic.c_str()); if (rc != SOLCLIENT_OK) { LOG(WARN, "solClient could not unsubscribe from topic '" << topic << "'"); return returnCode_t::FAILURE; } LOG(INFO, "solClient unsubscribed from topic '" << topic << "'"); return returnCode_t::SUCCESS; } returnCode_t SolClientThread::startTimer(void) { solClient_returnCode_t rc; std::lock_guard<std::mutex> lock(mutex_m); rc = solClient_context_startTimer( context_mp, SOLCLIENT_CONTEXT_TIMER_REPEAT, 1000, // Timer ticks every second contextTimerCallback, nullptr, &timerId_m); if (rc != SOLCLIENT_OK) { LOG(ERROR, "solClient could not start timer"); return returnCode_t::FAILURE; } LOG(INFO, "solClient timer started"); return returnCode_t::SUCCESS; } returnCode_t SolClientThread::stopTimer(void) { std::lock_guard<std::mutex> lock(mutex_m); if (timerId_m == SOLCLIENT_CONTEXT_TIMER_ID_INVALID) { return returnCode_t::NOTHING_TO_DO; } if (solClient_context_stopTimer(context_mp, &timerId_m) != SOLCLIENT_OK) { LOG(ERROR, "solClient could not stop timer"); return returnCode_t::FAILURE; } return returnCode_t::SUCCESS; } } /* namespace topicMonitor */
33.391061
103
0.678267
brandonto
79a0bb73780abbea33fe3c5fc98eedf1f634ef65
110
hpp
C++
libcaramel/adapters/queue.hpp
Wmbat/libcaramel
71bd054aea82b081f202f52b7d24226871123b3f
[ "MIT" ]
2
2020-12-19T04:00:41.000Z
2021-09-11T19:28:29.000Z
libcaramel/adapters/queue.hpp
Wmbat/libcaramel
71bd054aea82b081f202f52b7d24226871123b3f
[ "MIT" ]
4
2021-05-11T22:52:16.000Z
2021-05-16T20:43:31.000Z
libcaramel/adapters/queue.hpp
Wmbat/libcaramel
71bd054aea82b081f202f52b7d24226871123b3f
[ "MIT" ]
1
2021-01-06T04:05:56.000Z
2021-01-06T04:05:56.000Z
#pragma once namespace caramel { template <typename Any> class queue { }; } // namespace caramel
11
26
0.645455
Wmbat
79a346ce41317849a953cf58e572534c4526d437
705
cpp
C++
leetcode/problems/easy/69-sqrtx.cpp
wingkwong/competitive-programming
e8bf7aa32e87b3a020b63acac20e740728764649
[ "MIT" ]
18
2020-08-27T05:27:50.000Z
2022-03-08T02:56:48.000Z
leetcode/problems/easy/69-sqrtx.cpp
wingkwong/competitive-programming
e8bf7aa32e87b3a020b63acac20e740728764649
[ "MIT" ]
null
null
null
leetcode/problems/easy/69-sqrtx.cpp
wingkwong/competitive-programming
e8bf7aa32e87b3a020b63acac20e740728764649
[ "MIT" ]
1
2020-10-13T05:23:58.000Z
2020-10-13T05:23:58.000Z
/* Sqrt(x) https://leetcode.com/problems/sqrtx/ Given a non-negative integer x, compute and return the square root of x. Since the return type is an integer, the decimal digits are truncated, and only the integer part of the result is returned. Example 1: Input: x = 4 Output: 2 Example 2: Input: x = 8 Output: 2 Explanation: The square root of 8 is 2.82842..., and since the decimal part is truncated, 2 is returned. */ class Solution { public: int mySqrt(int x) { long ans = 0, bit = 1L << 16; while(bit > 0) { ans |= bit; if (ans * ans > x) { ans ^= bit; } bit >>= 1; } return (int)ans; } };
20.735294
123
0.575887
wingkwong
79a58e6f679687548894f8a39e10181acd6d6672
6,857
cc
C++
script/api/api_simple.cc
chris-nada/simutrans-extended
71c0c4f78cb3170b1fa1c68d8baafa9a7269ef6f
[ "Artistic-1.0" ]
38
2017-07-26T14:48:12.000Z
2022-03-24T23:48:55.000Z
script/api/api_simple.cc
chris-nada/simutrans-extended
71c0c4f78cb3170b1fa1c68d8baafa9a7269ef6f
[ "Artistic-1.0" ]
74
2017-03-15T21:07:34.000Z
2022-03-18T07:53:11.000Z
script/api/api_simple.cc
chris-nada/simutrans-extended
71c0c4f78cb3170b1fa1c68d8baafa9a7269ef6f
[ "Artistic-1.0" ]
43
2017-03-10T15:27:28.000Z
2022-03-05T10:55:38.000Z
/* * This file is part of the Simutrans-Extended project under the Artistic License. * (see LICENSE.txt) */ #include "api.h" /** @file api_simple.cc exports simple data types. */ #include "api_simple.h" #include "../api_class.h" #include "../api_function.h" #include "../../dataobj/ribi.h" #include "../../simworld.h" #include "../../dataobj/scenario.h" using namespace script_api; #ifdef DOXYGEN /** * Struct to hold information about time as month-year. * If used as argument to functions then only the value of @ref raw matters. * If filled by an api-call the year and month will be set, too. * Relation: raw = 12*month + year. * @see world::get_time obj_desc_time_x */ class time_x { // begin_class("time_x") public: #ifdef SQAPI_DOC // document members integer raw; ///< raw integer value of date integer year; ///< year integer month; ///< month in 0..11 #endif }; // end_class /** * Struct to get precise information about time. * @see world::get_time */ class time_ticks_x : public time_x { // begin_class("time_ticks_x", "time_x") public: #ifdef SQAPI_DOC // document members integer ticks; ///< current time in ticks integer ticks_per_month; ///< length of one in-game month in ticks integer next_month_ticks; ///< new month will start at this time #endif }; // end_class #endif // pushes table = { raw = , year = , month = } SQInteger param<mytime_t>::push(HSQUIRRELVM vm, mytime_t const& v) { sq_newtableex(vm, 6); create_slot<uint32>(vm, "raw", v.raw); create_slot<uint32>(vm, "year", v.raw/12); create_slot<uint32>(vm, "month", v.raw%12); return 1; } SQInteger param<mytime_ticks_t>::push(HSQUIRRELVM vm, mytime_ticks_t const& v) { param<mytime_t>::push(vm, v); create_slot<uint32>(vm, "ticks", v.ticks); create_slot<uint32>(vm, "ticks_per_month", v.ticks_per_month); create_slot<uint32>(vm, "next_month_ticks", v.next_month_ticks); return 1; } mytime_t param<mytime_t>::get(HSQUIRRELVM vm, SQInteger index) { // 0 has special meaning of 'no-timeline' SQInteger i=1; if (!SQ_SUCCEEDED(sq_getinteger(vm, index, &i))) { get_slot(vm, "raw", i, index); } return (uint16) (i >= 0 ? i : 1); } SQInteger script_api::push_ribi(HSQUIRRELVM vm, ribi_t::ribi ribi) { welt->get_scenario()->ribi_w2sq(ribi); return param<uint8>::push(vm, ribi); } ribi_t::ribi script_api::get_ribi(HSQUIRRELVM vm, SQInteger index) { ribi_t::ribi ribi = param<uint8>::get(vm, index) & ribi_t::all; welt->get_scenario()->ribi_sq2w(ribi); return ribi; } #define map_ribi_ribi(f) \ SQInteger export_## f(HSQUIRRELVM vm) \ { \ ribi_t::ribi ribi = get_ribi(vm, -1); \ ribi = ribi_t::f(ribi); \ return push_ribi(vm, ribi); \ } #define map_ribi_any(f,type) \ SQInteger export_## f(HSQUIRRELVM vm) \ { \ ribi_t::ribi ribi = get_ribi(vm, -1); \ type ret = ribi_t::f(ribi); \ return script_api::param<type>::push(vm, ret); \ } // export the ribi functions map_ribi_any(is_single, bool); map_ribi_any(is_twoway, bool); map_ribi_any(is_threeway, bool); map_ribi_any(is_bend, bool); map_ribi_any(is_straight, bool); map_ribi_ribi(doubles); map_ribi_ribi(backward); void export_simple(HSQUIRRELVM vm) { /** * Class that holds 2d coordinates. * * Coordinates always refer to the original rotation in @ref map.file. * They will be rotated if transferred between the game engine and squirrel. */ begin_class(vm, "coord"); #ifdef SQAPI_DOC // document members /// x-coordinate integer x; /// y-coordinate integer y; // operators are defined in scenario_base.nut coord operator + (coord other); coord operator - (coord other); coord operator - (); coord operator * (integer fac); coord operator / (integer fac); /** * Converts coordinate to string containing the coordinates in the current rotation of the map. * * Cannot be used in links in scenario texts. Use @ref href instead. */ string _tostring(); /** * Generates text to generate links to coordinates in scenario texts. * @param text text to be shown in the link * @returns a-tag with link in href * @see get_rule_text */ string href(string text); #endif end_class(vm); /** * Class that holds 3d coordinates. * * Coordinates always refer to the original rotation in @ref map.file. * They will be rotated if transferred between the game engine and squirrel. */ begin_class(vm, "coord3d", "coord"); #ifdef SQAPI_DOC // document members /// x-coordinate integer x; /// y-coordinate integer y; /// z-coordinate - height integer z; // operators are defined in scenario_base.nut coord3d operator + (coord3d other); coord3d operator - (coord other); coord3d operator + (coord3d other); coord3d operator - (coord other); coord3d operator - (); coord3d operator * (integer fac); coord3d operator / (integer fac); /** * Converts coordinate to string containing the coordinates in the current rotation of the map. * * Cannot be used in links in scenario texts. Use @ref href instead. */ string _tostring(); /** * Generates text to generate links to coordinates in scenario texts. * @param text text to be shown in the link * @returns a-tag with link in href * @see get_rule_text */ string href(string text); #endif end_class(vm); /** * Class holding static methods to work with directions. * Directions are just bit-encoded integers. */ begin_class(vm, "dir"); /** * @param d direction to test * @return whether direction is single direction, i.e. just one of n/s/e/w * @typemask bool(dir) */ STATIC register_function(vm, &export_is_single, "is_single", 2, "yi"); /** * @param d direction to test * @return whether direction is double direction, e.g. n+e, n+s. * @typemask bool(dir) */ STATIC register_function(vm, &export_is_twoway, "is_twoway", 2, "yi"); /** * @param d direction to test * @return whether direction is triple direction, e.g. n+s+e. * @typemask bool(dir) */ STATIC register_function(vm, &export_is_threeway, "is_threeway", 2, "yi"); /** * @param d direction to test * @return whether direction is curve, e.g. n+e, s+w. * @typemask bool(dir) */ STATIC register_function(vm, &export_is_bend, "is_curve", 2, "yi"); /** * @param d direction to test * @return whether direction is straight and has no curves in it, e.g. n+w, w. * @typemask bool(dir) */ STATIC register_function(vm, &export_is_straight, "is_straight", 2, "yi"); /** * @param d direction * @return complements direction to complete straight, i.e. w -> w+e, but n+w -> 0. * @typemask dir(dir) */ STATIC register_function(vm, &export_doubles, "double", 2, "yi"); /** * @param d direction to test * @return backward direction, e.g. w -> e, n+w -> s+e, n+w+s -> e. * @typemask dir(dir) */ STATIC register_function(vm, &export_backward, "backward", 2, "yi"); end_class(vm); }
27.873984
96
0.684264
chris-nada
79a6b9efe0dd1aecd62e87a7f901339e21cd22f3
5,238
cpp
C++
src/core/Collection.cpp
demonatic/Skilo
adc73692dfa41c11b74ce02bfc657a5692156187
[ "MIT" ]
3
2020-05-10T16:52:35.000Z
2021-03-12T08:06:06.000Z
src/core/Collection.cpp
demonatic/Skilo
adc73692dfa41c11b74ce02bfc657a5692156187
[ "MIT" ]
null
null
null
src/core/Collection.cpp
demonatic/Skilo
adc73692dfa41c11b74ce02bfc657a5692156187
[ "MIT" ]
null
null
null
#include "Collection.h" #include "g3log/g3log.hpp" #include "search/IndexSearcher.h" namespace Skilo { using namespace Schema; Collection::Collection(const CollectionMeta &collection_meta,StorageService *storage_service,const SkiloConfig &config): _collection_id(collection_meta.get_collection_id()), _collection_name(collection_meta.get_collection_name()), _storage_service(storage_service),_schema(collection_meta), _indexes(_collection_id,_schema,collection_meta,_storage_service),_config(config) { _next_seq_id=_storage_service->get_collection_next_seq_id(_collection_id); _tokenizer=this->get_tokenize_strategy(collection_meta.get_tokenizer()); this->build_index(); } uint32_t Collection::get_id() const { return this->_collection_id; } const std::string &Collection::get_name() const { return this->_collection_name; } void Collection::build_index() { size_t load_doc_count=0; LOG(INFO)<<"Loading documents of collection \""<<_collection_name<<"\" ..."; _storage_service->scan_for_each_doc(_collection_id,[this,&load_doc_count](const std::string_view doc_str){ Index::IndexWriter index_writer(_indexes,_tokenizer.get()); const Document doc(doc_str); index_writer.index_in_memory(_schema,doc); load_doc_count++; }); LOG(INFO)<<"Collection \""<<_collection_name<<"\" load finished. total "<<load_doc_count<<" documents"; _doc_num=load_doc_count; _indexes.set_doc_num(_doc_num); } void Collection::drop_all() { _storage_service->drop_collection(_collection_id,_collection_name); } void Collection::add_new_document(Document &document) { this->validate_document(document); document.add_seq_id(_next_seq_id); if(!_storage_service->write_document(_collection_id,document)){ std::string err="fail to write document to storage with doc id=\""+std::to_string(document.get_doc_id())+"\""; LOG(WARNING)<<err; throw InternalServerException(err); } _next_seq_id++; Index::IndexWriter index_writer(_indexes,_tokenizer.get()); index_writer.index_in_memory(_schema,document); _indexes.set_doc_num(++_doc_num); } void Collection::remove_document(const uint32_t doc_id) { uint32_t seq_id=_storage_service->get_doc_seq_id(_collection_id,doc_id); Document doc=this->_storage_service->get_document(_collection_id,seq_id); Index::IndexEraser index_eraser(_indexes,_tokenizer.get()); index_eraser.remove_from_memory_index(_schema,doc); _indexes.set_doc_num(--_doc_num); if(!_storage_service->remove_document(_collection_id,doc)){ std::string err="fail to remove document from storage with doc id=\""+std::to_string(doc.get_doc_id())+"\""; LOG(WARNING)<<err; throw InternalServerException(err); } } bool Collection::contain_document(const uint32_t doc_id) const { return _storage_service->contain_document(_collection_id,doc_id); } Document Collection::get_document(const uint32_t id,bool seq) const { try { uint32_t seq_id=seq?id:_storage_service->get_doc_seq_id(_collection_id,id); return _storage_service->get_document(_collection_id,seq_id); } catch (InternalServerException &e) { throw NotFoundException("Can not fetch document with "+string(seq?"seq":"doc")+" id \'"+std::to_string(id)+'\''); } } void Collection::validate_document(const Document &document) { return _schema.validate(document); } SearchResult Collection::search(const Query &query_info) const { Search::IndexSearcher searcher(query_info,_indexes,_tokenizer.get()); std::vector<std::pair<uint32_t,double>> res_docs; float search_time_cost=Util::timing_function( std::bind(&Search::IndexSearcher::search,searcher,std::placeholders::_1),res_docs); uint32_t hit_count=static_cast<uint32_t>(res_docs.size()); //load hit documents SearchResult result(hit_count); for(auto [seq_id,score]:res_docs){ LOG(DEBUG)<<"search hit seq_id="<<seq_id<<" score="<<score; Document doc=_storage_service->get_document(_collection_id,seq_id); result.add_hit(doc,score); } result.add_took_secs(search_time_cost); return result; } uint32_t Collection::get_doc_num() const { return _doc_num; } std::vector<std::string_view> Collection::auto_suggest(const std::string &query_prefix) const { Search::AutoSuggestor *suggestor=_indexes.get_suggestor(); if(!suggestor){ throw UnAuthorizedException("auto suggestion is not enabled in schema"); } return suggestor->auto_suggest(query_prefix); } std::unique_ptr<Index::TokenizeStrategy> Collection::get_tokenize_strategy(const std::string &tokenizer_name) const { using StrategyFactory=std::function<std::unique_ptr<Index::TokenizeStrategy>()>; static const std::unordered_map<std::string,StrategyFactory> factories{ {"default",[](){return std::make_unique<Index::DefaultTokenizer>();}}, {"jieba",[](){return std::make_unique<Index::JiebaTokenizer>(SkiloConfig::get_conf<std::string>("extensions.dict_dir"));}} }; auto it=factories.find(tokenizer_name); return it!=factories.end()?it->second():this->get_tokenize_strategy("default"); } } //namespace Skilo
35.391892
130
0.734822
demonatic
79a6d5cac7c48459079f05a2b5cbca81a4a52e94
1,180
hpp
C++
test/test_parent_parsers.hpp
MasterMann/argparse
e6a8802551d54fbd5a9eefb543239776dc763e96
[ "MIT" ]
3
2019-12-31T09:13:42.000Z
2021-11-25T12:26:20.000Z
test/test_parent_parsers.hpp
MasterMann/argparse
e6a8802551d54fbd5a9eefb543239776dc763e96
[ "MIT" ]
20
2019-12-24T16:57:30.000Z
2019-12-29T03:34:03.000Z
test/test_parent_parsers.hpp
MasterMann/argparse
e6a8802551d54fbd5a9eefb543239776dc763e96
[ "MIT" ]
1
2020-01-05T00:25:11.000Z
2020-01-05T00:25:11.000Z
#pragma once #include <catch.hpp> #include <argparse.hpp> TEST_CASE("Add parent parsers", "[parent_parsers]") { argparse::ArgumentParser parent_parser("main"); parent_parser.add_argument("--verbose") .default_value(false) .implicit_value(true); argparse::ArgumentParser child_parser("foo"); child_parser.add_parents(parent_parser); child_parser.parse_args({ "./main", "--verbose"}); REQUIRE(child_parser["--verbose"] == true); } TEST_CASE("Add parent to multiple parent parsers", "[parent_parsers]") { argparse::ArgumentParser parent_parser("main"); parent_parser.add_argument("--parent") .default_value(0) .action([](const std::string& value) { return std::stoi(value); }); argparse::ArgumentParser foo_parser("foo"); foo_parser.add_argument("foo"); foo_parser.add_parents(parent_parser); foo_parser.parse_args({ "./main", "--parent", "2", "XXX" }); REQUIRE(foo_parser["--parent"] == 2); REQUIRE(foo_parser["foo"] == std::string("XXX")); argparse::ArgumentParser bar_parser("bar"); bar_parser.add_argument("--bar"); bar_parser.parse_args({ "./main", "--bar", "YYY" }); REQUIRE(bar_parser["--bar"] == std::string("YYY")); }
34.705882
72
0.688983
MasterMann
79a7d6d4510165a7845990b23d244c0fb1d66cd9
2,948
hpp
C++
Tools/AtlasViewer/src/AtlasViewer.hpp
palikar/DirectXer
c21b87eed220fc54d97d5363e8a33bd0944a2596
[ "MIT" ]
null
null
null
Tools/AtlasViewer/src/AtlasViewer.hpp
palikar/DirectXer
c21b87eed220fc54d97d5363e8a33bd0944a2596
[ "MIT" ]
null
null
null
Tools/AtlasViewer/src/AtlasViewer.hpp
palikar/DirectXer
c21b87eed220fc54d97d5363e8a33bd0944a2596
[ "MIT" ]
null
null
null
#pragma once #include <iostream> #include <unordered_map> #include <vector> #include <string> #include <cstdint> #include <fstream> #include <stb_image.h> #include <GraphicsCommon.hpp> #include <Types.hpp> #include <Utils.hpp> #include <Assets.hpp> #include <fmt/format.h> #include <filesystem> static LPSTR* CommandLineToArgvA(LPSTR lpCmdLine, INT* pNumArgs) { int retval; retval = MultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS, lpCmdLine, -1, NULL, 0); LPWSTR lpWideCharStr = (LPWSTR)malloc(retval * sizeof(WCHAR)); retval = MultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS, lpCmdLine, -1, lpWideCharStr, retval); if (!SUCCEEDED(retval)) { free(lpWideCharStr); return NULL; } int numArgs; LPWSTR* args; args = CommandLineToArgvW(lpWideCharStr, &numArgs); free(lpWideCharStr); int storage = numArgs * sizeof(LPSTR); for (int i = 0; i < numArgs; ++i) { BOOL lpUsedDefaultChar = FALSE; retval = WideCharToMultiByte(CP_ACP, 0, args[i], -1, NULL, 0, NULL, &lpUsedDefaultChar); if (!SUCCEEDED(retval)) { LocalFree(args); return NULL; } storage += retval; } LPSTR* result = (LPSTR*)LocalAlloc(LMEM_FIXED, storage); if (result == NULL) { LocalFree(args); return NULL; } int bufLen = storage - numArgs * sizeof(LPSTR); LPSTR buffer = ((LPSTR)result) + numArgs * sizeof(LPSTR); for (int i = 0; i < numArgs; ++i) { BOOL lpUsedDefaultChar = FALSE; retval = WideCharToMultiByte(CP_ACP, 0, args[i], -1, buffer, bufLen, NULL, &lpUsedDefaultChar); if (!SUCCEEDED(retval)) { LocalFree(result); LocalFree(args); return NULL; } result[i] = buffer; buffer += retval; bufLen -= retval; } LocalFree(args); *pNumArgs = numArgs; return result; } struct AtlasViewer { struct CommandLineArguments { std::string Root{"resources"}; std::string Input{"input.dxa"}; }; }; struct Context { HWND hWnd; AtlasViewer::CommandLineArguments Args; bool FullscreenMode; UINT WindowStyle; RECT WindowRect; Graphics Graphics; TextureId DummyTex; uint16 currentTex{0}; std::vector<TextureId> Texs; }; static void HandleMessage(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, Context& context); static LRESULT CALLBACK HandleMsg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { if (msg == WM_CREATE) { auto context = (Context*)((LPCREATESTRUCTA)lParam)->lpCreateParams; SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)context); context->Graphics.InitSwapChain(hWnd, 1080, 720); context->Graphics.InitBackBuffer(); context->Graphics.InitZBuffer(1080, 720); context->Graphics.InitResources(); context->Graphics.InitRasterizationsStates(); context->Graphics.InitSamplers(); context->Graphics.InitBlending(); context->Graphics.InitDepthStencilStates(); } else { auto context = (Context*)GetWindowLongPtr(hWnd, GWLP_USERDATA); HandleMessage(hWnd, msg, wParam, lParam, *context); } return DefWindowProc(hWnd, msg, wParam, lParam); }
22.165414
98
0.712008
palikar
79b0849accd41d291fd083601cea7d4fe92782cf
764
cpp
C++
third_party/libprocess/src/synchronized.cpp
clearstorydata/mesos
4164125048c6635a4d0dbe72daf243457b0f325b
[ "Apache-2.0" ]
1
2019-02-17T15:56:26.000Z
2019-02-17T15:56:26.000Z
third_party/libprocess/src/synchronized.cpp
yubo/mesos
b177a56a4c4343e87e3eead34863a63a2e91db94
[ "Apache-2.0" ]
null
null
null
third_party/libprocess/src/synchronized.cpp
yubo/mesos
b177a56a4c4343e87e3eead34863a63a2e91db94
[ "Apache-2.0" ]
3
2017-07-10T07:28:30.000Z
2020-07-25T19:48:07.000Z
#include "synchronized.hpp" using std::string; static string s1; static synchronizable(s1); static string s2; static synchronizable(s2) = SYNCHRONIZED_INITIALIZER; static string s3; static synchronizable(s3) = SYNCHRONIZED_INITIALIZER_RECURSIVE; void bar() { synchronized(s3) { } } void foo() { synchronized(s3) { bar(); } } class Foo { public: Foo() { synchronizer(s) = SYNCHRONIZED_INITIALIZER_RECURSIVE; } void foo() { synchronized(s) { synchronized(s) { } } } private: string s; synchronizable(s); }; int main(int argc, char **argv) { synchronizer(s1) = SYNCHRONIZED_INITIALIZER_RECURSIVE; //synchronizer(s2) = SYNCHRONIZED_INITIALIZER; //foo(); Foo f; f.foo(); return 0; }
11.402985
63
0.653141
clearstorydata
79b5adc304ce24f89fe0b3f5e6b412245010db7e
6,564
hpp
C++
modules/concurrency/include/shard/concurrency/channel.hpp
ikimol/shard
72a72dbebfd247d2b7b300136c489672960b37d8
[ "MIT" ]
null
null
null
modules/concurrency/include/shard/concurrency/channel.hpp
ikimol/shard
72a72dbebfd247d2b7b300136c489672960b37d8
[ "MIT" ]
null
null
null
modules/concurrency/include/shard/concurrency/channel.hpp
ikimol/shard
72a72dbebfd247d2b7b300136c489672960b37d8
[ "MIT" ]
null
null
null
// Copyright (c) 2021 Miklos Molnar. All rights reserved. #ifndef SHARD_CONCURRENCY_CHANNEL_HPP #define SHARD_CONCURRENCY_CHANNEL_HPP #include <shard/core/non_copyable.hpp> #include <shard/optional.hpp> #include <atomic> #include <condition_variable> #include <mutex> #include <queue> #include <utility> namespace shard { namespace concurrency { template <typename T> class channel : private core::non_copyable { public: using value_type = T; using size_type = std::size_t; public: /// Default constructor channel() = default; /// Destructor that closes the channel and thus notifies waiting threads ~channel() { close(); } /// Add a new item to the channel by copying it void put(const value_type& value) { if (!m_open) { return; } // put the value on the queue { std::lock_guard<std::mutex> lock(m_mutex); m_queue.push(value); } // lock released before notifying m_cv.notify_one(); } /// Add a new item to the channel by moving it void put(value_type&& value) { if (!m_open) { return; } // put the value on the queue { std::lock_guard<std::mutex> lock(m_mutex); m_queue.push(std::move(value)); } // lock released before notifying m_cv.notify_one(); } /// Add a new item to the channel by creating it in-place template <typename... Args> void emplace(Args&&... args) { if (!m_open) { return; } // create the value in-place on the queue { std::lock_guard<std::mutex> lock(m_mutex); m_queue.emplace(std::forward<Args>(args)...); } // lock released before notifying m_cv.notify_one(); } /// Pop and retrieve the next value from the channel /// /// \note The calling thread is *NOT* blocked. /// /// \param out The reference to be assigned the value /// /// \return True if a value was retrieved, false if the channel was closed /// or if the queue is empty bool try_get(value_type& out) { std::lock_guard<std::mutex> lock(m_mutex); if (!m_open || m_queue.empty()) { return false; } out = std::move(m_queue.front()); m_queue.pop(); return true; } /// Pop and retrieve the next value from the channel /// /// \note The calling thread is *NOT* blocked. /// /// \return An optional value with the result if a value was retrieved from /// the queue, nullopt otherwise shard::optional<T> try_get_optional() { std::lock_guard<std::mutex> lock(m_mutex); if (!m_open || m_queue.empty()) { return shard::nullopt; } auto result = make_optional(std::move(m_queue.front())); m_queue.pop(); return result; } /// Pop and retrieve the next value from the channel /// /// \note If the queue is empty, the calling thread is blocked until there /// is an item on the queue or the channel is closed. /// /// \param out The reference to be assigned the value /// /// \return True if a value was retrieved, false if the channel was closed bool wait_get(value_type& out) { std::unique_lock<std::mutex> lock(m_mutex); // unblock if closed or there's something new on the queue m_cv.wait(lock, [this] { return !m_open || !m_queue.empty(); }); if (!m_open) { return false; } out = std::move(m_queue.front()); m_queue.pop(); return true; } /// Pop and retrieve the next value from the channel /// /// \note If the queue is empty, the calling thread is blocked until there /// is an item on the queue or the channel is closed. /// /// \return An optional value with the result if a value was retrieved from /// the queue, nullopt otherwise shard::optional<T> wait_get_optional() { std::unique_lock<std::mutex> lock(m_mutex); // unblock if closed or there's something new on the queue m_cv.wait(lock, [this] { return !m_open || !m_queue.empty(); }); if (!m_open) { return shard::nullopt; } auto result = make_optional(std::move(m_queue.front())); m_queue.pop(); return result; } /// Get number of items on the channel size_type size() const { std::lock_guard<std::mutex> lock(m_mutex); return m_queue.size(); } /// Check if channel is empty bool is_empty() const { std::lock_guard<std::mutex> lock(m_mutex); return m_queue.empty(); } /// Clear the channel, removing everything from the queue void clear() { { std::lock_guard<std::mutex> lock(m_mutex); while (!m_queue.empty()) { m_queue.pop(); } } // lock released before notifying m_cv.notify_all(); } /// Open the channel, notifying all waiting threads /// /// This will open the channel and notify threads only if it was closed /// before. void open() { bool was_open = m_open; m_open = true; if (!was_open) { m_cv.notify_all(); } } /// Close the channel, notifying all waiting threads /// /// This will close the channel and notify threads only if it was open /// before. The channel can later be reopened using open(). /// /// \note This will *NOT* clear the channel. void close() { bool was_open = m_open; m_open = false; if (was_open) { m_cv.notify_all(); } } /// Check if the channel is open bool is_open() const { return m_open; } /// Notify all waiting threads /// /// Useful in cases where the channel is populated before any threads are /// spawned. Once the threads are created, the channel can notify them that /// there are items to processed. /// /// \note Will only notify if the channel is open. void notify() { if (m_open) { m_cv.notify_all(); } } private: std::queue<value_type> m_queue; mutable std::mutex m_mutex; std::condition_variable m_cv; std::atomic<bool> m_open = ATOMIC_VAR_INIT(true); }; } // namespace concurrency // bring symbols into parent namespace using concurrency::channel; } // namespace shard #endif // SHARD_CONCURRENCY_CHANNEL_HPP
28.663755
79
0.587599
ikimol
79b7bc50e3feec0d780bc392d247762da59b9b34
352
cpp
C++
Practice Programs/alice_bob_cindi_dani.cpp
SR-Sunny-Raj/CPP_Language_Programs
3e10a365187f70cc473c5b62155ff51dc12e38b8
[ "MIT" ]
3
2021-02-04T17:59:00.000Z
2022-01-29T17:21:42.000Z
Practice Programs/alice_bob_cindi_dani.cpp
SR-Sunny-Raj/CPP_Language_Programs
3e10a365187f70cc473c5b62155ff51dc12e38b8
[ "MIT" ]
null
null
null
Practice Programs/alice_bob_cindi_dani.cpp
SR-Sunny-Raj/CPP_Language_Programs
3e10a365187f70cc473c5b62155ff51dc12e38b8
[ "MIT" ]
3
2021-10-02T14:38:21.000Z
2021-10-05T06:19:22.000Z
#include <iostream> using namespace std; int main() { string str1, str2, str3; cin >> str1 >> str2 >> str3; if (str1 != "Alice") cout << "Alice" << endl; else if (str2 != "Bob") cout << "Bob" << endl; else if (str3 != "Cindy") cout << "Cindy" << endl; else cout << "Dani" << endl; return 0; }
22
32
0.485795
SR-Sunny-Raj
79ba07b4f83837cb53909d50b2cf9aa25a796e3e
3,963
hxx
C++
src/core/include/ivy/io/transcodechannel.hxx
sikol/ivy
6365b8783353cf0c79c633bbc7110be95a55225c
[ "BSL-1.0" ]
null
null
null
src/core/include/ivy/io/transcodechannel.hxx
sikol/ivy
6365b8783353cf0c79c633bbc7110be95a55225c
[ "BSL-1.0" ]
null
null
null
src/core/include/ivy/io/transcodechannel.hxx
sikol/ivy
6365b8783353cf0c79c633bbc7110be95a55225c
[ "BSL-1.0" ]
null
null
null
/* * Copyright (c) 2019, 2020, 2021 SiKol Ltd. * Distributed under the Boost Software License, Version 1.0. */ #ifndef IVY_IO_TRANSCODECHANNEL_HXX_INCLUDED #define IVY_IO_TRANSCODECHANNEL_HXX_INCLUDED #include <deque> #include <span> #include <system_error> #include <ivy/charenc.hxx> #include <ivy/expected.hxx> #include <ivy/io/channel.hxx> #include <ivy/string.hxx> namespace ivy { template <typename source_encoding, typename target_encoding, sequential_channel base_channel, layer_ownership ownership> class itranscodechannel final : layer_base<base_channel, ownership> { std::deque<encoding_char_type<target_encoding>> _buffer; charconv<source_encoding, target_encoding> _charconv; public: using value_type = encoding_char_type<target_encoding>; using encoding_type = target_encoding; itranscodechannel(itranscodechannel &&) noexcept = default; auto operator=(itranscodechannel &&) noexcept -> itranscodechannel & = default; itranscodechannel(itranscodechannel const &) = delete; auto operator=(itranscodechannel const &) -> itranscodechannel & = delete; itranscodechannel(base_channel &c) requires( ownership == layer_ownership::borrow_layer) : layer_base<base_channel, ownership>(c) { } itranscodechannel(base_channel &&c) requires(ownership == layer_ownership::own_layer) : layer_base<base_channel, ownership>(std::move(c)) { } auto read(std::span<value_type>) noexcept -> expected<io_size_t, error>; }; template <typename source_encoding, typename target_encoding, sequential_input_channel base_channel> auto make_itranscodechannel(base_channel &b) { return itranscodechannel<source_encoding, target_encoding, base_channel, layer_ownership::borrow_layer>(b); } template <typename source_encoding, typename target_encoding, sequential_input_channel base_channel> auto make_itranscodechannel(base_channel &&b) { return itranscodechannel<source_encoding, target_encoding, base_channel, layer_ownership::own_layer>(std::move(b)); } template <typename source_encoding, typename target_encoding, sequential_channel base_channel, layer_ownership ownership> auto itranscodechannel<source_encoding, target_encoding, base_channel, ownership>::read(std::span<value_type> buf) noexcept -> expected<io_size_t, error> { if (_buffer.empty()) { typename encoding_traits<source_encoding>::char_type cbuf[1024 / sizeof( typename encoding_traits<source_encoding>::char_type)]; auto r = this->get_base_layer().read(cbuf); if (!r) return make_unexpected(r.error()); auto cdata = std::span(cbuf); _charconv.convert(cdata.subspan(0, *r), std::back_inserter(_buffer)); } auto can_read = std::min(_buffer.size(), buf.size()); std::ranges::copy(_buffer | std::views::take(can_read), std::ranges::begin(buf)); _buffer.erase(_buffer.begin(), std::next(_buffer.begin(), can_read)); return can_read; } } // namespace ivy #endif // IVY_IO_TRANSCODECHANNEL_HXX_INCLUDED
35.383929
81
0.574817
sikol
79ba1de0a45375b206513f390cf7fa8e7a7a3e38
153
cpp
C++
src/mango/core/wire/request/ScenarioRequest.cpp
vero-zhang/mango
0cc8d34a8b729151953df41a7e9cd26324345d44
[ "MIT" ]
null
null
null
src/mango/core/wire/request/ScenarioRequest.cpp
vero-zhang/mango
0cc8d34a8b729151953df41a7e9cd26324345d44
[ "MIT" ]
null
null
null
src/mango/core/wire/request/ScenarioRequest.cpp
vero-zhang/mango
0cc8d34a8b729151953df41a7e9cd26324345d44
[ "MIT" ]
null
null
null
#include "mango/core/wire/request/ScenarioRequest.h" MANGO_NS_BEGIN ScenarioRequest::ScenarioRequest(const Tags& tags) : tags(tags) {} MANGO_NS_END
15.3
52
0.784314
vero-zhang
79be6d71569663060fd3db563a97ed31f9a909d9
13,800
cpp
C++
src/commands/ScreenshotCommand.cpp
Audacity-Team/Audacity
61cdb408abcb2260c539cdffb1602a33e366ec2d
[ "CC-BY-3.0", "MIT" ]
24
2015-01-22T13:55:17.000Z
2021-06-25T09:41:19.000Z
src/commands/ScreenshotCommand.cpp
Audacity-Team/Audacity
61cdb408abcb2260c539cdffb1602a33e366ec2d
[ "CC-BY-3.0", "MIT" ]
null
null
null
src/commands/ScreenshotCommand.cpp
Audacity-Team/Audacity
61cdb408abcb2260c539cdffb1602a33e366ec2d
[ "CC-BY-3.0", "MIT" ]
14
2015-01-12T23:13:35.000Z
2021-01-16T09:02:41.000Z
/********************************************************************** Audacity - A Digital Audio Editor Copyright 1999-2009 Audacity Team License: GPL v2 - see LICENSE.txt Dominic Mazzoni Dan Horgan ******************************************************************//** \class ScreenshotCommand \brief Implements a command for capturing various areas of the screen or project window. *//*******************************************************************/ #include "ScreenshotCommand.h" #include "CommandTargets.h" #include "../AudacityApp.h" #include "../Project.h" #include <wx/toplevel.h> #include <wx/dcscreen.h> #include <wx/dcmemory.h> #include <wx/settings.h> #include <wx/bitmap.h> #include "../TrackPanel.h" #include "../toolbars/ToolManager.h" #include "../toolbars/ToolBar.h" #include "../toolbars/ControlToolBar.h" #include "../toolbars/DeviceToolBar.h" #include "../toolbars/EditToolBar.h" #include "../toolbars/MeterToolBar.h" #include "../toolbars/MixerToolBar.h" #include "../toolbars/SelectionBar.h" #include "../toolbars/ToolsToolBar.h" #include "../toolbars/TranscriptionToolBar.h" #include "../widgets/Ruler.h" wxTopLevelWindow *ScreenshotCommand::GetFrontWindow(AudacityProject *project) { wxWindow *front = NULL; wxWindow *proj = wxGetTopLevelParent(project); // This is kind of an odd hack. There's no method to enumerate all // possible windows, so we search the whole screen for any windows // that are not this one and not the given Audacity project and // if we find anything, we assume that's the dialog the user wants // to capture. int width, height, x, y; wxDisplaySize(&width, &height); for (x = 0; x < width; x += 50) { for (y = 0; y < height; y += 50) { wxWindow *win = wxFindWindowAtPoint(wxPoint(x, y)); if (win) { win = wxGetTopLevelParent(win); if (win != mIgnore && win != proj) { front = win; break; } } } } if (!front || !front->IsTopLevel()) { return (wxTopLevelWindow *)proj; } return (wxTopLevelWindow *)front; } wxRect ScreenshotCommand::GetBackgroundRect() { wxRect r; r.x = 16; r.y = 16; r.width = r.x * 2; r.height = r.y * 2; return r; } static void Yield() { int cnt; for (cnt = 10; cnt && !wxGetApp().Yield(true); cnt--) { wxMilliSleep(10); } wxMilliSleep(200); for (cnt = 10; cnt && !wxGetApp().Yield(true); cnt--) { wxMilliSleep(10); } } void ScreenshotCommand::Capture(wxString filename, wxWindow *window, int x, int y, int width, int height, bool bg) { if (window) { if (window->IsTopLevel()) { window->Raise(); } else { wxGetTopLevelParent(window)->Raise(); } } Yield(); int screenW, screenH; wxDisplaySize(&screenW, &screenH); wxBitmap full(screenW, screenH); wxScreenDC screenDC; wxMemoryDC fullDC; // We grab the whole screen image since there seems to be a problem with // using non-zero source coordinates on OSX. (as of wx2.8.9) fullDC.SelectObject(full); fullDC.Blit(0, 0, screenW, screenH, &screenDC, 0, 0); fullDC.SelectObject(wxNullBitmap); wxRect r(x, y, width, height); // Ensure within bounds (x/y are negative on Windows when maximized) r.Intersect(wxRect(0, 0, screenW, screenH)); // Convert to screen coordinates if needed if (window && window->GetParent() && !window->IsTopLevel()) { r.SetPosition(window->GetParent()->ClientToScreen(r.GetPosition())); } // Extract the actual image wxBitmap part = full.GetSubBitmap(r); // Add a background if (bg && mBackground) { wxRect b = GetBackgroundRect(); wxBitmap back(width + b.width, height + b.height); fullDC.SelectObject(back); fullDC.SetBackground(wxBrush(mBackColor, wxSOLID)); fullDC.Clear(); fullDC.DrawBitmap(part, b.x, b.y); fullDC.SelectObject(wxNullBitmap); part = back; } // Save the final image wxImage image = part.ConvertToImage(); if (image.SaveFile(filename)) { mOutput->Status(_("Saved ") + filename); } else { mOutput->Error(_("Error trying to save file: ") + filename); } ::wxBell(); } void ScreenshotCommand::CaptureToolbar(ToolManager *man, int type, wxString name) { bool visible = man->IsVisible(type); if (!visible) { man->ShowHide(type); Yield(); } wxWindow *w = man->GetToolBar(type); int x = 0, y = 0; int width, height; w->ClientToScreen(&x, &y); w->GetParent()->ScreenToClient(&x, &y); w->GetClientSize(&width, &height); Capture(name, w, x, y, width, height); if (!visible) { man->ShowHide(type); if (mIgnore) mIgnore->Raise(); } } void ScreenshotCommand::CaptureDock(wxWindow *win, wxString fileName) { int x = 0, y = 0; int width, height; win->ClientToScreen(&x, &y); win->GetParent()->ScreenToClient(&x, &y); win->GetClientSize(&width, &height); Capture(fileName, win, x, y, width, height); } wxString ScreenshotCommandType::BuildName() { return wxT("Screenshot"); } void ScreenshotCommandType::BuildSignature(CommandSignature &signature) { OptionValidator *captureModeValidator = new OptionValidator(); captureModeValidator->AddOption(wxT("window")); captureModeValidator->AddOption(wxT("fullwindow")); captureModeValidator->AddOption(wxT("windowplus")); captureModeValidator->AddOption(wxT("fullscreen")); captureModeValidator->AddOption(wxT("toolbars")); captureModeValidator->AddOption(wxT("selectionbar")); captureModeValidator->AddOption(wxT("tools")); captureModeValidator->AddOption(wxT("transport")); captureModeValidator->AddOption(wxT("mixer")); captureModeValidator->AddOption(wxT("meter")); captureModeValidator->AddOption(wxT("edit")); captureModeValidator->AddOption(wxT("device")); captureModeValidator->AddOption(wxT("transcription")); captureModeValidator->AddOption(wxT("trackpanel")); captureModeValidator->AddOption(wxT("ruler")); captureModeValidator->AddOption(wxT("tracks")); captureModeValidator->AddOption(wxT("firsttrack")); captureModeValidator->AddOption(wxT("secondtrack")); OptionValidator *backgroundValidator = new OptionValidator(); backgroundValidator->AddOption(wxT("Blue")); backgroundValidator->AddOption(wxT("White")); backgroundValidator->AddOption(wxT("None")); Validator *filePathValidator = new Validator(); signature.AddParameter(wxT("CaptureMode"), wxT("fullscreen"), captureModeValidator); signature.AddParameter(wxT("Background"), wxT("None"), backgroundValidator); signature.AddParameter(wxT("FilePath"), wxT(""), filePathValidator); } Command *ScreenshotCommandType::Create(CommandOutputTarget *target) { return new ScreenshotCommand(*this, target); } wxString ScreenshotCommand::MakeFileName(wxString path, wxString basename) { wxFileName prefixPath; prefixPath.AssignDir(path); wxString prefix = prefixPath.GetPath (wxPATH_GET_VOLUME|wxPATH_GET_SEPARATOR); wxString filename; int i = 0; do { filename.Printf(wxT("%s%s%03d.png"), prefix.c_str(), basename.c_str(), i); i++; } while (::wxFileExists(filename)); return filename; } bool ScreenshotCommand::Apply(CommandExecutionContext context) { // Read the parameters that were passed in wxString filePath = GetString(wxT("FilePath")); wxString captureMode = GetString(wxT("CaptureMode")); wxString background = GetString(wxT("Background")); // Build a suitable filename wxString fileName = MakeFileName(filePath, captureMode); if (background.IsSameAs(wxT("Blue"))) { mBackground = true; mBackColor = wxColour(51, 102, 153); } else if (background.IsSameAs(wxT("White"))) { mBackground = true; mBackColor = wxColour(255, 255, 255); } else { mBackground = false; } // Reset the toolbars to a known state context.proj->mToolManager->Reset(); wxTopLevelWindow *w = GetFrontWindow(context.proj); if (!w) { return false; } if (captureMode.IsSameAs(wxT("window"))) { int x = 0, y = 0; int width, height; w->ClientToScreen(&x, &y); w->GetClientSize(&width, &height); if (w != context.proj && w->GetTitle() != wxT("")) { fileName = MakeFileName(filePath, captureMode + (wxT("-") + w->GetTitle() + wxT("-"))); } Capture(fileName, w, x, y, width, height); } else if (captureMode.IsSameAs(wxT("fullwindow")) || captureMode.IsSameAs(wxT("windowplus"))) { wxRect r = w->GetRect(); r.SetPosition(w->GetScreenPosition()); r = w->GetScreenRect(); if (w != context.proj && w->GetTitle() != wxT("")) { fileName = MakeFileName(filePath, captureMode + (wxT("-") + w->GetTitle() + wxT("-"))); } #if defined(__WXGTK__) // In wxGTK, we need to include decoration sizes r.width += (wxSystemSettings::GetMetric(wxSYS_BORDER_X, w) * 2); r.height += wxSystemSettings::GetMetric(wxSYS_CAPTION_Y, w) + wxSystemSettings::GetMetric(wxSYS_BORDER_Y, w); #endif if (!mBackground && captureMode.IsSameAs(wxT("windowplus"))) { // background colour not selected but we want a background wxRect b = GetBackgroundRect(); r.x = (r.x - b.x) >= 0 ? (r.x - b.x): 0; r.y = (r.y - b.y) >= 0 ? (r.y - b.y): 0; r.width += b.width; r.height += b.height; } Capture(fileName, w, r.x, r.y, r.width, r.height, true); } else if (captureMode.IsSameAs(wxT("fullscreen"))) { int width, height; wxDisplaySize(&width, &height); Capture(fileName, w, 0, 0, width, height); } else if (captureMode.IsSameAs(wxT("toolbars"))) { CaptureDock(context.proj->mToolManager->GetTopDock(), fileName); } else if (captureMode.IsSameAs(wxT("selectionbar"))) { CaptureDock(context.proj->mToolManager->GetBotDock(), fileName); } else if (captureMode.IsSameAs(wxT("tools"))) { CaptureToolbar(context.proj->mToolManager, ToolsBarID, fileName); } else if (captureMode.IsSameAs(wxT("transport"))) { CaptureToolbar(context.proj->mToolManager, TransportBarID, fileName); } else if (captureMode.IsSameAs(wxT("mixer"))) { CaptureToolbar(context.proj->mToolManager, MixerBarID, fileName); } else if (captureMode.IsSameAs(wxT("meter"))) { CaptureToolbar(context.proj->mToolManager, MeterBarID, fileName); } else if (captureMode.IsSameAs(wxT("edit"))) { CaptureToolbar(context.proj->mToolManager, EditBarID, fileName); } else if (captureMode.IsSameAs(wxT("device"))) { CaptureToolbar(context.proj->mToolManager, DeviceBarID, fileName); } else if (captureMode.IsSameAs(wxT("transcription"))) { CaptureToolbar(context.proj->mToolManager, TranscriptionBarID, fileName); } else if (captureMode.IsSameAs(wxT("trackpanel"))) { TrackPanel *panel = context.proj->mTrackPanel; AdornedRulerPanel *ruler = panel->mRuler; int h = ruler->GetRulerHeight(); int x = 0, y = -h; int width, height; panel->ClientToScreen(&x, &y); panel->GetParent()->ScreenToClient(&x, &y); panel->GetClientSize(&width, &height); Capture(fileName, panel, x, y, width, height + h); } else if (captureMode.IsSameAs(wxT("ruler"))) { TrackPanel *panel = context.proj->mTrackPanel; AdornedRulerPanel *ruler = panel->mRuler; int x = 0, y = 0; int width, height; ruler->ClientToScreen(&x, &y); ruler->GetParent()->ScreenToClient(&x, &y); ruler->GetClientSize(&width, &height); height = ruler->GetRulerHeight(); Capture(fileName, ruler, x, y, width, height); } else if (captureMode.IsSameAs(wxT("tracks"))) { TrackPanel *panel = context.proj->mTrackPanel; int x = 0, y = 0; int width, height; panel->ClientToScreen(&x, &y); panel->GetParent()->ScreenToClient(&x, &y); panel->GetClientSize(&width, &height); Capture(fileName, panel, x, y, width, height); } else if (captureMode.IsSameAs(wxT("firsttrack"))) { TrackPanel *panel = context.proj->mTrackPanel; TrackListIterator iter(context.proj->GetTracks()); Track * t = iter.First(); if (!t) { return false; } wxRect r = panel->FindTrackRect(t, true); int x = 0, y = r.y - 3; int width, height; panel->ClientToScreen(&x, &y); panel->GetParent()->ScreenToClient(&x, &y); panel->GetClientSize(&width, &height); Capture(fileName, panel, x, y, width, r.height + 6); } else if (captureMode.IsSameAs(wxT("secondtrack"))) { TrackPanel *panel = context.proj->mTrackPanel; TrackListIterator iter(context.proj->GetTracks()); Track * t = iter.First(); if (!t) { return false; } if (t->GetLinked()) { t = iter.Next(); } t = iter.Next(); if (!t) { return false; } wxRect r = panel->FindTrackRect(t, true); int x = 0, y = r.y - 3; int width, height; panel->ClientToScreen(&x, &y); panel->GetParent()->ScreenToClient(&x, &y); panel->GetClientSize(&width, &height); Capture(fileName, panel, x, y, width, r.height + 6); } else { // Invalid capture mode! return false; } return true; }
28.105906
81
0.613768
Audacity-Team
79bf2bc92a01302721f77adb1ee71cde7d736086
282
cpp
C++
C++Code/1008.cpp
CrystianPrintes20/ProjetoUri
92a88ae2671a556f4d418c3605e9a2c6933dc9d8
[ "MIT" ]
null
null
null
C++Code/1008.cpp
CrystianPrintes20/ProjetoUri
92a88ae2671a556f4d418c3605e9a2c6933dc9d8
[ "MIT" ]
null
null
null
C++Code/1008.cpp
CrystianPrintes20/ProjetoUri
92a88ae2671a556f4d418c3605e9a2c6933dc9d8
[ "MIT" ]
null
null
null
//Questão: Salario #include <iostream> #include <iomanip> using namespace std; int main() { int N, HT; cin >> N >> HT; float SH; cin >> SH; cout << "NUMBER = "<< N <<endl; cout << fixed << setprecision(2); cout << "SALARY = U$ "<< HT*SH <<endl; return 0; }
16.588235
41
0.546099
CrystianPrintes20
79c2cc0898a994722fcb1ac0a5d0af17bc6cb10a
106
cpp
C++
test/llvm_test_code/module_wise/module_wise_8/src1.cpp
janniclas/phasar
324302ae96795e6f0a065c14d4f7756b1addc2a4
[ "MIT" ]
1
2022-02-15T07:56:29.000Z
2022-02-15T07:56:29.000Z
test/llvm_test_code/module_wise/module_wise_8/src1.cpp
fabianbs96/phasar
5b8acd046d8676f72ce0eb85ca20fdb0724de444
[ "MIT" ]
null
null
null
test/llvm_test_code/module_wise/module_wise_8/src1.cpp
fabianbs96/phasar
5b8acd046d8676f72ce0eb85ca20fdb0724de444
[ "MIT" ]
null
null
null
#include "src1.h" void foo(int &a, int &b, int &c) { c = a + b; inc(c); } void inc(int &a) { ++a; }
11.777778
34
0.471698
janniclas
79c2f119428a404b6b860101ce8b18f947f5bdee
478
cpp
C++
nd-coursework/books/cpp/C++Templates/basics/myfirstmain.cpp
crdrisko/nd-grad
f1765e4f24d7a4b1b3a76c64eb8d88bcca0eaa44
[ "MIT" ]
1
2020-09-26T12:38:55.000Z
2020-09-26T12:38:55.000Z
nd-coursework/books/cpp/C++Templates/basics/myfirstmain.cpp
crdrisko/nd-research
f1765e4f24d7a4b1b3a76c64eb8d88bcca0eaa44
[ "MIT" ]
null
null
null
nd-coursework/books/cpp/C++Templates/basics/myfirstmain.cpp
crdrisko/nd-research
f1765e4f24d7a4b1b3a76c64eb8d88bcca0eaa44
[ "MIT" ]
null
null
null
// Copyright (c) 2017 by Addison-Wesley, David Vandevoorde, Nicolai M. Josuttis, and Douglas Gregor. All rights reserved. // See the LICENSE file in the project root for more information. // // Name: myfirstmain.cpp // Author: crdrisko // Date: 08/12/2020-14:52:01 // Description: Using the printTypeof<> template #include "myfirst.hpp" int main() { double ice = 3.0; printTypeof(ice); // call function template for type double }
29.875
121
0.658996
crdrisko
79c537fe27718a983781d5afb6576759b3fcd8f2
26,326
cpp
C++
untests/flat_map_tests.cpp
BlackMATov/flat.hpp
98184d75a8227e47ac426b590fd23ead4859bb88
[ "MIT" ]
71
2019-05-04T01:34:33.000Z
2022-01-31T13:46:47.000Z
untests/flat_map_tests.cpp
BlackMATov/flat.hpp
98184d75a8227e47ac426b590fd23ead4859bb88
[ "MIT" ]
21
2019-05-04T11:23:59.000Z
2020-11-29T22:26:24.000Z
untests/flat_map_tests.cpp
BlackMATov/flat.hpp
98184d75a8227e47ac426b590fd23ead4859bb88
[ "MIT" ]
1
2019-05-06T11:04:38.000Z
2019-05-06T11:04:38.000Z
/******************************************************************************* * This file is part of the "https://github.com/blackmatov/flat.hpp" * For conditions of distribution and use, see copyright notice in LICENSE.md * Copyright (C) 2019-2021, by Matvey Cherevko (blackmatov@gmail.com) ******************************************************************************/ #include <flat.hpp/flat_map.hpp> #include "doctest/doctest.hpp" #include <deque> #include <string> #include <string_view> namespace { using namespace flat_hpp; template < typename T > class dummy_less { public: dummy_less() = default; dummy_less(int i) noexcept : i(i) {} bool operator()(const T& l, const T& r) const { return l < r; } int i = 0; }; template < typename T > class dummy_less2 { dummy_less2() = default; dummy_less2(dummy_less2&&) noexcept(false) {} bool operator()(const T& l, const T& r) const { return l < r; } }; template < typename T > [[maybe_unused]] void swap(dummy_less2<T>&, dummy_less2<T>&) noexcept { } template < typename T > class dummy_less3 { dummy_less3() = default; dummy_less3(dummy_less3&&) noexcept(false) {} bool operator()(const T& l, const T& r) const { return l < r; } }; template < typename T > constexpr std::add_const_t<T>& my_as_const(T& t) noexcept { return t; } } TEST_CASE("flat_map") { SUBCASE("guides") { { std::vector<std::pair<int,unsigned>> vs; auto s0 = flat_map(vs.begin(), vs.end()); auto s1 = flat_map(flat_hpp::sorted_range, vs.begin(), vs.end()); auto s2 = flat_map(flat_hpp::sorted_unique_range, vs.begin(), vs.end()); auto s3 = flat_map(vs.begin(), vs.end(), std::less<int>()); auto s4 = flat_map(flat_hpp::sorted_range, vs.begin(), vs.end(), std::less<int>()); auto s5 = flat_map(flat_hpp::sorted_unique_range, vs.begin(), vs.end(), std::less<int>()); auto s6 = flat_map(vs.begin(), vs.end(), std::allocator<int>()); auto s7 = flat_map(flat_hpp::sorted_range, vs.begin(), vs.end(), std::allocator<int>()); auto s8 = flat_map(flat_hpp::sorted_unique_range, vs.begin(), vs.end(), std::allocator<int>()); auto s9 = flat_map(vs.begin(), vs.end(), std::less<int>(), std::allocator<int>()); auto s10 = flat_map(flat_hpp::sorted_range, vs.begin(), vs.end(), std::less<int>(), std::allocator<int>()); auto s11 = flat_map(flat_hpp::sorted_unique_range, vs.begin(), vs.end(), std::less<int>(), std::allocator<int>()); STATIC_REQUIRE(std::is_same_v<decltype(s0)::key_type, int>); STATIC_REQUIRE(std::is_same_v<decltype(s1)::key_type, int>); STATIC_REQUIRE(std::is_same_v<decltype(s2)::key_type, int>); STATIC_REQUIRE(std::is_same_v<decltype(s3)::key_type, int>); STATIC_REQUIRE(std::is_same_v<decltype(s4)::key_type, int>); STATIC_REQUIRE(std::is_same_v<decltype(s5)::key_type, int>); STATIC_REQUIRE(std::is_same_v<decltype(s6)::key_type, int>); STATIC_REQUIRE(std::is_same_v<decltype(s7)::key_type, int>); STATIC_REQUIRE(std::is_same_v<decltype(s8)::key_type, int>); STATIC_REQUIRE(std::is_same_v<decltype(s9)::key_type, int>); STATIC_REQUIRE(std::is_same_v<decltype(s10)::key_type, int>); STATIC_REQUIRE(std::is_same_v<decltype(s11)::key_type, int>); STATIC_REQUIRE(std::is_same_v<decltype(s0)::mapped_type, unsigned>); STATIC_REQUIRE(std::is_same_v<decltype(s1)::mapped_type, unsigned>); STATIC_REQUIRE(std::is_same_v<decltype(s2)::mapped_type, unsigned>); STATIC_REQUIRE(std::is_same_v<decltype(s3)::mapped_type, unsigned>); STATIC_REQUIRE(std::is_same_v<decltype(s4)::mapped_type, unsigned>); STATIC_REQUIRE(std::is_same_v<decltype(s5)::mapped_type, unsigned>); STATIC_REQUIRE(std::is_same_v<decltype(s6)::mapped_type, unsigned>); STATIC_REQUIRE(std::is_same_v<decltype(s7)::mapped_type, unsigned>); STATIC_REQUIRE(std::is_same_v<decltype(s8)::mapped_type, unsigned>); STATIC_REQUIRE(std::is_same_v<decltype(s9)::mapped_type, unsigned>); STATIC_REQUIRE(std::is_same_v<decltype(s10)::mapped_type, unsigned>); STATIC_REQUIRE(std::is_same_v<decltype(s11)::mapped_type, unsigned>); } { auto s1 = flat_map({std::pair{1,1u}, std::pair{2,2u}}); auto s2 = flat_map(flat_hpp::sorted_range, {std::pair{1,1u}, std::pair{2,2u}}); auto s3 = flat_map(flat_hpp::sorted_unique_range, {std::pair{1,1u}, std::pair{2,2u}}); STATIC_REQUIRE(std::is_same_v<decltype(s1)::key_type, int>); STATIC_REQUIRE(std::is_same_v<decltype(s2)::key_type, int>); STATIC_REQUIRE(std::is_same_v<decltype(s3)::key_type, int>); STATIC_REQUIRE(std::is_same_v<decltype(s1)::mapped_type, unsigned>); STATIC_REQUIRE(std::is_same_v<decltype(s2)::mapped_type, unsigned>); STATIC_REQUIRE(std::is_same_v<decltype(s3)::mapped_type, unsigned>); } { auto s1 = flat_map({std::pair{1,1u}, std::pair{2,2u}}, std::less<int>()); auto s2 = flat_map(flat_hpp::sorted_range, {std::pair{1,1u}, std::pair{2,2u}}, std::less<int>()); auto s3 = flat_map(flat_hpp::sorted_unique_range, {std::pair{1,1u}, std::pair{2,2u}}, std::less<int>()); STATIC_REQUIRE(std::is_same_v<decltype(s1)::key_type, int>); STATIC_REQUIRE(std::is_same_v<decltype(s2)::key_type, int>); STATIC_REQUIRE(std::is_same_v<decltype(s3)::key_type, int>); STATIC_REQUIRE(std::is_same_v<decltype(s1)::mapped_type, unsigned>); STATIC_REQUIRE(std::is_same_v<decltype(s2)::mapped_type, unsigned>); STATIC_REQUIRE(std::is_same_v<decltype(s3)::mapped_type, unsigned>); } { auto s1 = flat_map({std::pair{1,1u}, std::pair{2,2u}}, std::allocator<int>()); auto s2 = flat_map(flat_hpp::sorted_range, {std::pair{1,1u}, std::pair{2,2u}}, std::allocator<int>()); auto s3 = flat_map(flat_hpp::sorted_unique_range, {std::pair{1,1u}, std::pair{2,2u}}, std::allocator<int>()); STATIC_REQUIRE(std::is_same_v<decltype(s1)::key_type, int>); STATIC_REQUIRE(std::is_same_v<decltype(s2)::key_type, int>); STATIC_REQUIRE(std::is_same_v<decltype(s3)::key_type, int>); STATIC_REQUIRE(std::is_same_v<decltype(s1)::mapped_type, unsigned>); STATIC_REQUIRE(std::is_same_v<decltype(s2)::mapped_type, unsigned>); STATIC_REQUIRE(std::is_same_v<decltype(s3)::mapped_type, unsigned>); } { auto s1 = flat_map({std::pair{1,1u}, std::pair{2,2u}}, std::less<int>(), std::allocator<int>()); auto s2 = flat_map(flat_hpp::sorted_range, {std::pair{1,1u}, std::pair{2,2u}}, std::less<int>(), std::allocator<int>()); auto s3 = flat_map(flat_hpp::sorted_unique_range, {std::pair{1,1u}, std::pair{2,2u}}, std::less<int>(), std::allocator<int>()); STATIC_REQUIRE(std::is_same_v<decltype(s1)::key_type, int>); STATIC_REQUIRE(std::is_same_v<decltype(s2)::key_type, int>); STATIC_REQUIRE(std::is_same_v<decltype(s3)::key_type, int>); STATIC_REQUIRE(std::is_same_v<decltype(s1)::mapped_type, unsigned>); STATIC_REQUIRE(std::is_same_v<decltype(s2)::mapped_type, unsigned>); STATIC_REQUIRE(std::is_same_v<decltype(s3)::mapped_type, unsigned>); } } SUBCASE("detail") { STATIC_REQUIRE(detail::is_transparent<std::less<>, int>::value); STATIC_REQUIRE_FALSE(detail::is_transparent<std::less<int>, int>::value); } SUBCASE("sizeof") { REQUIRE(sizeof(flat_map<int, unsigned>) == sizeof(std::vector<std::pair<int, unsigned>>)); struct vc : flat_map<int, unsigned>::value_compare { int i; }; REQUIRE(sizeof(vc) == sizeof(int)); } SUBCASE("noexcept") { using alloc_t = std::allocator<std::pair<int,unsigned>>; using map_t = flat_map<int, unsigned, dummy_less<int>, std::vector<std::pair<int,unsigned>, alloc_t>>; using map2_t = flat_map<int, unsigned, dummy_less2<int>>; using map3_t = flat_map<int, unsigned, dummy_less3<int>>; STATIC_REQUIRE(std::is_nothrow_default_constructible_v<map_t>); STATIC_REQUIRE(std::is_nothrow_move_constructible_v<map_t>); STATIC_REQUIRE(std::is_nothrow_move_assignable_v<map_t>); STATIC_REQUIRE(std::is_nothrow_swappable_v<map_t>); STATIC_REQUIRE(std::is_nothrow_swappable_v<map2_t>); STATIC_REQUIRE(!std::is_nothrow_swappable_v<map3_t>); STATIC_REQUIRE(noexcept(std::declval<map_t&>().begin())); STATIC_REQUIRE(noexcept(std::declval<const map_t&>().begin())); STATIC_REQUIRE(noexcept(std::declval<const map_t&>().cbegin())); STATIC_REQUIRE(noexcept(std::declval<map_t&>().end())); STATIC_REQUIRE(noexcept(std::declval<const map_t&>().end())); STATIC_REQUIRE(noexcept(std::declval<const map_t&>().cend())); STATIC_REQUIRE(noexcept(std::declval<map_t&>().rbegin())); STATIC_REQUIRE(noexcept(std::declval<const map_t&>().rbegin())); STATIC_REQUIRE(noexcept(std::declval<const map_t&>().crbegin())); STATIC_REQUIRE(noexcept(std::declval<map_t&>().rend())); STATIC_REQUIRE(noexcept(std::declval<const map_t&>().rend())); STATIC_REQUIRE(noexcept(std::declval<const map_t&>().crend())); STATIC_REQUIRE(noexcept(std::declval<const map_t&>().empty())); STATIC_REQUIRE(noexcept(std::declval<const map_t&>().size())); STATIC_REQUIRE(noexcept(std::declval<const map_t&>().max_size())); STATIC_REQUIRE(noexcept(std::declval<const map_t&>().capacity())); STATIC_REQUIRE(noexcept(std::declval<map_t&>().clear())); } SUBCASE("types") { using map_t = flat_map<int, unsigned>; STATIC_REQUIRE(std::is_same_v<map_t::key_type, int>); STATIC_REQUIRE(std::is_same_v<map_t::mapped_type, unsigned>); STATIC_REQUIRE(std::is_same_v<map_t::value_type, std::pair<int, unsigned>>); STATIC_REQUIRE(std::is_same_v<map_t::size_type, std::size_t>); STATIC_REQUIRE(std::is_same_v<map_t::difference_type, std::ptrdiff_t>); STATIC_REQUIRE(std::is_same_v<map_t::reference, std::pair<int, unsigned>&>); STATIC_REQUIRE(std::is_same_v<map_t::const_reference, const std::pair<int, unsigned>&>); STATIC_REQUIRE(std::is_same_v<map_t::pointer, std::pair<int, unsigned>*>); STATIC_REQUIRE(std::is_same_v<map_t::const_pointer, const std::pair<int, unsigned>*>); } SUBCASE("ctors") { using alloc_t = std::allocator< std::pair<int,unsigned>>; using map_t = flat_map< int, unsigned, std::less<int>, std::vector<std::pair<int,unsigned>, alloc_t>>; using map2_t = flat_map< int, unsigned, std::greater<int>, std::vector<std::pair<int,unsigned>, alloc_t>>; using vec_t = std::vector< std::pair<int,unsigned>, alloc_t>; { auto s0 = map_t(); auto s1 = map2_t(alloc_t()); auto s2 = map_t(std::less<int>()); auto s3 = map2_t(std::greater<int>(), alloc_t()); } { vec_t v{{1,30},{2,20},{3,10}}; auto s0 = map_t(v.cbegin(), v.cend()); auto s1 = map2_t(v.cbegin(), v.cend(), alloc_t()); auto s2 = map_t(v.cbegin(), v.cend(), std::less<int>()); auto s3 = map2_t(v.cbegin(), v.cend(), std::greater<int>(), alloc_t()); REQUIRE(vec_t(s0.begin(), s0.end()) == vec_t({{1,30},{2,20},{3,10}})); REQUIRE(vec_t(s1.begin(), s1.end()) == vec_t({{3,10},{2,20},{1,30}})); REQUIRE(vec_t(s2.begin(), s2.end()) == vec_t({{1,30},{2,20},{3,10}})); REQUIRE(vec_t(s3.begin(), s3.end()) == vec_t({{3,10},{2,20},{1,30}})); } { auto s0 = map_t({{0,1}, {1,2}}); auto s1 = map_t({{0,1}, {1,2}}, alloc_t()); auto s2 = map_t({{0,1}, {1,2}}, std::less<int>()); auto s3 = map_t({{0,1}, {1,2}}, std::less<int>(), alloc_t()); REQUIRE(vec_t(s0.begin(), s0.end()) == vec_t({{0,1},{1,2}})); REQUIRE(vec_t(s1.begin(), s1.end()) == vec_t({{0,1},{1,2}})); REQUIRE(vec_t(s2.begin(), s2.end()) == vec_t({{0,1},{1,2}})); REQUIRE(vec_t(s3.begin(), s3.end()) == vec_t({{0,1},{1,2}})); } { auto s0 = map_t{{0,1}, {1,2}}; auto s1 = s0; REQUIRE(s0 == map_t{{0,1}, {1,2}}); REQUIRE(s1 == map_t{{0,1}, {1,2}}); auto s2 = std::move(s1); REQUIRE(s1.empty()); REQUIRE(s2 == map_t{{0,1}, {1,2}}); auto s3 = map_t(s2, alloc_t()); REQUIRE(s2 == s3); auto s4 = map_t(std::move(s3), alloc_t()); REQUIRE(s3.empty()); REQUIRE(s4 == map_t{{0,1}, {1,2}}); } { auto s0 = map_t{{0,1}, {1,2}}; map_t s1; s1 = s0; REQUIRE(s0 == map_t{{0,1}, {1,2}}); REQUIRE(s1 == map_t{{0,1}, {1,2}}); map_t s2; s2 = std::move(s1); REQUIRE(s0 == map_t{{0,1}, {1,2}}); REQUIRE(s1.empty()); REQUIRE(s2 == map_t{{0,1}, {1,2}}); map_t s3; s3 = {{0,1}, {1,2}}; REQUIRE(s3 == map_t{{0,1}, {1,2}}); } { auto s0 = map_t(sorted_range, {{1,4},{2,3},{2,2},{3,1}}); REQUIRE(s0 == map_t{{1,4},{2,3},{3,1}}); vec_t v1({{1,4},{2,3},{2,2},{3,1}}); auto s1 = map_t(sorted_range, v1.begin(), v1.end()); REQUIRE(s1 == map_t{{1,4},{2,3},{3,1}}); } } SUBCASE("capacity") { using map_t = flat_map<int, unsigned>; { map_t s0; REQUIRE(s0.empty()); REQUIRE_FALSE(s0.size()); REQUIRE(s0.max_size() == std::vector<std::pair<int,unsigned>>().max_size()); s0.insert({2,42}); REQUIRE_FALSE(s0.empty()); REQUIRE(s0.size() == 1u); REQUIRE(s0.max_size() == std::vector<std::pair<int,unsigned>>().max_size()); s0.insert({2,84}); REQUIRE(s0.size() == 1u); s0.insert({3,84}); REQUIRE(s0.size() == 2u); s0.clear(); REQUIRE(s0.empty()); REQUIRE_FALSE(s0.size()); REQUIRE(s0.max_size() == std::vector<std::pair<int,unsigned>>().max_size()); } { map_t s0; REQUIRE(s0.capacity() == 0); s0.reserve(42); REQUIRE(s0.capacity() == 42); s0.insert({{1,2},{2,3},{3,4}}); REQUIRE(s0.capacity() == 42); s0.shrink_to_fit(); REQUIRE(s0.size() == 3); REQUIRE(s0.capacity() == 3); REQUIRE(s0 == map_t{{1,2},{2,3},{3,4}}); using alloc2_t = std::allocator< std::pair<int, unsigned>>; using map2_t = flat_map< int, unsigned, std::less<int>, std::deque<std::pair<int, unsigned>, alloc2_t>>; map2_t s1; s1.insert({{1,2},{2,3},{3,4}}); REQUIRE(s1 == map2_t{{1,2},{2,3},{3,4}}); } } SUBCASE("access") { struct obj_t { obj_t(int i) : i(i) {} int i; bool operator<(const obj_t& o) const { return i < o.i; } bool operator==(const obj_t& o) const { return i == o.i; } }; using map_t = flat_map<obj_t, unsigned>; map_t s0; obj_t k1(1); s0[k1] = 42; REQUIRE(s0[k1] == 42); REQUIRE(s0 == map_t{{1,42}}); s0[1] = 84; REQUIRE(s0[1] == 84); REQUIRE(s0 == map_t{{1,84}}); s0[2] = 21; REQUIRE(s0[2] == 21); REQUIRE(s0 == map_t{{1,84},{2,21}}); REQUIRE(s0.at(1) == 84); REQUIRE(my_as_const(s0).at(k1) == 84); REQUIRE_THROWS_AS(s0.at(0), std::out_of_range); REQUIRE_THROWS_AS(my_as_const(s0).at(0), std::out_of_range); } SUBCASE("inserts") { struct obj_t { obj_t(int i) : i(i) {} int i; bool operator<(const obj_t& o) const { return i < o.i; } bool operator==(const obj_t& o) const { return i == o.i; } }; using map_t = flat_map<obj_t, obj_t>; { map_t s0; auto k1_42 = std::make_pair(1, 42); auto k3_84 = std::make_pair(3, 84); auto i0 = s0.insert(k1_42); REQUIRE(s0 == map_t{{1,42}}); REQUIRE(i0 == std::make_pair(s0.begin(), true)); auto i1 = s0.insert(std::make_pair(1, obj_t(42))); REQUIRE(s0 == map_t{{1,42}}); REQUIRE(i1 == std::make_pair(s0.begin(), false)); auto i2 = s0.insert(std::make_pair(2, obj_t(42))); REQUIRE(s0 == map_t{{1,42},{2,42}}); REQUIRE(i2 == std::make_pair(s0.begin() + 1, true)); auto i3 = s0.insert(s0.cend(), k3_84); REQUIRE(i3 == s0.begin() + 2); s0.insert(s0.cend(), std::make_pair(4, obj_t(84))); auto i4 = s0.insert(s0.cend(), std::make_pair(0, obj_t(21))); REQUIRE(i4 == s0.begin()); auto i5 = s0.emplace(5, 100500); REQUIRE(i5 == std::make_pair(s0.end() - 1, true)); REQUIRE(s0 == map_t{{0,21},{1,42},{2,42},{3,84},{4,84},{5,100500}}); auto i6 = s0.emplace_hint(s0.cend(), 6, 100500); REQUIRE(i6 == s0.end() - 1); REQUIRE(s0 == map_t{{0,21},{1,42},{2,42},{3,84},{4,84},{5,100500},{6,100500}}); } { map_t s0; s0.insert({{6,2},{4,6},{2,4},{4,2}}); REQUIRE(s0 == map_t{{2,4},{4,6},{6,2}}); s0.insert({{9,3},{7,5},{3,9},{5,3},{5,3}}); REQUIRE(s0 == map_t{{2,4},{3,9},{4,6},{5,3},{6,2},{7,5},{9,3}}); } { map_t s0; s0.insert(sorted_unique_range, {{1,3},{2,2},{3,1}}); REQUIRE(s0 == map_t{{1,3},{2,2},{3,1}}); map_t s1; s1.insert(sorted_range, {{1,3},{2,2},{2,2},{3,1}}); REQUIRE(s1 == map_t{{1,3},{2,2},{3,1}}); } { map_t s0; auto i0 = s0.insert_or_assign(1, 4); REQUIRE(i0 == std::make_pair(s0.begin(), true)); REQUIRE(s0 == map_t{{1,4}}); auto i1 = s0.insert_or_assign(1, 8); REQUIRE(i1 == std::make_pair(s0.begin(), false)); REQUIRE(s0 == map_t{{1,8}}); const obj_t k0{2}; auto i2 = s0.insert_or_assign(k0, 6); REQUIRE(i2 == std::make_pair(s0.begin() + 1, true)); REQUIRE(s0 == map_t{{1,8}, {2,6}}); auto i3 = s0.insert_or_assign(k0, 2); REQUIRE(i3 == std::make_pair(s0.begin() + 1, false)); REQUIRE(s0 == map_t{{1,8}, {2,2}}); } { map_t s0; auto i0 = s0.try_emplace(1, 4); REQUIRE(i0 == std::make_pair(s0.begin(), true)); REQUIRE(s0 == map_t{{1,4}}); auto i1 = s0.try_emplace(1, 8); REQUIRE(i1 == std::make_pair(s0.begin(), false)); REQUIRE(s0 == map_t{{1,4}}); } } SUBCASE("erasers") { using map_t = flat_map<int, unsigned>; { map_t s0{{1,2},{2,3},{3,4}}; s0.clear(); REQUIRE(s0.empty()); } { map_t s0{{1,2},{2,3},{3,4}}; auto i = s0.erase(s0.find(2)); REQUIRE(i == s0.begin() + 1); REQUIRE(s0 == map_t{{1,2},{3,4}}); } { map_t s0{{1,2},{2,3},{3,4}}; auto i = s0.erase(s0.begin() + 1, s0.end()); REQUIRE(i == s0.end()); REQUIRE(s0 == map_t{{1,2}}); } { map_t s0{{1,2},{2,3},{3,4}}; REQUIRE(s0.erase(1) == 1); REQUIRE(s0.erase(6) == 0); REQUIRE(s0 == map_t{{2,3},{3,4}}); } { map_t s0{{1,2},{2,3},{3,4}}; map_t s1{{2,3},{3,4},{5,6}}; s0.swap(s1); REQUIRE(s0 == map_t{{2,3},{3,4},{5,6}}); REQUIRE(s1 == map_t{{1,2},{2,3},{3,4}}); swap(s1, s0); REQUIRE(s0 == map_t{{1,2},{2,3},{3,4}}); REQUIRE(s1 == map_t{{2,3},{3,4},{5,6}}); } } SUBCASE("lookup") { using map_t = flat_map<int, unsigned>; { map_t s0{{1,2},{2,3},{3,4},{4,5},{5,6}}; REQUIRE(s0.count(3)); REQUIRE_FALSE(s0.count(6)); REQUIRE(my_as_const(s0).count(5)); REQUIRE_FALSE(my_as_const(s0).count(0)); } { map_t s0{{1,2},{2,3},{3,4},{4,5},{5,6}}; REQUIRE(s0.find(2) == s0.begin() + 1); REQUIRE(my_as_const(s0).find(3) == s0.cbegin() + 2); REQUIRE(s0.find(6) == s0.end()); REQUIRE(my_as_const(s0).find(0) == s0.cend()); REQUIRE(my_as_const(s0).contains(1)); REQUIRE(my_as_const(s0).contains(3)); REQUIRE_FALSE(my_as_const(s0).contains(0)); } { map_t s0{{1,2},{2,3},{3,4},{4,5},{5,6}}; REQUIRE(s0.equal_range(3) == std::make_pair(s0.begin() + 2, s0.begin() + 3)); REQUIRE(s0.equal_range(6) == std::make_pair(s0.end(), s0.end())); REQUIRE(my_as_const(s0).equal_range(3) == std::make_pair(s0.cbegin() + 2, s0.cbegin() + 3)); REQUIRE(my_as_const(s0).equal_range(0) == std::make_pair(s0.cbegin(), s0.cbegin())); } { map_t s0{{0,1},{3,2},{6,3}}; REQUIRE(s0.lower_bound(0) == s0.begin()); REQUIRE(s0.lower_bound(1) == s0.begin() + 1); REQUIRE(s0.lower_bound(10) == s0.end()); REQUIRE(my_as_const(s0).lower_bound(-1) == s0.cbegin()); REQUIRE(my_as_const(s0).lower_bound(7) == s0.cbegin() + 3); } } SUBCASE("heterogeneous") { flat_map<std::string, int, std::less<>> s0{{"hello", 42}, {"world", 84}}; REQUIRE(s0.find(std::string_view("hello")) == s0.begin()); REQUIRE(my_as_const(s0).find(std::string_view("world")) == s0.begin() + 1); REQUIRE(s0.find(std::string_view("42")) == s0.end()); REQUIRE(my_as_const(s0).find(std::string_view("42")) == s0.cend()); REQUIRE(my_as_const(s0).contains(std::string_view("hello"))); REQUIRE_FALSE(my_as_const(s0).contains(std::string_view("42"))); REQUIRE(my_as_const(s0).count(std::string_view("hello")) == 1); REQUIRE(my_as_const(s0).count(std::string_view("hello_42")) == 0); REQUIRE(s0.upper_bound(std::string_view("hello")) == s0.begin() + 1); REQUIRE(my_as_const(s0).upper_bound(std::string_view("hello")) == s0.begin() + 1); REQUIRE(s0.at(std::string_view("world")) == 84); REQUIRE(my_as_const(s0).at(std::string_view("world")) == 84); } SUBCASE("observers") { struct my_less { int i; my_less(int i) : i(i) {} bool operator()(int l, int r) const { return l < r; } }; using map_t = flat_map<int, unsigned, my_less>; map_t s0(my_less(42)); REQUIRE(my_as_const(s0).key_comp().i == 42); REQUIRE(my_as_const(s0).value_comp()({2,50},{4,20})); } SUBCASE("custom_less") { using map_t = flat_map<int, unsigned, dummy_less<int>>; auto s0 = map_t(dummy_less<int>(42)); auto s1 = map_t(dummy_less<int>(21)); REQUIRE(s0.key_comp().i == 42); REQUIRE(s1.key_comp().i == 21); s0.swap(s1); REQUIRE(s0.key_comp().i == 21); REQUIRE(s1.key_comp().i == 42); } SUBCASE("operators") { using map_t = flat_map<int, unsigned>; REQUIRE(map_t{{1,2},{3,4}} == map_t{{3,4},{1,2}}); REQUIRE_FALSE(map_t{{1,2},{3,4}} == map_t{{2,4},{1,2}}); REQUIRE_FALSE(map_t{{1,2},{3,4}} == map_t{{1,3},{1,2}}); REQUIRE_FALSE(map_t{{1,2},{3,4}} == map_t{{3,4},{1,2},{0,0}}); REQUIRE_FALSE(map_t{{1,2},{3,4}} != map_t{{3,4},{1,2}}); REQUIRE(map_t{{1,2},{3,4}} != map_t{{2,4},{1,2}}); REQUIRE(map_t{{1,2},{3,4}} != map_t{{1,3},{1,2}}); REQUIRE(map_t{{1,2},{3,4}} != map_t{{3,4},{1,2},{0,0}}); REQUIRE(map_t{{0,2},{3,4}} < map_t{{1,2},{3,4}}); REQUIRE(map_t{{1,1},{3,4}} < map_t{{1,2},{3,4}}); REQUIRE(map_t{{1,2},{3,4}} < map_t{{1,2},{3,4},{5,6}}); REQUIRE(map_t{{0,2},{3,4}} <= map_t{{1,2},{3,4}}); REQUIRE(map_t{{1,1},{3,4}} <= map_t{{1,2},{3,4}}); REQUIRE(map_t{{1,2},{3,4}} <= map_t{{1,2},{3,4},{5,6}}); REQUIRE(map_t{{1,2},{3,4}} > map_t{{0,2},{3,4}}); REQUIRE(map_t{{1,2},{3,4}} > map_t{{1,1},{3,4}}); REQUIRE(map_t{{1,2},{3,4},{5,6}} > map_t{{1,2},{3,4}}); REQUIRE(map_t{{1,2},{3,4}} >= map_t{{0,2},{3,4}}); REQUIRE(map_t{{1,2},{3,4}} >= map_t{{1,1},{3,4}}); REQUIRE(map_t{{1,2},{3,4},{5,6}} >= map_t{{1,2},{3,4}}); REQUIRE_FALSE(map_t{{1,2},{3,4}} < map_t{{1,2},{3,4}}); REQUIRE(map_t{{1,2},{3,4}} <= map_t{{1,2},{3,4}}); REQUIRE_FALSE(map_t{{1,2},{3,4}} > map_t{{1,2},{3,4}}); REQUIRE(map_t{{1,2},{3,4}} >= map_t{{1,2},{3,4}}); const map_t s0; REQUIRE(s0 == s0); REQUIRE_FALSE(s0 != s0); REQUIRE_FALSE(s0 < s0); REQUIRE_FALSE(s0 > s0); REQUIRE(s0 <= s0); REQUIRE(s0 >= s0); } }
40.009119
139
0.517245
BlackMATov
79c86d2dcdb409c36b8cbd454c4c168756a080fc
594
cc
C++
src/opustags.cc
hackerb9/opustags
3d941961c88053259b4d249675f8903b80c6f7c6
[ "BSD-3-Clause" ]
38
2016-07-10T03:01:26.000Z
2022-03-17T16:17:17.000Z
src/opustags.cc
hackerb9/opustags
3d941961c88053259b4d249675f8903b80c6f7c6
[ "BSD-3-Clause" ]
51
2016-03-16T10:51:50.000Z
2022-02-25T19:50:57.000Z
src/opustags.cc
hackerb9/opustags
3d941961c88053259b4d249675f8903b80c6f7c6
[ "BSD-3-Clause" ]
9
2018-05-31T18:11:08.000Z
2022-03-17T16:18:05.000Z
/** * \file src/opustags.cc * \brief Main function for opustags. * * See opustags.h for the program's documentation. */ #include <opustags.h> #include <locale.h> /** * Main function of the opustags binary. * * Does practically nothing but call the cli module. */ int main(int argc, char** argv) { try { setlocale(LC_ALL, ""); ot::options opt = ot::parse_options(argc, argv, stdin); ot::run(opt); return 0; } catch (const ot::status& rc) { if (!rc.message.empty()) fprintf(stderr, "error: %s\n", rc.message.c_str()); return rc == ot::st::bad_arguments ? 2 : 1; } }
20.482759
57
0.636364
hackerb9
79c8b503e1bfbf60f47f62b2be068268d4869a83
48,323
cpp
C++
test/TestApp/AutoGenTests/AutoGenSharedGroupsTests.cpp
jasonsandlin/PlayFabCoreCSdk
ecf51e9a7a90e579efed595bd1d76ec8f3a1ae19
[ "Apache-2.0" ]
null
null
null
test/TestApp/AutoGenTests/AutoGenSharedGroupsTests.cpp
jasonsandlin/PlayFabCoreCSdk
ecf51e9a7a90e579efed595bd1d76ec8f3a1ae19
[ "Apache-2.0" ]
null
null
null
test/TestApp/AutoGenTests/AutoGenSharedGroupsTests.cpp
jasonsandlin/PlayFabCoreCSdk
ecf51e9a7a90e579efed595bd1d76ec8f3a1ae19
[ "Apache-2.0" ]
null
null
null
#include "TestAppPch.h" #include "TestContext.h" #include "TestApp.h" #include "AutoGenSharedGroupsTests.h" #include "XAsyncHelper.h" #include "playfab/PFAuthentication.h" namespace PlayFabUnit { using namespace PlayFab::Wrappers; AutoGenSharedGroupsTests::SharedGroupsTestData AutoGenSharedGroupsTests::testData; void AutoGenSharedGroupsTests::Log(std::stringstream& ss) { TestApp::LogPut(ss.str().c_str()); ss.str(std::string()); ss.clear(); } HRESULT AutoGenSharedGroupsTests::LogHR(HRESULT hr) { if( TestApp::ShouldTrace(PFTestTraceLevel::Information) ) { TestApp::Log("Result: 0x%0.8x", hr); } return hr; } void AutoGenSharedGroupsTests::AddTests() { // Generated tests AddTest("TestSharedGroupsClientAddSharedGroupMembersPrerequisiteClientCreateSharedGroup", &AutoGenSharedGroupsTests::TestSharedGroupsClientAddSharedGroupMembersPrerequisiteClientCreateSharedGroup); AddTest("TestSharedGroupsClientAddSharedGroupMembers", &AutoGenSharedGroupsTests::TestSharedGroupsClientAddSharedGroupMembers); AddTest("TestSharedGroupsClientAddSharedGroupMembersCleanupClientRemoveSharedGroupMembers", &AutoGenSharedGroupsTests::TestSharedGroupsClientAddSharedGroupMembersCleanupClientRemoveSharedGroupMembers); AddTest("TestSharedGroupsClientAddSharedGroupMembersCleanupServerDeleteSharedGroup", &AutoGenSharedGroupsTests::TestSharedGroupsClientAddSharedGroupMembersCleanupServerDeleteSharedGroup); AddTest("TestSharedGroupsClientCreateSharedGroup", &AutoGenSharedGroupsTests::TestSharedGroupsClientCreateSharedGroup); AddTest("TestSharedGroupsClientCreateSharedGroupCleanupServerDeleteSharedGroup", &AutoGenSharedGroupsTests::TestSharedGroupsClientCreateSharedGroupCleanupServerDeleteSharedGroup); AddTest("TestSharedGroupsClientGetSharedGroupDataPrerequisiteClientCreateSharedGroup", &AutoGenSharedGroupsTests::TestSharedGroupsClientGetSharedGroupDataPrerequisiteClientCreateSharedGroup); AddTest("TestSharedGroupsClientGetSharedGroupDataPrerequisiteClientUpdateSharedGroupData", &AutoGenSharedGroupsTests::TestSharedGroupsClientGetSharedGroupDataPrerequisiteClientUpdateSharedGroupData); AddTest("TestSharedGroupsClientGetSharedGroupData", &AutoGenSharedGroupsTests::TestSharedGroupsClientGetSharedGroupData); AddTest("TestSharedGroupsClientGetSharedGroupDataCleanupServerDeleteSharedGroup", &AutoGenSharedGroupsTests::TestSharedGroupsClientGetSharedGroupDataCleanupServerDeleteSharedGroup); AddTest("TestSharedGroupsClientRemoveSharedGroupMembersPrerequisiteClientCreateSharedGroup", &AutoGenSharedGroupsTests::TestSharedGroupsClientRemoveSharedGroupMembersPrerequisiteClientCreateSharedGroup); AddTest("TestSharedGroupsClientRemoveSharedGroupMembersPrerequisiteClientAddSharedGroupMembers", &AutoGenSharedGroupsTests::TestSharedGroupsClientRemoveSharedGroupMembersPrerequisiteClientAddSharedGroupMembers); AddTest("TestSharedGroupsClientRemoveSharedGroupMembers", &AutoGenSharedGroupsTests::TestSharedGroupsClientRemoveSharedGroupMembers); AddTest("TestSharedGroupsClientRemoveSharedGroupMembersCleanupServerDeleteSharedGroup", &AutoGenSharedGroupsTests::TestSharedGroupsClientRemoveSharedGroupMembersCleanupServerDeleteSharedGroup); AddTest("TestSharedGroupsClientUpdateSharedGroupDataPrerequisiteClientCreateSharedGroup", &AutoGenSharedGroupsTests::TestSharedGroupsClientUpdateSharedGroupDataPrerequisiteClientCreateSharedGroup); AddTest("TestSharedGroupsClientUpdateSharedGroupData", &AutoGenSharedGroupsTests::TestSharedGroupsClientUpdateSharedGroupData); AddTest("TestSharedGroupsClientUpdateSharedGroupDataCleanupServerDeleteSharedGroup", &AutoGenSharedGroupsTests::TestSharedGroupsClientUpdateSharedGroupDataCleanupServerDeleteSharedGroup); AddTest("TestSharedGroupsServerAddSharedGroupMembersPrerequisiteServerCreateSharedGroup", &AutoGenSharedGroupsTests::TestSharedGroupsServerAddSharedGroupMembersPrerequisiteServerCreateSharedGroup); AddTest("TestSharedGroupsServerAddSharedGroupMembers", &AutoGenSharedGroupsTests::TestSharedGroupsServerAddSharedGroupMembers); AddTest("TestSharedGroupsServerAddSharedGroupMembersCleanupServerRemoveSharedGroupMembers", &AutoGenSharedGroupsTests::TestSharedGroupsServerAddSharedGroupMembersCleanupServerRemoveSharedGroupMembers); AddTest("TestSharedGroupsServerAddSharedGroupMembersCleanupServerDeleteSharedGroup", &AutoGenSharedGroupsTests::TestSharedGroupsServerAddSharedGroupMembersCleanupServerDeleteSharedGroup); AddTest("TestSharedGroupsServerCreateSharedGroup", &AutoGenSharedGroupsTests::TestSharedGroupsServerCreateSharedGroup); AddTest("TestSharedGroupsServerCreateSharedGroupCleanupServerDeleteSharedGroup", &AutoGenSharedGroupsTests::TestSharedGroupsServerCreateSharedGroupCleanupServerDeleteSharedGroup); AddTest("TestSharedGroupsServerDeleteSharedGroupPrerequisiteServerCreateSharedGroup", &AutoGenSharedGroupsTests::TestSharedGroupsServerDeleteSharedGroupPrerequisiteServerCreateSharedGroup); AddTest("TestSharedGroupsServerDeleteSharedGroup", &AutoGenSharedGroupsTests::TestSharedGroupsServerDeleteSharedGroup); AddTest("TestSharedGroupsServerGetSharedGroupDataPrerequisiteClientCreateSharedGroup", &AutoGenSharedGroupsTests::TestSharedGroupsServerGetSharedGroupDataPrerequisiteClientCreateSharedGroup); AddTest("TestSharedGroupsServerGetSharedGroupDataPrerequisiteServerUpdateSharedGroupData", &AutoGenSharedGroupsTests::TestSharedGroupsServerGetSharedGroupDataPrerequisiteServerUpdateSharedGroupData); AddTest("TestSharedGroupsServerGetSharedGroupData", &AutoGenSharedGroupsTests::TestSharedGroupsServerGetSharedGroupData); AddTest("TestSharedGroupsServerGetSharedGroupDataCleanupServerDeleteSharedGroup", &AutoGenSharedGroupsTests::TestSharedGroupsServerGetSharedGroupDataCleanupServerDeleteSharedGroup); AddTest("TestSharedGroupsServerRemoveSharedGroupMembersPrerequisiteServerCreateSharedGroup", &AutoGenSharedGroupsTests::TestSharedGroupsServerRemoveSharedGroupMembersPrerequisiteServerCreateSharedGroup); AddTest("TestSharedGroupsServerRemoveSharedGroupMembersPrerequisiteServerAddSharedGroupMembers", &AutoGenSharedGroupsTests::TestSharedGroupsServerRemoveSharedGroupMembersPrerequisiteServerAddSharedGroupMembers); AddTest("TestSharedGroupsServerRemoveSharedGroupMembers", &AutoGenSharedGroupsTests::TestSharedGroupsServerRemoveSharedGroupMembers); AddTest("TestSharedGroupsServerRemoveSharedGroupMembersCleanupServerDeleteSharedGroup", &AutoGenSharedGroupsTests::TestSharedGroupsServerRemoveSharedGroupMembersCleanupServerDeleteSharedGroup); AddTest("TestSharedGroupsServerUpdateSharedGroupDataPrerequisiteServerCreateSharedGroup", &AutoGenSharedGroupsTests::TestSharedGroupsServerUpdateSharedGroupDataPrerequisiteServerCreateSharedGroup); AddTest("TestSharedGroupsServerUpdateSharedGroupData", &AutoGenSharedGroupsTests::TestSharedGroupsServerUpdateSharedGroupData); AddTest("TestSharedGroupsServerUpdateSharedGroupDataCleanupServerDeleteSharedGroup", &AutoGenSharedGroupsTests::TestSharedGroupsServerUpdateSharedGroupDataCleanupServerDeleteSharedGroup); } void AutoGenSharedGroupsTests::ClassSetUp() { HRESULT hr = PFAdminInitialize(testTitleData.titleId.data(), testTitleData.developerSecretKey.data(), nullptr, &stateHandle); assert(SUCCEEDED(hr)); if (SUCCEEDED(hr)) { PFAuthenticationLoginWithCustomIDRequest request{}; request.customId = "CustomId"; request.createAccount = true; PFGetPlayerCombinedInfoRequestParams combinedInfoRequestParams{}; combinedInfoRequestParams.getCharacterInventories = true; combinedInfoRequestParams.getCharacterList = true; combinedInfoRequestParams.getPlayerProfile = true; combinedInfoRequestParams.getPlayerStatistics = true; combinedInfoRequestParams.getTitleData = true; combinedInfoRequestParams.getUserAccountInfo = true; combinedInfoRequestParams.getUserData = true; combinedInfoRequestParams.getUserInventory = true; combinedInfoRequestParams.getUserReadOnlyData = true; combinedInfoRequestParams.getUserVirtualCurrency = true; request.infoRequestParameters = &combinedInfoRequestParams; XAsyncBlock async{}; hr = PFAuthenticationClientLoginWithCustomIDAsync(stateHandle, &request, &async); assert(SUCCEEDED(hr)); if (SUCCEEDED(hr)) { // Synchronously wait for login to complete hr = XAsyncGetStatus(&async, true); assert(SUCCEEDED(hr)); if (SUCCEEDED(hr)) { hr = PFAuthenticationClientLoginGetResult(&async, &titlePlayerHandle); assert(SUCCEEDED(hr) && titlePlayerHandle); hr = PFTitlePlayerGetEntityHandle(titlePlayerHandle, &entityHandle); assert(SUCCEEDED(hr) && entityHandle); } } request.customId = "CustomId2"; async = {}; hr = PFAuthenticationClientLoginWithCustomIDAsync(stateHandle, &request, &async); assert(SUCCEEDED(hr)); if (SUCCEEDED(hr)) { // Synchronously what for login to complete hr = XAsyncGetStatus(&async, true); assert(SUCCEEDED(hr)); if (SUCCEEDED(hr)) { hr = PFAuthenticationClientLoginGetResult(&async, &titlePlayerHandle2); assert(SUCCEEDED(hr) && titlePlayerHandle2); hr = PFTitlePlayerGetEntityHandle(titlePlayerHandle2, &entityHandle2); assert(SUCCEEDED(hr) && entityHandle2); } } PFAuthenticationGetEntityTokenRequest titleTokenRequest{}; async = {}; hr = PFAuthenticationGetEntityTokenAsync(stateHandle, &titleTokenRequest, &async); assert(SUCCEEDED(hr)); if (SUCCEEDED(hr)) { // Synchronously wait for login to complete hr = XAsyncGetStatus(&async, true); assert(SUCCEEDED(hr)); if (SUCCEEDED(hr)) { hr = PFAuthenticationGetEntityTokenGetResult(&async, &titleEntityHandle); assert(SUCCEEDED(hr)); } } } } void AutoGenSharedGroupsTests::ClassTearDown() { PFTitlePlayerCloseHandle(titlePlayerHandle); PFEntityCloseHandle(entityHandle); PFEntityCloseHandle(titleEntityHandle); XAsyncBlock async{}; HRESULT hr = PFUninitializeAsync(stateHandle, &async); assert(SUCCEEDED(hr)); hr = XAsyncGetStatus(&async, true); assert(SUCCEEDED(hr)); UNREFERENCED_PARAMETER(hr); } void AutoGenSharedGroupsTests::SetUp(TestContext& testContext) { if (!entityHandle) { testContext.Skip("Skipping test because login failed"); } } #pragma region ClientAddSharedGroupMembers void AutoGenSharedGroupsTests::TestSharedGroupsClientAddSharedGroupMembersPrerequisiteClientCreateSharedGroup(TestContext& testContext) { struct ClientCreateSharedGroupResultHolder : public CreateSharedGroupResultHolder { HRESULT Get(XAsyncBlock* async) override { size_t requiredBufferSize; RETURN_IF_FAILED(LogHR(PFSharedGroupsClientCreateSharedGroupGetResultSize(async, &requiredBufferSize))); resultBuffer.resize(requiredBufferSize); RETURN_IF_FAILED(LogHR(PFSharedGroupsClientCreateSharedGroupGetResult(async, resultBuffer.size(), resultBuffer.data(), &result, nullptr))); LogPFSharedGroupsCreateSharedGroupResult(result); return StoreClientAddSharedGroupMembersPrerequisitePFSharedGroupsCreateSharedGroupResult(shared_from_this()); } }; auto async = std::make_unique<XAsyncHelper<ClientCreateSharedGroupResultHolder>>(testContext); PFSharedGroupsCreateSharedGroupRequestWrapper<> request; FillClientAddSharedGroupMembersPrerequisiteCreateSharedGroupRequest(request); LogCreateSharedGroupRequest(&request.Model(), "TestSharedGroupsServerUpdateSharedGroupData"); HRESULT hr = PFSharedGroupsClientCreateSharedGroupAsync(titlePlayerHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsClientAddSharedGroupMembersPrerequisiteClientCreateSharedGroupAsync", hr); return; } async.release(); } void AutoGenSharedGroupsTests::TestSharedGroupsClientAddSharedGroupMembers(TestContext& testContext) { auto async = std::make_unique<XAsyncHelper<XAsyncResult>>(testContext); PFSharedGroupsAddSharedGroupMembersRequestWrapper<> request; FillAddSharedGroupMembersRequest(request); LogAddSharedGroupMembersRequest(&request.Model(), "TestSharedGroupsClientAddSharedGroupMembers"); HRESULT hr = PFSharedGroupsClientAddSharedGroupMembersAsync(titlePlayerHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsClientAddSharedGroupMembersAsync", hr); return; } async.release(); } void AutoGenSharedGroupsTests::TestSharedGroupsClientAddSharedGroupMembersCleanupClientRemoveSharedGroupMembers(TestContext& testContext) { auto async = std::make_unique<XAsyncHelper<XAsyncResult>>(testContext); PFSharedGroupsRemoveSharedGroupMembersRequestWrapper<> request; FillClientAddSharedGroupMembersCleanupRemoveSharedGroupMembersRequest(request); LogRemoveSharedGroupMembersRequest(&request.Model(), "TestSharedGroupsClientAddSharedGroupMembersCleanupClientRemoveSharedGroupMembers"); HRESULT hr = PFSharedGroupsClientRemoveSharedGroupMembersAsync(titlePlayerHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsClientAddSharedGroupMembersCleanupClientRemoveSharedGroupMembersAsync", hr); return; } async.release(); } void AutoGenSharedGroupsTests::TestSharedGroupsClientAddSharedGroupMembersCleanupServerDeleteSharedGroup(TestContext& testContext) { auto async = std::make_unique<XAsyncHelper<XAsyncResult>>(testContext); PFSharedGroupsDeleteSharedGroupRequestWrapper<> request; FillClientAddSharedGroupMembersCleanupDeleteSharedGroupRequest(request); LogDeleteSharedGroupRequest(&request.Model(), "TestSharedGroupsClientAddSharedGroupMembersCleanupServerDeleteSharedGroup"); HRESULT hr = PFSharedGroupsServerDeleteSharedGroupAsync(stateHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsClientAddSharedGroupMembersCleanupServerDeleteSharedGroupAsync", hr); return; } async.release(); } #pragma endregion #pragma region ClientCreateSharedGroup void AutoGenSharedGroupsTests::TestSharedGroupsClientCreateSharedGroup(TestContext& testContext) { struct ClientCreateSharedGroupResultHolder : public CreateSharedGroupResultHolder { HRESULT Get(XAsyncBlock* async) override { size_t requiredBufferSize; RETURN_IF_FAILED(LogHR(PFSharedGroupsClientCreateSharedGroupGetResultSize(async, &requiredBufferSize))); resultBuffer.resize(requiredBufferSize); RETURN_IF_FAILED(LogHR(PFSharedGroupsClientCreateSharedGroupGetResult(async, resultBuffer.size(), resultBuffer.data(), &result, nullptr))); LogPFSharedGroupsCreateSharedGroupResult(result); return S_OK; } HRESULT Validate() override { return ValidatePFSharedGroupsCreateSharedGroupResult(result); } }; auto async = std::make_unique<XAsyncHelper<ClientCreateSharedGroupResultHolder>>(testContext); PFSharedGroupsCreateSharedGroupRequestWrapper<> request; FillCreateSharedGroupRequest(request); LogCreateSharedGroupRequest(&request.Model(), "TestSharedGroupsClientCreateSharedGroup"); HRESULT hr = PFSharedGroupsClientCreateSharedGroupAsync(titlePlayerHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsClientCreateSharedGroupAsync", hr); return; } async.release(); } void AutoGenSharedGroupsTests::TestSharedGroupsClientCreateSharedGroupCleanupServerDeleteSharedGroup(TestContext& testContext) { auto async = std::make_unique<XAsyncHelper<XAsyncResult>>(testContext); PFSharedGroupsDeleteSharedGroupRequestWrapper<> request; FillClientCreateSharedGroupCleanupDeleteSharedGroupRequest(request); LogDeleteSharedGroupRequest(&request.Model(), "TestSharedGroupsClientCreateSharedGroupCleanupServerDeleteSharedGroup"); HRESULT hr = PFSharedGroupsServerDeleteSharedGroupAsync(stateHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsClientCreateSharedGroupCleanupServerDeleteSharedGroupAsync", hr); return; } async.release(); } #pragma endregion #pragma region ClientGetSharedGroupData void AutoGenSharedGroupsTests::TestSharedGroupsClientGetSharedGroupDataPrerequisiteClientCreateSharedGroup(TestContext& testContext) { struct ClientCreateSharedGroupResultHolder : public CreateSharedGroupResultHolder { HRESULT Get(XAsyncBlock* async) override { size_t requiredBufferSize; RETURN_IF_FAILED(LogHR(PFSharedGroupsClientCreateSharedGroupGetResultSize(async, &requiredBufferSize))); resultBuffer.resize(requiredBufferSize); RETURN_IF_FAILED(LogHR(PFSharedGroupsClientCreateSharedGroupGetResult(async, resultBuffer.size(), resultBuffer.data(), &result, nullptr))); LogPFSharedGroupsCreateSharedGroupResult(result); return StoreClientGetSharedGroupDataPrerequisitePFSharedGroupsCreateSharedGroupResult(shared_from_this()); } }; auto async = std::make_unique<XAsyncHelper<ClientCreateSharedGroupResultHolder>>(testContext); PFSharedGroupsCreateSharedGroupRequestWrapper<> request; FillClientGetSharedGroupDataPrerequisiteCreateSharedGroupRequest(request); LogCreateSharedGroupRequest(&request.Model(), "TestSharedGroupsClientCreateSharedGroup"); HRESULT hr = PFSharedGroupsClientCreateSharedGroupAsync(titlePlayerHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsClientGetSharedGroupDataPrerequisiteClientCreateSharedGroupAsync", hr); return; } async.release(); } void AutoGenSharedGroupsTests::TestSharedGroupsClientGetSharedGroupDataPrerequisiteClientUpdateSharedGroupData(TestContext& testContext) { auto async = std::make_unique<XAsyncHelper<XAsyncResult>>(testContext); PFSharedGroupsUpdateSharedGroupDataRequestWrapper<> request; FillClientGetSharedGroupDataPrerequisiteUpdateSharedGroupDataRequest(request); LogUpdateSharedGroupDataRequest(&request.Model(), "TestSharedGroupsClientCreateSharedGroup"); HRESULT hr = PFSharedGroupsClientUpdateSharedGroupDataAsync(titlePlayerHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsClientGetSharedGroupDataPrerequisiteClientUpdateSharedGroupDataAsync", hr); return; } async.release(); } void AutoGenSharedGroupsTests::TestSharedGroupsClientGetSharedGroupData(TestContext& testContext) { struct ClientGetSharedGroupDataResultHolder : public GetSharedGroupDataResultHolder { HRESULT Get(XAsyncBlock* async) override { size_t requiredBufferSize; RETURN_IF_FAILED(LogHR(PFSharedGroupsClientGetSharedGroupDataGetResultSize(async, &requiredBufferSize))); resultBuffer.resize(requiredBufferSize); RETURN_IF_FAILED(LogHR(PFSharedGroupsClientGetSharedGroupDataGetResult(async, resultBuffer.size(), resultBuffer.data(), &result, nullptr))); LogPFSharedGroupsGetSharedGroupDataResult(result); return S_OK; } HRESULT Validate() override { return ValidatePFSharedGroupsGetSharedGroupDataResult(result); } }; auto async = std::make_unique<XAsyncHelper<ClientGetSharedGroupDataResultHolder>>(testContext); PFSharedGroupsGetSharedGroupDataRequestWrapper<> request; FillGetSharedGroupDataRequest(request); LogGetSharedGroupDataRequest(&request.Model(), "TestSharedGroupsClientGetSharedGroupData"); HRESULT hr = PFSharedGroupsClientGetSharedGroupDataAsync(titlePlayerHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsClientGetSharedGroupDataAsync", hr); return; } async.release(); } void AutoGenSharedGroupsTests::TestSharedGroupsClientGetSharedGroupDataCleanupServerDeleteSharedGroup(TestContext& testContext) { auto async = std::make_unique<XAsyncHelper<XAsyncResult>>(testContext); PFSharedGroupsDeleteSharedGroupRequestWrapper<> request; FillClientGetSharedGroupDataCleanupDeleteSharedGroupRequest(request); LogDeleteSharedGroupRequest(&request.Model(), "TestSharedGroupsClientGetSharedGroupDataCleanupServerDeleteSharedGroup"); HRESULT hr = PFSharedGroupsServerDeleteSharedGroupAsync(stateHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsClientGetSharedGroupDataCleanupServerDeleteSharedGroupAsync", hr); return; } async.release(); } #pragma endregion #pragma region ClientRemoveSharedGroupMembers void AutoGenSharedGroupsTests::TestSharedGroupsClientRemoveSharedGroupMembersPrerequisiteClientCreateSharedGroup(TestContext& testContext) { struct ClientCreateSharedGroupResultHolder : public CreateSharedGroupResultHolder { HRESULT Get(XAsyncBlock* async) override { size_t requiredBufferSize; RETURN_IF_FAILED(LogHR(PFSharedGroupsClientCreateSharedGroupGetResultSize(async, &requiredBufferSize))); resultBuffer.resize(requiredBufferSize); RETURN_IF_FAILED(LogHR(PFSharedGroupsClientCreateSharedGroupGetResult(async, resultBuffer.size(), resultBuffer.data(), &result, nullptr))); LogPFSharedGroupsCreateSharedGroupResult(result); return StoreClientRemoveSharedGroupMembersPrerequisitePFSharedGroupsCreateSharedGroupResult(shared_from_this()); } }; auto async = std::make_unique<XAsyncHelper<ClientCreateSharedGroupResultHolder>>(testContext); PFSharedGroupsCreateSharedGroupRequestWrapper<> request; FillClientRemoveSharedGroupMembersPrerequisiteCreateSharedGroupRequest(request); LogCreateSharedGroupRequest(&request.Model(), "TestSharedGroupsClientGetSharedGroupData"); HRESULT hr = PFSharedGroupsClientCreateSharedGroupAsync(titlePlayerHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsClientRemoveSharedGroupMembersPrerequisiteClientCreateSharedGroupAsync", hr); return; } async.release(); } void AutoGenSharedGroupsTests::TestSharedGroupsClientRemoveSharedGroupMembersPrerequisiteClientAddSharedGroupMembers(TestContext& testContext) { auto async = std::make_unique<XAsyncHelper<XAsyncResult>>(testContext); PFSharedGroupsAddSharedGroupMembersRequestWrapper<> request; FillClientRemoveSharedGroupMembersPrerequisiteAddSharedGroupMembersRequest(request); LogAddSharedGroupMembersRequest(&request.Model(), "TestSharedGroupsClientGetSharedGroupData"); HRESULT hr = PFSharedGroupsClientAddSharedGroupMembersAsync(titlePlayerHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsClientRemoveSharedGroupMembersPrerequisiteClientAddSharedGroupMembersAsync", hr); return; } async.release(); } void AutoGenSharedGroupsTests::TestSharedGroupsClientRemoveSharedGroupMembers(TestContext& testContext) { auto async = std::make_unique<XAsyncHelper<XAsyncResult>>(testContext); PFSharedGroupsRemoveSharedGroupMembersRequestWrapper<> request; FillRemoveSharedGroupMembersRequest(request); LogRemoveSharedGroupMembersRequest(&request.Model(), "TestSharedGroupsClientRemoveSharedGroupMembers"); HRESULT hr = PFSharedGroupsClientRemoveSharedGroupMembersAsync(titlePlayerHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsClientRemoveSharedGroupMembersAsync", hr); return; } async.release(); } void AutoGenSharedGroupsTests::TestSharedGroupsClientRemoveSharedGroupMembersCleanupServerDeleteSharedGroup(TestContext& testContext) { auto async = std::make_unique<XAsyncHelper<XAsyncResult>>(testContext); PFSharedGroupsDeleteSharedGroupRequestWrapper<> request; FillClientRemoveSharedGroupMembersCleanupDeleteSharedGroupRequest(request); LogDeleteSharedGroupRequest(&request.Model(), "TestSharedGroupsClientRemoveSharedGroupMembersCleanupServerDeleteSharedGroup"); HRESULT hr = PFSharedGroupsServerDeleteSharedGroupAsync(stateHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsClientRemoveSharedGroupMembersCleanupServerDeleteSharedGroupAsync", hr); return; } async.release(); } #pragma endregion #pragma region ClientUpdateSharedGroupData void AutoGenSharedGroupsTests::TestSharedGroupsClientUpdateSharedGroupDataPrerequisiteClientCreateSharedGroup(TestContext& testContext) { struct ClientCreateSharedGroupResultHolder : public CreateSharedGroupResultHolder { HRESULT Get(XAsyncBlock* async) override { size_t requiredBufferSize; RETURN_IF_FAILED(LogHR(PFSharedGroupsClientCreateSharedGroupGetResultSize(async, &requiredBufferSize))); resultBuffer.resize(requiredBufferSize); RETURN_IF_FAILED(LogHR(PFSharedGroupsClientCreateSharedGroupGetResult(async, resultBuffer.size(), resultBuffer.data(), &result, nullptr))); LogPFSharedGroupsCreateSharedGroupResult(result); return StoreClientUpdateSharedGroupDataPrerequisitePFSharedGroupsCreateSharedGroupResult(shared_from_this()); } }; auto async = std::make_unique<XAsyncHelper<ClientCreateSharedGroupResultHolder>>(testContext); PFSharedGroupsCreateSharedGroupRequestWrapper<> request; FillClientUpdateSharedGroupDataPrerequisiteCreateSharedGroupRequest(request); LogCreateSharedGroupRequest(&request.Model(), "TestSharedGroupsClientRemoveSharedGroupMembers"); HRESULT hr = PFSharedGroupsClientCreateSharedGroupAsync(titlePlayerHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsClientUpdateSharedGroupDataPrerequisiteClientCreateSharedGroupAsync", hr); return; } async.release(); } void AutoGenSharedGroupsTests::TestSharedGroupsClientUpdateSharedGroupData(TestContext& testContext) { auto async = std::make_unique<XAsyncHelper<XAsyncResult>>(testContext); PFSharedGroupsUpdateSharedGroupDataRequestWrapper<> request; FillUpdateSharedGroupDataRequest(request); LogUpdateSharedGroupDataRequest(&request.Model(), "TestSharedGroupsClientUpdateSharedGroupData"); HRESULT hr = PFSharedGroupsClientUpdateSharedGroupDataAsync(titlePlayerHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsClientUpdateSharedGroupDataAsync", hr); return; } async.release(); } void AutoGenSharedGroupsTests::TestSharedGroupsClientUpdateSharedGroupDataCleanupServerDeleteSharedGroup(TestContext& testContext) { auto async = std::make_unique<XAsyncHelper<XAsyncResult>>(testContext); PFSharedGroupsDeleteSharedGroupRequestWrapper<> request; FillClientUpdateSharedGroupDataCleanupDeleteSharedGroupRequest(request); LogDeleteSharedGroupRequest(&request.Model(), "TestSharedGroupsClientUpdateSharedGroupDataCleanupServerDeleteSharedGroup"); HRESULT hr = PFSharedGroupsServerDeleteSharedGroupAsync(stateHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsClientUpdateSharedGroupDataCleanupServerDeleteSharedGroupAsync", hr); return; } async.release(); } #pragma endregion #pragma region ServerAddSharedGroupMembers void AutoGenSharedGroupsTests::TestSharedGroupsServerAddSharedGroupMembersPrerequisiteServerCreateSharedGroup(TestContext& testContext) { struct ServerCreateSharedGroupResultHolder : public CreateSharedGroupResultHolder { HRESULT Get(XAsyncBlock* async) override { size_t requiredBufferSize; RETURN_IF_FAILED(LogHR(PFSharedGroupsServerCreateSharedGroupGetResultSize(async, &requiredBufferSize))); resultBuffer.resize(requiredBufferSize); RETURN_IF_FAILED(LogHR(PFSharedGroupsServerCreateSharedGroupGetResult(async, resultBuffer.size(), resultBuffer.data(), &result, nullptr))); LogPFSharedGroupsCreateSharedGroupResult(result); return StoreServerAddSharedGroupMembersPrerequisitePFSharedGroupsCreateSharedGroupResult(shared_from_this()); } }; auto async = std::make_unique<XAsyncHelper<ServerCreateSharedGroupResultHolder>>(testContext); PFSharedGroupsCreateSharedGroupRequestWrapper<> request; FillServerAddSharedGroupMembersPrerequisiteCreateSharedGroupRequest(request); LogCreateSharedGroupRequest(&request.Model(), "TestSharedGroupsClientUpdateSharedGroupData"); HRESULT hr = PFSharedGroupsServerCreateSharedGroupAsync(stateHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsServerAddSharedGroupMembersPrerequisiteServerCreateSharedGroupAsync", hr); return; } async.release(); } void AutoGenSharedGroupsTests::TestSharedGroupsServerAddSharedGroupMembers(TestContext& testContext) { auto async = std::make_unique<XAsyncHelper<XAsyncResult>>(testContext); PFSharedGroupsAddSharedGroupMembersRequestWrapper<> request; FillAddSharedGroupMembersRequest(request); LogAddSharedGroupMembersRequest(&request.Model(), "TestSharedGroupsServerAddSharedGroupMembers"); HRESULT hr = PFSharedGroupsServerAddSharedGroupMembersAsync(stateHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsServerAddSharedGroupMembersAsync", hr); return; } async.release(); } void AutoGenSharedGroupsTests::TestSharedGroupsServerAddSharedGroupMembersCleanupServerRemoveSharedGroupMembers(TestContext& testContext) { auto async = std::make_unique<XAsyncHelper<XAsyncResult>>(testContext); PFSharedGroupsRemoveSharedGroupMembersRequestWrapper<> request; FillServerAddSharedGroupMembersCleanupRemoveSharedGroupMembersRequest(request); LogRemoveSharedGroupMembersRequest(&request.Model(), "TestSharedGroupsServerAddSharedGroupMembersCleanupServerRemoveSharedGroupMembers"); HRESULT hr = PFSharedGroupsServerRemoveSharedGroupMembersAsync(stateHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsServerAddSharedGroupMembersCleanupServerRemoveSharedGroupMembersAsync", hr); return; } async.release(); } void AutoGenSharedGroupsTests::TestSharedGroupsServerAddSharedGroupMembersCleanupServerDeleteSharedGroup(TestContext& testContext) { auto async = std::make_unique<XAsyncHelper<XAsyncResult>>(testContext); PFSharedGroupsDeleteSharedGroupRequestWrapper<> request; FillServerAddSharedGroupMembersCleanupDeleteSharedGroupRequest(request); LogDeleteSharedGroupRequest(&request.Model(), "TestSharedGroupsServerAddSharedGroupMembersCleanupServerDeleteSharedGroup"); HRESULT hr = PFSharedGroupsServerDeleteSharedGroupAsync(stateHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsServerAddSharedGroupMembersCleanupServerDeleteSharedGroupAsync", hr); return; } async.release(); } #pragma endregion #pragma region ServerCreateSharedGroup void AutoGenSharedGroupsTests::TestSharedGroupsServerCreateSharedGroup(TestContext& testContext) { struct ServerCreateSharedGroupResultHolder : public CreateSharedGroupResultHolder { HRESULT Get(XAsyncBlock* async) override { size_t requiredBufferSize; RETURN_IF_FAILED(LogHR(PFSharedGroupsServerCreateSharedGroupGetResultSize(async, &requiredBufferSize))); resultBuffer.resize(requiredBufferSize); RETURN_IF_FAILED(LogHR(PFSharedGroupsServerCreateSharedGroupGetResult(async, resultBuffer.size(), resultBuffer.data(), &result, nullptr))); LogPFSharedGroupsCreateSharedGroupResult(result); return S_OK; } HRESULT Validate() override { return ValidatePFSharedGroupsCreateSharedGroupResult(result); } }; auto async = std::make_unique<XAsyncHelper<ServerCreateSharedGroupResultHolder>>(testContext); PFSharedGroupsCreateSharedGroupRequestWrapper<> request; FillCreateSharedGroupRequest(request); LogCreateSharedGroupRequest(&request.Model(), "TestSharedGroupsServerCreateSharedGroup"); HRESULT hr = PFSharedGroupsServerCreateSharedGroupAsync(stateHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsServerCreateSharedGroupAsync", hr); return; } async.release(); } void AutoGenSharedGroupsTests::TestSharedGroupsServerCreateSharedGroupCleanupServerDeleteSharedGroup(TestContext& testContext) { auto async = std::make_unique<XAsyncHelper<XAsyncResult>>(testContext); PFSharedGroupsDeleteSharedGroupRequestWrapper<> request; FillServerCreateSharedGroupCleanupDeleteSharedGroupRequest(request); LogDeleteSharedGroupRequest(&request.Model(), "TestSharedGroupsServerCreateSharedGroupCleanupServerDeleteSharedGroup"); HRESULT hr = PFSharedGroupsServerDeleteSharedGroupAsync(stateHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsServerCreateSharedGroupCleanupServerDeleteSharedGroupAsync", hr); return; } async.release(); } #pragma endregion #pragma region ServerDeleteSharedGroup void AutoGenSharedGroupsTests::TestSharedGroupsServerDeleteSharedGroupPrerequisiteServerCreateSharedGroup(TestContext& testContext) { struct ServerCreateSharedGroupResultHolder : public CreateSharedGroupResultHolder { HRESULT Get(XAsyncBlock* async) override { size_t requiredBufferSize; RETURN_IF_FAILED(LogHR(PFSharedGroupsServerCreateSharedGroupGetResultSize(async, &requiredBufferSize))); resultBuffer.resize(requiredBufferSize); RETURN_IF_FAILED(LogHR(PFSharedGroupsServerCreateSharedGroupGetResult(async, resultBuffer.size(), resultBuffer.data(), &result, nullptr))); LogPFSharedGroupsCreateSharedGroupResult(result); return StoreServerDeleteSharedGroupPrerequisitePFSharedGroupsCreateSharedGroupResult(shared_from_this()); } }; auto async = std::make_unique<XAsyncHelper<ServerCreateSharedGroupResultHolder>>(testContext); PFSharedGroupsCreateSharedGroupRequestWrapper<> request; FillServerDeleteSharedGroupPrerequisiteCreateSharedGroupRequest(request); LogCreateSharedGroupRequest(&request.Model(), "TestSharedGroupsServerCreateSharedGroup"); HRESULT hr = PFSharedGroupsServerCreateSharedGroupAsync(stateHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsServerDeleteSharedGroupPrerequisiteServerCreateSharedGroupAsync", hr); return; } async.release(); } void AutoGenSharedGroupsTests::TestSharedGroupsServerDeleteSharedGroup(TestContext& testContext) { auto async = std::make_unique<XAsyncHelper<XAsyncResult>>(testContext); PFSharedGroupsDeleteSharedGroupRequestWrapper<> request; FillDeleteSharedGroupRequest(request); LogDeleteSharedGroupRequest(&request.Model(), "TestSharedGroupsServerDeleteSharedGroup"); HRESULT hr = PFSharedGroupsServerDeleteSharedGroupAsync(stateHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsServerDeleteSharedGroupAsync", hr); return; } async.release(); } #pragma endregion #pragma region ServerGetSharedGroupData void AutoGenSharedGroupsTests::TestSharedGroupsServerGetSharedGroupDataPrerequisiteClientCreateSharedGroup(TestContext& testContext) { struct ClientCreateSharedGroupResultHolder : public CreateSharedGroupResultHolder { HRESULT Get(XAsyncBlock* async) override { size_t requiredBufferSize; RETURN_IF_FAILED(LogHR(PFSharedGroupsClientCreateSharedGroupGetResultSize(async, &requiredBufferSize))); resultBuffer.resize(requiredBufferSize); RETURN_IF_FAILED(LogHR(PFSharedGroupsClientCreateSharedGroupGetResult(async, resultBuffer.size(), resultBuffer.data(), &result, nullptr))); LogPFSharedGroupsCreateSharedGroupResult(result); return StoreServerGetSharedGroupDataPrerequisitePFSharedGroupsCreateSharedGroupResult(shared_from_this()); } }; auto async = std::make_unique<XAsyncHelper<ClientCreateSharedGroupResultHolder>>(testContext); PFSharedGroupsCreateSharedGroupRequestWrapper<> request; FillServerGetSharedGroupDataPrerequisiteCreateSharedGroupRequest(request); LogCreateSharedGroupRequest(&request.Model(), "TestSharedGroupsServerDeleteSharedGroup"); HRESULT hr = PFSharedGroupsClientCreateSharedGroupAsync(titlePlayerHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsServerGetSharedGroupDataPrerequisiteClientCreateSharedGroupAsync", hr); return; } async.release(); } void AutoGenSharedGroupsTests::TestSharedGroupsServerGetSharedGroupDataPrerequisiteServerUpdateSharedGroupData(TestContext& testContext) { auto async = std::make_unique<XAsyncHelper<XAsyncResult>>(testContext); PFSharedGroupsUpdateSharedGroupDataRequestWrapper<> request; FillServerGetSharedGroupDataPrerequisiteUpdateSharedGroupDataRequest(request); LogUpdateSharedGroupDataRequest(&request.Model(), "TestSharedGroupsServerDeleteSharedGroup"); HRESULT hr = PFSharedGroupsServerUpdateSharedGroupDataAsync(stateHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsServerGetSharedGroupDataPrerequisiteServerUpdateSharedGroupDataAsync", hr); return; } async.release(); } void AutoGenSharedGroupsTests::TestSharedGroupsServerGetSharedGroupData(TestContext& testContext) { struct ServerGetSharedGroupDataResultHolder : public GetSharedGroupDataResultHolder { HRESULT Get(XAsyncBlock* async) override { size_t requiredBufferSize; RETURN_IF_FAILED(LogHR(PFSharedGroupsServerGetSharedGroupDataGetResultSize(async, &requiredBufferSize))); resultBuffer.resize(requiredBufferSize); RETURN_IF_FAILED(LogHR(PFSharedGroupsServerGetSharedGroupDataGetResult(async, resultBuffer.size(), resultBuffer.data(), &result, nullptr))); LogPFSharedGroupsGetSharedGroupDataResult(result); return S_OK; } HRESULT Validate() override { return ValidatePFSharedGroupsGetSharedGroupDataResult(result); } }; auto async = std::make_unique<XAsyncHelper<ServerGetSharedGroupDataResultHolder>>(testContext); PFSharedGroupsGetSharedGroupDataRequestWrapper<> request; FillGetSharedGroupDataRequest(request); LogGetSharedGroupDataRequest(&request.Model(), "TestSharedGroupsServerGetSharedGroupData"); HRESULT hr = PFSharedGroupsServerGetSharedGroupDataAsync(stateHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsServerGetSharedGroupDataAsync", hr); return; } async.release(); } void AutoGenSharedGroupsTests::TestSharedGroupsServerGetSharedGroupDataCleanupServerDeleteSharedGroup(TestContext& testContext) { auto async = std::make_unique<XAsyncHelper<XAsyncResult>>(testContext); PFSharedGroupsDeleteSharedGroupRequestWrapper<> request; FillServerGetSharedGroupDataCleanupDeleteSharedGroupRequest(request); LogDeleteSharedGroupRequest(&request.Model(), "TestSharedGroupsServerGetSharedGroupDataCleanupServerDeleteSharedGroup"); HRESULT hr = PFSharedGroupsServerDeleteSharedGroupAsync(stateHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsServerGetSharedGroupDataCleanupServerDeleteSharedGroupAsync", hr); return; } async.release(); } #pragma endregion #pragma region ServerRemoveSharedGroupMembers void AutoGenSharedGroupsTests::TestSharedGroupsServerRemoveSharedGroupMembersPrerequisiteServerCreateSharedGroup(TestContext& testContext) { struct ServerCreateSharedGroupResultHolder : public CreateSharedGroupResultHolder { HRESULT Get(XAsyncBlock* async) override { size_t requiredBufferSize; RETURN_IF_FAILED(LogHR(PFSharedGroupsServerCreateSharedGroupGetResultSize(async, &requiredBufferSize))); resultBuffer.resize(requiredBufferSize); RETURN_IF_FAILED(LogHR(PFSharedGroupsServerCreateSharedGroupGetResult(async, resultBuffer.size(), resultBuffer.data(), &result, nullptr))); LogPFSharedGroupsCreateSharedGroupResult(result); return StoreServerRemoveSharedGroupMembersPrerequisitePFSharedGroupsCreateSharedGroupResult(shared_from_this()); } }; auto async = std::make_unique<XAsyncHelper<ServerCreateSharedGroupResultHolder>>(testContext); PFSharedGroupsCreateSharedGroupRequestWrapper<> request; FillServerRemoveSharedGroupMembersPrerequisiteCreateSharedGroupRequest(request); LogCreateSharedGroupRequest(&request.Model(), "TestSharedGroupsServerGetSharedGroupData"); HRESULT hr = PFSharedGroupsServerCreateSharedGroupAsync(stateHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsServerRemoveSharedGroupMembersPrerequisiteServerCreateSharedGroupAsync", hr); return; } async.release(); } void AutoGenSharedGroupsTests::TestSharedGroupsServerRemoveSharedGroupMembersPrerequisiteServerAddSharedGroupMembers(TestContext& testContext) { auto async = std::make_unique<XAsyncHelper<XAsyncResult>>(testContext); PFSharedGroupsAddSharedGroupMembersRequestWrapper<> request; FillServerRemoveSharedGroupMembersPrerequisiteAddSharedGroupMembersRequest(request); LogAddSharedGroupMembersRequest(&request.Model(), "TestSharedGroupsServerGetSharedGroupData"); HRESULT hr = PFSharedGroupsServerAddSharedGroupMembersAsync(stateHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsServerRemoveSharedGroupMembersPrerequisiteServerAddSharedGroupMembersAsync", hr); return; } async.release(); } void AutoGenSharedGroupsTests::TestSharedGroupsServerRemoveSharedGroupMembers(TestContext& testContext) { auto async = std::make_unique<XAsyncHelper<XAsyncResult>>(testContext); PFSharedGroupsRemoveSharedGroupMembersRequestWrapper<> request; FillRemoveSharedGroupMembersRequest(request); LogRemoveSharedGroupMembersRequest(&request.Model(), "TestSharedGroupsServerRemoveSharedGroupMembers"); HRESULT hr = PFSharedGroupsServerRemoveSharedGroupMembersAsync(stateHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsServerRemoveSharedGroupMembersAsync", hr); return; } async.release(); } void AutoGenSharedGroupsTests::TestSharedGroupsServerRemoveSharedGroupMembersCleanupServerDeleteSharedGroup(TestContext& testContext) { auto async = std::make_unique<XAsyncHelper<XAsyncResult>>(testContext); PFSharedGroupsDeleteSharedGroupRequestWrapper<> request; FillServerRemoveSharedGroupMembersCleanupDeleteSharedGroupRequest(request); LogDeleteSharedGroupRequest(&request.Model(), "TestSharedGroupsServerRemoveSharedGroupMembersCleanupServerDeleteSharedGroup"); HRESULT hr = PFSharedGroupsServerDeleteSharedGroupAsync(stateHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsServerRemoveSharedGroupMembersCleanupServerDeleteSharedGroupAsync", hr); return; } async.release(); } #pragma endregion #pragma region ServerUpdateSharedGroupData void AutoGenSharedGroupsTests::TestSharedGroupsServerUpdateSharedGroupDataPrerequisiteServerCreateSharedGroup(TestContext& testContext) { struct ServerCreateSharedGroupResultHolder : public CreateSharedGroupResultHolder { HRESULT Get(XAsyncBlock* async) override { size_t requiredBufferSize; RETURN_IF_FAILED(LogHR(PFSharedGroupsServerCreateSharedGroupGetResultSize(async, &requiredBufferSize))); resultBuffer.resize(requiredBufferSize); RETURN_IF_FAILED(LogHR(PFSharedGroupsServerCreateSharedGroupGetResult(async, resultBuffer.size(), resultBuffer.data(), &result, nullptr))); LogPFSharedGroupsCreateSharedGroupResult(result); return StoreServerUpdateSharedGroupDataPrerequisitePFSharedGroupsCreateSharedGroupResult(shared_from_this()); } }; auto async = std::make_unique<XAsyncHelper<ServerCreateSharedGroupResultHolder>>(testContext); PFSharedGroupsCreateSharedGroupRequestWrapper<> request; FillServerUpdateSharedGroupDataPrerequisiteCreateSharedGroupRequest(request); LogCreateSharedGroupRequest(&request.Model(), "TestSharedGroupsServerRemoveSharedGroupMembers"); HRESULT hr = PFSharedGroupsServerCreateSharedGroupAsync(stateHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsServerUpdateSharedGroupDataPrerequisiteServerCreateSharedGroupAsync", hr); return; } async.release(); } void AutoGenSharedGroupsTests::TestSharedGroupsServerUpdateSharedGroupData(TestContext& testContext) { auto async = std::make_unique<XAsyncHelper<XAsyncResult>>(testContext); PFSharedGroupsUpdateSharedGroupDataRequestWrapper<> request; FillUpdateSharedGroupDataRequest(request); LogUpdateSharedGroupDataRequest(&request.Model(), "TestSharedGroupsServerUpdateSharedGroupData"); HRESULT hr = PFSharedGroupsServerUpdateSharedGroupDataAsync(stateHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsServerUpdateSharedGroupDataAsync", hr); return; } async.release(); } void AutoGenSharedGroupsTests::TestSharedGroupsServerUpdateSharedGroupDataCleanupServerDeleteSharedGroup(TestContext& testContext) { auto async = std::make_unique<XAsyncHelper<XAsyncResult>>(testContext); PFSharedGroupsDeleteSharedGroupRequestWrapper<> request; FillServerUpdateSharedGroupDataCleanupDeleteSharedGroupRequest(request); LogDeleteSharedGroupRequest(&request.Model(), "TestSharedGroupsServerUpdateSharedGroupDataCleanupServerDeleteSharedGroup"); HRESULT hr = PFSharedGroupsServerDeleteSharedGroupAsync(stateHandle, &request.Model(), &async->asyncBlock); if (FAILED(hr)) { testContext.Fail("PFSharedGroupsSharedGroupsServerUpdateSharedGroupDataCleanupServerDeleteSharedGroupAsync", hr); return; } async.release(); } #pragma endregion }
48.959473
215
0.788672
jasonsandlin
79caa9119b3a31843cdeacb6ea0fbeabbaf47076
7,854
cpp
C++
cpu_seg.cpp
kele/cuda_image_segmentation
1d9aa1c83e73ed1af29640e7fcc909abfb355439
[ "MIT" ]
null
null
null
cpu_seg.cpp
kele/cuda_image_segmentation
1d9aa1c83e73ed1af29640e7fcc909abfb355439
[ "MIT" ]
null
null
null
cpu_seg.cpp
kele/cuda_image_segmentation
1d9aa1c83e73ed1af29640e7fcc909abfb355439
[ "MIT" ]
null
null
null
#include <algorithm> #include <cassert> #include <cmath> #include <cstdlib> #include <deque> #include "cpu_seg.hpp" void push_relabel(ImageGraph &g); void segmentation_cpu(int width, int height, const pixel_t *image, const pixel_t *marks, pixel_t *segmented_image) { typedef ImageGraph::regular_node_t regular_node_t; typedef ImageGraph::node_t node_t; ImageGraph g(width, height); Histogram hist(width, height, image, marks); /* REG_NEIGBHOURS, unfortunately, has to be 4 here */ const int delt[ImageGraph::REG_NEIGHBOURS][2] = { {-1, 0}, { 0, -1}, { 0, +1}, {+1, 0}}; /* neighbour edges */ for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { regular_node_t &v = g.get(x, y); for (int i = 0; i < g.REG_NEIGHBOURS; i++) { if (in_range(y + delt[i][0], 0, height - 1) && in_range(x + delt[i][1], 0, width - 1)) { const int dy = y + delt[i][0]; const int dx = x + delt[i][1]; regular_node_t &u = g.get(dx, dy); v.c[i] = compute_edge(image[y*width + x], image[dy*width + dx]); } } } } /* source and sink edges */ for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { regular_node_t &v = g.get(x, y); int k = 0; for (int i = 0; i < g.REG_NEIGHBOURS; i++) k = (k < v.c[i]) ? v.c[i] : k; k = k + 1; int i = y*width + x; if (marks[y*width + x] == WHITE) { v.c[g.SOURCE] = g.source.c[i] = k; v.c[g.SINK] = g.sink.c[i] = 0; } else if (marks[y*width + x] == BLACK) { v.c[g.SINK] = g.sink.c[i] = k; v.c[g.SOURCE] = g.source.c[i] = 0; } else { v.c[g.SOURCE] = MULT*LAMBDA*(-log(hist.prob_bg(image[i]))); v.c[g.SINK] = MULT*LAMBDA*(-log(hist.prob_obj(image[i]))); g.source.c[i] = v.c[g.SOURCE]; g.sink.c[i] = v.c[g.SINK]; } } } push_relabel(g); /* Make the image white */ for (int i = 0; i < height*width; i++) { segmented_image[i].r = 255; segmented_image[i].g = 255; segmented_image[i].b = 255; } /* BFS */ std::vector<bool> visited(height*width, false); std::deque<int> Q; for (unsigned i = 0; i < g.width*g.height; i++) { if (g.source.c[i] > 0) { segmented_image[i].r = image[i].r; segmented_image[i].g = image[i].g; segmented_image[i].b = image[i].b; Q.push_back(i); visited[i] = true; } } while (!Q.empty()) { int vpos = Q.front(); Q.pop_front(); const int x = vpos % width; const int y = vpos / width; regular_node_t &v = g.nodes[vpos]; for (int i = 0; i < g.REG_NEIGHBOURS; i++) { if (in_range(y + delt[i][0], 0, height - 1) && in_range(x + delt[i][1], 0, width - 1)) { if (v.c[i] <= 0) continue; const int dy = y + delt[i][0]; const int dx = x + delt[i][1]; const int upos = dy*width + dx; if (visited[upos]) continue; segmented_image[upos].r = image[upos].r; segmented_image[upos].g = image[upos].g; segmented_image[upos].b = image[upos].b; Q.push_back(upos); visited[upos] = true; } } } } void push_relabel(ImageGraph &g) { typedef ImageGraph::regular_node_t regular_node_t; typedef ImageGraph::node_t node_t; const int delt[ImageGraph::REG_NEIGHBOURS][2] = { {-1, 0}, { 0, -1}, { 0, +1}, {+1, 0}}; /* * Push-relabel with FIFO queue. */ std::deque<int> Q; /* initialise preflow */ g.source.height = g.width * g.height; for (int i = 0; i < g.width * g.height; i++) { regular_node_t &v = g.nodes[i]; const int d = g.source.c[i]; g.source.overflow -= d; g.source.c[i] -= d; v.overflow += d; v.c[g.SOURCE] += d; Q.push_back(i); } g.sink.overflow = 0; /* main loop */ while (!Q.empty()) { const int vpos = Q.front(); regular_node_t &v = g.nodes[vpos]; Q.pop_front(); const int x = vpos % g.width; const int y = vpos / g.width; for (int i = 0; i < g.REG_NEIGHBOURS; i++) { if (in_range(y + delt[i][0], 0, g.height - 1) && in_range(x + delt[i][1], 0, g.width - 1)) { const int dy = y + delt[i][0]; const int dx = x + delt[i][1]; const int upos = dy*g.width + dx; regular_node_t &u = g.nodes[upos]; if (v.height > u.height && v.c[i] > 0) { // if (v.height == u.height + 1 && v.c[i] > 0) { const int d = std::min(v.overflow, v.c[i]); const int ui = g.REG_NEIGHBOURS - 1 - i; v.overflow -= d; v.c[i] -= d; u.overflow += d; u.c[ui] += d; if (u.overflow == d) // CRUCIAL: in order not to take all the mem Q.push_back(upos); } } if (v.overflow == 0) break; } if (v.overflow == 0) continue; if (v.height > g.sink.height && v.c[g.SINK] > 0) { // if (v.height == g.sink.height + 1 && v.c[g.SINK] > 0) { int d = std::min(v.overflow, v.c[g.SINK]); v.overflow -= d; v.c[g.SINK] -= d; g.sink.c[vpos] += d; g.sink.overflow += d; } if (v.overflow == 0) continue; if (v.height > g.source.height && v.c[g.SOURCE] > 0) { // if (v.height == g.source.height + 1 && v.c[g.SOURCE] > 0) { int d = std::min(v.overflow, v.c[g.SOURCE]); v.overflow -= d; v.c[g.SOURCE] -= d; g.source.c[vpos] += d; g.source.overflow += d; } if (v.overflow == 0) continue; /* * It's safe now to relabel. */ bool relabel = true; int min_height = INF; for (int i = 0; i < g.REG_NEIGHBOURS; i++) { if (in_range(y + delt[i][0], 0, g.height - 1) && in_range(x + delt[i][1], 0, g.width - 1)) { const int dy = y + delt[i][0]; const int dx = x + delt[i][1]; const int upos = dy*g.width + dx; regular_node_t &u = g.nodes[upos]; if (v.c[i] > 0) { if (v.height > u.height) { relabel = false; break; } else { min_height = std::min(min_height, u.height); } } } } if (!relabel) continue; if (v.c[g.SINK] > 0 && v.height > g.sink.height) continue; else if (v.c[g.SINK] > 0) min_height = std::min(min_height, g.sink.height); if (v.c[g.SOURCE] > 0 && v.height > g.source.height) continue; else if (v.c[g.SOURCE] > 0) min_height = std::min(min_height, g.source.height); v.height = min_height + 1; Q.push_back(vpos); } }
31.926829
85
0.424879
kele
79d3efe7cc270b106db582ae299dfe961d32a5ab
1,601
cc
C++
src/TRAINING/io.cc
DrAugus/augus_cpp
ba46aae72cd7e91052dd17985f1625efd146b0fa
[ "MIT" ]
null
null
null
src/TRAINING/io.cc
DrAugus/augus_cpp
ba46aae72cd7e91052dd17985f1625efd146b0fa
[ "MIT" ]
1
2022-03-10T03:17:07.000Z
2022-03-10T03:17:07.000Z
src/TRAINING/io.cc
DrAugus/cpp
ba46aae72cd7e91052dd17985f1625efd146b0fa
[ "MIT" ]
null
null
null
// // Created by AUGUS on 2021/8/9. // #include "io.hh" #include "gtest/gtest.h" std::string binaryToHex(const std::string &binaryStr) { std::string ret; static const char *hex = "0123456789ABCDEF"; for (auto c:binaryStr) { ret.push_back(hex[(c >> 4) & 0xf]); //取二进制高四位 ret.push_back(hex[c & 0xf]); //取二进制低四位 } return ret; } void io_test::string2binary() { std::string sss = R"({"Account": "","FortressUser": "","AppName": "","AppPath": "","AppHash": "","Mac": "","Token": "","dport": 0,"TerminalPort": 0,"dst": "","TerminalIP": "","dbid": 0})"; const char *json = R"({"Account": "","FortressUser": "","AppName": "","AppPath": "","AppHash": "","Mac": "","Token": "","dport": 0,"TerminalPort": 0,"dst": "","TerminalIP": "","dbid": 0})"; std::cout << "json length: " << strlen(json) << std::endl; char a[164]; strcpy(a, json); std::cout << "json info: "; for (auto ss:a) { std::cout << ss; } std::string changed = binaryToHex(a); std::cout << "\nchange to hex, now string-> "; for (auto ss:changed) { std::cout << ss; } std::cout << "\n"; //--下面的注释已然看不懂了 //注意修改工作路径 为 yourpath\augus_cpp\src\subpath std::fstream f; std::ifstream fin("log/data.txt"); //读取文件 if (!fin) { std::cerr << "fail" << std::endl; } //追加写入,在原来基础上加了ios::app f.open("log/data.txt", std::ios::out | std::ios::app); //输入你想写入的内容 f << "\n\n" << changed << std::endl; f.close(); } TEST(io_test, string2binary) { io_test::string2binary(); }
24.630769
178
0.532167
DrAugus
79d49e69821340407b9782f046431279be1cc256
1,953
cc
C++
src/graphics/color_test.cc
kofuk/pixel-terrain
f39e2a0120aab5a11311f57cfd1ab46efa65fddd
[ "MIT" ]
2
2020-10-16T08:46:45.000Z
2020-11-04T02:19:19.000Z
src/graphics/color_test.cc
kofuk/minecraft-image-generator
ef2f7deb2daac7f7c2cfb468ef39e0cdc8b33db7
[ "MIT" ]
null
null
null
src/graphics/color_test.cc
kofuk/minecraft-image-generator
ef2f7deb2daac7f7c2cfb468ef39e0cdc8b33db7
[ "MIT" ]
null
null
null
// SPDX-License-Identifier: MIT #include <boost/test/tools/interface.hpp> #include <boost/test/unit_test.hpp> #include <boost/test/unit_test_suite.hpp> #include "graphics/color.hh" using namespace pixel_terrain; BOOST_AUTO_TEST_CASE(blend_color) { BOOST_TEST((graphics::blend_color(0xffffffaa, 0x00000000) & 0xffffffff) == 0xffffffaa); BOOST_TEST((graphics::blend_color(0x00000000, 0xffffffff) & 0xffffffff) == 0xffffffff); BOOST_TEST((graphics::blend_color(0x12345688, 0x65432155) & 0xffffffff) == 0x243749B0); } BOOST_AUTO_TEST_CASE(blend_ratio) { BOOST_TEST((graphics::blend_color(0x6789abcd, 0x12345678, 0.0) & 0xffffffff) == 0x6789abcd); BOOST_TEST((graphics::blend_color(0x6789abcd, 0x12345678, 1.0) & 0xffffffff) == 0x123456cd); } BOOST_AUTO_TEST_CASE(increase_brightness) { BOOST_TEST((graphics::increase_brightness(0x505050ff, 5) & 0xffffffff) == 0x555555ff); BOOST_TEST((graphics::increase_brightness(0xfcfcfcff, 5) & 0xffffffff) == 0xffffffff); BOOST_TEST((graphics::increase_brightness(0x50fcfcff, 5) & 0xffffffff) == 0x55ffffff); BOOST_TEST((graphics::increase_brightness(0xfc50fcff, 5) & 0xffffffff) == 0xff55ffff); BOOST_TEST((graphics::increase_brightness(0xfcfc50ff, 5) & 0xffffffff) == 0xffff55ff); BOOST_TEST((graphics::increase_brightness(0x555555ff, -5) & 0xffffffff) == 0x505050ff); BOOST_TEST((graphics::increase_brightness(0x030303ff, -5) & 0xffffffff) == 0x000000ff); BOOST_TEST((graphics::increase_brightness(0x5a0303ff, -5) & 0xffffffff) == 0x550000ff); BOOST_TEST((graphics::increase_brightness(0x035a03ff, -5) & 0xffffffff) == 0x005500ff); BOOST_TEST((graphics::increase_brightness(0x03035aff, -5) & 0xffffffff) == 0x000055ff); }
39.06
78
0.664619
kofuk
79d58b6d2b272a8cbe82d3b32bcf35471eebd27e
575
cpp
C++
LuoguOJ/Luogu 1781.cpp
tico88612/Solution-Note
31a9d220fd633c6920760707a07c9a153c2f76cc
[ "MIT" ]
1
2018-02-11T09:41:54.000Z
2018-02-11T09:41:54.000Z
LuoguOJ/Luogu 1781.cpp
tico88612/Solution-Note
31a9d220fd633c6920760707a07c9a153c2f76cc
[ "MIT" ]
null
null
null
LuoguOJ/Luogu 1781.cpp
tico88612/Solution-Note
31a9d220fd633c6920760707a07c9a153c2f76cc
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> #define _ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); using namespace std; struct Item { string num; int no; }; bool cmp(Item a,Item b){ if(a.num.length()==b.num.length()){ int i; for(i=0;i<(int)a.num.length()&&a.num[i]==b.num[i];i++); return a.num[i]>b.num[i]; } else return a.num.length()>b.num.length(); } int main(){ int N; cin>>N; vector<Item> enter(N); for(int i=0;i<N;i++){ cin>>enter[i].num; enter[i].no=i+1; } sort(enter.begin(), enter.end(), cmp); cout<<enter[0].no<<'\n'; cout<<enter[0].num<<'\n'; return 0; }
19.827586
57
0.591304
tico88612
79d657060df323046cab2275d30bfc4c267350f3
87,000
cpp
C++
wind/qDbManager.cpp
huangwenguang/wind
d2b7e15d3ad41a0a5ea17e7ed5780d148e5d4dff
[ "Apache-2.0" ]
null
null
null
wind/qDbManager.cpp
huangwenguang/wind
d2b7e15d3ad41a0a5ea17e7ed5780d148e5d4dff
[ "Apache-2.0" ]
null
null
null
wind/qDbManager.cpp
huangwenguang/wind
d2b7e15d3ad41a0a5ea17e7ed5780d148e5d4dff
[ "Apache-2.0" ]
null
null
null
#include "qDbManager.h" #include <QTimer> #include <QTime> #include <QtSql> #include <QSqlQuery> #include "qConfig.h" qDbManager::qDbManager(QObject *parent) : QObject(parent) { } qDbManager::~qDbManager() { delete m_redis; } /**连接数据库11 * @brief qDbManager::createConnection * @return */ bool qDbManager::createConnection() { QTime dbt; dbt.start(); qDebug()<<QString("start db"); m_dbmap=jsonParsing.setMapArrsy(K_dbName); m_mysqlmap=jsonParsing.setMap(K_mysql_conn); //3 AUDJPY=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_AUDJPY])); AUDJPY.setHostName(m_mysqlmap[K_mysql_hostName]); AUDJPY.setPort(m_mysqlmap[K_mysql_port].toInt()); AUDJPY.setDatabaseName(m_dbmap[K_AUDJPY]); AUDJPY.setUserName( m_mysqlmap[K_userName] ); AUDJPY.setPassword(m_mysqlmap[K_pwd] ); if (!AUDJPY.open()) { AUDJPY.open(); if(!AUDJPY.open()) { qDebug()<<QObject::tr("AUDJPY database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("AUDJPY connection is successful\n"); } //4 AUDNZD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_AUDNZD])); AUDNZD.setHostName(m_mysqlmap[K_mysql_hostName]); AUDNZD.setPort(m_mysqlmap[K_mysql_port].toInt()); AUDNZD.setDatabaseName(m_dbmap[K_AUDNZD]); AUDNZD.setUserName( m_mysqlmap[K_userName] ); AUDNZD.setPassword( m_mysqlmap[K_pwd] ); if (!AUDNZD.open()) { AUDNZD.open(); if(!AUDNZD.open()) { qDebug()<<QObject::tr("AUDNZD database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("AUDNZD connection is successful\n"); } //5 AUDUSD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_AUDUSD])); AUDUSD.setHostName(m_mysqlmap[K_mysql_hostName]); AUDUSD.setPort(m_mysqlmap[K_mysql_port].toInt()); AUDUSD.setDatabaseName(m_dbmap[K_AUDUSD]); AUDUSD.setUserName( m_mysqlmap[K_userName] ); AUDUSD.setPassword( m_mysqlmap[K_pwd] ); if (!AUDUSD.open()) { AUDUSD.open(); if(!AUDUSD.open()) { qDebug()<<QObject::tr("AUDUSD database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("AUDUSD connection is successful\n"); } //6 BUND=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_BUND])); BUND.setHostName(m_mysqlmap[K_mysql_hostName]); BUND.setPort(m_mysqlmap[K_mysql_port].toInt()); BUND.setDatabaseName(m_dbmap[K_BUND]); BUND.setUserName( m_mysqlmap[K_userName] ); BUND.setPassword( m_mysqlmap[K_pwd] ); if (!BUND.open()) { BUND.open(); if(!BUND.open()) { qDebug()<<QObject::tr("BUND database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("BUND connection is successful\n"); } //7 CADCHF=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_CADCHF])); CADCHF.setHostName(m_mysqlmap[K_mysql_hostName]); CADCHF.setPort(m_mysqlmap[K_mysql_port].toInt()); CADCHF.setDatabaseName(m_dbmap[K_CADCHF]); CADCHF.setUserName( m_mysqlmap[K_userName] ); CADCHF.setPassword( m_mysqlmap[K_pwd] ); if (!CADCHF.open()) { CADCHF.open(); if(!CADCHF.open()) { qDebug()<<QObject::tr("CADCHF database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("CADCHF connection is successful\n"); } //9 COPPER=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_COPPER])); COPPER.setHostName(m_mysqlmap[K_mysql_hostName]); COPPER.setPort(m_mysqlmap[K_mysql_port].toInt()); COPPER.setDatabaseName(m_dbmap[K_COPPER]); COPPER.setUserName( m_mysqlmap[K_userName] ); COPPER.setPassword( m_mysqlmap[K_pwd] ); if (!COPPER.open()) { COPPER.open(); if(!COPPER.open()) { qDebug()<<QObject::tr("COPPER database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("COPPER connection is successful\n"); } //10 EURAUD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_EURAUD])); EURAUD.setHostName(m_mysqlmap[K_mysql_hostName]); EURAUD.setPort(m_mysqlmap[K_mysql_port].toInt()); EURAUD.setDatabaseName(m_dbmap[K_EURAUD]); EURAUD.setUserName( m_mysqlmap[K_userName] ); EURAUD.setPassword( m_mysqlmap[K_pwd] ); if (!EURAUD.open()) { COPPER.open(); if(!COPPER.open()) { qDebug()<<QObject::tr("EURAUD database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("EURAUD connection is successful\n"); } //11 EURCAD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_EURCAD])); EURCAD.setHostName(m_mysqlmap[K_mysql_hostName]); EURCAD.setPort(m_mysqlmap[K_mysql_port].toInt()); EURCAD.setDatabaseName(m_dbmap[K_EURCAD]); EURCAD.setUserName( m_mysqlmap[K_userName] ); EURCAD.setPassword( m_mysqlmap[K_pwd] ); if (!EURCAD.open()) { EURCAD.open(); if(!EURCAD.open()) { qDebug()<<QObject::tr("EURCAD database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("EURCAD connection is successful\n"); } //12 EURCHF=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_EURCHF])); EURCHF.setHostName(m_mysqlmap[K_mysql_hostName]); EURCHF.setPort(m_mysqlmap[K_mysql_port].toInt()); EURCHF.setDatabaseName(m_dbmap[K_EURCHF]); EURCHF.setUserName( m_mysqlmap[K_userName] ); EURCHF.setPassword( m_mysqlmap[K_pwd] ); if (!EURCHF.open()) { EURCHF.open(); if(!EURCHF.open()) { qDebug()<<QObject::tr("EURCHF database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("EURCHF connection is successful\n"); } //13 EURGBP=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_EURGBP])); EURGBP.setHostName(m_mysqlmap[K_mysql_hostName]); EURGBP.setPort(m_mysqlmap[K_mysql_port].toInt()); EURGBP.setDatabaseName(m_dbmap[K_EURGBP]); EURGBP.setUserName( m_mysqlmap[K_userName] ); EURGBP.setPassword( m_mysqlmap[K_pwd] ); if (!EURGBP.open()) { EURGBP.open(); if(!EURGBP.open()) { qDebug()<<QObject::tr("EURGBP database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("EURGBP connection is successful\n"); } //14 EURJPY=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_EURJPY])); EURJPY.setHostName(m_mysqlmap[K_mysql_hostName]); EURJPY.setPort(m_mysqlmap[K_mysql_port].toInt()); EURJPY.setDatabaseName(m_dbmap[K_EURJPY]); EURJPY.setUserName( m_mysqlmap[K_userName] ); EURJPY.setPassword( m_mysqlmap[K_pwd] ); if (!EURJPY.open()) { EURJPY.open(); if(!EURJPY.open()) { qDebug()<<QObject::tr("EURJPY database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("EURJPY connection is successful\n"); } //16 EURNZD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_EURNZD])); EURNZD.setHostName(m_mysqlmap[K_mysql_hostName]); EURNZD.setPort(m_mysqlmap[K_mysql_port].toInt()); EURNZD.setDatabaseName(m_dbmap[K_EURNZD]); EURNZD.setUserName( m_mysqlmap[K_userName] ); EURNZD.setPassword( m_mysqlmap[K_pwd] ); if (!EURNZD.open()) { EURNZD.open(); if(!EURNZD.open()) { qDebug()<<QObject::tr("EURNZD database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("EURNZD connection is successful\n"); } //19 EURUSD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_EURUSD])); EURUSD.setHostName(m_mysqlmap[K_mysql_hostName]); EURUSD.setPort(m_mysqlmap[K_mysql_port].toInt()); EURUSD.setDatabaseName(m_dbmap[K_EURUSD]); EURUSD.setUserName( m_mysqlmap[K_userName] ); EURUSD.setPassword( m_mysqlmap[K_pwd] ); if (!EURUSD.open()) { EURUSD.open(); if(!EURUSD.open()) { qDebug()<<QObject::tr("EURUSD database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("EURUSD connection is successful\n"); } //20 GBPAUD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_GBPAUD])); GBPAUD.setHostName(m_mysqlmap[K_mysql_hostName]); GBPAUD.setPort(m_mysqlmap[K_mysql_port].toInt()); GBPAUD.setDatabaseName(m_dbmap[K_GBPAUD]); GBPAUD.setUserName( m_mysqlmap[K_userName] ); GBPAUD.setPassword( m_mysqlmap[K_pwd] ); if (!GBPAUD.open()) { EURUSD.open(); if(!GBPAUD.open()) { qDebug()<<QObject::tr("GBPAUD database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("GBPAUD connection is successful\n"); } //21 GBPCAD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_GBPCAD])); GBPCAD.setHostName(m_mysqlmap[K_mysql_hostName]); GBPCAD.setPort(m_mysqlmap[K_mysql_port].toInt()); GBPCAD.setDatabaseName(m_dbmap[K_GBPCAD]); GBPCAD.setUserName( m_mysqlmap[K_userName] ); GBPCAD.setPassword( m_mysqlmap[K_pwd] ); if (!GBPCAD.open()) { GBPCAD.open(); if(!GBPCAD.open()) { qDebug()<<QObject::tr("GBPCAD database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("GBPCAD connection is successful\n"); } //22 GBPCHF=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_GBPCHF])); GBPCHF.setHostName(m_mysqlmap[K_mysql_hostName]); GBPCHF.setPort(m_mysqlmap[K_mysql_port].toInt()); GBPCHF.setDatabaseName(m_dbmap[K_GBPCHF]); GBPCHF.setUserName( m_mysqlmap[K_userName] ); GBPCHF.setPassword( m_mysqlmap[K_pwd] ); if (!GBPCHF.open()) { GBPCHF.open(); if(!GBPCHF.open()) { qDebug()<<QObject::tr("GBPCHF database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("GBPCHF connection is successful\n"); } //23 GBPJPY=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_GBPJPY])); GBPJPY.setHostName(m_mysqlmap[K_mysql_hostName]); GBPJPY.setPort(m_mysqlmap[K_mysql_port].toInt()); GBPJPY.setDatabaseName(m_dbmap[K_GBPJPY]); GBPJPY.setUserName( m_mysqlmap[K_userName] ); GBPJPY.setPassword( m_mysqlmap[K_pwd] ); if (!GBPJPY.open()) { GBPJPY.open(); if(!GBPJPY.open()) { qDebug()<<QObject::tr("GBPJPY database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("GBPJPY connection is successful\n"); } //24 GBPNZD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_GBPNZD])); GBPNZD.setHostName(m_mysqlmap[K_mysql_hostName]); GBPNZD.setPort(m_mysqlmap[K_mysql_port].toInt()); GBPNZD.setDatabaseName(m_dbmap[K_GBPNZD]); GBPNZD.setUserName( m_mysqlmap[K_userName] ); GBPNZD.setPassword( m_mysqlmap[K_pwd] ); if (!GBPNZD.open()) { GBPNZD.open(); if(!GBPNZD.open()) { qDebug()<<QObject::tr("GBPNZD database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("GBPNZD connection is successful\n"); } //25 GBPUSD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_GBPUSD])); GBPUSD.setHostName(m_mysqlmap[K_mysql_hostName]); GBPUSD.setPort(m_mysqlmap[K_mysql_port].toInt()); GBPUSD.setDatabaseName(m_dbmap[K_GBPUSD]); GBPUSD.setUserName( m_mysqlmap[K_userName] ); GBPUSD.setPassword( m_mysqlmap[K_pwd] ); if (!GBPUSD.open()) { GBPUSD.open(); if(!GBPUSD.open()) { qDebug()<<QObject::tr("GBPUSD database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("GBPUSD connection is successful\n"); } //26 NGAS=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_NGAS])); NGAS.setHostName(m_mysqlmap[K_mysql_hostName]); NGAS.setPort(m_mysqlmap[K_mysql_port].toInt()); NGAS.setDatabaseName(m_dbmap[K_NGAS]); NGAS.setUserName( m_mysqlmap[K_userName] ); NGAS.setPassword( m_mysqlmap[K_pwd] ); if (!NGAS.open()) { NGAS.open(); if(!NGAS.open()) { qDebug()<<QObject::tr("NGAS database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("NGAS connection is successful\n"); } //27 NZDCAD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_NZDCAD])); NZDCAD.setHostName(m_mysqlmap[K_mysql_hostName]); NZDCAD.setPort(m_mysqlmap[K_mysql_port].toInt()); NZDCAD.setDatabaseName(m_dbmap[K_NZDCAD]); NZDCAD.setUserName( m_mysqlmap[K_userName] ); NZDCAD.setPassword( m_mysqlmap[K_pwd] ); if (!NZDCAD.open()) { NZDCAD.open(); if(!NZDCAD.open()) { qDebug()<<QObject::tr("NZDCAD database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("NZDCAD connection is successful\n"); } //28 NZDCHF=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_NZDCHF])); NZDCHF.setHostName(m_mysqlmap[K_mysql_hostName]); NZDCHF.setPort(m_mysqlmap[K_mysql_port].toInt()); NZDCHF.setDatabaseName(m_dbmap[K_NZDCHF]); NZDCHF.setUserName( m_mysqlmap[K_userName] ); NZDCHF.setPassword( m_mysqlmap[K_pwd] ); if (!NZDCHF.open()) { NZDCHF.open(); if(!NZDCHF.open()) { qDebug()<<QObject::tr("NZDCHF database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("NZDCHF connection is successful\n"); } //29 NZDJPY=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_NZDJPY])); NZDJPY.setHostName(m_mysqlmap[K_mysql_hostName]); NZDJPY.setPort(m_mysqlmap[K_mysql_port].toInt()); NZDJPY.setDatabaseName(m_dbmap[K_NZDJPY]); NZDJPY.setUserName( m_mysqlmap[K_userName] ); NZDJPY.setPassword( m_mysqlmap[K_pwd] ); if (!NZDJPY.open()) { NZDJPY.open(); if(!NZDJPY.open()) { qDebug()<<QObject::tr("NZDJPY database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("NZDJPY connection is successful\n"); } //30 NZDUSD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_NZDUSD])); NZDUSD.setHostName(m_mysqlmap[K_mysql_hostName]); NZDUSD.setPort(m_mysqlmap[K_mysql_port].toInt()); NZDUSD.setDatabaseName(m_dbmap[K_NZDUSD]); NZDUSD.setUserName( m_mysqlmap[K_userName] ); NZDUSD.setPassword( m_mysqlmap[K_pwd] ); if (!NZDUSD.open()) { NZDUSD.open(); if(!NZDUSD.open()) { qDebug()<<QObject::tr("NZDUSD database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("NZDUSD connection is successful\n"); } //31 UKOIL=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_UKOIL])); UKOIL.setHostName(m_mysqlmap[K_mysql_hostName]); UKOIL.setPort(m_mysqlmap[K_mysql_port].toInt()); UKOIL.setDatabaseName(m_dbmap[K_UKOIL]); UKOIL.setUserName( m_mysqlmap[K_userName] ); UKOIL.setPassword( m_mysqlmap[K_pwd] ); if (!UKOIL.open()) { UKOIL.open(); if(!UKOIL.open()) { qDebug()<<QObject::tr("UKOIL database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("UKOIL connection is successful\n"); } //32 USDCAD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_USDCAD])); USDCAD.setHostName(m_mysqlmap[K_mysql_hostName]); USDCAD.setPort(m_mysqlmap[K_mysql_port].toInt()); USDCAD.setDatabaseName(m_dbmap[K_USDCAD]); USDCAD.setUserName( m_mysqlmap[K_userName] ); USDCAD.setPassword( m_mysqlmap[K_pwd] ); if (!USDCAD.open()) { USDCAD.open(); if(!USDCAD.open()) { qDebug()<<QObject::tr("USDCAD database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("USDCAD connection is successful\n"); } //33 USDCHF=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_USDCHF])); USDCHF.setHostName(m_mysqlmap[K_mysql_hostName]); USDCHF.setPort(m_mysqlmap[K_mysql_port].toInt()); USDCHF.setDatabaseName(m_dbmap[K_USDCHF]); USDCHF.setUserName( m_mysqlmap[K_userName] ); USDCHF.setPassword( m_mysqlmap[K_pwd] ); if (!USDCHF.open()) { USDCHF.open(); if(!USDCHF.open()) { qDebug()<<QObject::tr("USDCHF database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("USDCHF connection is successful\n"); } //34 USDCNH=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_USDCNH])); USDCNH.setHostName(m_mysqlmap[K_mysql_hostName]); USDCNH.setPort(m_mysqlmap[K_mysql_port].toInt()); USDCNH.setDatabaseName(m_dbmap[K_USDCNH]); USDCNH.setUserName( m_mysqlmap[K_userName] ); USDCNH.setPassword( m_mysqlmap[K_pwd] ); if (!USDCNH.open()) { USDCNH.open(); if(!USDCNH.open()) { qDebug()<<QObject::tr("USDCNH database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("USDCNH connection is successful\n"); } //35 USDHKD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_USDHKD])); USDHKD.setHostName(m_mysqlmap[K_mysql_hostName]); USDHKD.setPort(m_mysqlmap[K_mysql_port].toInt()); USDHKD.setDatabaseName(m_dbmap[K_USDHKD]); USDHKD.setUserName( m_mysqlmap[K_userName] ); USDHKD.setPassword( m_mysqlmap[K_pwd] ); if (!USDHKD.open()) { USDHKD.open(); if(!USDHKD.open()) { qDebug()<<QObject::tr("USDHKD database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("USDHKD connection is successful\n"); } //36 USDJPY=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_USDJPY])); USDJPY.setHostName(m_mysqlmap[K_mysql_hostName]); USDJPY.setPort(m_mysqlmap[K_mysql_port].toInt()); USDJPY.setDatabaseName(m_dbmap[K_USDJPY]); USDJPY.setUserName( m_mysqlmap[K_userName] ); USDJPY.setPassword( m_mysqlmap[K_pwd] ); if (!USDJPY.open()) { USDJPY.open(); if(!USDJPY.open()) { qDebug()<<QObject::tr("USDJPY database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("USDJPY connection is successful\n"); } //37 USDMXN=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_USDMXN])); USDMXN.setHostName(m_mysqlmap[K_mysql_hostName]); USDMXN.setPort(m_mysqlmap[K_mysql_port].toInt()); USDMXN.setDatabaseName(m_dbmap[K_USDMXN]); USDMXN.setUserName( m_mysqlmap[K_userName] ); USDMXN.setPassword( m_mysqlmap[K_pwd] ); if (!USDMXN.open()) { USDMXN.open(); if(!USDMXN.open()) { qDebug()<<QObject::tr("USDMXN database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("USDMXN connection is successful\n"); } //38 USDNOK=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_USDNOK])); USDNOK.setHostName(m_mysqlmap[K_mysql_hostName]); USDNOK.setPort(m_mysqlmap[K_mysql_port].toInt()); USDNOK.setDatabaseName(m_dbmap[K_USDNOK]); USDNOK.setUserName( m_mysqlmap[K_userName] ); USDNOK.setPassword( m_mysqlmap[K_pwd] ); if (!USDNOK.open()) { USDNOK.open(); if(!USDNOK.open()) { qDebug()<<QObject::tr("USDNOK database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("USDNOK connection is successful\n"); } //39 USDSEK=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_USDSEK])); USDSEK.setHostName(m_mysqlmap[K_mysql_hostName]); USDSEK.setPort(m_mysqlmap[K_mysql_port].toInt()); USDSEK.setDatabaseName(m_dbmap[K_USDSEK]); USDSEK.setUserName( m_mysqlmap[K_userName] ); USDSEK.setPassword( m_mysqlmap[K_pwd] ); if (!USDSEK.open()) { USDSEK.open(); if(!USDSEK.open()) { qDebug()<<QObject::tr("USDSEK database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("USDSEK connection is successful\n"); } //40 USDTRY=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_USDTRY])); USDTRY.setHostName(m_mysqlmap[K_mysql_hostName]); USDTRY.setPort(m_mysqlmap[K_mysql_port].toInt()); USDTRY.setDatabaseName(m_dbmap[K_USDTRY]); USDTRY.setUserName( m_mysqlmap[K_userName] ); USDTRY.setPassword( m_mysqlmap[K_pwd] ); if (!USDTRY.open()) { USDTRY.open(); if(!USDTRY.open()) { qDebug()<<QObject::tr("USDTRY database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("USDTRY connection is successful\n"); } //41 USDZAR=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_USDZAR])); USDZAR.setHostName(m_mysqlmap[K_mysql_hostName]); USDZAR.setPort(m_mysqlmap[K_mysql_port].toInt()); USDZAR.setDatabaseName(m_dbmap[K_USDZAR]); USDZAR.setUserName( m_mysqlmap[K_userName] ); USDZAR.setPassword( m_mysqlmap[K_pwd] ); if (!USDZAR.open()) { USDZAR.open(); if(!USDZAR.open()) { qDebug()<<QObject::tr("USDZAR database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("USDZAR connection is successful\n"); } //42 USOIL=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_USOIL])); USOIL.setHostName(m_mysqlmap[K_mysql_hostName]); USOIL.setPort(m_mysqlmap[K_mysql_port].toInt()); USOIL.setDatabaseName(m_dbmap[K_USOIL]); USOIL.setUserName( m_mysqlmap[K_userName] ); USOIL.setPassword( m_mysqlmap[K_pwd] ); if (!USOIL.open()) { USOIL.open(); if(!USOIL.open()) { qDebug()<<QObject::tr("USOIL database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("USOIL connection is successful\n"); } //43 XAGUSD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_XAGUSD])); XAGUSD.setHostName(m_mysqlmap[K_mysql_hostName]); XAGUSD.setPort(m_mysqlmap[K_mysql_port].toInt()); XAGUSD.setDatabaseName(m_dbmap[K_XAGUSD]); XAGUSD.setUserName( m_mysqlmap[K_userName] ); XAGUSD.setPassword( m_mysqlmap[K_pwd] ); if (!XAGUSD.open()) { XAGUSD.open(); if(!XAGUSD.open()) { qDebug()<<QObject::tr("XAGUSD database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("XAGUSD connection is successful\n"); } //44 XAUUSD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_XAUUSD])); XAUUSD.setHostName(m_mysqlmap[K_mysql_hostName]); XAUUSD.setPort(m_mysqlmap[K_mysql_port].toInt()); XAUUSD.setDatabaseName(m_dbmap[K_XAUUSD]); XAUUSD.setUserName( m_mysqlmap[K_userName] ); XAUUSD.setPassword( m_mysqlmap[K_pwd] ); if (!XAUUSD.open()) { XAUUSD.open(); if(!XAUUSD.open()) { qDebug()<<QObject::tr("XAUUSD database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("XAUUSD connection is successful\n"); } //45 XPDUSD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_XPDUSD])); XPDUSD.setHostName(m_mysqlmap[K_mysql_hostName]); XPDUSD.setPort(m_mysqlmap[K_mysql_port].toInt()); XPDUSD.setDatabaseName(m_dbmap[K_XPDUSD]); XPDUSD.setUserName( m_mysqlmap[K_userName] ); XPDUSD.setPassword( m_mysqlmap[K_pwd] ); if (!XPDUSD.open()) { XPDUSD.open(); if(!XPDUSD.open()) { qDebug()<<QObject::tr("XPDUSD database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("XPDUSD connection is successful\n"); XPDUSD.open(); } //46 XPTUSD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_XPTUSD])); XPTUSD.setHostName(m_mysqlmap[K_mysql_hostName]); XPTUSD.setPort(m_mysqlmap[K_mysql_port].toInt()); XPTUSD.setDatabaseName(m_dbmap[K_XPTUSD]); XPTUSD.setUserName( m_mysqlmap[K_userName] ); XPTUSD.setPassword( m_mysqlmap[K_pwd] ); if (!XPTUSD.open()) { XPTUSD.open(); if(!XPTUSD.open()) { qDebug()<<QObject::tr("XPTUSD database connection failed\n"); return false; } }else { qDebug()<<QObject::tr("XPTUSD connection is successful\n"); } qDebug()<<QString("end db %1 ms").arg(dbt.elapsed()); return true; } /**重新打开数据库数据库 * @brief qReadisTest::openDB */ void qDbManager::openDB() { QTime t; t.start(); qDebug()<<"重新start db"; //1 if(QSqlDatabase::contains(m_dbmap[K_AUDJPY])) { AUDJPY = QSqlDatabase::database(m_dbmap[K_AUDJPY]); } else { AUDJPY = QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_AUDJPY]); } // AUDJPY.open(); if (!AUDJPY.open()) { qDebug()<<QObject::tr("AUDJPY database connection failed\n"); return ; }else { qDebug()<<QObject::tr("AUDJPY connection is successful\n"); } //2 if(QSqlDatabase::contains(m_dbmap[K_AUDNZD])) { AUDNZD = QSqlDatabase::database(m_dbmap[K_AUDNZD]); } else { AUDNZD = QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_AUDNZD]); // AUDNZD->setDatabaseName(m_dbmap[K_AUDNZD]); } if (!AUDNZD.open()) { qDebug()<<QObject::tr("AUDNZD database connection failed\n"); return ; }else { qDebug()<<QObject::tr("AUDNZD connection is successful\n"); } //3 if(QSqlDatabase::contains(m_dbmap[K_AUDUSD])) { AUDUSD = QSqlDatabase::database(m_dbmap[K_AUDUSD]); } else { AUDUSD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_AUDUSD])); } if (!AUDUSD.open()) { qDebug()<<QObject::tr("AUDUSD database connection failed\n"); return ; }else { qDebug()<<QObject::tr("AUDUSD connection is successful\n"); } //4 if(QSqlDatabase::contains(m_dbmap[K_BUND])) { BUND = QSqlDatabase::database(m_dbmap[K_BUND]); } else { BUND=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_BUND])); } if (!BUND.open()) { qDebug()<<QObject::tr("BUND database connection failed\n"); return ; }else { qDebug()<<QObject::tr("BUND connection is successful\n"); } //5 if(QSqlDatabase::contains(m_dbmap[K_CADCHF])) { CADCHF = QSqlDatabase::database(m_dbmap[K_CADCHF]); } else { CADCHF=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_CADCHF])); } if (!CADCHF.open()) { qDebug()<<QObject::tr("CADCHF database connection failed\n"); return ; }else { qDebug()<<QObject::tr("CADCHF connection is successful\n"); } //6 if(QSqlDatabase::contains(m_dbmap[K_COPPER])) { COPPER = QSqlDatabase::database(m_dbmap[K_COPPER]); } else { COPPER=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_COPPER])); } if (!COPPER.open()) { qDebug()<<QObject::tr("COPPER database connection failed\n"); return ; }else { qDebug()<<QObject::tr("COPPER connection is successful\n"); } //7 if(QSqlDatabase::contains(m_dbmap[K_EURAUD])) { EURAUD = QSqlDatabase::database(m_dbmap[K_EURAUD]); } else { EURAUD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_EURAUD])); } if (!EURAUD.open()) { qDebug()<<QObject::tr("EURAUD database connection failed\n"); return ; }else { qDebug()<<QObject::tr("EURAUD connection is successful\n"); } //8 if(QSqlDatabase::contains(m_dbmap[K_EURCAD])) { EURCAD = QSqlDatabase::database(m_dbmap[K_EURCAD]); } else { EURCAD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_EURCAD])); } if (!EURCAD.open()) { qDebug()<<QObject::tr("EURCAD database connection failed\n"); return ; }else { qDebug()<<QObject::tr("EURCAD connection is successful\n"); } //9 if(QSqlDatabase::contains(m_dbmap[K_EURCHF])) { EURCHF = QSqlDatabase::database(m_dbmap[K_EURCHF]); } else { EURCHF=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_EURCHF])); } if (!EURCHF.open()) { qDebug()<<QObject::tr("EURCHF database connection failed\n"); return ; }else { qDebug()<<QObject::tr("EURCHF connection is successful\n"); } //10 if(QSqlDatabase::contains(m_dbmap[K_EURGBP])) { EURGBP = QSqlDatabase::database(m_dbmap[K_EURGBP]); } else { EURGBP=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_EURGBP])); } if (!EURGBP.open()) { qDebug()<<QObject::tr("EURGBP database connection failed\n"); return ; }else { qDebug()<<QObject::tr("EURGBP connection is successful\n"); } //11 if(QSqlDatabase::contains(m_dbmap[K_EURJPY])) { EURJPY = QSqlDatabase::database(m_dbmap[K_EURJPY]); } else { EURJPY=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_EURJPY])); } if (!EURJPY.open()) { qDebug()<<QObject::tr("EURJPY database connection failed\n"); return ; }else { qDebug()<<QObject::tr("EURJPY connection is successful\n"); } //12 if(QSqlDatabase::contains(m_dbmap[K_EURNZD])) { EURNZD = QSqlDatabase::database(m_dbmap[K_EURNZD]); } else { EURNZD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_EURNZD])); } if (!EURNZD.open()) { qDebug()<<QObject::tr("EURNZD database connection failed\n"); return ; }else { qDebug()<<QObject::tr("EURNZD connection is successful\n"); } //13 if(QSqlDatabase::contains(m_dbmap[K_EURUSD])) { EURUSD = QSqlDatabase::database(m_dbmap[K_EURUSD]); } else { EURUSD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_EURUSD])); } if (!EURUSD.open()) { qDebug()<<QObject::tr("EURUSD database connection failed\n"); return ; }else { qDebug()<<QObject::tr("EURUSD connection is successful\n"); } //14 if(QSqlDatabase::contains(m_dbmap[K_GBPAUD])) { GBPAUD = QSqlDatabase::database(m_dbmap[K_GBPAUD]); } else { GBPAUD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_GBPAUD])); } if (!GBPAUD.open()) { qDebug()<<QObject::tr("GBPAUD database connection failed\n"); return ; }else { qDebug()<<QObject::tr("GBPAUD connection is successful\n"); } //15 if(QSqlDatabase::contains(m_dbmap[K_GBPCAD])) { GBPCAD = QSqlDatabase::database(m_dbmap[K_GBPCAD]); } else { GBPCAD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_GBPCAD])); } if (!GBPCAD.open()) { qDebug()<<QObject::tr("GBPCAD database connection failed\n"); return ; }else { qDebug()<<QObject::tr("GBPCAD connection is successful\n"); } //16 if(QSqlDatabase::contains(m_dbmap[K_GBPCHF])) { GBPCHF = QSqlDatabase::database(m_dbmap[K_GBPCHF]); } else { GBPCHF=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_GBPCHF])); } if (!GBPCHF.open()) { qDebug()<<QObject::tr("GBPCHF database connection failed\n"); return ; }else { qDebug()<<QObject::tr("GBPCHF connection is successful\n"); } //17 if(QSqlDatabase::contains(m_dbmap[K_GBPJPY])) { GBPJPY = QSqlDatabase::database(m_dbmap[K_GBPJPY]); } else { GBPJPY=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_GBPJPY])); } if (!GBPJPY.open()) { qDebug()<<QObject::tr("GBPJPY database connection failed\n"); return ; }else { qDebug()<<QObject::tr("GBPJPY connection is successful\n"); } //18 if(QSqlDatabase::contains(m_dbmap[K_GBPNZD])) { GBPNZD = QSqlDatabase::database(m_dbmap[K_GBPNZD]); } else { GBPNZD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_GBPNZD])); } if (!GBPNZD.open()) { qDebug()<<QObject::tr("GBPNZD database connection failed\n"); return ; }else { qDebug()<<QObject::tr("GBPNZD connection is successful\n"); } //19 if(QSqlDatabase::contains(m_dbmap[K_GBPUSD])) { GBPUSD = QSqlDatabase::database(m_dbmap[K_GBPUSD]); } else { GBPUSD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_GBPUSD])); } if (!GBPUSD.open()) { qDebug()<<QObject::tr("GBPUSD database connection failed\n"); return ; }else { qDebug()<<QObject::tr("GBPUSD connection is successful\n"); } //20 if(QSqlDatabase::contains(m_dbmap[K_NGAS])) { NGAS = QSqlDatabase::database(m_dbmap[K_NGAS]); } else { NGAS=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_NGAS])); } if (!NGAS.open()) { qDebug()<<QObject::tr("NGAS database connection failed\n"); return ; }else { qDebug()<<QObject::tr("NGAS connection is successful\n"); } //21 if(QSqlDatabase::contains(m_dbmap[K_NZDCAD])) { NZDCAD = QSqlDatabase::database(m_dbmap[K_NZDCAD]); } else { NZDCAD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_NZDCAD])); } if (!NZDCAD.open()) { qDebug()<<QObject::tr("NZDCAD database connection failed\n"); return ; }else { qDebug()<<QObject::tr("NZDCAD connection is successful\n"); } //22 if(QSqlDatabase::contains(m_dbmap[K_NZDCHF])) { NZDCHF = QSqlDatabase::database(m_dbmap[K_NZDCHF]); } else { NZDCHF=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_NZDCHF])); } if (!NZDCHF.open()) { qDebug()<<QObject::tr("NZDCHF database connection failed\n"); return ; }else { qDebug()<<QObject::tr("NZDCHF connection is successful\n"); } //23 if(QSqlDatabase::contains(m_dbmap[K_NZDJPY])) { NZDJPY = QSqlDatabase::database(m_dbmap[K_NZDJPY]); } else { NZDJPY=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_NZDJPY])); } if (!NZDJPY.open()) { qDebug()<<QObject::tr("NZDJPY database connection failed\n"); return ; }else { qDebug()<<QObject::tr("NZDJPY connection is successful\n"); } //24 if(QSqlDatabase::contains(m_dbmap[K_NZDUSD])) { NZDUSD = QSqlDatabase::database(m_dbmap[K_NZDUSD]); } else { NZDUSD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_NZDUSD])); } if (!NZDUSD.open()) { qDebug()<<QObject::tr("NZDUSD database connection failed\n"); return ; }else { qDebug()<<QObject::tr("NZDUSD connection is successful\n"); } //25 if(QSqlDatabase::contains(m_dbmap[K_UKOIL])) { UKOIL = QSqlDatabase::database(m_dbmap[K_UKOIL]); } else { UKOIL=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_UKOIL])); } if (!UKOIL.open()) { qDebug()<<QObject::tr("UKOIL database connection failed\n"); return ; }else { qDebug()<<QObject::tr("UKOIL connection is successful\n"); } //26 if(QSqlDatabase::contains(m_dbmap[K_USDCAD])) { USDCAD = QSqlDatabase::database(m_dbmap[K_USDCAD]); } else { USDCAD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_USDCAD])); } if (!USDCAD.open()) { qDebug()<<QObject::tr("USDCAD database connection failed\n"); return ; }else { qDebug()<<QObject::tr("USDCAD connection is successful\n"); } //27 if(QSqlDatabase::contains(m_dbmap[K_USDCHF])) { USDCHF = QSqlDatabase::database(m_dbmap[K_USDCHF]); } else { USDCHF=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_USDCHF])); } if (!USDCHF.open()) { qDebug()<<QObject::tr("USDCHF database connection failed\n"); return ; }else { qDebug()<<QObject::tr("USDCHF connection is successful\n"); } //28 if(QSqlDatabase::contains(m_dbmap[K_USDCNH])) { USDCNH = QSqlDatabase::database(m_dbmap[K_USDCNH]); } else { USDCNH=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_USDCNH])); } if (!USDCNH.open()) { qDebug()<<QObject::tr("USDCNH database connection failed\n"); return ; }else { qDebug()<<QObject::tr("USDCNH connection is successful\n"); } //29 if(QSqlDatabase::contains(m_dbmap[K_USDHKD])) { USDHKD = QSqlDatabase::database(m_dbmap[K_USDHKD]); } else { USDHKD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_USDHKD])); } if (!USDHKD.open()) { qDebug()<<QObject::tr("USDHKD database connection failed\n"); return ; }else { qDebug()<<QObject::tr("USDHKD connection is successful\n"); } //30 if(QSqlDatabase::contains(m_dbmap[K_USDJPY])) { USDJPY = QSqlDatabase::database(m_dbmap[K_USDJPY]); } else { USDJPY=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_USDJPY])); } if (!USDJPY.open()) { qDebug()<<QObject::tr("USDJPY database connection failed\n"); return ; }else { qDebug()<<QObject::tr("USDJPY connection is successful\n"); } //31 if(QSqlDatabase::contains(m_dbmap[K_USDMXN])) { USDMXN = QSqlDatabase::database(m_dbmap[K_USDMXN]); } else { USDMXN=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_USDMXN])); } if (!USDMXN.open()) { qDebug()<<QObject::tr("USDMXN database connection failed\n"); return ; }else { qDebug()<<QObject::tr("USDMXN connection is successful\n"); } //32 if(QSqlDatabase::contains(m_dbmap[K_USDNOK])) { USDNOK = QSqlDatabase::database(m_dbmap[K_USDNOK]); } else { USDNOK=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_USDNOK])); } if (!USDNOK.open()) { qDebug()<<QObject::tr("USDNOK database connection failed\n"); return ; }else { qDebug()<<QObject::tr("USDNOK connection is successful\n"); } //33 if(QSqlDatabase::contains(m_dbmap[K_USDSEK])) { USDSEK = QSqlDatabase::database(m_dbmap[K_USDSEK]); } else { USDSEK=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_USDSEK])); } if (!USDSEK.open()) { qDebug()<<QObject::tr("USDSEK database connection failed\n"); return ; }else { qDebug()<<QObject::tr("USDSEK connection is successful\n"); } //34 if(QSqlDatabase::contains(m_dbmap[K_USDTRY])) { USDTRY = QSqlDatabase::database(m_dbmap[K_USDTRY]); } else { USDTRY=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_USDTRY])); } if (!USDTRY.open()) { qDebug()<<QObject::tr("USDTRY database connection failed\n"); return ; }else { qDebug()<<QObject::tr("USDTRY connection is successful\n"); } //35 if(QSqlDatabase::contains(m_dbmap[K_USDZAR])) { USDZAR = QSqlDatabase::database(m_dbmap[K_USDZAR]); } else { USDZAR=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_USDZAR])); } if (!USDZAR.open()) { qDebug()<<QObject::tr("USDZAR database connection failed\n"); return ; }else { qDebug()<<QObject::tr("USDZAR connection is successful\n"); } //36 if(QSqlDatabase::contains(m_dbmap[K_USOIL])) { USOIL = QSqlDatabase::database(m_dbmap[K_USOIL]); } else { USOIL=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_USOIL])); } if (!USOIL.open()) { qDebug()<<QObject::tr("USOIL database connection failed\n"); return ; }else { qDebug()<<QObject::tr("USOIL connection is successful\n"); } //37 if(QSqlDatabase::contains(m_dbmap[K_XAGUSD])) { XAGUSD = QSqlDatabase::database(m_dbmap[K_XAGUSD]); } else { XAGUSD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_XAGUSD])); } if (!XAGUSD.open()) { qDebug()<<QObject::tr("XAGUSD database connection failed\n"); return ; }else { qDebug()<<QObject::tr("XAGUSD connection is successful\n"); } //38 if(QSqlDatabase::contains(m_dbmap[K_XAUUSD])) { XAUUSD = QSqlDatabase::database(m_dbmap[K_XAUUSD]); } else { XAUUSD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_XAUUSD])); } if (!XAUUSD.open()) { qDebug()<<QObject::tr("XAUUSD database connection failed\n"); return ; }else { qDebug()<<QObject::tr("XAUUSD connection is successful\n"); } //39 if(QSqlDatabase::contains(m_dbmap[K_XPDUSD])) { XPDUSD = QSqlDatabase::database(m_dbmap[K_XPDUSD]); } else { XPDUSD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_XPDUSD])); } if (!XPDUSD.open()) { qDebug()<<QObject::tr("XPDUSD database connection failed\n"); return ; }else { qDebug()<<QObject::tr("XPDUSD connection is successful\n"); } //40 if(QSqlDatabase::contains(m_dbmap[K_XPTUSD])) { XPTUSD = QSqlDatabase::database(m_dbmap[K_XPTUSD]); } else { XPTUSD=QSqlDatabase(QSqlDatabase::addDatabase(K_qMYSQL,m_dbmap[K_XPTUSD])); } XPTUSD.open(); if (!XPTUSD.open()) { qDebug()<<QObject::tr("XPTUSD database connection failed\n"); return ; }else { qDebug()<<QObject::tr("XPTUSD connection is successful\n"); } qDebug()<<QObject::tr("end重新db:%1 ms").arg(t.elapsed()); } /**关闭数据库 * @brief qReadisTest::closeDB */ void qDbManager::closeDB() { AUDNZD.close(); QSqlDatabase::removeDatabase("AUDNZD"); } /**数据库保存 * @brief qDbManager::createDBArray * @return */ QVector<QSqlDatabase> qDbManager::createDBArray() { QVector<QSqlDatabase> strArray; strArray.append(AUDJPY); strArray.append(AUDNZD); strArray.append(AUDUSD); strArray.append(BUND); strArray.append(CADCHF); strArray.append(COPPER); strArray.append(EURAUD); strArray.append(EURCAD); strArray.append(EURCHF); strArray.append(EURGBP); strArray.append(EURJPY); strArray.append(EURNZD); strArray.append(EURUSD); strArray.append(GBPAUD); strArray.append(GBPCAD); strArray.append(GBPCHF); strArray.append(GBPJPY); strArray.append(GBPNZD); strArray.append(GBPUSD); strArray.append(NGAS); strArray.append(NZDCAD); strArray.append(NZDCHF); strArray.append(NZDJPY); strArray.append(NZDUSD); strArray.append(UKOIL); strArray.append(USDCAD); strArray.append(USDCHF); strArray.append(USDCNH); strArray.append(USDHKD); strArray.append(USDJPY); strArray.append(USDMXN); strArray.append(USDNOK); strArray.append(USDSEK); strArray.append(USDTRY); strArray.append(USDZAR); strArray.append(USOIL); strArray.append(XAGUSD); strArray.append(XAUUSD); strArray.append(XPDUSD); strArray.append(XPTUSD); return strArray; } /**插入数据到redis * @brief qReadisTest::josnStr */ void qDbManager::addDataRedis(qRedis *redis) { m_redis=redis; QVector<QString> strDBArray=jsonUtil.getArray(K_dbName); qDebug()<<QString("%1%2").arg("shuzu").arg(strDBArray.count()); int totle=strDBArray.size(); for (int f = 0; f < totle; f++) { QString DB=strDBArray[f]; // qDebug()<<QString("数据库%1").arg(DB); // QVector<QString> tableArray= this->tabelName(DB); QVector<QString> typeOptionsArray=jsonUtil.getArray(K_typeOptions); int numOptionsArray=typeOptionsArray.count(); for (int h = 0; h < numOptionsArray; h++) { // QString tableName=tableArray[h]; QString type=typeOptionsArray[h]; strJson=""; this->addText(f,type); } } } /**封装redis格式的文本 * @brief qReadisTest::addJson * @param tableName */ void qDbManager::addText(int dbindex,const QString &type) { //if(tableName.length()>0) //{ QVector<QSqlDatabase> dbArray=createDBArray(); QSqlDatabase db=dbArray[dbindex]; QString dbName=db.databaseName(); if(db.isValid()) { this->selectDateFrist(dbName,db,type); this->selectDateSeconde(dbName,db,type); } // } } void qDbManager::selectDateFrist(const QString &dbName,const QSqlDatabase &db,const QString &type) { QSqlQuery query(db); QString sql=QString("select * from %1_%2 order by id desc limit 0,2").arg(dbName.toLower()).arg(type); query.exec(sql); // QSqlRecord rec = query.record(); strJson="["; while(query.next()) { strJson=strJson.append("["); int ptime = query.record().indexOf("ptime"); if(ptime>0) { QDateTime time = query.value("ptime").toDateTime(); int ptime = time.toTime_t(); //将当前时间转为时间戳 strJson=strJson.append("%1%2").arg(ptime).arg(","); } int open = query.record().indexOf("open"); if(open>0) { float open=query.value("open").toFloat(); strJson=strJson.append("%1%2").arg(QString("%1").arg(open)).arg(","); } int close = query.record().indexOf("close"); if(close>0) { float close=query.value("close").toFloat(); strJson=strJson.append("%1%2").arg(QString("%1").arg(close)).arg(","); } int high = query.record().indexOf("high"); if(high>0) { float high=query.value("high").toFloat(); strJson=strJson.append("%1%2").arg(QString("%1").arg(high)).arg(","); } int low = query.record().indexOf("low"); if(low>0) { float low=query.value("low").toFloat(); strJson=strJson.append("%1%2").arg(QString("%1").arg(low)).arg(","); } int volume = query.record().indexOf("volume"); if(volume>0) { int volume=query.value("volume").toInt(); strJson=strJson.append("%1").arg(QString("%1").arg(volume)); }else { strJson = strJson.left(strJson.length() - 1); } strJson=strJson.append("],"); } if(strJson.length()>1) { strJson = strJson.left(strJson.length() - 1); } strJson=strJson.append("]"); if(strJson.length()>2) { // qDebug()<<QString("文本封装结束%1").arg(strJson); QString key=QString("%1__%2").arg(dbName.toLower()).arg(type); m_redis->set(key,QString("%1").arg(strJson)); } } void qDbManager::selectDateSeconde(const QString &dbName,const QSqlDatabase &db,const QString &type) { QSqlQuery query(db); QString sql=QString("select * from %1_%2 order by id desc limit 0,100").arg(dbName.toLower()).arg(type); query.exec(sql); strJson="["; while(query.next()) { strJson=strJson.append("["); int ptime = query.record().indexOf("ptime"); if(ptime>0) { QDateTime time = query.value("ptime").toDateTime(); //获取当前时间 int ptime = time.toTime_t(); //将当前时间转为时间戳 strJson=strJson.append("%1%2").arg(ptime).arg(","); } int open = query.record().indexOf("open"); if(open>0) { float open=query.value("open").toFloat(); strJson=strJson.append("%1%2").arg(QString("%1").arg(open)).arg(","); } int close = query.record().indexOf("close"); if(close>0) { float close=query.value("close").toFloat(); strJson=strJson.append("%1%2").arg(QString("%1").arg(close)).arg(","); } int high = query.record().indexOf("high"); if(high>0) { float high=query.value("high").toFloat(); strJson=strJson.append("%1%2").arg(QString("%1").arg(high)).arg(","); } int low = query.record().indexOf("low"); if(low>0) { float low=query.value("low").toFloat(); strJson=strJson.append("%1%2").arg(QString("%1").arg(low)).arg(","); } int volume = query.record().indexOf("volume"); if(volume>0) { int volume=query.value("volume").toInt(); strJson=strJson.append("%1").arg(QString("%1").arg(volume)); }else { strJson = strJson.left(strJson.length() - 1); } strJson=strJson.append("],"); } if(strJson.length()>1) { strJson = strJson.left(strJson.length() - 1); } strJson=strJson.append("]"); if(strJson.length()>2) { QString key=QString("%1_%2").arg(dbName.toLower()).arg(type); m_redis->lpush(key,QString("%1").arg(strJson)); } } /**查询数据库的表 * @brief qDbManager::tabelName * @param db * @return */ QVector<QString> qDbManager::tabelName(const QString &db) { QVector<QString> tabelArray; QVector<QSqlDatabase> dbArray=createDBArray(); // QVector<QString> dbstr=readFile(); int sum=dbArray.count(); for (int g =0; g< sum; g++) { QSqlDatabase dbase=dbArray[g]; QSqlQuery query(dbase); query.exec(QString("select table_name from information_schema.tables where table_schema='%1'").arg(db)); while(query.next()) { QString str=query.value(0).toString(); if(str.indexOf("_")!=-1) { tabelArray.append(query.value(0).toString()); } } return tabelArray; } return tabelArray; } /**查询表 * @brief qDbManager::getselect */ void qDbManager::getselect() { qDebug()<<"aaa"; QSqlQuery query; query.exec("select * from factory order by id desc limit 0,2"); int row = 0; QJsonObject nestedMap; while(query.next()) { row++; QJsonObject factory; int Did=query.value("id").toInt(); factory.insert("id",Did); QString manufactory=query.value("manufactory").toString(); factory.insert("manufactory",manufactory); QString address=query.value("address").toString(); factory.insert("address",address); qDebug()<<Did; qDebug()<<address; nestedMap.insert(QString::number(row, 10),factory); } QJsonDocument document; document.setObject(nestedMap); QByteArray byte_array = document.toJson(QJsonDocument::Compact); QString json_str(byte_array); qDebug()<<json_str; qDebug()<<"bbb"; }
41.232227
123
0.364103
huangwenguang
79dfd05b1bfad2afe56dcec8446963d070cad25c
2,486
cpp
C++
binding/python/io.cpp
GreyMerlin/owl_cpp
ccc6128dbd08dcf7fcbe6679ec6acd714732bbb6
[ "BSL-1.0" ]
null
null
null
binding/python/io.cpp
GreyMerlin/owl_cpp
ccc6128dbd08dcf7fcbe6679ec6acd714732bbb6
[ "BSL-1.0" ]
1
2021-08-04T13:29:57.000Z
2021-08-04T14:10:49.000Z
binding/python/io.cpp
GreyMerlin/owl_cpp
ccc6128dbd08dcf7fcbe6679ec6acd714732bbb6
[ "BSL-1.0" ]
1
2020-09-21T22:25:57.000Z
2020-09-21T22:25:57.000Z
/** @file "/owlcpp/binding/python/io.cpp" part of owlcpp project. @n Distributed under the Boost Software License, Version 1.0; see doc/license.txt. @n Copyright Mikhail K Levin 2011 *******************************************************************************/ #include "boost/python.hpp" namespace bp = boost::python; #include "boost/tuple/tuple.hpp" #include "owlcpp/exception.hpp" #include "owlcpp/rdf/triple_store.hpp" #include "owlcpp/io/catalog.hpp" #include "owlcpp/io/input.hpp" #include "owlcpp/io/read_ontology_iri.hpp" using owlcpp::Triple_store; using owlcpp::Catalog; void export_catalog(); namespace{ void translator(owlcpp::base_exception const& e) { PyErr_SetString( PyExc_RuntimeError, boost::diagnostic_information(e).c_str() ); } bp::tuple read_ontology_iri( boost::filesystem::path const& path, const std::size_t depth ) { const std::pair<std::string,std::string> p = owlcpp::read_ontology_iri(path, depth); return bp::make_tuple(p.first, p.second); } void load_file_1(boost::filesystem::path const& file, Triple_store& ts) { owlcpp::load_file(file, ts); } void load_file_2( boost::filesystem::path const& file, Triple_store& ts, Catalog const& cat ) { owlcpp::load_file(file, ts, cat); } }//namespace anonymous BOOST_PYTHON_MODULE(_io) { bp::register_exception_translator<owlcpp::base_exception>(&translator); bp::implicitly_convertible<std::string,boost::filesystem::path>(); export_catalog(); bp::def( "read_ontology_iri", &read_ontology_iri, (bp::arg("path"), bp::arg("depth")= std::numeric_limits<std::size_t>::max()), "Find ontologyIRI and versionIRI declarations in ontology document." "Once ontologyIRI is found, look for *depth* number of triples" "to locate versionIRI." ); bp::def( "load_file", &load_file_1, (bp::arg("file"), bp::arg("store")), "load ontology document ignoring imports" ); bp::def( "load_file", &load_file_2, (bp::arg("file"), bp::arg("store"), bp::arg("catalog")), "load ontology document including its imports" ); bp::def( "load_iri", static_cast< void (*) ( std::string const&, Triple_store&, Catalog const& ) >(&owlcpp::load_iri) ); }
27.622222
89
0.600161
GreyMerlin
076a8cd90f93853076a89e582437e5e741544744
2,700
cpp
C++
src/machine/timer/timer.cpp
elmerucr/E64-II
47115cba99630cd0890768e8657e1fabba6c2c3b
[ "MIT" ]
2
2021-02-02T19:28:02.000Z
2021-11-28T20:14:28.000Z
src/machine/timer/timer.cpp
elmerucr/E64-II
47115cba99630cd0890768e8657e1fabba6c2c3b
[ "MIT" ]
null
null
null
src/machine/timer/timer.cpp
elmerucr/E64-II
47115cba99630cd0890768e8657e1fabba6c2c3b
[ "MIT" ]
null
null
null
// timer.cpp // E64-II // // Copyright © 2019-2020 elmerucr. All rights reserved. #include "timer.hpp" #include "common.hpp" void E64::timer_ic::reset() { machine.TTL74LS148->release_line(interrupt_device_number); registers[0] = 0x00; // no pending irq's registers[1] = 0x00; // all timers turned off // load data register with value 1 bpm (may never be zero) registers[2] = 0x00; // high byte registers[3] = 0x01; // low byte for (int i=0; i<8; i++) { timers[i].bpm = (registers[2] << 8) | registers[3]; timers[i].clock_interval = bpm_to_clock_interval(timers[i].bpm); timers[i].counter = 0; } } void E64::timer_ic::run(uint32_t number_of_cycles) { for (int i=0; i<8; i++) { timers[i].counter += number_of_cycles; if ((timers[i].counter >= timers[i].clock_interval) && (registers[1] & (0b1 << i))) { timers[i].counter -= timers[i].clock_interval; // NEEDS WORK: what if counter flips below 0? machine.TTL74LS148->pull_line(interrupt_device_number); registers[0] |= (0b1 << i); } } } uint32_t E64::timer_ic::bpm_to_clock_interval(uint16_t bpm) { return (60.0 / bpm) * CPU_CLOCK_SPEED; } uint8_t E64::timer_ic::read_byte(uint8_t address) { return registers[address & 0x03]; } void E64::timer_ic::write_byte(uint8_t address, uint8_t byte) { switch (address & 0x03) { case 0x00: /* * b s r * 0 0 = 0 * 0 1 = 1 * 1 0 = 0 * 1 1 = 0 * * b = bit that's written * s = status (on if an interrupt was caused) * r = boolean result (acknowledge an interrupt (s=1) if b=1 * r = (~b) & s */ registers[0] = (~byte) & registers[0]; if ((registers[0] & 0xff) == 0) { // no timers left causing interrupts machine.TTL74LS148->release_line(interrupt_device_number); } break; case 0x01: { uint8_t turned_on = byte & (~registers[1]); for (int i=0; i<8; i++) { if (turned_on & (0b1 << i)) { timers[i].bpm = (uint16_t)(registers[2] << 8) | registers[3]; if (timers[i].bpm == 0) timers[i].bpm = 1; timers[i].clock_interval = bpm_to_clock_interval(timers[i].bpm); timers[i].counter = 0; } } registers[0x01] = byte; //& 0x0f; // turn off all the rest? break; } default: registers[ address & 0x03 ] = byte; break; } } uint64_t E64::timer_ic::get_timer_counter(uint8_t timer_number) { return timers[timer_number & 0x07].counter; } uint64_t E64::timer_ic::get_timer_clock_interval(uint8_t timer_number) { return timers[timer_number & 0x07].clock_interval; }
25
74
0.591852
elmerucr
0777728cfc4a2a06445b9daf796e5cecaadac892
100
cpp
C++
XI/recursivitate/info.mcip.ro/216.cpp
rlodina99/Learn_cpp
0c5bd9e6c52ca21e2eb95eb91597272ddc842c08
[ "MIT" ]
null
null
null
XI/recursivitate/info.mcip.ro/216.cpp
rlodina99/Learn_cpp
0c5bd9e6c52ca21e2eb95eb91597272ddc842c08
[ "MIT" ]
null
null
null
XI/recursivitate/info.mcip.ro/216.cpp
rlodina99/Learn_cpp
0c5bd9e6c52ca21e2eb95eb91597272ddc842c08
[ "MIT" ]
null
null
null
#216. [2010-03-20 - 18:00:30] Sa se calculeze recusiv suma S=1/2+2/1+2/3+3/2+...+n/(n+1)+(n+1)/n.
25
39
0.56
rlodina99
077802f97457dcd4a612891ebc01e376e3f840a6
10,149
cpp
C++
JetBrainsFileWatcher/JetBrainsFileWatcher/JBNativeFileWatcher.cpp
SineStriker/fsnotifier
38e8253e6a164f760e5e42bf2f4ba9e63d3fb0f6
[ "Apache-2.0" ]
4
2022-03-07T01:47:19.000Z
2022-03-07T12:24:48.000Z
JetBrainsFileWatcher/JetBrainsFileWatcher/JBNativeFileWatcher.cpp
SineStriker/fsnotifier
38e8253e6a164f760e5e42bf2f4ba9e63d3fb0f6
[ "Apache-2.0" ]
null
null
null
JetBrainsFileWatcher/JetBrainsFileWatcher/JBNativeFileWatcher.cpp
SineStriker/fsnotifier
38e8253e6a164f760e5e42bf2f4ba9e63d3fb0f6
[ "Apache-2.0" ]
null
null
null
#include "JBNativeFileWatcher.h" #include "JBFileWatcher.h" #include "JBFileWatcherNotificationSink.h" #include <QCoreApplication> #include <QFileInfo> #include <QThread> using namespace JBFileWatcherUtils; JBNativeFileWatcher::JBNativeFileWatcher(QObject *parent) : JBPluggableFileWatcher(parent), myLastChangedPathsLock(new QMutex()) { myNotificationSink = nullptr; myLastChangedPaths.resize(2); myIsActive = false; myIsSendingRoots = false; } JBNativeFileWatcher::~JBNativeFileWatcher() { } void JBNativeFileWatcher::initialize(JBFileWatcherNotificationSink *sink) { Q_ASSERT(sink); myNotificationSink = sink; myExecutable = executable(); myStartAttemptCount = 0; myIsShuttingDown = false; mySettingRoots = 0; myRecursiveWatchRoots.clear(); myFlatWatchRoots.clear(); myIgnoredRoots.clear(); resetChangedPaths(); myLastOp = WatcherOp::UNKNOWN; myLines.clear(); QFileInfo info(myExecutable); if (!info.isFile()) { notifyOnFailure("watcher.exe.not.found"); } else if (!info.isExecutable()) { notifyOnFailure("watcher.exe.not.exe"); } else if (!startupProcess()) { notifyOnFailure("watcher.failed.to.start"); } myIsActive = true; } void JBNativeFileWatcher::dispose() { myIsShuttingDown = true; shutdownProcess(); myIsActive = false; } bool JBNativeFileWatcher::isActive() const { return myIsActive.loadRelaxed(); } bool JBNativeFileWatcher::isSendingRoots() const { return myIsSendingRoots.loadRelaxed(); } bool JBNativeFileWatcher::isSettingRoots() const { return isOperational() && mySettingRoots.loadRelaxed() > 0; } void JBNativeFileWatcher::setWatchRoots(const QStringList &recursive, const QStringList &flat) { setWatchRootsCore(recursive, flat, false); } void JBNativeFileWatcher::waitForRootsSet() { while (isSettingRoots()) { qApp->processEvents(); } } bool JBNativeFileWatcher::startupProcess(bool restart) { if (myIsShuttingDown.loadRelaxed()) { return true; } if (myStartAttemptCount++ > MAX_PROCESS_LAUNCH_ATTEMPT_COUNT) { notifyOnFailure("watcher.bailed.out.10x"); return false; } if (restart && !shutdownProcess()) { return false; } jbDebug() << "[Watcher] Starting file watcher:" << myExecutable; if (!startProcess(myExecutable)) { return false; } if (restart) { if (!myRecursiveWatchRoots.isEmpty() || !myFlatWatchRoots.isEmpty()) { jbDebug() << "[Watcher] Restart watcher and set paths again"; setWatchRootsCore(myRecursiveWatchRoots, myFlatWatchRoots, true); } } return true; } bool JBNativeFileWatcher::shutdownProcess() { if (myProcess->state() == QProcess::Running) { if (!writeLine(EXIT_COMMAND)) { return false; } if (!myProcess->waitForFinished(500)) { jbWarning() << "[Watcher] File watcher is still alive, doing a force quit."; if (!killProcess()) { notifyOnFailure("watcher.failed.to.shut"); return false; } } } return true; } void JBNativeFileWatcher::setWatchRootsCore(QStringList recursive, QStringList flat, bool restart) { if (!restart && myRecursiveWatchRoots == recursive && myFlatWatchRoots == flat) { myNotificationSink->notifyManualWatchRoots(this, myIgnoredRoots); return; } mySettingRoots++; myRecursiveWatchRoots = recursive; myFlatWatchRoots = flat; QStringList ignored; if (SystemInfo::isWindows()) { recursive = screenUncRoots(recursive, ignored); flat = screenUncRoots(flat, ignored); } myIgnoredRoots = ignored; myNotificationSink->notifyManualWatchRoots(this, ignored); // Start send comand line myIsSendingRoots = true; bool flag = true; if (writeLine(ROOTS_COMMAND)) { for (auto it = recursive.begin(); it != recursive.end(); ++it) { const QString &path = *it; if (!writeLine(path)) { flag = false; break; } } if (flag) { for (auto it = flat.begin(); it != flat.end(); ++it) { const QString &path = *it; if (!writeLine('|' + path)) { flag = false; break; } } } } if (flag) { flag &= writeLine("#"); } if (!flag) { jbWarning() << "[Watcher] Error setting roots."; } // Send command line over myIsSendingRoots = false; } QStringList JBNativeFileWatcher::screenUncRoots(const QStringList &roots, QStringList &ignored) { QStringList filtered; for (auto it = roots.begin(); it != roots.end(); ++it) { const QString &root = *it; if (OSAgnosticPathUtil::isUncPath(root)) { ignored.append(root); } else { filtered.append(root); } } return filtered; } QString JBNativeFileWatcher::executable() const { return FSNotifierExecutable(); } void JBNativeFileWatcher::resetChangedPaths() { QMutexLocker locker(myLastChangedPathsLock.data()); myLastChangedPathIndex = 0; myLastChangedPaths[0] = ""; myLastChangedPaths[1] = ""; } bool JBNativeFileWatcher::isRepetition(const QString &path) { QMutexLocker locker(myLastChangedPathsLock.data()); const int length = myLastChangedPaths.size(); for (int i = 0; i < length; ++i) { int last = myLastChangedPathIndex - i - 1; if (last < 0) { last += length; } const QString &lastChangedPath = myLastChangedPaths[last]; if (!lastChangedPath.isEmpty() && !lastChangedPath.compare(path)) { return true; } } myLastChangedPaths[myLastChangedPathIndex++] = path; if (myLastChangedPathIndex == length) { myLastChangedPathIndex = 0; } return false; } void JBNativeFileWatcher::notifyProcessTerminated(int exitCode, QProcess::ExitStatus exitStatus) { Q_UNUSED(exitStatus) jbDebug() << "[Watcher] Watcher terminated with exit code" << exitCode; if (!startupProcess(true)) { shutdownProcess(); jbWarning() << "[Watcher] Watcher terminated and attempt to restart has failed. Exiting " "watching thread."; } } void JBNativeFileWatcher::notifyTextAvailable(const QString &line, QProcess::ProcessChannel channel) { if (channel == QProcess::StandardError) { jbWarning() << line; return; } if (myLastOp == WatcherOp::UNKNOWN) { WatcherOp watcherOp = StringToWatcherOp(line); if (watcherOp == WatcherOp::UNKNOWN) { jbWarning().noquote() << "[Watcher] Illegal watcher command: \'" + line + "\'"; return; } if (watcherOp == WatcherOp::GIVEUP) { jbDebug() << "[Watcher] Output: GiveUp"; notifyOnFailure("watcher.gave.up"); myIsShuttingDown = true; } else if (watcherOp == WatcherOp::RESET) { jbDebug() << "[Watcher] Output: Reset"; myNotificationSink->notifyReset(""); } else { myLastOp = watcherOp; } } else if (myLastOp == WatcherOp::MESSAGE) { notifyOnFailure(MessageToFailureReasonString(line)); myLastOp = WatcherOp::UNKNOWN; } else if (myLastOp == WatcherOp::REMAP || myLastOp == WatcherOp::UNWATCHEABLE) { if (line == '#') { if (myLastOp == WatcherOp::REMAP) { jbDebug() << "[Watcher] Output: Remap"; processRemap(); } else { jbDebug() << "[Watcher] Output: Unwatchable"; mySettingRoots--; processUnwatchable(); } myLines.clear(); myLastOp = WatcherOp::UNKNOWN; } else { myLines.append(line); } } else { QString path = line.simplified(); processChange(path, myLastOp); myLastOp = WatcherOp::UNKNOWN; } } void JBNativeFileWatcher::notifyErrorOccured(QProcess::ProcessError error) { Q_UNUSED(error) } void JBNativeFileWatcher::notifyOnFailure(const QString &reason) { myNotificationSink->notifyUserOnFailure(reason); } void JBNativeFileWatcher::processRemap() { QList<QPair<QString, QString>> map; for (int i = 0; i < myLines.size() - 1; i += 2) { map.append({myLines.at(i), myLines.at(i + 1)}); } myNotificationSink->notifyMapping(map); } void JBNativeFileWatcher::processUnwatchable() { myIgnoredRoots.append(myLines); myNotificationSink->notifyManualWatchRoots(this, myLines); } void JBNativeFileWatcher::processChange(const QString &path, WatcherOp op) { if (SystemInfo::isWindows()) { if (op == WatcherOp::RECDIRTY) { myNotificationSink->notifyReset(path); return; } } if ((op == WatcherOp::CHANGE || op == WatcherOp::STATS) && isRepetition(path)) { return; } if (SystemInfo::isMac()) { // path = Normalizer.normalize(path, Normalizer.Form.NFC); } switch (op) { case WatcherOp::STATS: case WatcherOp::CHANGE: myNotificationSink->notifyDirtyPath(path); break; case WatcherOp::CREATE: case WatcherOp::DELETE: myNotificationSink->notifyPathCreatedOrDeleted(path); break; case WatcherOp::DIRTY: myNotificationSink->notifyDirtyDirectory(path); break; case WatcherOp::RECDIRTY: myNotificationSink->notifyDirtyPathRecursive(path); break; default: jbWarning() << "[Watcher] Unexpected op:" << WatcherOpToString(op); } } QString JBNativeFileWatcher::fsnotifier_path = #ifdef Q_OS_WINDOWS "fsnotifier.exe" #else "fsnotifier" #endif ; QString JBNativeFileWatcher::FSNotifierExecutable() { return fsnotifier_path; } void JBNativeFileWatcher::setFsNotifierExecutablePath(const QString &path) { fsnotifier_path = path; }
28.113573
100
0.618288
SineStriker
077af8d955f545651c664c4e7b9b225c939c8323
385
cpp
C++
tree/priority_queue/heap_sort/heapSort.cpp
vectordb-io/vstl
1cd35add1a28cc1bcac560629b4a49495fe2b065
[ "Apache-2.0" ]
null
null
null
tree/priority_queue/heap_sort/heapSort.cpp
vectordb-io/vstl
1cd35add1a28cc1bcac560629b4a49495fe2b065
[ "Apache-2.0" ]
null
null
null
tree/priority_queue/heap_sort/heapSort.cpp
vectordb-io/vstl
1cd35add1a28cc1bcac560629b4a49495fe2b065
[ "Apache-2.0" ]
null
null
null
// test heap sort #include <iostream> #include <algorithm> #include "heapSort.h" using namespace std; int main(void) { int a[11], i, n = 10; // initialize descending data for (i = 1; i <= 10; i++) a[i] = n - i + 1; heapSort(a, 10); // output sorted data copy(a, a+n, ostream_iterator<int>(cout, " ")); cout << endl; return 0; }
16.73913
51
0.537662
vectordb-io
077bc8525a993f66fe619826094b26f7a432f4cc
544
hpp
C++
LevelManager.hpp
HyruleExplorer/FORGE
95b29e9f810d901efa7e904e2ceed9936cef2a11
[ "Zlib" ]
null
null
null
LevelManager.hpp
HyruleExplorer/FORGE
95b29e9f810d901efa7e904e2ceed9936cef2a11
[ "Zlib" ]
null
null
null
LevelManager.hpp
HyruleExplorer/FORGE
95b29e9f810d901efa7e904e2ceed9936cef2a11
[ "Zlib" ]
null
null
null
#ifndef LEVEL_MANAGER_HPP #define LEVEL_MANAGER_HPP #include "SFML/Graphics.hpp" #include "Level_1.hpp" #include "Level_2.hpp" class LevelManager { public: LevelManager(); ~LevelManager(); void run(); void ignite( Level& level ); void update( Level& level ); private: Level mMenu; Level_1 level_1; Level_2 level_2; sf::Color mAgeColor; std::string filename; //std::string name; //std::map<std::string,Level>::const_iterator result; }; #endif // LEVEL_MANAGER_HPP
18.758621
58
0.641544
HyruleExplorer
077cf772881551e212f9eda07607dc866bcf9d51
271
cpp
C++
window_gerenciar.cpp
hun251/Fastmarket
2b759bf08bd0ff7872b09ffc74af272fbb0b3ae7
[ "Apache-2.0" ]
1
2021-04-23T16:13:55.000Z
2021-04-23T16:13:55.000Z
window_gerenciar.cpp
hun251/Fastmarket
2b759bf08bd0ff7872b09ffc74af272fbb0b3ae7
[ "Apache-2.0" ]
2
2021-05-03T21:02:42.000Z
2021-06-08T17:18:23.000Z
window_gerenciar.cpp
hun251/Fastmarket
2b759bf08bd0ff7872b09ffc74af272fbb0b3ae7
[ "Apache-2.0" ]
null
null
null
#include "window_gerenciar.h" #include "ui_window_gerenciar.h" window_gerenciar::window_gerenciar(QWidget *parent) : QDialog(parent), ui(new Ui::window_gerenciar) { ui->setupUi(this); } window_gerenciar::~window_gerenciar() { delete ui; }
18.066667
54
0.682657
hun251
077ea6bf2d9e4761a945e18c6f1dc7381ef48fd2
6,020
cpp
C++
example/27.pid/3.AutoTune.cpp
eboxmaker/eboxFramework-rtt
9718678422f56faec1cf21a6a8fd3f72441bea33
[ "MIT" ]
115
2018-08-12T08:41:17.000Z
2022-03-08T07:43:48.000Z
example/27.pid/3.AutoTune.cpp
eboxmaker/eboxFramework-rtt
9718678422f56faec1cf21a6a8fd3f72441bea33
[ "MIT" ]
4
2018-08-13T10:14:55.000Z
2019-07-03T06:54:10.000Z
example/27.pid/3.AutoTune.cpp
eboxmaker/eboxFramework-rtt
9718678422f56faec1cf21a6a8fd3f72441bea33
[ "MIT" ]
59
2018-09-02T21:54:25.000Z
2022-01-13T02:28:28.000Z
/** ****************************************************************************** * @file pwm.cpp * @author shentq * @version V2.0 * @date 2016/08/14 * @brief ebox application example . ****************************************************************************** * @attention * * No part of this software may be used for any commercial activities by any form * or means, without the prior written consent of shentq. This specification is * preliminary and is subject to change at any time without notice. shentq assumes * no responsibility for any errors contained herein. * <h2><center>&copy; Copyright 2015 shentq. All Rights Reserved.</center></h2> ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "ebox.h" #include "math.h" #include "ebox_encoder.h" #include "pid_v1.h" #include "PID_AutoTune_v0.h" void AutoTuneHelper(bool start); void changeAutoTune(); void SerialSend(); void SerialReceive(); void DoModel(); uint8_t ATuneModeRemember = 2; //Define Variables we'll be connecting to double Setpoint, Input, Output; //Specify the links and initial tuning parameters double Kp = 20, Ki = 1200, Kd = 0.01; double kpmodel = 1.5, taup = 100, theta[50]; double outputStart = 5; double aTuneStep = 50, aTuneNoise = 1, aTuneStartValue = 100; unsigned int aTuneLookBack = 20; //set to false to connect to the real world bool useSimulation = true; bool tuning = false; unsigned long modelTime, serialTime; PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, P_ON_E, DIRECT); PID_ATune aTune(&Input, &Output); Encoder encoder(TIM4, &PB6, &PB7); float x; uint16_t y; Pwm pwm1(&PA0); void setup() { ebox_init(); uart1.begin(115200); encoder.begin(3); pwm1.begin(2000, 0000); pwm1.set_oc_polarity(1);//set output polarity after compare uart1.printf("max frq = %dKhz\r\n", pwm1.get_max_frq() / 1000); uart1.printf("max frq = %f\r\n", pwm1.get_accuracy()); if(useSimulation) { for(uint8_t i = 0; i < 50; i++) { theta[i] = outputStart; } modelTime = 0; } //initialize the variables we're linked to Input = 0; Setpoint = 35.5; //turn the PID on myPID.SetMode(AUTOMATIC); if(tuning) { tuning = false; changeAutoTune(); tuning = true; } serialTime = 0; } int main(void) { static uint64_t last_time = millis(); static uint64_t last_time1 = millis(); static uint64_t now = millis(); setup(); uint16_t temp; float speed; while(1) { if(!useSimulation) { //pull the input in from the real world Input = encoder.read_speed() / 4000; } if(tuning) { uint8_t val = (aTune.Runtime()); if (val != 0) { tuning = false; } if(!tuning) { //we're done, set the tuning parameters Kp = aTune.GetKp(); Ki = aTune.GetKi(); Kd = aTune.GetKd(); myPID.SetTunings(Kp, Ki, Kd); AutoTuneHelper(false); } } else myPID.Compute(); if(useSimulation) { uart1.printf("%0.2f\t%0.2f\r\n", Input, Output); theta[30] = Output; if(now >= modelTime) { modelTime += 100; DoModel(); } } else { pwm1.set_duty(0); } //send-receive with processing if it's time if(millis() > serialTime) { // SerialReceive(); // SerialSend(); serialTime += 500; } // if(millis() - last_time > 5) // { // last_time = millis(); // Input = encoder.read_speed()/4000; // pwm1.set_duty(Output); // uart1.printf("%0.2f\t%0.2f\r\n",Input,Output); // } // myPID.Compute(); // if(millis() - last_time1 > 10) // { // last_time1 = millis(); // uart1.printf("%0.2f\t%0.2f\r\n",Input,Output); // } } } void changeAutoTune() { if(!tuning) { //Set the output to the desired starting frequency. Output = aTuneStartValue; aTune.SetNoiseBand(aTuneNoise); aTune.SetOutputStep(aTuneStep); aTune.SetLookbackSec((int)aTuneLookBack); AutoTuneHelper(true); tuning = true; } else { //cancel autotune aTune.Cancel(); tuning = false; AutoTuneHelper(false); } } void AutoTuneHelper(bool start) { if(start) ATuneModeRemember = myPID.GetMode(); else myPID.SetMode(ATuneModeRemember); } void SerialSend() { uart1.print("setpoint: "); uart1.print(Setpoint); uart1.print(" "); uart1.print("input: "); uart1.print(Input); uart1.print(" "); uart1.print("output: "); uart1.print(Output); uart1.print(" "); if(tuning) { uart1.println("tuning mode"); } else { uart1.print("kp: "); uart1.print(myPID.GetKp()); uart1.print(" "); uart1.print("ki: "); uart1.print(myPID.GetKi()); uart1.print(" "); uart1.print("kd: "); uart1.print(myPID.GetKd()); uart1.println(); } } void SerialReceive() { char b = uart1.read(); if((b == '1' && !tuning) || (b != '1' && tuning)) changeAutoTune(); } void DoModel() { //cycle the dead time for(uint8_t i = 0; i < 49; i++) { theta[i] = theta[i + 1]; } //compute the input Input = (kpmodel / taup) * (theta[0] - outputStart) + Input * (1 - 1 / taup) + ((float)random(-10, 10)) / 100; }
24.471545
114
0.504319
eboxmaker
0785437488fb1a85a75a4654b4cc7a4bb62777c9
1,778
cpp
C++
Visual Studio 2010/Projects/bjarneStroustrupC++PartI/object_oriented_examples/Chapter10Exercise8.cpp
Ziezi/Programming-Principles-and-Practice-Using-C-by-Bjarne-Stroustrup-
6fd64801863e883508f15d16398744405f4f9e34
[ "Unlicense" ]
9
2018-10-24T15:16:47.000Z
2021-12-14T13:53:50.000Z
Visual Studio 2010/Projects/bjarneStroustrupC++PartI/object_oriented_examples/Chapter10Exercise8.cpp
ChrisBKirov/Programming-Principles-and-Practice-Using-C-by-Bjarne-Stroustrup-
6fd64801863e883508f15d16398744405f4f9e34
[ "Unlicense" ]
null
null
null
Visual Studio 2010/Projects/bjarneStroustrupC++PartI/object_oriented_examples/Chapter10Exercise8.cpp
ChrisBKirov/Programming-Principles-and-Practice-Using-C-by-Bjarne-Stroustrup-
6fd64801863e883508f15d16398744405f4f9e34
[ "Unlicense" ]
7
2018-10-29T15:30:37.000Z
2021-01-18T15:15:09.000Z
/* TITLE Concatenate two files Chapter10Exercise8.cpp Bjarne Stroustrup "Programming: Principles and Practice Using C++" COMMENT Objective: Create a file that contains the concatenated data of two other files. Input: - Output: - Author: Chris B. Kirov Date: 03.05.2015 */ #include <iostream> #include <fstream> #include <string> #include"Chapter10Exercise8.h" void test_function(); //========================================================================================== int main() { try { test_function(); } catch(std::exception& e) { std::cerr<< e.what() << std::endl; } } //========================================================================================== /* Function: test_function() */ void test_function() { std::string source_file_name1 = "Chapter10Exercise8File1.txt"; std::string source_file_name2 = "Chapter10Exercise8File2.txt"; std::string destination_file_name = "Chapter10Exercise8Conc.txt"; // print contents of source files std::ifstream ifs1(source_file_name1.c_str()); if(!ifs1) { std::cerr <<"Can't open input file: "<< source_file_name1 <<'\n'; } std::cout <<"Source file 1 contains:\n" << ifs1.rdbuf() <<'\n'; std::ifstream ifs2(source_file_name2.c_str()); if(!ifs1) { std::cerr <<"Can't open input file: "<< source_file_name2 <<'\n'; } std::cout <<"Source file 2 contains:\n" << ifs2.rdbuf() <<'\n'; // concatenate concatenate_two_files(source_file_name1, source_file_name2, destination_file_name); // print contents of destination file std::ifstream ifs3(destination_file_name.c_str()); if(!ifs1) { std::cerr <<"Can't open input file: "<< destination_file_name <<'\n'; } std::cout <<"Destination file contains:\n" << ifs3.rdbuf() <<'\n'; }
23.706667
92
0.604612
Ziezi
0788c566aaad9ecea5d43057eaa253fdfdcb1412
15,025
hpp
C++
client/client/src/proj/ap_type2s.hpp
oracleloyall/CommonLib
f2a092ab1b87f45cfd4470b9a87f5fd658e2d7da
[ "Apache-2.0" ]
3
2019-07-03T03:16:39.000Z
2019-12-02T08:08:43.000Z
client/client/src/proj/ap_type2s.hpp
oracleloyall/CommonLib
f2a092ab1b87f45cfd4470b9a87f5fd658e2d7da
[ "Apache-2.0" ]
null
null
null
client/client/src/proj/ap_type2s.hpp
oracleloyall/CommonLib
f2a092ab1b87f45cfd4470b9a87f5fd658e2d7da
[ "Apache-2.0" ]
null
null
null
/* * ap_type2s.hpp * * Created on: 2015骞�6鏈�17鏃� * Author: sw */ #ifndef PROJ_AP_TYPE2S_HPP_ #define PROJ_AP_TYPE2S_HPP_ #include "../hlib/global.hpp" typedef unsigned char __u8; typedef unsigned short __u16; typedef unsigned int __u32; typedef unsigned long long __u64; const __u16 H_PROTO_LOGO = 29559; // sw const __u16 H_PROTO_UDP = 30000; const __u8 H_PROTO_VER = 1; const __u8 H_PROTO_NEO_VER = 2; // !!NOTICE: 鐗堟湰v2 [鏂癩 const __u16 H_PROTO_MAX_LEN = 4096; const __u16 H_LENGTH_NEED_ZIP = 500; // 濡傛棤鐗规畩绾﹀畾锛岃秴杩囨闀垮害鑷姩鍘嬬缉 typedef __u8 msg_head_flag; const msg_head_flag mhf_NONE = 0; const msg_head_flag mhf_GZIP = 1; const msg_head_flag mhf_ENCRYPT = 2; const msg_head_flag mhf_ACK_REQED = 4; const msg_head_flag mhf_NOT_END = 8; const msg_head_flag mhf_ACK = 16; typedef __u16 msg_cmd_type; // 鐗堟湰v2 const msg_cmd_type msg_cmd_unknown = 0; // const msg_cmd_type msg_cmd_conn_req2 = 1;// FatAP鍙戣捣锛氳繛鎺ヨ璇侊紝瀵瑰簲struct ap_conn_req; const msg_cmd_type msg_cmd_conn_resp2 = 2; // 绠$悊鏈嶅姟鍣ㄨ繑鍥烇細鍒濆鍖栦俊鎭紝瀵瑰簲 struct ap_conn_resp; const msg_cmd_type msg_cmd_ap_stat2 = 3; // FatAP鍙戝嚭锛欶atAP蹇冭烦锛屽搴� struct ap_stat; const msg_cmd_type msg_cmd_ap_dns_white2 = 4; // 绠$悊鏈嶅姟鍣ㄨ姹侳atAP淇敼鐧藉悕鍗�, 瀵瑰簲 struct ap_dns_white; const msg_cmd_type msg_cmd_ap_dev_conf2 = 5; // 绠$悊鏈嶅姟鍣ㄨ姹侳atAP淇敼閰嶇疆, 瀵瑰簲 struct ap_conf; const msg_cmd_type msg_cmd_ap_net_conf2 = 6; // 绠$悊鏈嶅姟鍣ㄨ姹侳atAP淇敼鐨勭綉缁滈厤缃紝瀵瑰簲ap_net_conf2 const msg_cmd_type msg_cmd_ap_upgrade2 = 7; // 璁剧疆FatAP鍗囩骇, 瀵瑰簲 struct ap_upgrade const msg_cmd_type msg_cmd_user_stat2 = 8; // 鍙屾柟鍧囧彲鍙戝嚭锛氱鐞嗘湇鍔″櫒鍙戝嚭鍒欎慨鏀圭敤鎴蜂俊鎭� 锛孎atAP鍙戝嚭閫氬憡鐩墠鐘跺喌(涓婁笅绾裤�佸叾鍚庣殑蹇冭烦) 锛屽搴� struct user_stat; const msg_cmd_type msg_cmd_user_action2 = 9; // FatAP鍙戝嚭锛氱敤鎴风殑鎿嶄綔锛屽搴攕truct user_action; const msg_cmd_type msg_cmd_link_detection = 10; // 閾捐矾妫�娴嬪懡浠� const msg_cmd_type msg_cmd_ack2 = 11; /* 鍥炲簲瀵规柟鐗瑰畾seq宸茬粡澶勭悊锛屾棤鍖呬綋銆� 鍥炲簲鍗曚竴鐨勫寘鎺ユ敹锛宻eq娌跨敤瀵规柟seq銆俵en缃负0. 鍥炲簲杩炵画澶氫釜鍖呮帴鏀讹紝seq缃负鍥炲簲鐨勯涓猻eq锛屼竴鐩村埌seq+len 鍚屾椂缁欏畾鐩墠灏氭湭鎺ユ敹鐨勯娈祍eq鍦╟rc32c */ const msg_cmd_type msg_cmd_conn_heartbeat2 = 12; // 鍗忚鏂瑰鏀寔UDP锛屽簲瀹氭椂鍙戯紝鏃犻渶鍥炲簲 const msg_cmd_type msg_cmd_black_list2 = 13; // 绠$悊鏈嶅姟鍣ㄨ姹侳atAP淇敼榛戝悕鍗�,瀵瑰簲鐨剆truct ap_dns_black const msg_cmd_type msg_cmd_reboot2 = 14; // 绠$悊鏈嶅姟鍣ㄨ姹侳atAP閲嶆柊鍚姩 // const msg_cmd_type msg_cmd_ap_auth = 50; // 璁惧娉ㄥ唽鍛戒护(閫氳鍗忚閲囩敤udp鏂瑰紡) const msg_cmd_type msg_cmd_max = 255; typedef struct msg_head2 { __u16 logo; /*鏍囧織锛宻w = smartwifi */ __u8 ver; /*鐗堟湰锛屽垵濮嬩负2 */ msg_head_flag flag;/*鎵╁睍鏍囪瘑锛� 浣�1浣嶄负1琛ㄧず鍖呬綋宸插仛 gzip 浣�2浣嶄负1琛ㄧず鍖呬綋宸插姞瀵嗭紙鏆傛椂鏈鐞嗗姞瀵嗭級 浣�3浣嶄负1琛ㄧず璇ュ寘闇�瑕佺瓑寰呭搴旂殑seq鐨勬帴鏀跺洖搴旓紙UDP蹇呴』缃�1锛� 浣�4浣嶄负1琛ㄧず鍖呬綋灏氭湭瀹岀粨锛屽彂閫佹柟宸茶嚜鍔ㄥ垏鍒嗚秴闀挎暟鎹寘銆傛帴鏀惰繛缁�掑seq锛岀洿鍒版煇涓寘flag璇ヤ綅涓�0鏃讹紝姝ゅ寘浣撴柟瀹岀粨銆� 浣�5浣嶄负1琛ㄧずack鍛戒护鍥炴姤鐨剆eq鍜宻eq浠ュ墠鐨勫潎宸叉敹鍒帮紙鍙湪ack鍛戒护鏃舵湁鏁堬級 */ msg_cmd_type cmd;/*鐢ㄤ簬鏍囪瘑鍖呬綋鍛戒护绫诲瀷锛屽彇鍊艰enum msg_cmd_type*/ __u16 len; /*鍚庢帴鏁版嵁鍖呬綋鐨勯暱搴�*/ __u32 crc32c; /*鍖呬綋鏍¢獙鍜岋紝浣跨敤SSE4.2鐨勬爣鍑嗐�傚鍖呬綋 绯籫zip澶勭悊鍚庣粨鏋滐紝姝ゆ暟鍊间负瀵筭zip缁撴灉鐨勮绠楀�� 銆� 濡傛灉cmd涓篴ck锛屽垯姝ゅ瓧娈佃〃绀烘湡鏈涘彂閫佺殑绗竴娈电殑seq*/ __u32 seq; /*鍛戒护娴佹按銆傝捣濮嬪�间负0锛屽叾鍚庤嚜鐒跺闀裤�傜敤浜庤瘑鍒摢浜涜姹傚凡缁忚鍥炲簲锛岄伩鍏嶉噸澶嶅鐞嗭紱浠ュ強涓撻棬閫氱煡鐗瑰畾seq宸茬粡澶勭悊*/ } *pmsg_head2; const int H_HEAD_LEN2 = sizeof(msg_head2); typedef __u16 mi_type; const mi_type mi_unknown = 0; const mi_type mi_h3c = 1; const mi_type mi_huawei = 2; const mi_type mi_threenet = 3; const mi_type mi_zdc = 4; const mi_type mi_raisecom = 5; const mi_type mi_wisechoice = 6; const mi_type mi_commsky = 7; const mi_type mi_ewifi = 255; const mi_type mi_telin_daemon = 65535; typedef __u8 UDIC_type; /* Unique device identification code */ const UDIC_type UDIC_unknown = 0; /* 杩樹负鑾峰彇璁惧鍞竴鏍囪瘑鐮� */ typedef struct ap_conn_req2 { __u32 ap_time; /* FatAP鏃堕棿 */ __u32 soft_id; /* 璁惧杞欢鍨嬪彿 65535*/ __u32 hard_id; /* 璁惧纭欢鍨嬪彿 0 */ __u32 ability; /* 璁惧鑳藉姏鎻忚堪锛� __u8 hard_seq[64]; /*璁惧搴忓垪鍙�*/ __u8 ip[16]; /* ipv4 绌轰綑鍚庨潰12涓瓧鑺� */ __u8 mac[6]; __u16 reserved; /* */ mi_type manu_id; /*鍘傚晢浠g爜*/ UDIC_type udic[12]; /*璁惧鍞竴鏍囪瘑鐮�*/ __u8 dev_id[16]; } *pap_conn_req2; typedef struct ap_auth { bool if_test; // true琛ㄧず鐢ㄤ簬娴嬭瘯娉ㄥ唽姝ラ __u16 port; // 缃戝叧绔彛 __u8 gw_mac[6]; // 缃戝叧MAC __u8 gw_ip[16]; // 缃戝叧鐨刬p __u8 accout_id[20]; // 璐︽埛 __u8 passwd[20]; // 璐﹀彿瀵嗙爜 __u8 soft_ver[20]; // 鐗堟湰 __u8 seq[20]; // 涓插彿 } *pap_auth; typedef struct ap_auth_sp { __u8 devid[16]; // 璁惧ID } *pap_auth_sp; typedef __u16 udp_type; typedef struct UDP_Msg { udp_type type; union { ap_auth ap_reg; ap_auth_sp ap_req_resp; }data; } *pUDP_Msg; const int AP_AUTH_LEN = sizeof(UDP_Msg); typedef __u8 cs_type; const cs_type cs_unknown = 0; const cs_type cs_telecom = 1; const cs_type cs_cinema = 2; const cs_type cs_supermarket = 3; const cs_type cs_goverment = 4; const cs_type cs_mall = 5; const cs_type cs_cafe = 6; const cs_type cs_bar = 7; const cs_type cs_college = 8; const cs_type cs_test = 254; const cs_type cs_max = 255; typedef __u8 ap_conn_ret; const ap_conn_ret acr_OK = 0; const ap_conn_ret acr_DENIED = 1; const ap_conn_ret acr_REDIRECT = 2; typedef __u8 ap_auth_mode; const ap_auth_mode aam_PASS = 0; const ap_auth_mode aam_AUTH = 1; typedef __u8 ap_audit_mode; const ap_audit_mode aam_NONE = 0; const ap_audit_mode aam_AUDIT = 1; typedef struct ap_conn_resp2 { ap_conn_ret result; /* 璁よ瘉缁撴灉锛�0=閫氳繃锛�1=鎷掔粷锛寃hite涓哄鍚戝湴鍧�锛�2=瑕佹眰杞叾浠栫鐞嗘湇鍔″櫒锛� 搴旇浆鎺uth_srv涓潪璇ョ鐞嗘湇鍔″櫒鐨勫叾浠栨湇鍔″櫒 */ ap_auth_mode auth_mode; /* 缁堢璁よ瘉妯″紡锛�0=鐩存帴鏀捐锛�1=瑕佹眰璁よ瘉 */ ap_audit_mode audit_mode; /* 瀹¤妯″紡锛�0=涓嶄紶鐢ㄦ埛璁块棶鐨刄RL锛�1=鍥炰紶鐢ㄦ埛璁块棶鐨刄RL */ cs_type serv_type; /* 鍦烘墍绫诲瀷锛屽彇鍊煎弬鑰僥num cs_type锛� 濡傦紝閰掑簵銆佽嵂搴椼�佸皬鍖虹瓑绛� */ UDIC_type udic; /* 璁惧鍞竴琛ㄧず鐮� */ __u16 reserved1; /* 鏈�澶т紶杈撳崟鍏� */ __u16 ap_interval; /* FatAP涓庣鐞嗘湇鍔″櫒闂寸殑蹇冭烦鏃堕棿锛屽崟浣嶇锛岄粯璁や负60绉� */ __u16 user_interval; /* 缁堢鐢ㄦ埛姹囨姤鐨勫績璺虫椂闂达紝鍗曚綅绉掞紝榛樿涓�60绉� */ __u16 audit_interval; /* 鐢ㄦ埛琛屼负姹囨姤锛屽崟浣嶇锛岄粯璁や负60绉� */ __u8 auth_srv[64]; /* 绠$悊鏈嶅姟鍣ㄥ湴鍧�锛屾瘮濡�: www.auth_srv.com:8080, 0d鍒嗗壊锛岀浜屼釜鍙婁互鍚庝负beiyong */ __u8 audit_srv[64]; /* 瀹¤鏈嶅姟鍣紝鐩墠鏆傛椂淇濈暀涓嶇敤锛�0d鍒嗗壊锛�*/ __u8 def_302[128]; /* 榛樿璺宠浆鍦板潃锛屽湪struct user_stat 涓病鏈夋寚瀹氳烦杞湴鍧�鏃朵娇鐢� */ __u16 white_len; /* 鍩熷悕榛戠櫧鍚嶅崟闀垮害 鏈�闀夸负65535 */ __u16 black_len; /* 鍩熷悕榛戝悕鍗曢暱搴� 鏈�闀夸负65535 */ __u8 white[0]; /* 鍩熷悕鐧藉悕鍗曪紝鍩熷悕闂翠互鍒嗗彿鍒嗛殧 */ __u8 black[0]; /* 鍩熷悕榛戝悕鍗曪紝鍩熷悕闂翠互鍒嗗彿鍒嗛殧 */ } *pap_conn_resp2; typedef __u8 user_stat_type; // 鐢ㄦ埛鐘舵�� const user_stat_type user_unknown = 0; const user_stat_type user_on = 1; // 鐢ㄦ埛宸蹭笂绾挎湭鏀捐 const user_stat_type user_pass = 2; // 鐢ㄦ埛宸叉斁琛� const user_stat_type user_off = 3; // 鐢ㄦ埛宸蹭笅绾� const user_stat_type user_max = 255; typedef struct user_stat2 { user_stat_type stat;// __u8 __u8 url_len; // 瀵瑰簲鍖呯殑缁撳熬鏈夊闀縐RL __u8 mac[6]; __u8 user_ip[16]; // IPv4鏃跺悗闈�12瀛楄妭鐣�0 __u64 incoming; // 涓嬭娴侀噺璁℃暟锛屽崟浣嶄负瀛楄妭 __u64 outgoing; // 涓婅娴侀噺璁℃暟锛屽崟浣嶄负瀛楄妭 __u64 ibw_limit; // 涓嬭甯﹀闄愬埗锛屽崟浣嶄负瀛楄妭锛�-1琛ㄧず涓嶉檺 __u64 obw_limit; // 涓婅甯﹀闄愬埗锛屽崟浣嶄负瀛楄妭锛�-1琛ㄧず涓嶉檺 __u32 online_date; // unix鏃堕棿鎴筹紝0琛ㄧず鏃犺褰� __u32 offline_date; // unix鏃堕棿鎴筹紝0琛ㄧず鏃犺褰� __u32 duration; // 宸茬粡涓婄嚎鏃堕棿锛屽崟浣嶄负绉掞紝鐘舵�佹敼鍙橈紙涓婄嚎/鏀捐/韪㈠嚭锛夋椂褰�0 __u16 ses_limit; // tcp session 闄愬埗锛�0=涓嶉檺 __u16 udp_limit; // udp session 闄愬埗锛�0=涓嶉檺 __u8 url_data[0]; // URL鏁版嵁,缁堢璁よ瘉鎴愬姛鍚庨渶瑕佽烦杞殑椤甸潰銆傝嫢涓嶅瓨鍦紝鍒欎娇鐢ㄩ粯璁よ烦杞〉闈� } *puser_stat2; typedef __u8 wlan_visiblity; const wlan_visiblity wv_broadcast = 0; const wlan_visiblity wv_hidden = 1; typedef __u8 wlan_enable; const wlan_enable we_enable = 1; const wlan_enable we_disable = 0; typedef __u8 wlan_ssid_encoding; const wlan_ssid_encoding wse_gb2312 = 0; // for PC const wlan_ssid_encoding wse_utf8 = 1; // for Phone typedef __u8 wlan_type; const wlan_type wt_unknown = 0; const wlan_type wt_b = 1; const wlan_type wt_g = 2; const wlan_type wt_n = 4; const wlan_type wt_a = 8; const wlan_type wt_bg = 3; const wlan_type wt_bgn = 7; const wlan_type wt_abgn = 15; #define DEL_WLAN 0x80 typedef struct wlan_entity2 { __u8 wlan_ssid_len; __u8 wlan_ssid[255]; __u8 wlan_index; // 绱㈠紩锛岀敤浜庢棩鍚庢搷浣� 鏈�楂樹綅缃�1锛岃〃绀哄垹闄ょ浉搴攚lan wlan_visiblity wlan_hidden; // 1=hidden,0=broadcast wlan_enable wlan_enabled; // 1=enable,0=disable wlan_ssid_encoding wlan_utf8; // 1=utf8,0=gbk ap_auth_mode auth_mode; // 缁堢璁よ瘉妯″紡锛�0=鐩存帴鏀捐锛�1=瑕佹眰璁よ瘉 __u8 encrtpt_mode; // 鍔犲瘑绠楁硶 0=涓嶅姞瀵� 1=AES 2=TKIP __u8 wlan_txpower; // : 4 __u8 wlan_channel; __u8 wlan_channel2; // 0=鏈睍棰� __u8 session_limit; // 鎺ュ叆缁堢鏁伴噺闄愬埗 wlan_type dev_type; // abgn = 15 __u8 wlan_vlan; // : 8 wlan_enable dhcp_enabled; // 1=enable,0=disable __u8 sofe_mode; // 0=unkown 1=NO,2=WEp 3=WPA __u8 secret_key[20]; // 鏅�歸ifi妯″紡涓�,闇�瑕佽緭鍏ョ殑瀵嗙爜 __u8 dhcp_start[16]; // DHCP 璧峰IP鍦板潃 __u8 dhcp_end[16]; // DHCP 缁堟IP鍦板潃 __u8 wlan_ip[16]; // __u16 white_len; // 鍚庨殢鐧藉悕鍗曢暱搴� __u16 black_len; // 鍚庨殢榛戝悕鍗曢暱搴� __u8 whitelist[0]; __u8 blacklist[0]; } *pwlan_entity2; typedef __u8 wan_stat; const wan_stat ws_unknown = 0; const wan_stat ws_connecting = 1; const wan_stat ws_connected = 2; const wan_stat ws_disabled = 3; typedef __u8 wan_mode; const wan_mode wm_unknown = 0; const wan_mode wm_PPPoE = 1; const wan_mode wm_DHCP = 2; const wan_mode wm_static = 3; typedef struct wan_entity2 { __u8 wan_index; wan_stat wan_status; // 1=enable,0=disable __u8 wan_mac[6]; __u8 wan_ip[16]; __u8 wan_gw[16]; __u8 wan_mask[16]; wan_mode conn_mode; // 0=unknown,1=PPPoE,2=DHCP,3=static : 0 wlan_enable auto_dns; // 0=disabled,1=enabled __u8 dns_mode; // 1=鑷姩鑾峰彇,0=鎵嬪姩鑾峰彇 __u16 wan_mtu; __u32 reserved; __u8 host_len; __u8 host[31]; __u8 dns_count; // 璁板綍鏈夊灏慸ns鏈嶅姟鍣� __u8 dns[255];// 褰撴湁澶氫釜dns鏈嶅姟鍣ㄦ椂,ip鍦板潃绱у瘑鎺掑垪娌℃湁鍒嗛殧绗�,鍒ゆ柇涓嬩竴涓猧p鏄惁涓�0,鍒ゆ柇dns鍒楄〃鏄惁缁撴潫 __u8 usr_len; // pppoe name __u8 usr[31]; __u8 pswd_len; __u8 pswd[31]; } *pwan_entity2; typedef __u8 vlan_mode; const vlan_mode vm_unknown = 0; const vlan_mode vm_by_port = 1; const vlan_mode vm_by_mac = 2; const vlan_mode vm_by_prot = 3; //鍗忚 const vlan_mode vn_by_ip = 4; typedef union vlan_node { __u16 port; __u8 mac[6]; __u8 prot[8]; } *pvlan_node; #define DEL_VLAN 0x80 typedef struct vlan_entity { __u8 vlan_index; // 鏈�楂樹綅缃�1锛岃〃绀哄垹闄ゅ搴旂殑vlan // 1 0 0 0 0 0 0 2 琛ㄧず鍒犻櫎id涓�2 鐨剉lan ap_auth_mode auth_mode; // 缁堢璁よ瘉妯″紡锛�0=鐩存帴鏀捐锛�1=瑕佹眰璁よ瘉 ap_audit_mode audit_mode; // 瀹¤妯″紡锛�0=涓嶄紶鐢ㄦ埛璁块棶鐨刄RL锛�1=鍥炰紶鐢ㄦ埛璁块棶鐨刄RL vlan_mode dev_mode; // vlan 鍒掑垎渚濇嵁 __u32 vlan_down_bw; // vlan鏁翠綋涓嬭甯﹀,鍗曚綅瀛愯妭 __u32 vlan_up_bw; // vlan鏁翠綋涓婅甯﹀,鍗曚綅瀛愯妭 __u32 sta_down_bw; // 缁堢涓嬭甯﹀,鍗曚綅瀛愯妭 __u32 sta_up_bw; // 缁堢涓婅甯﹀,鍗曚綅瀛愯妭 __u16 biz_ses_limit; // 鍟嗕笟Wifi鏁翠綋tcp session闄愬埗 __u16 biz_udp_limit; // 鍟嗕笟Wifi鏁翠綋udp session闄愬埗 __u8 ip_start[16]; // 鍙湁褰撴寜鐓p鍒掑垎鏃舵墠鏈夋晥 __u8 ip_end[16]; __u16 reserved; __u16 node_len; // vlan_node node[0]; } *pvlan_entity; typedef struct lan_entity { __u8 dhcp_mode; // 1=寮�鍚痙hcp銆�0=鍏抽棴鐨刣hcp __u8 vlan_id; __u16 reserved1; __u32 leasetime; __u8 gw_mac[6]; __u16 reserved2; __u8 dhcp_start[16]; __u8 dhcp_end[16]; __u8 gw_ip[16]; __u8 mask[16]; } *plan_entity; typedef struct ap_stat2 { __u32 free_mem; // 鍙敤鍐呭瓨锛屽崟浣嶄负K __u32 free_storage; // 鍙敤瀛樺偍锛屽崟浣嶄负K __u32 ap_time; // 绯荤粺鏃堕棿 __u32 uptime; // ap鍦ㄧ嚎鏃堕棿锛屽崟浣嶄负绉� __u64 incoming; // 涓嬭鎬绘祦閲忥紝鍗曚綅涓哄瓧鑺� __u64 outgoing; // 涓婅鎬绘祦閲忥紝鍗曚綅涓哄瓧鑺� __u16 cpu; // 鍗曚綅涓轰竾鍒嗕箣涓�(鏁存暟閮ㄥ垎) ap_auth_mode auth_mode; /* 缁堢璁よ瘉妯″紡锛�0=鐩存帴鏀捐锛�1=瑕佹眰璁よ瘉 */ ap_audit_mode audit_mode; /* 瀹¤妯″紡锛�0=涓嶄紶鐢ㄦ埛璁块棶鐨刄RL锛�1=鍥炰紶鐢ㄦ埛璁块棶鐨刄RL */ __u16 online_user; // 褰撳墠鐘跺喌 __u16 authed_user; // 褰撳墠鐘跺喌 __u16 ap_interval; /* FatAP涓庣鐞嗘湇鍔″櫒闂寸殑蹇冭烦鏃堕棿锛屽崟浣嶇锛岄粯璁や负30绉� */ __u16 user_interval; /* 缁堢鐢ㄦ埛姹囨姤鐨勫績璺虫椂闂达紝鍗曚綅绉掞紝榛樿涓�30绉� */ __u16 audit_interval; // 琛屼负涓婃姤闂撮殧 __u16 reserved1; __u32 biz_ibw_limit; // 鍟嗕笟Wifi鏁翠綋涓嬭甯﹀闄愬埗锛屽崟浣嶄负瀛楄妭 __u32 biz_obw_limit; // 鍟嗕笟Wifi鏁翠綋涓婅甯﹀闄愬埗锛屽崟浣嶄负瀛楄妭 __u32 biz_ibw; __u32 biz_obw; __u16 biz_ses_limit; // 鍟嗕笟Wifi鏁翠綋tcp session闄愬埗 __u16 biz_udp_limit; // 鍟嗕笟Wifi鏁翠綋udp session闄愬埗 __u16 biz_ses; __u16 biz_udp; __u16 wlan_count; // 涔嬪悗鏈夊灏憌lan_entity __u16 vlan_count; // 涔嬪悗鏈夊灏憌an_entity __u16 wan_count; // 涔嬪悗鏈夊灏憌an_entity __u16 reserved2; wlan_entity2 wlan[0]; wan_entity2 wan[0]; vlan_entity vlan[0]; } *pap_stat2; enum Ext_Dev_Conf // 瀹氫箟璁惧鎵╁睍鍙互鏀寔閰嶇疆 { no_ext_dev_conf = 0, // 琛ㄧずap_dev_conf2鍚庢病鏈夎窡浠讳綍鎵╁睍閰嶇疆 base_dev_conf = 1, // 琛ㄧずAP涓�浜涘熀纭�閰嶇疆,瀵瑰簲ap_dev_base_conf safe_dev_conf = 2, // }; typedef __u16 dev_conf_type; typedef struct ap_dev_base_conf { __u16 mtu; // 鏈�澶т紶杈撳崟鍏� __u8 hostname[20]; // 淇敼涓绘満鍚� __u8 auth_srv[64];// 绠$悊鏈嶅姟鍣ㄥ湴鍧�锛屾瘮濡�: www.auth_srv.com:8080, 0d鍒嗗壊锛岀浜屼釜鍙婁互鍚庝负beiyong __u8 audit_srv[64]; // 瀹¤鏈嶅姟鍣紝鐩墠鏆傛椂淇濈暀涓嶇敤锛�0d鍒嗗壊锛� __u8 plat_srv[64]; __u8 def_302[128]; // 榛樿璺宠浆鍦板潃锛屽湪struct user_stat 涓病鏈夋寚瀹氳烦杞湴鍧�鏃朵娇鐢� __u16 ap_interval; // FatAP涓庣鐞嗘湇鍔″櫒闂寸殑蹇冭烦鏃堕棿锛屽崟浣嶇锛岄粯璁や负60绉� __u16 user_interval; // 缁堢鐢ㄦ埛姹囨姤鐨勫績璺虫椂闂达紝鍗曚綅绉掞紝榛樿涓�60绉� __u16 audit_interval; // 鐢ㄦ埛琛屼负姹囨姤锛屽崟浣嶇锛岄粯璁や负60绉� __u16 gps_interval; // __u32 biz_ibw_limit; // 鍟嗕笟Wifi鏁翠綋涓嬭甯﹀闄愬埗锛屽崟浣嶄负瀛愯妭 __u32 biz_obw_limit; // 鍟嗕笟Wifi鏁翠綋涓婅甯﹀闄愬埗锛屽崟浣嶄负瀛愯妭 }*pap_dev_base_conf; typedef struct ap_safe_dev_conf { __u8 webaccount[20]; // web绠$悊骞冲彴璐﹀彿 __u8 webpasswd[20]; // web绠$悊骞冲彴瀵嗙爜 __u16 webport; // web绠$悊骞冲彴绔彛 __u8 telnetaccount[20]; // telnet鐧诲綍璐﹀彿 __u8 telnetpasswd[20]; // telnet鐧诲綍瀵嗙爜 __u16 telentport; // telnet绔彛 __u8 pingenable; // 0鍏抽棴ping,1鍏抽棴ping } *pap_safe_dev_conf; typedef struct ap_dev_conf2 { dev_conf_type type; // 琛ㄧず闅忓悗鎵╁睍閰嶇疆绫诲瀷锛堟墍鏈夊彲鎵╁睍閰嶇疆閮藉湪Ext_Dev_Conf锛� __u8 dev_conf[0]; }*pap_dev_conf2; typedef __u16 Conf_Count; typedef struct ap_net_conf2 { Conf_Count lan_count; Conf_Count vlan_count; Conf_Count wan_count; Conf_Count wlan_count; lan_entity lan[0]; vlan_entity vlan[0]; wan_entity2 wan[0]; wlan_entity2 wlan[0]; } *pap_net_conf2; typedef __u16 user_action_type; const user_action_type uatURL = 0; const user_action_type uatTCP = 1; const user_action_type uatUDP = 2; typedef struct user_action_entry { __u32 action_date; user_action_type action; __u16 data_len; __u8 data[0]; } *puser_action_entry; typedef struct user_action2 { __u8 user_ip[16]; __u8 mac[6]; __u16 entry_count; // 鍏跺悗鎵挎帴澶氫釜user_action_entry, 姣忎釜entry澶氶暱鐢卞叾鑷韩鐨刣ata_len鎵�鍐冲畾 user_action_entry uae_list[0]; } *puser_action2; typedef struct ap_dns_white2 { __u8 data[0]; // dns鐧藉悕鍗曟暟鎹紝浠ュ崐瑙掑垎鍙峰垎鍓层�傛敮鎸佸湴鍧�銆佸湴鍧�:绔彛銆佸煙鍚嶃�佸煙鍚�:绔彛銆丮AC鍦板潃 } *pap_dns_white; typedef struct ap_upgrade2 { __u8 url[0]; // 鍗囩骇鍖呯殑url鍦板潃 } *pap_upgrade; typedef struct ap_link_detection { #if 0 __u8 te_ip[16]; // IPv4鏃跺悗闈�12瀛楄妭鐣�0 __u16 transmitted;// 鍙戦�佺殑鍖呮暟 __u16 rececived;// 鎺ュ彈鐨勫寘鏁� __u16 loss;// 涓㈠け鐨勫寘鏁� __u16 time;// 妫�娴嬫椂闂� 锛屽崟浣峬s #endif }*pap_link_detection; typedef struct ap_dns_black { __u8 data[0]; // 榛戝悕鍗� } *pap_dns_black; typedef struct ap_reboot { __u32 time; // 寤惰繜澶氬皯绉掗噸鍚澶� 0绔嬪埢閲嶅惎 } *pap_reboot; typedef struct { __u32 type; __u32 len; // total packet length in bytes __u32 sequence; } HEAD; #endif /* PROJ_AP_TYPE2S_HPP_ */
29.005792
137
0.733511
oracleloyall
078df870ecfa9a50db5dffb2638b40d244a61d42
4,619
cpp
C++
2014/prelim/C.cpp
golmansax/google-code-jam
4486db353b19a5d61512aee8d6350aca75a5ab56
[ "MIT" ]
null
null
null
2014/prelim/C.cpp
golmansax/google-code-jam
4486db353b19a5d61512aee8d6350aca75a5ab56
[ "MIT" ]
null
null
null
2014/prelim/C.cpp
golmansax/google-code-jam
4486db353b19a5d61512aee8d6350aca75a5ab56
[ "MIT" ]
null
null
null
#include <iostream> #include <cstdio> #include <cstdlib> #include <string> #include <cstring> #include <cmath> #include <algorithm> #include <set> #include <map> #include <vector> using namespace std; struct tCell { int x; int y; int adjacent_unopens; tCell(int my_x, int my_y, int my_adjacent_unopens) : x(my_x), y(my_y), adjacent_unopens(my_adjacent_unopens) { } bool operator<(const tCell& rhs) const { return adjacent_unopens < rhs.adjacent_unopens; } }; int main() { int n_tests; cin >> n_tests; for (int i_test = 0; i_test < n_tests; i_test++) { int r, c, m; cin >> r >> c >> m; bool open[r][c]; int start_x, start_y; bool found_answer = false; vector<tCell> edges; // Check start points for a quarter of the grid for (start_y = 0; start_y < (r + 1) / 2; start_y++) { for (start_x = 0; start_x < (c + 1) / 2; start_x++) { // Reset variables int remaining_opens = r * c - m - 1; //cout << "Remaining opens: " << remaining_opens << endl; for (int y = 0; y < r; y++) { for (int x = 0; x < c; x++) { if (start_y == y && x == start_x) { open[y][x] = true; } else { open[y][x] = false; } } } if (remaining_opens == 0) { found_answer = true; break; } edges.clear(); tCell start_cell(start_x, start_y, 0); edges.push_back(start_cell); while (true) { // Compute adjacent_unopens vector<tCell>::iterator it = edges.begin(); for (; it != edges.end(); it++) { int my_x = it->x; int my_y = it->y; int adjacent_unopens = 0; for (int y = my_y - 1; y <= my_y + 1; y++) { for (int x = my_x - 1; x <= my_x + 1; x++) { if (y < 0 || y >= r || x < 0 || x >= c) { continue; } if (!open[y][x]) { adjacent_unopens++; } } } it->adjacent_unopens = adjacent_unopens; if (remaining_opens == adjacent_unopens) { break; } } // If it is not end, then we have a finisher if (it != edges.end()) { int my_x = it->x; int my_y = it->y; for (int y = my_y - 1; y <= my_y + 1; y++) { for (int x = my_x - 1; x <= my_x + 1; x++) { if (y < 0 || y >= r || x < 0 || x >= c) { continue; } open[y][x] = true; } } found_answer = true; break; } // If it is not end, then we have a finisher if (it != edges.end()) { int my_x = it->x; int my_y = it->y; for (int y = my_y - 1; y <= my_y + 1; y++) { for (int x = my_x - 1; x <= my_x + 1; x++) { if (y < 0 || y >= r || x < 0 || x >= c) { continue; } open[y][x] = true; } } found_answer = true; break; } sort(edges.begin(), edges.end()); while (edges.begin() != edges.end() && edges.begin()->adjacent_unopens == 0) { edges.erase(edges.begin()); } // No possible solutions if (edges.begin() == edges.end()) { break; } // Add the first one to the list it = edges.begin(); remaining_opens -= it->adjacent_unopens; // No possible solutions if (remaining_opens < 0) { break; } int my_x = it->x; int my_y = it->y; //printf("Adding: %d %d\n", my_x, my_y); for (int y = my_y - 1; y <= my_y + 1; y++) { for (int x = my_x - 1; x <= my_x + 1; x++) { if (y < 0 || y >= r || x < 0 || x >= c) { continue; } open[y][x] = true; tCell cell(x, y, 0); edges.push_back(cell); } } edges.erase(edges.begin()); } if (found_answer) { break; } } if (found_answer) { break; } } printf("Case #%d:\n", i_test+1); if (found_answer) { for (int y = 0; y < r; y++) { for (int x = 0; x < c; x++) { if (open[y][x]) { if (x == start_x && y == start_y) { cout << 'c'; } else { cout << '.'; } } else { cout << '*'; } } cout << endl; } } else { cout << "Impossible" << endl; } } }
26.394286
69
0.423252
golmansax
078ebf10fc69cdec76e3899d305e4916a872486a
2,109
hpp
C++
include/psst/math/angles.hpp
maxpagani/math
fb93b8ab78f74278fdbf51bfb81373b12f887803
[ "Apache-2.0" ]
36
2016-12-14T16:02:47.000Z
2022-03-03T18:16:45.000Z
include/psst/math/angles.hpp
maxpagani/math
fb93b8ab78f74278fdbf51bfb81373b12f887803
[ "Apache-2.0" ]
null
null
null
include/psst/math/angles.hpp
maxpagani/math
fb93b8ab78f74278fdbf51bfb81373b12f887803
[ "Apache-2.0" ]
8
2017-09-17T06:01:32.000Z
2021-07-28T09:28:41.000Z
/* * pi.hpp * * Created on: Dec 19, 2016 * Author: zmij */ #ifndef PSST_MATH_ANGLES_HPP_ #define PSST_MATH_ANGLES_HPP_ #include <psst/math/detail/value_policy.hpp> #include <cmath> namespace psst { namespace math { template <typename T> struct pi { static const T value; }; template <typename T> const T pi<T>::value = std::atan((T)1) * 4; /** * Clamp angle in the range of [0, π*2) * @param angle * @return */ template <typename T> constexpr T zero_to_two_pi(T const& val) { const auto double_pi = math::pi<std::decay_t<T>>::value * 2; T angle = val; while (angle >= double_pi) { angle -= double_pi; } while (angle < 0) { angle += double_pi; } return angle; } template <typename T> constexpr T minus_plus_half_pi(T const& angle) { const auto half_pi = math::pi<std::decay_t<T>>::value / 2; if (angle < -half_pi) return -half_pi; if (angle > half_pi) return half_pi; return angle; } template <typename T> constexpr T minus_plus_pi(T const& val) { const auto pi = math::pi<std::decay_t<T>>::value * 2; const auto double_pi = pi * 2; T angle = val; while (angle > pi) { angle -= double_pi; } while (angle < -pi) { angle += double_pi; } return angle; } template <typename T> constexpr T degrees_to_radians(T degrees) { return degrees / 180 * pi<std::decay_t<T>>::value; } template <typename T> constexpr T radians_to_degrees(T radians) { return radians / pi<std::decay_t<T>>::value * 180; } inline constexpr double operator"" _deg(long double deg) { return degrees_to_radians(deg); } inline constexpr double operator"" _deg(unsigned long long int deg) { return degrees_to_radians<double>(deg); } namespace value_policy { template <typename T> using clamp_zero_to_two_pi = value_clamp<T, zero_to_two_pi<T>>; template <typename T> using clamp_minus_plus_half_pi = value_clamp<T, minus_plus_half_pi<T>>; } // namespace value_policy } /* namespace math */ } /* namespace psst */ #endif /* PSST_MATH_ANGLES_HPP_ */
18.663717
71
0.647226
maxpagani
078f7a0304ccf7aaf9ba222cf88734da77c9c91f
2,081
hpp
C++
include/zmq/socket_cache.hpp
haal/fluent
b387aec46155a3f2d4c2060e818e212b7649c7ca
[ "Apache-2.0" ]
1,164
2018-07-25T23:17:07.000Z
2019-07-11T20:33:52.000Z
include/zmq/socket_cache.hpp
longwutianya/fluent
c8fc9f2dd781e5ed91c34351adc6a101cc383083
[ "Apache-2.0" ]
126
2018-07-25T22:41:53.000Z
2019-07-10T21:49:19.000Z
include/zmq/socket_cache.hpp
longwutianya/fluent
c8fc9f2dd781e5ed91c34351adc6a101cc383083
[ "Apache-2.0" ]
178
2018-07-25T23:17:11.000Z
2019-07-10T02:45:27.000Z
// Copyright 2018 U.C. Berkeley RISE Lab // // 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 SRC_INCLUDE_ZMQ_SOCKET_CACHE_HPP_ #define SRC_INCLUDE_ZMQ_SOCKET_CACHE_HPP_ #include <map> #include <string> #include "types.hpp" #include "zmq.hpp" // A SocketCache is a map from ZeroMQ addresses to PUSH ZeroMQ sockets. The // socket corresponding to address `address` can be retrieved from a // SocketCache `cache` with `cache[address]` or `cache.At(address)`. If a // socket with a given address is not in the cache when it is requested, one is // created and connected to the address. An example: // // zmq::context_t context(1); // SocketCache cache(&context); // // This will create a socket and connect it to "inproc://a". // zmq::socket_t& a = cache["inproc://a"]; // // This will not createa new socket. It will return the socket created in // // the previous line. In other words, a and the_same_a_as_before are // // references to the same socket. // zmq::socket_t& the_same_a_as_before = cache["inproc://a"]; // // cache.At("inproc://a") is 100% equivalent to cache["inproc://a"]. // zmq::socket_t& another_a = cache.At("inproc://a"); class SocketCache { public: explicit SocketCache(zmq::context_t* context, int type) : context_(context), type_(type) {} zmq::socket_t& At(const Address& addr); zmq::socket_t& operator[](const Address& addr); void clear_cache(); private: zmq::context_t* context_; std::map<Address, zmq::socket_t> cache_; int type_; }; #endif // SRC_INCLUDE_ZMQ_SOCKET_CACHE_HPP_
37.160714
79
0.709755
haal
079163232d247c1ce8d5a07de2c22fc6c1e84c77
1,047
cpp
C++
clstatphys/tests/rootfinder/false_position_method.cpp
FIshikawa/ClassicalStatPhys
e4010480d3c7977829c1b3fdeaf51401a2409373
[ "MIT" ]
null
null
null
clstatphys/tests/rootfinder/false_position_method.cpp
FIshikawa/ClassicalStatPhys
e4010480d3c7977829c1b3fdeaf51401a2409373
[ "MIT" ]
2
2020-01-21T08:54:05.000Z
2020-01-21T09:29:10.000Z
clstatphys/tests/rootfinder/false_position_method.cpp
FIshikawa/ClassicalStatPhys
e4010480d3c7977829c1b3fdeaf51401a2409373
[ "MIT" ]
2
2020-07-18T03:36:32.000Z
2021-07-21T22:58:27.000Z
#include <gtest/gtest.h> #include <clstatphys/tools/false_position_method.hpp> double f(double x) { return 3*x*x-5*x+1; } TEST(FlasePositionTest, FlasePosition1) { optimization::FalsePositionMethod optimizer; int iteration; iteration = optimizer.find_zero(f, 0, 1); EXPECT_TRUE(iteration > 0); EXPECT_DOUBLE_EQ((5 - std::sqrt(13)) / 6, optimizer.zero()); } TEST(FlasePositionTest, FlasePosition2) { optimization::FalsePositionMethod optimizer; int iteration; iteration = optimizer.find_zero(f, 1, 10); EXPECT_TRUE(iteration > 0); EXPECT_DOUBLE_EQ((5 + std::sqrt(13)) / 6, optimizer.zero()); } TEST(FlasePositionTest, FlasePosition3) { optimization::FalsePositionMethod optimizer; int iteration; iteration = optimizer.find_zero(f, 10, 1); EXPECT_TRUE(iteration > 0); EXPECT_DOUBLE_EQ((5 + std::sqrt(13)) / 6, optimizer.zero()); } TEST(FlasePositionTest, FlasePosition4) { optimization::FalsePositionMethod optimizer; int iteration; iteration = optimizer.find_zero(f, 3, 4); EXPECT_FALSE(iteration > 0); }
29.083333
62
0.730659
FIshikawa
07927e7ce599ea938f72c7e5917ddc481c256d21
3,108
cpp
C++
src/tdme/tools/particlesystem/TDMEParticleSystem.cpp
mahula/tdme2
0f74d35ae5d2cd33b1a410c09f0d45f250ca7a64
[ "BSD-3-Clause" ]
null
null
null
src/tdme/tools/particlesystem/TDMEParticleSystem.cpp
mahula/tdme2
0f74d35ae5d2cd33b1a410c09f0d45f250ca7a64
[ "BSD-3-Clause" ]
null
null
null
src/tdme/tools/particlesystem/TDMEParticleSystem.cpp
mahula/tdme2
0f74d35ae5d2cd33b1a410c09f0d45f250ca7a64
[ "BSD-3-Clause" ]
null
null
null
#include <tdme/tools/particlesystem/TDMEParticleSystem.h> #include <cstdlib> #include <string> #include <tdme/utils/Time.h> #include <tdme/engine/Engine.h> #include <tdme/engine/model/Color4.h> #include <tdme/gui/GUI.h> #include <tdme/tools/shared/tools/Tools.h> #include <tdme/tools/shared/views/PopUps.h> #include <tdme/tools/shared/views/SharedParticleSystemView.h> #include <tdme/tools/shared/views/View.h> #include <tdme/utils/Console.h> using std::string; using tdme::tools::particlesystem::TDMEParticleSystem; using tdme::utils::Time; using tdme::engine::Engine; using tdme::engine::model::Color4; using tdme::gui::GUI; using tdme::tools::shared::tools::Tools; using tdme::tools::shared::views::PopUps; using tdme::tools::shared::views::SharedParticleSystemView; using tdme::tools::shared::views::View; using tdme::utils::Console; string TDMEParticleSystem::VERSION = "1.9.9"; TDMEParticleSystem* TDMEParticleSystem::instance = nullptr; TDMEParticleSystem::TDMEParticleSystem() { Tools::loadSettings(this); TDMEParticleSystem::instance = this; engine = Engine::getInstance(); view = nullptr; viewInitialized = false; viewNew = nullptr; popUps = new PopUps(); particleSystemView = nullptr; quitRequested = false; } TDMEParticleSystem::~TDMEParticleSystem() { delete popUps; delete particleSystemView; } void TDMEParticleSystem::main(int argc, char** argv) { Console::println(string("TDMEParticleSystem " + VERSION)); Console::println(string("Programmed 2018 by Andreas Drewke, drewke.net.")); Console::println(); auto tdmeParticleSystem = new TDMEParticleSystem(); tdmeParticleSystem->run(argc, argv, "TDMEParticleSystem"); } TDMEParticleSystem* TDMEParticleSystem::getInstance() { return instance; } void TDMEParticleSystem::setView(View* view) { viewNew = view; } View* TDMEParticleSystem::getView() { return view; } void TDMEParticleSystem::quit() { quitRequested = true; } void TDMEParticleSystem::display() { if (viewNew != nullptr) { if (view != nullptr && viewInitialized == true) { view->deactivate(); view->dispose(); viewInitialized = false; } view = viewNew; viewNew = nullptr; } if (view != nullptr) { if (viewInitialized == false) { view->initialize(); view->activate(); viewInitialized = true; } view->display(); } engine->display(); if (view != nullptr) view->display(); if (quitRequested == true) { if (view != nullptr) { view->deactivate(); view->dispose(); } Application::exit(0); } } void TDMEParticleSystem::dispose() { if (view != nullptr && viewInitialized == true) { view->deactivate(); view->dispose(); view = nullptr; } engine->dispose(); Tools::oseDispose(); } void TDMEParticleSystem::initialize() { engine->initialize(); engine->setSceneColor(Color4(125.0f / 255.0f, 125.0f / 255.0f, 125.0f / 255.0f, 1.0f)); setInputEventHandler(engine->getGUI()); Tools::oseInit(); popUps->initialize(); setView(particleSystemView = new SharedParticleSystemView(popUps)); } void TDMEParticleSystem::reshape(int32_t width, int32_t height) { engine->reshape(0, 0, width, height); }
22.521739
88
0.717181
mahula
07930c1c3b65b8fd591ac2e791fb5ee01ec64163
5,553
cpp
C++
src/Scenes/Tiles/Tileset.cpp
Tristeon/Tristeon
9052e87b743f1122ed4c81952f2bffda96599447
[ "MIT" ]
32
2018-06-16T20:50:15.000Z
2022-03-26T16:57:15.000Z
src/Scenes/Tiles/Tileset.cpp
Tristeon/Tristeon2D
9052e87b743f1122ed4c81952f2bffda96599447
[ "MIT" ]
2
2018-10-07T17:41:39.000Z
2021-01-08T03:14:19.000Z
src/Scenes/Tiles/Tileset.cpp
Tristeon/Tristeon2D
9052e87b743f1122ed4c81952f2bffda96599447
[ "MIT" ]
9
2018-06-12T21:00:58.000Z
2021-01-08T02:18:30.000Z
#include "Tileset.h" #include "AssetManagement/Resources.h" #include <Rendering/Texture.h> namespace Tristeon { void to_json(json& j, const TileInfo& p) { j["hasCollider"] = p.hasCollider; j["density"] = p.density; j["friction"] = p.friction; j["restitution"] = p.restitution; } void from_json(const json& j, TileInfo& p) { p.hasCollider = j.value("hasCollider", false); p.density = j.value("density", 1.0f); p.friction = j.value("friction", 0.0f); p.restitution = j.value("restitution", 0.0f); } Tileset::Tileset() { albedoMap = Resources::load<Texture>(Texture::defaultPath); albedoPath = Texture::defaultPath; this->tileInfo = std::make_unique<TileInfo[]>(cols * rows); for (size_t i = 0; i < cols * rows; i++) tileInfo[i] = TileInfo{}; } json Tileset::serialize() { auto j = Serializable::serialize(); j["typeID"] = Type<Tileset>::fullName(); j["id"] = id; j["width"] = cols; j["height"] = rows; j["albedoPath"] = albedoPath; j["normalPath"] = normalPath; j["normalMapStrength"] = normalMapStrength; j["lightMaskPath"] = lightMaskPath; j["spacingLeft"] = spacingLeft; j["spacingRight"] = spacingRight; j["spacingTop"] = spacingTop; j["spacingBottom"] = spacingBottom; j["horizontalSpacing"] = horizontalSpacing; j["verticalSpacing"] = verticalSpacing; auto info = json::array_t(); for (size_t i = 0; i < cols * rows; i++) { info.emplace_back(TileInfo{ false, 1, 0, 0 }); if (tileInfo) info[i] = tileInfo[i]; } j["tileInfo"] = info; return j; } void Tileset::deserialize(json j) { Serializable::deserialize(j); cols = j.value("width", 1u); rows = j.value("height", 1u); id = j.value("id", 0); albedoPath = j.value("albedoPath", ""); albedoMap = Resources::load<Texture>(albedoPath); normalPath = j.value("normalPath", ""); normalMap = Resources::load<Texture>(normalPath); normalMapStrength = j.value("normalMapStrength", 1.0f); lightMaskPath = j.value("lightMaskPath", ""); lightMask = Resources::load<Texture>(lightMaskPath); spacingLeft = j.value("spacingLeft", 0); spacingRight = j.value("spacingRight", 0); spacingTop = j.value("spacingTop", 0); spacingBottom = j.value("spacingBottom", 0); horizontalSpacing = j.value("horizontalSpacing", 0); verticalSpacing = j.value("verticalSpacing", 0); this->tileInfo = std::make_unique<TileInfo[]>(cols * rows); for (size_t i = 0; i < cols * rows; i++) tileInfo[i] = TileInfo{}; if (j.contains("tileInfo") && j["tileInfo"].is_array()) { for (size_t i = 0; i < cols * rows && i < j["tileInfo"].size(); i++) { tileInfo[i] = j["tileInfo"][i]; } } } TileInfo Tileset::info(const int& index) const { if (index < 0 || index > cols * rows) return {}; return tileInfo[index]; } VectorI Tileset::tileSize() const { auto img = albedoMap->size(); img.x -= spacingLeft + spacingRight; img.y -= spacingTop + spacingBottom; img.x -= horizontalSpacing * (cols - 1); img.y -= verticalSpacing * (rows - 1); return { img.x / (int)cols, img.y / (int)rows }; } Vector Tileset::tileSizeNormalized() const { if (!albedoMap) return Vector{}; auto const img = albedoMap->size(); auto const size = tileSize(); return { size.x / (float)img.x, size.y / (float)img.y }; } VectorI Tileset::tileMin(const int& x, const int& y) const { VectorI result{ (int)spacingLeft, (int)spacingTop }; auto const size = tileSize(); result.x += x * (size.x + horizontalSpacing); result.y += y * (size.y + verticalSpacing); return result; } VectorI Tileset::tileMin(const int& index) const { return tileMin(tileCoords(index)); } VectorI Tileset::tileMin(const VectorI& coords) const { return tileMin(coords.x, coords.y); } Vector Tileset::tileMinNormalized(const int& x, const int& y) const { auto const min = tileMin(x, y); auto const img = albedoMap->size(); return { min.x / (float)img.x, min.y / (float)img.y }; } Vector Tileset::tileMinNormalized(const int& index) const { return tileMinNormalized(tileCoords(index)); } Vector Tileset::tileMinNormalized(const VectorI& coords) const { return tileMinNormalized(coords.x, coords.y); } VectorI Tileset::tileMax(const int& x, const int& y) const { auto const min = tileMin(x, y); auto const size = tileSize(); return min + size; } VectorI Tileset::tileMax(const int& index) const { return tileMax(tileCoords(index)); } VectorI Tileset::tileMax(const VectorI& coords) const { return tileMax(coords.x, coords.y); } Vector Tileset::tileMaxNormalized(const int& x, const int& y) const { auto const max = tileMax(x, y); auto const img = albedoMap->size(); return { max.x / (float)img.x, max.y / (float)img.y }; } Vector Tileset::tileMaxNormalized(const int& index) const { return tileMaxNormalized(tileCoords(index)); } Vector Tileset::tileMaxNormalized(const VectorI& coords) const { return tileMaxNormalized(coords.x, coords.y); } int Tileset::tile(const int& x, const int& y) const { assert(x >= 0); assert(y >= 0); return y * cols + x; } int Tileset::tile(const VectorI& coords) const { return tile(coords.x, coords.y); } VectorI Tileset::tileCoords(const int& index) const { return { (int)index % (int)cols, (int)(index / (float)cols) }; } TileInfo Tileset::info(const int& x, const int& y) const { return tileInfo[tile(x, y)]; } TileInfo Tileset::info(const VectorI& coords) const { return tileInfo[tile(coords.x, coords.y)]; } }
23.529661
71
0.65118
Tristeon
079380678b7f324136966bee809ed8b96aa0e4a9
2,656
cpp
C++
Homeworks/HW-3/Task-3/task-3.cpp
kgolov/uni-data-structures
8d8b2ff75ffa0ceed3ebe7bbc294680134b7d1c1
[ "MIT" ]
null
null
null
Homeworks/HW-3/Task-3/task-3.cpp
kgolov/uni-data-structures
8d8b2ff75ffa0ceed3ebe7bbc294680134b7d1c1
[ "MIT" ]
null
null
null
Homeworks/HW-3/Task-3/task-3.cpp
kgolov/uni-data-structures
8d8b2ff75ffa0ceed3ebe7bbc294680134b7d1c1
[ "MIT" ]
null
null
null
#include <iostream> // Calculates the number of balloons needed if the maximum number of sweets is target long long balloonsNeeded(long long* sweets, long long* maxSweets, int size, long long target) { long long counter = 0; for (int i = 0; i < size; i++) { // Check if we need balloons here to reduce the maximum number of sweets if (maxSweets[i] > target) { long long difference = maxSweets[i] - target; // The balloons needed to make up this difference are the difference divided by the sweets // field of the current day, rounded up to an integer long long balloons = 1 + ((difference - 1) / sweets[i]); counter += balloons; } } return counter; } // Finds the minimum number of max sweets needed long long findMaxSweets(long long* sweets, long long* maxSweets, int size, long long balloons) { // Conduct a binary search for the answer // The maximum number of sweets is our upper bound long long left = 0; long long right = 0; for (int i = 0; i < size; i++) { if (maxSweets[i] > right) { right = maxSweets[i]; } } // We will store our result here long long result = right; while (left <= right) { // Take a guess for the maximum number of sweets, in the middle between our lower and upper bounds long long middle = left + (right - left) / 2; // If the balloons needed for this given number of sweets are lower than, or equal to the amount we have if (balloonsNeeded(sweets, maxSweets, size, middle) <= balloons) { // Then, this is a possible solution, so save it as a result if (middle < result) { result = middle; } // And update our upper bound to search for an even lower possible number right = middle - 1; } else { // Else, this cannot be a solution, so search for a higher number left = middle + 1; } } // We have found the minimum number of max sweets return result; } int main() { int days; std::cin >> days; long long balloons; std::cin >> balloons; long long* maxBalloons = new long long[days]; long long* sweets = new long long[days]; long long* maxSweets = new long long[days]; for (int i = 0; i < days; i++) { std::cin >> maxBalloons[i]; } for (int i = 0; i < days; i++) { std::cin >> sweets[i]; maxSweets[i] = maxBalloons[i] * sweets[i]; } std::cout << findMaxSweets(sweets, maxSweets, days, balloons); return 0; }
32
112
0.589985
kgolov
07938e6b44fe67f182eafe4e1c24e97b0c79a870
3,588
cc
C++
src/main.cc
qianqian121/odrMgrLite
877c5676198e8c35fb72c01c411c72a453449c65
[ "Unlicense" ]
null
null
null
src/main.cc
qianqian121/odrMgrLite
877c5676198e8c35fb72c01c411c72a453449c65
[ "Unlicense" ]
null
null
null
src/main.cc
qianqian121/odrMgrLite
877c5676198e8c35fb72c01c411c72a453449c65
[ "Unlicense" ]
null
null
null
/* =================================================== * file: main.cc * --------------------------------------------------- * purpose: main program for testing the * OdrManager * --------------------------------------------------- * first edit: 08.07.2006 by M. Dupuis * =================================================== * 21.07.2008: udate to OpenDRIVE Manager 1.1.19 * 21.06.2007: udate to OpenDRIVE Manager 1.1.10 * =================================================== */ /* ====== INCLUSIONS ====== */ #include <iostream> #include <math.h> #include <cstdlib> #include <cstdio> #include "OdrManagerLite.hh" #ifdef LINUX #include <sys/time.h> #else #include <windows.h> #endif using namespace std; /* ====== GLOBAL VARIABLES ====== */ int main( int argc, char **argv ) { OpenDrive::OdrManagerLite myManager; if ( argc < 2 ) { std::cerr << "Usage: " << std::endl; std::cerr << " odrMgr <filename> <additional filename>" << std::endl; exit( -1 ); } std::cerr << "main: analyzing file <" << argv[1] << ">" << std::endl; if ( !myManager.loadFile( argv[1] ) ) { std::cerr << "main: could not load <" << argv[1] << ">" << std::endl; exit( 0 ); } /******************************************************************** * SAMPLE no. 1 * print the data tree *********************************************************************/ // print the contents of the file std::cerr << "main: printing data contents" << std::endl; myManager.printData(); /******************************************************************** * SAMPLE no. 3 * navigate on the road data, a few samples *********************************************************************/ // create a position object for access to the data/ std::cerr << "main: position tests" << std::endl; OpenDrive::Position* myPos= myManager.createPosition(); // activate the position object myManager.activatePosition( myPos ); int testCase = 0; { switch ( testCase ) { case 0: // track to inertial and back { for ( double s = 0.0; s < 1600.0; s+= 100.0 ) { myManager.setTrackPos( 17, s, 3.0 ); bool result = myManager.track2inertial(); fprintf( stderr, "testCase 0: result = %d, s = %.3f, x = %.8lf, y = %.8lf, z = %.8lf, pitch=%.8lf\n", result, s, myManager.getInertialPos().getX(), myManager.getInertialPos().getY(), myManager.getInertialPos().getZ(), myManager.getInertialPos().getP() ); // now the other way round result = myManager.inertial2track(); myManager.footPoint2inertial(); fprintf( stderr, "testCase 0: result = %d, x = %.8lf, y = %.8lf, track = %d, s = %.8lf, t = %.8lf\n", result, myManager.getInertialPos().getX(), myManager.getInertialPos().getY(), myManager.getTrackPos().getTrackId(), myManager.getTrackPos().getS(), myManager.getTrackPos().getT() ); } } break; } } return 1; }
36.989691
145
0.401895
qianqian121
0795b2136bb20d35edbae00ce15ee2459c33a7b6
1,067
cpp
C++
poj-3125.cpp
casper001207/uva-online-judge
19dc42224c24ac66bc99d52498a26fd310caf6bc
[ "MIT" ]
1
2020-04-08T14:07:05.000Z
2020-04-08T14:07:05.000Z
poj-3125.cpp
casper001207/uva-online-judge
19dc42224c24ac66bc99d52498a26fd310caf6bc
[ "MIT" ]
null
null
null
poj-3125.cpp
casper001207/uva-online-judge
19dc42224c24ac66bc99d52498a26fd310caf6bc
[ "MIT" ]
null
null
null
#include <cstdio> #include <queue> using namespace std; bool checkIfOkToPrint(queue<int> q, int job, int priority[]); int main() { int Case, n, m; int priority[105]; scanf("%d", &Case); while (Case--) { scanf("%d %d", &n, &m); for (int i = 0; i < n; ++i) scanf("%d", &priority[i]); queue<int> q; for (int i = 0; i < n; ++i) q.push(i); int time = 0; bool isover = false; while (!isover) { int job = q.front(); q.pop(); bool check = checkIfOkToPrint(q, job, priority); if (check == true) { ++time; if (job == m) isover = true; } else { q.push(job); } } printf("%d\n", time); } } bool checkIfOkToPrint(queue<int> q, int job, int priority[]) { while (!q.empty()) { if (priority[q.front()] > priority[job]) return false; else q.pop(); } return true; }
22.702128
61
0.424555
casper001207
079bca3915e04aa1ea5fa7f7fc726d691d0f6c03
908
hh
C++
src/cassette/CasImage.hh
sdsnatcher73/openMSX
6de09386ff674668325ddf700b0b16334ad1d2ef
[ "Naumen", "Condor-1.1", "MS-PL" ]
320
2015-06-16T20:32:33.000Z
2022-03-26T17:03:27.000Z
src/cassette/CasImage.hh
sdsnatcher73/openMSX
6de09386ff674668325ddf700b0b16334ad1d2ef
[ "Naumen", "Condor-1.1", "MS-PL" ]
2,592
2015-05-30T12:12:21.000Z
2022-03-31T17:16:15.000Z
src/cassette/CasImage.hh
imulilla/openMSX_TSXadv
afffe852f73cb5f9a1f1d60f0ab9ff9a4da98c31
[ "Naumen", "Condor-1.1", "MS-PL" ]
74
2015-06-18T19:51:15.000Z
2022-03-24T15:09:33.000Z
#ifndef CASIMAGE_HH #define CASIMAGE_HH #include "CassetteImage.hh" #include <cstdint> #include <vector> namespace openmsx { class CliComm; class Filename; class FilePool; /** * Code based on "cas2wav" tool by Vincent van Dam */ class CasImage final : public CassetteImage { public: CasImage(const Filename& fileName, FilePool& filePool, CliComm& cliComm); // CassetteImage int16_t getSampleAt(EmuTime::param time) const override; [[nodiscard]] EmuTime getEndTime() const override; [[nodiscard]] unsigned getFrequency() const override; void fillBuffer(unsigned pos, float** bufs, unsigned num) const override; [[nodiscard]] float getAmplificationFactorImpl() const override; struct Data { std::vector<int8_t> wave; unsigned frequency; }; private: Data init(const Filename& filename, FilePool& filePool, CliComm& cliComm); private: const Data data; }; } // namespace openmsx #endif
20.636364
75
0.75
sdsnatcher73
079c67dacd53f1908346ff078896802240dcb050
5,862
cpp
C++
OpenROV/CAutopilot_EXP.cpp
noxxomatik/openrov-software-arduino-30.0.4-BNO055
e40b64e84cec6de2ee00abd013fe24fb483ab42d
[ "MIT" ]
null
null
null
OpenROV/CAutopilot_EXP.cpp
noxxomatik/openrov-software-arduino-30.0.4-BNO055
e40b64e84cec6de2ee00abd013fe24fb483ab42d
[ "MIT" ]
null
null
null
OpenROV/CAutopilot_EXP.cpp
noxxomatik/openrov-software-arduino-30.0.4-BNO055
e40b64e84cec6de2ee00abd013fe24fb483ab42d
[ "MIT" ]
null
null
null
#include "AConfig.h" #if( HAS_EXP_AUTOPILOT ) // Includes #include "CAutopilot.h" #include "CTimer.h" #include "NDataManager.h" #include "NCommManager.h" #include "CPIDController.h" #include "Utility.h" // File local variables and methods namespace { CTimer pilotTimer; // These should be replaced with two CPIDController instances for yaw and depth CPIDControllerAngular m_yawController( 0.01f, 0.0f, 0.0f, -1.0f, 1.0f, PID_CONTROLLER_DIRECTION_DIRECT, 10 ); CPIDControllerLinear m_depthController( 0.01f, 0.0f, 0.0f, -1.0f, 1.0f, PID_CONTROLLER_DIRECTION_DIRECT, 10 ); void HandleCommands() { if( !NCommManager::m_isCommandAvailable ) { // No commands to process return; } // Disable heading controller if( NCommManager::m_currentCommand.Equals( "headloff" ) ) { // Deactivate PID controller m_yawController.Deactivate(); // Send command to drive yaw at zero capacity (to turn off whatever was last sent by the controller) int m_argumentsToSend[] = { 1, 0 }; NCommManager::m_currentCommand.PushCommand( "yaw", m_argumentsToSend ); Serial.println( F( "log:heading_hold_disabled;" ) ); Serial.print( F( "targetHeading:" ) ); Serial.print( DISABLED ); Serial.println( ';' ); return; } // Enable heading controller if( NCommManager::m_currentCommand.Equals( "headlon" ) ) { if( NCommManager::m_currentCommand.m_arguments[0] == 0 ) { // Set the new target to our current heading NDataManager::m_controllerData.yawSetpoint = NDataManager::m_controllerData.yaw; } else { // Set new setpoint to the specified target value NDataManager::m_controllerData.yawSetpoint = NCommManager::m_currentCommand.m_arguments[1]; } // Activate PID controller m_yawController.Activate(); Serial.print( F( "log:heading_hold_enabled on=" ) ); Serial.print( *m_yawController.m_pSetpoint ); Serial.println( ';' ); Serial.print( F( "targetHeading:" ) ); Serial.print( *m_yawController.m_pSetpoint ); Serial.println( ';' ); return; } // Disable depth controller if( NCommManager::m_currentCommand.Equals( "deptloff" ) ) { // Deactivate PID controller m_depthController.Deactivate(); // Send command to drive lift at zero capacity (to turn off whatever was last sent by the controller) int m_argumentsToSend[] = { 1, 0 }; NCommManager::m_currentCommand.PushCommand( "lift", m_argumentsToSend ); Serial.println( F( "log:depth_hold_disabled;" ) ); Serial.print( F( "targetDepth:" ) ); Serial.print( DISABLED ); Serial.println( ';' ); return; } // Enable depth controller if( NCommManager::m_currentCommand.Equals( "deptlon" ) ) { if( NCommManager::m_currentCommand.m_arguments[0] == 0 ) { NDataManager::m_controllerData.depthSetpoint = NDataManager::m_controllerData.depth; } else { NDataManager::m_controllerData.depthSetpoint = NCommManager::m_currentCommand.m_arguments[1]; } // Activate PID controller m_depthController.Activate(); Serial.print( F( "log:depth_hold_enabled on=" ) ); Serial.print( *m_depthController.m_pSetpoint ); Serial.println( ';' ); Serial.print( F( "targetDepth:" ) ); Serial.print( *m_depthController.m_pSetpoint ); Serial.println( ';' ); return; } } void AllocateDepthControls() { if( m_depthController.m_isActive ) { // Map from -1to1 to -100to100 int lift = static_cast<int>( NDataManager::m_controllerData.depthCommand * 100.0f ); // TODO: Perform any deadbanding if necessary Serial.println( F( "log:dhold pushing command;" ) ); // TODO: Add error term to PID Controller class // TODO: Is this supposed to display as an integer? int error = static_cast<int>( NDataManager::m_controllerData.depthSetpoint - NDataManager::m_controllerData.depth ); Serial.print( F( "dp_er:" ) ); Serial.print( error ); Serial.println( ';' ); // Send lift command int m_argumentsToSend[] = { 1, lift }; NCommManager::m_currentCommand.PushCommand( "lift", m_argumentsToSend ); } } void AllocateYawControls() { if( m_yawController.m_isActive ) { // Map from -1to1 to -100to100 int yaw = static_cast<int>( NDataManager::m_controllerData.yawCommand * 50.0f ); // TODO: Perform any deadbanding if necessary Serial.println( F( "log:dhold pushing command;" ) ); // TODO: Add error term to PID Controller class // TODO: Is this supposed to display as an integer? int error = static_cast<int>( NORMALIZE_ANGLE( NDataManager::m_controllerData.yawSetpoint - NDataManager::m_controllerData.yaw ) ); Serial.print( F( "dp_er:" ) ); Serial.print( error ); Serial.println( ';' ); // Send yaw command int m_argumentsToSend[] = { 1, yaw }; NCommManager::m_currentCommand.PushCommand( "yaw", m_argumentsToSend ); } } void UpdateControllers() { // Compute controller outputs m_yawController.Compute(); m_depthController.Compute(); // Allocate controls AllocateDepthControls(); AllocateYawControls(); } } void CAutopilot::Initialize() { // Initialize the controllers // TODO: Maybe rethink pointer access and keep it standalone for usability m_yawController.Initialize( &NDataManager::m_controllerData.yaw, &NDataManager::m_controllerData.yawCommand, &NDataManager::m_controllerData.yawSetpoint ); m_depthController.Initialize( &NDataManager::m_controllerData.depth, &NDataManager::m_controllerData.depthCommand, &NDataManager::m_controllerData.depthSetpoint ); // Reset the timer pilotTimer.Reset(); Serial.println( F( "log:pilot setup complete;" ) ); } void CAutopilot::Update( CCommand& commandIn ) { // Handle commands HandleCommands(); // Run controllers at 20Hz and send resulting motor control commands if( pilotTimer.HasElapsed( 50 ) ) { // Update the controllers UpdateControllers(); } } #endif
27.521127
164
0.704708
noxxomatik
079cb8b3bc323aa7bfba617286de5052b0043dce
7,271
cpp
C++
modules/cudastereo/src/stereobm.cpp
JosephGeoBenjamin/opencv_contrib-hip
2a948c02b9077b0fd3ae2baf903e9990a5f0a684
[ "BSD-3-Clause" ]
null
null
null
modules/cudastereo/src/stereobm.cpp
JosephGeoBenjamin/opencv_contrib-hip
2a948c02b9077b0fd3ae2baf903e9990a5f0a684
[ "BSD-3-Clause" ]
null
null
null
modules/cudastereo/src/stereobm.cpp
JosephGeoBenjamin/opencv_contrib-hip
2a948c02b9077b0fd3ae2baf903e9990a5f0a684
[ "BSD-3-Clause" ]
1
2020-11-16T14:32:58.000Z
2020-11-16T14:32:58.000Z
/*M/////////////////////////////////////////////////////////////////////////////////////// // // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, // copy or use the software. // // // License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. // Copyright (C) 2009, Willow Garage Inc., all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // * Redistribution's of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // * Redistribution's 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. // // * The name of the copyright holders may not 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 Intel Corporation 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. // //M*/ #include "precomp.hpp" using namespace cv; using namespace cv::cuda; #if !defined (HAVE_HIP) || defined (CUDA_DISABLER) Ptr<cuda::StereoBM> cv::cuda::createStereoBM(int, int) { throw_no_cuda(); return Ptr<cuda::StereoBM>(); } #else /* !defined (HAVE_HIP) */ namespace cv { namespace cuda { namespace device { namespace stereobm { void stereoBM_CUDA(const PtrStepSzb& left, const PtrStepSzb& right, const PtrStepSzb& disp, int ndisp, int winsz, const PtrStepSz<unsigned int>& minSSD_buf, hipStream_t & stream); void prefilter_xsobel(const PtrStepSzb& input, const PtrStepSzb& output, int prefilterCap /*= 31*/, hipStream_t & stream); void postfilter_textureness(const PtrStepSzb& input, int winsz, float avgTexturenessThreshold, const PtrStepSzb& disp, hipStream_t & stream); } }}} namespace { class StereoBMImpl : public cuda::StereoBM { public: StereoBMImpl(int numDisparities, int blockSize); void compute(InputArray left, InputArray right, OutputArray disparity); void compute(InputArray left, InputArray right, OutputArray disparity, Stream& stream); int getMinDisparity() const { return 0; } void setMinDisparity(int /*minDisparity*/) {} int getNumDisparities() const { return ndisp_; } void setNumDisparities(int numDisparities) { ndisp_ = numDisparities; } int getBlockSize() const { return winSize_; } void setBlockSize(int blockSize) { winSize_ = blockSize; } int getSpeckleWindowSize() const { return 0; } void setSpeckleWindowSize(int /*speckleWindowSize*/) {} int getSpeckleRange() const { return 0; } void setSpeckleRange(int /*speckleRange*/) {} int getDisp12MaxDiff() const { return 0; } void setDisp12MaxDiff(int /*disp12MaxDiff*/) {} int getPreFilterType() const { return preset_; } void setPreFilterType(int preFilterType) { preset_ = preFilterType; } int getPreFilterSize() const { return 0; } void setPreFilterSize(int /*preFilterSize*/) {} int getPreFilterCap() const { return preFilterCap_; } void setPreFilterCap(int preFilterCap) { preFilterCap_ = preFilterCap; } int getTextureThreshold() const { return static_cast<int>(avergeTexThreshold_); } void setTextureThreshold(int textureThreshold) { avergeTexThreshold_ = static_cast<float>(textureThreshold); } int getUniquenessRatio() const { return 0; } void setUniquenessRatio(int /*uniquenessRatio*/) {} int getSmallerBlockSize() const { return 0; } void setSmallerBlockSize(int /*blockSize*/){} Rect getROI1() const { return Rect(); } void setROI1(Rect /*roi1*/) {} Rect getROI2() const { return Rect(); } void setROI2(Rect /*roi2*/) {} private: int preset_; int ndisp_; int winSize_; int preFilterCap_; float avergeTexThreshold_; GpuMat minSSD_, leBuf_, riBuf_; }; StereoBMImpl::StereoBMImpl(int numDisparities, int blockSize) : preset_(0), ndisp_(numDisparities), winSize_(blockSize), preFilterCap_(31), avergeTexThreshold_(3) { } void StereoBMImpl::compute(InputArray left, InputArray right, OutputArray disparity) { compute(left, right, disparity, Stream::Null()); } void StereoBMImpl::compute(InputArray _left, InputArray _right, OutputArray _disparity, Stream& _stream) { using namespace ::cv::cuda::device::stereobm; const int max_supported_ndisp = 1 << (sizeof(unsigned char) * 8); CV_Assert( 0 < ndisp_ && ndisp_ <= max_supported_ndisp ); CV_Assert( ndisp_ % 8 == 0 ); CV_Assert( winSize_ % 2 == 1 ); GpuMat left = _left.getGpuMat(); GpuMat right = _right.getGpuMat(); CV_Assert( left.type() == CV_8UC1 ); CV_Assert( left.size() == right.size() && left.type() == right.type() ); _disparity.create(left.size(), CV_8UC1); GpuMat disparity = _disparity.getGpuMat(); hipStream_t stream = StreamAccessor::getStream(_stream); cuda::ensureSizeIsEnough(left.size(), CV_32SC1, minSSD_); PtrStepSzb le_for_bm = left; PtrStepSzb ri_for_bm = right; if (preset_ == cv::StereoBM::PREFILTER_XSOBEL) { cuda::ensureSizeIsEnough(left.size(), left.type(), leBuf_); cuda::ensureSizeIsEnough(right.size(), right.type(), riBuf_); prefilter_xsobel( left, leBuf_, preFilterCap_, stream); prefilter_xsobel(right, riBuf_, preFilterCap_, stream); le_for_bm = leBuf_; ri_for_bm = riBuf_; } stereoBM_CUDA(le_for_bm, ri_for_bm, disparity, ndisp_, winSize_, minSSD_, stream); if (avergeTexThreshold_ > 0) postfilter_textureness(le_for_bm, winSize_, avergeTexThreshold_, disparity, stream); } } Ptr<cuda::StereoBM> cv::cuda::createStereoBM(int numDisparities, int blockSize) { return makePtr<StereoBMImpl>(numDisparities, blockSize); } #endif /* !defined (HAVE_HIP) */
39.091398
187
0.673773
JosephGeoBenjamin
079d6c7a9f6eee82e69c43655c04877ed611621a
2,602
cpp
C++
UVa/UVA227.cpp
Insouciant21/solution
8f241ec2076c9c29c0d39c2c285ee12eac1dee9e
[ "Apache-2.0" ]
1
2020-09-11T13:17:28.000Z
2020-09-11T13:17:28.000Z
UVa/UVA227.cpp
Insouciant21/solution
8f241ec2076c9c29c0d39c2c285ee12eac1dee9e
[ "Apache-2.0" ]
1
2020-10-22T13:36:23.000Z
2020-10-22T13:36:23.000Z
UVa/UVA227.cpp
Insouciant21/solution
8f241ec2076c9c29c0d39c2c285ee12eac1dee9e
[ "Apache-2.0" ]
1
2020-10-22T13:33:11.000Z
2020-10-22T13:33:11.000Z
#include <bits/stdc++.h> using namespace std; int main() { int kase = 0; while (true) { string grid[5]; for (auto &i : grid) i = ""; kase++; char ch = getchar(); if (ch == '\n') ch = getchar(); if (ch == 'Z') return 0; grid[0] += ch; for (auto &i : grid) { string t; getline(cin, t); i += t; } int x = 0, y = 0; bool find = false; for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { if (grid[i][j] == ' ') { x = i, y = j; find = true; break; } } if (find) break; } if (!find) { for (int i = 0; i < 5; i++) { if (grid[i].size() == 4) { x = i, y = 4; grid[i] += ' '; break; } } } bool success = true; while (true) { char i = getchar(); if (i == '\n') i = getchar(); if (i == '0') break; switch (i) { case 'A': if (x - 1 < 0) { success = false; break; } swap(grid[x][y], grid[x - 1][y]); x--; break; case 'B': if (x + 1 > 4) { success = false; break; } swap(grid[x][y], grid[x + 1][y]); x++; break; case 'L': if (y - 1 < 0) { success = false; break; } swap(grid[x][y], grid[x][y - 1]); y--; break; case 'R': if (y + 1 > 4) { success = false; break; } swap(grid[x][y], grid[x][y + 1]); y++; break; } } if (kase != 1) printf("\n"); printf("Puzzle #%d:\n", kase); if (!success) printf("This puzzle has no final configuration.\n"); else { for (auto &i : grid) { for (int j = 0; j < 5; j++) printf((j == 0) ? "%c" : " %c", i[j]); printf("\n"); } } } }
28.282609
82
0.259416
Insouciant21
079de2e3f63c950bede97fde173e4f9d0a0252f5
2,765
hpp
C++
common/dpcpp/cuckoo_hashtable.hpp
bagrorg/dwarf_bench
e06427c2b64b1696ba88a46ba758b1f5c9605893
[ "MIT" ]
5
2021-09-17T19:16:23.000Z
2022-03-18T11:45:44.000Z
common/dpcpp/cuckoo_hashtable.hpp
bagrorg/dwarf_bench
e06427c2b64b1696ba88a46ba758b1f5c9605893
[ "MIT" ]
20
2021-07-28T15:20:18.000Z
2021-09-02T14:18:03.000Z
common/dpcpp/cuckoo_hashtable.hpp
bagrorg/dwarf_bench
e06427c2b64b1696ba88a46ba758b1f5c9605893
[ "MIT" ]
null
null
null
#include <CL/sycl.hpp> #include "hashfunctions.hpp" template <class Key, class Val, class Hasher1, class Hasher2> class CuckooHashtable{ private: sycl::global_ptr<Key> _keys; sycl::global_ptr<Val> _vals; const size_t _size; Hasher1 _hasher1; Hasher2 _hasher2; const Key _EMPTY_KEY = std::numeric_limits<Key>::max(); sycl::global_ptr<uint32_t> _bitmask; static constexpr uint32_t elem_sz = CHAR_BIT * sizeof(uint32_t); public: explicit CuckooHashtable(const size_t size, sycl::global_ptr<Key> keys, sycl::global_ptr<Val> vals, sycl::global_ptr<uint32_t> bitmask, Hasher1 hasher1, Hasher2 hasher2): _size(size), _keys(keys), _vals(vals), _bitmask(bitmask), _hasher1(hasher1), _hasher2(hasher2){} const std::pair<Val, bool> at(Key key) const { auto pos1 = _hasher1(key); auto pos2 = _hasher2(key); if (_keys[pos1] == key) return {_vals[pos1], true}; if (_keys[pos2] == key) return {_vals[pos2], true}; return {{}, false}; } bool has(Key key) const { return _keys[_hasher1(key)] == key || _keys[_hasher2(key)] == key; } bool insert(Key key, Val value) { // TODO: change loop detection size_t cnt = 0; while (cnt < _size) { size_t pos[] = {_hasher1(key), _hasher2(key)}; for (size_t i = 0; i < 2; i++) { lock(pos[i]); if (_keys[pos[i]] == _EMPTY_KEY) { _keys[pos[i]] = key; _vals[pos[i]] = value; unlock(pos[i]); return true; } unlock(pos[i]); } lock(pos[0]); std::swap(key, _keys[pos[1]]); std::swap(value, _vals[pos[1]]); unlock(pos[0]); cnt++; } return false; } void lock(size_t pos) { uint32_t present; uint32_t major_idx = pos / elem_sz; uint8_t minor_idx = pos % elem_sz; uint32_t mask = uint32_t(1) << minor_idx; do { present = sycl::atomic<uint32_t>(_bitmask + major_idx).fetch_or(mask); } while (present & mask); } void unlock(size_t pos) { uint32_t major_idx = pos / elem_sz; uint8_t minor_idx = pos % elem_sz; uint32_t mask = uint32_t(1) << minor_idx; sycl::atomic<uint32_t>(_bitmask + major_idx).fetch_and(~mask); } };
34.135802
108
0.491863
bagrorg
07a1c7952a9a1bd56840f41440de7d7325c4695b
2,571
cpp
C++
aifm/exp/fig12a/linux_mem/read/main.cpp
asarthas/AIFM
aaf7113cb3ba58381174e8b86bdd7a0f1fd1acc4
[ "MIT" ]
49
2020-11-01T00:14:40.000Z
2022-03-26T07:28:12.000Z
aifm/exp/fig12a/linux_mem/read/main.cpp
asarthas/AIFM
aaf7113cb3ba58381174e8b86bdd7a0f1fd1acc4
[ "MIT" ]
12
2020-12-15T08:30:19.000Z
2022-03-13T03:54:24.000Z
aifm/exp/fig12a/linux_mem/read/main.cpp
asarthas/AIFM
aaf7113cb3ba58381174e8b86bdd7a0f1fd1acc4
[ "MIT" ]
19
2020-12-24T22:32:22.000Z
2022-03-30T01:33:43.000Z
extern "C" { #include <runtime/runtime.h> } #include "deref_scope.hpp" #include "device.hpp" #include "helpers.hpp" #include "manager.hpp" #include <algorithm> #include <array> #include <cstdint> #include <cstdlib> #include <iostream> #include <memory> #include <iostream> using namespace far_memory; using namespace std; #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) using Data_t = uint64_t; constexpr uint64_t kCacheSize = 5ULL << 30; // 5 GB. constexpr uint64_t kFarMemSize = 5ULL << 30; // 5 GB. constexpr uint64_t kWorkSetSize = 1ULL << 30; // 1 GB. constexpr uint64_t kNumEntries = kWorkSetSize / sizeof(Data_t); constexpr uint64_t kMeasureTimes = 1 << 20; // 1 million times. constexpr uint64_t kRawMemoryAccessCycles = 170; // 1 million times. constexpr uint64_t kNumConnections = 600; constexpr uint8_t kNumGCThreads = 21; unsigned cycles_low_start, cycles_high_start; unsigned cycles_low_end, cycles_high_end; uint32_t g_seed = 0xDEADBEEF; unique_ptr<Data_t> ptrs[kNumEntries]; std::vector<uint64_t> durations; uint32_t x = 123456789, y = 362436069, z = 521288629; uint32_t xorshf96(void) { uint32_t t; x ^= x << 16; x ^= x >> 5; x ^= x << 1; t = x; x = y; y = z; z = t ^ x ^ y; return z; } template <typename T> void print_percentile(int percentile, T *container) { auto idx = percentile / 100.0 * container->size(); cout << percentile << "\t" << (*container)[idx] << endl; } template <typename T> void print_results(T *container) { sort(container->begin(), container->end()); print_percentile(90, container); } void do_work(void *arg) { for (uint64_t i = 0; i < kNumEntries; i++) { ptrs[i].reset(new Data_t()); } DerefScope scope; for (uint64_t i = 0; i < kMeasureTimes; i++) { auto idx = xorshf96() % kNumEntries; helpers::timer_start(&cycles_high_start, &cycles_low_start); { const Data_t *raw_const_ptr = ptrs[idx].get(); ACCESS_ONCE(*raw_const_ptr); } helpers::timer_end(&cycles_high_end, &cycles_low_end); auto duration = helpers::get_elapsed_cycles( cycles_high_start, cycles_low_start, cycles_high_end, cycles_low_end); if (duration > kRawMemoryAccessCycles) { durations.push_back(duration); } } print_results(&durations); } int main(int argc, char *argv[]) { int ret; if (argc < 2) { std::cerr << "usage: [cfg_file]" << std::endl; return -EINVAL; } ret = runtime_init(argv[1], do_work, NULL); if (ret) { std::cerr << "failed to start runtime" << std::endl; return ret; } return 0; }
23.587156
78
0.671723
asarthas
07aac5a1de403d0a564475970c8977c8aedb089a
3,040
cpp
C++
src/swish/hooks-i3nt.cpp
becls/swish-win
bab98dfa757dfd851d8cf5176fb3e88115f311f4
[ "MIT" ]
19
2017-12-05T21:48:32.000Z
2019-12-09T05:18:02.000Z
src/swish/hooks-i3nt.cpp
becls/swish-win
bab98dfa757dfd851d8cf5176fb3e88115f311f4
[ "MIT" ]
null
null
null
src/swish/hooks-i3nt.cpp
becls/swish-win
bab98dfa757dfd851d8cf5176fb3e88115f311f4
[ "MIT" ]
1
2019-06-15T22:39:56.000Z
2019-06-15T22:39:56.000Z
// Copyright 2017 Beckman Coulter, Inc. // // 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. #include "stdafx.h" #define HookStaticFunction(name)\ extern "C" uptr Hook##name(uptr next)\ {\ void* loc;\ uptr prev;\ __asm {lea eax, [name]}\ __asm {mov [loc], eax}\ __asm {mov eax, [eax]}\ __asm {mov [prev], eax}\ DWORD prot;\ VirtualProtect(loc, sizeof(uptr), PAGE_READWRITE, &prot);\ __asm {mov eax, [next]}\ __asm {mov [name], eax}\ VirtualProtect(loc, sizeof(uptr), prot, &prot);\ return prev;\ } HookStaticFunction(ConnectNamedPipe) HookStaticFunction(CreateEventW) HookStaticFunction(CreateFileW) HookStaticFunction(CreateIoCompletionPort) HookStaticFunction(CreateNamedPipeW) HookStaticFunction(CryptAcquireContextW) HookStaticFunction(CryptGetHashParam) HookStaticFunction(FormatMessageW) HookStaticFunction(GetComputerNameW) HookStaticFunction(GetDiskFreeSpaceExW) HookStaticFunction(GetFileSizeEx) HookStaticFunction(GetFullPathNameW) HookStaticFunction(GetModuleFileNameW) HookStaticFunction(GetStdHandle) HookStaticFunction(QueryPerformanceCounter) HookStaticFunction(QueryPerformanceFrequency) HookStaticFunction(QueueUserWorkItem) HookStaticFunction(ReadDirectoryChangesW); HookStaticFunction(ReadFile) HookStaticFunction(RegisterWaitForSingleObject) HookStaticFunction(SetupDiEnumDeviceInterfaces) HookStaticFunction(SetupDiGetClassDevsW) HookStaticFunction(SetupDiGetDeviceInterfaceDetailW) HookStaticFunction(SetEvent) HookStaticFunction(TerminateProcess) HookStaticFunction(UuidCreate) HookStaticFunction(WinUsb_Initialize) HookStaticFunction(WinUsb_ReadPipe) HookStaticFunction(WinUsb_WritePipe) HookStaticFunction(WSAAddressToStringW) HookStaticFunction(WSAEventSelect) HookStaticFunction(WSARecv) HookStaticFunction(WSASend) HookStaticFunction(WSAStartup) HookStaticFunction(WriteFile) HookStaticFunction(getpeername) HookStaticFunction(getsockname) HookStaticFunction(listen) HookStaticFunction(setsockopt) HookStaticFunction(socket) HookStaticFunction(timeGetTime)
36.626506
70
0.819079
becls
07abeda787829d35361a1f1ff0cf2f5494618887
290
hpp
C++
pythran/pythonic/include/omp/set_nested.hpp
xmar/pythran
dbf2e8b70ed1e4d4ac6b5f26ead4add940a72592
[ "BSD-3-Clause" ]
null
null
null
pythran/pythonic/include/omp/set_nested.hpp
xmar/pythran
dbf2e8b70ed1e4d4ac6b5f26ead4add940a72592
[ "BSD-3-Clause" ]
null
null
null
pythran/pythonic/include/omp/set_nested.hpp
xmar/pythran
dbf2e8b70ed1e4d4ac6b5f26ead4add940a72592
[ "BSD-3-Clause" ]
null
null
null
#ifndef PYTHONIC_INCLUDE_OMP_SET_NESTED_HPP #define PYTHONIC_INCLUDE_OMP_SET_NESTED_HPP #include <omp.h> #include "pythonic/include/utils/functor.hpp" namespace pythonic { namespace omp { void set_nested(long val); DECLARE_FUNCTOR(pythonic::omp, set_nested); } } #endif
14.5
47
0.762069
xmar
07ac42f03e495d5514cccd71b2a91d385c2790e7
830
cpp
C++
convolution/test/ntt.test.cpp
rsm9/cplib-cpp
269064381eb259a049236335abb31f8f73ded7f4
[ "MIT" ]
4
2020-05-13T05:06:22.000Z
2020-09-18T17:03:36.000Z
convolution/test/ntt.test.cpp
rsm9/cplib-cpp
269064381eb259a049236335abb31f8f73ded7f4
[ "MIT" ]
1
2019-12-11T13:53:17.000Z
2019-12-11T13:53:17.000Z
convolution/test/ntt.test.cpp
rsm9/cplib-cpp
269064381eb259a049236335abb31f8f73ded7f4
[ "MIT" ]
3
2019-12-11T06:45:45.000Z
2020-09-07T13:45:32.000Z
#define PROBLEM "https://judge.yosupo.jp/problem/convolution_mod" #include "../ntt.hpp" #include "../../modint.hpp" #include "../../number/modint_runtime.hpp" #include <iostream> using namespace std; constexpr int MOD = 998244353; using mint = ModInt<MOD>; using mintr = ModIntRuntime; int main() { cin.tie(nullptr), ios::sync_with_stdio(false); mintr::set_mod(MOD); int N, M; cin >> N >> M; vector<mint> A(N), B(M); vector<mintr> Ar(N), Br(M); for (int i = 0; i < N; i++) cin >> A[i], Ar[i] = A[i].val(); for (int i = 0; i < M; i++) cin >> B[i], Br[i] = B[i].val(); vector<mint> ret = nttconv(A, B); vector<mintr> retr = nttconv(Ar, Br); for (int i = 0; i < N + M - 1; i++) { assert(ret[i].val() == retr[i].val()); cout << ret[i] << ' '; } cout << '\n'; }
25.9375
65
0.543373
rsm9
07ade805a1e01f9d2aeb281d4a3f53b0dd02f27b
2,671
cpp
C++
src/ui/Dialog.cpp
tomasiser/pepr3d
5eaacd573c553e0e8eb79212842894bf32b5c666
[ "BSD-2-Clause" ]
128
2019-11-18T16:09:58.000Z
2022-01-15T03:59:51.000Z
src/ui/Dialog.cpp
tomasiser/pepr3d
5eaacd573c553e0e8eb79212842894bf32b5c666
[ "BSD-2-Clause" ]
3
2019-04-01T17:41:19.000Z
2020-07-23T08:55:08.000Z
src/ui/Dialog.cpp
tomasiser/pepr3d
5eaacd573c553e0e8eb79212842894bf32b5c666
[ "BSD-2-Clause" ]
31
2019-04-04T11:28:11.000Z
2022-03-14T08:52:38.000Z
#include "Dialog.h" namespace pepr3d { bool Dialog::draw() const { bool isAccepted = false; if(!ImGui::IsPopupOpen("##dialog")) { ImGui::OpenPopup("##dialog"); } ImGuiWindowFlags window_flags = 0; window_flags |= ImGuiWindowFlags_NoTitleBar; window_flags |= ImGuiWindowFlags_NoMove; window_flags |= ImGuiWindowFlags_NoResize; window_flags |= ImGuiWindowFlags_NoCollapse; window_flags |= ImGuiWindowFlags_NoNav; const ImGuiIO& io = ImGui::GetIO(); ImGui::SetNextWindowPos(ImVec2(io.DisplaySize.x / 2.0f, io.DisplaySize.y / 2.0f), ImGuiCond_Always, ImVec2(0.5f, 0.5f)); ImGui::SetNextWindowSize(ImVec2(400.0f, -1.0f)); ImGui::SetNextWindowBgAlpha(1.0f); ImGui::PushStyleColor(ImGuiCol_WindowBg, ci::ColorA::hex(0xFFFFFF)); ImGui::PushStyleColor(ImGuiCol_Border, ci::ColorA::hex(0xE5E5E5)); ImGui::PushStyleColor(ImGuiCol_Text, ci::ColorA::hex(0x1C2A35)); ImGui::PushStyleColor(ImGuiCol_Separator, ci::ColorA::hex(0xE5E5E5)); ImGui::PushStyleColor(ImGuiCol_Button, ci::ColorA::zero()); ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ci::ColorA::hex(0xCFD5DA)); ImGui::PushStyleColor(ImGuiCol_ButtonActive, ci::ColorA::hex(0xA3B2BF)); ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f); ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, glm::vec2(12.0f)); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, glm::vec2(8.0f, 6.0f)); if(ImGui::BeginPopupModal("##dialog", nullptr, window_flags)) { auto captionColor = ci::ColorA::hex(0xEB5757); // red if(mType == DialogType::Warning) { captionColor = ci::ColorA::hex(0xF2994A); // orange } else if(mType == DialogType::Information) { captionColor = ci::ColorA::hex(0x017BDA); // blue } ImGui::PushStyleColor(ImGuiCol_Text, captionColor); ImGui::TextWrapped(mCaption.c_str()); ImGui::PopStyleColor(); ImGui::Spacing(); ImGui::Separator(); ImGui::Spacing(); ImGui::TextWrapped(mMessage.c_str()); ImGui::Spacing(); ImGui::Separator(); ImGui::Spacing(); isAccepted = ImGui::Button(mAcceptButton.c_str(), glm::ivec2(ImGui::GetContentRegionAvailWidth(), 33)); ImGui::GetWindowDrawList()->AddRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax(), (ImColor)ci::ColorA::hex(0xE5E5E5)); if(isAccepted) { ImGui::CloseCurrentPopup(); } ImGui::EndPopup(); } ImGui::PopStyleVar(3); ImGui::PopStyleColor(7); return isAccepted; } } // namespace pepr3d
39.865672
111
0.649569
tomasiser
07b39443adf607ff4bc02b5186e4858ec5d009b6
1,273
cpp
C++
src/raw-cpp/src/states/level-state.cpp
guillaume-haerinck/RollGoal
c6f95fad3b042da5c537dc892f5879326074549a
[ "MIT" ]
6
2019-06-16T18:56:50.000Z
2020-07-11T01:53:51.000Z
src/raw-cpp/src/states/level-state.cpp
guillaume-haerinck/RollGoal
c6f95fad3b042da5c537dc892f5879326074549a
[ "MIT" ]
null
null
null
src/raw-cpp/src/states/level-state.cpp
guillaume-haerinck/RollGoal
c6f95fad3b042da5c537dc892f5879326074549a
[ "MIT" ]
2
2019-07-07T21:22:15.000Z
2020-03-25T16:01:33.000Z
#include "level-state.h" #include "systems/physic-system.h" #include "systems/render-system.h" #include "systems/input-system.h" LevelState::LevelState(Context context) : IState(STATE_LEVEL, context) { m_systems = { new PhysicSystem(*context.registry), new RenderSystem(*context.registry), new InputSystem(*context.registry, context.singletonComponentsId) }; } LevelState::~LevelState() { for (const auto system : m_systems) { delete system; } } ///////////////////////////////////////////////////////////////////////////// ////////////////////////////// PUBLIC METHODS /////////////////////////////// ///////////////////////////////////////////////////////////////////////////// void LevelState::onEnter() { m_lifeCycle = StateLifeCycle::HAS_ENTERED; } void LevelState::update() { for (const auto system : m_systems) { system->update(); } if (m_lifeCycle == StateLifeCycle::HAS_ENTERED) m_lifeCycle = StateLifeCycle::HAS_UPDATED; } void LevelState::onExit() { m_lifeCycle = StateLifeCycle::HAS_EXITED; } ///////////////////////////////////////////////////////////////////////////// //////////////////////////// GETTERS & SETTERS ////////////////////////////// /////////////////////////////////////////////////////////////////////////////
25.46
77
0.48154
guillaume-haerinck
07b5abd29b72cf8ae980b74807a8960950538081
951
cpp
C++
Source/SageChargeBar.cpp
Project2CITM/Proyecto2
a10c78fded2b226629a817c4e9cd46ed9e8b5bc8
[ "MIT" ]
2
2022-03-13T20:31:50.000Z
2022-03-28T06:43:45.000Z
Source/SageChargeBar.cpp
Project2CITM/The-last-purifier
e082e8ce6d6aa90b1d232cd9e15f4bec994556ed
[ "MIT" ]
null
null
null
Source/SageChargeBar.cpp
Project2CITM/The-last-purifier
e082e8ce6d6aa90b1d232cd9e15f4bec994556ed
[ "MIT" ]
null
null
null
#include "SageChargeBar.h" SageChargeBar::SageChargeBar(iPoint pos, int width, int height, int values[3], SDL_Color totalColor, SDL_Color currentColors[3]) : Bar(pos, width, height, values[0], totalColor, currentColors[0]) { totalValues[0] = values[0]; totalValues[1] = values[1]; totalValues[2] = values[2]; currentRectColors[0] = currentColors[0]; currentRectColors[1] = currentColors[1]; currentRectColors[2] = currentColors[2]; currentValueMaximum = 0; } void SageChargeBar::PreUpdate() { currentRectColor = currentRectColors[currentValueMaximum]; } void SageChargeBar::SetValue(int value) { this->currentValue = value; while (currentValue > totalValues[currentValueMaximum] && currentValueMaximum != 2) currentValueMaximum++; totalValue = totalValues[currentValueMaximum]; SetValuePercentage((float)currentValue / (float)totalValue); } void SageChargeBar::ResetValues() { currentValueMaximum = 0; this->currentValue = 0; }
25.702703
195
0.756046
Project2CITM
07be2b957c358e75c60d9b0ffa30e191b561a4b5
1,791
cpp
C++
Chapter-6-Functions/6.7-The-Return-Statement/Examples/6-11.cpp
jesushilarioh/C-Plus-Plus
bbff921460ac4267af48558f040c7d82ccf42d5e
[ "MIT" ]
3
2019-10-28T01:12:46.000Z
2021-10-16T09:16:31.000Z
Chapter-6-Functions/6.7-The-Return-Statement/Examples/6-11.cpp
jesushilarioh/C-Plus-Plus
bbff921460ac4267af48558f040c7d82ccf42d5e
[ "MIT" ]
null
null
null
Chapter-6-Functions/6.7-The-Return-Statement/Examples/6-11.cpp
jesushilarioh/C-Plus-Plus
bbff921460ac4267af48558f040c7d82ccf42d5e
[ "MIT" ]
4
2020-04-10T17:22:17.000Z
2021-11-04T14:34:00.000Z
//************************************************************** // This program uses a function to perform division. If division // by zero is detected, the function returns. // // by: Jesus Hilario Hernandez // last updated: November 2, 2016 //************************************************************** #include <iostream> using namespace std; // Function prototype. void divide(double, double); double inputVal(double); // For error Checking int main() { double num1, num2; cout << "Enter two numbers and I will divide the first\n"; cout << "number by the second number: "; num1 = inputVal(num1); num2 = inputVal(num2); divide(num1, num2); return 0; } //******************************************************************* // Definition of function divide. * // Uses two parameters: arg1 and arg2. The function divides arg1 * // by arg2 and shows the result. If arg2 is zero, however, the * // function returns. * //******************************************************************* void divide(double arg1, double arg2) { if (arg2 == 0.0) { cout << "Sorry, I cannot divide by zero.\n"; return; } cout << "The quotient is " << (arg1 / arg2) << endl; } //******************************************************************* // Function inputVal prompts the user to enter valid input data. * // In this case the double data type is accepted only. * //******************************************************************* double inputVal(double num) { while (!(cin >> num)) { cout << "I'm sorry a number must be entered: "; cin.clear(); cin.ignore(123, '\n'); } return num; }
30.355932
69
0.450586
jesushilarioh
07c0ff457ca4a60a79fbf0d6df9a8df269f87f42
411
cpp
C++
chapter-7/7.37.cpp
zero4drift/Cpp-Primer-5th-Exercises
d3d0f0d228e8c2c5a3b3fe1fd03ce34e0894e93f
[ "MIT" ]
null
null
null
chapter-7/7.37.cpp
zero4drift/Cpp-Primer-5th-Exercises
d3d0f0d228e8c2c5a3b3fe1fd03ce34e0894e93f
[ "MIT" ]
null
null
null
chapter-7/7.37.cpp
zero4drift/Cpp-Primer-5th-Exercises
d3d0f0d228e8c2c5a3b3fe1fd03ce34e0894e93f
[ "MIT" ]
null
null
null
#include <iostream> #include "Sales_data.hpp" using std::cin; Sales_data first_item(cin); // Sales_data(istream &is) {read(is, *this);} data members depend on cin int main() { Sales_data next; // Sales_data(string s = ""): bookNo(s) {} bookNo "", units_sold 0, revenue 0.0 Sales_data last("9-999-99999-9"); // Sales_data(string s = ""): bookNo(s) {} bookNo "9-999-99999-9", units_sold 0, revenue 0.0 }
31.615385
129
0.6691
zero4drift
07c3fc4540820ec5f4c605347750b2b7c4f550da
505
cpp
C++
Problems/Codeforces/CF-816B.cpp
zhugezy/giggle
dfa50744a9fd328678b75af8135bbd770f18a6ac
[ "MIT" ]
6
2019-10-12T15:14:10.000Z
2020-02-02T11:16:00.000Z
Problems/Codeforces/CF-816B.cpp
zhugezy/giggle
dfa50744a9fd328678b75af8135bbd770f18a6ac
[ "MIT" ]
73
2019-10-11T15:09:40.000Z
2020-09-15T07:49:24.000Z
Problems/Codeforces/CF-816B.cpp
zhugezy/giggle
dfa50744a9fd328678b75af8135bbd770f18a6ac
[ "MIT" ]
5
2019-10-14T02:57:39.000Z
2020-06-19T09:38:34.000Z
// 816B #include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; int n, k, q, l, r; int b[N], sum[N]; int main() { scanf("%d%d%d", &n, &k, &q); for (int i = 1; i <= n; ++i) { scanf("%d%d", &l, &r); b[l]++; b[r + 1]--; } int tot = 0; for (int i = 1; i <= 200000; ++i) { tot += b[i]; sum[i] = sum[i - 1]; if (tot >= k) sum[i]++; } for (int i = 1; i <= q; ++i) { scanf("%d%d", &l, &r); printf("%d\n", sum[r] - sum[l - 1]); } return 0; }
17.413793
40
0.4
zhugezy
07c689c64812600c527e6d8a38f716b433e8cff0
1,507
cpp
C++
src/utils/posix/spawn.cpp
scaryrawr/tofi
15b3757c4d492d5bbc7f57aef94f582549d2bef3
[ "MIT" ]
1
2020-08-03T18:57:01.000Z
2020-08-03T18:57:01.000Z
src/utils/posix/spawn.cpp
scaryrawr/tofi
15b3757c4d492d5bbc7f57aef94f582549d2bef3
[ "MIT" ]
1
2021-03-07T21:32:10.000Z
2021-03-08T13:56:10.000Z
src/utils/posix/spawn.cpp
scaryrawr/tofi
15b3757c4d492d5bbc7f57aef94f582549d2bef3
[ "MIT" ]
null
null
null
#include "utils/spawn.h" #include "utils/command.h" #include <vector> #include <sys/wait.h> #include <unistd.h> namespace tofi { bool spawn(Command command) { // Fork first child to start a new session pid_t pid{fork()}; if (0 == pid) { if (pid < 0) { exit(errno); } // Try getting a new session id. pid = setsid(); if (pid < 0) { exit(errno); } // Fork second child who shall live a very long life pid = fork(); if (0 == pid) { std::vector<char *> argv{command.argv.size() + 1, nullptr}; std::transform(std::begin(command.argv), std::end(command.argv), std::begin(argv), [](std::string &str) { return str.data(); }); // command should be the first argument in argv, otherwise certain apps won't run correctly execvp(argv[0], argv.data()); } // Exit success or failure for the first child. exit(pid > 0 ? 0 : errno); } if (pid < 0) { return false; } int stat{}; waitpid(pid, &stat, 0); // Oddly, even if we're "successful" here, we don't actually know what happened to the child we care about return WIFEXITED(stat) && 0 == WEXITSTATUS(stat); } } // namespace tofi
25.982759
121
0.474453
scaryrawr
07c77156c0c7ac935870303eed9006b25034cfde
5,755
cpp
C++
Src/Object.cpp
bDiazCentro/AlchemyFramework
6b55cdef1d0b9ddb4248382e44bbbfdb8320f062
[ "MIT" ]
null
null
null
Src/Object.cpp
bDiazCentro/AlchemyFramework
6b55cdef1d0b9ddb4248382e44bbbfdb8320f062
[ "MIT" ]
null
null
null
Src/Object.cpp
bDiazCentro/AlchemyFramework
6b55cdef1d0b9ddb4248382e44bbbfdb8320f062
[ "MIT" ]
null
null
null
#include "Object.hpp" #include <algorithm> #include "GameManager.hpp" #define VNAME(x) #x #pragma region CONSTRUCTORS Object::Object() { std::string name = "object"; int renameTry = 1; std::string nameComplement = ""; while (GameManager::Instance()->ReturnGameObjectByName(name + nameComplement) != nullptr) { nameComplement = " (" + std::to_string(renameTry++) + ")"; } objectName = name + nameComplement; AddComponent(ComponentType::TRANSFORM); } Object::Object(string name) { int renameTry = 1; std::string nameComplement = ""; while (GameManager::Instance()->ReturnGameObjectByName(name+nameComplement) != nullptr) { nameComplement = " ("+std::to_string(renameTry++)+")"; } objectName = name+nameComplement; AddComponent(ComponentType::TRANSFORM); GameManager::Instance()->AddGameObject(this); } #pragma endregion #pragma region SETTERS AND GETTERS string Object::ObjectName() { return objectName; } void Object::ObjectName(string name) { int renameTry = 1; std::string nameComplement = ""; while (GameManager::Instance()->ReturnGameObjectByName(name + nameComplement) != nullptr) { nameComplement = " (" + std::to_string(renameTry++) + ")"; } objectName = name+nameComplement; } #pragma endregion #pragma region OBJECT FUNCTIONS void Object::DebugObjectInfo() { cout << "- - - - - - - - - - - - - - - - - - - - - - - -" << endl; cout << "Object name: " << ObjectName().c_str() << endl << endl; for (int i = 0; i < components.size(); i++) { switch (componentType[i]) { case TRANSFORM: cout << "TRANSFORM INFO" << endl; components[i]->transform.Debug(); break; case SPRITE: cout << "SPRITE RENDERER INFO" << endl; components[i]->spriteRenderer.Debug(); break; case BOX_2D_COLLIDER: cout << "BOX 2D COLLIDER INFO" << endl; components[i]->box2dCollider.Debug(); break; case CIRCLE_COLLIDER: cout << "CIRCLE COLLIDER INFO" << endl; components[i]->circleCollider.Debug(); break; case CAMERA: cout << "CAMERA INFO" << endl; components[i]->cameraComponent.Debug(); break; default: break; } cout << endl; } } void Object::AddComponent(ComponentType type) { if (std::find(componentType.begin(), componentType.end(), type) != componentType.end()) { cout << "(" << objectName << ") already has a " << GetComponentName(type) << " component." << endl; return; } Component *component = new Component(); switch (type) { case ComponentType::TRANSFORM: new (&component->transform) TransformComponent(this); break; case ComponentType::SPRITE: new (&component->spriteRenderer) SpriteRendererComponent(this); objectHasSpriteComponent = true; break; case CIRCLE_COLLIDER: new (&component->circleCollider) CircleColliderComponent(this); break; case BOX_2D_COLLIDER: new (&component->box2dCollider) Box2dColliderComponent(this); break; case CAMERA: new (&component->cameraComponent) CameraComponent(this); break; default: cout << "(" << objectName << ") " << GetComponentName(type) << " component cannot be add to a gameObject object." << endl; break; } components.push_back(component); componentType.push_back(type); } void Object::RemoveComponent(ComponentType type) { if (TRANSFORM == type ) { cout << "(" << objectName << ") " << GetComponentName(type) << " component cannot be removed from object." << endl; return; } if (std::find(componentType.begin(), componentType.end(), type) != componentType.end()) { int index = GetIndex(type); components.erase(components.begin() + index); componentType.erase(componentType.begin() + index); if (type == SPRITE)objectHasSpriteComponent = false; } else { cout << "(" << objectName << ")" << " object doesn't have a " << GetComponentName(type) << " component to remove" << endl; } } void Object::Draw() { components[GetIndex(ComponentType::SPRITE)]->spriteRenderer.Draw(); } int Object::GetIndex(const ComponentType type) { return find(componentType.begin(), componentType.end(), type) - componentType.begin(); } Component *Object::GetComponent(const ComponentType type) { auto componentTypeIterator = std::find(componentType.cbegin(), componentType.cend(), type); for (int i = 0; i < componentType.size(); ++i) { if (componentType[i] == type) { return components[i]; } } cout << objectName << " object doesn't have a " << GetComponentName(type) << " component." << endl; return nullptr; } void Object::Update() { for (int i = 0; i < components.size(); i++) { switch (componentType[i]) { case TRANSFORM: components[i]->transform.Update(); break; case SPRITE: components[i]->spriteRenderer.Update(); break; case CIRCLE_COLLIDER: components[i]->circleCollider.Update(); break; case BOX_2D_COLLIDER: components[i]->box2dCollider.Update(); break; case CAMERA: components[i]->cameraComponent.Update(); break; default: break; } } } string Object::GetComponentName(ComponentType type) { switch (type) { case TRANSFORM: return "transform"; break; case SPRITE: return "sprite"; break; case CIRCLE_COLLIDER: return "circle collider"; break; case BOX_2D_COLLIDER: return "box 2d collider"; break; case CAMERA: return "camera"; break; default: break; } } void Object::SetVertexPoints(unsigned const int size, float *v_array) { vertexPoints = new float[size]; arraySizeInBytes = size * sizeof(float); numVertex = size / 3; for (int i = 0; i < size; i++) { vertexPoints[i] = v_array[i]; } } #pragma endregion
24.489362
125
0.647958
bDiazCentro
07ca4aaea898196be71b8e746e623b592a9056ad
3,111
cpp
C++
Source/Core/Elements/XMLNodeHandlerSelect.cpp
MatthiasJFM/RmlUi
557dfdbf76ca1397d72c70003081aae4f33b82d0
[ "MIT" ]
1,099
2019-05-11T07:04:26.000Z
2022-03-30T12:39:09.000Z
Source/Core/Elements/XMLNodeHandlerSelect.cpp
MatthiasJFM/RmlUi
557dfdbf76ca1397d72c70003081aae4f33b82d0
[ "MIT" ]
251
2019-05-07T08:35:47.000Z
2022-03-31T20:28:49.000Z
Source/Core/Elements/XMLNodeHandlerSelect.cpp
MatthiasJFM/RmlUi
557dfdbf76ca1397d72c70003081aae4f33b82d0
[ "MIT" ]
148
2019-07-08T14:46:04.000Z
2022-03-31T10:59:33.000Z
/* * This source file is part of RmlUi, the HTML/CSS Interface Middleware * * For the latest information, see http://github.com/mikke89/RmlUi * * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd * Copyright (c) 2019 The RmlUi Team, and contributors * * 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. * */ #include "XMLNodeHandlerSelect.h" #include "../../../Include/RmlUi/Core/Log.h" #include "../../../Include/RmlUi/Core/Factory.h" #include "../../../Include/RmlUi/Core/XMLParser.h" #include "../../../Include/RmlUi/Core/Elements/ElementFormControlSelect.h" namespace Rml { XMLNodeHandlerSelect::XMLNodeHandlerSelect() {} XMLNodeHandlerSelect::~XMLNodeHandlerSelect() {} Element* XMLNodeHandlerSelect::ElementStart(XMLParser* parser, const String& name, const XMLAttributes& attributes) { RMLUI_ASSERT(name == "select" || name == "option"); if (name == "select") { // Call this node handler for all children parser->PushHandler("select"); // Attempt to instance the tabset ElementPtr element = Factory::InstanceElement(parser->GetParseFrame()->element, name, name, attributes); ElementFormControlSelect* select_element = rmlui_dynamic_cast<ElementFormControlSelect*>(element.get()); if (!select_element) { Log::Message(Log::LT_ERROR, "Instancer failed to create element for tag %s.", name.c_str()); return nullptr; } // Add the Select element into the document Element* result = parser->GetParseFrame()->element->AppendChild(std::move(element)); return result; } else if (name == "option") { // Call default element handler for all children. parser->PushDefaultHandler(); ElementPtr option_element = Factory::InstanceElement(parser->GetParseFrame()->element, name, name, attributes); Element* result = nullptr; ElementFormControlSelect* select_element = rmlui_dynamic_cast<ElementFormControlSelect*>(parser->GetParseFrame()->element); if (select_element) { result = option_element.get(); select_element->Add(std::move(option_element)); } return result; } return nullptr; } } // namespace Rml
35.352273
125
0.739312
MatthiasJFM