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
1cbd40bcb66fa97295d9aa8d00ca9c9fbcd3c811
1,163
hpp
C++
higan/sfc/controller/controller.hpp
ameer-bauer/higan-097
a4a28968173ead8251cfa7cd6b5bf963ee68308f
[ "Info-ZIP" ]
3
2016-03-23T01:17:36.000Z
2019-10-25T06:41:09.000Z
higan/sfc/controller/controller.hpp
ameer-bauer/higan-097
a4a28968173ead8251cfa7cd6b5bf963ee68308f
[ "Info-ZIP" ]
null
null
null
higan/sfc/controller/controller.hpp
ameer-bauer/higan-097
a4a28968173ead8251cfa7cd6b5bf963ee68308f
[ "Info-ZIP" ]
null
null
null
// SNES controller port pinout: // ------------------------------- // | (1) (2) (3) (4) | (5) (6) (7) ) // ------------------------------- // pin name port1 port2 // 1: +5v // 2: clock $4016 read $4017 read // 3: latch $4016.d0 write $4016.d0 write // 4: data1 $4016.d0 read $4017.d0 read // 5: data2 $4016.d1 read $4017.d1 read // 6: iobit $4201.d6 write; $4213.d6 read $4201.d7 write; $4213.d7 read // 7: gnd struct Controller : Thread { enum : bool { Port1 = 0, Port2 = 1 }; Controller(bool port); static auto Enter() -> void; virtual auto enter() -> void; auto step(unsigned clocks) -> void; auto synchronizeCPU() -> void; auto iobit() -> bool; auto iobit(bool data) -> void; virtual auto data() -> uint2 { return 0; } virtual auto latch(bool data) -> void {} const bool port; }; #include "gamepad/gamepad.hpp" #include "multitap/multitap.hpp" #include "mouse/mouse.hpp" #include "superscope/superscope.hpp" #include "justifier/justifier.hpp" #include "usart/usart.hpp"
29.820513
81
0.517627
ameer-bauer
1cc82d801b9f1424e65d621a3e0e8fc020dc0117
882
cpp
C++
C++/problem1464.cpp
1050669722/LeetCode-Answers
c8f4d1ccaac09cda63b60d75144335347b06dc81
[ "MIT" ]
null
null
null
C++/problem1464.cpp
1050669722/LeetCode-Answers
c8f4d1ccaac09cda63b60d75144335347b06dc81
[ "MIT" ]
null
null
null
C++/problem1464.cpp
1050669722/LeetCode-Answers
c8f4d1ccaac09cda63b60d75144335347b06dc81
[ "MIT" ]
null
null
null
// class Solution { // public: // static bool cmp(int a, int b) // { // return a > b; // } // int maxProduct(vector<int>& nums) { // sort(nums.begin(), nums.end(), cmp); // return (nums[0] - 1) * (nums[1] - 1); // } // }; class Solution { public: int maxProduct(vector<int>& nums) { int max = nums[0], submax = 1; // vector<int>::iterator test = nums.begin() + 2; for (vector<int>::iterator it = ++nums.begin(); it < nums.end(); ++it) //有些迭代器不能做加法的原因是不支持,底层数据结构不支持那样的操作(这些数据结构不是实现在内存中不是连续的,所以不是RA[随机访问]的),可能并不是类型尺寸的问题; { if (*it > max) { submax = max; max = *it; } else if (*it <= max && *it > submax) { submax = *it; } } return (max - 1) * (submax - 1); } };
25.941176
162
0.441043
1050669722
1cc928e75a74953ba64f61bca33b3fc73614c19f
162
cpp
C++
src/classwork/01_assign/main.cpp
acc-cosc-1337-spring-2020/acc-cosc-1337-spring-2020-ChelliBean
9e2f45a1d9682f5c9391a594e1284c6beffd9f58
[ "MIT" ]
null
null
null
src/classwork/01_assign/main.cpp
acc-cosc-1337-spring-2020/acc-cosc-1337-spring-2020-ChelliBean
9e2f45a1d9682f5c9391a594e1284c6beffd9f58
[ "MIT" ]
null
null
null
src/classwork/01_assign/main.cpp
acc-cosc-1337-spring-2020/acc-cosc-1337-spring-2020-ChelliBean
9e2f45a1d9682f5c9391a594e1284c6beffd9f58
[ "MIT" ]
null
null
null
#include"output.h"//use file code that I created #include<iostream>// use standard library using std::cout; int main() { cout<<"Hello World!"; return 0; }
12.461538
48
0.679012
acc-cosc-1337-spring-2020
1cce7151dbb70ffb24ff24d4371c453a2d454913
3,333
cpp
C++
src/core/Input.cpp
pixelsquare/atom-engine
763ed2446107f4baccb4a652effdd58303852ae4
[ "MIT" ]
null
null
null
src/core/Input.cpp
pixelsquare/atom-engine
763ed2446107f4baccb4a652effdd58303852ae4
[ "MIT" ]
null
null
null
src/core/Input.cpp
pixelsquare/atom-engine
763ed2446107f4baccb4a652effdd58303852ae4
[ "MIT" ]
null
null
null
/* * Copyright (C) 2012 PixelSquareLabs - All Rights Reserved * * Created: 06/05/2018 * Author: Anthony Ganzon * Email: pixelsquarelabs@yahoo.com * pixelsquarelabs@gmail.com */ #include "Input.h" #include "StdC.h" #include "PlatformGL.h" ATOM_BEGIN void (*mousePtr)(int x, int y); void (*mouseDownPtr)(int x, int y); void (*mousePassivePtr)(int x, int y); bool keyHold[256]; bool mouseButton[3]; bool Input::GetKey(unsigned char key) { return keyHold[key]; } bool Input::GetSpecialKey(SpecialKey type) { return specialKeyHold[static_cast<int>(type)]; } bool Input::GetKeyDown(unsigned char key) { return keyDown[key]; } /* Private Functions */ void atomOnKeyDown(unsigned char key, int x, int y) { keyHold[key] = true; specialKeyHold[key] = false; inputKey = key; if(!isPressed) { keyDown[key] = true; } if(key == 27) { std::exit(1); } } void atomOnKeyHold(unsigned char key, int x, int y) { keyHold[key] = false; specialKeyHold[key] = false; isPressed = false; specialPressed = false; } void atomOnSpecialKey(int key, int x, int y) { if(!specialPressed) { specialKeyHold[key] = true; } inputSpecialKey = key; } void atomOnMouseButton(int button, int state, int x, int y) { bool pressed = (state == GLUT_DOWN) ? true : false; switch(button) { case GLUT_LEFT_BUTTON: { //editMode.mouseClick[0] = pressed; mouseButton[0] = pressed; break; } case GLUT_MIDDLE_BUTTON: { //editMode.mouseClick[1] = pressed; mouseButton[1] = pressed; break; } case GLUT_RIGHT_BUTTON: { //editMode.mouseClick[2] = pressed; mouseButton[2] = pressed; break; } default: break; } if(pressed && mouseDownPtr != NULL) { mouseDownPtr(x, y); } //if(pressed) //{ // RayPick(x, y); //} //if(inEditMode) // { // editMode.lastX = x; // editMode.lastY = y; //} } void atomOnMouseMove(int x, int y) { if(mousePtr != NULL) { mousePtr(x, y); } //if(inEditMode) // { // int diffX = x - editMode.lastX; // int diffY = y - editMode.lastY; // editMode.lastX = x; // editMode.lastY = y; // if(editMode.mouseClick[0]) // { // editMode.rotation.x += (float) 0.5f * diffY; // editMode.rotation.y += (float) 0.5f * diffX; // } // if(editMode.mouseClick[1]) // { // editMode.position.z -= (float) 0.5f * diffX; // } // if(editMode.mouseClick[2]) // { // editMode.position.x += (float) 0.05f * diffX; // editMode.position.y -= (float) 0.05f * diffY; // } //} } void atomOnPassiveMouse(int x, int y) { if(mousePassivePtr != NULL) { mousePassivePtr(x, y); } } /* End of Private functions*/ void atomMouseFunc( void(*func)(int x, int y) ) { mousePtr = func; } void atomMouseDownFunc( void(*func)(int x, int y) ) { mouseDownPtr = func; } void atomPassiveMouseFunc( void(*func)(int x, int y) ) { mousePassivePtr = func; } bool GetMouseDown(MouseType type) { return mouseButton[static_cast<int>(type)]; } ATOM_END
18.414365
61
0.563756
pixelsquare
1cd240e2bc97c431a30e18912baccb00632fab33
6,452
cpp
C++
src/ui/WaterfallDialog.cpp
tlmrgvf/drtd
bf31747b963673797239cb11cd45c1c1ee4aeaa6
[ "BSD-2-Clause" ]
6
2020-07-11T11:16:18.000Z
2021-12-17T23:30:36.000Z
src/ui/WaterfallDialog.cpp
tlmrgvf/drtd
bf31747b963673797239cb11cd45c1c1ee4aeaa6
[ "BSD-2-Clause" ]
9
2020-07-03T21:23:50.000Z
2022-02-15T12:56:16.000Z
src/ui/WaterfallDialog.cpp
tlmrgvf/drtd
bf31747b963673797239cb11cd45c1c1ee4aeaa6
[ "BSD-2-Clause" ]
null
null
null
/* BSD 2-Clause License Copyright (c) 2020, Till Mayer All rights reserved. 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. 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 "WaterfallDialog.hpp" #include <Drtd.hpp> #include <sstream> #include <ui/MainGui.hpp> #include <util/Singleton.hpp> #include <util/Util.hpp> using namespace Ui; const std::array s_bins { "1024", "2048", "4096", "8192", "16384", "32768", "65536" }; WaterfallDialog::WaterfallDialog() : Fl_Window(100, 100, 360, 204, "Waterfall settings") , m_window(85, 4, 0, 25, "Window:") , m_zoom(m_window.x(), m_window.y() + m_window.h() + 4, w() - m_window.x() - 24, 25, "Zoom:") , m_reset_zoom(m_zoom.x() + m_zoom.w() + 4, m_zoom.y(), 15, m_zoom.h(), "R") , m_bin_offset(m_window.x(), m_zoom.y() + m_zoom.h() + 4, 150, 25, "Offset (Hz):") , m_speed_multiplier(m_window.x(), m_bin_offset.y() + m_bin_offset.h() + 4, w() - m_window.x() - 4, 25, "Speed:") , m_bins(m_window.x(), m_speed_multiplier.y() + m_speed_multiplier.h() + 4, 150, 25, "Bins:") , m_palette(m_window.x(), m_bins.y() + m_bins.h() + 4, 0, 25, "Palette:") , m_power_spectrum(m_window.x(), m_palette.y() + m_palette.h() + 4, 180, 25, "Show power spectrum") { double max_width = 0; for (auto& window : Dsp::Window::s_windows) { m_window.add(window.name().c_str()); max_width = std::max(fl_width(window.name().c_str()), max_width); } m_window.size(static_cast<int>(max_width + 40), m_window.h()); m_window.align(FL_ALIGN_LEFT); m_window.callback(save_to_waterfall); m_zoom.type(FL_HOR_NICE_SLIDER); m_zoom.selection_color(Util::s_amber_color); m_zoom.align(FL_ALIGN_LEFT); m_zoom.bounds(s_min_zoom, s_max_zoom); m_zoom.callback(save_to_waterfall); m_reset_zoom.callback([](Fl_Widget*, void*) { s_waterfall_dialog->m_zoom.value(0); save_to_waterfall(nullptr, nullptr); }); m_bin_offset.align(FL_ALIGN_LEFT); m_bin_offset.callback(save_to_waterfall); m_speed_multiplier.type(FL_HOR_NICE_SLIDER); m_speed_multiplier.selection_color(Util::s_amber_color); m_speed_multiplier.align(FL_ALIGN_LEFT); m_speed_multiplier.callback(save_to_waterfall); m_speed_multiplier.bounds(0, 10); m_bins.align(FL_ALIGN_LEFT); for (auto bins : s_bins) m_bins.add(bins); m_bins.callback(save_to_waterfall); max_width = 0; for (auto& palette : Ui::Palette::palettes()) { m_palette.add(palette.name); max_width = std::max(fl_width(palette.name), max_width); } m_palette.size(static_cast<int>(max_width + 40), m_palette.h()); m_palette.callback(save_to_waterfall); m_power_spectrum.callback(save_to_waterfall); } void WaterfallDialog::show_dialog() { auto& main_gui = Drtd::main_gui(); s_waterfall_dialog->position( main_gui.x() + Util::center(main_gui.w(), s_waterfall_dialog->w()), main_gui.y() + Util::center(main_gui.h(), s_waterfall_dialog->h())); s_waterfall_dialog->load_from_waterfall(Drtd::main_gui().waterfall().settings()); s_waterfall_dialog->set_non_modal(); s_waterfall_dialog->show(); } void WaterfallDialog::save_to_waterfall(Fl_Widget*, void*) { Waterfall::Settings new_settings; auto& waterfall = Drtd::main_gui().waterfall(); new_settings.zoom = static_cast<float>(s_waterfall_dialog->m_zoom.value()); new_settings.speed_multiplier = static_cast<u8>(s_waterfall_dialog->m_speed_multiplier.value()); new_settings.bins = std::atoi(s_bins[static_cast<u32>(s_waterfall_dialog->m_bins.value())]); new_settings.power_spectrum = static_cast<bool>(s_waterfall_dialog->m_power_spectrum.value()); s_waterfall_dialog->update_offset_spinner_limits(new_settings); new_settings.bin_offset = static_cast<u32>(Waterfall::translate_hz_to_x(new_settings, static_cast<Hertz>(s_waterfall_dialog->m_bin_offset.value()), waterfall.sample_rate())); waterfall.set_window_index(static_cast<u8>(s_waterfall_dialog->m_window.value())); waterfall.set_palette_index(static_cast<u8>(s_waterfall_dialog->m_palette.value())); waterfall.update_settings_later(new_settings); } void WaterfallDialog::update_offset_spinner_limits(const Waterfall::Settings& settings) { auto& waterfall = Drtd::main_gui().waterfall(); m_bin_offset.step(Waterfall::hz_per_bin(settings, waterfall.sample_rate())); m_bin_offset.range(0, waterfall.sample_rate() / 2); } void WaterfallDialog::load_from_waterfall(const Waterfall::Settings& settings) { if (!s_waterfall_dialog.has_instance()) return; auto& waterfall = Drtd::main_gui().waterfall(); s_waterfall_dialog->m_window.value(waterfall.window_index()); s_waterfall_dialog->m_zoom.value(settings.zoom); s_waterfall_dialog->m_speed_multiplier.value(settings.speed_multiplier); s_waterfall_dialog->update_offset_spinner_limits(settings); s_waterfall_dialog->m_bin_offset.value(Waterfall::translate_x_to_hz(settings, settings.bin_offset, waterfall.sample_rate())); s_waterfall_dialog->m_bins.value(s_waterfall_dialog->m_bins.find_item(std::to_string(settings.bins).c_str())); s_waterfall_dialog->m_palette.value(waterfall.palette_index()); s_waterfall_dialog->m_power_spectrum.value(settings.power_spectrum); }
44.496552
178
0.734656
tlmrgvf
1cd43a448911fbd04fe83949b42db9d78d125efa
816
cpp
C++
LeetCodeSolutions/LeetCode_0340.cpp
lih627/python-algorithm-templates
a61fd583e33a769b44ab758990625d3381793768
[ "MIT" ]
24
2020-03-28T06:10:25.000Z
2021-11-23T05:01:29.000Z
LeetCodeSolutions/LeetCode_0340.cpp
lih627/python-algorithm-templates
a61fd583e33a769b44ab758990625d3381793768
[ "MIT" ]
null
null
null
LeetCodeSolutions/LeetCode_0340.cpp
lih627/python-algorithm-templates
a61fd583e33a769b44ab758990625d3381793768
[ "MIT" ]
8
2020-05-18T02:43:16.000Z
2021-05-24T18:11:38.000Z
class Solution { public: int lengthOfLongestSubstringKDistinct(string s, int k) { unordered_map<char, int> counter; int ret = 0; int tmp = 0; for(int i = 0; i < s.size(); ++i){ char &c = s[i]; ++counter[c]; ++tmp; if(counter.size() <= k){ ret = max(ret, tmp); } if(counter.size() == k + 1){ int st = i - tmp + 1; while(counter.size() > k){ char key = s[st]; --counter[key]; --tmp; if(counter[key] == 0){ counter.erase(counter.find(key)); } ++st; } } } return ret; } };
28.137931
60
0.344363
lih627
1cde9554045fac17fee74ce98256b8f38e00a5f0
1,779
cpp
C++
src/owlVulkan/core/descriptor_set_layout.cpp
auperes/owl_engine
6da8b48b1caf6cf9f224f1a1d5df59461e83ce9a
[ "MIT" ]
null
null
null
src/owlVulkan/core/descriptor_set_layout.cpp
auperes/owl_engine
6da8b48b1caf6cf9f224f1a1d5df59461e83ce9a
[ "MIT" ]
null
null
null
src/owlVulkan/core/descriptor_set_layout.cpp
auperes/owl_engine
6da8b48b1caf6cf9f224f1a1d5df59461e83ce9a
[ "MIT" ]
null
null
null
#include "descriptor_set_layout.h" #include <array> #include "vulkan_helpers.h" namespace owl::vulkan::core { descriptor_set_layout::descriptor_set_layout(const std::shared_ptr<logical_device>& logical_device) : _logical_device(logical_device) { VkDescriptorSetLayoutBinding uniform_layout_binding{}; uniform_layout_binding.binding = 0; uniform_layout_binding.descriptorCount = 1; uniform_layout_binding.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; uniform_layout_binding.pImmutableSamplers = nullptr; uniform_layout_binding.stageFlags = VK_SHADER_STAGE_VERTEX_BIT; VkDescriptorSetLayoutBinding sampler_layout_binding{}; sampler_layout_binding.binding = 1; sampler_layout_binding.descriptorCount = 1; sampler_layout_binding.descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; sampler_layout_binding.pImmutableSamplers = nullptr; sampler_layout_binding.stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT; std::array<VkDescriptorSetLayoutBinding, 2> bindings = {uniform_layout_binding, sampler_layout_binding}; VkDescriptorSetLayoutCreateInfo layout_info{}; layout_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO; layout_info.bindingCount = static_cast<uint32_t>(bindings.size()); layout_info.pBindings = bindings.data(); auto result = vkCreateDescriptorSetLayout(_logical_device->get_vk_handle(), &layout_info, nullptr, &_vk_handle); helpers::handle_result(result, "Failed to create descriptor set layout"); } descriptor_set_layout::~descriptor_set_layout() { vkDestroyDescriptorSetLayout(_logical_device->get_vk_handle(), _vk_handle, nullptr); } } // namespace owl::vulkan
46.815789
140
0.767285
auperes
1ce1d9e1c2bc974a6eb73a02948038db7a816bfc
842
cpp
C++
UAlbertaBot/Source/strategies/zerg/ThreeHatchScourge.cpp
kant2002/ualbertabot
b4c75be8bf023f289f2e58e49ad600a9bda38fcd
[ "MIT" ]
2
2017-07-06T18:27:41.000Z
2018-03-14T06:19:43.000Z
UAlbertaBot/Source/strategies/zerg/ThreeHatchScourge.cpp
kant2002/ualbertabot
b4c75be8bf023f289f2e58e49ad600a9bda38fcd
[ "MIT" ]
18
2017-10-29T20:37:47.000Z
2019-08-25T16:01:28.000Z
UAlbertaBot/Source/strategies/zerg/ThreeHatchScourge.cpp
kant2002/ualbertabot
b4c75be8bf023f289f2e58e49ad600a9bda38fcd
[ "MIT" ]
1
2017-09-13T07:02:23.000Z
2017-09-13T07:02:23.000Z
#include "ThreeHatchScourge.h" #include "..\..\UnitUtil.h" using UAlbertaBot::MetaPairVector; using UAlbertaBot::MetaPair; using UAlbertaBot::UnitUtil::GetAllUnitCount; AKBot::ThreeHatchScourge::ThreeHatchScourge(BWAPI::Player self): _self(self) { } void AKBot::ThreeHatchScourge::getBuildOrderGoal(MetaPairVector& goal, int currentFrame) const { int numDrones = GetAllUnitCount(_self, BWAPI::UnitTypes::Zerg_Drone); int numScourge = GetAllUnitCount(_self, BWAPI::UnitTypes::Zerg_Scourge); int numHydras = GetAllUnitCount(_self, BWAPI::UnitTypes::Zerg_Hydralisk); if (numScourge > 40) { goal.push_back(MetaPair(BWAPI::UnitTypes::Zerg_Hydralisk, numHydras + 12)); } else { goal.push_back(MetaPair(BWAPI::UnitTypes::Zerg_Scourge, numScourge + 12)); } goal.push_back(MetaPair(BWAPI::UnitTypes::Zerg_Drone, numDrones + 4)); }
28.066667
94
0.766033
kant2002
1cec3f6a74dc297e4082b3694dede3711fc066db
2,729
cc
C++
source/common/http/conn_pool_base.cc
jaricftw/envoy
766f3fb8dbdafce402631c43c16fda46ed003462
[ "Apache-2.0" ]
1
2021-12-10T23:58:57.000Z
2021-12-10T23:58:57.000Z
source/common/http/conn_pool_base.cc
jaricftw/envoy
766f3fb8dbdafce402631c43c16fda46ed003462
[ "Apache-2.0" ]
30
2022-02-17T02:28:37.000Z
2022-03-31T02:31:02.000Z
source/common/http/conn_pool_base.cc
jaricftw/envoy
766f3fb8dbdafce402631c43c16fda46ed003462
[ "Apache-2.0" ]
1
2019-11-03T03:46:51.000Z
2019-11-03T03:46:51.000Z
#include "common/http/conn_pool_base.h" namespace Envoy { namespace Http { ConnPoolImplBase::PendingRequest::PendingRequest(ConnPoolImplBase& parent, StreamDecoder& decoder, ConnectionPool::Callbacks& callbacks) : parent_(parent), decoder_(decoder), callbacks_(callbacks) { parent_.host_->cluster().stats().upstream_rq_pending_total_.inc(); parent_.host_->cluster().stats().upstream_rq_pending_active_.inc(); parent_.host_->cluster().resourceManager(parent_.priority_).pendingRequests().inc(); } ConnPoolImplBase::PendingRequest::~PendingRequest() { parent_.host_->cluster().stats().upstream_rq_pending_active_.dec(); parent_.host_->cluster().resourceManager(parent_.priority_).pendingRequests().dec(); } ConnectionPool::Cancellable* ConnPoolImplBase::newPendingRequest(StreamDecoder& decoder, ConnectionPool::Callbacks& callbacks) { ENVOY_LOG(debug, "queueing request due to no available connections"); PendingRequestPtr pending_request(new PendingRequest(*this, decoder, callbacks)); pending_request->moveIntoList(std::move(pending_request), pending_requests_); return pending_requests_.front().get(); } void ConnPoolImplBase::purgePendingRequests( const Upstream::HostDescriptionConstSharedPtr& host_description, absl::string_view failure_reason) { // NOTE: We move the existing pending requests to a temporary list. This is done so that // if retry logic submits a new request to the pool, we don't fail it inline. pending_requests_to_purge_ = std::move(pending_requests_); while (!pending_requests_to_purge_.empty()) { PendingRequestPtr request = pending_requests_to_purge_.front()->removeFromList(pending_requests_to_purge_); host_->cluster().stats().upstream_rq_pending_failure_eject_.inc(); request->callbacks_.onPoolFailure(ConnectionPool::PoolFailureReason::ConnectionFailure, failure_reason, host_description); } } void ConnPoolImplBase::onPendingRequestCancel(PendingRequest& request) { ENVOY_LOG(debug, "cancelling pending request"); if (!pending_requests_to_purge_.empty()) { // If pending_requests_to_purge_ is not empty, it means that we are called from // with-in a onPoolFailure callback invoked in purgePendingRequests (i.e. purgePendingRequests // is down in the call stack). Remove this request from the list as it is cancelled, // and there is no need to call its onPoolFailure callback. request.removeFromList(pending_requests_to_purge_); } else { request.removeFromList(pending_requests_); } host_->cluster().stats().upstream_rq_cancelled_.inc(); checkForDrained(); } } // namespace Http } // namespace Envoy
46.254237
99
0.751557
jaricftw
1cec87866a9ada7ac611ed3a82cc35c828bd8104
7,002
cpp
C++
YorozuyaGSLib/source/_dh_mission_mgrDetail.cpp
lemkova/Yorozuya
f445d800078d9aba5de28f122cedfa03f26a38e4
[ "MIT" ]
29
2017-07-01T23:08:31.000Z
2022-02-19T10:22:45.000Z
YorozuyaGSLib/source/_dh_mission_mgrDetail.cpp
kotopes/Yorozuya
605c97d3a627a8f6545cc09f2a1b0a8afdedd33a
[ "MIT" ]
90
2017-10-18T21:24:51.000Z
2019-06-06T02:30:33.000Z
YorozuyaGSLib/source/_dh_mission_mgrDetail.cpp
kotopes/Yorozuya
605c97d3a627a8f6545cc09f2a1b0a8afdedd33a
[ "MIT" ]
44
2017-12-19T08:02:59.000Z
2022-02-24T23:15:01.000Z
#include <_dh_mission_mgrDetail.hpp> #include <common/ATFCore.hpp> START_ATF_NAMESPACE namespace Detail { Info::_dh_mission_mgrGetLimMSecTime2_ptr _dh_mission_mgrGetLimMSecTime2_next(nullptr); Info::_dh_mission_mgrGetLimMSecTime2_clbk _dh_mission_mgrGetLimMSecTime2_user(nullptr); Info::_dh_mission_mgrGetMissionCont4_ptr _dh_mission_mgrGetMissionCont4_next(nullptr); Info::_dh_mission_mgrGetMissionCont4_clbk _dh_mission_mgrGetMissionCont4_user(nullptr); Info::_dh_mission_mgrInit6_ptr _dh_mission_mgrInit6_next(nullptr); Info::_dh_mission_mgrInit6_clbk _dh_mission_mgrInit6_user(nullptr); Info::_dh_mission_mgrIsOpenPortal8_ptr _dh_mission_mgrIsOpenPortal8_next(nullptr); Info::_dh_mission_mgrIsOpenPortal8_clbk _dh_mission_mgrIsOpenPortal8_user(nullptr); Info::_dh_mission_mgrNextMission10_ptr _dh_mission_mgrNextMission10_next(nullptr); Info::_dh_mission_mgrNextMission10_clbk _dh_mission_mgrNextMission10_user(nullptr); Info::_dh_mission_mgrOpenPortal12_ptr _dh_mission_mgrOpenPortal12_next(nullptr); Info::_dh_mission_mgrOpenPortal12_clbk _dh_mission_mgrOpenPortal12_user(nullptr); Info::_dh_mission_mgrSearchCurMissionCont14_ptr _dh_mission_mgrSearchCurMissionCont14_next(nullptr); Info::_dh_mission_mgrSearchCurMissionCont14_clbk _dh_mission_mgrSearchCurMissionCont14_user(nullptr); Info::_dh_mission_mgrctor__dh_mission_mgr16_ptr _dh_mission_mgrctor__dh_mission_mgr16_next(nullptr); Info::_dh_mission_mgrctor__dh_mission_mgr16_clbk _dh_mission_mgrctor__dh_mission_mgr16_user(nullptr); unsigned int _dh_mission_mgrGetLimMSecTime2_wrapper(struct _dh_mission_mgr* _this) { return _dh_mission_mgrGetLimMSecTime2_user(_this, _dh_mission_mgrGetLimMSecTime2_next); }; struct _dh_mission_mgr::_if_change* _dh_mission_mgrGetMissionCont4_wrapper(struct _dh_mission_mgr* _this, struct _dh_mission_setup* pMsSetup) { return _dh_mission_mgrGetMissionCont4_user(_this, pMsSetup, _dh_mission_mgrGetMissionCont4_next); }; void _dh_mission_mgrInit6_wrapper(struct _dh_mission_mgr* _this) { _dh_mission_mgrInit6_user(_this, _dh_mission_mgrInit6_next); }; bool _dh_mission_mgrIsOpenPortal8_wrapper(struct _dh_mission_mgr* _this, int nIndex) { return _dh_mission_mgrIsOpenPortal8_user(_this, nIndex, _dh_mission_mgrIsOpenPortal8_next); }; void _dh_mission_mgrNextMission10_wrapper(struct _dh_mission_mgr* _this, struct _dh_mission_setup* pNextMssionPtr) { _dh_mission_mgrNextMission10_user(_this, pNextMssionPtr, _dh_mission_mgrNextMission10_next); }; void _dh_mission_mgrOpenPortal12_wrapper(struct _dh_mission_mgr* _this, int nIndex) { _dh_mission_mgrOpenPortal12_user(_this, nIndex, _dh_mission_mgrOpenPortal12_next); }; struct _dh_mission_mgr::_if_change* _dh_mission_mgrSearchCurMissionCont14_wrapper(struct _dh_mission_mgr* _this) { return _dh_mission_mgrSearchCurMissionCont14_user(_this, _dh_mission_mgrSearchCurMissionCont14_next); }; void _dh_mission_mgrctor__dh_mission_mgr16_wrapper(struct _dh_mission_mgr* _this) { _dh_mission_mgrctor__dh_mission_mgr16_user(_this, _dh_mission_mgrctor__dh_mission_mgr16_next); }; ::std::array<hook_record, 8> _dh_mission_mgr_functions = { _hook_record { (LPVOID)0x14026ef40L, (LPVOID *)&_dh_mission_mgrGetLimMSecTime2_user, (LPVOID *)&_dh_mission_mgrGetLimMSecTime2_next, (LPVOID)cast_pointer_function(_dh_mission_mgrGetLimMSecTime2_wrapper), (LPVOID)cast_pointer_function((unsigned int(_dh_mission_mgr::*)())&_dh_mission_mgr::GetLimMSecTime) }, _hook_record { (LPVOID)0x14026f220L, (LPVOID *)&_dh_mission_mgrGetMissionCont4_user, (LPVOID *)&_dh_mission_mgrGetMissionCont4_next, (LPVOID)cast_pointer_function(_dh_mission_mgrGetMissionCont4_wrapper), (LPVOID)cast_pointer_function((struct _dh_mission_mgr::_if_change*(_dh_mission_mgr::*)(struct _dh_mission_setup*))&_dh_mission_mgr::GetMissionCont) }, _hook_record { (LPVOID)0x14026ed50L, (LPVOID *)&_dh_mission_mgrInit6_user, (LPVOID *)&_dh_mission_mgrInit6_next, (LPVOID)cast_pointer_function(_dh_mission_mgrInit6_wrapper), (LPVOID)cast_pointer_function((void(_dh_mission_mgr::*)())&_dh_mission_mgr::Init) }, _hook_record { (LPVOID)0x14026f4a0L, (LPVOID *)&_dh_mission_mgrIsOpenPortal8_user, (LPVOID *)&_dh_mission_mgrIsOpenPortal8_next, (LPVOID)cast_pointer_function(_dh_mission_mgrIsOpenPortal8_wrapper), (LPVOID)cast_pointer_function((bool(_dh_mission_mgr::*)(int))&_dh_mission_mgr::IsOpenPortal) }, _hook_record { (LPVOID)0x14026efc0L, (LPVOID *)&_dh_mission_mgrNextMission10_user, (LPVOID *)&_dh_mission_mgrNextMission10_next, (LPVOID)cast_pointer_function(_dh_mission_mgrNextMission10_wrapper), (LPVOID)cast_pointer_function((void(_dh_mission_mgr::*)(struct _dh_mission_setup*))&_dh_mission_mgr::NextMission) }, _hook_record { (LPVOID)0x1400c2d10L, (LPVOID *)&_dh_mission_mgrOpenPortal12_user, (LPVOID *)&_dh_mission_mgrOpenPortal12_next, (LPVOID)cast_pointer_function(_dh_mission_mgrOpenPortal12_wrapper), (LPVOID)cast_pointer_function((void(_dh_mission_mgr::*)(int))&_dh_mission_mgr::OpenPortal) }, _hook_record { (LPVOID)0x14026f580L, (LPVOID *)&_dh_mission_mgrSearchCurMissionCont14_user, (LPVOID *)&_dh_mission_mgrSearchCurMissionCont14_next, (LPVOID)cast_pointer_function(_dh_mission_mgrSearchCurMissionCont14_wrapper), (LPVOID)cast_pointer_function((struct _dh_mission_mgr::_if_change*(_dh_mission_mgr::*)())&_dh_mission_mgr::SearchCurMissionCont) }, _hook_record { (LPVOID)0x14026eb70L, (LPVOID *)&_dh_mission_mgrctor__dh_mission_mgr16_user, (LPVOID *)&_dh_mission_mgrctor__dh_mission_mgr16_next, (LPVOID)cast_pointer_function(_dh_mission_mgrctor__dh_mission_mgr16_wrapper), (LPVOID)cast_pointer_function((void(_dh_mission_mgr::*)())&_dh_mission_mgr::ctor__dh_mission_mgr) }, }; }; // end namespace Detail END_ATF_NAMESPACE
54.703125
163
0.699372
lemkova
1ced9b79f8b3dd329e525472b67c8ebea77b2953
32,862
cpp
C++
plugins/CaptureTheFlag.cpp
PsychoLogicAu/GPUSteer
99c23f0e27468b964207d65758612ade7d7c4892
[ "MIT" ]
null
null
null
plugins/CaptureTheFlag.cpp
PsychoLogicAu/GPUSteer
99c23f0e27468b964207d65758612ade7d7c4892
[ "MIT" ]
null
null
null
plugins/CaptureTheFlag.cpp
PsychoLogicAu/GPUSteer
99c23f0e27468b964207d65758612ade7d7c4892
[ "MIT" ]
null
null
null
// ---------------------------------------------------------------------------- // // // OpenSteer -- Steering Behaviors for Autonomous Characters // // Copyright (c) 2002-2003, Sony Computer Entertainment America // Original author: Craig Reynolds <craig_reynolds@playstation.sony.com> // // 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. // // // ---------------------------------------------------------------------------- // // // Capture the Flag (a portion of the traditional game) // // The "Capture the Flag" sample steering problem, proposed by Marcin // Chady of the Working Group on Steering of the IGDA's AI Interface // Standards Committee (http://www.igda.org/Committees/ai.htm) in this // message (http://sourceforge.net/forum/message.php?msg_id=1642243): // // "An agent is trying to reach a physical location while trying // to stay clear of a group of enemies who are actively seeking // him. The environment is littered with obstacles, so collision // avoidance is also necessary." // // Note that the enemies do not make use of their knowledge of the // seeker's goal by "guarding" it. // // XXX hmm, rename them "attacker" and "defender"? // // 08-12-02 cwr: created // // // ---------------------------------------------------------------------------- #include <iomanip> #include <sstream> #include "OpenSteer/SimpleVehicle.h" #include "OpenSteer/OpenSteerDemo.h" using namespace OpenSteer; // ---------------------------------------------------------------------------- // short names for STL vectors (iterators) of SphericalObstacle pointers typedef std::vector<SphericalObstacle*> SOG; // spherical obstacle group typedef SOG::const_iterator SOI; // spherical obstacle iterator // ---------------------------------------------------------------------------- // This PlugIn uses two vehicle types: CtfSeeker and CtfEnemy. They have a // common base class: CtfBase which is a specialization of SimpleVehicle. class CtfBase : public SimpleVehicle { public: // constructor CtfBase () {reset ();} // reset state void reset (void); // draw this character/vehicle into the scene void draw (void); // annotate when actively avoiding obstacles void annotateAvoidObstacle (const float minDistanceToCollision); void drawHomeBase (void); void randomizeStartingPositionAndHeading (void); enum seekerState {running, tagged, atGoal}; // for draw method float3 bodyColor; // xxx store steer sub-state for anotation bool avoiding; // dynamic obstacle registry static void initializeObstacles (void); static void addOneObstacle (void); static void removeOneObstacle (void); float minDistanceToObstacle (const float3 point); static int obstacleCount; static const int maxObstacleCount; static SOG allObstacles; }; class CtfSeeker : public CtfBase { public: // constructor CtfSeeker () {reset ();} // reset state void reset (void); // per frame simulation update void update (const float currentTime, const float elapsedTime); // is there a clear path to the goal? bool clearPathToGoal (void); float3 steeringForSeeker (void); void updateState (const float currentTime); void draw (void); float3 steerToEvadeAllDefenders (void); float3 XXXsteerToEvadeAllDefenders (void); void adjustObstacleAvoidanceLookAhead (const bool clearPath); void clearPathAnnotation (const float threshold, const float behindcThreshold, const float3& goalDirection); seekerState state; bool evading; // xxx store steer sub-state for anotation float lastRunningTime; // for auto-reset }; class CtfEnemy : public CtfBase { public: // constructor CtfEnemy () {reset ();} // reset state void reset (void); // per frame simulation update void update (const float currentTime, const float elapsedTime); }; // ---------------------------------------------------------------------------- // globals // (perhaps these should be member variables of a Vehicle or PlugIn class) const int CtfBase::maxObstacleCount = 100; const float3 gHomeBaseCenter = make_float3(0, 0, 0); const float gHomeBaseRadius = 1.5; const float gMinStartRadius = 30; const float gMaxStartRadius = 40; const float gBrakingRate = 0.75; const float3 evadeColor = make_float3(0.6f, 0.6f, 0.3f); // annotation const float3 seekColor = make_float3(0.3f, 0.6f, 0.6f); // annotation const float3 clearPathColor = make_float3(0.3f, 0.6f, 0.3f); // annotation const float gAvoidancePredictTimeMin = 0.9f; const float gAvoidancePredictTimeMax = 2; float gAvoidancePredictTime = gAvoidancePredictTimeMin; bool enableAttackSeek = true; // for testing (perhaps retain for UI control?) bool enableAttackEvade = true; // for testing (perhaps retain for UI control?) CtfSeeker* gSeeker = NULL; // count the number of times the simulation has reset (e.g. for overnight runs) int resetCount = 0; // ---------------------------------------------------------------------------- // state for OpenSteerDemo PlugIn // // XXX consider moving this inside CtfPlugIn // XXX consider using STL (any advantage? consistency?) CtfSeeker* ctfSeeker; const int ctfEnemyCount = 1000; CtfEnemy* ctfEnemies [ctfEnemyCount]; // ---------------------------------------------------------------------------- // reset state void CtfBase::reset (void) { SimpleVehicle::reset (); // reset the vehicle setSpeed (3); // speed along Forward direction. setMaxForce (3.0); // steering force is clipped to this magnitude setMaxSpeed (3.0); // velocity is clipped to this magnitude avoiding = false; // not actively avoiding randomizeStartingPositionAndHeading (); // new starting position clearTrailHistory (); // prevent long streaks due to teleportation } void CtfSeeker::reset (void) { CtfBase::reset (); bodyColor = make_float3(0.4f, 0.4f, 0.6f); // blueish gSeeker = this; state = running; evading = false; setPosition(float3_scalar_multiply(position(), 2.0f)); } void CtfEnemy::reset (void) { CtfBase::reset (); bodyColor = make_float3(0.6f, 0.4f, 0.4f); // redish } // ---------------------------------------------------------------------------- // draw this character/vehicle into the scene void CtfBase::draw (void) { drawBasic2dCircularVehicle (*this, bodyColor); drawTrail (); } // ---------------------------------------------------------------------------- void CtfBase::randomizeStartingPositionAndHeading (void) { // randomize position on a ring between inner and outer radii // centered around the home base const float rRadius = frandom2 (gMinStartRadius, gMaxStartRadius); const float3 randomOnRing = float3_scalar_multiply(float3_RandomUnitVectorOnXZPlane (), rRadius); setPosition (float3_add(gHomeBaseCenter, randomOnRing)); // are we are too close to an obstacle? if (minDistanceToObstacle (position()) < radius()*5) { // if so, retry the randomization (this recursive call may not return // if there is too little free space) randomizeStartingPositionAndHeading (); } else { // otherwise, if the position is OK, randomize 2D heading randomizeHeadingOnXZPlane (); } } // ---------------------------------------------------------------------------- void CtfEnemy::update (const float currentTime, const float elapsedTime) { // determine upper bound for pursuit prediction time const float seekerToGoalDist = float3_distance(gHomeBaseCenter, gSeeker->position()); const float adjustedDistance = seekerToGoalDist - radius()-gHomeBaseRadius; const float seekerToGoalTime = ((adjustedDistance < 0 ) ? 0 : (adjustedDistance/gSeeker->speed())); const float maxPredictionTime = seekerToGoalTime * 0.9f; // determine steering (pursuit, obstacle avoidance, or braking) float3 steer = make_float3(0, 0, 0); if (gSeeker->state == running) { const float3 avoidance = steerToAvoidObstacles (*this, gAvoidancePredictTimeMin, (ObstacleGroup&) allObstacles); // saved for annotation avoiding = float3_equals(avoidance, float3_zero()); if (avoiding) steer = steerForPursuit (*this, *gSeeker, maxPredictionTime); else steer = avoidance; } else { applyBrakingForce (gBrakingRate, elapsedTime); } applySteeringForce (steer, elapsedTime); // annotation annotationVelocityAcceleration (); recordTrailVertex (currentTime, position()); // detect and record interceptions ("tags") of seeker const float seekerToMeDist = float3_distance (position(), gSeeker->position()); const float sumOfRadii = radius() + gSeeker->radius(); if (seekerToMeDist < sumOfRadii) { if (gSeeker->state == running) gSeeker->state = tagged; // annotation: if (gSeeker->state == tagged) { const float3 color = make_float3(0.8f, 0.5f, 0.5f); annotationXZDisk (sumOfRadii, float3_scalar_divide(float3_add(position(), gSeeker->position()), 2), color, 20); } } } // ---------------------------------------------------------------------------- // are there any enemies along the corridor between us and the goal? bool CtfSeeker::clearPathToGoal (void) { const float sideThreshold = radius() * 8.0f; const float behindThreshold = radius() * 2.0f; const float3 goalOffset = float3_subtract(gHomeBaseCenter, position()); const float goalDistance = float3_length(goalOffset); const float3 goalDirection = float3_scalar_divide(goalOffset, goalDistance); const bool goalIsAside = isAside (*this, gHomeBaseCenter, 0.5); // for annotation: loop over all and save result, instead of early return bool xxxReturn = true; // loop over enemies for (int i = 0; i < ctfEnemyCount; i++) { // short name for this enemy const CtfEnemy& e = *ctfEnemies[i]; const float eDistance = float3_distance (position(), e.position()); const float timeEstimate = 0.3f * eDistance / e.speed(); //xxx const float3 eFuture = e.predictFuturePosition (timeEstimate); const float3 eOffset = float3_subtract(eFuture, position()); const float alongCorridor = float3_dot(goalDirection, eOffset); const bool inCorridor = ((alongCorridor > -behindThreshold) && (alongCorridor < goalDistance)); const float eForwardDistance = float3_dot(forward(), eOffset); // xxx temp move this up before the conditionals annotationXZCircle (e.radius(), eFuture, clearPathColor, 20); //xxx // consider as potential blocker if within the corridor if (inCorridor) { const float3 perp = float3_subtract(eOffset, float3_scalar_multiply(goalDirection, alongCorridor)); const float acrossCorridor = float3_length(perp); if (acrossCorridor < sideThreshold) { // not a blocker if behind us and we are perp to corridor const float eFront = eForwardDistance + e.radius (); //annotationLine (position, forward*eFront, gGreen); // xxx //annotationLine (e.position, forward*eFront, gGreen); // xxx // xxx // std::ostringstream message; // message << "eFront = " << std::setprecision(2) // << std::setiosflags(std::ios::fixed) << eFront << std::ends; // draw2dTextAt3dLocation (*message.str(), eFuture, gWhite); const bool eIsBehind = eFront < -behindThreshold; const bool eIsWayBehind = eFront < (-2 * behindThreshold); const bool safeToTurnTowardsGoal = ((eIsBehind && goalIsAside) || eIsWayBehind); if (! safeToTurnTowardsGoal) { // this enemy blocks the path to the goal, so return false annotationLine (position(), e.position(), clearPathColor); // return false; xxxReturn = false; } } } } // no enemies found along path, return true to indicate path is clear // clearPathAnnotation (sideThreshold, behindThreshold, goalDirection); // return true; if (xxxReturn) clearPathAnnotation (sideThreshold, behindThreshold, goalDirection); return xxxReturn; } // ---------------------------------------------------------------------------- void CtfSeeker::clearPathAnnotation (const float sideThreshold, const float behindThreshold, const float3& goalDirection) { const float3 behindSide = float3_scalar_multiply(side(), sideThreshold); const float3 behindBack = float3_scalar_multiply(forward(), -behindThreshold); const float3 pbb = float3_add(position(), behindBack); const float3 gun = localRotateForwardToSide (goalDirection); const float3 gn = float3_scalar_multiply(gun, sideThreshold); const float3 hbc = gHomeBaseCenter; annotationLine (float3_add(pbb, gn), float3_add(hbc, gn), clearPathColor); annotationLine (float3_subtract(pbb, gn), float3_subtract(hbc, gn), clearPathColor); annotationLine (float3_subtract(hbc, gn), float3_add(hbc, gn), clearPathColor); annotationLine (float3_subtract(pbb, behindSide), float3_add(pbb, behindSide), clearPathColor); } // ---------------------------------------------------------------------------- // xxx perhaps this should be a call to a general purpose annotation // xxx for "local xxx axis aligned box in XZ plane" -- same code in in // xxx Pedestrian.cpp void CtfBase::annotateAvoidObstacle (const float minDistanceToCollision) { const float3 boxSide = float3_scalar_multiply(side(), radius()); const float3 boxFront = float3_scalar_multiply(forward(), minDistanceToCollision); const float3 FR = float3_subtract(float3_add(position(), boxFront), boxSide); const float3 FL = float3_add(float3_add(position(), boxFront), boxSide); const float3 BR = float3_subtract(position(), boxSide); const float3 BL = float3_add(position(), boxSide); const float3 white = make_float3(1,1,1); annotationLine (FR, FL, white); annotationLine (FL, BL, white); annotationLine (BL, BR, white); annotationLine (BR, FR, white); } // ---------------------------------------------------------------------------- float3 CtfSeeker::steerToEvadeAllDefenders (void) { float3 evade = float3_zero(); const float goalDistance = float3_distance(gHomeBaseCenter, position()); // sum up weighted evasion for (int i = 0; i < ctfEnemyCount; i++) { const CtfEnemy& e = *ctfEnemies[i]; const float3 eOffset = float3_subtract(e.position(), position()); const float eDistance = float3_length(eOffset); const float eForwardDistance = float3_dot(forward(), eOffset); const float behindThreshold = radius() * 2; const bool behind = eForwardDistance < behindThreshold; if ((!behind) || (eDistance < 5)) { if (eDistance < (goalDistance * 1.2)) //xxx { const float timeEstimate = 0.5f * eDistance / e.speed();//xxx //const float timeEstimate = 0.15f * eDistance / e.speed();//xxx const float3 future = e.predictFuturePosition (timeEstimate); annotationXZCircle (e.radius(), future, evadeColor, 20); // xxx const float3 offset = float3_subtract(future, position()); const float3 lateral = float3_perpendicularComponent(offset, forward()); const float d = float3_length(lateral); const float weight = -1000 / (d * d); evade = float3_add(evade, float3_scalar_multiply(float3_scalar_divide(lateral, d), weight)); } } } return evade; } float3 CtfSeeker::XXXsteerToEvadeAllDefenders (void) { // sum up weighted evasion float3 evade = float3_zero(); for (int i = 0; i < ctfEnemyCount; i++) { const CtfEnemy& e = *ctfEnemies[i]; const float3 eOffset = float3_subtract(e.position(), position()); const float eDistance = float3_length(eOffset); // xxx maybe this should take into account e's heading? xxx // TODO: just that :) const float timeEstimate = 0.5f * eDistance / e.speed(); //xxx const float3 eFuture = e.predictFuturePosition (timeEstimate); // annotation annotationXZCircle (e.radius(), eFuture, evadeColor, 20); // steering to flee from eFuture (enemy's future position) const float3 flee = xxxsteerForFlee (*this, eFuture); const float eForwardDistance = float3_dot(forward(), eOffset); const float behindThreshold = radius() * -2; const float distanceWeight = 4 / eDistance; const float forwardWeight = ((eForwardDistance > behindThreshold) ? 1.0f : 0.5f); const float3 adjustedFlee = float3_scalar_multiply(flee, distanceWeight * forwardWeight); evade = float3_add(evade, adjustedFlee); } return evade; } // ---------------------------------------------------------------------------- float3 CtfSeeker::steeringForSeeker (void) { // determine if obstacle avodiance is needed const bool clearPath = clearPathToGoal (); adjustObstacleAvoidanceLookAhead (clearPath); const float3 obstacleAvoidance = steerToAvoidObstacles (*this, gAvoidancePredictTime, (ObstacleGroup&) allObstacles); // saved for annotation avoiding = !float3_equals(obstacleAvoidance, float3_zero()); if (avoiding) { // use pure obstacle avoidance if needed return obstacleAvoidance; } else { // otherwise seek home base and perhaps evade defenders const float3 seek = xxxsteerForSeek (*this, gHomeBaseCenter); if (clearPath) { // we have a clear path (defender-free corridor), use pure seek // xxx experiment 9-16-02 float3 s = limitMaxDeviationAngle (seek, 0.707f, forward()); annotationLine (position(), float3_add(position(), float3_scalar_multiply(s, 0.2f)), seekColor); return s; } else { if (1) // xxx testing new evade code xxx { // combine seek and (forward facing portion of) evasion const float3 evade = steerToEvadeAllDefenders (); const float3 steer = float3_add(seek, limitMaxDeviationAngle (evade, 0.5f, forward())); // annotation: show evasion steering force annotationLine (position(), float3_add(position(), float3_scalar_multiply(steer, 0.2f)), evadeColor); return steer; } else { const float3 evade = XXXsteerToEvadeAllDefenders (); const float3 steer = limitMaxDeviationAngle (float3_add(seek, evade), 0.707f, forward()); annotationLine (position(),float3_add(position(),seek), gRed); annotationLine (position(),float3_add(position(),evade), gGreen); // annotation: show evasion steering force annotationLine (position(),float3_add(position(),float3_scalar_multiply(steer,0.2f)),evadeColor); return steer; } } } } // ---------------------------------------------------------------------------- // adjust obstacle avoidance look ahead time: make it large when we are far // from the goal and heading directly towards it, make it small otherwise. void CtfSeeker::adjustObstacleAvoidanceLookAhead (const bool clearPath) { if (clearPath) { evading = false; const float goalDistance = float3_distance(gHomeBaseCenter,position()); const bool headingTowardGoal = isAhead (*this, gHomeBaseCenter, 0.98f); const bool isNear = (goalDistance/speed()) < gAvoidancePredictTimeMax; const bool useMax = headingTowardGoal && !isNear; gAvoidancePredictTime = (useMax ? gAvoidancePredictTimeMax : gAvoidancePredictTimeMin); } else { evading = true; gAvoidancePredictTime = gAvoidancePredictTimeMin; } } // ---------------------------------------------------------------------------- void CtfSeeker::updateState (const float currentTime) { // if we reach the goal before being tagged, switch to atGoal state if (state == running) { const float baseDistance = float3_distance(position(),gHomeBaseCenter); if (baseDistance < (radius() + gHomeBaseRadius)) state = atGoal; } // update lastRunningTime (holds off reset time) if (state == running) { lastRunningTime = currentTime; } else { const float resetDelay = 4; const float resetTime = lastRunningTime + resetDelay; if (currentTime > resetTime) { // xxx a royal hack (should do this internal to CTF): OpenSteerDemo::queueDelayedResetPlugInXXX (); } } } // ---------------------------------------------------------------------------- void CtfSeeker::draw (void) { // first call the draw method in the base class CtfBase::draw(); // select string describing current seeker state char* seekerStateString = ""; switch (state) { case running: if (avoiding) seekerStateString = "avoid obstacle"; else if (evading) seekerStateString = "seek and evade"; else seekerStateString = "seek goal"; break; case tagged: seekerStateString = "tagged"; break; case atGoal: seekerStateString = "reached goal"; break; } // annote seeker with its state as text const float3 textOrigin = float3_add(position(), make_float3(0, 0.25, 0)); std::ostringstream annote; annote << seekerStateString << std::endl; annote << std::setprecision(2) << std::setiosflags(std::ios::fixed) << speed() << std::ends; draw2dTextAt3dLocation (annote, textOrigin, gWhite); // display status in the upper left corner of the window std::ostringstream status; status << seekerStateString << std::endl; status << obstacleCount << " obstacles [F1/F2]" << std::endl; status << "position: " << position().x << ", " << position().z << std::endl; status << resetCount << " restarts" << std::ends; const float h = drawGetWindowHeight (); const float3 screenLocation = make_float3(10, h-50, 0); draw2dTextAt2dLocation (status, screenLocation, gGray80); } // ---------------------------------------------------------------------------- // update method for goal seeker void CtfSeeker::update (const float currentTime, const float elapsedTime) { // do behavioral state transitions, as needed updateState (currentTime); // determine and apply steering/braking forces float3 steer = make_float3(0, 0, 0); if (state == running) { steer = steeringForSeeker (); } else { applyBrakingForce (gBrakingRate, elapsedTime); } applySteeringForce (steer, elapsedTime); // annotation annotationVelocityAcceleration (); recordTrailVertex (currentTime, position()); } // ---------------------------------------------------------------------------- // dynamic obstacle registry // // xxx need to combine guts of addOneObstacle and minDistanceToObstacle, // xxx perhaps by having the former call the latter, or change the latter to // xxx be "nearestObstacle": give it a position, it finds the nearest obstacle // xxx (but remember: obstacles a not necessarilty spheres!) int CtfBase::obstacleCount = -1; // this value means "uninitialized" SOG CtfBase::allObstacles; #define testOneObstacleOverlap(radius, center) \ { \ float d = float3_distance (c, center); \ float clearance = d - (r + (radius)); \ if (minClearance > clearance) minClearance = clearance; \ } void CtfBase::initializeObstacles (void) { // start with 40% of possible obstacles if (obstacleCount == -1) { obstacleCount = 0; for (int i = 0; i < (maxObstacleCount * 0.4); i++) addOneObstacle (); } } void CtfBase::addOneObstacle (void) { if (obstacleCount < maxObstacleCount) { // pick a random center and radius, // loop until no overlap with other obstacles and the home base float r; float3 c; float minClearance; const float requiredClearance = gSeeker->radius() * 4; // 2 x diameter do { r = frandom2 (1.5, 4); c = float3_scalar_multiply(float3_randomVectorOnUnitRadiusXZDisk(), gMaxStartRadius * 1.1f); minClearance = FLT_MAX; for (SOI so = allObstacles.begin(); so != allObstacles.end(); so++) { testOneObstacleOverlap ((**so).radius, (**so).center); } testOneObstacleOverlap (gHomeBaseRadius - requiredClearance, gHomeBaseCenter); } while (minClearance < requiredClearance); // add new non-overlapping obstacle to registry allObstacles.push_back (new SphericalObstacle (r, c)); obstacleCount++; } } float CtfBase::minDistanceToObstacle (const float3 point) { float r = 0; float3 c = point; float minClearance = FLT_MAX; for (SOI so = allObstacles.begin(); so != allObstacles.end(); so++) { testOneObstacleOverlap ((**so).radius, (**so).center); } return minClearance; } void CtfBase::removeOneObstacle (void) { if (obstacleCount > 0) { obstacleCount--; allObstacles.pop_back(); } } // ---------------------------------------------------------------------------- // PlugIn for OpenSteerDemo class CtfPlugIn : public PlugIn { public: const char* name (void) {return "Capture the Flag";} float selectionOrderSortKey (void) {return 0.01f;} virtual ~CtfPlugIn() {} // be more "nice" to avoid a compiler warning void open (void) { // create the seeker ("hero"/"attacker") ctfSeeker = new CtfSeeker; all.push_back (ctfSeeker); // create the specified number of enemies, // storing pointers to them in an array. for (int i = 0; i<ctfEnemyCount; i++) { ctfEnemies[i] = new CtfEnemy; all.push_back (ctfEnemies[i]); } // initialize camera OpenSteerDemo::init2dCamera (*ctfSeeker); OpenSteerDemo::camera.mode = Camera::cmFixedDistanceOffset; OpenSteerDemo::camera.fixedTarget = make_float3(15, 0, 0); OpenSteerDemo::camera.fixedPosition = make_float3(80, 60, 0); CtfBase::initializeObstacles (); } void update (const float currentTime, const float elapsedTime) { // update the seeker ctfSeeker->update (currentTime, elapsedTime); // update each enemy for (int i = 0; i < ctfEnemyCount; i++) { ctfEnemies[i]->update (currentTime, elapsedTime); } } void redraw (const float currentTime, const float elapsedTime) { // selected vehicle (user can mouse click to select another) AbstractVehicle& selected = *OpenSteerDemo::selectedVehicle; // vehicle nearest mouse (to be highlighted) AbstractVehicle& nearMouse = *OpenSteerDemo::vehicleNearestToMouse (); // update camera OpenSteerDemo::updateCamera (currentTime, elapsedTime, selected); // draw "ground plane" centered between base and selected vehicle const float3 goalOffset = float3_subtract(gHomeBaseCenter, OpenSteerDemo::camera.position()); const float3 goalDirection = float3_normalize(goalOffset); const float3 cameraForward = OpenSteerDemo::camera.xxxls().forward(); const float goalDot = float3_dot(cameraForward, goalDirection); const float blend = remapIntervalClip (goalDot, 1, 0, 0.5, 0); const float3 gridCenter = interpolate (blend, selected.position(), gHomeBaseCenter); OpenSteerDemo::gridUtility (gridCenter); // draw the seeker, obstacles and home base ctfSeeker->draw(); drawObstacles (); drawHomeBase(); // draw each enemy for (int i = 0; i < ctfEnemyCount; i++) ctfEnemies[i]->draw (); // highlight vehicle nearest mouse OpenSteerDemo::highlightVehicleUtility (nearMouse); } void close (void) { // delete seeker delete (ctfSeeker); ctfSeeker = NULL; // delete each enemy for (int i = 0; i < ctfEnemyCount; i++) { delete (ctfEnemies[i]); ctfEnemies[i] = NULL; } // clear the group of all vehicles all.clear(); } void reset (void) { // count resets resetCount++; // reset the seeker ("hero"/"attacker") and enemies ctfSeeker->reset (); for (int i = 0; i<ctfEnemyCount; i++) ctfEnemies[i]->reset (); // reset camera position OpenSteerDemo::position2dCamera (*ctfSeeker); // make camera jump immediately to new position OpenSteerDemo::camera.doNotSmoothNextMove (); } void handleFunctionKeys (int keyNumber) { switch (keyNumber) { case 1: CtfBase::addOneObstacle (); break; case 2: CtfBase::removeOneObstacle (); break; } } void printMiniHelpForFunctionKeys (void) { std::ostringstream message; message << "Function keys handled by "; message << '"' << name() << '"' << ':' << std::ends; OpenSteerDemo::printMessage (message); OpenSteerDemo::printMessage (" F1 add one obstacle."); OpenSteerDemo::printMessage (" F2 remove one obstacle."); OpenSteerDemo::printMessage (""); } const AVGroup& allVehicles (void) {return (const AVGroup&) all;} void drawHomeBase (void) { const float3 up = make_float3(0, 0.01f, 0); const float3 atColor = make_float3(0.3f, 0.3f, 0.5f); const float3 noColor = gGray50; const bool reached = ctfSeeker->state == CtfSeeker::atGoal; const float3 baseColor = (reached ? atColor : noColor); drawXZDisk (gHomeBaseRadius, gHomeBaseCenter, baseColor, 40); drawXZDisk (gHomeBaseRadius/15, float3_add(gHomeBaseCenter, up), gBlack, 20); } void drawObstacles (void) { const float3 color = make_float3(0.8f, 0.6f, 0.4f); const SOG& allSO = CtfBase::allObstacles; for (SOI so = allSO.begin(); so != allSO.end(); so++) { drawXZCircle ((**so).radius, (**so).center, color, 40); } } // a group (STL vector) of all vehicles in the PlugIn std::vector<CtfBase*> all; }; CtfPlugIn gCtfPlugIn; // ----------------------------------------------------------------------------
34.124611
121
0.603493
PsychoLogicAu
1cee2ff8ee63ba51aec389c7f3406455fdd7a3e5
892
hpp
C++
SDK/ARKSurvivalEvolved_StructureSettings_BrokenByPlasma_classes.hpp
2bite/ARK-SDK
c38ca9925309516b2093ad8c3a70ed9489e1d573
[ "MIT" ]
10
2020-02-17T19:08:46.000Z
2021-07-31T11:07:19.000Z
SDK/ARKSurvivalEvolved_StructureSettings_BrokenByPlasma_classes.hpp
2bite/ARK-SDK
c38ca9925309516b2093ad8c3a70ed9489e1d573
[ "MIT" ]
9
2020-02-17T18:15:41.000Z
2021-06-06T19:17:34.000Z
SDK/ARKSurvivalEvolved_StructureSettings_BrokenByPlasma_classes.hpp
2bite/ARK-SDK
c38ca9925309516b2093ad8c3a70ed9489e1d573
[ "MIT" ]
3
2020-07-22T17:42:07.000Z
2021-06-19T17:16:13.000Z
#pragma once // ARKSurvivalEvolved (329.9) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "ARKSurvivalEvolved_StructureSettings_BrokenByPlasma_structs.hpp" namespace sdk { //--------------------------------------------------------------------------- //Classes //--------------------------------------------------------------------------- // BlueprintGeneratedClass StructureSettings_BrokenByPlasma.StructureSettings_BrokenByPlasma_C // 0x0000 (0x0050 - 0x0050) class UStructureSettings_BrokenByPlasma_C : public UStructureSettings_BrokenByExplosives_C { public: static UClass* StaticClass() { static auto ptr = UObject::FindClass("BlueprintGeneratedClass StructureSettings_BrokenByPlasma.StructureSettings_BrokenByPlasma_C"); return ptr; } void ExecuteUbergraph_StructureSettings_BrokenByPlasma(int EntryPoint); }; } #ifdef _MSC_VER #pragma pack(pop) #endif
22.871795
134
0.676009
2bite
1cf155d7cd0580a126aa817059e5ad5c89fdbcbd
21,127
cxx
C++
SimModel_Python_API/simmodel_swig/SimModel_Dll_lib/framework/SimRoot.cxx
EnEff-BIM/EnEffBIM-Framework
6328d39b498dc4065a60b5cc9370b8c2a9a1cddf
[ "MIT" ]
3
2016-05-30T15:12:16.000Z
2022-03-22T08:11:13.000Z
SimModel_Python_API/simmodel_swig/SimModel_Dll_lib/framework/SimRoot.cxx
EnEff-BIM/EnEffBIM-Framework
6328d39b498dc4065a60b5cc9370b8c2a9a1cddf
[ "MIT" ]
21
2016-06-13T11:33:45.000Z
2017-05-23T09:46:52.000Z
SimModel_Python_API/simmodel_swig/SimModel_Dll_lib/framework/SimRoot.cxx
EnEff-BIM/EnEffBIM-Framework
6328d39b498dc4065a60b5cc9370b8c2a9a1cddf
[ "MIT" ]
null
null
null
// Copyright (c) 2005-2014 Code Synthesis Tools CC // // This program was generated by CodeSynthesis XSD, an XML Schema to // C++ data binding compiler. // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as // published by the Free Software Foundation. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // // In addition, as a special exception, Code Synthesis Tools CC gives // permission to link this program with the Xerces-C++ library (or with // modified versions of Xerces-C++ that use the same license as Xerces-C++), // and distribute linked combinations including the two. You must obey // the GNU General Public License version 2 in all respects for all of // the code used other than Xerces-C++. If you modify this copy of the // program, you may extend this exception to your version of the program, // but you are not obligated to do so. If you do not wish to do so, delete // this exception statement from your version. // // Furthermore, Code Synthesis Tools CC makes a special exception for // the Free/Libre and Open Source Software (FLOSS) which is described // in the accompanying FLOSSE file. // // Begin prologue. // // // End prologue. #include <xsd/cxx/pre.hxx> #include "SimRoot.hxx" namespace schema { namespace simxml { namespace SimModelCore { // SimRoot // const SimRoot::Description_optional& SimRoot:: Description () const { return this->Description_; } SimRoot::Description_optional& SimRoot:: Description () { return this->Description_; } void SimRoot:: Description (const Description_type& x) { this->Description_.set (x); } void SimRoot:: Description (const Description_optional& x) { this->Description_ = x; } void SimRoot:: Description (::std::auto_ptr< Description_type > x) { this->Description_.set (x); } const SimRoot::ObjectOwnerHistory_optional& SimRoot:: ObjectOwnerHistory () const { return this->ObjectOwnerHistory_; } SimRoot::ObjectOwnerHistory_optional& SimRoot:: ObjectOwnerHistory () { return this->ObjectOwnerHistory_; } void SimRoot:: ObjectOwnerHistory (const ObjectOwnerHistory_type& x) { this->ObjectOwnerHistory_.set (x); } void SimRoot:: ObjectOwnerHistory (const ObjectOwnerHistory_optional& x) { this->ObjectOwnerHistory_ = x; } void SimRoot:: ObjectOwnerHistory (::std::auto_ptr< ObjectOwnerHistory_type > x) { this->ObjectOwnerHistory_.set (x); } const SimRoot::IfcGlobalID_optional& SimRoot:: IfcGlobalID () const { return this->IfcGlobalID_; } SimRoot::IfcGlobalID_optional& SimRoot:: IfcGlobalID () { return this->IfcGlobalID_; } void SimRoot:: IfcGlobalID (const IfcGlobalID_type& x) { this->IfcGlobalID_.set (x); } void SimRoot:: IfcGlobalID (const IfcGlobalID_optional& x) { this->IfcGlobalID_ = x; } void SimRoot:: IfcGlobalID (::std::auto_ptr< IfcGlobalID_type > x) { this->IfcGlobalID_.set (x); } const SimRoot::IfcName_optional& SimRoot:: IfcName () const { return this->IfcName_; } SimRoot::IfcName_optional& SimRoot:: IfcName () { return this->IfcName_; } void SimRoot:: IfcName (const IfcName_type& x) { this->IfcName_.set (x); } void SimRoot:: IfcName (const IfcName_optional& x) { this->IfcName_ = x; } void SimRoot:: IfcName (::std::auto_ptr< IfcName_type > x) { this->IfcName_.set (x); } const SimRoot::SimUniqueID_optional& SimRoot:: SimUniqueID () const { return this->SimUniqueID_; } SimRoot::SimUniqueID_optional& SimRoot:: SimUniqueID () { return this->SimUniqueID_; } void SimRoot:: SimUniqueID (const SimUniqueID_type& x) { this->SimUniqueID_.set (x); } void SimRoot:: SimUniqueID (const SimUniqueID_optional& x) { this->SimUniqueID_ = x; } void SimRoot:: SimUniqueID (::std::auto_ptr< SimUniqueID_type > x) { this->SimUniqueID_.set (x); } const SimRoot::SimModelType_optional& SimRoot:: SimModelType () const { return this->SimModelType_; } SimRoot::SimModelType_optional& SimRoot:: SimModelType () { return this->SimModelType_; } void SimRoot:: SimModelType (const SimModelType_type& x) { this->SimModelType_.set (x); } void SimRoot:: SimModelType (const SimModelType_optional& x) { this->SimModelType_ = x; } void SimRoot:: SimModelType (::std::auto_ptr< SimModelType_type > x) { this->SimModelType_.set (x); } const SimRoot::SimModelSubtype_optional& SimRoot:: SimModelSubtype () const { return this->SimModelSubtype_; } SimRoot::SimModelSubtype_optional& SimRoot:: SimModelSubtype () { return this->SimModelSubtype_; } void SimRoot:: SimModelSubtype (const SimModelSubtype_type& x) { this->SimModelSubtype_.set (x); } void SimRoot:: SimModelSubtype (const SimModelSubtype_optional& x) { this->SimModelSubtype_ = x; } void SimRoot:: SimModelSubtype (::std::auto_ptr< SimModelSubtype_type > x) { this->SimModelSubtype_.set (x); } const SimRoot::SimModelName_optional& SimRoot:: SimModelName () const { return this->SimModelName_; } SimRoot::SimModelName_optional& SimRoot:: SimModelName () { return this->SimModelName_; } void SimRoot:: SimModelName (const SimModelName_type& x) { this->SimModelName_.set (x); } void SimRoot:: SimModelName (const SimModelName_optional& x) { this->SimModelName_ = x; } void SimRoot:: SimModelName (::std::auto_ptr< SimModelName_type > x) { this->SimModelName_.set (x); } const SimRoot::SourceModelSchema_optional& SimRoot:: SourceModelSchema () const { return this->SourceModelSchema_; } SimRoot::SourceModelSchema_optional& SimRoot:: SourceModelSchema () { return this->SourceModelSchema_; } void SimRoot:: SourceModelSchema (const SourceModelSchema_type& x) { this->SourceModelSchema_.set (x); } void SimRoot:: SourceModelSchema (const SourceModelSchema_optional& x) { this->SourceModelSchema_ = x; } void SimRoot:: SourceModelSchema (::std::auto_ptr< SourceModelSchema_type > x) { this->SourceModelSchema_.set (x); } const SimRoot::SourceModelObjectType_optional& SimRoot:: SourceModelObjectType () const { return this->SourceModelObjectType_; } SimRoot::SourceModelObjectType_optional& SimRoot:: SourceModelObjectType () { return this->SourceModelObjectType_; } void SimRoot:: SourceModelObjectType (const SourceModelObjectType_type& x) { this->SourceModelObjectType_.set (x); } void SimRoot:: SourceModelObjectType (const SourceModelObjectType_optional& x) { this->SourceModelObjectType_ = x; } void SimRoot:: SourceModelObjectType (::std::auto_ptr< SourceModelObjectType_type > x) { this->SourceModelObjectType_.set (x); } const SimRoot::SourceLibraryEntryID_optional& SimRoot:: SourceLibraryEntryID () const { return this->SourceLibraryEntryID_; } SimRoot::SourceLibraryEntryID_optional& SimRoot:: SourceLibraryEntryID () { return this->SourceLibraryEntryID_; } void SimRoot:: SourceLibraryEntryID (const SourceLibraryEntryID_type& x) { this->SourceLibraryEntryID_.set (x); } void SimRoot:: SourceLibraryEntryID (const SourceLibraryEntryID_optional& x) { this->SourceLibraryEntryID_ = x; } void SimRoot:: SourceLibraryEntryID (::std::auto_ptr< SourceLibraryEntryID_type > x) { this->SourceLibraryEntryID_.set (x); } const SimRoot::SourceLibraryEntryRef_optional& SimRoot:: SourceLibraryEntryRef () const { return this->SourceLibraryEntryRef_; } SimRoot::SourceLibraryEntryRef_optional& SimRoot:: SourceLibraryEntryRef () { return this->SourceLibraryEntryRef_; } void SimRoot:: SourceLibraryEntryRef (const SourceLibraryEntryRef_type& x) { this->SourceLibraryEntryRef_.set (x); } void SimRoot:: SourceLibraryEntryRef (const SourceLibraryEntryRef_optional& x) { this->SourceLibraryEntryRef_ = x; } void SimRoot:: SourceLibraryEntryRef (::std::auto_ptr< SourceLibraryEntryRef_type > x) { this->SourceLibraryEntryRef_.set (x); } //const SimRoot::RefId_type& SimRoot:: const std::string SimRoot:: RefId () const { return this->RefId_.get (); } //SimRoot::RefId_type& SimRoot:: std::string SimRoot:: RefId () { return this->RefId_.get (); } void SimRoot:: RefId (const RefId_type& x) { this->RefId_.set (x); } void SimRoot:: RefId (::std::auto_ptr< RefId_type > x) { this->RefId_.set (x); } } } } #include <xsd/cxx/xml/dom/parsing-source.hxx> #include <xsd/cxx/tree/type-factory-map.hxx> namespace _xsd { static const ::xsd::cxx::tree::type_factory_plate< 0, char > type_factory_plate_init; } namespace schema { namespace simxml { namespace SimModelCore { // SimRoot // SimRoot:: SimRoot () : ::xml_schema::type (), Description_ (this), ObjectOwnerHistory_ (this), IfcGlobalID_ (this), IfcName_ (this), SimUniqueID_ (this), SimModelType_ (this), SimModelSubtype_ (this), SimModelName_ (this), SourceModelSchema_ (this), SourceModelObjectType_ (this), SourceLibraryEntryID_ (this), SourceLibraryEntryRef_ (this), RefId_ (this) { } SimRoot:: SimRoot (const RefId_type& RefId) : ::xml_schema::type (), Description_ (this), ObjectOwnerHistory_ (this), IfcGlobalID_ (this), IfcName_ (this), SimUniqueID_ (this), SimModelType_ (this), SimModelSubtype_ (this), SimModelName_ (this), SourceModelSchema_ (this), SourceModelObjectType_ (this), SourceLibraryEntryID_ (this), SourceLibraryEntryRef_ (this), RefId_ (RefId, this) { } SimRoot:: SimRoot (const SimRoot& x, ::xml_schema::flags f, ::xml_schema::container* c) : ::xml_schema::type (x, f, c), Description_ (x.Description_, f, this), ObjectOwnerHistory_ (x.ObjectOwnerHistory_, f, this), IfcGlobalID_ (x.IfcGlobalID_, f, this), IfcName_ (x.IfcName_, f, this), SimUniqueID_ (x.SimUniqueID_, f, this), SimModelType_ (x.SimModelType_, f, this), SimModelSubtype_ (x.SimModelSubtype_, f, this), SimModelName_ (x.SimModelName_, f, this), SourceModelSchema_ (x.SourceModelSchema_, f, this), SourceModelObjectType_ (x.SourceModelObjectType_, f, this), SourceLibraryEntryID_ (x.SourceLibraryEntryID_, f, this), SourceLibraryEntryRef_ (x.SourceLibraryEntryRef_, f, this), RefId_ (x.RefId_, f, this) { } SimRoot:: SimRoot (const ::xercesc::DOMElement& e, ::xml_schema::flags f, ::xml_schema::container* c) : ::xml_schema::type (e, f | ::xml_schema::flags::base, c), Description_ (this), ObjectOwnerHistory_ (this), IfcGlobalID_ (this), IfcName_ (this), SimUniqueID_ (this), SimModelType_ (this), SimModelSubtype_ (this), SimModelName_ (this), SourceModelSchema_ (this), SourceModelObjectType_ (this), SourceLibraryEntryID_ (this), SourceLibraryEntryRef_ (this), RefId_ (this) { if ((f & ::xml_schema::flags::base) == 0) { ::xsd::cxx::xml::dom::parser< char > p (e, true, false, true); this->parse (p, f); } } void SimRoot:: parse (::xsd::cxx::xml::dom::parser< char >& p, ::xml_schema::flags f) { for (; p.more_content (); p.next_content (false)) { const ::xercesc::DOMElement& i (p.cur_element ()); const ::xsd::cxx::xml::qualified_name< char > n ( ::xsd::cxx::xml::dom::name< char > (i)); // Description // if (n.name () == "Description" && n.namespace_ () == "http://d-alchemy.com/schema/simxml/SimModelCore") { ::std::auto_ptr< Description_type > r ( Description_traits::create (i, f, this)); if (!this->Description_) { this->Description_.set (r); continue; } } // ObjectOwnerHistory // if (n.name () == "ObjectOwnerHistory" && n.namespace_ () == "http://d-alchemy.com/schema/simxml/SimModelCore") { ::std::auto_ptr< ObjectOwnerHistory_type > r ( ObjectOwnerHistory_traits::create (i, f, this)); if (!this->ObjectOwnerHistory_) { this->ObjectOwnerHistory_.set (r); continue; } } // IfcGlobalID // if (n.name () == "IfcGlobalID" && n.namespace_ () == "http://d-alchemy.com/schema/simxml/SimModelCore") { ::std::auto_ptr< IfcGlobalID_type > r ( IfcGlobalID_traits::create (i, f, this)); if (!this->IfcGlobalID_) { this->IfcGlobalID_.set (r); continue; } } // IfcName // if (n.name () == "IfcName" && n.namespace_ () == "http://d-alchemy.com/schema/simxml/SimModelCore") { ::std::auto_ptr< IfcName_type > r ( IfcName_traits::create (i, f, this)); if (!this->IfcName_) { this->IfcName_.set (r); continue; } } // SimUniqueID // if (n.name () == "SimUniqueID" && n.namespace_ () == "http://d-alchemy.com/schema/simxml/SimModelCore") { ::std::auto_ptr< SimUniqueID_type > r ( SimUniqueID_traits::create (i, f, this)); if (!this->SimUniqueID_) { this->SimUniqueID_.set (r); continue; } } // SimModelType // if (n.name () == "SimModelType" && n.namespace_ () == "http://d-alchemy.com/schema/simxml/SimModelCore") { ::std::auto_ptr< SimModelType_type > r ( SimModelType_traits::create (i, f, this)); if (!this->SimModelType_) { this->SimModelType_.set (r); continue; } } // SimModelSubtype // if (n.name () == "SimModelSubtype" && n.namespace_ () == "http://d-alchemy.com/schema/simxml/SimModelCore") { ::std::auto_ptr< SimModelSubtype_type > r ( SimModelSubtype_traits::create (i, f, this)); if (!this->SimModelSubtype_) { this->SimModelSubtype_.set (r); continue; } } // SimModelName // if (n.name () == "SimModelName" && n.namespace_ () == "http://d-alchemy.com/schema/simxml/SimModelCore") { ::std::auto_ptr< SimModelName_type > r ( SimModelName_traits::create (i, f, this)); if (!this->SimModelName_) { this->SimModelName_.set (r); continue; } } // SourceModelSchema // if (n.name () == "SourceModelSchema" && n.namespace_ () == "http://d-alchemy.com/schema/simxml/SimModelCore") { ::std::auto_ptr< SourceModelSchema_type > r ( SourceModelSchema_traits::create (i, f, this)); if (!this->SourceModelSchema_) { this->SourceModelSchema_.set (r); continue; } } // SourceModelObjectType // if (n.name () == "SourceModelObjectType" && n.namespace_ () == "http://d-alchemy.com/schema/simxml/SimModelCore") { ::std::auto_ptr< SourceModelObjectType_type > r ( SourceModelObjectType_traits::create (i, f, this)); if (!this->SourceModelObjectType_) { this->SourceModelObjectType_.set (r); continue; } } // SourceLibraryEntryID // if (n.name () == "SourceLibraryEntryID" && n.namespace_ () == "http://d-alchemy.com/schema/simxml/SimModelCore") { ::std::auto_ptr< SourceLibraryEntryID_type > r ( SourceLibraryEntryID_traits::create (i, f, this)); if (!this->SourceLibraryEntryID_) { this->SourceLibraryEntryID_.set (r); continue; } } // SourceLibraryEntryRef // if (n.name () == "SourceLibraryEntryRef" && n.namespace_ () == "http://d-alchemy.com/schema/simxml/SimModelCore") { ::std::auto_ptr< SourceLibraryEntryRef_type > r ( SourceLibraryEntryRef_traits::create (i, f, this)); if (!this->SourceLibraryEntryRef_) { this->SourceLibraryEntryRef_.set (r); continue; } } break; } while (p.more_attributes ()) { const ::xercesc::DOMAttr& i (p.next_attribute ()); const ::xsd::cxx::xml::qualified_name< char > n ( ::xsd::cxx::xml::dom::name< char > (i)); if (n.name () == "RefId" && n.namespace_ ().empty ()) { this->RefId_.set (RefId_traits::create (i, f, this)); continue; } } if (!RefId_.present ()) { throw ::xsd::cxx::tree::expected_attribute< char > ( "RefId", ""); } } SimRoot* SimRoot:: _clone (::xml_schema::flags f, ::xml_schema::container* c) const { return new class SimRoot (*this, f, c); } SimRoot& SimRoot:: operator= (const SimRoot& x) { if (this != &x) { static_cast< ::xml_schema::type& > (*this) = x; this->Description_ = x.Description_; this->ObjectOwnerHistory_ = x.ObjectOwnerHistory_; this->IfcGlobalID_ = x.IfcGlobalID_; this->IfcName_ = x.IfcName_; this->SimUniqueID_ = x.SimUniqueID_; this->SimModelType_ = x.SimModelType_; this->SimModelSubtype_ = x.SimModelSubtype_; this->SimModelName_ = x.SimModelName_; this->SourceModelSchema_ = x.SourceModelSchema_; this->SourceModelObjectType_ = x.SourceModelObjectType_; this->SourceLibraryEntryID_ = x.SourceLibraryEntryID_; this->SourceLibraryEntryRef_ = x.SourceLibraryEntryRef_; this->RefId_ = x.RefId_; } return *this; } SimRoot:: ~SimRoot () { } } } } #include <istream> #include <xsd/cxx/xml/sax/std-input-source.hxx> #include <xsd/cxx/tree/error-handler.hxx> namespace schema { namespace simxml { namespace SimModelCore { } } } #include <xsd/cxx/post.hxx> // Begin epilogue. // // // End epilogue.
26.147277
123
0.558432
EnEff-BIM
1cf2697aa4fa44c82a42f2d8a0aaab20c26c2d3a
10,661
hpp
C++
source/housys/include/hou/sys/pixel.hpp
DavideCorradiDev/houzi-game-engine
d704aa9c5b024300578aafe410b7299c4af4fcec
[ "MIT" ]
2
2018-04-12T20:59:20.000Z
2018-07-26T16:04:07.000Z
source/housys/include/hou/sys/pixel.hpp
DavideCorradiDev/houzi-game-engine
d704aa9c5b024300578aafe410b7299c4af4fcec
[ "MIT" ]
null
null
null
source/housys/include/hou/sys/pixel.hpp
DavideCorradiDev/houzi-game-engine
d704aa9c5b024300578aafe410b7299c4af4fcec
[ "MIT" ]
null
null
null
// Houzi Game Engine // Copyright (c) 2018 Davide Corradi // Licensed under the MIT license. #ifndef HOU_SYS_PIXEL_HPP #define HOU_SYS_PIXEL_HPP #include "hou/sys/color.hpp" #include "hou/sys/pixel_fwd.hpp" #include "hou/sys/sys_config.hpp" #include "hou/cor/pragmas.hpp" #include <array> namespace hou { HOU_PRAGMA_PACK_PUSH(1) /** * Represents a pixel. * * Note: all possible class instances (one for each possible pixel_format value) * are already explicitly instantiated and exported in the library. * * \tparam PF the pixel format. */ template <pixel_format PF> class pixel { public: /** * The pixel format. */ static constexpr pixel_format format = PF; /** * The number of bits in a pixel. */ static constexpr size_t bit_count = get_bits_per_pixel(PF); /** * The number of bytes in a pixel. */ static constexpr size_t byte_count = get_bytes_per_pixel(PF); public: /** * Retrieves the format of the pixel. * * \return the format of the pixel. */ static pixel_format get_format() noexcept; /** * Retrieves the amount of bytes used by the pixel. * * \return the amomunt of bytes used by the pixel. */ static uint get_byte_count() noexcept; public: /** * default constructor. * * Initializes all channels to 0. */ pixel() noexcept; /** * Channel constructor. * * Initializes the pixel with the given channel values. * * \tparam PF2 dummy template parameter. * * \tparam Enable enabling template parameter. * * \param r the red channel value. */ template <pixel_format PF2 = PF, typename Enable = std::enable_if_t<PF2 == pixel_format::r>> pixel(uint8_t r) noexcept; /** * Channel constructor. * * Initializes the pixel with the given channel values. * * \tparam PF2 dummy template parameter. * * \tparam Enable enabling template parameter. * * \param r the red channel value. * * \param g the green channel value. */ template <pixel_format PF2 = PF, typename Enable = std::enable_if_t<PF2 == pixel_format::rg>> pixel(uint8_t r, uint8_t g) noexcept; /** * Channel constructor. * * Initializes the pixel with the given channel values. * * \tparam PF2 dummy template parameter. * * \tparam Enable enabling template parameter. * * \param r the red channel value. * * \param g the green channel value. * * \param b the blue channel value. */ template <pixel_format PF2 = PF, typename Enable = std::enable_if_t<PF2 == pixel_format::rgb>> pixel(uint8_t r, uint8_t g, uint8_t b) noexcept; /** * Channel constructor. * * Initializes the pixel with the given channel values. * * \tparam PF2 dummy template parameter. * * \tparam Enable enabling template parameter. * * \param r the red channel value. * * \param g the green channel value. * * \param b the blue channel value. * * \param a the alpha channel value. */ template <pixel_format PF2 = PF, typename Enable = std::enable_if_t<PF2 == pixel_format::rgba>> pixel(uint8_t r, uint8_t g, uint8_t b, uint8_t a) noexcept; /** * color constructor. * * Initializes the pixel with the given color. * * \tparam PF2 dummy template parameter. * * \tparam Enable enabling template parameter. * * \param c the color. */ template <pixel_format PF2 = PF, typename Enable = std::enable_if_t<PF2 == pixel_format::rgba>> pixel(const color& c) noexcept; /** * Format conversion constructor. * * Initializes the pixel with the channel values of a pixel with a different * format. * * The following rules are applied: * * * When converting from rg or rgba to r or rgb, the last input channel (the * transparency channel) is ignored. * * * When converting from r or rgb to rg or rgba the last output channel (the * transparency channel) is set to 255. * * * When converting from r or rg to rgb or rgba, the r, g and b output * hannels are set to the value of the r input channel. * * * When converting from rgb or rgba to r or rg, the r output channel * (the value channel) is set to a weighted average of the r, g, and b input * channels: Rout = (77 * Rin + 150 * Gin + 29 * Bin) / 256. * * \tparam otherFormat the other pixel_format. * * \tparam Enable enabling template parameter. * * \param other the other pixel. */ template <pixel_format otherFormat, typename Enable = std::enable_if_t<otherFormat != PF>> pixel(const pixel<otherFormat>& other) noexcept; /** * Retrieves the value of the red channel of the pixel. * * \return the value of the channel. */ uint8_t get_r() const noexcept; /** * Sets the value of the red channel of the pixel. * * \param value the value. */ void set_r(uint8_t value) noexcept; /** * Retrieves the value of the green channel of the pixel. * * \tparam PF2 dummy template parameter. * * \tparam Enable enabling template parameter. * * \return the value of the channel. */ template <pixel_format PF2 = PF, typename Enable = std::enable_if_t<(get_bytes_per_pixel(PF2) > 1u)>> uint8_t get_g() const noexcept; /** * Sets the value of the green channel of the pixel. * * \tparam PF2 dummy template parameter. * * \tparam Enable enabling template parameter. * * \param value the value. */ template <pixel_format PF2 = PF, typename Enable = std::enable_if_t<(get_bytes_per_pixel(PF2) > 1u)>> void set_g(uint8_t value) noexcept; /** * Retrieves the value of the blue channel of the pixel. * * \tparam PF2 dummy template parameter. * * \tparam Enable enabling template parameter. * * \return the value of the channel. */ template <pixel_format PF2 = PF, typename Enable = std::enable_if_t<(get_bytes_per_pixel(PF2) > 2u)>> uint8_t get_b() const noexcept; /** * Sets the value of the blue channel of the pixel. * * \tparam PF2 dummy template parameter. * * \tparam Enable enabling template parameter. * * \param value the value. */ template <pixel_format PF2 = PF, typename Enable = std::enable_if_t<(get_bytes_per_pixel(PF2) > 1u)>> void set_b(uint8_t value) noexcept; /** * Retrieves the value of the alpha channel of the pixel. * * \tparam PF2 dummy template parameter. * * \tparam Enable enabling template parameter. * * \return the value of the channel. */ template <pixel_format PF2 = PF, typename Enable = std::enable_if_t<(get_bytes_per_pixel(PF2) > 3u)>> uint8_t get_a() const noexcept; /** * Sets the value of the alpha channel of the pixel. * * \tparam PF2 dummy template parameter. * * \tparam Enable enabling template parameter. * * \param value the value. */ template <pixel_format PF2 = PF, typename Enable = std::enable_if_t<(get_bytes_per_pixel(PF2) > 1u)>> void set_a(uint8_t value) noexcept; /** * Retrieves the color of the pixel. * * \tparam PF2 dummy template parameter. * * \tparam Enable enabling template parameter. * * \return the color of the pixel. */ template <pixel_format PF2 = PF, typename Enable = std::enable_if_t<PF2 == pixel_format::rgba>> color get_color() const noexcept; /** * Sets the color of the pixel. * * \tparam PF2 dummy template parameter. * * \tparam Enable enabling template parameter. * * \param c the color of the pixel. */ template <pixel_format PF2 = PF, typename Enable = std::enable_if_t<PF2 == pixel_format::rgba>> void set_color(const color& c) noexcept; /** * Sets the channels of the pixel. * * \tparam PF2 dummy template parameter. * * \tparam Enable enabling template parameter. * * \param r the red channel value. */ template <pixel_format PF2 = PF, typename Enable = std::enable_if_t<PF2 == pixel_format::r>> void set(uint8_t r) noexcept; /** * Sets the channels of the pixel. * * \tparam PF2 dummy template parameter. * * \tparam Enable enabling template parameter. * * \param r the red channel value. * * \param g the green channel value. */ template <pixel_format PF2 = PF, typename Enable = std::enable_if_t<PF2 == pixel_format::rg>> void set(uint8_t r, uint8_t g) noexcept; /** * Sets the channels of the pixel. * * \tparam PF2 dummy template parameter. * * \tparam Enable enabling template parameter. * * \param r the red channel value. * * \param g the green channel value. * * \param b the blue channel value. */ template <pixel_format PF2 = PF, typename Enable = std::enable_if_t<PF2 == pixel_format::rgb>> void set(uint8_t r, uint8_t g, uint8_t b) noexcept; /** * Sets the channels of the pixel. * * \tparam PF2 dummy template parameter. * * \tparam Enable enabling template parameter. * * \param r the red channel value. * * \param g the green channel value. * * \param b the blue channel value. * * \param a the alpha channel value. */ template <pixel_format PF2 = PF, typename Enable = std::enable_if_t<PF2 == pixel_format::rgba>> void set(uint8_t r, uint8_t g, uint8_t b, uint8_t a) noexcept; #ifndef HOU_DOXYGEN public: template <pixel_format PF2> friend constexpr bool operator==( const pixel<PF2>& lhs, const pixel<PF2>& rhs) noexcept; template <pixel_format PF2> friend constexpr bool operator!=( const pixel<PF2>& lhs, const pixel<PF2>& rhs) noexcept; #endif private: std::array<uint8_t, get_bytes_per_pixel(PF)> m_channels; }; HOU_PRAGMA_PACK_POP() /** * Checks if two pixel objects are equal. * * \tparam PF the pixel format. * * \param lhs the left operand. * * \param rhs the right operand. * * \return the result of the check. */ template <pixel_format PF> constexpr bool operator==( const pixel<PF>& lhs, const pixel<PF>& rhs) noexcept; /** * Checks if two pixel objects are not equal. * * \tparam PF the pixel format. * * \param lhs the left operand. * * \param rhs the right operand. * * \return the result of the check. */ template <pixel_format PF> constexpr bool operator!=( const pixel<PF>& lhs, const pixel<PF>& rhs) noexcept; /** * Writes the object into a stream. * * \tparam PF the pixel format. * * \param os the stream. * * \param pixel the pixel. * * \return a reference to os. */ template <pixel_format PF> std::ostream& operator<<(std::ostream& os, const pixel<PF>& pixel); } // namespace hou #include "hou/sys/pixel.inl" #endif
24.395881
80
0.658381
DavideCorradiDev
1cf3f12450e1339a4385eab14590f24f95726ca8
1,298
cpp
C++
src/CefView/CefBrowserApp/CefViewBrowserClient_KeyboardHandler.cpp
daiming/CefViewCore
89837575e8d5f50aa16a91ef19b0ad7ddbff205e
[ "MIT" ]
null
null
null
src/CefView/CefBrowserApp/CefViewBrowserClient_KeyboardHandler.cpp
daiming/CefViewCore
89837575e8d5f50aa16a91ef19b0ad7ddbff205e
[ "MIT" ]
null
null
null
src/CefView/CefBrowserApp/CefViewBrowserClient_KeyboardHandler.cpp
daiming/CefViewCore
89837575e8d5f50aa16a91ef19b0ad7ddbff205e
[ "MIT" ]
null
null
null
#include <CefViewBrowserClient.h> #pragma region std_headers #include <sstream> #include <string> #include <algorithm> #pragma endregion std_headers #pragma region cef_headers #include <include/cef_app.h> #pragma endregion cef_headers #include <Common/CefViewCoreLog.h> CefRefPtr<CefKeyboardHandler> CefViewBrowserClient::GetKeyboardHandler() { return this; } bool CefViewBrowserClient::OnPreKeyEvent(CefRefPtr<CefBrowser> browser, const CefKeyEvent& event, CefEventHandle os_event, bool* is_keyboard_shortcut) { CEF_REQUIRE_UI_THREAD(); // 增加按键事件,处理F5刷新和F10调用调试工具 // TODO 禁用devtools中的F5和F10响应 if (event.type == KEYEVENT_RAWKEYDOWN) { if (event.windows_key_code == VK_F5) { // 刷新 browser->Reload(); return true; } else if (event.windows_key_code == VK_F10) { // 调试控制台 if (browser->GetHost()->HasDevTools()) { browser->GetHost()->CloseDevTools(); } else { CefWindowInfo windowInfo; #if defined(OS_WIN) windowInfo.SetAsPopup(NULL, "DevTools"); #endif CefBrowserSettings settings; browser->GetHost()->ShowDevTools(windowInfo, this, settings, CefPoint()); } } } return false; }
24.490566
81
0.645609
daiming
1cf7a1559aae83b8a8fd1054dd02842bf6d4b59e
16,956
cpp
C++
jni/events/basesynthevent.cpp
scottmccain/MWEngine
e8aa3e37a7c9d0cc3198081d12e3342fe227af3c
[ "MIT" ]
null
null
null
jni/events/basesynthevent.cpp
scottmccain/MWEngine
e8aa3e37a7c9d0cc3198081d12e3342fe227af3c
[ "MIT" ]
null
null
null
jni/events/basesynthevent.cpp
scottmccain/MWEngine
e8aa3e37a7c9d0cc3198081d12e3342fe227af3c
[ "MIT" ]
null
null
null
/** * The MIT License (MIT) * * Copyright (c) 2013-2014 Igor Zinken - http://www.igorski.nl * * 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 "basesynthevent.h" #include "../audioengine.h" #include "../sequencer.h" #include "../global.h" #include "../utilities/utils.h" #include <cmath> /* constructor / destructor */ BaseSynthEvent::BaseSynthEvent() { } /** * initializes an BaseSynthEvent for use in a sequenced context * * @param aFrequency {int} the frequency of the note to synthesize in Hz * @param aPosition {int} the step position in the sequencer * @param aLength {float} the length in steps the note lasts * @param aInstrument {SynthInstrument} the instruments properties * @param aAutoCache {bool} whether to start caching automatically, this is * only available if AudioEngineProps::EVENT_CACHING is true */ BaseSynthEvent::BaseSynthEvent( float aFrequency, int aPosition, float aLength, SynthInstrument *aInstrument, bool aAutoCache ) { init( aInstrument, aFrequency, aPosition, aLength, true ); setAutoCache( aAutoCache ); } /** * initializes an BaseSynthEvent to be synthesized at once, for a live instrument context * * @param aFrequency {int} the frequency of the note to synthesize in Hz * @param aInstrument {SynthInstrument} */ BaseSynthEvent::BaseSynthEvent( float aFrequency, SynthInstrument *aInstrument ) { init( aInstrument, aFrequency, 0, 1, false ); } BaseSynthEvent::~BaseSynthEvent() { removeFromSequencer(); if ( _adsr != 0 ) { delete _adsr; _adsr = 0; } } /* public methods */ /** * will only occur for a sequenced BaseSynthEvent */ void BaseSynthEvent::mixBuffer( AudioBuffer* outputBuffer, int bufferPos, int minBufferPosition, int maxBufferPosition, bool loopStarted, int loopOffset, bool useChannelRange ) { // is EVENT_CACHING is enabled, read from cached buffer if ( AudioEngineProps::EVENT_CACHING ) { BaseAudioEvent::mixBuffer( outputBuffer, bufferPos, minBufferPosition, maxBufferPosition, loopStarted, loopOffset, useChannelRange ); } else { // EVENT_CACHING is disabled, synthesize on the fly lock(); // over the max position ? read from the start ( implies that sequence has started loop ) if ( bufferPos >= maxBufferPosition ) { if ( useChannelRange ) bufferPos -= maxBufferPosition; else if ( !loopStarted ) bufferPos -= ( maxBufferPosition - minBufferPosition ); } int bufferEndPos = bufferPos + AudioEngineProps::BUFFER_SIZE; if (( bufferPos >= _sampleStart || bufferEndPos > _sampleStart ) && bufferPos < _sampleEnd ) { // render the snippet _cacheWriteIndex = _sampleStart > bufferPos ? 0 : bufferPos - _sampleStart; int writeOffset = _sampleStart > bufferPos ? _sampleStart - bufferPos : 0; render( _buffer ); // overwrites old buffer contents outputBuffer->mergeBuffers( _buffer, 0, writeOffset, MAX_PHASE ); // reset of properties at end of write if ( _cacheWriteIndex >= _sampleLength ) calculateBuffers(); } if ( loopStarted && bufferPos >= loopOffset ) { bufferPos = minBufferPosition + loopOffset; if ( bufferPos >= _sampleStart && bufferPos <= _sampleEnd ) { _cacheWriteIndex = 0; // render the snippet from the start render( _buffer ); // overwrites old buffer contents outputBuffer->mergeBuffers( _buffer, 0, loopOffset, MAX_PHASE ); // reset of properties at end of write if ( _cacheWriteIndex >= _sampleLength ) calculateBuffers(); } } unlock(); } } AudioBuffer* BaseSynthEvent::getBuffer() { if ( AudioEngineProps::EVENT_CACHING ) { // if caching hasn't completed, fill cache fragment if ( !_cachingCompleted ) doCache(); } return _buffer; } float BaseSynthEvent::getFrequency() { return _frequency; } void BaseSynthEvent::setFrequency( float aFrequency ) { _frequency = aFrequency; } /** * @param aPosition position in the sequencer where this event starts playing * @param aLength length (in sequencer steps) of this event * @param aInstrument the SynthInstrument whose properties will be used for synthesizing this event * can be NULL to keep the current SynthInstrument, if not null the current * SynthInstrument is replaced */ void BaseSynthEvent::invalidateProperties( int aPosition, float aLength, SynthInstrument *aInstrument ) { // swap instrument if new one is different to existing reference if ( aInstrument != 0 && _instrument != aInstrument ) { removeFromSequencer(); _instrument = aInstrument; addToSequencer(); } position = aPosition; length = aLength; // is this event caching ? if ( AudioEngineProps::EVENT_CACHING && !_cachingCompleted ) _cancel = true; if ( _rendering ) _update = true; // we're rendering, request update from within render loop else updateProperties(); // instant update as we're not rendering } void BaseSynthEvent::unlock() { _locked = false; if ( _updateAfterUnlock ) calculateBuffers(); _updateAfterUnlock = false; } void BaseSynthEvent::calculateBuffers() { if ( _locked ) { _updateAfterUnlock = true; return; } int oldLength; if ( isSequenced ) { _cancel = true; oldLength = _sampleLength; _sampleLength = ( int )( length * ( float ) AudioEngine::bytes_per_tick ); _sampleStart = position * AudioEngine::bytes_per_tick; _sampleEnd = _sampleStart + _sampleLength; } else { // quick releases of a noteOn-instruction should ring for at least a 64th note _minLength = AudioEngine::bytes_per_bar / 64; _sampleLength = AudioEngine::bytes_per_bar; // important for amplitude swell in oldLength = AudioEngineProps::BUFFER_SIZE; // buffer is as long as the engine's buffer size _hasMinLength = false; // keeping track if the min length has been rendered } _adsr->setBufferLength( _sampleLength ); // sample length changed (f.i. tempo change) or buffer not yet created ? // create buffer for (new) sample length if ( _sampleLength != oldLength || _buffer == 0 ) { // note that when event caching is enabled, the buffer is as large as // the total event length requires if ( AudioEngineProps::EVENT_CACHING && isSequenced ) { destroyBuffer(); // clear previous buffer contents _buffer = new AudioBuffer( AudioEngineProps::OUTPUT_CHANNELS, _sampleLength ); } else _buffer = new AudioBuffer( AudioEngineProps::OUTPUT_CHANNELS, AudioEngineProps::BUFFER_SIZE ); } if ( AudioEngineProps::EVENT_CACHING && isSequenced ) { resetCache(); // yes here, not in cache()-invocation as cancels might otherwise remain permanent (see BulkCacher) if ( _autoCache && !_caching ) // re-cache cache( false ); } } /** * synthesize is invoked by the Sequencer for rendering a non-sequenced * BaseSynthEvent into a single buffer * * aBufferLength {int} length of the buffer to synthesize */ AudioBuffer* BaseSynthEvent::synthesize( int aBufferLength ) { // in case buffer length is unequal to cached length, create new write buffer if ( aBufferLength != AudioEngineProps::BUFFER_SIZE || _buffer == 0 ) { destroyBuffer(); _buffer = new AudioBuffer( AudioEngineProps::OUTPUT_CHANNELS, aBufferLength ); } render( _buffer ); // synthesize, also overwrites old buffer contents // keep track of the rendered bytes, in case of a key up event // we still want to have the sound ring for the minimum period // defined in the constructor instead of cut off immediately if ( _queuedForDeletion && _minLength > 0 ) _minLength -= aBufferLength; if ( _minLength <= 0 ) { _hasMinLength = true; setDeletable( _queuedForDeletion ); // this event is about to be deleted, apply a tiny fadeout if ( _queuedForDeletion ) { int amt = ceil( aBufferLength / 4 ); SAMPLE_TYPE envIncr = MAX_PHASE / amt; SAMPLE_TYPE amp = MAX_PHASE; for ( int i = aBufferLength - amt; i < aBufferLength; ++i ) { for ( int c = 0, nc = _buffer->amountOfChannels; c < nc; ++c ) _buffer->getBufferForChannel( c )[ i ] *= amp; amp -= envIncr; } } } return _buffer; } /** * (pre-)cache the contents of the BaseSynthEvent in its entirety * this can be done in idle time to make optimum use of resources */ void BaseSynthEvent::cache( bool doCallback ) { if ( _buffer == 0 ) return; // cache request likely invoked after destruction _caching = true; doCache(); if ( doCallback ) sequencer::bulkCacher->cacheQueue(); } ADSR* BaseSynthEvent::getADSR() { return _adsr; } float BaseSynthEvent::getVolume() { return _volume; } void BaseSynthEvent::setVolume( float aValue ) { _volume = aValue; } /* protected methods */ /** * actual updating of the properties, requested by invalidateProperties * this operation might potentially delete objects that could be in * use during a rendering operation, as such it is invoked from the render */ void BaseSynthEvent::updateProperties() { // ADSR envelopes _adsr->cloneEnvelopes( _instrument->adsr ); calculateBuffers(); _update = false; // we're in sync now :) _cancel = false; } /** * the actual synthesizing of the audio * * @param aOutputBuffer {AudioBuffer*} the buffer to write into */ void BaseSynthEvent::render( AudioBuffer* aOutputBuffer ) { // override in your custom subclass, note that // the body of the function will look somewhat like this: _rendering = true; int bufferLength = aOutputBuffer->bufferSize; int renderStartOffset = AudioEngineProps::EVENT_CACHING && isSequenced ? _cacheWriteIndex : 0; int maxSampleIndex = _sampleLength - 1; // max index possible for this events length int renderEndOffset = renderStartOffset + bufferLength; // max buffer index to be written to in this cycle // keep in bounds of event duration if ( renderEndOffset > maxSampleIndex ) { renderEndOffset = maxSampleIndex; aOutputBuffer->silenceBuffers(); // as we tend to overwrite the incoming buffer } int i; for ( i = renderStartOffset; i < renderEndOffset; ++i ) { // render math goes here SAMPLE_TYPE amp = 0.0; // end of single render iteration, write into output buffer goes here : if ( _update ) updateProperties(); // if an update was requested, do it now (prior to committing to buffer) if ( _cancel ) break; // if a caching cancel was requested, cancel now // -- write the output into the buffers channels for ( int c = 0, ca = aOutputBuffer->amountOfChannels; c < ca; ++c ) aOutputBuffer->getBufferForChannel( c )[ i ] = amp * _volume; } // apply ADSR envelopes and update cacheWriteIndex for next render cycle _adsr->apply( aOutputBuffer, _cacheWriteIndex ); _cacheWriteIndex += i; if ( AudioEngineProps::EVENT_CACHING ) { if ( isSequenced ) { _caching = false; // was a cancel requested ? re-cache to match the new instrument properties (cancel // may only be requested during the changing of properties!) if ( _cancel ) { //calculateBuffers(); // no, use a manual invocation (BulkCacher) } else { if ( i == maxSampleIndex ) _cachingCompleted = true; if ( _bulkCacheable ) _autoCache = true; } } } _cancel = false; // ensure we can render for the next iteration _rendering = false; } void BaseSynthEvent::setDeletable( bool value ) { // pre buffered event or rendered min length ? schedule for immediate deletion if ( isSequenced || _hasMinLength ) _deleteMe = value; else _queuedForDeletion = value; } /** * @param aInstrument pointer to the SynthInstrument containing the rendering properties for the BaseSynthEvent * @param aFrequency frequency in Hz for the note to be rendered * @param aPosition offset in the sequencer where this event starts playing / becomes audible * @param aLength length of the event (in sequencer steps) * @param aIsSequenced whether this event is sequenced and only audible in a specific sequence range */ void BaseSynthEvent::init( SynthInstrument *aInstrument, float aFrequency, int aPosition, int aLength, bool aIsSequenced ) { _destroyableBuffer = true; // synth event buffer is always unique and managed by this instance ! _instrument = aInstrument; _adsr = aInstrument->adsr != 0 ? aInstrument->adsr->clone() : new ADSR(); // when instrument has no fixed length and the decay is short // we deactivate the decay envelope completely (for now) if ( !aIsSequenced && _adsr->getDecay() < .75 ) _adsr->setDecay( 0 ); _buffer = 0; _locked = false; position = aPosition; length = aLength; isSequenced = aIsSequenced; _queuedForDeletion = false; _deleteMe = false; _update = false; _cancel = false; // whether we should cancel caching _hasMinLength = isSequenced; // a sequenced event has no early cancel _caching = false; _cachingCompleted = false; // whether we're done caching _autoCache = false; // we'll cache sequentially instead _rendering = false; _volume = aInstrument->volume; _sampleLength = 0; _cacheWriteIndex = 0; setFrequency( aFrequency ); calculateBuffers(); addToSequencer(); } void BaseSynthEvent::addToSequencer() { // adds the event to the sequencer so it can be heard if ( isSequenced ) _instrument->audioEvents->push_back( this ); else _instrument->liveAudioEvents->push_back( this ); } void BaseSynthEvent::removeFromSequencer() { if ( !isSequenced ) { for ( int i; i < _instrument->liveAudioEvents->size(); i++ ) { if ( _instrument->liveAudioEvents->at( i ) == this ) { _instrument->liveAudioEvents->erase( _instrument->liveAudioEvents->begin() + i ); break; } } } else { for ( int i; i < _instrument->audioEvents->size(); i++ ) { if ( _instrument->audioEvents->at( i ) == this ) { _instrument->audioEvents->erase( _instrument->audioEvents->begin() + i ); break; } } } } /** * render the event into the buffer and cache its * contents for the given bufferLength (we can cache * buffer fragments on demand, or all at once) */ void BaseSynthEvent::doCache() { render( _buffer ); }
32.297143
121
0.630573
scottmccain
1cf9552c81aebe439df5d6232a43a2b649d91b46
286
cpp
C++
events/DisconnectPlayerEvent.cpp
deb0ch/R-Type
8bb37cd5ec318efb97119afb87d4996f6bb7644e
[ "WTFPL" ]
5
2016-03-15T20:14:10.000Z
2020-10-30T23:56:24.000Z
events/DisconnectPlayerEvent.cpp
deb0ch/R-Type
8bb37cd5ec318efb97119afb87d4996f6bb7644e
[ "WTFPL" ]
3
2018-12-19T19:12:44.000Z
2020-04-02T13:07:00.000Z
events/DisconnectPlayerEvent.cpp
deb0ch/R-Type
8bb37cd5ec318efb97119afb87d4996f6bb7644e
[ "WTFPL" ]
2
2016-04-11T19:29:28.000Z
2021-11-26T20:53:22.000Z
#include "DisconnectPlayerEvent.hh" DisconnectPlayerEvent::DisconnectPlayerEvent(unsigned int hash) : AEvent("DisconnectPlayerEvent"), _hash(hash) {} DisconnectPlayerEvent::~DisconnectPlayerEvent() {} unsigned int DisconnectPlayerEvent::getRemoteId() const { return this->_hash; }
22
110
0.797203
deb0ch
7f2e9d5841d3e43121f5aa0cadb8d9ff159623bb
788
cpp
C++
src/Server/Ph0enix-Server/Agent.cpp
SKGP/EDR
da4cb02afe164d38014a3616e7cff8e71ce56965
[ "MIT" ]
6
2021-05-23T13:26:23.000Z
2021-07-27T08:11:29.000Z
src/Server/Ph0enix-Server/Agent.cpp
SKGP/EDR
da4cb02afe164d38014a3616e7cff8e71ce56965
[ "MIT" ]
null
null
null
src/Server/Ph0enix-Server/Agent.cpp
SKGP/EDR
da4cb02afe164d38014a3616e7cff8e71ce56965
[ "MIT" ]
1
2021-05-29T06:22:34.000Z
2021-05-29T06:22:34.000Z
#include "Agent.h" Agent::Agent() { } Agent::~Agent() { } std::string Agent::getIp() { return this->ip; } std::string Agent::getMac() { return this->mac; } std::string Agent::getHostName() { return this->hostName; } int Agent::getReputation() { return this->reputation; } SOCKET Agent::getsocket() { return this->socket; } bool Agent::getActive() { return this->active; } void Agent::setIp(std::string ip) { this->ip = ip; } void Agent::setMac(std::string mac) { this->mac = mac; } void Agent::setHostName(std::string hostName) { this->hostName = hostName; } void Agent::setReputation(int reputation) { this->reputation = reputation; } void Agent::setSocket(SOCKET socket) { this->socket = socket; } void Agent::setActive(bool active) { this->active = active; }
11.257143
45
0.668782
SKGP
7f37d226759fb210eac85a515d9f71aaa5253726
971
cpp
C++
CodeInterviews-SwordOffer/Offer41-Median-of-Dataflow/solution1.cpp
loyio/leetcode
366393c29a434a621592ef6674a45795a3086184
[ "CC0-1.0" ]
null
null
null
CodeInterviews-SwordOffer/Offer41-Median-of-Dataflow/solution1.cpp
loyio/leetcode
366393c29a434a621592ef6674a45795a3086184
[ "CC0-1.0" ]
null
null
null
CodeInterviews-SwordOffer/Offer41-Median-of-Dataflow/solution1.cpp
loyio/leetcode
366393c29a434a621592ef6674a45795a3086184
[ "CC0-1.0" ]
2
2022-01-25T05:31:31.000Z
2022-02-26T07:22:23.000Z
class MedianFinder { public: priority_queue<int, vector<int>, less<int>> maxHeap; priority_queue<int, vector<int>, greater<int>> minHeap; /** initialize your data structure here. */ MedianFinder() { } void addNum(int num) { if(maxHeap.size() == minHeap.size()){ minHeap.push(num); int top = minHeap.top(); minHeap.pop(); maxHeap.push(top); }else{ maxHeap.push(num); int top = maxHeap.top(); maxHeap.pop(); minHeap.push(top); } } double findMedian() { if(maxHeap.size() == minHeap.size()){ return (maxHeap.top() + minHeap.top())*1.0/2; }else{ return maxHeap.top()*1.0; } } }; /** * Your MedianFinder object will be instantiated and called as such: * MedianFinder* obj = new MedianFinder(); * obj->addNum(num); * double param_2 = obj->findMedian(); */
24.897436
68
0.530381
loyio
7f3bbb1b1b870b6214b4494887e9b7170561a50c
833
hpp
C++
genfile/include/genfile/SNPPositionInRangeTest.hpp
gavinband/bingwa
d52e166b3bb6bc32cd32ba63bf8a4a147275eca1
[ "BSL-1.0" ]
3
2021-04-21T05:42:24.000Z
2022-01-26T14:59:43.000Z
genfile/include/genfile/SNPPositionInRangeTest.hpp
gavinband/bingwa
d52e166b3bb6bc32cd32ba63bf8a4a147275eca1
[ "BSL-1.0" ]
2
2020-04-09T16:11:04.000Z
2020-11-10T11:18:56.000Z
genfile/include/genfile/SNPPositionInRangeTest.hpp
gavinband/qctool
8d8adb45151c91f953fe4a9af00498073b1132ba
[ "BSL-1.0" ]
null
null
null
// Copyright Gavin Band 2008 - 2012. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef SNPPOSITIONINRANGETEST_HPP #define SNPPOSITIONINRANGETEST_HPP #include <set> #include <string> #include "genfile/GenomePosition.hpp" #include "genfile/GenomePositionRange.hpp" #include "genfile/VariantIdentifyingDataTest.hpp" namespace genfile { // Test if the given SNP is in the given (closed) range of positions. struct SNPPositionInRangeTest: public VariantIdentifyingDataTest { SNPPositionInRangeTest( GenomePositionRange const range ) ; bool operator()( VariantIdentifyingData const& data ) const ; std::string display() const ; private: GenomePositionRange const m_range ; } ; } #endif
28.724138
70
0.757503
gavinband
7f4a041a282e53a4b2bf70ace30f418d40c181ab
1,521
cc
C++
src/q_251_300/q0283.cc
vNaonLu/daily-leetcode
2830c2cd413d950abe7c6d9b833c771f784443b0
[ "MIT" ]
2
2021-09-28T18:41:03.000Z
2021-09-28T18:42:57.000Z
src/q_251_300/q0283.cc
vNaonLu/Daily_LeetCode
30024b561611d390931cef1b22afd6a5060cf586
[ "MIT" ]
16
2021-09-26T11:44:20.000Z
2021-11-28T06:44:02.000Z
src/q_251_300/q0283.cc
vNaonLu/daily-leetcode
2830c2cd413d950abe7c6d9b833c771f784443b0
[ "MIT" ]
1
2021-11-22T09:11:36.000Z
2021-11-22T09:11:36.000Z
#include <gtest/gtest.h> #include <iostream> #include <vector> using namespace std; /** * This file is generated by leetcode_add.py v1.0 * * 283. * Move Zeroes * * ––––––––––––––––––––––––––––– Description ––––––––––––––––––––––––––––– * * Given an integer array ‘nums’ , move all ‘0’ 's to the end of it while * maintaining the relative order of the non-zero * “Note” that you must do this in-place without making a copy of the * array. * * ––––––––––––––––––––––––––––– Constraints ––––––––––––––––––––––––––––– * * • ‘1 ≤ nums.length ≤ 10⁴’ * • ‘-2³¹ ≤ nums[i] ≤ 2³¹ - 1’ * */ struct q283 : public ::testing::Test { // Leetcode answer here class Solution { public: void moveZeroes(vector<int>& nums) { int fillindex = -1; for (int i = 0; i < nums.size(); ++i) { if (nums[i] != 0) { nums[++fillindex] = nums[i]; } } while (fillindex < nums.size() - 1) { nums[++fillindex] = 0; } } }; class Solution *solution; }; TEST_F(q283, sample_input01) { solution = new Solution(); vector<int> nums = {0, 1, 0, 3, 12}; vector<int> exp = {1, 3, 12, 0, 0}; solution->moveZeroes(nums); // Assume the first argument is answer. EXPECT_EQ(nums, exp); delete solution; } TEST_F(q283, sample_input02) { solution = new Solution(); vector<int> nums = {0}; vector<int> exp = {0}; solution->moveZeroes(nums); // Assume the first argument is answer. EXPECT_EQ(nums, exp); delete solution; }
23.4
75
0.543064
vNaonLu
7f53e434568b0723e58ecb4111a2a05c383f41be
2,902
cpp
C++
loader.cpp
fuadsaud/objviewer
56d1e427319ac706d80adb6b1675986839b4ccb6
[ "MIT" ]
1
2017-03-09T21:46:37.000Z
2017-03-09T21:46:37.000Z
loader.cpp
fuadsaud/objviewer
56d1e427319ac706d80adb6b1675986839b4ccb6
[ "MIT" ]
null
null
null
loader.cpp
fuadsaud/objviewer
56d1e427319ac706d80adb6b1675986839b4ccb6
[ "MIT" ]
null
null
null
#include "loader.h" obj::loader::loader(std::string p) { path = p.c_str(); } void obj::loader::load(obj::mesh * m) { std::ifstream in(path.c_str()); obj::group * g = new obj::group(); m->push_group(g); obj::vertex * v; obj::vertex2 * t; obj::face * face; std::vector<std::string> f; std::vector<std::string> tokens; while (!in.eof()) { std::string line; std::getline(in, line); if (line.empty()) continue; tokens = split(line, ' ', false); switch(line[0]) { case 'v': if (tokens.size() > 3) { switch (line[1]) { case 't': m->push_texture(new obj::vertex2( atof(tokens.at(1).c_str()), atof(tokens.at(2).c_str()))); case 'n': v = new obj::vertex( atof(tokens.at(1).c_str()), atof(tokens.at(2).c_str()), atof(tokens.at(3).c_str())); m->push_normal(v); break; default: v = new obj::vertex( atof(tokens.at(1).c_str()), atof(tokens.at(2).c_str()), atof(tokens.at(3).c_str())); m->push_vertex(v); break; } } else { m->push_texture(t); } break; case 'f': face = new obj::face(); for (int i = 1; i < tokens.size(); i++) { f = split(tokens[i], '/', true); face->push_vertex(atoi(f[0].c_str()) - 1); if (f.size() > 1 && !f[1].empty()) { face->push_texture(atoi(f[1].c_str()) - 1); } if (f.size() > 2) { face->push_normal(atoi(f[2].c_str()) - 1); } } g->push_face(face); break; case 'g': if (!g->get_faces().empty()) { if (tokens.size() == 1) { g = new obj::group(); } else { g = new obj::group(tokens.at(1)); } m->push_group(g); } break; case 'm': m->set_material_library("fixtures/" + tokens[1]); break; case 'u': std::string material = std::string(tokens[1]); g->set_material(material); break; } } }
28.732673
69
0.334941
fuadsaud
7f54503df223b72945a5ec38fb4c399f5d40dc5c
45,452
cpp
C++
src/game/g_script.cpp
jumptohistory/jaymod
92d0a0334ac27da94b12280b0b42b615b8813c23
[ "Apache-2.0" ]
25
2016-05-27T11:53:58.000Z
2021-10-17T00:13:41.000Z
src/game/g_script.cpp
jumptohistory/jaymod
92d0a0334ac27da94b12280b0b42b615b8813c23
[ "Apache-2.0" ]
1
2016-07-09T05:25:03.000Z
2016-07-09T05:25:03.000Z
src/game/g_script.cpp
jumptohistory/jaymod
92d0a0334ac27da94b12280b0b42b615b8813c23
[ "Apache-2.0" ]
16
2016-05-28T23:06:50.000Z
2022-01-26T13:47:12.000Z
//=========================================================================== // // Name: g_script.c // Function: Wolfenstein Entity Scripting // Programmer: Ridah // Tab Size: 4 (real tabs) //=========================================================================== #include <bgame/impl.h> #include <omnibot/et/g_etbot_interface.h> /* Scripting that allows the designers to control the behaviour of entities according to each different scenario. */ vmCvar_t g_scriptDebug; // //==================================================================== // // action functions need to be declared here so they can be accessed in the scriptAction table qboolean G_ScriptAction_GotoMarker( gentity_t *ent, char *params ); qboolean G_ScriptAction_Wait( gentity_t *ent, char *params ); qboolean G_ScriptAction_Trigger( gentity_t *ent, char *params ); qboolean G_ScriptAction_PlaySound( gentity_t *ent, char *params ); qboolean G_ScriptAction_PlayAnim( gentity_t *ent, char *params ); qboolean G_ScriptAction_AlertEntity( gentity_t *ent, char *params ); qboolean G_ScriptAction_ToggleSpeaker( gentity_t *ent, char *params ); qboolean G_ScriptAction_DisableSpeaker( gentity_t *ent, char *params ); qboolean G_ScriptAction_EnableSpeaker( gentity_t *ent, char *params ); qboolean G_ScriptAction_Accum( gentity_t *ent, char *params ); qboolean G_ScriptAction_GlobalAccum( gentity_t *ent, char *params ); qboolean G_ScriptAction_Print( gentity_t *ent, char *params ); qboolean G_ScriptAction_FaceAngles( gentity_t *ent, char *params ); qboolean G_ScriptAction_ResetScript( gentity_t *ent, char *params ); qboolean G_ScriptAction_TagConnect( gentity_t *ent, char *params ); qboolean G_ScriptAction_Halt( gentity_t *ent, char *params ); qboolean G_ScriptAction_StopSound( gentity_t *ent, char *params ); //qboolean G_ScriptAction_StartCam( gentity_t *ent, char *params ); qboolean G_ScriptAction_EntityScriptName( gentity_t *ent, char *params); qboolean G_ScriptAction_AIScriptName( gentity_t *ent, char *params); qboolean G_ScriptAction_AxisRespawntime( gentity_t *ent, char *params ); qboolean G_ScriptAction_AlliedRespawntime( gentity_t *ent, char *params ); qboolean G_ScriptAction_NumberofObjectives( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetWinner( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetDefendingTeam( gentity_t *ent, char *params ); qboolean G_ScriptAction_Announce( gentity_t *ent, char *params ); qboolean G_ScriptAction_Announce_Icon( gentity_t *ent, char *params ); qboolean G_ScriptAction_AddTeamVoiceAnnounce( gentity_t *ent, char *params ); qboolean G_ScriptAction_RemoveTeamVoiceAnnounce( gentity_t *ent, char *params ); qboolean G_ScriptAction_TeamVoiceAnnounce( gentity_t *ent, char *params ); qboolean G_ScriptAction_EndRound( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetRoundTimelimit( gentity_t *ent, char *params ); qboolean G_ScriptAction_RemoveEntity( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetState( gentity_t *ent, char *params ); qboolean G_ScriptAction_VoiceAnnounce( gentity_t *ent, char *params); qboolean G_ScriptAction_FollowSpline( gentity_t *ent, char *params ); qboolean G_ScriptAction_FollowPath( gentity_t *ent, char *params ); qboolean G_ScriptAction_AbortMove( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetSpeed( gentity_t* ent, char *params ); qboolean G_ScriptAction_SetRotation( gentity_t* ent, char *params ); qboolean G_ScriptAction_StopRotation( gentity_t* ent, char *params ); qboolean G_ScriptAction_StartAnimation( gentity_t* ent, char *params ); qboolean G_ScriptAction_AttatchToTrain( gentity_t* ent, char *params ); qboolean G_ScriptAction_FreezeAnimation( gentity_t* ent, char *params ); qboolean G_ScriptAction_UnFreezeAnimation( gentity_t* ent, char *params ); qboolean G_ScriptAction_ShaderRemap( gentity_t* ent, char *params ); qboolean G_ScriptAction_ShaderRemapFlush( gentity_t* ent, char *params ); qboolean G_ScriptAction_ChangeModel( gentity_t* ent, char *params ); qboolean G_ScriptAction_SetChargeTimeFactor( gentity_t* ent, char *params ); qboolean G_ScriptAction_SetDamagable( gentity_t *ent, char *params ); qboolean G_ScriptAction_StartCam( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetInitialCamera( gentity_t *ent, char *params ); qboolean G_ScriptAction_StopCam( gentity_t *ent, char *params ); qboolean G_ScriptAction_RepairMG42( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetHQStatus( gentity_t *ent, char *params ); qboolean G_ScriptAction_PrintAccum(gentity_t *ent, char *params ); qboolean G_ScriptAction_PrintGlobalAccum(gentity_t *ent, char *params ); qboolean G_ScriptAction_BotDebugging(gentity_t *ent, char *params ); qboolean G_ScriptAction_ObjectiveStatus( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetModelFromBrushmodel( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetPosition( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetAutoSpawn( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetMainObjective( gentity_t *ent, char *params ); qboolean G_ScriptAction_SpawnRubble( gentity_t *ent, char *params ); qboolean G_ScriptAction_AllowTankExit( gentity_t *ent, char *params ); qboolean G_ScriptAction_AllowTankEnter( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetTankAmmo( gentity_t *ent, char *params ); qboolean G_ScriptAction_AddTankAmmo( gentity_t *ent, char *params ); qboolean G_ScriptAction_Kill( gentity_t *ent, char *params ); qboolean G_ScriptAction_DisableMessage( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetGlobalFog( gentity_t *ent, char *params ); qboolean G_ScriptAction_Cvar( gentity_t *ent, char *params ); qboolean G_ScriptAction_AbortIfWarmup( gentity_t *ent, char *params ); qboolean G_ScriptAction_AbortIfNotSinglePlayer( gentity_t *ent, char *params ); qboolean G_ScriptAction_MusicStart( gentity_t *ent, char *params ); qboolean G_ScriptAction_MusicPlay( gentity_t *ent, char *params ); qboolean G_ScriptAction_MusicStop( gentity_t *ent, char *params ); qboolean G_ScriptAction_MusicQueue( gentity_t *ent, char *params ); qboolean G_ScriptAction_MusicFade( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetDebugLevel( gentity_t *ent, char *params ); qboolean G_ScriptAction_FadeAllSounds( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetBotGoalState( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetBotGoalPriority( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetAASState( gentity_t *ent, char *params ); qboolean G_ScriptAction_Construct(gentity_t *ent, char *params ) ; qboolean G_ScriptAction_ConstructibleClass( gentity_t *ent, char *params ) ; qboolean G_ScriptAction_ConstructibleChargeBarReq( gentity_t *ent, char *params ) ; qboolean G_ScriptAction_ConstructibleConstructXPBonus( gentity_t *ent, char *params ) ; qboolean G_ScriptAction_ConstructibleDestructXPBonus( gentity_t *ent, char *params ) ; qboolean G_ScriptAction_ConstructibleHealth( gentity_t *ent, char *params ) ; qboolean G_ScriptAction_ConstructibleWeaponclass( gentity_t *ent, char *params ) ; qboolean G_ScriptAction_ConstructibleDuration( gentity_t *ent, char *params ) ; //bani qboolean etpro_ScriptAction_SetValues( gentity_t *ent, char *params ); qboolean etpro_ScriptAction_Create( gentity_t *ent, char *params ); qboolean etpro_ScriptAction_DeleteEntity( gentity_t *ent, char *params ); // these are the actions that each event can call g_script_stack_action_t gScriptActions[] = { {"gotomarker", G_ScriptAction_GotoMarker}, {"playsound", G_ScriptAction_PlaySound}, {"playanim", G_ScriptAction_PlayAnim}, {"wait", G_ScriptAction_Wait}, {"trigger", G_ScriptAction_Trigger}, {"alertentity", G_ScriptAction_AlertEntity}, {"togglespeaker", G_ScriptAction_ToggleSpeaker}, {"disablespeaker", G_ScriptAction_DisableSpeaker}, {"enablespeaker", G_ScriptAction_EnableSpeaker}, {"accum", G_ScriptAction_Accum}, {"globalaccum", G_ScriptAction_GlobalAccum}, {"print", G_ScriptAction_Print}, {"faceangles", G_ScriptAction_FaceAngles}, {"resetscript", G_ScriptAction_ResetScript}, {"attachtotag", G_ScriptAction_TagConnect}, {"halt", G_ScriptAction_Halt}, {"stopsound", G_ScriptAction_StopSound}, // {"startcam", G_ScriptAction_StartCam}, {"entityscriptname", G_ScriptAction_EntityScriptName}, {"aiscriptname", G_ScriptAction_AIScriptName}, {"wm_axis_respawntime", G_ScriptAction_AxisRespawntime}, {"wm_allied_respawntime", G_ScriptAction_AlliedRespawntime}, {"wm_number_of_objectives", G_ScriptAction_NumberofObjectives}, {"wm_setwinner", G_ScriptAction_SetWinner}, {"wm_set_defending_team", G_ScriptAction_SetDefendingTeam}, {"wm_announce", G_ScriptAction_Announce}, {"wm_teamvoiceannounce", G_ScriptAction_TeamVoiceAnnounce}, {"wm_addteamvoiceannounce", G_ScriptAction_AddTeamVoiceAnnounce}, {"wm_removeteamvoiceannounce", G_ScriptAction_RemoveTeamVoiceAnnounce}, {"wm_announce_icon", G_ScriptAction_Announce_Icon}, {"wm_endround", G_ScriptAction_EndRound}, {"wm_set_round_timelimit", G_ScriptAction_SetRoundTimelimit}, {"wm_voiceannounce", G_ScriptAction_VoiceAnnounce}, {"wm_objective_status", G_ScriptAction_ObjectiveStatus}, {"wm_set_main_objective", G_ScriptAction_SetMainObjective}, {"remove", G_ScriptAction_RemoveEntity}, {"setstate", G_ScriptAction_SetState}, {"followspline", G_ScriptAction_FollowSpline}, {"followpath", G_ScriptAction_FollowPath}, {"abortmove", G_ScriptAction_AbortMove}, {"setspeed", G_ScriptAction_SetSpeed}, {"setrotation", G_ScriptAction_SetRotation}, {"stoprotation", G_ScriptAction_StopRotation}, {"startanimation", G_ScriptAction_StartAnimation}, {"attatchtotrain", G_ScriptAction_AttatchToTrain}, {"freezeanimation", G_ScriptAction_FreezeAnimation}, {"unfreezeanimation", G_ScriptAction_UnFreezeAnimation}, {"remapshader", G_ScriptAction_ShaderRemap}, {"remapshaderflush", G_ScriptAction_ShaderRemapFlush}, {"changemodel", G_ScriptAction_ChangeModel}, {"setchargetimefactor", G_ScriptAction_SetChargeTimeFactor}, {"setdamagable", G_ScriptAction_SetDamagable}, {"startcam", G_ScriptAction_StartCam}, {"SetInitialCamera", G_ScriptAction_SetInitialCamera}, {"stopcam", G_ScriptAction_StopCam}, {"repairmg42", G_ScriptAction_RepairMG42}, {"sethqstatus", G_ScriptAction_SetHQStatus}, {"printaccum", G_ScriptAction_PrintAccum}, {"printglobalaccum", G_ScriptAction_PrintGlobalAccum}, {"botgebugging", G_ScriptAction_BotDebugging}, {"cvar", G_ScriptAction_Cvar}, {"abortifwarmup", G_ScriptAction_AbortIfWarmup}, {"abortifnotsingleplayer", G_ScriptAction_AbortIfNotSinglePlayer}, {"mu_start", G_ScriptAction_MusicStart}, {"mu_play", G_ScriptAction_MusicPlay}, {"mu_stop", G_ScriptAction_MusicStop}, {"mu_queue", G_ScriptAction_MusicQueue}, {"mu_fade", G_ScriptAction_MusicFade}, {"setdebuglevel", G_ScriptAction_SetDebugLevel}, {"setposition", G_ScriptAction_SetPosition}, {"setautospawn", G_ScriptAction_SetAutoSpawn}, // Gordon: going for longest silly script command ever here :) (sets a model for a brush to one stolen from a func_brushmodel {"setmodelfrombrushmodel", G_ScriptAction_SetModelFromBrushmodel}, // fade all sounds up or down {"fadeallsounds", G_ScriptAction_FadeAllSounds}, {"setbotgoalstate", G_ScriptAction_SetBotGoalState}, {"setbotgoalpriority", G_ScriptAction_SetBotGoalPriority}, {"setaasstate", G_ScriptAction_SetAASState}, {"construct", G_ScriptAction_Construct}, {"spawnrubble", G_ScriptAction_SpawnRubble}, {"setglobalfog", G_ScriptAction_SetGlobalFog}, {"allowtankexit", G_ScriptAction_AllowTankExit}, {"allowtankenter", G_ScriptAction_AllowTankEnter}, {"settankammo", G_ScriptAction_SetTankAmmo}, {"addtankammo", G_ScriptAction_AddTankAmmo}, {"kill", G_ScriptAction_Kill}, {"disablemessage", G_ScriptAction_DisableMessage}, //bani { "set", etpro_ScriptAction_SetValues }, { "create", etpro_ScriptAction_Create }, { "delete", etpro_ScriptAction_DeleteEntity }, { "constructible_class", G_ScriptAction_ConstructibleClass }, { "constructible_chargebarreq", G_ScriptAction_ConstructibleChargeBarReq }, { "constructible_constructxpbonus", G_ScriptAction_ConstructibleConstructXPBonus }, { "constructible_destructxpbonus", G_ScriptAction_ConstructibleDestructXPBonus }, { "constructible_health", G_ScriptAction_ConstructibleHealth }, { "constructible_weaponclass", G_ScriptAction_ConstructibleWeaponclass }, { "constructible_duration" , G_ScriptAction_ConstructibleDuration }, {NULL, NULL} }; static qboolean G_Script_EventMatch_StringEqual( g_script_event_t *event, const char* eventParm ); static qboolean G_Script_EventMatch_IntInRange( g_script_event_t *event, const char* eventParm ); // the list of events that can start an action sequence g_script_event_define_t gScriptEvents[] = { {"spawn", NULL}, // called as each character is spawned into the game {"trigger", G_Script_EventMatch_StringEqual}, // something has triggered us (always followed by an identifier) {"pain", G_Script_EventMatch_IntInRange}, // we've been hurt {"death", NULL}, // RIP {"activate", G_Script_EventMatch_StringEqual}, // something has triggered us [activator team] {"stopcam", NULL}, {"playerstart", NULL}, {"built", G_Script_EventMatch_StringEqual}, {"buildstart", G_Script_EventMatch_StringEqual}, {"decayed", G_Script_EventMatch_StringEqual}, {"destroyed", G_Script_EventMatch_StringEqual}, {"rebirth", NULL}, {"failed", NULL}, {"dynamited", NULL}, {"defused", NULL}, {"mg42", G_Script_EventMatch_StringEqual}, {"message", G_Script_EventMatch_StringEqual}, // contains a sequence of VO in a message {"exploded", NULL}, {NULL, NULL} }; /* =============== G_Script_EventMatch_StringEqual =============== */ static qboolean G_Script_EventMatch_StringEqual( g_script_event_t *event, const char* eventParm ) { if (eventParm && !Q_stricmp( event->params, eventParm )) return qtrue; else return qfalse; } /* =============== G_Script_EventMatch_IntInRange =============== */ static qboolean G_Script_EventMatch_IntInRange( g_script_event_t *event, const char* eventParm ) { char* pString, *token; int int1, int2, eInt; // get the cast name pString = (char*)eventParm; token = COM_ParseExt( &pString, qfalse ); int1 = atoi( token ); token = COM_ParseExt( &pString, qfalse ); int2 = atoi( token ); eInt = atoi( event->params ); if( eventParm && eInt > int1 && eInt <= int2 ) { return qtrue; } else { return qfalse; } } /* =============== G_Script_EventForString =============== */ int G_Script_EventForString( const char *string ) { int i, hash; hash = BG_StringHashValue_Lwr( string ); for( i = 0; gScriptEvents[i].eventStr; i++) { if( gScriptEvents[i].hash == hash && !Q_stricmp( string, gScriptEvents[i].eventStr ) ) { return i; } } return -1; } /* =============== G_Script_ActionForString =============== */ g_script_stack_action_t *G_Script_ActionForString( char *string ) { int i, hash; hash = BG_StringHashValue_Lwr( string ); for( i = 0; gScriptActions[i].actionString; i++ ) { if( gScriptActions[i].hash == hash && !Q_stricmp( string, gScriptActions[i].actionString ) ) { return &gScriptActions[i]; } } return NULL; } /* ============= G_Script_ScriptLoad Loads the script for the current level into the buffer ============= */ void G_Script_ScriptLoad( void ) { char filename[MAX_QPATH]; vmCvar_t mapname; fileHandle_t f; int len; qboolean found = qfalse; trap_Cvar_Register( &g_scriptDebug, "g_scriptDebug", "0", 0 ); level.scriptEntity = NULL; trap_Cvar_VariableStringBuffer( "g_scriptName", filename, sizeof(filename) ); if (strlen( filename ) > 0) { trap_Cvar_Register( &mapname, "g_scriptName", "", CVAR_CHEAT ); } else { trap_Cvar_Register( &mapname, "mapname", "", CVAR_SERVERINFO | CVAR_ROM ); } // Jaybird - etpro mapscripts // Check for custom mapscript first if(g_mapScriptDirectory.string[0]) { Q_strncpyz(filename, g_mapScriptDirectory.string, sizeof(filename)); Q_strcat(filename, sizeof(filename), "/"); Q_strcat( filename, sizeof(filename), mapname.string ); if ( g_gametype.integer == GT_WOLF_LMS ) { Q_strcat( filename, sizeof(filename), "_lms" ); } Q_strcat( filename, sizeof(filename), ".script" ); len = trap_FS_FOpenFile( filename, &f, FS_READ ); if(len > 0) found = qtrue; } // If it wasn't found, run the standard script if(!found) { Q_strncpyz( filename, "maps/", sizeof(filename) ); Q_strcat( filename, sizeof(filename), mapname.string ); if ( g_gametype.integer == GT_WOLF_LMS ) { Q_strcat( filename, sizeof(filename), "_lms" ); } Q_strcat( filename, sizeof(filename), ".script" ); len = trap_FS_FOpenFile( filename, &f, FS_READ ); } // make sure we clear out the temporary scriptname trap_Cvar_Set( "g_scriptName", "" ); if( len < 0 ) { return; } // END Mad Doc - TDF // Arnout: make sure we terminate the script with a '\0' to prevent parser from choking //level.scriptEntity = G_Alloc( len ); //trap_FS_Read( level.scriptEntity, len, f ); level.scriptEntity = (char*)G_Alloc( len + 1 ); trap_FS_Read( level.scriptEntity, len, f ); *(level.scriptEntity + len) = '\0'; // Gordon: and make sure ppl haven't put stuff with uppercase in the string table.. G_Script_EventStringInit(); // Gordon: discard all the comments NOW, so we dont deal with them inside scripts // Gordon: disabling for a sec, wanna check if i can get proper line numbers from error output // COM_Compress( level.scriptEntity ); trap_FS_FCloseFile( f ); } /* ============== G_Script_ParseSpawnbot Parses "Spawnbot" command, precaching a custom character if specified ============== */ void G_Script_ParseSpawnbot( char **ppScript, char params[], int paramsize ) { qboolean parsingCharacter = qfalse; char *token; token = COM_ParseExt(ppScript, qfalse ); while( token[0] ) { // if we are currently parsing a spawnbot command, check the parms for // a custom character, which we will need to precache on the client // did we just see a '/character' parm? if( parsingCharacter ) { parsingCharacter = qfalse; G_CharacterIndex( token ); if( !BG_FindCharacter( token ) ) { bg_character_t *character = BG_FindFreeCharacter( token ); Q_strncpyz( character->characterFile, token, sizeof(character->characterFile) ); if( !G_RegisterCharacter( token, character ) ) { G_Error( "ERROR: G_Script_ParseSpawnbot: failed to load character file '%s'\n", token ); } } #ifdef DEBUG G_DPrintf( "precached character %s\n", token ); #endif } else if( !Q_stricmp( token, "/character" ) ) { parsingCharacter = qtrue; } if( strlen( params ) ) // add a space between each param Q_strcat( params, paramsize, " " ); if( strrchr(token,' ' )) // need to wrap this param in quotes since it has more than one word Q_strcat( params, paramsize, "\"" ); Q_strcat( params, paramsize, token ); if( strrchr(token,' ') ) // need to wrap this param in quotes since it has more than one word Q_strcat( params, paramsize, "\"" ); token = COM_ParseExt( ppScript, qfalse ); } } /* ============== G_Script_ScriptParse Parses the script for the given entity ============== */ void G_Script_ScriptParse( gentity_t *ent ) { char *pScript; char *token; qboolean wantName; qboolean inScript; int eventNum; g_script_event_t events[G_MAX_SCRIPT_STACK_ITEMS]; int numEventItems; g_script_event_t *curEvent; // DHM - Nerve :: Some of our multiplayer script commands have longer parameters //char params[MAX_QPATH]; char params[MAX_INFO_STRING]; // dhm - end g_script_stack_action_t *action; int i; int bracketLevel; qboolean buildScript; if (!ent->scriptName) return; if (!level.scriptEntity) return; buildScript = (qboolean)trap_Cvar_VariableIntegerValue( "com_buildScript" ); pScript = level.scriptEntity; wantName = qtrue; inScript = qfalse; COM_BeginParseSession("G_Script_ScriptParse"); bracketLevel = 0; numEventItems = 0; memset( events, 0, sizeof(events) ); while (1) { token = COM_Parse( &pScript ); if ( !token[0] ) { if ( !wantName ) { G_Error( "G_Script_ScriptParse(), Error (line %d): '}' expected, end of script found.\n", COM_GetCurrentParseLine() ); } break; } // end of script if ( token[0] == '}' ) { if ( inScript ) { break; } if ( wantName ) { G_Error( "G_Script_ScriptParse(), Error (line %d): '}' found, but not expected.\n", COM_GetCurrentParseLine() ); } wantName = qtrue; } else if ( token[0] == '{' ) { if ( wantName ) { G_Error( "G_Script_ScriptParse(), Error (line %d): '{' found, NAME expected.\n", COM_GetCurrentParseLine() ); } } else if ( wantName ) { if ( !Q_stricmp( token, "bot" ) ) { // a bot, skip this whole entry SkipRestOfLine ( &pScript ); // skip this section SkipBracedSection( &pScript ); // continue; } if( !Q_stricmp( token, "entity" ) ) { // this is an entity, so go back to look for a name continue; } if ( !Q_stricmp( ent->scriptName, token ) ) { inScript = qtrue; numEventItems = 0; } wantName = qfalse; } else if ( inScript ) { Q_strlwr( token ); eventNum = G_Script_EventForString( token ); if (eventNum < 0) { G_Error( "G_Script_ScriptParse(), Error (line %d): unknown event: %s.\n", COM_GetCurrentParseLine(), token ); } if( numEventItems >= G_MAX_SCRIPT_STACK_ITEMS ) { G_Error( "G_Script_ScriptParse(), Error (line %d): G_MAX_SCRIPT_STACK_ITEMS reached (%d)\n", COM_GetCurrentParseLine(), G_MAX_SCRIPT_STACK_ITEMS ); } curEvent = &events[numEventItems]; curEvent->eventNum = eventNum; memset( params, 0, sizeof(params) ); // parse any event params before the start of this event's actions while ((token = COM_Parse( &pScript )) != NULL && (token[0] != '{')) { if( !token[0] ) { G_Error( "G_Script_ScriptParse(), Error (line %d): '}' expected, end of script found.\n", COM_GetCurrentParseLine() ); } if(strlen( params )) { // add a space between each param Q_strcat( params, sizeof(params), " " ); } Q_strcat( params, sizeof(params), token ); } if( strlen( params ) ) { // copy the params into the event curEvent->params = (char*)G_Alloc( strlen( params ) + 1 ); Q_strncpyz( curEvent->params, params, strlen(params)+1 ); } // parse the actions for this event while( (token = COM_Parse( &pScript )) != NULL && (token[0] != '}') ) { if( !token[0] ) { G_Error( "G_Script_ScriptParse(), Error (line %d): '}' expected, end of script found.\n", COM_GetCurrentParseLine() ); } action = G_Script_ActionForString( token ); if( !action ) { G_Error( "G_Script_ScriptParse(), Error (line %d): unknown action: %s.\n", COM_GetCurrentParseLine(), token ); } curEvent->stack.items[curEvent->stack.numItems].action = action; memset( params, 0, sizeof(params) ); // Ikkyo - Parse for {}'s if this is a set command if( !Q_stricmp( action->actionString, "set" ) || !Q_stricmp( action->actionString, "create" ) || !Q_stricmp( action->actionString, "delete" ) ) { token = COM_Parse( &pScript ); if( token[0] != '{' ) { COM_ParseError( "'{' expected, found: %s.\n", token ); } while( ( token = COM_Parse( &pScript ) ) && ( token[0] != '}') ) { if ( strlen( params ) ) // add a space between each param Q_strcat( params, sizeof( params ), " " ); if ( strrchr( token,' ') ) // need to wrap this param in quotes since it has more than one word Q_strcat( params, sizeof( params ), "\"" ); Q_strcat( params, sizeof( params ), token ); if ( strrchr( token,' ') ) // need to wrap this param in quotes since it has mor Q_strcat( params, sizeof( params ), "\"" ); } } else // hackly precaching of custom characters if( !Q_stricmp(token, "spawnbot") ) { // this is fairly indepth, so I'll move it to a separate function for readability G_Script_ParseSpawnbot( &pScript, params, MAX_INFO_STRING ); } else { token = COM_ParseExt( &pScript, qfalse ); for (i=0; token[0]; i++) { if( strlen( params ) ) // add a space between each param Q_strcat( params, sizeof(params), " " ); if( i == 0 ) { // Special case: playsound's need to be cached on startup to prevent in-game pauses if (!Q_stricmp(action->actionString, "playsound")) { G_SoundIndex(token); } else if (!Q_stricmp(action->actionString, "changemodel")) { G_ModelIndex(token); } else if ( buildScript && ( !Q_stricmp(action->actionString, "mu_start") || !Q_stricmp(action->actionString, "mu_play") || !Q_stricmp(action->actionString, "mu_queue") || !Q_stricmp(action->actionString, "startcam")) ) { if(strlen(token)) // we know there's a [0], but don't know if it's '0' trap_SendServerCommand(-1, va("addToBuild %s\n", token) ); } } if(i == 0 || i == 1) { if (!Q_stricmp(action->actionString, "remapshader")) { G_ShaderIndex(token); } } if (strrchr(token,' ')) // need to wrap this param in quotes since it has more than one word Q_strcat( params, sizeof(params), "\"" ); Q_strcat( params, sizeof(params), token ); if (strrchr(token,' ')) // need to wrap this param in quotes since it has more than one word Q_strcat( params, sizeof(params), "\"" ); token = COM_ParseExt( &pScript, qfalse ); } } if (strlen( params )) { // copy the params into the event curEvent->stack.items[curEvent->stack.numItems].params = (char*)G_Alloc( strlen( params ) + 1 ); Q_strncpyz( curEvent->stack.items[curEvent->stack.numItems].params, params, strlen(params)+1 ); } curEvent->stack.numItems++; if (curEvent->stack.numItems >= G_MAX_SCRIPT_STACK_ITEMS) { G_Error( "G_Script_ScriptParse(): script exceeded G_MAX_SCRIPT_STACK_ITEMS (%d), line %d\n", G_MAX_SCRIPT_STACK_ITEMS, COM_GetCurrentParseLine() ); } } numEventItems++; } else { // skip this character completely // TTimo gcc: suggest parentheses around assignment used as truth value while ( ( token = COM_Parse( &pScript ) ) != NULL ) { if (!token[0]) { G_Error( "G_Script_ScriptParse(), Error (line %d): '}' expected, end of script found.\n", COM_GetCurrentParseLine() ); } else if (token[0] == '{') { bracketLevel++; } else if (token[0] == '}') { if (!--bracketLevel) break; } } } } // alloc and copy the events into the gentity_t for this cast if (numEventItems > 0) { ent->scriptEvents = (g_script_event_t*)G_Alloc( sizeof(g_script_event_t) * numEventItems ); memcpy( ent->scriptEvents, events, sizeof(g_script_event_t) * numEventItems ); ent->numScriptEvents = numEventItems; } } /* ================ G_Script_ScriptChange ================ */ qboolean G_Script_ScriptRun( gentity_t *ent ); void G_Script_ScriptChange( gentity_t *ent, int newScriptNum ) { g_script_status_t scriptStatusBackup; // backup the current scripting memcpy( &scriptStatusBackup, &ent->scriptStatus, sizeof(g_script_status_t) ); // set the new script to this cast, and reset script status ent->scriptStatus.scriptEventIndex = newScriptNum; ent->scriptStatus.scriptStackHead = 0; ent->scriptStatus.scriptStackChangeTime = level.time; ent->scriptStatus.scriptId = scriptStatusBackup.scriptId + 1; ent->scriptStatus.scriptFlags |= SCFL_FIRST_CALL; // try and run the script, if it doesn't finish, then abort the current script (discard backup) if ( G_Script_ScriptRun( ent ) && (ent->scriptStatus.scriptId == scriptStatusBackup.scriptId + 1)) { // make sure we didnt change our script via a third party // completed successfully memcpy( &ent->scriptStatus, &scriptStatusBackup, sizeof(g_script_status_t) ); ent->scriptStatus.scriptFlags &= ~SCFL_FIRST_CALL; } } // Gordon: lower the strings and hash them void G_Script_EventStringInit( void ) { int i; for( i = 0; gScriptEvents[i].eventStr; i++) { gScriptEvents[i].hash = BG_StringHashValue_Lwr( gScriptEvents[i].eventStr ); } for( i = 0; gScriptActions[i].actionString; i++) { gScriptActions[i].hash = BG_StringHashValue_Lwr( gScriptActions[i].actionString ); } } /* ================ G_Script_GetEventIndex returns the event index within the entity for the specified event string xkan, 10/28/2002 - extracted from G_Script_ScriptEvent. ================ */ static int G_Script_GetEventIndex( gentity_t *ent, const char* eventStr, const char* params ) { int i, eventNum = -1; int hash = BG_StringHashValue_Lwr( eventStr ); // find out which event this is for( i = 0; gScriptEvents[i].eventStr; i++) { if( gScriptEvents[i].hash == hash && !Q_stricmp( eventStr, gScriptEvents[i].eventStr ) ) { // match found eventNum = i; break; } } if( eventNum < 0 ) { if( g_cheats.integer ) { // dev mode G_Printf( "devmode-> G_Script_GetEventIndex(), unknown event: %s\n", eventStr ); } return -1; } // show debugging info if (g_scriptDebug.integer) { G_Printf( "%i : (%s) GScript event: %s %s\n", level.time, ent->scriptName ? ent->scriptName : "n/a", eventStr, params ? params : "" ); } // see if this entity has this event for( i = 0; i < ent->numScriptEvents; i++) { if (ent->scriptEvents[i].eventNum == eventNum) { if( (!ent->scriptEvents[i].params) || (!gScriptEvents[eventNum].eventMatch || gScriptEvents[eventNum].eventMatch( &ent->scriptEvents[i], params ))) { return i; } } } return -1; // event not found/matched in this ent } /* ================ G_Script_ScriptEvent An event has occured, for which a script may exist ================ */ void G_Script_ScriptEvent( gentity_t *ent, const char* eventStr, const char* params ) { int i = G_Script_GetEventIndex(ent, eventStr, params); if (i>=0) G_Script_ScriptChange( ent, i ); ////////////////////////////////////////////////////////////////////////// // skip these if(!Q_stricmp(eventStr, "trigger") || !Q_stricmp(eventStr, "activate") || !Q_stricmp(eventStr, "spawn") || !Q_stricmp(eventStr, "death") || !Q_stricmp(eventStr, "pain") || !Q_stricmp(eventStr, "playerstart")) return; if(!Q_stricmp(eventStr, "defused")) { Bot_Util_SendTrigger(ent, NULL, va("Defused at %s.", ent->parent ? ent->parent->track : ent->track), eventStr); } else if(!Q_stricmp(eventStr, "dynamited")) { Bot_Util_SendTrigger(ent, NULL, va("Planted at %s.", ent->parent ? ent->parent->track : ent->track), eventStr); } else if(!Q_stricmp(eventStr, "destroyed")) { Bot_Util_SendTrigger(ent, NULL, va("%s Destroyed.", ent->parent ? ent->parent->track : ent->track), eventStr); } else if(!Q_stricmp(eventStr, "exploded")) { Bot_Util_SendTrigger(ent, NULL, va("Explode_%s Exploded.", _GetEntityName(ent) ),eventStr); } } /* ============= G_Script_ScriptRun returns qtrue if the script completed ============= */ qboolean G_Script_ScriptRun( gentity_t *ent ) { g_script_stack_t *stack; int oldScriptId; if (!ent->scriptEvents) { ent->scriptStatus.scriptEventIndex = -1; return qtrue; } // if we are still doing a gotomarker, process the movement if (ent->scriptStatus.scriptFlags & SCFL_GOING_TO_MARKER) { G_ScriptAction_GotoMarker( ent, NULL ); } // if we are animating, do the animation if (ent->scriptStatus.scriptFlags & SCFL_ANIMATING) { G_ScriptAction_PlayAnim( ent, ent->scriptStatus.animatingParams ); } if (ent->scriptStatus.scriptEventIndex < 0) return qtrue; stack = &ent->scriptEvents[ent->scriptStatus.scriptEventIndex].stack; if (!stack->numItems) { ent->scriptStatus.scriptEventIndex = -1; return qtrue; } // // show debugging info if (g_scriptDebug.integer && ent->scriptStatus.scriptStackChangeTime == level.time) { if (ent->scriptStatus.scriptStackHead < stack->numItems) { G_Printf( "%i : (%s) GScript command: %s %s\n", level.time, ent->scriptName, stack->items[ent->scriptStatus.scriptStackHead].action->actionString, (stack->items[ent->scriptStatus.scriptStackHead].params ? stack->items[ent->scriptStatus.scriptStackHead].params : "") ); } } // while (ent->scriptStatus.scriptStackHead < stack->numItems) { oldScriptId = ent->scriptStatus.scriptId; if (!stack->items[ent->scriptStatus.scriptStackHead].action->actionFunc( ent, stack->items[ent->scriptStatus.scriptStackHead].params )) { ent->scriptStatus.scriptFlags &= ~SCFL_FIRST_CALL; return qfalse; } //if the scriptId changed, a new event was triggered in our scripts which did not finish if (oldScriptId != ent->scriptStatus.scriptId) { return qfalse; } // move to the next action in the script ent->scriptStatus.scriptStackHead++; // record the time that this new item became active ent->scriptStatus.scriptStackChangeTime = level.time; // ent->scriptStatus.scriptFlags |= SCFL_FIRST_CALL; // show debugging info if (g_scriptDebug.integer) { if (ent->scriptStatus.scriptStackHead < stack->numItems) { G_Printf( "%i : (%s) GScript command: %s %s\n", level.time, ent->scriptName, stack->items[ent->scriptStatus.scriptStackHead].action->actionString, (stack->items[ent->scriptStatus.scriptStackHead].params ? stack->items[ent->scriptStatus.scriptStackHead].params : "") ); } } } ent->scriptStatus.scriptEventIndex = -1; return qtrue; } //================================================================================ // Script Entities void mountedmg42_fire( gentity_t *other ) { vec3_t forward, right, up; vec3_t muzzle; gentity_t *self; if( !( self = other->tankLink ) ) { return; } AngleVectors( other->client->ps.viewangles, forward, right, up ); VectorCopy( other->s.pos.trBase, muzzle ); // VectorMA( muzzle, 42, up, muzzle ); muzzle[2] += other->client->ps.viewheight; VectorMA( muzzle, 58, forward, muzzle ); SnapVector( muzzle ); if( self->s.density & 8 ) { Fire_Lead_Ext( other, other, MG42_SPREAD_MP, MG42_DAMAGE_MP, muzzle, forward, right, up, MOD_BROWNING ); } else { Fire_Lead_Ext( other, other, MG42_SPREAD_MP, MG42_DAMAGE_MP, muzzle, forward, right, up, MOD_MG42 ); } } void script_linkentity(gentity_t *ent) { // this is required since non-solid brushes need to be linked but not solid trap_LinkEntity(ent); // if ((ent->s.eType == ET_MOVER) && !(ent->spawnflags & 2)) { // ent->s.solid = 0; // } } void script_mover_die(gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod) { G_Script_ScriptEvent( self, "death", "" ); if (!(self->spawnflags & 8)) { G_FreeEntity( self ); } if( self->tankLink ) { G_LeaveTank( self->tankLink, qtrue ); } self->die = NULL; } void script_mover_set_blocking( gentity_t *ent ) { if (ent->r.linked && ent->r.contents == CONTENTS_SOLID) { G_SetAASBlockingEntity( ent, AAS_AREA_AVOID ); } } void script_mover_aas_blocking( gentity_t *ent ) { if( ent->timestamp <= level.time ) { // are we moving? if (ent->s.pos.trType != TR_STATIONARY /*VectorLengthSquared( ent->s.pos.trDelta )*/) { // never block while moving if (ent->AASblocking) { G_SetAASBlockingEntity( ent, AAS_AREA_ENABLED ); } } else if (!VectorCompare( ent->s.pos.trBase, ent->botAreaPos )) { script_mover_set_blocking( ent ); VectorCopy( ent->s.pos.trBase, ent->botAreaPos ); } ent->timestamp = level.time + 500; } if( ent->spawnflags & 128 ) { if( !ent->tankLink ) { if( ent->mg42weapHeat ) { ent->mg42weapHeat -= int(300.0f * FRAMETIME * 0.001f); if( ent->mg42weapHeat < 0 ) ent->mg42weapHeat = 0; } if( ent->backupWeaponTime ) { ent->backupWeaponTime -= FRAMETIME; if( ent->backupWeaponTime < 0 ) ent->backupWeaponTime = 0; } } } ent->nextthink = level.time + FRAMETIME; } void script_mover_spawn(gentity_t *ent) { if (ent->spawnflags & 128) { if(!ent->tagBuffer) { ent->nextTrain = ent; } else { gentity_t* tent = G_FindByTargetname( NULL, ent->tagBuffer); if(!tent) { ent->nextTrain = ent; } else { ent->nextTrain = tent; } } ent->s.effect3Time = ent->nextTrain-g_entities; } if (ent->spawnflags & 2) { ent->clipmask = CONTENTS_SOLID; ent->r.contents = CONTENTS_SOLID; } else { ent->s.eFlags |= EF_NONSOLID_BMODEL; ent->clipmask = 0; ent->r.contents = 0; } script_linkentity(ent); // now start thinking process which controls AAS interaction script_mover_set_blocking( ent ); ent->think = script_mover_aas_blocking; ent->nextthink = level.time + 200; } void script_mover_use(gentity_t *ent, gentity_t *other, gentity_t *activator) { if(ent->spawnflags & 8) { if(ent->count) { ent->health = ent->count; ent->s.dl_intensity = ent->health; G_Script_ScriptEvent( ent, "rebirth", "" ); ent->die = script_mover_die; } } else { script_mover_spawn(ent); } } void script_mover_blocked( gentity_t *ent, gentity_t *other ) { // remove it, we must not stop for anything or it will screw up script timing if ( !other->client && other->s.eType != ET_CORPSE ) { // /me slaps nerve // except CTF flags!!!! if( other->s.eType == ET_ITEM && other->item->giType == IT_TEAM ) { Team_DroppedFlagThink( other ); return; } G_TempEntity( other->s.origin, EV_ITEM_POP ); G_FreeEntity( other ); return; } // FIXME: we could have certain entities stop us, thereby "pausing" movement // until they move out the way. then we can just call the GotoMarker() again, // telling it that we are just now calling it for the first time, so it should // start us on our way again (theoretically speaking). // kill them G_Damage( other, ent, ent, NULL, NULL, 9999, 0, MOD_CRUSH ); } /*QUAKED script_mover (0.5 0.25 1.0) ? TRIGGERSPAWN SOLID EXPLOSIVEDAMAGEONLY RESURECTABLE COMPASS ALLIED AXIS MOUNTED_GUN Scripted brush entity. A simplified means of moving brushes around based on events. "modelscale" - Scale multiplier (defaults to 1, and scales uniformly) "modelscale_vec" - Set scale per-axis. Overrides "modelscale", so if you have both the "modelscale" is ignored "model2" optional md3 to draw over the solid clip brush "scriptname" name used for scripting purposes (like aiName in AI scripting) "health" optionally make this entity damagable "description" used with health, if the entity is damagable, it draws a healthbar with this description above it. */ void SP_script_mover(gentity_t *ent) { float scale[3] = {1,1,1}; vec3_t scalevec; char tagname[MAX_QPATH]; char* modelname; char* tagent; char cs[MAX_INFO_STRING]; char* s; if (!ent->model) G_Error("script_mover must have a \"model\"\n" ); if (!ent->scriptName) G_Error("script_mover must have a \"scriptname\"\n" ); ent->blocked = script_mover_blocked; // first position at start VectorCopy( ent->s.origin, ent->pos1 ); // VectorCopy( ent->r.currentOrigin, ent->pos1 ); VectorCopy( ent->pos1, ent->pos2 ); // don't go anywhere just yet trap_SetBrushModel( ent, ent->model ); InitMover( ent ); ent->reached = NULL; ent->s.animMovetype = 0; ent->s.density = 0; if (ent->spawnflags & 256) { ent->s.density |= 2; } if (ent->spawnflags & 8) { ent->use = script_mover_use; } if (ent->spawnflags & 16) { ent->s.time2 = 1; } else { ent->s.time2 = 0; } if (ent->spawnflags & 32) { ent->s.teamNum = TEAM_ALLIES; } else if (ent->spawnflags & 64) { ent->s.teamNum = TEAM_AXIS; } else { ent->s.teamNum = TEAM_FREE; } if (ent->spawnflags & 1) { ent->use = script_mover_use; trap_UnlinkEntity(ent); // make sure it's not visible return; } G_SetAngle (ent, ent->s.angles); G_SpawnInt( "health", "0", &ent->health ); if(ent->health) { ent->takedamage = qtrue; ent->count = ent->health; // client needs to know about it as well ent->s.effect1Time = ent->count; ent->s.dl_intensity = 255; if( G_SpawnString( "description", "", &s ) ) { trap_GetConfigstring( CS_SCRIPT_MOVER_NAMES, cs, sizeof(cs) ); Info_SetValueForKey( cs, va("%i",ent-g_entities), s ); trap_SetConfigstring( CS_SCRIPT_MOVER_NAMES, cs ); } } else { ent->count = 0; } ent->die = script_mover_die; // look for general scaling if(G_SpawnFloat( "modelscale", "1", &scale[0])) { scale[2] = scale[1] = scale[0]; } if(G_SpawnString( "model2", "", &modelname ) ) { COM_StripExtension( modelname, tagname ); Q_strcat( tagname, MAX_QPATH, ".tag" ); ent->tagNumber = trap_LoadTag( tagname ); /* if( !(ent->tagNumber = trap_LoadTag( tagname )) ) { Com_Error( ERR_DROP, "Failed to load Tag File (%s)\n", tagname ); }*/ } // look for axis specific scaling if(G_SpawnVector("modelscale_vec", "1 1 1", &scalevec[0])) { VectorCopy(scalevec, scale); } if(scale[0] != 1 || scale[1] != 1 || scale[2] != 1) { ent->s.density |= 1; // scale is stored in 'angles2' VectorCopy(scale, ent->s.angles2); } if (ent->spawnflags & 128) { ent->s.density |= 4; ent->waterlevel = 0; if( G_SpawnString( "gun", "", &modelname ) ) { if( !Q_stricmp( modelname, "browning" ) ) { ent->s.density |= 8; } } G_SpawnString("tagent", "", &tagent); Q_strncpyz( ent->tagBuffer, tagent, 16 ); ent->s.powerups = -1; } ent->think = script_mover_spawn; ent->nextthink = level.time + FRAMETIME; } //.............................................................................. void script_model_med_spawn(gentity_t *ent) { if (ent->spawnflags & 2) { ent->clipmask = CONTENTS_SOLID; ent->r.contents = CONTENTS_SOLID; } ent->s.eType = ET_GENERAL; ent->s.modelindex = G_ModelIndex (ent->model); ent->s.frame = 0; VectorCopy( ent->s.origin, ent->s.pos.trBase ); ent->s.pos.trType = TR_STATIONARY; trap_LinkEntity(ent); } void script_model_med_use(gentity_t *ent, gentity_t *other, gentity_t *activator) { script_model_med_spawn(ent); } /*QUAKED script_model_med (0.5 0.25 1.0) (-16 -16 -24) (16 16 64) TriggerSpawn Solid MEDIUM SIZED scripted entity, used for animating a model, moving it around, etc SOLID spawnflag means this entity will clip the player and AI, otherwise they can walk straight through it "model" the full path of the model to use "scriptname" name used for scripting purposes (like aiName in AI scripting) */ void SP_script_model_med(gentity_t *ent) { if (!ent->model) G_Error("script_model_med %s must have a \"model\"\n", ent->scriptName ); if (!ent->scriptName) G_Error("script_model_med must have a \"scriptname\"\n" ); ent->s.eType = ET_GENERAL; ent->s.apos.trType = TR_STATIONARY; ent->s.apos.trTime = 0; ent->s.apos.trDuration = 0; VectorCopy (ent->s.angles, ent->s.apos.trBase); VectorClear (ent->s.apos.trDelta ); if (ent->spawnflags & 1) { ent->use = script_model_med_use; trap_UnlinkEntity(ent); // make sure it's not visible return; } script_model_med_spawn(ent); } //.............................................................................. /*QUAKED script_camera (1.0 0.25 1.0) (-8 -8 -8) (8 8 8) TriggerSpawn This is a camera entity. Used by the scripting to show cinematics, via special camera commands. See scripting documentation. "scriptname" name used for scripting purposes (like aiName in AI scripting) */ void SP_script_camera(gentity_t *ent) { if (!ent->scriptName) G_Error("%s must have a \"scriptname\"\n", ent->classname ); ent->s.eType = ET_CAMERA; ent->s.apos.trType = TR_STATIONARY; ent->s.apos.trTime = 0; ent->s.apos.trDuration = 0; VectorCopy (ent->s.angles, ent->s.apos.trBase); VectorClear (ent->s.apos.trDelta ); ent->s.frame = 0; ent->r.svFlags |= SVF_NOCLIENT; // only broadcast when in use } /*QUAKED script_multiplayer (1.0 0.25 1.0) (-8 -8 -8) (8 8 8) This is used to script multiplayer maps. Entity not displayed in game. // Gordon: also storing some stuff that will change often but needs to be broadcast, so we dont want to use a configstring "scriptname" name used for scripting purposes (REQUIRED) */ void SP_script_multiplayer(gentity_t *ent) { ent->scriptName = "game_manager"; // Gordon: broadcasting this to clients now, should be cheaper in bandwidth for sending landmine info ent->s.eType = ET_GAMEMANAGER; ent->r.svFlags = SVF_BROADCAST; if(level.gameManager) { // Gordon: ok, making this an error now G_Error("^1ERROR: multiple script_multiplayers found^7\n"); } level.gameManager = ent; level.gameManager->s.otherEntityNum = MAX_TEAM_LANDMINES; // axis landmine count level.gameManager->s.otherEntityNum2 = MAX_TEAM_LANDMINES; // allies landmine count level.gameManager->s.modelindex = qfalse; // axis HQ doesn't exist level.gameManager->s.modelindex2 = qfalse; // allied HQ doesn't exist trap_LinkEntity( ent ); } /* ================= SP_func_fakebrush ----------------- Jaybird Added for fake brush compatibility with ETPro ================= */ void SP_func_fakebrush (gentity_t *ent) { // Set the brush (will automatically set up ef_fakebmodel) trap_SetBrushModel( ent, ent->model ); // Link it trap_LinkEntity( ent ); }
33.543911
272
0.691037
jumptohistory
7f55ee3e5aaeda93228401f6811366967ffaffd7
3,100
cc
C++
source/driver.cc
chinmaygarde/epoxy
17cddb751e25c75b54da66932d2d64722cffc8b8
[ "MIT" ]
4
2020-07-09T04:58:14.000Z
2021-09-11T03:56:22.000Z
source/driver.cc
chinmaygarde/epoxy
17cddb751e25c75b54da66932d2d64722cffc8b8
[ "MIT" ]
null
null
null
source/driver.cc
chinmaygarde/epoxy
17cddb751e25c75b54da66932d2d64722cffc8b8
[ "MIT" ]
null
null
null
// This source file is part of Epoxy licensed under the MIT License. // See LICENSE.md file for details. #include "driver.h" #include "file.h" #include "scanner.h" #include <algorithm> #include <iostream> #include <sstream> #include <string> namespace epoxy { Driver::Driver(std::string advisory_file_name) : advisory_file_name_(std::move(advisory_file_name)) { location_.initialize(&advisory_file_name_); } Driver::~Driver() = default; void Driver::AddNamespace(Namespace ns) { namespaces_.emplace_back(std::move(ns)); } Driver::ParserResult Driver::Parse(const std::string& text) { Scanner scanner(text); if (!scanner.IsValid()) { return ParserResult::kParserError; } Parser parser(*this, scanner.GetHandle()); switch (parser.parse()) { case 0: /* parsing was successful (return is due to end-of-input) */ return ParserResult::kSuccess; case 1: /* contains a syntax error */ return ParserResult::kSyntaxError; case 2: /* memory exhaustion */ return ParserResult::kOutOfMemory; } return ParserResult::kParserError; } void Driver::ReportParsingError(const class location& location, const std::string& message) { errors_.emplace_back(Driver::Error{location, message}); } static void UnderscoreErrorInText(std::ostream& stream, const location& position, const std::string& original_text) { if (original_text.empty()) { return; } auto line = GetLineInString(original_text, position.begin.line); if (!line.has_value()) { return; } std::string pad(2u, ' '); stream << pad << line.value() << std::endl; const auto column = std::max<size_t>(static_cast<size_t>(position.begin.column), 1u); std::string bar(column - 1, '-'); stream << pad << bar << "^" << std::endl; } void Driver::PrettyPrintErrors(std::ostream& stream, const std::string& original_text) const { for (const auto& error : errors_) { const auto& error_begin = error.location.begin; stream << *error_begin.filename << ":" << error_begin.line << ":" << error_begin.column << ": error: " << error.message << std::endl; UnderscoreErrorInText(stream, error.location, original_text); } } const std::vector<Namespace>& Driver::GetNamespaces() const { return namespaces_; } location Driver::GetCurrentLocation() const { return location_; } static size_t GetNewlinesInString(const std::string& string) { return std::count_if(string.begin(), string.end(), [](const auto& c) { return c == '\n'; }); } static size_t CharsAfterLastNewline(const std::string& string) { auto last = string.find_last_of('\n'); if (last == std::string::npos) { return string.size(); } else { return string.size() - last - 1u; } } void Driver::BumpCurrentLocation(const char* c_text) { std::string text(c_text); location_.step(); location_.lines(GetNewlinesInString(text)); location_.columns(CharsAfterLastNewline(text)); } } // namespace epoxy
26.271186
78
0.653548
chinmaygarde
7f586f305b5d2239aa813c14cf9ae04586a1a575
642
cpp
C++
tests/uit/setup/InterProcAddress.cpp
perryk12/conduit
3ea055312598353afd465536c8e04cdec1111c8c
[ "MIT" ]
null
null
null
tests/uit/setup/InterProcAddress.cpp
perryk12/conduit
3ea055312598353afd465536c8e04cdec1111c8c
[ "MIT" ]
1
2020-10-22T20:41:05.000Z
2020-10-22T20:41:05.000Z
tests/uit/setup/InterProcAddress.cpp
perryk12/conduit
3ea055312598353afd465536c8e04cdec1111c8c
[ "MIT" ]
null
null
null
#include <set> #define CATCH_CONFIG_MAIN #define CATCH_CONFIG_DEFAULT_REPORTER "multiprocess" #include "Catch/single_include/catch2/catch.hpp" #include "uitsl/debug/MultiprocessReporter.hpp" #include "uitsl/mpi/MpiGuard.hpp" #include "uit/setup/InterProcAddress.hpp" const uitsl::MpiGuard guard; TEST_CASE("Test InterProcAddress") { // TODO flesh out stub test uit::InterProcAddress{0}; REQUIRE( uit::InterProcAddress{0} == uit::InterProcAddress{0} ); REQUIRE(!( uit::InterProcAddress{0} < uit::InterProcAddress{0} )); REQUIRE( uit::InterProcAddress{0} != uit::InterProcAddress{1} ); std::set<uit::InterProcAddress>{}; }
24.692308
68
0.744548
perryk12
7f5e9068af284cba93236e3803fe9c4ec8371fe6
8,691
cpp
C++
Source/MIVIBridge/Private/MIVICharacterBase.cpp
DrowningDragons/MIVIBridge
07fe752958b370d649d42ddf9f50cdcf089a31ad
[ "MIT" ]
1
2021-12-30T13:14:06.000Z
2021-12-30T13:14:06.000Z
Source/MIVIBridge/Private/MIVICharacterBase.cpp
DrowningDragons/MIVIBridge
07fe752958b370d649d42ddf9f50cdcf089a31ad
[ "MIT" ]
null
null
null
Source/MIVIBridge/Private/MIVICharacterBase.cpp
DrowningDragons/MIVIBridge
07fe752958b370d649d42ddf9f50cdcf089a31ad
[ "MIT" ]
1
2022-01-04T01:11:04.000Z
2022-01-04T01:11:04.000Z
// Copyright (c) 2019-2021 Drowning Dragons Limited. All Rights Reserved. #include "MIVICharacterBase.h" #include "Net/UnrealNetwork.h" #include "GameFramework/CharacterMovementComponent.h" #include "Pawn/VIPawnVaultComponent.h" #include "VIMotionWarpingComponent.h" #include "Components/CapsuleComponent.h" #include "VIBlueprintFunctionLibrary.h" void AMIVICharacterBase::BeginPlay() { Super::BeginPlay(); VaultComponent = IVIPawnInterface::Execute_GetPawnVaultComponent(this); MotionWarping = IVIPawnInterface::Execute_GetMotionWarpingComponent(this); } void AMIVICharacterBase::CheckJumpInput(float DeltaTime) { const bool bIsVaulting = IsVaulting(); // Server update simulated proxies with correct vaulting state if (GetLocalRole() == ROLE_Authority && GetNetMode() != NM_Standalone) { bRepIsVaulting = bIsVaulting; } // Try to vault from local input if (IsLocallyControlled() && VaultComponent) { // Disable jump if vaulting if (VaultComponent->bPressedVault) { bPressedJump = false; } // Possibly execute vault if (GetCharacterMovement()) { VaultComponent->CheckVaultInput(DeltaTime, GetCharacterMovement()->MovementMode); } else { VaultComponent->CheckVaultInput(DeltaTime); } } // Pick up changes in vaulting state to change movement mode // to something other than flying (required for root motion on Z) if (bWasVaulting && !bIsVaulting) { StopVaultAbility(); } // Call super so we actually jump if we're meant to Super::CheckJumpInput(DeltaTime); // Cache end of frame bWasVaulting = bIsVaulting; } void AMIVICharacterBase::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const { Super::GetLifetimeReplicatedProps(OutLifetimeProps); DOREPLIFETIME_CONDITION(AMIVICharacterBase, bRepIsVaulting, COND_SimulatedOnly); DOREPLIFETIME_CONDITION(AMIVICharacterBase, RepMotionMatch, COND_SimulatedOnly); } void AMIVICharacterBase::Jump() { // If missing critical components then jump and exit if (!VaultComponent || !GetCharacterMovement()) { Super::Jump(); return; } // Either jump or vault, determined by VaultComponent::EVIJumpKeyPriority if (VaultComponent->Jump(GetCharacterMovement()->GetGravityZ(), CanJump(), GetCharacterMovement()->IsFalling())) { // Jump normally Super::Jump(); } else { // Jump key essentially presses the vault input VaultComponent->Vault(); } } void AMIVICharacterBase::StopJumping() { Super::StopJumping(); // Release vault input if the jump key pressed vault instead if (VaultComponent) { VaultComponent->StopJumping(); } } void AMIVICharacterBase::StartVaultAbility_Implementation() { // Called by GA_Vault // Need to be in flying mode to have root motion on Z axis if (GetCharacterMovement() && GetLocalRole() > ROLE_SimulatedProxy) { GetCharacterMovement()->SetMovementMode(MOVE_Flying); } } void AMIVICharacterBase::StopVaultAbility() { // Called by CheckJumpInput() // Exiting flying mode // This may put is straight into falling if we aren't properly grounded, which is fine if (GetCharacterMovement() && GetLocalRole() > ROLE_SimulatedProxy) { GetCharacterMovement()->SetMovementMode(GetCharacterMovement()->GetGroundMovementMode()); } OnStopVaultAbility(); } void AMIVICharacterBase::OnRep_MotionMatch() { // Simulated proxies update their sync points here, sent from the server during GA_Vault MotionWarping->AddOrUpdateSyncPoint(TEXT("VaultSyncPoint"), FVIMotionWarpingSyncPoint(RepMotionMatch.Location, RepMotionMatch.Direction.ToOrientationQuat())); } bool AMIVICharacterBase::IsVaulting() const { // Simulated proxies use the value provided by server if (GetLocalRole() == ROLE_SimulatedProxy) { return bRepIsVaulting; } // Local and authority uses gameplay tags for a predicted result if (VaultComponent) { return VaultComponent->IsVaulting(); } return false; } // *********************************************** // // ******** Begin Pawn Vaulting Interface ******** // // *********************************************** // UVIPawnVaultComponent* AMIVICharacterBase::GetPawnVaultComponent_Implementation() const { // You need to override this UVIBlueprintFunctionLibrary::MessageLogError(FString::Printf(TEXT("AMIVICharacterBase::GetPawnVaultComponent not implemented for { %s }. Cannot Vault."), *GetName())); return nullptr; } UVIMotionWarpingComponent* AMIVICharacterBase::GetMotionWarpingComponent_Implementation() const { // You need to override this UVIBlueprintFunctionLibrary::MessageLogError(FString::Printf(TEXT("AMIVICharacterBase::GetMotionWarpingComponent not implemented for { %s }. Cannot Vault."), *GetName())); return nullptr; } FVIAnimSet AMIVICharacterBase::GetVaultAnimSet_Implementation() const { // You need to override this UVIBlueprintFunctionLibrary::MessageLogError(FString::Printf(TEXT("AMIVICharacterBase::GetVaultAnimSet not implemented for { %s }. Cannot Vault."), *GetName())); return FVIAnimSet(); } FVITraceSettings AMIVICharacterBase::GetVaultTraceSettings_Implementation() const { // You need to override this UVIBlueprintFunctionLibrary::MessageLogError(FString::Printf(TEXT("AMIVICharacterBase::GetVaultTraceSettings not implemented for { %s }. Using default trace settings."), *GetName()), false); return FVITraceSettings(); } FVector AMIVICharacterBase::GetVaultDirection_Implementation() const { // Use input vector if available if (GetCharacterMovement() && !GetCharacterMovement()->GetCurrentAcceleration().IsNearlyZero()) { return GetCharacterMovement()->GetCurrentAcceleration(); } // Use character facing direction if not providing input return GetActorForwardVector(); } bool AMIVICharacterBase::CanVault_Implementation() const { // Vaulting must finish before starting another vault attempt if (IsVaulting()) { return false; } // Invalid components if (!VaultComponent || !GetCharacterMovement()) { return false; } // Animation instance is required to play vault montage if (!GetMesh() || !GetMesh()->GetAnimInstance()) { return false; } // Authority not initialized (this isn't set on clients) if (HasAuthority() && !VaultComponent->bVaultAbilityInitialized) { return false; } // Exit if character is in a state they cannot vault from if (GetCharacterMovement()->IsMovingOnGround() || GetCharacterMovement()->IsFalling() || GetCharacterMovement()->IsSwimming()) { if (GetCharacterMovement()->IsMovingOnGround() && !VaultComponent->bCanVaultFromGround) { return false; } if (GetCharacterMovement()->IsFalling() && !VaultComponent->bCanVaultFromFalling) { return false; } if (GetCharacterMovement()->IsSwimming() && !VaultComponent->bCanVaultFromSwimming) { return false; } } else { return false; } // Can't vault while crouching if (!VaultComponent->bCanVaultFromCrouching && GetCharacterMovement()->IsCrouching()) { return false; } // Passed all conditions return true; } void AMIVICharacterBase::OnLocalPlayerVault_Implementation(const FVector& Location, const FVector& Direction) { // LocalPlayer just stores the data in the same place for convenience, ease of use, memory reduction, etc RepMotionMatch = FVIRepMotionMatch(Location, Direction); } void AMIVICharacterBase::GetVaultLocationAndDirection_Implementation(FVector& OutLocation, FVector& OutDirection) const { // Because LocalPlayer stores in the same place, no need for any testing as they all use RepMotionMatch to store this // This is only currently used for FBIK tracing OutLocation = RepMotionMatch.Location; OutDirection = RepMotionMatch.Direction; } void AMIVICharacterBase::ReplicateMotionMatch_Implementation(const FVIRepMotionMatch& MotionMatch) { // GA_Vault has directed server to update it's RepMotionMatch property so that it will // be replicated to simulated proxies with 1 decimal point of precision (net quantization) RepMotionMatch = MotionMatch; } bool AMIVICharacterBase::IsWalkable_Implementation(const FHitResult& HitResult) const { // Surface we hit can be walked on or not return GetCharacterMovement() && GetCharacterMovement()->IsWalkable(HitResult); } bool AMIVICharacterBase::CanAutoVaultInCustomMovementMode_Implementation() const { return true; // Example usage commented out /* if (GetCharacterMovement()) { switch (GetCharacterMovement()->CustomMovementMode) { case 0: return false; case 1: // Some example custom mode where auto vault can work return true; case 2: return false; default: return true; } } */ } // *********************************************** // // ********* End Pawn Vaulting Interface ********* // // *********************************************** //
28.035484
191
0.741457
DrowningDragons
7f6e5b03489a33cdc086f784b03c8ca232778bd7
650
hpp
C++
libs/core/include/fcppt/math/matrix/row_type_fwd.hpp
pmiddend/fcppt
9f437acbb10258e6df6982a550213a05815eb2be
[ "BSL-1.0" ]
null
null
null
libs/core/include/fcppt/math/matrix/row_type_fwd.hpp
pmiddend/fcppt
9f437acbb10258e6df6982a550213a05815eb2be
[ "BSL-1.0" ]
null
null
null
libs/core/include/fcppt/math/matrix/row_type_fwd.hpp
pmiddend/fcppt
9f437acbb10258e6df6982a550213a05815eb2be
[ "BSL-1.0" ]
null
null
null
// Copyright Carl Philipp Reh 2009 - 2018. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef FCPPT_MATH_MATRIX_ROW_TYPE_FWD_HPP_INCLUDED #define FCPPT_MATH_MATRIX_ROW_TYPE_FWD_HPP_INCLUDED #include <fcppt/math/size_type.hpp> #include <fcppt/math/vector/static_fwd.hpp> namespace fcppt { namespace math { namespace matrix { /** \brief The type of matrix row \ingroup fcpptmathmatrix */ template< typename T, fcppt::math::size_type C > using row_type = fcppt::math::vector::static_< T, C >; } } } #endif
15.116279
61
0.730769
pmiddend
7f797dcf0d1a76d2e63ebbe386faf815b89f7b12
7,040
hpp
C++
include/UnityEngine/Timeline/ControlPlayableAsset_-GetControlableScripts-d__39.hpp
darknight1050/BeatSaber-Quest-Codegen
a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032
[ "Unlicense" ]
null
null
null
include/UnityEngine/Timeline/ControlPlayableAsset_-GetControlableScripts-d__39.hpp
darknight1050/BeatSaber-Quest-Codegen
a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032
[ "Unlicense" ]
null
null
null
include/UnityEngine/Timeline/ControlPlayableAsset_-GetControlableScripts-d__39.hpp
darknight1050/BeatSaber-Quest-Codegen
a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032
[ "Unlicense" ]
null
null
null
// Autogenerated from CppHeaderCreator // Created by Sc2ad // ========================================================================= #pragma once // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.Timeline.ControlPlayableAsset #include "UnityEngine/Timeline/ControlPlayableAsset.hpp" // Including type: System.Collections.Generic.IEnumerable`1 #include "System/Collections/Generic/IEnumerable_1.hpp" // Including type: System.Collections.Generic.IEnumerator`1 #include "System/Collections/Generic/IEnumerator_1.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils-properties.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils-fields.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Begin forward declares // Forward declaring namespace: UnityEngine namespace UnityEngine { // Forward declaring type: MonoBehaviour class MonoBehaviour; // Forward declaring type: GameObject class GameObject; } // Forward declaring namespace: System::Collections namespace System::Collections { // Skipping declaration: IEnumerator because it is already included! } // Completed forward declares // Type namespace: UnityEngine.Timeline namespace UnityEngine::Timeline { // Size: 0x44 #pragma pack(push, 1) // Autogenerated type: UnityEngine.Timeline.ControlPlayableAsset/<GetControlableScripts>d__39 // [CompilerGeneratedAttribute] Offset: DD7A60 class ControlPlayableAsset::$GetControlableScripts$d__39 : public ::Il2CppObject/*, public System::Collections::Generic::IEnumerable_1<UnityEngine::MonoBehaviour*>, public System::Collections::Generic::IEnumerator_1<UnityEngine::MonoBehaviour*>*/ { public: // private System.Int32 <>1__state // Size: 0x4 // Offset: 0x10 int $$1__state; // Field size check static_assert(sizeof(int) == 0x4); // Padding between fields: $$1__state and: $$2__current char __padding0[0x4] = {}; // private UnityEngine.MonoBehaviour <>2__current // Size: 0x8 // Offset: 0x18 UnityEngine::MonoBehaviour* $$2__current; // Field size check static_assert(sizeof(UnityEngine::MonoBehaviour*) == 0x8); // private System.Int32 <>l__initialThreadId // Size: 0x4 // Offset: 0x20 int $$l__initialThreadId; // Field size check static_assert(sizeof(int) == 0x4); // Padding between fields: $$l__initialThreadId and: root char __padding2[0x4] = {}; // private UnityEngine.GameObject root // Size: 0x8 // Offset: 0x28 UnityEngine::GameObject* root; // Field size check static_assert(sizeof(UnityEngine::GameObject*) == 0x8); // public UnityEngine.GameObject <>3__root // Size: 0x8 // Offset: 0x30 UnityEngine::GameObject* $$3__root; // Field size check static_assert(sizeof(UnityEngine::GameObject*) == 0x8); // private UnityEngine.MonoBehaviour[] <>7__wrap1 // Size: 0x8 // Offset: 0x38 ::Array<UnityEngine::MonoBehaviour*>* $$7__wrap1; // Field size check static_assert(sizeof(::Array<UnityEngine::MonoBehaviour*>*) == 0x8); // private System.Int32 <>7__wrap2 // Size: 0x4 // Offset: 0x40 int $$7__wrap2; // Field size check static_assert(sizeof(int) == 0x4); // Creating value type constructor for type: $GetControlableScripts$d__39 $GetControlableScripts$d__39(int $$1__state_ = {}, UnityEngine::MonoBehaviour* $$2__current_ = {}, int $$l__initialThreadId_ = {}, UnityEngine::GameObject* root_ = {}, UnityEngine::GameObject* $$3__root_ = {}, ::Array<UnityEngine::MonoBehaviour*>* $$7__wrap1_ = {}, int $$7__wrap2_ = {}) noexcept : $$1__state{$$1__state_}, $$2__current{$$2__current_}, $$l__initialThreadId{$$l__initialThreadId_}, root{root_}, $$3__root{$$3__root_}, $$7__wrap1{$$7__wrap1_}, $$7__wrap2{$$7__wrap2_} {} // Creating interface conversion operator: operator System::Collections::Generic::IEnumerable_1<UnityEngine::MonoBehaviour*> operator System::Collections::Generic::IEnumerable_1<UnityEngine::MonoBehaviour*>() noexcept { return *reinterpret_cast<System::Collections::Generic::IEnumerable_1<UnityEngine::MonoBehaviour*>*>(this); } // Creating interface conversion operator: operator System::Collections::Generic::IEnumerator_1<UnityEngine::MonoBehaviour*> operator System::Collections::Generic::IEnumerator_1<UnityEngine::MonoBehaviour*>() noexcept { return *reinterpret_cast<System::Collections::Generic::IEnumerator_1<UnityEngine::MonoBehaviour*>*>(this); } // public System.Void .ctor(System.Int32 <>1__state) // Offset: 0x17C611C template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary> static ControlPlayableAsset::$GetControlableScripts$d__39* New_ctor(int $$1__state) { static auto ___internal__logger = ::Logger::get().WithContext("UnityEngine::Timeline::ControlPlayableAsset::$GetControlableScripts$d__39::.ctor"); return THROW_UNLESS((::il2cpp_utils::New<ControlPlayableAsset::$GetControlableScripts$d__39*, creationType>($$1__state))); } // private System.Void System.IDisposable.Dispose() // Offset: 0x17C7A08 void System_IDisposable_Dispose(); // private System.Boolean MoveNext() // Offset: 0x17C7A0C bool MoveNext(); // private UnityEngine.MonoBehaviour System.Collections.Generic.IEnumerator<UnityEngine.MonoBehaviour>.get_Current() // Offset: 0x17C7B60 UnityEngine::MonoBehaviour* System_Collections_Generic_IEnumerator$UnityEngine_MonoBehaviour$_get_Current(); // private System.Void System.Collections.IEnumerator.Reset() // Offset: 0x17C7B68 void System_Collections_IEnumerator_Reset(); // private System.Object System.Collections.IEnumerator.get_Current() // Offset: 0x17C7BC8 ::Il2CppObject* System_Collections_IEnumerator_get_Current(); // private System.Collections.Generic.IEnumerator`1<UnityEngine.MonoBehaviour> System.Collections.Generic.IEnumerable<UnityEngine.MonoBehaviour>.GetEnumerator() // Offset: 0x17C7BD0 System::Collections::Generic::IEnumerator_1<UnityEngine::MonoBehaviour*>* System_Collections_Generic_IEnumerable$UnityEngine_MonoBehaviour$_GetEnumerator(); // private System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() // Offset: 0x17C7C7C System::Collections::IEnumerator* System_Collections_IEnumerable_GetEnumerator(); }; // UnityEngine.Timeline.ControlPlayableAsset/<GetControlableScripts>d__39 #pragma pack(pop) static check_size<sizeof(ControlPlayableAsset::$GetControlableScripts$d__39), 64 + sizeof(int)> __UnityEngine_Timeline_ControlPlayableAsset_$GetControlableScripts$d__39SizeCheck; static_assert(sizeof(ControlPlayableAsset::$GetControlableScripts$d__39) == 0x44); } DEFINE_IL2CPP_ARG_TYPE(UnityEngine::Timeline::ControlPlayableAsset::$GetControlableScripts$d__39*, "UnityEngine.Timeline", "ControlPlayableAsset/<GetControlableScripts>d__39");
54.573643
489
0.742898
darknight1050
7f7de4f5b9fb796b3548a3e2ce282d8e0d96279e
1,944
cpp
C++
src/human.cpp
Groogy/derelict
5ca82ae5a5a553e292e388706a27b53840cf3afa
[ "Zlib" ]
null
null
null
src/human.cpp
Groogy/derelict
5ca82ae5a5a553e292e388706a27b53840cf3afa
[ "Zlib" ]
null
null
null
src/human.cpp
Groogy/derelict
5ca82ae5a5a553e292e388706a27b53840cf3afa
[ "Zlib" ]
null
null
null
#include "human.hpp" #include "tile.hpp" #include "terrain.hpp" #include "earth.hpp" #include "tilemap.hpp" #include "settler.hpp" constexpr int TicksPerSettlement = 40; Human::Human(sf::Vector2i settlement) { mySettlements.push_back(settlement); nTimeToGrowth = TicksPerSettlement; } void Human::update(Earth& earth) { auto& tilemap = earth.accessTilemap(); std::vector<sf::Vector2i> destroyedSettlements; for(auto settlement : mySettlements) { const auto& tile = tilemap.getTile(settlement); if(tile.getTerrain()->getName() != "Settlement") { destroyedSettlements.push_back(settlement); } else { nTimeToGrowth -= rand() % 2 == 0 ? 1 : 0; } } for(auto destroyed : destroyedSettlements) { mySettlements.erase(macros::find(mySettlements, destroyed)); } if(nTimeToGrowth <= 0) { handleGrowth(earth); nTimeToGrowth = TicksPerSettlement * mySettlements.size(); } std::vector<Settler*> doneSettlers; for(auto& settler : mySettlers) { if(settler->update(earth)) { doneSettlers.push_back(settler.get()); } } auto building = tilemap.getTile(mySettlements.front()).getBuilding(); for(auto done : doneSettlers) { auto pos = done->getPosition(); tilemap.setTileTerrain(pos, "Settlement"); tilemap.setBuilding(pos, building); mySettlements.push_back(done->getPosition()); for(auto& settler : mySettlers) { if(settler.get() == done) { mySettlers.erase(macros::find(mySettlers, settler)); } } } } bool Human::isDestroyed() const { return mySettlements.empty(); } void Human::handleGrowth(Earth& earth) { auto& tilemap = earth.getTilemap(); int random = rand() % mySettlements.size(); sf::Vector2i settlement = mySettlements[random]; auto path = tilemap.findFirstConvertableWalkable(settlement, "Settlement"); if(path.isFinished()) return; auto settler = std::make_unique<Settler>(*this, settlement, path); mySettlers.push_back(std::move(settler)); }
21.6
76
0.705761
Groogy
7f7e56d5a52cb4499f999a3994d5b85b07734b44
3,453
cpp
C++
code archive/joi/2019-sp-day3 pC.cpp
brianbbsu/program
c4505f2b8c0b91010e157db914a63c49638516bc
[ "MIT" ]
4
2018-04-08T08:07:58.000Z
2021-06-07T14:55:24.000Z
code archive/joi/2019-sp-day3 pC.cpp
brianbbsu/program
c4505f2b8c0b91010e157db914a63c49638516bc
[ "MIT" ]
null
null
null
code archive/joi/2019-sp-day3 pC.cpp
brianbbsu/program
c4505f2b8c0b91010e157db914a63c49638516bc
[ "MIT" ]
1
2018-10-29T12:37:25.000Z
2018-10-29T12:37:25.000Z
//{ #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef double lf; typedef pair<ll,ll> ii; #define REP(i,n) for(ll i=0;i<n;i++) #define REP1(i,n) for(ll i=1;i<=n;i++) #define FILL(i,n) memset(i,n,sizeof i) #define X first #define Y second #define SZ(_a) (int)_a.size() #define ALL(_a) _a.begin(),_a.end() #define pb push_back #ifdef brian #define debug(...) do{\ fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\ _do(__VA_ARGS__);\ }while(0) template<typename T>void _do(T &&_x){cerr<<_x<<endl;} template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);} template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";} template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb) { _s<<"{"; for(It _it=_ita;_it!=_itb;_it++) { _s<<(_it==_ita?"":",")<<*_it; } _s<<"}"; return _s; } template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));} template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));} template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));} template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;} #define IOS() #else #define debug(...) #define pary(...) #define endl '\n' #define IOS() ios_base::sync_with_stdio(0);cin.tie(0); #endif // brian //} const ll MAXn=3e5+5,MAXlg=__lg(MAXn)+2; const ll MOD=1000000007; const ll INF=ll(1e15); struct qrtg{ ll i, s, st, e, et; }; ll l[2][MAXn], r[2][MAXn], ans[MAXn]; ii dp[2][MAXn][2]; ll n, q; const ll K = 700; //vector<qrtg> qr[2]; set<ii> u[2][K + 5], d[2][K + 5]; void let(ll p, ll s,ll t) { t--; l[0][p] = s - p; r[0][p] = t - p; p = n - p; l[1][p] = s - p; r[1][p] = t - p; } ii cal(ll fg,ll it, ll x) { ll ut = prev(u[fg][it].lower_bound({x, -1}))->Y; ll dt = d[fg][it].lower_bound({x, INF})->Y; if(min(ut, dt) == n)return {0, x}; if(ut <= dt)return {dp[fg][ut][1].X + x - r[fg][ut], dp[fg][ut][1].Y}; else return dp[fg][dt][0]; } void build(ll fg, ll it) { } int main() { IOS(); cin>>n>>q; REP1(i,n-1) { ll s, t; cin>>s>>t; let(i, s, t); } for(int i = 0;i < q;i++) { ll tp, s, st, e, et; cin>>tp>>s>>st>>e>>et; if(s < e)qr[0].pb({i, s, st, e, et}); else qr[1].pb({i, n - s + 1, st, n - e + 1, et}); } for(int fg = 0;fg <= 1;fg ++) { u.clear();d.clear(); u.insert({-INF, n});d.insert({INF, n}); sort(ALL(qr[fg]), [](auto &a, auto &b){return a.s > b.s;}); for(auto &p:qr[fg])p.st -= p.s, p.et -= p.e; int it = 0; for(int i = n-1;i >= 1; i--) { dp[fg][i][0] = cal(fg, l[fg][i]); dp[fg][i][1] = cal(fg, r[fg][i]); u.erase(u.lower_bound({r[fg][i], -1}), u.end()); d.erase(d.begin(), d.lower_bound({l[fg][i], INF})); u.insert({r[fg][i], i});d.insert({l[fg][i], i}); while(it != SZ(qr[fg]) && qr[fg][it].s == i){ ii t = cal(fg, qr[fg][it].st); if(t.Y > qr[fg][it].et)t.X += t.Y - qr[fg][it].et; ans[qr[fg][it].i] = t.X; it++; } } } REP(i, q)cout<<ans[i]<<endl; }
25.768657
129
0.504489
brianbbsu
7f856f4c3a4036ac8066fbfdb77d87c861bcaa8f
7,964
cpp
C++
compiler/src/ast/stmt/ast_flow_codegen.cpp
TuplexLanguage/tuplex
fc436c78224522663e40e09d36f83570fd76ba2d
[ "Apache-2.0" ]
15
2017-08-15T20:46:44.000Z
2021-12-15T02:51:13.000Z
compiler/src/ast/stmt/ast_flow_codegen.cpp
TuplexLanguage/tuplex
fc436c78224522663e40e09d36f83570fd76ba2d
[ "Apache-2.0" ]
null
null
null
compiler/src/ast/stmt/ast_flow_codegen.cpp
TuplexLanguage/tuplex
fc436c78224522663e40e09d36f83570fd76ba2d
[ "Apache-2.0" ]
1
2017-09-28T14:48:15.000Z
2017-09-28T14:48:15.000Z
#include "ast_flow.hpp" #include "ast/expr/ast_ref.hpp" #include "llvm_generator.hpp" #include "parsercontext.hpp" using namespace llvm; Value* TxCondClauseNode::code_gen_cond( LlvmGenerationContext& context, GenScope* scope ) const { return this->condExpr->code_gen_expr( context, scope ); } Value* TxIsClauseNode::code_gen_cond( LlvmGenerationContext& context, GenScope* scope ) const { auto refExprV = this->origValueExpr->code_gen_dyn_value( context, scope ); Constant* reqTargetTypeIdC = ConstantInt::get( Type::getInt32Ty( context.llvmContext ), this->typeExpr->qtype()->target_type()->get_runtime_type_id() ); auto typeEqCondV = context.gen_isa( scope, refExprV, reqTargetTypeIdC ); // // exact type equality, not is-a: // Value* runtimeTargetTypeIdV = gen_get_ref_typeid( context, scope, refExprV ); // auto typeEqCondV = scope->builder->CreateICmpEQ( runtimeTargetTypeIdV, reqTargetTypeIdC ); return typeEqCondV; } void TxIsClauseNode::code_gen_prestep( LlvmGenerationContext& context, GenScope* scope ) const { this->valueField->code_gen_field( context, scope ); } void TxForHeaderNode::code_gen_init( LlvmGenerationContext& context, GenScope* scope ) const { this->initStmt->code_gen( context, scope ); } Value* TxForHeaderNode::code_gen_cond( LlvmGenerationContext& context, GenScope* scope ) const { return this->nextCond->expr->code_gen_expr( context, scope ); } void TxForHeaderNode::code_gen_poststep( LlvmGenerationContext& context, GenScope* scope ) const { this->stepStmt->code_gen( context, scope ); } void TxInClauseNode::code_gen_init( LlvmGenerationContext& context, GenScope* scope ) const { this->iterField->code_gen_field( context, scope ); } Value* TxInClauseNode::code_gen_cond( LlvmGenerationContext& context, GenScope* scope ) const { return this->nextCond->code_gen_expr( context, scope ); } void TxInClauseNode::code_gen_prestep( LlvmGenerationContext& context, GenScope* scope ) const { this->valueField->code_gen_field( context, scope ); } void TxElseClauseNode::code_gen( LlvmGenerationContext& context, GenScope* scope ) const { TRACE_CODEGEN( this, context ); scope->builder->SetCurrentDebugLocation( DebugLoc::get( ploc.begin.line, ploc.begin.column, scope->debug_scope() ) ); return this->body->code_gen( context, scope ); } void TxIfStmtNode::code_gen( LlvmGenerationContext& context, GenScope* scope ) const { TRACE_CODEGEN( this, context ); scope->builder->SetCurrentDebugLocation( DebugLoc::get( ploc.begin.line, ploc.begin.column, scope->debug_scope() ) ); auto suiteDScope = context.debug_builder()->createLexicalBlock( scope->debug_scope(), get_parser_context()->debug_file(), ploc.begin.line, ploc.begin.column ); scope->push_debug_scope( suiteDScope ); std::string id = std::to_string( this->ploc.begin.line ); auto parentFunc = scope->builder->GetInsertBlock()->getParent(); BasicBlock* trueBlock = BasicBlock::Create( context.llvmContext, "if_true"+id, parentFunc ); BasicBlock* postBlock = nullptr; // generate initialization: this->header->code_gen_init( context, scope ); // generate condition: auto condVal = this->header->code_gen_cond( context, scope ); // generate branch and else code: if ( this->elseClause ) { BasicBlock* elseBlock = BasicBlock::Create( context.llvmContext, "if_else"+id, parentFunc ); scope->builder->CreateCondBr( condVal, trueBlock, elseBlock ); scope->builder->SetInsertPoint( elseBlock ); this->elseClause->code_gen( context, scope ); if ( !this->elseClause->ends_with_terminal_stmt() ) { postBlock = BasicBlock::Create( context.llvmContext, "if_post"+id, parentFunc ); scope->builder->CreateBr( postBlock ); // branch from end of else suite to next-block } } else { postBlock = BasicBlock::Create( context.llvmContext, "if_post"+id, parentFunc ); scope->builder->CreateCondBr( condVal, trueBlock, postBlock ); } // generate true code: scope->builder->SetInsertPoint( trueBlock ); this->header->code_gen_prestep( context, scope ); this->body->code_gen( context, scope ); this->header->code_gen_poststep( context, scope ); if ( postBlock ) { // note: trueBlock may not be the "current" block anymore when reaching end of body if ( !scope->builder->GetInsertBlock()->getTerminator() ) scope->builder->CreateBr( postBlock ); // branch from end of true block to next-block scope->builder->SetInsertPoint( postBlock ); } scope->pop_debug_scope(); } void TxForStmtNode::code_gen( LlvmGenerationContext& context, GenScope* scope ) const { TRACE_CODEGEN( this, context ); scope->builder->SetCurrentDebugLocation( DebugLoc::get( ploc.begin.line, ploc.begin.column, scope->debug_scope() ) ); auto suiteDScope = context.debug_builder()->createLexicalBlock( scope->debug_scope(), get_parser_context()->debug_file(), ploc.begin.line, ploc.begin.column ); scope->push_debug_scope( suiteDScope ); std::string id = std::to_string( this->ploc.begin.line ); auto parentFunc = scope->builder->GetInsertBlock()->getParent(); BasicBlock* condBlock = BasicBlock::Create( context.llvmContext, "loop_cond"+id, parentFunc ); BasicBlock* loopBlock = BasicBlock::Create( context.llvmContext, "loop_body"+id, parentFunc ); BasicBlock* postBlock = nullptr; // generate initialization: for ( auto clause : *this->loopHeaders ) { clause->code_gen_init( context, scope ); } scope->builder->CreateBr( condBlock ); // generate condition block: scope->builder->SetInsertPoint( condBlock ); Value* condVal = this->loopHeaders->back()->code_gen_cond( context, scope ); if ( this->loopHeaders->size() > 1 ) { // TODO: test all the conditions for ( int i = this->loopHeaders->size()-1 ; i >= 0; i-- ) { condVal = scope->builder->CreateAnd( this->loopHeaders->at(i)->code_gen_cond( context, scope ), condVal ); } } if ( this->elseClause ) { BasicBlock* elseBlock = BasicBlock::Create( context.llvmContext, "loop_else"+id, parentFunc ); scope->builder->CreateCondBr( condVal, loopBlock, elseBlock ); // generate else code: scope->builder->SetInsertPoint( elseBlock ); this->elseClause->code_gen( context, scope ); if ( !this->ends_with_terminal_stmt() ) { postBlock = BasicBlock::Create( context.llvmContext, "loop_post"+id, parentFunc ); scope->builder->CreateBr( postBlock ); // branch from end of else suite to post-block } } else { postBlock = BasicBlock::Create( context.llvmContext, "loop_post"+id, parentFunc ); scope->builder->CreateCondBr( condVal, loopBlock, postBlock ); } // generate loop code: CompoundStatementScope css( condBlock, postBlock ); scope->compStmtStack.push( &css ); { scope->builder->SetInsertPoint( loopBlock ); for ( auto clause : *this->loopHeaders ) { clause->code_gen_prestep( context, scope ); } this->body->code_gen( context, scope ); // note: loopBlock is may not be the "current" block anymore when reaching end of loop body if ( !scope->builder->GetInsertBlock()->getTerminator() ) { for ( auto clause : *this->loopHeaders ) { clause->code_gen_poststep( context, scope ); } scope->builder->CreateBr( condBlock ); // branch from end of loop body to cond-block } } scope->compStmtStack.pop(); if ( postBlock ) scope->builder->SetInsertPoint( postBlock ); scope->pop_debug_scope(); }
44
125
0.669513
TuplexLanguage
7f8e15d29a1ba83e5bd1bdf02af3b85368fb2b89
16,297
cc
C++
nugen/EventGeneratorBase/test/EventGeneratorTest_module.cc
nusense/nugen
ee4fefda7f2aa5e5ca8ee9c741f07bd3dbef2ed7
[ "Apache-2.0" ]
null
null
null
nugen/EventGeneratorBase/test/EventGeneratorTest_module.cc
nusense/nugen
ee4fefda7f2aa5e5ca8ee9c741f07bd3dbef2ed7
[ "Apache-2.0" ]
null
null
null
nugen/EventGeneratorBase/test/EventGeneratorTest_module.cc
nusense/nugen
ee4fefda7f2aa5e5ca8ee9c741f07bd3dbef2ed7
[ "Apache-2.0" ]
null
null
null
//////////////////////////////////////////////////////////////////////// // // brebel@fnal.gov // //////////////////////////////////////////////////////////////////////// #ifndef EVGEN_TEST_H #define EVGEN_TEST_H #include <cstdlib> #include <string> #include <sstream> #include <vector> #include <map> #include <unistd.h> // Framework includes #include "art/Framework/Core/ModuleMacros.h" #include "art/Framework/Principal/Event.h" #include "fhiclcpp/ParameterSet.h" #include "art/Framework/Principal/Handle.h" #include "messagefacility/MessageLogger/MessageLogger.h" #include "art/Framework/Core/EDAnalyzer.h" #include "cetlib_except/exception.h" #include "cetlib/search_path.h" #include "nusimdata/SimulationBase/MCTruth.h" #include "nusimdata/SimulationBase/GTruth.h" #include "nusimdata/SimulationBase/MCFlux.h" #include "nusimdata/SimulationBase/MCNeutrino.h" #include "nusimdata/SimulationBase/MCParticle.h" #include "nugen/EventGeneratorBase/evgenbase.h" #include "nugen/EventGeneratorBase/GENIE/GENIEHelper.h" #include "TStopwatch.h" #include "TGeoManager.h" namespace art { class Event; } namespace simb { class MCParticle; } ///Monte Carlo event generation namespace evgen { /// A module to check the results from the Monte Carlo generator class EventGeneratorTest : public art::EDAnalyzer { public: explicit EventGeneratorTest(fhicl::ParameterSet const &pset); void analyze(art::Event const& evt); private: fhicl::ParameterSet GENIEParameterSet(std::string fluxType, bool usePOTPerSpill); void GENIETest(fhicl::ParameterSet const& pset); void GENIEHistogramFluxTest(); void GENIESimpleFluxTest(); void GENIEMonoFluxTest(); void GENIEAtmoFluxTest(); void GENIENtupleFluxTest(); fhicl::ParameterSet CRYParameterSet(); void CRYTest(); bool IntersectsDetector(simb::MCParticle const& part); void ProjectToSurface(TLorentzVector pos, TLorentzVector mom, int axis, double surfaceLoc, double* xyz); double fTotalGENIEPOT; ///< number of POT to generate with GENIE when ///< in total POT mode double fTotalGENIEInteractions; ///< number of interactions to generate with ///< GENIE when in EventsPerSpill mode double fTotalCRYSpills; ///< number of spills to use when testing CRY std::string fTopVolume; ///< Top Volume used by GENIE std::string fGeometryFile; ///< location of Geometry GDML file to test double fCryDetLength; ///< length of detector to test CRY, units of cm double fCryDetWidth; ///< width of detector to test CRY, units of cm double fCryDetHeight; ///< height of detector to test CRY, units of cm CLHEP::HepRandomEngine& fEngine; ///< art-owned engine used in generation random numbers }; } namespace evgen { //____________________________________________________________________________ EventGeneratorTest::EventGeneratorTest(fhicl::ParameterSet const& pset) : EDAnalyzer (pset) , fTotalGENIEPOT ( pset.get< double >("TotalGENIEPOT", 5e18)) , fTotalGENIEInteractions( pset.get< double >("TotalGENIEInteractions", 100) ) , fTotalCRYSpills ( pset.get< double >("TotalCRYSpills", 1000)) , fTopVolume ( pset.get< std::string >("TopVolume" )) , fGeometryFile ( pset.get< std::string >("GeometryFile" )) , fCryDetLength (1000.) , fCryDetWidth (500.) , fCryDetHeight (500.) , fEngine{createEngine(pset.get< int >("Seed", evgb::GetRandomNumberSeed()))} {} //____________________________________________________________________________ void EventGeneratorTest::analyze(art::Event const& evt) { mf::LogWarning("EventGeneratorTest") << "testing GENIE..."; mf::LogWarning("EventGeneratorTest") << "\t histogram flux..."; this->GENIEHistogramFluxTest(); mf::LogWarning("EventGeneratorTest") << "\t \t done." << "\t simple flux..."; this->GENIESimpleFluxTest(); mf::LogWarning("EventGeneratorTest") << "\t \t done." << "\t atmo flux..."; this->GENIEAtmoFluxTest(); mf::LogWarning("EventGeneratorTest") << "\t \t done." << "\t mono flux..."; this->GENIEMonoFluxTest(); mf::LogWarning("EventGeneratorTest") << "\t \t done.\n" << "GENIE tests done"; mf::LogWarning("EventGeneratorTest") << "testing CRY..."; this->CRYTest(); mf::LogWarning("EventGeneratorTest") << "\t CRY test done."; } //____________________________________________________________________________ fhicl::ParameterSet EventGeneratorTest::GENIEParameterSet(std::string fluxType, bool usePOTPerSpill) { // make a parameter set first so that we can pass it to the GENIEHelper // object we are going to make std::vector<double> beamCenter; beamCenter.push_back(0.0); beamCenter.push_back(0.); beamCenter.push_back(0.0); std::vector<double> beamDir; beamDir.push_back(0.); beamDir.push_back(0.); beamDir.push_back(1.); std::vector<int> flavors; if(fluxType.compare("atmo_FLUKA") == 0){ flavors.push_back(14); } else{ flavors.push_back(12); flavors.push_back(14); flavors.push_back(-12); flavors.push_back(-14); } std::vector<std::string> env; env.push_back("GPRODMODE"); env.push_back("YES"); env.push_back("GEVGL"); env.push_back("Default"); double potPerSpill = 5.e13; double eventsPerSpill = 0; if(!usePOTPerSpill) eventsPerSpill = 1; std::vector<std::string> fluxFiles; fluxFiles.push_back("samples_for_geniehelper/L010z185i_lowthr_ipndshed.root"); if(fluxType.compare("simple_flux") == 0){ fluxFiles.clear(); fluxFiles.push_back("samples_for_geniehelper/gsimple_NOvA-NDOS_le010z185i_20100521_RHC_lowth_s_00001.root"); } else if(fluxType.compare("atmo_FLUKA") == 0){ fluxFiles.clear(); // at FNAL this is installed relative to in /nusoft/data/flux fluxFiles.push_back("atmospheric/battistoni/sdave_numu07.dat"); } else if(fluxType.compare("ntuple") == 0){ throw cet::exception("EventGeneratorTest") <<"No ntuple flux file " << "exists, bail ungracefully"; } fhicl::ParameterSet pset; pset.put("FluxType", fluxType); pset.put("FluxFiles", fluxFiles); pset.put("BeamName", "numi"); pset.put("TopVolume", fTopVolume); pset.put("EventsPerSpill", eventsPerSpill); pset.put("POTPerSpill", potPerSpill); pset.put("BeamCenter", beamCenter); pset.put("BeamDirection", beamDir); pset.put("GenFlavors", flavors); pset.put("Environment", env); pset.put("DetectorLocation", "NOvA-ND"); mf::LogWarning("EventGeneratorTest") << pset.to_string(); return pset; } //____________________________________________________________________________ void EventGeneratorTest::GENIETest(fhicl::ParameterSet const& pset) { // use cet::search_path to get the Geometry file path cet::search_path sp("FW_SEARCH_PATH"); std::string geometryFile = fGeometryFile; if( !sp.find_file(geometryFile, fGeometryFile) ) throw cet::exception("EventGeneratorTest") << "cannot find geometry file:\n " << geometryFile << "\n to test GENIE"; TGeoManager::Import(geometryFile.c_str()); // make the GENIEHelper object evgb::GENIEHelper help(pset, gGeoManager, geometryFile, gGeoManager->FindVolumeFast(pset.get< std::string>("TopVolume").c_str())->Weight()); help.Initialize(); int interactionCount = 0; int nspill = 0; int spillLimit = 0; // decide if we are in POT/Spill or Events/Spill mode double eps = pset.get<double>("EventsPerSpill"); if(eps > 0.) spillLimit = TMath::Nint(fTotalGENIEInteractions/eps); else spillLimit = 1000; while(nspill < spillLimit){ ++nspill; while( !help.Stop() ){ simb::MCTruth truth; simb::MCFlux flux; simb::GTruth gTruth; if( help.Sample(truth, flux, gTruth) ) ++interactionCount; } // end creation loop for this spill } // end loop over spills // count the POT used and the number of events made mf::LogWarning("EventGeneratorTest") << "made " << interactionCount << " interactions with " << help.TotalExposure() << " POTs"; // compare to a simple expectation double totalExp = 0.; if(help.FluxType().compare("histogram") == 0 && pset.get<double>("EventsPerSpill") == 0){ std::vector<TH1D*> fluxhist = help.FluxHistograms(); if(fluxhist.size() < 1){ throw cet::exception("EventGeneratorTest") << "using histogram fluxes but no histograms provided!"; } // see comments in GENIEHelper::Initialize() for how this calculation was done. totalExp = 1.e-38*1.e-20*help.TotalHistFlux(); totalExp *= help.TotalExposure()*help.TotalMass()/(1.67262158e-27); mf::LogWarning("EventGeneratorTest") << "expected " << totalExp << " interactions"; if(std::abs(interactionCount - totalExp) > 3.*std::sqrt(totalExp) ){ throw cet::exception("EventGeneratorTest") << "generated count is more than " << "3 sigma off expectation"; } }// end if histogram fluxes return; } //____________________________________________________________________________ void EventGeneratorTest::GENIEHistogramFluxTest() { mf::LogWarning("EventGeneratorTest") << "\t\t\t 1 event per spill...\n"; // make the parameter set fhicl::ParameterSet pset1(this->GENIEParameterSet("histogram", false)); this->GENIETest(pset1); mf::LogWarning("EventGeneratorTest") <<"\t\t\t events based on POT per spill...\n"; fhicl::ParameterSet pset2(this->GENIEParameterSet("histogram", true)); this->GENIETest(pset2); return; } //____________________________________________________________________________ void EventGeneratorTest::GENIESimpleFluxTest() { // make the parameter set mf::LogWarning("EventGeneratorTest") << "testing GENIEHelper in simple_flux mode with \n" << "\t 1 event per spill...\n"; fhicl::ParameterSet pset1 = this->GENIEParameterSet("simple_flux", false); this->GENIETest(pset1); mf::LogWarning("EventGeneratorTest") <<"\t events based on POT per spill...\n"; fhicl::ParameterSet pset2 = this->GENIEParameterSet("simple_flux", true); this->GENIETest(pset2); return; } //____________________________________________________________________________ void EventGeneratorTest::GENIEMonoFluxTest() { // make the parameter set fhicl::ParameterSet pset1 = this->GENIEParameterSet("mono", false); mf::LogWarning("EventGeneratorTest") << "\t\t 1 event per spill...\n"; this->GENIETest(pset1); return; } //____________________________________________________________________________ void EventGeneratorTest::GENIEAtmoFluxTest() { // make the parameter set fhicl::ParameterSet pset1 = this->GENIEParameterSet("atmo_FLUKA", false); mf::LogWarning("EventGeneratorTest") << "\t\t 1 event per spill...\n"; this->GENIETest(pset1); return; } //____________________________________________________________________________ fhicl::ParameterSet EventGeneratorTest::CRYParameterSet() { fhicl::ParameterSet pset; pset.put("SampleTime", 600e-6 ); pset.put("TimeOffset", -30e-6 ); pset.put("EnergyThreshold", 50e-3 ); pset.put("Latitude", "latitude 41.8 " ); pset.put("Altitude", "altitude 0 " ); pset.put("SubBoxLength", "subboxLength 75 "); mf::LogWarning("EventGeneratorTest") << pset.to_string(); return pset; } //____________________________________________________________________________ void EventGeneratorTest::CRYTest() { // make the parameter set fhicl::ParameterSet pset = this->CRYParameterSet(); // make the CRYHelper evgb::CRYHelper help(pset, fEngine); int nspill = 0; double avPartPerSpill = 0.; double avPartIntersectPerSpill = 0.; double avMuonIntersectPerSpill = 0.; double avEIntersectPerSpill = 0.; while(nspill < TMath::Nint(fTotalCRYSpills) ){ simb::MCTruth mct; help.Sample(mct, 1., 100., 0); avPartPerSpill += mct.NParticles(); // now check to see if the particles go through the // detector enclosure for(int p = 0; p < mct.NParticles(); ++p){ if(this->IntersectsDetector(mct.GetParticle(p)) ){ avPartIntersectPerSpill += 1.; if(TMath::Abs(mct.GetParticle(p).PdgCode()) == 13) avMuonIntersectPerSpill += 1.; else if(TMath::Abs(mct.GetParticle(p).PdgCode()) == 11) avEIntersectPerSpill += 1.; } } ++nspill; } mf::LogWarning("EventGeneratorTest") << "there are " << avPartPerSpill/(1.*nspill) << " cosmic rays made per spill \n" << avPartIntersectPerSpill/(1.*nspill) << " intersect the detector per spill" << "\n\t " << avMuonIntersectPerSpill/(1.*nspill) << " muons \n\t" << avEIntersectPerSpill/(1.*nspill) << " electrons"; return; } //____________________________________________________________________________ bool EventGeneratorTest::IntersectsDetector(simb::MCParticle const& part) { // the particle's initial position and momentum TLorentzVector pos = part.Position(); TLorentzVector mom = part.Momentum(); if(TMath::Abs(mom.P()) == 0){ mf::LogWarning("EventGeneratorTest") << "particle has no momentum!!! bail"; return false; } double xyz[3] = {0.}; // Checking intersection with 6 planes // 1. Check intersection with the y = +halfheight plane this->ProjectToSurface(pos, mom, 1, 0.5*fCryDetHeight, xyz); if( TMath::Abs(xyz[0]) <= 0.5*fCryDetWidth && xyz[2] > 0. && TMath::Abs(xyz[2]) <= fCryDetLength ) return true; // 2. Check intersection with the +x plane this->ProjectToSurface(pos, mom, 0, 0.5*fCryDetWidth, xyz); if( TMath::Abs(xyz[1]) <= 0.5*fCryDetHeight && xyz[2] > 0. && TMath::Abs(xyz[2]) <= fCryDetLength ) return true; // 3. Check intersection with the -x plane this->ProjectToSurface(pos, mom, 0, -0.5*fCryDetWidth, xyz); if( TMath::Abs(xyz[1]) <= 0.5*fCryDetHeight && xyz[2] > 0. && TMath::Abs(xyz[2]) <= fCryDetLength ) return true; // 4. Check intersection with the z=0 plane this->ProjectToSurface(pos, mom, 2, 0., xyz); if( TMath::Abs(xyz[0]) <= 0.5*fCryDetWidth && TMath::Abs(xyz[1]) <= 0.5*fCryDetHeight ) return true; // 5. Check intersection with the z=detlength plane this->ProjectToSurface(pos, mom, 2, fCryDetLength, xyz); if( TMath::Abs(xyz[0]) <= 0.5*fCryDetWidth && TMath::Abs(xyz[1]) <= 0.5*fCryDetHeight ) return true; return false; } //____________________________________________________________________________ void EventGeneratorTest::ProjectToSurface(TLorentzVector pos, TLorentzVector mom, int axis, double surfaceLoc, double* xyz) { double momDir = 0.; double posDir = 0.; if(axis == 0){ momDir = mom.Px(); posDir = pos.X(); } else if(axis == 1){ momDir = mom.Py(); posDir = pos.X(); } else if(axis == 2){ momDir = mom.Pz(); posDir = pos.X(); } double ddS = (momDir/mom.P()); double length1Dim = (posDir - surfaceLoc); if(TMath::Abs(ddS) > 0.){ length1Dim /= ddS; xyz[0] = pos.X() + length1Dim*mom.Px()/mom.P(); xyz[1] = pos.Y() + length1Dim*mom.Py()/mom.P(); xyz[2] = pos.Z() + length1Dim*mom.Pz()/mom.P(); } return; } }// namespace namespace evgen{ DEFINE_ART_MODULE(EventGeneratorTest) } #endif // EVGEN_TEST_H
32.080709
114
0.63932
nusense
7f92e43c34d995bd5d9fc6cbd8abf11bf6e52483
605
hpp
C++
framework/pipeline/StandardLine.hpp
FeiGeChuanShu/TengineFactory
89524b8edc3fb6d00f60f12ebfcfdea985639e03
[ "Apache-2.0" ]
1
2021-09-30T05:44:57.000Z
2021-09-30T05:44:57.000Z
framework/pipeline/StandardLine.hpp
FeiGeChuanShu/TengineFactory
89524b8edc3fb6d00f60f12ebfcfdea985639e03
[ "Apache-2.0" ]
null
null
null
framework/pipeline/StandardLine.hpp
FeiGeChuanShu/TengineFactory
89524b8edc3fb6d00f60f12ebfcfdea985639e03
[ "Apache-2.0" ]
null
null
null
#ifndef STANDARDLINE_HPP #define STANDARDLINE_HPP #include <iostream> #include "LineBase.hpp" #include "Dataset.hpp" #include "ImageDispose.hpp" #include <memory> namespace TFactory { class StandardLine : public LineBase { private: Anchor anchor; public: StandardLine(); void onCreate(); void onPreProcess(); void onRun(uint8_t* imageData, int input_w, int input_h, std::vector<std::vector<float*>> streams); void onPostProcess(); std::vector<float*> onReceiveOutput(); void onDestory(); ~StandardLine(); private: void NoPostProcess(); void NMS(); }; } #endif
20.862069
103
0.700826
FeiGeChuanShu
7f944db347c15c981a63e0a15a596c8313f8c51b
14,703
cpp
C++
rcff/src/RCF/ProxyEndpointService.cpp
DayBreakZhang/CXKJ_Code
c7caab736313f029324f1c95714f5a94b2589076
[ "Apache-2.0" ]
null
null
null
rcff/src/RCF/ProxyEndpointService.cpp
DayBreakZhang/CXKJ_Code
c7caab736313f029324f1c95714f5a94b2589076
[ "Apache-2.0" ]
null
null
null
rcff/src/RCF/ProxyEndpointService.cpp
DayBreakZhang/CXKJ_Code
c7caab736313f029324f1c95714f5a94b2589076
[ "Apache-2.0" ]
null
null
null
//****************************************************************************** // RCF - Remote Call Framework // // Copyright (c) 2005 - 2019, Delta V Software. All rights reserved. // http://www.deltavsoft.com // // RCF is distributed under dual licenses - closed source or GPL. // Consult your particular license for conditions of use. // // If you have not purchased a commercial license, you are using RCF // under GPL terms. // // Version: 3.1 // Contact: support <at> deltavsoft.com // //****************************************************************************** #include <RCF/ProxyEndpointService.hpp> #include <RCF/BsdClientTransport.hpp> #include <RCF/Enums.hpp> #include <RCF/Log.hpp> #include <RCF/Uuid.hpp> #include <RCF/ProxyEndpointTransport.hpp> namespace RCF { ProxyEndpointEntry::ProxyEndpointEntry() { } ProxyEndpointEntry::ProxyEndpointEntry(const std::string& endpointName) : mName(endpointName) { } void ProxyEndpointService::onServiceAdded(RCF::RcfServer &server) { mpRcfServer = &server; server.bind<I_ProxyEp>(*this); } void ProxyEndpointService::onServiceRemoved(RCF::RcfServer &server) { RCF_UNUSED_VARIABLE(server); } void ProxyEndpointService::onServerStart(RCF::RcfServer &server) { RCF_UNUSED_VARIABLE(server); } void ProxyEndpointService::onServerStop(RCF::RcfServer &server) { RCF_UNUSED_VARIABLE(server); { Lock lock(mEntriesMutex); mEntries.clear(); } { Lock lock(mEndpointConnectionsMutex); mEndpointConnections.clear(); } } void ProxyEndpointService::enumerateProxyEndpoints(std::vector<std::string>& endpoints) { if ( !mpRcfServer->getEnableProxyEndpoints() ) { RCF_THROW(Exception(RcfError_ProxyEndpointsNotEnabled)); } endpoints.clear(); std::vector<std::string> duds; Lock lock(mEntriesMutex); for ( auto iter : mEntries ) { const std::string& endpointName = iter.first; ProxyEndpointEntry & entry = iter.second; RcfSessionPtr sessionPtr = entry.mSessionWeakPtr.lock(); if ( sessionPtr && sessionPtr->isConnected() ) { endpoints.push_back(endpointName); } else { duds.push_back(endpointName); } } for (auto dud : duds) { mEntries.erase(mEntries.find(dud)); } } ClientTransportUniquePtr ProxyEndpointService::makeProxyEndpointConnection( const std::string& proxyEndpointName) { if ( !mpRcfServer->getEnableProxyEndpoints() ) { RCF_THROW(Exception(RcfError_ProxyEndpointsNotEnabled)); } // If serving a proxy request over the network, the server must be multi-threaded. if ( getCurrentRcfSessionPtr() && mpRcfServer->getThreadPool()->getThreadMaxCount() < 2 ) { RCF_THROW(Exception(RcfError_ProxyServerMultiThreaded)); } std::string requestId = generateUuid(); bool endpointOnline = true; { Lock lock(mEntriesMutex); auto iter = mEntries.find(proxyEndpointName); if (iter != mEntries.end()) { ProxyEndpointEntry & entry = iter->second; RcfSessionPtr sessionPtr = entry.mSessionWeakPtr.lock(); if ( !sessionPtr || !sessionPtr->isConnected() ) { mEntries.erase(iter); endpointOnline = false; } else { entry.mPendingRequests.push_back(requestId); if ( entry.mAmdPtr ) { std::vector<std::string> & amdRequests = entry.mAmdPtr->parameters().a1.get(); amdRequests.clear(); amdRequests.swap(entry.mPendingRequests); entry.mAmdPtr->commit(); entry.mAmdPtr.reset(); } } } else { endpointOnline = false; } } if ( !endpointOnline ) { Exception e(RcfError_ProxyEndpointDown, proxyEndpointName); RCF_THROW(e); } // Wait for a connection to show up. auto requestKey = std::make_pair(proxyEndpointName, requestId); Timer connectTimer; while ( !connectTimer.elapsed(10*1000) ) { Lock lock(mEndpointConnectionsMutex); auto iter = mEndpointConnections.find(requestKey); if ( iter != mEndpointConnections.end() ) { ClientTransportUniquePtr transportPtr = std::move(iter->second); mEndpointConnections.erase(iter); return transportPtr; } using namespace std::chrono_literals; mEndpointConnectionsCond.wait_for(lock, 1000ms); } // If we're here, we've timed out waiting for the proxy endpoint to spool up a connection. Exception e(RcfError_NoProxyConnection, proxyEndpointName); RCF_THROW(e); return ClientTransportUniquePtr(); } class RelaySocket; typedef std::shared_ptr<RelaySocket> RelaySocketPtr; class RelaySocket : public std::enable_shared_from_this<RelaySocket> { public: RelaySocket(TcpSocketPtr socketPtr1, TcpSocketPtr socketPtr2) : mSocketPtr1(socketPtr1), mSocketPtr2(socketPtr2), mBuffer1(4096), mBuffer2(4096) { } ~RelaySocket() { } class ReadHandler { public: ReadHandler(RelaySocketPtr relaySocketPtr, TcpSocketPtr socketPtr) : mRelaySocketPtr(relaySocketPtr), mSocketPtr(socketPtr) {} void operator()(AsioErrorCode err, std::size_t bytes) { mRelaySocketPtr->onReadCompleted(mSocketPtr, err, bytes); } RelaySocketPtr mRelaySocketPtr; TcpSocketPtr mSocketPtr; }; class WriteHandler { public: WriteHandler(RelaySocketPtr relaySocketPtr, TcpSocketPtr socketPtr) : mRelaySocketPtr(relaySocketPtr), mSocketPtr(socketPtr) {} void operator()(AsioErrorCode err, std::size_t bytes) { mRelaySocketPtr->onWriteCompleted(mSocketPtr, err, bytes); } RelaySocketPtr mRelaySocketPtr; TcpSocketPtr mSocketPtr; }; void onReadCompleted(TcpSocketPtr socketPtr, AsioErrorCode err, std::size_t bytes) { RCF_LOG_4()(this)(err)(bytes) << "RelaySocket - read from socket completed."; if ( err ) { if ( socketPtr == mSocketPtr2 ) { AsioErrorCode ec; mSocketPtr1->shutdown(ASIO_NS::ip::tcp::socket::shutdown_send, ec); } else { AsioErrorCode ec; mSocketPtr2->shutdown(ASIO_NS::ip::tcp::socket::shutdown_send, ec); } } else { RCF_LOG_4()(this)(bytes) << "RelaySocket - issuing write on relayed socket."; if ( socketPtr == mSocketPtr1 ) { mBufferLen1 = bytes; ASIO_NS::async_write( *mSocketPtr2, ASIO_NS::buffer(&mBuffer1[0], bytes), WriteHandler(shared_from_this(), mSocketPtr2)); } else { mBufferLen2 = bytes; ASIO_NS::async_write( *mSocketPtr1, ASIO_NS::buffer(&mBuffer2[0], bytes), WriteHandler(shared_from_this(), mSocketPtr1)); } } } void onWriteCompleted(TcpSocketPtr socketPtr, AsioErrorCode err, std::size_t bytes) { RCF_LOG_4()(this)(err)(bytes) << "RelaySocket - write to relayed socket completed."; if ( err ) { if ( socketPtr == mSocketPtr2 ) { AsioErrorCode ec; mSocketPtr1->shutdown(ASIO_NS::ip::tcp::socket::shutdown_send, ec); } else { AsioErrorCode ec; mSocketPtr2->shutdown(ASIO_NS::ip::tcp::socket::shutdown_send, ec); } } else { RCF_LOG_4()(this) << "RelaySocket - issuing read on socket."; if ( socketPtr == mSocketPtr2 ) { mSocketPtr1->async_read_some( ASIO_NS::buffer(&mBuffer1[0], mBuffer1.size()), ReadHandler(shared_from_this(), mSocketPtr1)); } else { mSocketPtr2->async_read_some( ASIO_NS::buffer(&mBuffer2[0], mBuffer2.size()), ReadHandler(shared_from_this(), mSocketPtr2)); } } } void start() { RCF_LOG_3()(this) << "RelaySocket - start relaying."; onWriteCompleted(mSocketPtr1, RCF::AsioErrorCode(), 0); onWriteCompleted(mSocketPtr2, RCF::AsioErrorCode(), 0); } private: TcpSocketPtr mSocketPtr1; std::vector<char> mBuffer1; std::size_t mBufferLen1 = 0; TcpSocketPtr mSocketPtr2; std::vector<char> mBuffer2; std::size_t mBufferLen2 = 0; }; void ProxyEndpointService::setupProxiedConnection(RcfSession& session, ClientTransportPtr proxyTransportPtr) { // Get the socket to the client. ServerTransportEx &serverTransport = dynamic_cast<ServerTransportEx &>(session.getNetworkSession().getServerTransport()); ClientTransportPtr clientTransportPtr(serverTransport.createClientTransport(session.shared_from_this()).release()); BsdClientTransport& clientTransport = dynamic_cast<BsdClientTransport&>(*clientTransportPtr); clientTransport.setRcfSession(RcfSessionWeakPtr()); session.setCloseSessionAfterWrite(true); TcpSocketPtr clientSocketPtr = clientTransport.releaseTcpSocket(); // Get the socket to the target server. BsdClientTransport& proxyTransport = dynamic_cast<BsdClientTransport&>(*proxyTransportPtr); TcpSocketPtr proxySocketPtr = proxyTransport.releaseTcpSocket(); // Start relaying them. RelaySocketPtr relaySocketPtr(new RelaySocket(clientSocketPtr, proxySocketPtr)); relaySocketPtr->start(); } class ProxyEndpointSession { public: ProxyEndpointSession() { } ~ProxyEndpointSession() { } ProxyEndpointService * mpEpService = NULL; std::string mEndpointName; }; void ProxyEndpointService::removeEndpoint(const std::string& endpointName) { Lock lock(mEntriesMutex); auto iter = mEntries.find(endpointName); if ( iter != mEntries.end() ) { mEntries.erase(iter); } } void ProxyEndpointService::SetupProxyEndpoint(const std::string& endpointName, const std::string& password) { if ( !mpRcfServer->getEnableProxyEndpoints() ) { RCF_THROW(Exception(RcfError_ProxyEndpointsNotEnabled)); } // TODO: check password. RCF_UNUSED_VARIABLE(password); ProxyEndpointSession * pEpSession = &getCurrentRcfSession().createSessionObject<ProxyEndpointSession>(); pEpSession->mEndpointName = endpointName; pEpSession->mpEpService = this; Lock lock(mEntriesMutex); mEntries[endpointName] = ProxyEndpointEntry(endpointName); mEntries[endpointName].mSessionWeakPtr = getCurrentRcfSession().shared_from_this(); } void ProxyEndpointService::GetConnectionRequests( std::vector<std::string>& requests) { ProxyEndpointSession * pEpSession = getCurrentRcfSession().querySessionObject<ProxyEndpointSession>(); if ( !pEpSession ) { // TODO: literal Exception e("Invalid proxy endpoint connection."); RCF_THROW(e); } std::string endpointName = pEpSession->mEndpointName; requests.clear(); Lock lock(mEntriesMutex); auto iter = mEntries.find(endpointName); if (iter != mEntries.end()) { ProxyEndpointEntry & entry = iter->second; if ( entry.mSessionWeakPtr.lock() == getCurrentRcfSession().shared_from_this() ) { if ( entry.mPendingRequests.size() > 0 ) { // Synchronous return. requests.clear(); requests.swap(entry.mPendingRequests); } else { // Asynchronous return, once a request is made. entry.mAmdPtr.reset(new AmdGetRequests(getCurrentRcfSession())); entry.mSessionWeakPtr = getCurrentRcfSession().shared_from_this(); } } } } void ProxyEndpointService::onConnectionAvailable( const std::string& endpointName, const std::string& requestId, RCF::RcfSessionPtr sessionPtr, RCF::ClientTransportUniquePtr transportPtr) { Lock lock(mEntriesMutex); mEndpointConnections[std::make_pair(endpointName, requestId)].reset( transportPtr.release() ); mEndpointConnectionsCond.notify_all(); } void ProxyEndpointService::MakeConnectionAvailable( const std::string& endpointName, const std::string& requestId) { RCF::convertRcfSessionToRcfClient( [=](RcfSessionPtr sessionPtr, ClientTransportUniquePtr transportPtr) { onConnectionAvailable(endpointName, requestId, sessionPtr, std::move(transportPtr)); }, RCF::Twoway); } } // namespace RCF
32.172867
129
0.551384
DayBreakZhang
7f9d899b0d084cbeeab5dad71ea423b86ff3edea
22,460
cpp
C++
arch/drisc/ICache.cpp
svp-dev/mgsim
0abd708f3c48723fc233f6c53f3e638129d070fa
[ "MIT" ]
7
2016-03-01T13:16:59.000Z
2021-08-20T07:41:43.000Z
arch/drisc/ICache.cpp
svp-dev/mgsim
0abd708f3c48723fc233f6c53f3e638129d070fa
[ "MIT" ]
null
null
null
arch/drisc/ICache.cpp
svp-dev/mgsim
0abd708f3c48723fc233f6c53f3e638129d070fa
[ "MIT" ]
5
2015-04-20T14:29:38.000Z
2018-12-29T11:09:17.000Z
#include "ICache.h" #include "DRISC.h" #include <sim/log2.h> #include <sim/config.h> #include <sim/sampling.h> #include <cassert> #include <cstring> #include <iomanip> #include <iostream> using namespace std; namespace Simulator { namespace drisc { ICache::ICache(const std::string& name, DRISC& parent, Clock& clock) : Object(name, parent), m_memory(NULL), m_selector(IBankSelector::makeSelector(*this, GetConf("BankSelector", string), GetConf("NumSets", size_t))), m_mcid(0), m_lines(), m_data(), InitBuffer(m_outgoing, clock, "OutgoingBufferSize"), InitBuffer(m_incoming, clock, "IncomingBufferSize"), m_lineSize(GetTopConf("CacheLineSize", size_t)), m_assoc (GetConf("Associativity", size_t)), InitSampleVariable(numHits, SVC_CUMULATIVE), InitSampleVariable(numDelayedReads, SVC_CUMULATIVE), InitSampleVariable(numEmptyMisses, SVC_CUMULATIVE), InitSampleVariable(numLoadingMisses, SVC_CUMULATIVE), InitSampleVariable(numInvalidMisses, SVC_CUMULATIVE), InitSampleVariable(numHardConflicts, SVC_CUMULATIVE), InitSampleVariable(numResolvedConflicts, SVC_CUMULATIVE), InitSampleVariable(numStallingMisses, SVC_CUMULATIVE), InitProcess(p_Outgoing, DoOutgoing), InitProcess(p_Incoming, DoIncoming), p_service(clock, GetName() + ".p_service") { RegisterModelObject(parent, "cpu"); m_outgoing.Sensitive( p_Outgoing ); m_incoming.Sensitive( p_Incoming ); // These things must be powers of two if (m_assoc == 0 || !IsPowerOfTwo(m_assoc)) { throw exceptf<InvalidArgumentException>(*this, "Associativity = %zd is not a power of two", m_assoc); } const size_t sets = m_selector->GetNumBanks(); if (!IsPowerOfTwo(sets)) { throw exceptf<InvalidArgumentException>(*this, "NumSets = %zd is not a power of two", sets); } if (!IsPowerOfTwo(m_lineSize)) { throw exceptf<InvalidArgumentException>(*this, "CacheLineSize = %zd is not a power of two", m_lineSize); } // At least a complete register value has to fit in a line if (m_lineSize < sizeof(Integer)) { throw exceptf<InvalidArgumentException>(*this, "CacheLineSize = %zd cannot be less than a word.", m_lineSize); } // Initialize the cache lines m_lines.resize(sets * m_assoc); m_data.resize(m_lineSize * m_lines.size()); RegisterStateVariable(m_data, "data"); for (size_t i = 0; i < m_lines.size(); ++i) { auto& line = m_lines[i]; line.state = LINE_EMPTY; line.data = &m_data[i * m_lineSize]; line.references = 0; line.waiting.head = INVALID_TID; line.creation = false; RegisterStateObject(line, "line" + to_string(i)); } } void ICache::ConnectMemory(IMemory* memory) { assert(m_memory == NULL); // can't register two times assert(memory != NULL); m_memory = memory; StorageTraceSet traces; m_mcid = m_memory->RegisterClient(*this, p_Outgoing, traces, m_incoming); p_Outgoing.SetStorageTraces(traces); } ICache::~ICache() { delete m_selector; } bool ICache::IsEmpty() const { for (size_t i = 0; i < m_lines.size(); ++i) { if (m_lines[i].state != LINE_EMPTY && m_lines[i].references != 0) { return false; } } return true; } // // Finds the line for the specified address. Returns: // SUCCESS - Line found (hit) // DELAYED - Line not found (miss), but empty one allocated // FAILED - Line not found (miss), no empty lines to allocate // Result ICache::FindLine(MemAddr address, Line* &line, bool check_only) { MemAddr tag; size_t setindex; m_selector->Map(address / m_lineSize, tag, setindex); const size_t set = setindex * m_assoc; // Find the line Line* empty = NULL; Line* replace = NULL; for (size_t i = 0; i < m_assoc; ++i) { line = &m_lines[set + i]; if (line->state == LINE_EMPTY) { // Empty line, remember this one empty = line; } else if (line->tag == tag) { // The wanted line was in the cache return SUCCESS; } else if (line->references == 0 && (replace == NULL || line->access < replace->access)) { // The line is available to be replaced and has a lower LRU rating, // remember it for replacing replace = line; } } // The line could not be found, allocate the empty line or replace an existing line line = (empty != NULL) ? empty : replace; if (line == NULL) { // No available line DeadlockWrite("Unable to allocate a cache-line for the request to %#016llx (set %u)", (unsigned long long)address, (unsigned)(set / m_assoc)); return FAILED; } if (!check_only) { COMMIT { // Reset the line line->tag = tag; } } return DELAYED; } bool ICache::ReleaseCacheLine(CID cid) { if (cid != INVALID_CID) { // Once the references hit zero, the line can be replaced by a next request COMMIT { Line& line = m_lines[cid]; assert(line.references > 0); if (--line.references == 0 && line.state == LINE_INVALID) { line.state = LINE_EMPTY; } } } return true; } bool ICache::Read(CID cid, MemAddr address, void* data, MemSize size) const { MemAddr tag; size_t unused; m_selector->Map(address / m_lineSize, tag, unused); size_t offset = (size_t)(address % m_lineSize); if (offset + size > m_lineSize) { throw exceptf<InvalidArgumentException>(*this, "Read (%#016llx, %zd): Address range crosses over cache line boundary", (unsigned long long)address, (size_t)size); } #if MEMSIZE_MAX >= SIZE_MAX if (size > SIZE_MAX) { throw exceptf<InvalidArgumentException>(*this, "Read (%#016llx, %zd): Size argument too big", (unsigned long long)address, (size_t)size); } #endif if (m_lines[cid].state == LINE_EMPTY || m_lines[cid].tag != tag) { throw exceptf<InvalidArgumentException>(*this, "Read (%#016llx, %zd): Attempting to read from an invalid cache line", (unsigned long long)address, (size_t)size); } const Line& line = m_lines[cid]; // Verify that we're actually reading a fetched line assert(line.state == LINE_FULL || line.state == LINE_INVALID); COMMIT{ memcpy(data, line.data + offset, (size_t)size); } return true; } // For family creation Result ICache::Fetch(MemAddr address, MemSize size, CID& cid) { return Fetch(address, size, NULL, &cid); } // For thread activation Result ICache::Fetch(MemAddr address, MemSize size, TID& tid, CID& cid) { return Fetch(address, size, &tid, &cid); } Result ICache::Fetch(MemAddr address, MemSize size, TID* tid, CID* cid) { // Check that we're fetching executable memory auto& cpu = GetDRISC(); if (!cpu.CheckPermissions(address, size, IMemory::PERM_EXECUTE)) { throw exceptf<SecurityException>(*this, "Fetch (%#016llx, %zd): Attempting to execute from non-executable memory", (unsigned long long)address, (size_t)size); } // Validate input size_t offset = (size_t)(address % m_lineSize); if (offset + size > m_lineSize) { throw exceptf<InvalidArgumentException>(*this, "Fetch (%#016llx, %zd): Address range crosses over cache line boundary", (unsigned long long)address, (size_t)size); } #if MEMSIZE_MAX >= SIZE_MAX if (size > SIZE_MAX) { throw exceptf<InvalidArgumentException>(*this, "Fetch (%#016llx, %zd): Size argument too big", (unsigned long long)address, (size_t)size); } #endif if (!p_service.Invoke()) { return FAILED; } // Align the address address = address - offset; // Check the cache Line* line; Result result; if ((result = FindLine(address, line)) == FAILED) { // No cache lines are available // DeadlockWrite was already called in FindLine (which has more information) ++m_numHardConflicts; return FAILED; } // Update access time COMMIT{ line->access = cpu.GetCycleNo(); } // If the caller wants the line index, give it if (cid != NULL) { *cid = line - &m_lines[0]; } if (result == SUCCESS) { // Cache hit if (line->state == LINE_INVALID) { // This line has been invalidated, we have to wait until it's cleared // so we can request a new one ++m_numInvalidMisses; return FAILED; } // Update reference count COMMIT{ line->references++; } if (line->state == LINE_FULL) { // The line was already fetched so we're done. // This is 'true' hit in that we don't have to wait. COMMIT{ ++m_numHits; } return SUCCESS; } // The line is being fetched assert(line->state == LINE_LOADING); COMMIT { if (tid != NULL) { // Add the thread to the queue TID head = line->waiting.head; if (line->waiting.head == INVALID_TID) { line->waiting.tail = *tid; } line->waiting.head = *tid; *tid = head; } else if (cid != NULL) { // Initial line for creation assert(!line->creation); line->creation = true; } // Statistics ++m_numLoadingMisses; } } else { // Cache miss; a line has been allocated, fetch the data if (!m_outgoing.Push(address)) { DeadlockWrite("Unable to put request for I-Cache line into outgoing buffer"); ++m_numStallingMisses; return FAILED; } // Data is being fetched COMMIT { // Statistics if (line->state == LINE_EMPTY) ++m_numEmptyMisses; else ++m_numResolvedConflicts; // Initialize buffer line->creation = false; line->references = 1; line->state = LINE_LOADING; if (tid != NULL) { // Initialize the waiting queue line->waiting.head = *tid; line->waiting.tail = *tid; *tid = INVALID_TID; } else if (cid != NULL) { // Line is used in family creation line->creation = true; } } } COMMIT{ ++m_numDelayedReads; } return DELAYED; } bool ICache::OnMemoryReadCompleted(MemAddr addr, const char *data) { // Instruction cache line returned, store in cache and Buffer // Find the line Line* line; if (FindLine(addr, line, true) == SUCCESS && line->state != LINE_FULL) { // We need this data, store it assert(line->state == LINE_LOADING || line->state == LINE_INVALID); COMMIT { std::copy(data, data + m_lineSize, line->data); } CID cid = line - &m_lines[0]; if (!m_incoming.Push(cid)) { DeadlockWrite("Unable to buffer I-Cache line read completion for line #%u", (unsigned)cid); return false; } } return true; } bool ICache::OnMemoryWriteCompleted(TID /*tid*/) { // The I-Cache never writes UNREACHABLE; } bool ICache::OnMemorySnooped(MemAddr address, const char * data, const bool * mask) { Line* line; // Cache coherency: check if we have the same address if (FindLine(address, line, true) == SUCCESS) { // We do, update the data COMMIT{ line::blit(line->data, data, mask, m_lineSize); } } return true; } bool ICache::OnMemoryInvalidated(MemAddr address) { COMMIT { Line* line; if (FindLine(address, line, true) == SUCCESS) { if (line->state == LINE_FULL) { // Valid lines without references are invalidated by clearing then. Simple. // Otherwise, we invalidate them. line->state = (line->references == 0) ? LINE_EMPTY : LINE_INVALID; } else if (line->state != LINE_INVALID) { // Mark the line as invalidated. After it has been loaded and used it will be cleared assert(line->state == LINE_LOADING); line->state = LINE_INVALID; } } } return true; } Object& ICache::GetMemoryPeer() { return *GetParent(); } Result ICache::DoOutgoing() { assert(!m_outgoing.Empty()); assert(m_memory != NULL); const MemAddr& address = m_outgoing.Front(); if (!m_memory->Read(m_mcid, address)) { // The fetch failed DeadlockWrite("Unable to read %#016llx from memory", (unsigned long long)address); return FAILED; } m_outgoing.Pop(); return SUCCESS; } Result ICache::DoIncoming() { assert(!m_incoming.Empty()); if (!p_service.Invoke()) { return FAILED; } CID cid = m_incoming.Front(); Line& line = m_lines[cid]; COMMIT{ line.state = LINE_FULL; } auto& alloc = GetDRISC().GetAllocator(); if (line.creation) { // Resume family creation if (!alloc.OnICachelineLoaded(cid)) { DeadlockWrite("Unable to resume family creation for C%u", (unsigned)cid); return FAILED; } COMMIT{ line.creation = false; } } if (line.waiting.head != INVALID_TID) { // Reschedule the line's waiting list if (!alloc.QueueActiveThreads(line.waiting)) { DeadlockWrite("Unable to queue active threads T%u through T%u for C%u", (unsigned)line.waiting.head, (unsigned)line.waiting.tail, (unsigned)cid); return FAILED; } // Clear the waiting list COMMIT { line.waiting.head = INVALID_TID; line.waiting.tail = INVALID_TID; } } m_incoming.Pop(); return SUCCESS; } void ICache::Cmd_Info(std::ostream& out, const std::vector<std::string>& /*arguments*/) const { out << "The Instruction Cache stores data from memory that contains instructions for\n" "active threads for faster access. Compared to a traditional cache, this I-Cache\n" "is extended with several fields to support the multiple threads.\n\n" "Supported operations:\n" "- inspect <component>\n" " Reads and displays the cache-lines, and global information such as hit-rate\n" " and cache configuration.\n"; } void ICache::Cmd_Read(std::ostream& out, const std::vector<std::string>& arguments) const { if (arguments.empty()) { out << "Cache type: "; if (m_assoc == 1) { out << "Direct mapped" << endl; } else if (m_assoc == m_lines.size()) { out << "Fully associative" << endl; } else { out << dec << m_assoc << "-way set associative" << endl; } out << "L1 bank mapping: " << m_selector->GetName() << endl << "Cache size: " << dec << (m_lineSize * m_lines.size()) << " bytes" << endl << "Cache line size: " << dec << m_lineSize << " bytes" << endl << endl; uint64_t numRAccesses = m_numHits + m_numDelayedReads; uint64_t numRqst = m_numEmptyMisses + m_numResolvedConflicts; uint64_t numStalls = m_numHardConflicts + m_numInvalidMisses + m_numStallingMisses; #define PRINTVAL(X, q) dec << (X) << " (" << setprecision(2) << fixed << (X) * q << "%)" if (numRAccesses == 0) out << "No accesses so far, cannot provide statistical data." << endl; else { out << "***********************************************************" << endl << " Summary " << endl << "***********************************************************" << endl << endl << "Number of read requests from client: " << numRAccesses << endl << "Number of request to upstream: " << numRqst << endl << "Number of stall cycles: " << numStalls << endl << endl << endl; float r_factor = 100.0f / numRAccesses; out << "***********************************************************" << endl << " Cache reads " << endl << "***********************************************************" << endl << endl << "Number of read requests from client: " << numRAccesses << endl << "Read hits: " << PRINTVAL(m_numHits, r_factor) << endl << "Read misses: " << PRINTVAL(m_numDelayedReads, r_factor) << endl << "Breakdown of read misses:" << endl << "- to an empty line: " << PRINTVAL(m_numEmptyMisses, r_factor) << endl << "- to a loading line with same tag: " << PRINTVAL(m_numLoadingMisses, r_factor) << endl << "- to a reusable line with different tag (conflict): " << PRINTVAL(m_numResolvedConflicts, r_factor) << endl << "(percentages relative to " << numRAccesses << " read requests)" << endl << endl; if (numStalls != 0) { float s_factor = 100.f / numStalls; out << "***********************************************************" << endl << " Stall cycles " << endl << "***********************************************************" << endl << endl << "Number of stall cycles: " << numStalls << endl << "Breakdown:" << endl << "- read conflict to non-reusable line: " << PRINTVAL(m_numHardConflicts, s_factor) << endl << "- read to invalidated line: " << PRINTVAL(m_numInvalidMisses, s_factor) << endl << "- unable to send request upstream: " << PRINTVAL(m_numStallingMisses, s_factor) << endl << "(percentages relative to " << numStalls << " stall cycles)" << endl << endl; } } return; } else if (arguments[0] == "buffers") { out << endl << "Outgoing buffer:" << endl; if (m_outgoing.Empty()) { out << "(Empty)" << endl; } else { out << " Address " << endl; out << "-----------------" << endl; for (Buffer<MemAddr>::const_iterator p = m_outgoing.begin(); p != m_outgoing.end(); ++p) { out << setfill('0') << hex << setw(16) << *p << endl; } } out << endl << "Incoming buffer:"; if (m_incoming.Empty()) { out << " (Empty)"; } else for (Buffer<CID>::const_iterator p = m_incoming.begin(); p != m_incoming.end(); ++p) { out << " C" << dec << *p; } out << endl; } out << "Set | Address | Data | Ref |" << endl; out << "----+---------------------+-------------------------------------------------+-----+" << endl; for (size_t i = 0; i < m_lines.size(); ++i) { const size_t set = i / m_assoc; const Line& line = m_lines[i]; if (i % m_assoc == 0) { out << setw(3) << setfill(' ') << dec << right << set; } else { out << " "; } if (line.state == LINE_EMPTY) { out << " | | | |"; } else { char state = ' '; switch (line.state) { case LINE_LOADING: state = 'L'; break; case LINE_INVALID: state = 'I'; break; default: state = ' '; break; } out << " | " << hex << "0x" << setw(16) << setfill('0') << m_selector->Unmap(line.tag, set) * m_lineSize << state << " |"; if (line.state == LINE_FULL) { // Print the data static const int BYTES_PER_LINE = 16; for (size_t y = 0; y < m_lineSize; y += BYTES_PER_LINE) { out << hex << setfill('0'); for (size_t x = y; x < y + BYTES_PER_LINE; ++x) { out << " " << setw(2) << (unsigned)(unsigned char)line.data[x]; } out << " | "; if (y == 0) { out << setw(3) << dec << setfill(' ') << line.references; } else { out << " "; } out << " |"; if (y + BYTES_PER_LINE < m_lineSize) { // This was not yet the last line out << endl << " | |"; } } } else { out << " | " << setw(3) << dec << setfill(' ') << line.references << " |"; } } out << endl; out << ((i + 1) % m_assoc == 0 ? "----" : " "); out << "+---------------------+-------------------------------------------------+-----+" << endl; } } } }
32.17765
127
0.503963
svp-dev
7f9f551fd176d35ea850812106284c034b597292
15,145
cpp
C++
Y-Engine/Renderer & Math/YEMath/YObb.cpp
Yosbi/YEngine
e9a992919b646f8672c16285b776638ac86f96fa
[ "MIT" ]
null
null
null
Y-Engine/Renderer & Math/YEMath/YObb.cpp
Yosbi/YEngine
e9a992919b646f8672c16285b776638ac86f96fa
[ "MIT" ]
null
null
null
Y-Engine/Renderer & Math/YEMath/YObb.cpp
Yosbi/YEngine
e9a992919b646f8672c16285b776638ac86f96fa
[ "MIT" ]
null
null
null
//------------------------------------------------------------------------------- // YObb.cpp // Yosbi Alves // yosbito@gmail.com // Copyright (c) 2011 //----------------------------------------------------------------------- // Desc: In this file is the definition of the clases, and methods // YObb class //----------------------------------------------------------------------- //----------------------------------------------------------------------- // Includes //----------------------------------------------------------------------- #include "YEMath.h" //-------------------------------------------------------------------- // Name: DeTransform() // Desc: Detransform a obb to the matrix space //-------------------------------------------------------------------- inline void YObb::DeTransform(const YObb &obb, const YMatrix &m) { YMatrix mat = m; YVector vcT; // erase translation from mat vcT.Set(mat._41, mat._42, mat._43); mat._41 = mat._42 = mat._43 = 0.0f; // rotate center and axis to matrix coord.-space this->vcCenter = mat * obb.vcCenter; this->vcA0 = mat * obb.vcA0; this->vcA1 = mat * obb.vcA1; this->vcA2 = mat * obb.vcA2; // set translation this->vcCenter += vcT; // copy axis length fA0 = obb.fA0; fA1 = obb.fA1; fA2 = obb.fA2; } //-------------------------------------------------------------------- // Name: ObbProj() // Desc: helperfunction //-------------------------------------------------------------------- void YObb::ObbProj(const YObb &Obb, const YVector &vcV, float *pfMin, float *pfMax) { float fDP = vcV * Obb.vcCenter; float fR = Obb.fA0 * _fabs(vcV * Obb.vcA0) + Obb.fA0 * _fabs(vcV * Obb.vcA1) + Obb.fA1 * _fabs(vcV * Obb.vcA2); *pfMin = fDP - fR; *pfMax = fDP + fR; } //-------------------------------------------------------------------- // Name: TriProj() // Desc: helperfunction //-------------------------------------------------------------------- void YObb::TriProj(const YVector &v0, const YVector &v1, const YVector &v2, const YVector &vcV, float *pfMin, float *pfMax) { *pfMin = vcV * v0; *pfMax = *pfMin; float fDP = vcV * v1; if (fDP < *pfMin) *pfMin = fDP; else if (fDP > *pfMax) *pfMax = fDP; fDP = vcV * v2; if (fDP < *pfMin) *pfMin = fDP; else if (fDP > *pfMax) *pfMax = fDP; } //-------------------------------------------------------------------- // Name: Intersects() // Desc: Intersects trianlge //-------------------------------------------------------------------- bool YObb::Intersects(const YVector &v0, const YVector &v1, const YVector &v2) { float fMin0, fMax0, fMin1, fMax1; float fD_C; YVector vcV, vcTriEdge[3], vcA[3]; // just for looping vcA[0] = this->vcA0; vcA[1] = this->vcA1; vcA[2] = this->vcA2; // direction of tri-normals vcTriEdge[0] = v1 - v0; vcTriEdge[1] = v2 - v0; vcV.Cross(vcTriEdge[0], vcTriEdge[1]); fMin0 = vcV * v0; fMax0 = fMin0; this->ObbProj((*this), vcV, &fMin1, &fMax1); if ( fMax1 < fMin0 || fMax0 < fMin1 ) return true; // direction of obb planes // ======================= // axis 1: vcV = this->vcA0; this->TriProj(v0, v1, v2, vcV, &fMin0, &fMax0); fD_C = vcV * this->vcCenter; fMin1 = fD_C - this->fA0; fMax1 = fD_C + this->fA0; if ( fMax1 < fMin0 || fMax0 < fMin1 ) return true; // axis 2: vcV = this->vcA1; this->TriProj(v0, v1, v2, vcV, &fMin0, &fMax0); fD_C = vcV * this->vcCenter; fMin1 = fD_C - this->fA1; fMax1 = fD_C + this->fA1; if ( fMax1 < fMin0 || fMax0 < fMin1 ) return true; // axis 3: vcV = this->vcA2; this->TriProj(v0, v1, v2, vcV, &fMin0, &fMax0); fD_C = vcV * this->vcCenter; fMin1 = fD_C - this->fA2; fMax1 = fD_C + this->fA2; if ( fMax1 < fMin0 || fMax0 < fMin1 ) return true; // direction of tri-obb edge-crossproducts vcTriEdge[2] = vcTriEdge[1] - vcTriEdge[0]; for (int j=0; j<3; j++) { for (int k=0; k<3; k++) { vcV.Cross(vcTriEdge[j], vcA[k]); this->TriProj(v0, v1, v2, vcV, &fMin0, &fMax0); this->ObbProj((*this), vcV, &fMin1, &fMax1); if ( (fMax1 < fMin0) || (fMax0 < fMin1) ) return true; } } return true; } //-------------------------------------------------------------------- // Name: Intersects() // Desc: Intersects ray, slaps method //-------------------------------------------------------------------- bool YObb::Intersects(const YRay &Ray, float *t) { float e, f, t1, t2, temp; float tmin = -99999.9f, tmax = +99999.9f; YVector vcP = this->vcCenter - Ray.m_vcOrig; // 1st slap e = this->vcA0 * vcP; f = this->vcA0 * Ray.m_vcDir; if (_fabs(f) > 0.00001f) { t1 = (e + this->fA0) / f; t2 = (e - this->fA0) / f; if (t1 > t2) { temp=t1; t1=t2; t2=temp; } if (t1 > tmin) tmin = t1; if (t2 < tmax) tmax = t2; if (tmin > tmax) return false; if (tmax < 0.0f) return false; } else if ( ((-e - this->fA0) > 0.0f) || ((-e + this->fA0) < 0.0f) ) return false; // 2nd slap e = this->vcA1 * vcP; f = this->vcA1 * Ray.m_vcDir; if (_fabs(f) > 0.00001f) { t1 = (e + this->fA1) / f; t2 = (e - this->fA1) / f; if (t1 > t2) { temp=t1; t1=t2; t2=temp; } if (t1 > tmin) tmin = t1; if (t2 < tmax) tmax = t2; if (tmin > tmax) return false; if (tmax < 0.0f) return false; } else if ( ((-e - this->fA1) > 0.0f) || ((-e + this->fA1) < 0.0f) ) return false; // 3rd slap e = this->vcA2 * vcP; f = this->vcA2 * Ray.m_vcDir; if (_fabs(f) > 0.00001f) { t1 = (e + this->fA2) / f; t2 = (e - this->fA2) / f; if (t1 > t2) { temp=t1; t1=t2; t2=temp; } if (t1 > tmin) tmin = t1; if (t2 < tmax) tmax = t2; if (tmin > tmax) return false; if (tmax < 0.0f) return false; } else if ( ((-e - this->fA2) > 0.0f) || ((-e + this->fA2) < 0.0f) ) return false; if (tmin > 0.0f) { if (t) *t = tmin; return true; } if (t) *t = tmax; return true; } //-------------------------------------------------------------------- // Name: Intersects() // Desc: Intersects ray at certain length (line segment), slaps method //-------------------------------------------------------------------- bool YObb::Intersects(const YRay &Ray, float fL, float *t) { float e, f, t1, t2, temp; float tmin = -99999.9f, tmax = +99999.9f; YVector vcP = this->vcCenter - Ray.m_vcOrig; // 1st slap e = this->vcA0 * vcP; f = this->vcA0 * Ray.m_vcDir; if (_fabs(f) > 0.00001f) { t1 = (e + this->fA0) / f; t2 = (e - this->fA0) / f; if (t1 > t2) { temp=t1; t1=t2; t2=temp; } if (t1 > tmin) tmin = t1; if (t2 < tmax) tmax = t2; if (tmin > tmax) return false; if (tmax < 0.0f) return false; } else if ( ((-e - this->fA0) > 0.0f) || ((-e + this->fA0) < 0.0f) ) return false; // 2nd slap e = this->vcA1 * vcP; f = this->vcA1 * Ray.m_vcDir; if (_fabs(f) > 0.00001f) { t1 = (e + this->fA1) / f; t2 = (e - this->fA1) / f; if (t1 > t2) { temp=t1; t1=t2; t2=temp; } if (t1 > tmin) tmin = t1; if (t2 < tmax) tmax = t2; if (tmin > tmax) return false; if (tmax < 0.0f) return false; } else if ( ((-e - this->fA1) > 0.0f) || ((-e + this->fA1) < 0.0f) ) return false; // 3rd slap e = this->vcA2 * vcP; f = this->vcA2 * Ray.m_vcDir; if (_fabs(f) > 0.00001f) { t1 = (e + this->fA2) / f; t2 = (e - this->fA2) / f; if (t1 > t2) { temp=t1; t1=t2; t2=temp; } if (t1 > tmin) tmin = t1; if (t2 < tmax) tmax = t2; if (tmin > tmax) return false; if (tmax < 0.0f) return false; } else if ( ((-e - this->fA2) > 0.0f) || ((-e + this->fA2) < 0.0f) ) return false; if ( (tmin > 0.0f) && (tmin <= fL) ) { if (t) *t = tmin; return true; } // intersection on line but not on segment if (tmax > fL) return false; if (t) *t = tmax; return true; } //-------------------------------------------------------------------- // Name: Intersects() // Desc: Intersects another obb //-------------------------------------------------------------------- bool YObb::Intersects(const YObb &Obb) { float T[3]; // difference vector between both obb YVector vcD = Obb.vcCenter - this->vcCenter; float matM[3][3]; // B's axis in relation to A float ra, // radius A rb, // radius B t; // absolute values from T[] // Obb A's axis as separation axis? // ================================ // first axis vcA0 matM[0][0] = this->vcA0 * Obb.vcA0; matM[0][1] = this->vcA0 * Obb.vcA1; matM[0][2] = this->vcA0 * Obb.vcA2; ra = this->fA0; rb = Obb.fA0 * _fabs(matM[0][0]) + Obb.fA1 * _fabs(matM[0][1]) + Obb.fA2 * _fabs(matM[0][2]); T[0] = vcD * this->vcA0; t = _fabs(T[0]); if(t > (ra + rb) ) return false; // second axis vcA1 matM[1][0] = this->vcA1 * Obb.vcA0; matM[1][1] = this->vcA1 * Obb.vcA1; matM[1][2] = this->vcA1 * Obb.vcA2; ra = this->fA1; rb = Obb.fA0 * _fabs(matM[1][0]) + Obb.fA1 * _fabs(matM[1][1]) + Obb.fA2 * _fabs(matM[1][2]); T[1] = vcD * this->vcA1; t = _fabs(T[1]); if(t > (ra + rb) ) return false; // third axis vcA2 matM[2][0] = this->vcA2 * Obb.vcA0; matM[2][1] = this->vcA2 * Obb.vcA1; matM[2][2] = this->vcA2 * Obb.vcA2; ra = this->fA2; rb = Obb.fA0 * _fabs(matM[2][0]) + Obb.fA1 * _fabs(matM[2][1]) + Obb.fA2 * _fabs(matM[2][2]); T[2] = vcD * this->vcA2; t = _fabs(T[2]); if(t > (ra + rb) ) return false; // Obb B's axis as separation axis? // ================================ // first axis vcA0 ra = this->fA0 * _fabs(matM[0][0]) + this->fA1 * _fabs(matM[1][0]) + this->fA2 * _fabs(matM[2][0]); rb = Obb.fA0; t = _fabs( T[0]*matM[0][0] + T[1]*matM[1][0] + T[2]*matM[2][0] ); if(t > (ra + rb) ) return false; // second axis vcA1 ra = this->fA0 * _fabs(matM[0][1]) + this->fA1 * _fabs(matM[1][1]) + this->fA2 * _fabs(matM[2][1]); rb = Obb.fA1; t = _fabs( T[0]*matM[0][1] + T[1]*matM[1][1] + T[2]*matM[2][1] ); if(t > (ra + rb) ) return false; // third axis vcA2 ra = this->fA0 * _fabs(matM[0][2]) + this->fA1 * _fabs(matM[1][2]) + this->fA2 * _fabs(matM[2][2]); rb = Obb.fA2; t = _fabs( T[0]*matM[0][2] + T[1]*matM[1][2] + T[2]*matM[2][2] ); if(t > (ra + rb) ) return false; // other candidates: cross products of axis: // ========================================= // axis A0xB0 ra = this->fA1*_fabs(matM[2][0]) + this->fA2*_fabs(matM[1][0]); rb = Obb.fA1*_fabs(matM[0][2]) + Obb.fA2*_fabs(matM[0][1]); t = _fabs( T[2]*matM[1][0] - T[1]*matM[2][0] ); if( t > ra + rb ) return false; // axis A0xB1 ra = this->fA1*_fabs(matM[2][1]) + this->fA2*_fabs(matM[1][1]); rb = Obb.fA0*_fabs(matM[0][2]) + Obb.fA2*_fabs(matM[0][0]); t = _fabs( T[2]*matM[1][1] - T[1]*matM[2][1] ); if( t > ra + rb ) return false; // axis A0xB2 ra = this->fA1*_fabs(matM[2][2]) + this->fA2*_fabs(matM[1][2]); rb = Obb.fA0*_fabs(matM[0][1]) + Obb.fA1*_fabs(matM[0][0]); t = _fabs( T[2]*matM[1][2] - T[1]*matM[2][2] ); if( t > ra + rb ) return false; // axis A1xB0 ra = this->fA0*_fabs(matM[2][0]) + this->fA2*_fabs(matM[0][0]); rb = Obb.fA1*_fabs(matM[1][2]) + Obb.fA2*_fabs(matM[1][1]); t = _fabs( T[0]*matM[2][0] - T[2]*matM[0][0] ); if( t > ra + rb ) return false; // axis A1xB1 ra = this->fA0*_fabs(matM[2][1]) + this->fA2*_fabs(matM[0][1]); rb = Obb.fA0*_fabs(matM[1][2]) + Obb.fA2*_fabs(matM[1][0]); t = _fabs( T[0]*matM[2][1] - T[2]*matM[0][1] ); if( t > ra + rb ) return false; // axis A1xB2 ra = this->fA0*_fabs(matM[2][2]) + this->fA2*_fabs(matM[0][2]); rb = Obb.fA0*_fabs(matM[1][1]) + Obb.fA1*_fabs(matM[1][0]); t = _fabs( T[0]*matM[2][2] - T[2]*matM[0][2] ); if( t > ra + rb ) return false; // axis A2xB0 ra = this->fA0*_fabs(matM[1][0]) + this->fA1*_fabs(matM[0][0]); rb = Obb.fA1*_fabs(matM[2][2]) + Obb.fA2*_fabs(matM[2][1]); t = _fabs( T[1]*matM[0][0] - T[0]*matM[1][0] ); if( t > ra + rb ) return false; // axis A2xB1 ra = this->fA0*_fabs(matM[1][1]) + this->fA1*_fabs(matM[0][1]); rb = Obb.fA0 *_fabs(matM[2][2]) + Obb.fA2*_fabs(matM[2][0]); t = _fabs( T[1]*matM[0][1] - T[0]*matM[1][1] ); if( t > ra + rb ) return false; // axis A2xB2 ra = this->fA0*_fabs(matM[1][2]) + this->fA1*_fabs(matM[0][2]); rb = Obb.fA0*_fabs(matM[2][1]) + Obb.fA1*_fabs(matM[2][0]); t = _fabs( T[1]*matM[0][2] - T[0]*matM[1][2] ); if( t > ra + rb ) return false; // no separation axis found => intersection return true; } //-------------------------------------------------------------------- // Name: Cull() /* Desc: Culls OBB to n sided frustrum. Normals pointing outwards. * -> IN: ZFXPlane - array of planes building frustrum * int - number of planes in array * OUT: ZFXVISIBLE - obb totally inside frustrum * ZFXCLIPPED - obb clipped by frustrum * ZFXCULLED - obb totally outside frustrum */ //-------------------------------------------------------------------- int YObb::Cull(const YPlane *pPlanes, int nNumPlanes) { YVector vN; int nResult = YVISIBLE; float fRadius, fTest; // for all planes for (int i=0; i<nNumPlanes; i++) { // frustrum normals pointing outwards, we need inwards vN = pPlanes[i].m_vcN * -1.0f; // calculate projected box radius fRadius = _fabs(fA0 * (vN * vcA0)) + _fabs(fA1 * (vN * vcA1)) + _fabs(fA2 * (vN * vcA2)); // testvalue: (N*C - d) (#) fTest = vN * this->vcCenter - pPlanes[i].m_fD; // obb totally outside of at least one plane: (#) < -r if (fTest < -fRadius) return YCULLED; // or maybe intersecting this plane? else if (!(fTest > fRadius)) nResult = YCLIPPED; } // for // if not culled then clipped or inside return nResult; }
30.720081
82
0.4414
Yosbi
7fa0d4420a4f16abe70e04c2980e94259d3fe6c6
6,566
cpp
C++
src/PIDController.cpp
rahulsalvi/PIDController
75a8f3735dda752d57c0fba8a12556914f2e5aa8
[ "MIT" ]
null
null
null
src/PIDController.cpp
rahulsalvi/PIDController
75a8f3735dda752d57c0fba8a12556914f2e5aa8
[ "MIT" ]
null
null
null
src/PIDController.cpp
rahulsalvi/PIDController
75a8f3735dda752d57c0fba8a12556914f2e5aa8
[ "MIT" ]
null
null
null
/* The MIT License (MIT) Copyright (c) 2016 Rahul Salvi 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 "PIDController.h" inline double absoluteValue(double x) { if (x < 0) { return -x; } return x; } PIDController::PIDController() : PIDController(nullptr, 0, 0, 0, 0) {} PIDController::PIDController(Timer* timer, double p, double i, double d, double f) : _timer(timer), _p(p), _i(i), _d(d), _f(f) { reset(); _minOutput = 0; _maxOutput = 0; _minInput = 0; _minOutput = 0; _isContinuous = false; _absoluteTolerance = 0; _percentTolerance = 0; _isWithinTolerance = false; _integratorLimit = 0; _isRunning = false; } void PIDController::start() { if (_timer) { _timer->start(); } _isRunning = true; } void PIDController::reset() { _error = 0; _previousError = 0; _integral = 0; _derivative = 0; _setpoint = 0; _output = 0; if (_timer) { _timer->reset(); } } void PIDController::setTimer(Timer* timer) { _timer = timer; } void PIDController::setPIDF(double p, double i, double d, double f) { _p = p; _i = i; _d = d; _f = f; } void PIDController::setP(double p) { _p = p; } void PIDController::setI(double i) { _i = i; if (_i) { _integratorLimit /= _i; } } void PIDController::setD(double d) { _d = d; } void PIDController::setF(double f) { _f = f; } void PIDController::setOutputLimits(double min, double max) { _minOutput = min; _maxOutput = max; } void PIDController::setInputLimits(double min, double max) { _minInput = min; _maxInput = max; } void PIDController::setContinuous(bool isContinuous) { _isContinuous = isContinuous; } void PIDController::setAbsoluteTolerance(double tolerance) { _absoluteTolerance = tolerance; } void PIDController::setPercentTolerance(double tolerance) { _percentTolerance = tolerance; } void PIDController::setIntegratorLimit(double limit) { _integratorLimit = limit; if (_i) { _integratorLimit /= _i; } } Timer* PIDController::timer() const { return _timer; } double PIDController::p() const { return _p; } double PIDController::i() const { return _i; } double PIDController::d() const { return _d; } double PIDController::f() const { return _f; } double PIDController::minOutput() const { return _minOutput; } double PIDController::maxOutput() const { return _maxOutput; } double PIDController::minInput() const { return _minInput; } double PIDController::maxInput() const { return _maxInput; } bool PIDController::isContinuous() const { return _isContinuous; } bool PIDController::isWithinTolerance() const { return _isWithinTolerance; } bool PIDController::isRunning() const { return _isRunning; } double PIDController::error() const { return _error; } double PIDController::integral() const { return _integral; } double PIDController::derivative() const { return _derivative; } double PIDController::setpoint() const { return _setpoint; } double PIDController::output() const { return _output; } double PIDController::getOutput(double input, double setpoint, double dt) { if (_minInput && _maxInput) { if (input > _maxInput) { input = _maxInput; } else if (input < _minInput) { input = _minInput; } } _setpoint = setpoint; _error = _setpoint - input; if (_absoluteTolerance) { if ((input > (_setpoint - _absoluteTolerance)) && (input < (_setpoint + _absoluteTolerance))) { _isWithinTolerance = true; } else { _isWithinTolerance = false; } } else if (_percentTolerance) { double tolerance = _percentTolerance * _setpoint; if ((input > (_setpoint - tolerance)) && (input < (_setpoint + tolerance))) { _isWithinTolerance = true; } else { _isWithinTolerance = false; } } else { _isWithinTolerance = false; } if (dt) { _dt = dt; return calculateOutput(false); } return calculateOutput(true); } double PIDController::getOutput(double error, double dt) { _error = error; _setpoint = 0; _isWithinTolerance = false; if (dt) { _dt = dt; return calculateOutput(false); } return calculateOutput(true); } double PIDController::calculateOutput(bool useTimer) { if (_isContinuous) { if (absoluteValue(_error) > ((absoluteValue(_minInput) + absoluteValue(_maxInput)) / 2)) { if (_error > 0) { _error = _error - _maxInput + _minInput; } else { _error = _error + _maxInput - _minInput; } } } if (useTimer && _timer) { _dt = _timer->dt(); } _integral += _error * _dt; _derivative = ((_error - _previousError) / _dt); _previousError = _error; if (_integratorLimit && (absoluteValue(_integral) > _integratorLimit)) { if (_integral < 0) { _integral = -_integratorLimit; } else { _integral = _integratorLimit; } } _output = (_p * _error) + (_i * _integral) + (_d * _derivative) + (_f * _setpoint); if (_minOutput && _maxOutput) { if (_output > _maxOutput) { _output = _maxOutput; } else if (_output < _minOutput) { _output = _minOutput; } } return _output; }
22.719723
103
0.634328
rahulsalvi
7fa83bb617e528da05444fc8fffa76d25fafa057
2,521
hpp
C++
game_files/game_engine/game_engine.hpp
sakumo7/zpr
7b9cdbec1ff8d8179a96bb6e1e88f54ee84d138e
[ "MIT" ]
null
null
null
game_files/game_engine/game_engine.hpp
sakumo7/zpr
7b9cdbec1ff8d8179a96bb6e1e88f54ee84d138e
[ "MIT" ]
null
null
null
game_files/game_engine/game_engine.hpp
sakumo7/zpr
7b9cdbec1ff8d8179a96bb6e1e88f54ee84d138e
[ "MIT" ]
null
null
null
#ifndef GAME_ENGINE_HPP #define GAME_ENGINE_HPP #include "../typedefs.hpp" #include "../tcp/tcp.hpp" #include "../game_state/game_state.hpp" #include <string> #include <boost/regex.hpp> #include <iostream> #include <memory> #include <vector> #include <thread> #include <queue> /** * \class GameEngine * * Definicja klasy GameEngine, która jest instancją gry. * \author $Author: Michał Murawski, Marcin Brzykcy $ * * */ class GameEngine{ private: // wektor wskaźników na graczy GameState _gameState; //std::vector<player_ptr> _players; //stany gry enum state {WAIT_FOR_PLAYERS=0,WAIT_FOR_MOVE=1,COMPUTE_NEW_STATE=2,GAME_OVER=3}; //obecny stan gry state _currentState=WAIT_FOR_PLAYERS; //następny stan gry state _nxtState; public: std::string _name; //kolejka przetwarzanych danych przez instacje gry std::queue<std::string> _queue; //funkcja uruchamijąca wątek prztwarzania kolejki void run(); //funkcja zatrzymująca wątek przetwarzania kolejki void stop(); //wskaźnik na wątek przetwarzający kolejke std::thread *_thread = nullptr; //pole stanu przetwarzania kolejki bool _is_running=true; //funkcja wysyłająca komendy do graczy i serwera void sendCmd(std::string input); //funkcja uruchamijąca gre void start(); //fukcja przetwarzające dane w kolejce void processInput(std::string input); //funkcja usuwająca gracza z gry int removePlayer(const std::shared_ptr<tcp::tcp_client>& client); //funkcja dodająca gracza do gry void addPlayer( std::string name,const std::shared_ptr<tcp::tcp_client>& _client_ptr); std::vector<player_ptr> getPlayers(); /** * funkcja zwracająca stan gry * * \return liczba reperezentująca stan gry */ int state(); /** * Konstruktor klasy * * \param name Nazwa gry * \param nazwa gracza który utworzył gre * \param referencja na wskaźnik klienta tcp który utworzył gre * */ GameEngine(std::string _name,std::string _mastername,const std::shared_ptr<tcp::tcp_client>& master); /** * Destruktor klasy */ ~GameEngine(); protected: /** * Funkcja dołaczająca gracza do gry na podstawie stringa * \return odpowiedź gry */ std::string join(std::string _str); /** * Funkcja inicjalizująca gre * \return odpowiedź gry */ std::string gameInit(); /** * Funkcja obliczająca nowy stan gry */ void execute(); std::string playing(std::string _str); }; #endif //GAME_ENGINE_HPP
25.989691
105
0.689409
sakumo7
7fa9e7dbdab74bafeba3d270798ff3c6c1477ea1
6,212
cc
C++
src/pfs_core/pfs_trace.cc
qiuyuhang/PolarDB-FileSystem
a18067ef9294c2f509decd80b2b9231c9f950e21
[ "Apache-2.0" ]
35
2021-11-08T03:24:50.000Z
2022-03-24T12:39:12.000Z
src/pfs_core/pfs_trace.cc
qiuyuhang/PolarDB-FileSystem
a18067ef9294c2f509decd80b2b9231c9f950e21
[ "Apache-2.0" ]
2
2021-11-30T02:29:53.000Z
2022-03-17T06:57:53.000Z
src/pfs_core/pfs_trace.cc
qiuyuhang/PolarDB-FileSystem
a18067ef9294c2f509decd80b2b9231c9f950e21
[ "Apache-2.0" ]
18
2021-11-08T08:43:06.000Z
2022-02-28T09:38:09.000Z
/* * Copyright (c) 2017-2021, Alibaba Group Holding Limited * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <sys/stat.h> #include <sys/syscall.h> #include <sys/time.h> #include <sys/types.h> #include <unistd.h> #include <errno.h> #include <fcntl.h> #include <stdio.h> #include <string.h> #include <time.h> #include <stdlib.h> #include "pfs_admin.h" #include "pfs_impl.h" #include "pfs_trace.h" //static int tracelvl_threshold = PFS_TRACE_ERROR; #define PFS_TRACE_LEN 1024 #define PFS_TRACE_NUM 16384 /* must be power of 2 */ typedef struct pfs_tracebuf { char tb_trace[PFS_TRACE_LEN]; } pfs_tracebuf_t; static pfs_tracebuf_t pfs_trace_buf[PFS_TRACE_NUM]; static uint64_t pfs_trace_idx = 0; char pfs_trace_pbdname[PFS_MAX_PBDLEN]; bool pfs_check_ival_trace_level(void *data) { int64_t integer_val = *(int64_t*)data; if ((integer_val != PFS_TRACE_OFF) && (integer_val != PFS_TRACE_ERROR) && (integer_val != PFS_TRACE_WARN) && (integer_val != PFS_TRACE_INFO) && (integer_val != PFS_TRACE_DBG) && (integer_val != PFS_TRACE_VERB)) return false; return true; } /* print level of trace */ int64_t trace_plevel = PFS_TRACE_INFO; PFS_OPTION_REG(trace_plevel, pfs_check_ival_trace_level); /* * Create a dummy tracectl to INIT trace sector. * Otherwise, if pfs_verbtrace() isn't called, trace sector may be not created * when compiling. */ static tracectl_t dummy_tracectl = { __FILE__, "dummy", __LINE__, PFS_TRACE_DBG, false, "dummy\n", }; static tracectl_t *dummy_tracectl_ptr DATA_SET_ATTR(_tracectl) = &dummy_tracectl; static inline const char * pfs_trace_levelname(int level) { switch (level) { case PFS_TRACE_ERROR: return "ERR"; case PFS_TRACE_WARN: return "WRN"; case PFS_TRACE_INFO: return "INF"; case PFS_TRACE_DBG: return "DBG"; default: return "UNKNOWN"; } return NULL; /* unreachable */ } /* * pfs_trace_redirect * * Redirect trace to log file. Before the redirection, log is * is printed on stderr tty. After redirection, stderr points * to the log file. */ void pfs_trace_redirect(const char *pbdname, int hostid) { int fd, nprint; char logfile[128]; nprint = snprintf(logfile, sizeof(logfile), "/var/log/pfs-%s.log", pbdname); if (nprint >= (int)sizeof(logfile)) { fprintf(stderr, "log file name too long, truncated as %s\n", logfile); return; } /* * Open the log file, redirect stderr to the log file, * and finally close the log file fd. stderr now is the * only user of the log file. */ fd = open(logfile, O_CREAT | O_WRONLY | O_APPEND, 0666); if (fd < 0) { fprintf(stderr, "cant open file %s\n", logfile); return; } if (dup2(fd, 2) < 0) { fprintf(stderr, "cant dup fd %d to stderr\n", fd); close(fd); fd = -1; return; } chmod(logfile, 0666); close(fd); pfs_itrace("host %d redirect trace to %s\n", hostid, logfile); } pfs_log_func_t *pfs_log_functor; void pfs_vtrace(int level, const char *fmt, ...) { static const char mon_name[][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; struct timeval tv; struct tm tm; uint64_t ti; int len; char *buf; int errno_save = errno; va_list ap; ti = __atomic_fetch_add(&pfs_trace_idx, 1, __ATOMIC_ACQ_REL); ti = (ti & (PFS_TRACE_NUM - 1)); buf = pfs_trace_buf[ti].tb_trace; gettimeofday(&tv, NULL); localtime_r(&tv.tv_sec, &tm); len = snprintf(buf, PFS_TRACE_LEN, "[PFS_LOG] " "%.3s%3d %.2d:%.2d:%.2d.%06ld %s [%ld] ", mon_name[tm.tm_mon], tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tv.tv_usec, pfs_trace_levelname(level), (long)syscall(SYS_gettid)); if (len < PFS_TRACE_LEN) { va_start(ap, fmt); vsnprintf(buf + len, PFS_TRACE_LEN - len, fmt, ap); va_end(ap); } if (pfs_log_functor != NULL) pfs_log_functor(buf); else fputs(buf, stderr); errno = errno_save; } static bool pfs_trace_match(tracectl_t *tc, const char *file, int line) { /* * File is not wildcard and doesn't match. */ if (strcmp(file, "*") != 0 && strcmp(file, tc->tc_file) != 0) return false; /* * Line is not wildcard and doesn't match. */ if (line && line != tc->tc_line) return false; return true; } int pfs_trace_list(const char *file, int line, admin_buf_t *ab) { DATA_SET_DECL(tracectl, _tracectl); tracectl_t **tcp, *tc; int n; /* * Walk through the tracectl set to show the trace point * with corresponding line & file */ n = pfs_adminbuf_printf(ab, "function\t\tfile\t\tline\t\tlevel\n"); if (n < 0) return n; DATA_SET_FOREACH(tcp, _tracectl) { tc = *tcp; if (!pfs_trace_match(tc, file, line)) continue; n = pfs_adminbuf_printf(ab, "%-26s\t%-20s\t%-6d\t%-3d\t%c\t%s", tc->tc_func, tc->tc_file, tc->tc_line, tc->tc_level, tc->tc_enable ? 'y' : '-', tc->tc_format); if (n < 0) return n; } return 0; } int pfs_trace_set(const char *file, int line, bool enable, admin_buf_t *ab) { DATA_SET_DECL(tracectl, _tracectl); tracectl_t **tcp, *tc; int n; DATA_SET_FOREACH(tcp, _tracectl) { tc = *tcp; if (!pfs_trace_match(tc, file, line)) continue; tc->tc_enable = enable; } n = pfs_adminbuf_printf(ab, "succeeded\n"); return n < 0 ? n : 0; } int pfs_trace_handle(int sock, msg_header_t *mh, msg_trace_t *tr) { int err; admin_buf_t *ab; ab = pfs_adminbuf_create(sock, mh->mh_type, mh->mh_op + 1, 32 << 10); if (ab == NULL) { ERR_RETVAL(ENOMEM); } switch (mh->mh_op) { case TRACE_LIST_REQ: err = pfs_trace_list(tr->tr_file, tr->tr_line, ab); break; case TRACE_SET_REQ: err = pfs_trace_set(tr->tr_file, tr->tr_line, tr->tr_enable, ab); break; default: err = -1; break; } pfs_adminbuf_destroy(ab, err); return err; }
22.754579
81
0.678042
qiuyuhang
7faca1396aa5321b9fa33aea232d82d5593a73c0
1,258
cpp
C++
UVaOnlineJudge/Problem_Set_Volumes_(100...1999)/Volume4(400-499)/495/code.cpp
luiscbr92/algorithmic-challenges
bc35729e54e4284e9ade1aa61b51a1c2d72aa62c
[ "MIT" ]
3
2015-10-21T18:56:43.000Z
2017-06-06T10:44:22.000Z
UVaOnlineJudge/Problem_Set_Volumes_(100...1999)/Volume4(400-499)/495/code.cpp
luiscbr92/algorithmic-challenges
bc35729e54e4284e9ade1aa61b51a1c2d72aa62c
[ "MIT" ]
null
null
null
UVaOnlineJudge/Problem_Set_Volumes_(100...1999)/Volume4(400-499)/495/code.cpp
luiscbr92/algorithmic-challenges
bc35729e54e4284e9ade1aa61b51a1c2d72aa62c
[ "MIT" ]
null
null
null
#include <iostream> #include <string> #include <vector> using namespace std; string sum(string a, string b){ string result = ""; int carry_over = 0; int index_a = a.size() -1; int index_b = b.size() -1; int a_digit, b_digit, amount; while(index_a > -1 || index_b > -1 || carry_over != 0){ a_digit = 0; if(index_a > -1) a_digit += int(a[index_a]) - 48; b_digit = 0; if(index_b > -1) b_digit += int(b[index_b]) - 48; amount = a_digit + b_digit + carry_over; if(amount > 9){ carry_over = 1; amount -= 10; } else carry_over = 0; result = char(amount+48) + result; index_a--; index_b--; } return result; } int main(){ ios_base::sync_with_stdio (false); int input; vector<string> fibonacci; fibonacci.push_back("0"); fibonacci.push_back("1"); int fibonacci_length = 2; while(fibonacci_length < 5001){ fibonacci.push_back(sum(fibonacci.at(fibonacci_length-1), fibonacci.at(fibonacci_length-2))); fibonacci_length++; } while(cin >> input){ cout << "The Fibonacci number for " << input << " is " << fibonacci.at(input) << "\n"; } return 0; }
22.070175
101
0.558029
luiscbr92
7facbde9579211d221d0cdc34e7d6e5ffb7bad3e
657
cpp
C++
Quicksort.cpp
amitsat27/hacktoberfest2021-1
8b11a7f64cab279cda0e13f55853f260b1f24987
[ "CC0-1.0" ]
null
null
null
Quicksort.cpp
amitsat27/hacktoberfest2021-1
8b11a7f64cab279cda0e13f55853f260b1f24987
[ "CC0-1.0" ]
null
null
null
Quicksort.cpp
amitsat27/hacktoberfest2021-1
8b11a7f64cab279cda0e13f55853f260b1f24987
[ "CC0-1.0" ]
null
null
null
//QUICK SORT #include<bits/stdc++.h> using namespace std; int partition(int arr[], int l,int r){ int pivot=arr[r]; int i=l-1; for(int j=l;j<r;j++){ if(arr[j]<pivot){ i++;swap(arr[i],arr[j]); } } swap(arr[i+1],arr[r]); return i+1; } void quicksort(int arr[],int l,int r){ if(l<r){ int pi=partition(arr,l,r); quicksort(arr,l,pi-1); quicksort(arr,pi+1,r); } } int main(){ int n;cin>>n; int arr[n]; for(int i=0;i<n;i++)cin>>arr[i]; quicksort(arr,0,n-1); for(int i=0;i<n;i++)cout<<arr[i]<<endl; return 0; }
16.846154
43
0.47032
amitsat27
7fb0d676f768bd4ac6ea7241c2a910be474f5a4a
12,144
cpp
C++
subsetting_strategies.cpp
mikemag/Mastermind
d32a4bbe62600a3dc257b6b692df64f2afbc8575
[ "MIT" ]
null
null
null
subsetting_strategies.cpp
mikemag/Mastermind
d32a4bbe62600a3dc257b6b692df64f2afbc8575
[ "MIT" ]
null
null
null
subsetting_strategies.cpp
mikemag/Mastermind
d32a4bbe62600a3dc257b6b692df64f2afbc8575
[ "MIT" ]
null
null
null
// Copyright (c) Michael M. Magruder (https://github.com/mikemag) // // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree. #include "utils.hpp" using namespace std; // -------------------------------------------------------------------------------------------------------------------- // Base for all subsetting strategies template <uint8_t p, uint8_t c, bool log> Codeword<p, c> StrategySubsetting<p, c, log>::selectNextGuess() { // Add the last guess from the list of used codewords. usedCodewords = savedUsedCodewords; usedCodewords.emplace_back(this->guess.packedCodeword()); Codeword<p, c> bestGuess; size_t bestScore = 0; bool bestIsPossibleSolution = false; int allCount = 0; // For metrics only for (const auto &g : Codeword<p, c>::getAllCodewords()) { bool isPossibleSolution = false; for (const auto &ps : this->possibleSolutions) { Score r = g.score(ps); subsetSizes[r.result]++; if (r == Codeword<p, c>::winningScore) { isPossibleSolution = true; // Remember if this guess is in the set of possible solutions } } this->rootData->scoreCounterCPU += this->possibleSolutions.size(); if (this->rootData->enableSmallPSMetrics) allCount++; // Shortcut small sets. Note, we've already done this check for possible solutions. if (Strategy<p, c, log>::enableSmallPSShortcut && !isPossibleSolution && this->possibleSolutions.size() <= Strategy<p, c, log>::totalScores) { int subsetsCount = computeTotalSubsets(); if (subsetsCount == this->possibleSolutions.size()) { if (log) { cout << "Selecting fully discriminating guess: " << g << ", subsets: " << subsetsCount << endl; } fill(begin(subsetSizes), end(subsetSizes), 0); // Done implicitly in computeSubsetScore, which we're skipping ++this->rootData->smallPSInnerShortcuts; this->rootData->smallPSInnerScoresSkipped += (Codeword<p, c>::getAllCodewords().size() - allCount) * this->possibleSolutions.size(); return g; } ++this->rootData->smallPSInnerWasted; } size_t score = computeSubsetScore(); if (score > bestScore || (!bestIsPossibleSolution && isPossibleSolution && score == bestScore)) { if (find(usedCodewords.cbegin(), usedCodewords.cend(), g.packedCodeword()) != usedCodewords.end()) { continue; // Ignore codewords we've already used } bestScore = score; bestGuess = g; bestIsPossibleSolution = isPossibleSolution; } } if (log) { cout << "Selecting best guess: " << bestGuess << "\tscore: " << bestScore << endl; } return bestGuess; } template <uint8_t p, uint8_t c, bool log> int StrategySubsetting<p, c, log>::computeTotalSubsets() { int totalSubsets = 0; for (auto s : subsetSizes) { if (s > 0) { totalSubsets++; } } return totalSubsets; } // -------------------------------------------------------------------------------------------------------------------- // Base for all subsetting GPU strategies template <uint8_t p, uint8_t c, bool log> Codeword<p, c> StrategySubsettingGPU<p, c, log>::selectNextGuess() { // Cut off "small" work and just do it on the CPU. if (mode == CPU || (mode == Both && Codeword<p, c>::getAllCodewords().size() * this->possibleSolutions.size() < 4 * 1024)) { return StrategySubsetting<p, c, log>::selectNextGuess(); } // Add the last guess from the list of used codewords. this->usedCodewords = this->savedUsedCodewords; this->usedCodewords.emplace_back(this->guess.packedCodeword()); // Pull out the codewords and colors into individual arrays // TODO: if this were separated into these two arrays throughout the Strategy then we could use a target-optimized // memcpy to blit them into the buffers, which would be much faster. uint32_t *psw = gpuRootData->gpuInterface->getPossibleSolutionssBuffer(); unsigned __int128 *psc = gpuRootData->gpuInterface->getPossibleSolutionsColorsBuffer(); for (int i = 0; i < this->possibleSolutions.size(); i++) { psw[i] = this->possibleSolutions[i].packedCodeword(); psc[i] = this->possibleSolutions[i].packedColors8(); } gpuRootData->gpuInterface->setPossibleSolutionsCount((uint32_t)this->possibleSolutions.size()); gpuRootData->gpuInterface->sendComputeCommand(); gpuRootData->kernelsExecuted++; this->rootData->scoreCounterGPU += Codeword<p, c>::getAllCodewords().size() * this->possibleSolutions.size(); uint32_t *maxScoreCounts = gpuRootData->gpuInterface->getScores(); bool *remainingIsPossibleSolution = gpuRootData->gpuInterface->getRemainingIsPossibleSolution(); if (Strategy<p, c, log>::enableSmallPSShortcutGPU) { // Shortcut small sets with fully discriminating codewords. Certain versions of the GPU kernels look for these and // pass them back in a list of useful codewords per SIMD group. Running through the list in-order and taking the // first one gives the first lexically ordered option. uint32_t discriminatingCount = 0; uint32_t *smallOptsOut = gpuRootData->gpuInterface->getFullyDiscriminatingCodewords(discriminatingCount); for (int i = 0; i < discriminatingCount; i++) { if (smallOptsOut[i] > 0) { Codeword<p, c> g = Codeword<p, c>::getAllCodewords()[smallOptsOut[i]]; if (log) { cout << "Selecting fully discriminating guess from GPU: " << g << ", subsets: " << this->possibleSolutions.size() << ", isPossibleSolution: " << remainingIsPossibleSolution[smallOptsOut[i]] << ", small opts index: " << i << endl; } return g; } } } Codeword<p, c> bestGuess; size_t bestScore = 0; bool bestIsPossibleSolution = false; for (int i = 0; i < Codeword<p, c>::getAllCodewords().size(); i++) { size_t score = maxScoreCounts[i]; if (score > bestScore || (!bestIsPossibleSolution && remainingIsPossibleSolution[i] && score == bestScore)) { auto &codeword = Codeword<p, c>::getAllCodewords()[i]; if (find(this->usedCodewords.cbegin(), this->usedCodewords.cend(), codeword.packedCodeword()) != this->usedCodewords.end()) { continue; // Ignore codewords we've already used } bestScore = score; bestGuess = codeword; bestIsPossibleSolution = remainingIsPossibleSolution[i]; } } if (log) { cout << "Selecting best guess: " << bestGuess << "\tscore: " << bestScore << " (GPU)" << endl; } return bestGuess; } // This moves all the codewords into the correct device-private buffers just once, since it's a) read only and b) // quite large. template <uint8_t p, uint8_t c, bool l> void StrategySubsettingGPU<p, c, l>::copyAllCodewordsToGPU() { if (!gpuRootData->gpuInterface->gpuAvailable()) { return; } // Pull out the codewords and color into individual arrays uint32_t *acw = gpuRootData->gpuInterface->getAllCodewordsBuffer(); unsigned __int128 *acc = gpuRootData->gpuInterface->getAllCodewordsColorsBuffer(); for (int i = 0; i < Codeword<p, c>::getAllCodewords().size(); i++) { acw[i] = Codeword<p, c>::getAllCodewords()[i].packedCodeword(); acc[i] = Codeword<p, c>::getAllCodewords()[i].packedColors8(); } gpuRootData->gpuInterface->setAllCodewordsCount((uint32_t)Codeword<p, c>::getAllCodewords().size()); // This shoves both buffers over into GPU memory just once, where they remain constant after that. No need to touch // them again. gpuRootData->gpuInterface->syncAllCodewords((uint32_t)Codeword<p, c>::getAllCodewords().size()); } template <uint8_t p, uint8_t c, bool l> void StrategySubsettingGPU<p, c, l>::printStats(chrono::duration<float, milli> elapsedMS) { StrategySubsetting<p, c, l>::printStats(elapsedMS); if (mode != CPU && gpuRootData->gpuInterface->gpuAvailable()) { cout << "GPU kernels executed: " << commaString(gpuRootData->kernelsExecuted) << " FPS: " << commaString((float)gpuRootData->kernelsExecuted / (elapsedMS.count() / 1000.0)) << endl; } } template <uint8_t p, uint8_t c, bool l> void StrategySubsettingGPU<p, c, l>::recordStats(StatsRecorder &sr, std::chrono::duration<float, std::milli> elapsedMS) { StrategySubsetting<p, c, l>::recordStats(sr, elapsedMS); sr.add("GPU Mode", GPUModeNames[mode]); sr.add("GPU Kernels", gpuRootData->kernelsExecuted); sr.add("GPU FPS", (float)gpuRootData->kernelsExecuted / (elapsedMS.count() / 1000.0)); if (gpuRootData->gpuInterface && gpuRootData->gpuInterface->gpuAvailable()) { sr.add("GPU Name", gpuRootData->gpuInterface->getGPUName()); } } StrategySubsettingGPURootData::~StrategySubsettingGPURootData() { delete gpuInterface; gpuInterface = nullptr; } // -------------------------------------------------------------------------------------------------------------------- // Knuth template <uint8_t p, uint8_t c, bool l> size_t StrategyKnuth<p, c, l>::computeSubsetScore() { int largestSubsetSize = 0; // Maximum number of codewords that could be retained by using this guess for (auto &s : this->subsetSizes) { if (s > largestSubsetSize) { largestSubsetSize = s; } s = 0; } // Invert largestSubsetSize, and return the minimum number of codewords that could be eliminated by using this guess return this->possibleSolutions.size() - largestSubsetSize; } template <uint8_t p, uint8_t c, bool l> shared_ptr<Strategy<p, c, l>> StrategyKnuth<p, c, l>::createNewMove(Score r, Codeword<p, c> nextGuess) { auto next = make_shared<StrategyKnuth<p, c, l>>(*this, nextGuess, this->possibleSolutions, this->usedCodewords); next->mode = this->mode; return next; } // -------------------------------------------------------------------------------------------------------------------- // Most Parts template <uint8_t p, uint8_t c, bool l> size_t StrategyMostParts<p, c, l>::computeSubsetScore() { int totalUsedSubsets = 0; for (auto &s : this->subsetSizes) { if (s > 0) { totalUsedSubsets++; } s = 0; } return totalUsedSubsets; } template <uint8_t p, uint8_t c, bool l> shared_ptr<Strategy<p, c, l>> StrategyMostParts<p, c, l>::createNewMove(Score r, Codeword<p, c> nextGuess) { auto next = make_shared<StrategyMostParts<p, c, l>>(*this, nextGuess, this->possibleSolutions, this->usedCodewords); next->mode = this->mode; return next; } // -------------------------------------------------------------------------------------------------------------------- // Expected Size template <uint8_t p, uint8_t c, bool l> size_t StrategyExpectedSize<p, c, l>::computeSubsetScore() { double expectedSize = 0; for (auto &s : this->subsetSizes) { if (s > 0) { expectedSize += ((double)s * (double)s) / (double)this->possibleSolutions.size(); } s = 0; } return -round(expectedSize * 10'000'000'000'000'000.0); // 16 digits of precision } template <uint8_t p, uint8_t c, bool l> shared_ptr<Strategy<p, c, l>> StrategyExpectedSize<p, c, l>::createNewMove(Score r, Codeword<p, c> nextGuess) { auto next = make_shared<StrategyExpectedSize<p, c, l>>(*this, nextGuess, this->possibleSolutions, this->usedCodewords); next->mode = this->mode; return next; } // -------------------------------------------------------------------------------------------------------------------- // Entropy template <uint8_t p, uint8_t c, bool l> size_t StrategyEntropy<p, c, l>::computeSubsetScore() { double entropySum = 0.0; for (auto &s : this->subsetSizes) { if (s > 0) { double pi = (double)s / this->possibleSolutions.size(); entropySum -= pi * log(pi); } s = 0; } return round(entropySum * 10'000'000'000'000'000.0); // 16 digits of precision } template <uint8_t p, uint8_t c, bool l> shared_ptr<Strategy<p, c, l>> StrategyEntropy<p, c, l>::createNewMove(Score r, Codeword<p, c> nextGuess) { auto next = make_shared<StrategyEntropy<p, c, l>>(*this, nextGuess, this->possibleSolutions, this->usedCodewords); next->mode = this->mode; return next; }
40.888889
119
0.637846
mikemag
7fb6379cb36d3266964954e61cbe62c202000f8b
3,889
hpp
C++
sol/state.hpp
a1ien/sol2
358c34e5e978524d7c0dbf3f69987f57dfb30da6
[ "MIT" ]
null
null
null
sol/state.hpp
a1ien/sol2
358c34e5e978524d7c0dbf3f69987f57dfb30da6
[ "MIT" ]
null
null
null
sol/state.hpp
a1ien/sol2
358c34e5e978524d7c0dbf3f69987f57dfb30da6
[ "MIT" ]
null
null
null
// sol2 // The MIT License (MIT) // Copyright (c) 2013-2017 Rapptz, ThePhD 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. #ifndef SOL_STATE_HPP #define SOL_STATE_HPP #include "state_view.hpp" #include "thread.hpp" namespace sol { namespace detail { inline int default_at_panic(lua_State* L) { #ifdef SOL_NO_EXCEPTIONS (void)L; return -1; #else size_t messagesize; const char* message = lua_tolstring(L, -1, &messagesize); if (message) { std::string err(message, messagesize); lua_settop(L, 0); throw error(err); } lua_settop(L, 0); throw error(std::string("An unexpected error occurred and forced the lua state to call atpanic")); #endif } inline int default_traceback_error_handler(lua_State* L) { using namespace sol; std::string msg = "An unknown error has triggered the default error handler"; optional<string_view> maybetopmsg = stack::check_get<string_view>(L, 1); if (maybetopmsg) { const string_view& topmsg = maybetopmsg.value(); msg.assign(topmsg.data(), topmsg.size()); } luaL_traceback(L, L, msg.c_str(), 1); optional<string_view> maybetraceback = stack::check_get<string_view>(L, -1); if (maybetraceback) { const string_view& traceback = maybetraceback.value(); msg.assign(traceback.data(), traceback.size()); } return stack::push(L, msg); } } // namespace detail class state : private std::unique_ptr<lua_State, detail::state_deleter>, public state_view { private: typedef std::unique_ptr<lua_State, detail::state_deleter> unique_base; public: state(lua_CFunction panic = detail::default_at_panic) : unique_base(luaL_newstate()), state_view(unique_base::get()) { set_panic(panic); lua_CFunction f = c_call<decltype(&detail::default_traceback_error_handler), &detail::default_traceback_error_handler>; protected_function::set_default_handler(object(lua_state(), in_place, f)); stack::register_main_thread(unique_base::get()); stack::luajit_exception_handler(unique_base::get()); } state(lua_CFunction panic, lua_Alloc alfunc, void* alpointer = nullptr) : unique_base(lua_newstate(alfunc, alpointer)), state_view(unique_base::get()) { set_panic(panic); lua_CFunction f = c_call<decltype(&detail::default_traceback_error_handler), &detail::default_traceback_error_handler>; protected_function::set_default_handler(object(lua_state(), in_place, f)); stack::register_main_thread(unique_base::get()); stack::luajit_exception_handler(unique_base::get()); } state(const state&) = delete; state(state&&) = default; state& operator=(const state&) = delete; state& operator=(state&& that) { state_view::operator=(std::move(that)); unique_base::operator=(std::move(that)); return *this; } using state_view::get; ~state() { } }; } // namespace sol #endif // SOL_STATE_HPP
36.009259
122
0.732322
a1ien
7fbadb2439d8fa21192433febe174d13f810249a
7,562
cpp
C++
RenderDrivers/GL/src/GLMaterial.cpp
katoun/kg_engine
fdcc6ec01b191d07cedf7a8d6c274166e25401a8
[ "Unlicense" ]
2
2015-04-21T05:36:12.000Z
2017-04-16T19:31:26.000Z
RenderDrivers/GL/src/GLMaterial.cpp
katoun/kg_engine
fdcc6ec01b191d07cedf7a8d6c274166e25401a8
[ "Unlicense" ]
null
null
null
RenderDrivers/GL/src/GLMaterial.cpp
katoun/kg_engine
fdcc6ec01b191d07cedf7a8d6c274166e25401a8
[ "Unlicense" ]
null
null
null
/* ----------------------------------------------------------------------------- KG game engine (http://katoun.github.com/kg_engine) is made available under the MIT License. Copyright (c) 2006-2013 Catalin Alexandru Nastase 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 <GLMaterial.h> #include <GLShader.h> #include <render/Shader.h> #include <resource/ResourceEvent.h> #define PARAMETER_NAME_BUFFERSIZE 255 namespace render { GLShaderParameter::GLShaderParameter(): ShaderParameter() { ParameterID = 0; } GLShaderVertexParameter::GLShaderVertexParameter(): ShaderVertexParameter() { ParameterID = 0; } GLMaterial::GLMaterial(const std::string& name, resource::Serializer* serializer): Material(name, serializer) { mGLHandle = 0; } GLMaterial::~GLMaterial() {} void GLMaterial::resourceLoaded(const resource::ResourceEvent& evt) { if (evt.source != nullptr) { if (evt.source == mVertexShader) { GLShader* pGLShader = static_cast<GLShader*>(mVertexShader); if (pGLShader != nullptr) { glAttachShader(mGLHandle, pGLShader->getGLHandle()); } } if (evt.source == mFragmentShader) { GLShader* pGLShader = static_cast<GLShader*>(mFragmentShader); if (pGLShader != nullptr) { glAttachShader(mGLHandle, pGLShader->getGLHandle()); } } if (evt.source == mGeometryShader) { GLShader* pGLShader = static_cast<GLShader*>(mGeometryShader); if (pGLShader != nullptr) { glAttachShader(mGLHandle, pGLShader->getGLHandle()); } } if (((mVertexShader == nullptr) || (mVertexShader != nullptr && mVertexShader->getState() == resource::RESOURCE_STATE_LOADED)) && ((mFragmentShader == nullptr) || (mFragmentShader != nullptr && mFragmentShader->getState() == resource::RESOURCE_STATE_LOADED)) && ((mGeometryShader == nullptr) || (mGeometryShader != nullptr && mGeometryShader->getState() == resource::RESOURCE_STATE_LOADED))) { GLint linked; glLinkProgram(mGLHandle); glGetProgramiv(mGLHandle, GL_LINK_STATUS, &linked); if (linked == 1) { char uniformName[PARAMETER_NAME_BUFFERSIZE]; GLenum type; GLint size; GLint count; glGetProgramiv(mGLHandle, GL_ACTIVE_UNIFORMS, &count); for (GLint idx=0; idx<count; idx++) { glGetActiveUniform(mGLHandle, idx, PARAMETER_NAME_BUFFERSIZE, NULL, &size, &type, uniformName); if (type != GL_SAMPLER_1D && type != GL_SAMPLER_2D && type != GL_SAMPLER_3D) continue; ShaderParameterType paramType = SHADER_PARAMETER_TYPE_UNKNOWN; switch (type) { case GL_SAMPLER_1D: paramType = SHADER_PARAMETER_TYPE_SAMPLER1D; break; case GL_SAMPLER_2D: paramType = SHADER_PARAMETER_TYPE_SAMPLER2D; break; case GL_SAMPLER_3D: paramType = SHADER_PARAMETER_TYPE_SAMPLER3D; break; } addTextureParameter(std::string(uniformName), paramType); } ////////////////////////////////// for (unsigned int i = 0; i < mVertexParameters.size(); i++) { GLShaderVertexParameter* pGLShaderVertexParameter = static_cast<GLShaderVertexParameter*>(mVertexParameters[i]); if (pGLShaderVertexParameter == nullptr) continue; pGLShaderVertexParameter->ParameterID = glGetAttribLocation(mGLHandle, pGLShaderVertexParameter->mName.c_str()); } hashmap<std::string, ShaderParameter*>::iterator pi; for (pi = mParameters.begin(); pi != mParameters.end(); ++pi) { GLShaderParameter* pGLShaderParameter = static_cast<GLShaderParameter*>(pi->second); if (pGLShaderParameter == nullptr) continue; pGLShaderParameter->ParameterID = glGetUniformLocation(mGLHandle, pi->first.c_str()); } ////////////////////////////////// } } } } void GLMaterial::resourceUnloaded(const resource::ResourceEvent& evt) {} GLhandleARB GLMaterial::getGLHandle() const { return mGLHandle; } bool GLMaterial::loadImpl() { if (!Material::loadImpl()) return false; mGLHandle = glCreateProgram(); return true; } void GLMaterial::unloadImpl() { glDeleteProgram(mGLHandle); } ShaderVertexParameter* GLMaterial::createVertexParameterImpl() { return new GLShaderVertexParameter(); } ShaderParameter* GLMaterial::createParameterImpl() { return new GLShaderParameter(); } void GLMaterial::setParameterImpl(ShaderParameter* parameter, const Color& col) { GLShaderParameter* glParam = static_cast<GLShaderParameter*>(parameter); if (glParam != nullptr) { glUniform4f(glParam->ParameterID, col.r, col.g, col.b, col.a); } } void GLMaterial::setParameterImpl(ShaderParameter* parameter, const core::vector2d& vec) { GLShaderParameter* glParam = static_cast<GLShaderParameter*>(parameter); if (glParam != nullptr) { glUniform2f(glParam->ParameterID, vec.x, vec.y); } } void GLMaterial::setParameterImpl(ShaderParameter* parameter, const core::vector3d& vec) { GLShaderParameter* glParam = static_cast<GLShaderParameter*>(parameter); if (glParam != nullptr) { glUniform3f(glParam->ParameterID, vec.x, vec.y, vec.z); } } void GLMaterial::setParameterImpl(ShaderParameter* parameter, const core::vector4d& vec) { GLShaderParameter* glParam = static_cast<GLShaderParameter*>(parameter); if (glParam != nullptr) { glUniform4f(glParam->ParameterID, vec.x, vec.y, vec.z, vec.w); } } void GLMaterial::setParameterImpl(ShaderParameter* parameter, const core::matrix4& m) { GLShaderParameter* glParam = static_cast<GLShaderParameter*>(parameter); if (glParam != nullptr) { glUniformMatrix4fv(glParam->ParameterID, 1, GL_TRUE/*GL_FALSE*/, m.get()); } } GLenum GLMaterial::getGLType(ShaderParameterType type) { switch(type) { case SHADER_PARAMETER_TYPE_FLOAT: return GL_FLOAT; case SHADER_PARAMETER_TYPE_FLOAT2: return GL_FLOAT_VEC2; case SHADER_PARAMETER_TYPE_FLOAT3: return GL_FLOAT_VEC3; case SHADER_PARAMETER_TYPE_FLOAT4: return GL_FLOAT_VEC4; case SHADER_PARAMETER_TYPE_INT: return GL_INT; case SHADER_PARAMETER_TYPE_INT2: return GL_INT_VEC2; case SHADER_PARAMETER_TYPE_INT3: return GL_INT_VEC3; case SHADER_PARAMETER_TYPE_INT4: return GL_INT_VEC4; case SHADER_PARAMETER_TYPE_MATRIX2: return GL_FLOAT_MAT2; case SHADER_PARAMETER_TYPE_MATRIX3: return GL_FLOAT_MAT3; case SHADER_PARAMETER_TYPE_MATRIX4: return GL_FLOAT_MAT4; case SHADER_PARAMETER_TYPE_SAMPLER1D: return GL_SAMPLER_1D; case SHADER_PARAMETER_TYPE_SAMPLER2D: return GL_SAMPLER_2D; case SHADER_PARAMETER_TYPE_SAMPLER3D: return GL_SAMPLER_3D; default: return 0; } } } //namespace render
28.535849
134
0.720709
katoun
7fc764fc3925bb75b0599800665eb75bbb34afe0
3,374
cpp
C++
Source/Driver/API/SQLSetEnvAttr.cpp
yichenghuang/bigobject-odbc
c6d947ea3d18d79684adfbac1c492282a075d48d
[ "MIT" ]
null
null
null
Source/Driver/API/SQLSetEnvAttr.cpp
yichenghuang/bigobject-odbc
c6d947ea3d18d79684adfbac1c492282a075d48d
[ "MIT" ]
null
null
null
Source/Driver/API/SQLSetEnvAttr.cpp
yichenghuang/bigobject-odbc
c6d947ea3d18d79684adfbac1c492282a075d48d
[ "MIT" ]
null
null
null
/* * ---------------------------------------------------------------------------- * Copyright (c) 2014-2015 BigObject Inc. * All Rights Reserved. * * Use of, copying, modifications to, and distribution of this software * and its documentation without BigObject's written permission can * result in the violation of U.S., Taiwan and China Copyright and Patent laws. * Violators will be prosecuted to the highest extent of the applicable laws. * * BIGOBJECT MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. * ---------------------------------------------------------------------------- */ #include "Driver.hpp" /* https://msdn.microsoft.com/en-us/library/ms709285%28v=vs.85%29.aspx Example calls: CLR (Demo/CSharp/Shell.exe): SQLSetEnvAttr(0x007c6298, 200, 0x00000003, -6) SQL_SUCCESS SQLSetEnvAttr(0x007c6298, 201, 0x00000002, -6) SQL_SUCCESS */ SQLRETURN SQL_API SQLSetEnvAttr( SQLHENV EnvironmentHandle, SQLINTEGER Attribute, SQLPOINTER Value, SQLINTEGER StringLength) { HDRVENV hEnv = (HDRVENV)EnvironmentHandle; SQLINTEGER val; LOG_DEBUG_F_FUNC( TEXT("%s: EnvironmentHandle = 0x%08lX, Attribute = %d, ") TEXT("Value = 0x%08lX, StringLength = %d"), LOG_FUNCTION_NAME, (long)EnvironmentHandle, Attribute, (long)Value, StringLength); /* SANITY CHECKS */ ODBCAPIHelper helper(hEnv, SQL_HANDLE_ENV); if(!helper.IsValid()) return SQL_INVALID_HANDLE; helper.Lock(); API_HOOK_ENTRY(SQLSetEnvAttr, EnvironmentHandle, Attribute, Value, StringLength); /* These cases permit null env handles */ /* We may do something with these later */ if(!hEnv && (Attribute == SQL_ATTR_CONNECTION_POOLING || Attribute == SQL_ATTR_CP_MATCH)) { goto __SQLSetEnvAttr_End; } switch(Attribute) { case SQL_ATTR_CONNECTION_POOLING: LOG_DEBUG_F_FUNC(TEXT("Setting SQL_ATTR_CONNECTION_POOLING: Value=%u"), (SQLUINTEGER)((std::size_t)Value)); hEnv->hEnvExtras->attrConnPooling = (SQLINTEGER)((std::size_t)Value); break; case SQL_ATTR_CP_MATCH: LOG_DEBUG_F_FUNC(TEXT("Setting SQL_ATTR_CP_MATCH: Value=%u"), (SQLUINTEGER)((std::size_t)Value)); hEnv->hEnvExtras->attrCPMatch = (SQLINTEGER)((std::size_t)Value); break; case SQL_ATTR_ODBC_VERSION: LOG_DEBUG_F_FUNC(TEXT("Setting SQL_ATTR_ODBC_VERSION: Value=%d"), (SQLUINTEGER)((std::size_t)Value)); val = (SQLINTEGER)((std::size_t)Value); if(val != SQL_OV_ODBC2 && val != SQL_OV_ODBC3) { #if (ODBCVER >= 0x0380) if(val != SQL_OV_ODBC3_80) #endif LOG_WARN_F_FUNC(TEXT("Unrecognized ODBC version=%d"), val); } hEnv->hEnvExtras->attrODBCVersion = (SQLINTEGER)((std::size_t)Value); break; case SQL_ATTR_OUTPUT_NTS: LOG_DEBUG_F_FUNC(TEXT("Setting SQL_ATTR_OUTPUT_NTS: Value=%d"), (SQLUINTEGER)((std::size_t)Value)); hEnv->hEnvExtras->attrOutputNTS = (SQLINTEGER)((std::size_t)Value); break; default: LOG_ERROR_F_FUNC( TEXT("Setting Invalid Environment Attribute=%d"), Attribute); API_HOOK_RETURN(SQL_ERROR); } __SQLSetEnvAttr_End: LOG_DEBUG_F_FUNC(TEXT("%s: SQL_SUCCESS"), LOG_FUNCTION_NAME); API_HOOK_RETURN(SQL_SUCCESS); }
30.125
79
0.681387
yichenghuang
7fca7b67177c2caceae05b66056875ec0885b75e
2,148
hxx
C++
Legolas/Algorithm/ATLASDenseMatrixVectorProduct.hxx
LaurentPlagne/Legolas
fdf533528baf7ab5fcb1db15d95d2387b3e3723c
[ "MIT" ]
null
null
null
Legolas/Algorithm/ATLASDenseMatrixVectorProduct.hxx
LaurentPlagne/Legolas
fdf533528baf7ab5fcb1db15d95d2387b3e3723c
[ "MIT" ]
null
null
null
Legolas/Algorithm/ATLASDenseMatrixVectorProduct.hxx
LaurentPlagne/Legolas
fdf533528baf7ab5fcb1db15d95d2387b3e3723c
[ "MIT" ]
1
2021-02-11T14:43:25.000Z
2021-02-11T14:43:25.000Z
/** * project DESCARTES * * @file ATLASDenseMatrixVectorProduct.hxx * * @author Laurent PLAGNE * @date june 2004 - january 2005 * * @par Modifications * - author date object * * (c) Copyright EDF R&D - CEA 2001-2005 */ #ifndef __LEGOLAS_ATLASDENSEMATRIXVECTORPRODUCT_HXX__ #define __LEGOLAS_ATLASDENSEMATRIXVECTORPRODUCT_HXX__ #include <vector> #include "Legolas/Algorithm/SparseMatrixVectorProduct.hxx" #ifdef GLASS_USE_ATLAS namespace Legolas{ #include "UTILITES.hxx" #include "Legolas/Algorithm/CBlasGemvTraits.hxx" class ATLASDenseMatrixVectorProduct{ public: template <class ASSIGN_MODE> class Engine{ public: template <class MATRIX,class VECTOR, class VECTOR_INOUT> static inline void apply(const MATRIX & A , const VECTOR & X , VECTOR_INOUT & Y) { int N=X.size(); typedef typename MATRIX::RealType RealType; const RealType * AData = A.getDataReference().matrix().getPointer(); const RealType * XData = X.getDataReference().getPointer(); RealType * YData = Y.getDataReference().getPointer(); RealType a=ASSIGN_MODE::alpha(); RealType b=ASSIGN_MODE::beta(); gemvTraits<RealType>::apply(CblasRowMajor,CblasNoTrans,N,N,a,AData,N,XData,1,b,YData,1); } }; class Transpose{ public: template <class ASSIGN_MODE> class Engine{ public: template <class MATRIX,class VECTOR, class VECTOR_INOUT> static inline void apply(const MATRIX & A , const VECTOR & X , VECTOR_INOUT & Y) { int N=X.size(); typedef typename MATRIX::RealType RealType; const RealType * AData = A.getDataReference().matrix().getPointer(); const RealType * XData = X.getDataReference().getPointer(); RealType * YData = Y.getDataReference().getPointer(); RealType a=ASSIGN_MODE::alpha(); RealType b=ASSIGN_MODE::beta(); gemvTraits<RealType>::apply(CblasRowMajor,CblasTrans,N,N,a,AData,N,XData,1,b,YData,1); } }; }; }; } #else namespace Legolas{ typedef SparseMatrixVectorProduct ATLASDenseMatrixVectorProduct; } #endif // GLASS_USE_ATLAS #endif
20.653846
89
0.684823
LaurentPlagne
7fcc2a0db0e38216a3a5ccef9bf3ea085aa562e7
620
cpp
C++
ACM-ICPC/16288.cpp
KimBoWoon/ACM-ICPC
146c36999488af9234d73f7b4b0c10d78486604f
[ "MIT" ]
null
null
null
ACM-ICPC/16288.cpp
KimBoWoon/ACM-ICPC
146c36999488af9234d73f7b4b0c10d78486604f
[ "MIT" ]
null
null
null
ACM-ICPC/16288.cpp
KimBoWoon/ACM-ICPC
146c36999488af9234d73f7b4b0c10d78486604f
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; int person[101]; stack<int> s[101]; int main() { int n, k; scanf("%d %d", &n, &k); for(int i = 0; i < n; i++) { scanf("%d", &person[i]); } reverse(person, person + n); for(int i = 0; i < 100; i++) { s[i].push(101); } for(int i = 0; i < n; i++) { int idx = 0, j; for(j = 0; j < k; j++) { if(s[j].top() > person[i]) { break; } } if(j == k) { printf("NO\n"); return 0; } s[j].push(person[i]); } printf("YES\n"); }
15.5
33
0.375806
KimBoWoon
7fd092f85796b17743f720381aa2db2a0903e82e
2,569
cpp
C++
src/TableIndexer.cpp
NDelt/Mini-Search-Engine
c7c64a7d365e5112e0a6eb320d3ff3e399bd9e18
[ "Apache-2.0" ]
null
null
null
src/TableIndexer.cpp
NDelt/Mini-Search-Engine
c7c64a7d365e5112e0a6eb320d3ff3e399bd9e18
[ "Apache-2.0" ]
null
null
null
src/TableIndexer.cpp
NDelt/Mini-Search-Engine
c7c64a7d365e5112e0a6eb320d3ff3e399bd9e18
[ "Apache-2.0" ]
1
2019-04-11T03:02:05.000Z
2019-04-11T03:02:05.000Z
#include "TableIndexer.hpp" /** * 역색인 테이블 생성기 * 1) CSV 파싱 * 2) 'BASIC QUALIFICATIONS' 컬럼에 대해 토큰 단위로 문자열 파싱 * 3) 문자열 파싱 후 반환되는 vector를 순회하며 (토큰, ID) 형식으로 해시 테이블에 데이터 추가 */ void TableIndexer::createIndex(const std::string& filePath, HashMap& hashMap) { clock_t start, end, loopStart, loopEnd; double result; std::cout << std::fixed; std::cout.precision(4); std::cout << ">>>>> Parsing CSV file....\n"; start = clock(); std::cout << "* File path : " << "\"" << filePath << "\"\n"; std::vector<std::vector<std::string>> matrix = CSVParser::parse(filePath); end = clock(); result = (double)(end - start); std::cout << ">>>>> CSV parsing complete. [" << result / CLOCKS_PER_SEC << "s]\n\n"; int wordsParsingCount = 1; loopStart = clock(); // 사용하는 CSV 파일 컬럼: ID(0), TITLE(1), BASIC QUALIFICATIONS(5) // 토큰 분석 대상 컬럼: BASIC QUALIFICATIONS(5) for (const std::vector<std::string>& row : matrix) { std::cout << ">>>>> (" << wordsParsingCount << ") Parsing words...\n"; start = clock(); this->id = std::atoi(row[0].c_str()); this->title = row[1]; this->qualif = row[5]; std::cout << "* ID : " << this->id << "\n"; std::cout << "* Job Title : " << this->title << "\n"; std::cout << "* Qualifications : " << this->qualif << "\n\n"; std::vector<std::string> retVec = QueryParser::parse(this->qualif); int interCount = 1; for (const std::string& str : retVec) { if (str.empty()) { std::cout << "(empty) / "; } else if (str.size() == 1) { std::cout << "(1 letter) / "; } else if (str == "an" || str == "the") { std::cout << "(stopword) / "; } else { std::cout << str << " / "; hashMap.add(str, this->id); // 해시 테이블에 데이터 삽입 } ++interCount; } std::cout << "\n"; end = clock(); result = (double)(end - start); std::cout << ">>>>> (" << wordsParsingCount << ") Words parsing complete. [" << result / CLOCKS_PER_SEC << "s]\n\n"; ++wordsParsingCount; } loopEnd = clock(); result = (double)(loopEnd - loopStart); std::cout << ">>>>> Inverted index table is created : " << hashMap.getCurrentRowCount() << " rows. [" << result / CLOCKS_PER_SEC << "s]\n\n"; }
32.1125
124
0.474114
NDelt
7fd2d7d17449a143010ed5bcd33add9faa85b1bf
11,537
cpp
C++
IccProfLib/IccPcc.cpp
petervwyatt/DemoIccMAX
f07a85a87269a7c0c4507012ea9f547edca723e6
[ "RSA-MD" ]
56
2016-02-24T20:43:57.000Z
2021-02-06T04:31:34.000Z
IccProfLib/IccPcc.cpp
petervwyatt/DemoIccMAX
f07a85a87269a7c0c4507012ea9f547edca723e6
[ "RSA-MD" ]
24
2016-02-01T16:50:58.000Z
2021-01-17T03:51:00.000Z
IccProfLib/IccPcc.cpp
petervwyatt/DemoIccMAX
f07a85a87269a7c0c4507012ea9f547edca723e6
[ "RSA-MD" ]
25
2016-02-02T15:26:09.000Z
2020-10-05T07:21:19.000Z
/** @file File: IccPcc.cpp Contains: Implementation of the IIccProfileConnectionConditions interface class. Version: V1 Copyright: (c) see ICC Software License */ /* * The ICC Software License, Version 0.2 * * * Copyright (c) 2003-2012 The International Color Consortium. All rights * reserved. * * 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. In the absence of prior written permission, the names "ICC" and "The * International Color Consortium" must not be used to imply that the * ICC organization endorses or promotes products derived from this * software. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 INTERNATIONAL COLOR CONSORTIUM OR * ITS CONTRIBUTING MEMBERS 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. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the The International Color Consortium. * * * Membership in the ICC is encouraged when this software is used for * commercial purposes. * * * For more information on The International Color Consortium, please * see <http://www.color.org/>. * * */ ////////////////////////////////////////////////////////////////////// // HISTORY: // // -Initial implementation by Max Derhak 5-15-2003 // ////////////////////////////////////////////////////////////////////// #ifdef WIN32 #pragma warning( disable: 4786) //disable warning in <list.h> #endif #include "IccPcc.h" #include "IccProfile.h" #include "IccTag.h" #include "IccCmm.h" bool IIccProfileConnectionConditions::isEquivalentPcc(IIccProfileConnectionConditions &IPCC) { icIlluminant illum = getPccIlluminant(); icStandardObserver obs = getPccObserver(); if (illum!=IPCC.getPccIlluminant() || obs!= IPCC.getPccObserver()) return false; if ((illum==icIlluminantDaylight || illum==icIlluminantBlackBody) && getPccCCT()!=IPCC.getPccCCT()) return false; if (illum==icIlluminantUnknown) return false; if (obs==icStdObsCustom) { if (!hasIlluminantSPD() && !IPCC.hasIlluminantSPD()) { icFloatNumber XYZ1[3], XYZ2[3]; getNormIlluminantXYZ(&XYZ1[0]); IPCC.getNormIlluminantXYZ(&XYZ2[0]); if (XYZ1[0]!=XYZ2[0] || XYZ1[1]!=XYZ2[1] || XYZ1[2]!=XYZ2[2]) return false; } else { return false; } } return true; } icIlluminant IIccProfileConnectionConditions::getPccIlluminant() { const CIccTagSpectralViewingConditions *pCond = getPccViewingConditions(); if (!pCond) return icIlluminantD50; return pCond->getStdIllumiant(); } icFloatNumber IIccProfileConnectionConditions::getPccCCT() { const CIccTagSpectralViewingConditions *pCond = getPccViewingConditions(); if (!pCond) return 0.0f; return pCond->getIlluminantCCT(); } icStandardObserver IIccProfileConnectionConditions::getPccObserver() { const CIccTagSpectralViewingConditions *pCond = getPccViewingConditions(); if (!pCond) return icStdObs1931TwoDegrees; return pCond->getStdObserver(); } bool IIccProfileConnectionConditions::isStandardPcc() { if (getPccIlluminant()==icIlluminantD50 && getPccObserver()==icStdObs1931TwoDegrees) return true; return false; } bool IIccProfileConnectionConditions::hasIlluminantSPD() { const CIccTagSpectralViewingConditions *pCond = getPccViewingConditions(); if (!pCond) return false; icSpectralRange illumRange; const icFloatNumber *illum = pCond->getIlluminant(illumRange); if (!illumRange.steps || !illum) return false; return true; } icFloatNumber IIccProfileConnectionConditions::getObserverIlluminantScaleFactor() { const CIccTagSpectralViewingConditions *pView = getPccViewingConditions(); if (!pView) return 1.0; icSpectralRange illumRange; const icFloatNumber *illum = pView->getIlluminant(illumRange); icSpectralRange obsRange; const icFloatNumber *obs = pView->getObserver(obsRange); int i, n = illumRange.steps; CIccMatrixMath *mapRange=CIccMatrixMath::rangeMap(obsRange, illumRange); icFloatNumber rv=0; if (mapRange) { icFloatNumber *Ycmf = new icFloatNumber[illumRange.steps]; mapRange->VectorMult(Ycmf, &obs[obsRange.steps]); delete mapRange; for (i=0; i<n; i++) { rv += Ycmf[i]*illum[i]; } delete [] Ycmf; } else { const icFloatNumber *Ycmf = &obs[obsRange.steps]; for (i=0; i<n; i++) { rv += Ycmf[i]*illum[i]; } } return rv; } icFloatNumber IIccProfileConnectionConditions::getObserverWhiteScaleFactor(const icFloatNumber *pWhite, const icSpectralRange &whiteRange) { const CIccTagSpectralViewingConditions *pView = getPccViewingConditions(); if (!pView) return 1.0; icSpectralRange obsRange; const icFloatNumber *obs = pView->getObserver(obsRange); int i, n = whiteRange.steps; CIccMatrixMath *mapRange=CIccMatrixMath::rangeMap(obsRange, whiteRange); icFloatNumber rv=0; if (mapRange) { icFloatNumber *Ycmf = new icFloatNumber[whiteRange.steps]; mapRange->VectorMult(Ycmf, &obs[obsRange.steps]); delete mapRange; for (i=0; i<n; i++) { rv += Ycmf[i]*pWhite[i]; } delete [] Ycmf; } else { const icFloatNumber *Ycmf = &obs[obsRange.steps]; for (i=0; i<n; i++) { rv += Ycmf[i]*pWhite[i]; } } return rv; } icFloatNumber *IIccProfileConnectionConditions::getEmissiveObserver(const icSpectralRange &range, const icFloatNumber *pWhite, icFloatNumber *obs) { const CIccTagSpectralViewingConditions *pView = getPccViewingConditions(); if (!pView || !pWhite) return NULL; int i, n = range.steps, size = 3*n; const icFloatNumber *fptr; icFloatNumber *tptr; icSpectralRange observerRange; const icFloatNumber *observer = pView->getObserver(observerRange); if (!obs) obs = (icFloatNumber*)malloc(size*sizeof(icFloatNumber)); if (obs) { CIccMatrixMath *mapRange=CIccMatrixMath::rangeMap(observerRange, range); //Copy observer while adjusting to range if (mapRange) { if (obs) { fptr = &observer[0]; tptr = obs; for (i=0; i<3; i++) { mapRange->VectorMult(tptr, fptr); fptr += observerRange.steps; tptr += range.steps; } } delete mapRange; } else { memcpy(obs, observer, size*sizeof(icFloatNumber)); } //Calculate scale constant icFloatNumber k=0.0f; fptr = &obs[range.steps]; //Using second color matching function for (i=0; i<(int)range.steps; i++) { k += fptr[i]*pWhite[i]; } //Scale observer so application of observer against white results in 1.0. for (i=0; i<size; i++) { obs[i] = obs[i] / k; } CIccMatrixMath observerMtx(3,range.steps); memcpy(observerMtx.entry(0), obs, size*sizeof(icFloatNumber)); icFloatNumber xyz[3]; observerMtx.VectorMult(xyz, pWhite); } return obs; } CIccMatrixMath *IIccProfileConnectionConditions::getReflectanceObserver(const icSpectralRange &rangeRef) { CIccMatrixMath *pAdjust=NULL, *pMtx; const CIccTagSpectralViewingConditions *pView = getPccViewingConditions(); icSpectralRange illumRange; const icFloatNumber *illum = pView->getIlluminant(illumRange); pMtx = CIccMatrixMath::rangeMap(rangeRef, illumRange); if (pMtx) pAdjust = pMtx; pMtx = pView->getObserverMatrix(illumRange); if (pAdjust) { pMtx = pAdjust->Mult(pMtx); delete pAdjust; } pAdjust = pMtx; pAdjust->VectorScale(illum); pAdjust->Scale(1.0f / pAdjust->RowSum(1)); return pAdjust; } CIccCombinedConnectionConditions::CIccCombinedConnectionConditions(CIccProfile *pProfile, IIccProfileConnectionConditions *pAppliedPCC, bool bReflectance/*=false*/) { const CIccTagSpectralViewingConditions *pView = pAppliedPCC ? pAppliedPCC->getPccViewingConditions() : NULL; if (bReflectance) { m_pPCC = pAppliedPCC; m_pViewingConditions = NULL; m_illuminantXYZ[0] = pView->m_illuminantXYZ.X / pView->m_illuminantXYZ.Y; m_illuminantXYZ[1] = pView->m_illuminantXYZ.Y / pView->m_illuminantXYZ.Y; m_illuminantXYZ[2] = pView->m_illuminantXYZ.Z / pView->m_illuminantXYZ.Y; m_illuminantXYZLum[0] = pView->m_illuminantXYZ.X; m_illuminantXYZLum[1] = pView->m_illuminantXYZ.Y; m_illuminantXYZLum[2] = pView->m_illuminantXYZ.Z; m_bValidMediaXYZ = pProfile->calcMediaWhiteXYZ(m_mediaXYZ, pAppliedPCC); } else if (pView) { m_pPCC = NULL; m_pViewingConditions = (CIccTagSpectralViewingConditions*)pView->NewCopy(); icSpectralRange illumRange; const icFloatNumber *illum = pView->getIlluminant(illumRange); m_pViewingConditions->setIlluminant(pView->getStdIllumiant(), illumRange, illum, pView->getIlluminantCCT()); pProfile->calcNormIlluminantXYZ(m_illuminantXYZ, this); pProfile->calcLumIlluminantXYZ(m_illuminantXYZLum, this); m_bValidMediaXYZ = pProfile->calcMediaWhiteXYZ(m_mediaXYZ, this); } else { m_pPCC = NULL; m_pViewingConditions = NULL; m_bValidMediaXYZ = false; } } CIccCombinedConnectionConditions::~CIccCombinedConnectionConditions() { if (m_pViewingConditions) delete m_pViewingConditions; } const CIccTagSpectralViewingConditions *CIccCombinedConnectionConditions::getPccViewingConditions() { if (m_pViewingConditions) return m_pViewingConditions; if (m_pPCC) return m_pPCC->getPccViewingConditions(); return NULL; } CIccTagMultiProcessElement *CIccCombinedConnectionConditions::getCustomToStandardPcc() { if (m_pPCC) return m_pPCC->getCustomToStandardPcc(); return NULL; } CIccTagMultiProcessElement *CIccCombinedConnectionConditions::getStandardToCustomPcc() { if (m_pPCC) return m_pPCC->getStandardToCustomPcc(); return NULL; } void CIccCombinedConnectionConditions::getNormIlluminantXYZ(icFloatNumber *pXYZ) { memcpy(pXYZ, m_illuminantXYZ, 3*sizeof(icFloatNumber)); } void CIccCombinedConnectionConditions::getLumIlluminantXYZ(icFloatNumber *pXYZLum) { memcpy(pXYZLum, m_illuminantXYZLum, 3 * sizeof(icFloatNumber)); } bool CIccCombinedConnectionConditions::getMediaWhiteXYZ(icFloatNumber *pXYZ) { if (m_pPCC || m_pViewingConditions) { memcpy(pXYZ, m_mediaXYZ, 3*sizeof(icFloatNumber)); return m_bValidMediaXYZ; } return false; }
28.699005
146
0.698362
petervwyatt
8f16dcdf4469a82484e7ebb4932249d97c61901a
1,860
hpp
C++
src/base/include/scripts/behaviour_script.hpp
N4G170/generic
29c8be184b1420b811e2a3db087f9bd6b76ed8bf
[ "MIT" ]
null
null
null
src/base/include/scripts/behaviour_script.hpp
N4G170/generic
29c8be184b1420b811e2a3db087f9bd6b76ed8bf
[ "MIT" ]
null
null
null
src/base/include/scripts/behaviour_script.hpp
N4G170/generic
29c8be184b1420b811e2a3db087f9bd6b76ed8bf
[ "MIT" ]
null
null
null
#ifndef BEHAVIOUR_SCRIPT_HPP #define BEHAVIOUR_SCRIPT_HPP #include "script.hpp" class BehaviourScript : public Script { public: //<f> Constructors & operator= /** brief Default constructor */ BehaviourScript() : Script{}, m_input_event{} {} /** brief Default destructor */ virtual ~BehaviourScript() noexcept {} /** brief Copy constructor */ BehaviourScript(const BehaviourScript& other): Script{other}, m_input_event{other.m_input_event} {} /** brief Move constructor */ BehaviourScript(BehaviourScript&& other) noexcept : Script{std::move(other)}, m_input_event{std::move(other.m_input_event)} {} /** brief Copy operator */ BehaviourScript& operator= (const BehaviourScript& other) { if(this != &other) { Script::operator=(other); m_input_event = other.m_input_event; } return *this; } /** brief Move operator */ BehaviourScript& operator= (BehaviourScript&& other) noexcept { if(this != &other) { Script::operator=(std::move(other)); m_input_event = std::move(other.m_input_event); } return *this; } //</f> /Constructors & operator= //<f> Methods void Input(const SDL_Event& event) { m_input_event = event; } //</f> /Methods //<f> Virtual Methods virtual Script* Clone() = 0; virtual void FixedUpdate(float fixed_delta_time){}; virtual void Update(float delta_time){}; //</f> /Virtual Methods //<f> Getters/Setters //</f> /Getters/Setters protected: // vars and stuff SDL_Event m_input_event; private: }; #endif //BEHAVIOUR_SCRIPT_HPP
29.52381
134
0.568817
N4G170
8f1820ee1e7f321c33bc7a0da2708585b1656a87
693
hpp
C++
include/Core/Mathf.hpp
Ursanon/RayTracing
8cc51b9b7845ccd2ef99704d7cfebc301f36b315
[ "MIT" ]
2
2020-01-06T14:31:16.000Z
2020-01-07T08:15:51.000Z
include/Core/Mathf.hpp
Ursanon/RayTracing
8cc51b9b7845ccd2ef99704d7cfebc301f36b315
[ "MIT" ]
null
null
null
include/Core/Mathf.hpp
Ursanon/RayTracing
8cc51b9b7845ccd2ef99704d7cfebc301f36b315
[ "MIT" ]
null
null
null
#ifndef MATHF_HPP_ #define MATHF_HPP_ #include "Core/Vector3.hpp" namespace rt { namespace mathf { static constexpr float PI = 3.14159265358979f; float clamp(const float& value, const float& min, const float& max); float clamp01(const float& value); float lerp(const float& a, const float& b, const float t); float schlick_approx(const float& n1, const float& n2, const float& cosine); /** * checks is value between minimum (exclusive) and maximum (exclusive) * @returns */ template<typename T> bool is_between(const T& value, const T& minimum, const T& maximum) { return value > minimum && value < maximum; } } } #endif // !MATHF_HPP_
21.65625
78
0.678211
Ursanon
8f1cd44c1eb759fa35bf34a340e431fe4dc1a4fb
14,367
cpp
C++
matlab/panoContext_code/Toolbox/SketchTokens-master/toolbox/channels/private/gradientMex.cpp
imamik/LayoutNet
f68eb214e793b9786f2582f9244bac4f8f98a816
[ "MIT" ]
380
2018-02-23T02:58:35.000Z
2022-03-21T06:34:33.000Z
matlab/panoContext_code/Toolbox/SketchTokens-master/toolbox/channels/private/gradientMex.cpp
imamik/LayoutNet
f68eb214e793b9786f2582f9244bac4f8f98a816
[ "MIT" ]
36
2018-04-11T03:49:42.000Z
2021-01-21T01:25:47.000Z
matlab/panoContext_code/Toolbox/SketchTokens-master/toolbox/channels/private/gradientMex.cpp
imamik/LayoutNet
f68eb214e793b9786f2582f9244bac4f8f98a816
[ "MIT" ]
94
2018-02-25T05:23:51.000Z
2022-02-11T02:00:47.000Z
/******************************************************************************* * Piotr's Image&Video Toolbox Version 3.00 * Copyright 2012 Piotr Dollar & Ron Appel. [pdollar-at-caltech.edu] * Please email me if you find bugs, or have suggestions or questions! * Licensed under the Simplified BSD License [see external/bsd.txt] *******************************************************************************/ #include "wrappers.hpp" #include <math.h> #include "string.h" #include "sse.hpp" #define PI 3.1415926535897931f // compute x and y gradients for just one column (uses sse) void grad1( float *I, float *Gx, float *Gy, int h, int w, int x ) { int y, y1; float *Ip, *In, r; __m128 *_Ip, *_In, *_G, _r; // compute column of Gx Ip=I-h; In=I+h; r=.5f; if(x==0) { r=1; Ip+=h; } else if(x==w-1) { r=1; In-=h; } if( h<4 || h%4>0 || (size_t(I)&15) || (size_t(Gx)&15) ) { for( y=0; y<h; y++ ) *Gx++=(*In++-*Ip++)*r; } else { _G=(__m128*) Gx; _Ip=(__m128*) Ip; _In=(__m128*) In; _r = SET(r); for(y=0; y<h; y+=4) *_G++=MUL(SUB(*_In++,*_Ip++),_r); } // compute column of Gy #define GRADY(r) *Gy++=(*In++-*Ip++)*r; Ip=I; In=Ip+1; // GRADY(1); Ip--; for(y=1; y<h-1; y++) GRADY(.5f); In--; GRADY(1); y1=((~((size_t) Gy) + 1) & 15)/4; if(y1==0) y1=4; if(y1>h-1) y1=h-1; GRADY(1); Ip--; for(y=1; y<y1; y++) GRADY(.5f); _r = SET(.5f); _G=(__m128*) Gy; for(; y+4<h-1; y+=4, Ip+=4, In+=4, Gy+=4) *_G++=MUL(SUB(LDu(*In),LDu(*Ip)),_r); for(; y<h-1; y++) GRADY(.5f); In--; GRADY(1); #undef GRADY } // compute x and y gradients at each location (uses sse) void grad2( float *I, float *Gx, float *Gy, int h, int w, int d ) { int o, x, c, a=w*h; for(c=0; c<d; c++) for(x=0; x<w; x++) { o=c*a+x*h; grad1( I+o, Gx+o, Gy+o, h, w, x ); } } // build lookup table a[] s.t. a[dx/2.02*n]~=acos(dx) float* acosTable() { int i, n=25000, n2=n/2; float t, ni; static float a[25000]; static bool init=false; if( init ) return a+n2; ni = 2.02f/(float) n; for( i=0; i<n; i++ ) { t = i*ni - 1.01f; t = t<-1 ? -1 : (t>1 ? 1 : t); t = (float) acos( t ); a[i] = (t <= PI-1e-5f) ? t : 0; } init=true; return a+n2; } // compute gradient magnitude and orientation at each location (uses sse) void gradMag( float *I, float *M, float *O, int h, int w, int d ) { int x, y, y1, c, h4, s; float *Gx, *Gy, *M2; __m128 *_Gx, *_Gy, *_M2, _m; float *acost = acosTable(), acMult=25000/2.02f; // allocate memory for storing one column of output (padded so h4%4==0) h4=(h%4==0) ? h : h-(h%4)+4; s=d*h4*sizeof(float); M2=(float*) alMalloc(s,16); _M2=(__m128*) M2; Gx=(float*) alMalloc(s,16); _Gx=(__m128*) Gx; Gy=(float*) alMalloc(s,16); _Gy=(__m128*) Gy; // compute gradient magnitude and orientation for each column for( x=0; x<w; x++ ) { // compute gradients (Gx, Gy) and squared magnitude (M2) for each channel for( c=0; c<d; c++ ) grad1( I+x*h+c*w*h, Gx+c*h4, Gy+c*h4, h, w, x ); for( y=0; y<d*h4/4; y++ ) _M2[y]=ADD(MUL(_Gx[y],_Gx[y]),MUL(_Gy[y],_Gy[y])); // store gradients with maximum response in the first channel for(c=1; c<d; c++) { for( y=0; y<h4/4; y++ ) { y1=h4/4*c+y; _m = CMPGT( _M2[y1], _M2[y] ); _M2[y] = OR( AND(_m,_M2[y1]), ANDNOT(_m,_M2[y]) ); _Gx[y] = OR( AND(_m,_Gx[y1]), ANDNOT(_m,_Gx[y]) ); _Gy[y] = OR( AND(_m,_Gy[y1]), ANDNOT(_m,_Gy[y]) ); } } // compute gradient mangitude (M) and normalize Gx for( y=0; y<h4/4; y++ ) { _m = MIN( RCPSQRT(_M2[y]), SET(1e10f) ); _M2[y] = RCP(_m); _Gx[y] = MUL( MUL(_Gx[y],_m), SET(acMult) ); _Gx[y] = XOR( _Gx[y], AND(_Gy[y], SET(-0.f)) ); }; memcpy( M+x*h, M2, h*sizeof(float) ); // compute and store gradient orientation (O) via table lookup if(O!=0) for( y=0; y<h; y++ ) O[x*h+y] = acost[(int)Gx[y]]; } alFree(Gx); alFree(Gy); alFree(M2); } // normalize gradient magnitude at each location (uses sse) void gradMagNorm( float *M, float *S, int h, int w, float norm ) { __m128 *_M, *_S, _norm; int i=0, n=h*w, n4=n/4; _S = (__m128*) S; _M = (__m128*) M; _norm = SET(norm); bool sse = !(size_t(M)&15) && !(size_t(S)&15); if(sse) { for(; i<n4; i++) *_M++=MUL(*_M,RCP(ADD(*_S++,_norm))); i*=4; } for(; i<n; i++) M[i] /= (S[i] + norm); } // helper for gradHist, quantize O and M into O0, O1 and M0, M1 (uses sse) void gradQuantize( float *O, float *M, int *O0, int *O1, float *M0, float *M1, int nOrients, int nb, int n, float norm ) { // assumes all *OUTPUT* matrices are 4-byte aligned int i, o0, o1; float o, od, m; __m128i _o0, _o1, *_O0, *_O1; __m128 _o, _o0f, _m, *_M0, *_M1; // define useful constants const float oMult=(float)nOrients/PI; const int oMax=nOrients*nb; const __m128 _norm=SET(norm), _oMult=SET(oMult), _nbf=SET((float)nb); const __m128i _oMax=SET(oMax), _nb=SET(nb); // perform the majority of the work with sse _O0=(__m128i*) O0; _O1=(__m128i*) O1; _M0=(__m128*) M0; _M1=(__m128*) M1; for( i=0; i<=n-4; i+=4 ) { _o=MUL(LDu(O[i]),_oMult); _o0f=CVT(CVT(_o)); _o0=CVT(MUL(_o0f,_nbf)); _o1=ADD(_o0,_nb); _o1=AND(CMPGT(_oMax,_o1),_o1); *_O0++=_o0; *_O1++=_o1; _m=MUL(LDu(M[i]),_norm); *_M1=MUL(SUB(_o,_o0f),_m); *_M0=SUB(_m,*_M1); _M0++; _M1++; } // compute trailing locations without sse for( i; i<n; i++ ) { o=O[i]*oMult; m=M[i]*norm; o0=(int) o; od=o-o0; o0*=nb; o1=o0+nb; if(o1==oMax) o1=0; O0[i]=o0; O1[i]=o1; M1[i]=od*m; M0[i]=m-M1[i]; } } // compute nOrients gradient histograms per bin x bin block of pixels void gradHist( float *M, float *O, float *H, int h, int w, int bin, int nOrients, bool softBin ) { const int hb=h/bin, wb=w/bin, h0=hb*bin, w0=wb*bin, nb=wb*hb; const float s=(float)bin, sInv=1/s, sInv2=1/s/s; float *H0, *H1, *M0, *M1; int x, y; int *O0, *O1; O0=(int*)alMalloc(h*sizeof(int),16); M0=(float*) alMalloc(h*sizeof(float),16); O1=(int*)alMalloc(h*sizeof(int),16); M1=(float*) alMalloc(h*sizeof(float),16); // main loop for( x=0; x<w0; x++ ) { // compute target orientation bins for entire column - very fast gradQuantize( O+x*h, M+x*h, O0, O1, M0, M1, nOrients, nb, h0, sInv2 ); if( !softBin || bin==1 ) { // interpolate w.r.t. orientation only, not spatial bin H1=H+(x/bin)*hb; #define GH H1[O0[y]]+=M0[y]; H1[O1[y]]+=M1[y]; y++; if( bin==1 ) for(y=0; y<h0;) { GH; H1++; } else if( bin==2 ) for(y=0; y<h0;) { GH; GH; H1++; } else if( bin==3 ) for(y=0; y<h0;) { GH; GH; GH; H1++; } else if( bin==4 ) for(y=0; y<h0;) { GH; GH; GH; GH; H1++; } else for( y=0; y<h0;) { for( int y1=0; y1<bin; y1++ ) { GH; } H1++; } #undef GH } else { // interpolate using trilinear interpolation float ms[4], xyd, xb, yb, xd, yd, init; __m128 _m, _m0, _m1; bool hasLf, hasRt; int xb0, yb0; if( x==0 ) { init=(0+.5f)*sInv-0.5f; xb=init; } hasLf = xb>=0; xb0 = hasLf?(int)xb:-1; hasRt = xb0 < wb-1; xd=xb-xb0; xb+=sInv; yb=init; y=0; // macros for code conciseness #define GHinit yd=yb-yb0; yb+=sInv; H0=H+xb0*hb+yb0; xyd=xd*yd; \ ms[0]=1-xd-yd+xyd; ms[1]=yd-xyd; ms[2]=xd-xyd; ms[3]=xyd; #define GH(H,ma,mb) H1=H; STRu(*H1,ADD(LDu(*H1),MUL(ma,mb))); // leading rows, no top bin for( ; y<bin/2; y++ ) { yb0=-1; GHinit; if(hasLf) { H0[O0[y]+1]+=ms[1]*M0[y]; H0[O1[y]+1]+=ms[1]*M1[y]; } if(hasRt) { H0[O0[y]+hb+1]+=ms[3]*M0[y]; H0[O1[y]+hb+1]+=ms[3]*M1[y]; } } // main rows, has top and bottom bins, use SSE for minor speedup for( ; ; y++ ) { yb0 = (int) yb; if(yb0>=hb-1) break; GHinit; _m0=SET(M0[y]); _m1=SET(M1[y]); if(hasLf) { _m=SET(0,0,ms[1],ms[0]); GH(H0+O0[y],_m,_m0); GH(H0+O1[y],_m,_m1); } if(hasRt) { _m=SET(0,0,ms[3],ms[2]); GH(H0+O0[y]+hb,_m,_m0); GH(H0+O1[y]+hb,_m,_m1); } } // final rows, no bottom bin for( ; y<h0; y++ ) { yb0 = (int) yb; GHinit; if(hasLf) { H0[O0[y]]+=ms[0]*M0[y]; H0[O1[y]]+=ms[0]*M1[y]; } if(hasRt) { H0[O0[y]+hb]+=ms[2]*M0[y]; H0[O1[y]+hb]+=ms[2]*M1[y]; } } #undef GHinit #undef GH } } alFree(O0); alFree(O1); alFree(M0); alFree(M1); } // compute HOG features given gradient histograms void hog( float *H, float *G, int h, int w, int bin, int nOrients, float clip ){ float *N, *N1, *H1; int o, x, y, hb=h/bin, wb=w/bin, nb=wb*hb; float eps = 1e-4f/4/bin/bin/bin/bin; // precise backward equality // compute 2x2 block normalization values N = (float*) wrCalloc(nb,sizeof(float)); for( o=0; o<nOrients; o++ ) for( x=0; x<nb; x++ ) N[x]+=H[x+o*nb]*H[x+o*nb]; for( x=0; x<wb-1; x++ ) for( y=0; y<hb-1; y++ ) { N1=N+x*hb+y; *N1=1/float(sqrt( N1[0] + N1[1] + N1[hb] + N1[hb+1] +eps )); } // perform 4 normalizations per spatial block (handling boundary regions) #define U(a,b) Gs[a][y]=H1[y]*N1[y-(b)]; if(Gs[a][y]>clip) Gs[a][y]=clip; for( o=0; o<nOrients; o++ ) for( x=0; x<wb; x++ ) { H1=H+o*nb+x*hb; N1=N+x*hb; float *Gs[4]; Gs[0]=G+o*nb+x*hb; for( y=1; y<4; y++ ) Gs[y]=Gs[y-1]+nb*nOrients; bool lf, md, rt; lf=(x==0); rt=(x==wb-1); md=(!lf && !rt); y=0; if(!rt) U(0,0); if(!lf) U(2,hb); if(lf) for( y=1; y<hb-1; y++ ) { U(0,0); U(1,1); } if(md) for( y=1; y<hb-1; y++ ) { U(0,0); U(1,1); U(2,hb); U(3,hb+1); } if(rt) for( y=1; y<hb-1; y++ ) { U(2,hb); U(3,hb+1); } y=hb-1; if(!rt) U(1,1); if(!lf) U(3,hb+1); } wrFree(N); #undef U } /******************************************************************************/ #ifdef MATLAB_MEX_FILE // Create [hxwxd] mxArray array, initialize to 0 if c=true mxArray* mxCreateMatrix3( int h, int w, int d, mxClassID id, bool c, void **I ){ const int dims[3]={h,w,d}, n=h*w*d; int b; mxArray* M; if( id==mxINT32_CLASS ) b=sizeof(int); else if( id==mxDOUBLE_CLASS ) b=sizeof(double); else if( id==mxSINGLE_CLASS ) b=sizeof(float); else mexErrMsgTxt("Unknown mxClassID."); *I = c ? mxCalloc(n,b) : mxMalloc(n*b); M = mxCreateNumericMatrix(0,0,id,mxREAL); mxSetData(M,*I); mxSetDimensions(M,dims,3); return M; } // Check inputs and outputs to mex, retrieve first input I void checkArgs( int nl, mxArray *pl[], int nr, const mxArray *pr[], int nl0, int nl1, int nr0, int nr1, int *h, int *w, int *d, mxClassID id, void **I ) { const int *dims; int nDims; if( nl<nl0 || nl>nl1 ) mexErrMsgTxt("Incorrect number of outputs."); if( nr<nr0 || nr>nr1 ) mexErrMsgTxt("Incorrect number of inputs."); nDims = mxGetNumberOfDimensions(pr[0]); dims = mxGetDimensions(pr[0]); *h=dims[0]; *w=dims[1]; *d=(nDims==2) ? 1 : dims[2]; *I = mxGetPr(pr[0]); if( nDims!=2 && nDims!=3 ) mexErrMsgTxt("I must be a 2D or 3D array."); if( mxGetClassID(pr[0])!=id ) mexErrMsgTxt("I has incorrect type."); } // [Gx,Gy] = grad2(I) - see gradient2.m void mGrad2( int nl, mxArray *pl[], int nr, const mxArray *pr[] ) { int h, w, d; float *I, *Gx, *Gy; checkArgs(nl,pl,nr,pr,1,2,1,1,&h,&w,&d,mxSINGLE_CLASS,(void**)&I); if(h<2 || w<2) mexErrMsgTxt("I must be at least 2x2."); pl[0]= mxCreateMatrix3( h, w, d, mxSINGLE_CLASS, 0, (void**) &Gx ); pl[1]= mxCreateMatrix3( h, w, d, mxSINGLE_CLASS, 0, (void**) &Gy ); grad2( I, Gx, Gy, h, w, d ); } // [M,O] = gradMag( I, [channel] ) - see gradientMag.m void mGradMag( int nl, mxArray *pl[], int nr, const mxArray *pr[] ) { int h, w, d, c; float *I, *M, *O=0; checkArgs(nl,pl,nr,pr,1,2,1,2,&h,&w,&d,mxSINGLE_CLASS,(void**)&I); if(h<2 || w<2) mexErrMsgTxt("I must be at least 2x2."); c = (nr>=2) ? (int) mxGetScalar(pr[1]) : 0; if( c>0 && c<=d ) { I += h*w*(c-1); d=1; } pl[0] = mxCreateMatrix3(h,w,1,mxSINGLE_CLASS,0,(void**)&M); if(nl>=2) pl[1] = mxCreateMatrix3(h,w,1,mxSINGLE_CLASS,0,(void**)&O); gradMag(I, M, O, h, w, d ); } // gradMagNorm( M, S, norm ) - operates on M - see gradientMag.m void mGradMagNorm( int nl, mxArray *pl[], int nr, const mxArray *pr[] ) { int h, w, d; float *M, *S, norm; checkArgs(nl,pl,nr,pr,0,0,3,3,&h,&w,&d,mxSINGLE_CLASS,(void**)&M); if( mxGetM(pr[1])!=h || mxGetN(pr[1])!=w || d!=1 || mxGetClassID(pr[1])!=mxSINGLE_CLASS ) mexErrMsgTxt("M or S is bad."); S = (float*) mxGetPr(pr[1]); norm = (float) mxGetScalar(pr[2]); gradMagNorm(M,S,h,w,norm); } // H=gradHist(M,O,[bin],[nOrients],[softBin],[useHog],[clip])-see gradientHist.m void mGradHist( int nl, mxArray *pl[], int nr, const mxArray *pr[] ) { int h, w, d, hb, wb, bin, nOrients; bool softBin, useHog; float *M, *O, *H, *G, clip; checkArgs(nl,pl,nr,pr,1,3,2,7,&h,&w,&d,mxSINGLE_CLASS,(void**)&M); O = (float*) mxGetPr(pr[1]); if( mxGetM(pr[1])!=h || mxGetN(pr[1])!=w || d!=1 || mxGetClassID(pr[1])!=mxSINGLE_CLASS ) mexErrMsgTxt("M or O is bad."); bin = (nr>=3) ? (int) mxGetScalar(pr[2]) : 8; nOrients = (nr>=4) ? (int) mxGetScalar(pr[3]) : 9; softBin = (nr>=5) ? (bool) (mxGetScalar(pr[4])>0) : true; useHog = (nr>=6) ? (bool) (mxGetScalar(pr[5])>0) : false; clip = (nr>=7) ? (float) mxGetScalar(pr[6]) : 0.2f; hb=h/bin; wb=w/bin; if( useHog==false ) { pl[0] = mxCreateMatrix3(hb,wb,nOrients,mxSINGLE_CLASS,1,(void**)&H); gradHist( M, O, H, h, w, bin, nOrients, softBin ); } else { pl[0] = mxCreateMatrix3(hb,wb,nOrients*4,mxSINGLE_CLASS,1,(void**)&G); H = (float*) mxCalloc(wb*hb*nOrients,sizeof(float)); gradHist( M, O, H, h, w, bin, nOrients, softBin ); hog( H, G, h, w, bin, nOrients, clip ); mxFree(H); } } // inteface to various gradient functions (see corresponding Matlab functions) void mexFunction( int nl, mxArray *pl[], int nr, const mxArray *pr[] ) { int f; char action[1024]; f=mxGetString(pr[0],action,1024); nr--; pr++; if(f) mexErrMsgTxt("Failed to get action."); else if(!strcmp(action,"gradient2")) mGrad2(nl,pl,nr,pr); else if(!strcmp(action,"gradientMag")) mGradMag(nl,pl,nr,pr); else if(!strcmp(action,"gradientMagNorm")) mGradMagNorm(nl,pl,nr,pr); else if(!strcmp(action,"gradientHist")) mGradHist(nl,pl,nr,pr); else mexErrMsgTxt("Invalid action."); } #endif
45.46519
81
0.545347
imamik
8f1e4115eb5239c7700383c1296f7c3df9e55f66
1,543
cpp
C++
Framework/Common/Scene.cpp
lishaojiang/GameEngineFromScratch
7769d3916a9ffabcfdaddeba276fdf964d8a86ee
[ "MIT" ]
1,217
2017-08-18T02:41:11.000Z
2022-03-30T01:48:46.000Z
Framework/Common/Scene.cpp
lishaojiang/GameEngineFromScratch
7769d3916a9ffabcfdaddeba276fdf964d8a86ee
[ "MIT" ]
16
2017-09-05T15:04:37.000Z
2021-09-09T13:59:38.000Z
Framework/Common/Scene.cpp
lishaojiang/GameEngineFromScratch
7769d3916a9ffabcfdaddeba276fdf964d8a86ee
[ "MIT" ]
285
2017-08-18T04:53:55.000Z
2022-03-30T00:02:15.000Z
#include "Scene.hpp" using namespace My; using namespace std; shared_ptr<SceneObjectCamera> Scene::GetCamera(const std::string& key) const { auto i = Cameras.find(key); if (i == Cameras.end()) { return nullptr; } return i->second; } shared_ptr<SceneObjectLight> Scene::GetLight(const std::string& key) const { auto i = Lights.find(key); if (i == Lights.end()) { return nullptr; } return i->second; } shared_ptr<SceneObjectGeometry> Scene::GetGeometry( const std::string& key) const { auto i = Geometries.find(key); if (i == Geometries.end()) { return nullptr; } return i->second; } shared_ptr<SceneObjectMaterial> Scene::GetMaterial( const std::string& key) const { auto i = Materials.find(key); if (i == Materials.end()) { return m_pDefaultMaterial; } return i->second; } shared_ptr<SceneObjectMaterial> Scene::GetFirstMaterial() const { return (Materials.empty() ? nullptr : Materials.cbegin()->second); } shared_ptr<SceneGeometryNode> Scene::GetFirstGeometryNode() const { return (GeometryNodes.empty() ? nullptr : GeometryNodes.cbegin()->second.lock()); } shared_ptr<SceneLightNode> Scene::GetFirstLightNode() const { return (LightNodes.empty() ? nullptr : LightNodes.cbegin()->second.lock()); } shared_ptr<SceneCameraNode> Scene::GetFirstCameraNode() const { return (CameraNodes.empty() ? nullptr : CameraNodes.cbegin()->second.lock()); }
25.295082
79
0.642255
lishaojiang
8f21f0fcc56d16472b85a71bf04761558672f9d6
1,365
cpp
C++
snap/eclipse-workspace/CMPE320_prototype1/src/CookBook.cpp
ETSnider/PantryPal
8239c37701497195878ec07db37ccca61b23d2bb
[ "MIT" ]
null
null
null
snap/eclipse-workspace/CMPE320_prototype1/src/CookBook.cpp
ETSnider/PantryPal
8239c37701497195878ec07db37ccca61b23d2bb
[ "MIT" ]
null
null
null
snap/eclipse-workspace/CMPE320_prototype1/src/CookBook.cpp
ETSnider/PantryPal
8239c37701497195878ec07db37ccca61b23d2bb
[ "MIT" ]
null
null
null
#include <iostream> #include <string> #include "curl/curl.h" #include "CookBook.h" using namespace std; size_t CookBook::jsonStore(char *data, size_t size, size_t nmemb, std::string *buffer_in) { if (buffer_in != NULL) { // Append the data to the buffer buffer_in->append(data, size * nmemb); // How much did we write? recipe = buffer_in; printf("%c", &recipe); return size * nmemb; } return 0; } int main(int argc, char* argv[]) { curl_global_init(CURL_GLOBAL_ALL); CURL* easyHandle = curl_easy_init(); CURLcode res; struct curl_slist* headers = NULL; headers = curl_slist_append(headers, "Content-Type: application/json"); if (easyHandle) { curl_easy_setopt(easyHandle, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(easyHandle, CURLOPT_URL, "https://api.spoonacular.com/recipes/complexSearch?query=pasta&maxFat=25&number=2"); curl_easy_setopt(easyHandle, CURLOPT_HTTPGET, 1); //curl_easy_setopt(easyHandle, CURLOPT_WRITEFUNCTION, jsonStore); res = curl_easy_perform(easyHandle); if (res != CURLE_OK) { fprintf(stderr, "something went wrong\n"); } } curl_slist_free_all(headers); curl_easy_cleanup(easyHandle); return 0; }
30.333333
135
0.627839
ETSnider
8f2681bacb7b8b1a14831f640dd17f67c4523c3b
3,224
cpp
C++
src/vkfw_core/gfx/vk/rt/TopLevelAccelerationStructure.cpp
dasmysh/VulkanFramework_Lib
baeaeb3158d23187f2ffa5044e32d8a5145284aa
[ "MIT" ]
null
null
null
src/vkfw_core/gfx/vk/rt/TopLevelAccelerationStructure.cpp
dasmysh/VulkanFramework_Lib
baeaeb3158d23187f2ffa5044e32d8a5145284aa
[ "MIT" ]
null
null
null
src/vkfw_core/gfx/vk/rt/TopLevelAccelerationStructure.cpp
dasmysh/VulkanFramework_Lib
baeaeb3158d23187f2ffa5044e32d8a5145284aa
[ "MIT" ]
null
null
null
/** * @file TopLevelAccelerationStructure.cpp * @author Sebastian Maisch <sebastian.maisch@googlemail.com> * @date 2020.11.22 * * @brief Implementation of the top level acceleration structure. */ #include "gfx/vk/rt/TopLevelAccelerationStructure.h" namespace vkfw_core::gfx::rt { TopLevelAccelerationStructure::TopLevelAccelerationStructure(vkfw_core::gfx::LogicalDevice* device, std::string_view name, vk::BuildAccelerationStructureFlagsKHR flags) : AccelerationStructure{device, name, vk::AccelerationStructureTypeKHR::eTopLevel, flags} { } TopLevelAccelerationStructure::TopLevelAccelerationStructure(TopLevelAccelerationStructure&& rhs) noexcept = default; TopLevelAccelerationStructure& TopLevelAccelerationStructure::operator=(TopLevelAccelerationStructure&& rhs) noexcept = default; TopLevelAccelerationStructure::~TopLevelAccelerationStructure() {} void TopLevelAccelerationStructure::AddBottomLevelAccelerationStructureInstance( const vk::AccelerationStructureInstanceKHR& blasInstance) { m_blasInstances.emplace_back(blasInstance); } void TopLevelAccelerationStructure::BuildAccelerationStructure(CommandBuffer& cmdBuffer) { m_instancesBuffer = std::make_unique<HostBuffer>(GetDevice(), fmt::format("InstanceBuffer:{}", GetName()), vk::BufferUsageFlagBits::eShaderDeviceAddress | vk::BufferUsageFlagBits::eAccelerationStructureBuildInputReadOnlyKHR); m_instancesBuffer->InitializeData(m_blasInstances); PipelineBarrier barrier{GetDevice()}; vk::AccelerationStructureGeometryInstancesDataKHR asGeometryDataInstances{ VK_FALSE, m_instancesBuffer->GetDeviceAddressConst( vk::AccessFlagBits2KHR::eAccelerationStructureRead, vk::PipelineStageFlagBits2KHR::eAccelerationStructureBuild, barrier)}; vk::AccelerationStructureGeometryDataKHR asGeometryData{asGeometryDataInstances}; vk::AccelerationStructureGeometryKHR asGeometry{vk::GeometryTypeKHR::eInstances, asGeometryData, vk::GeometryFlagBitsKHR::eOpaque}; vk::AccelerationStructureBuildRangeInfoKHR asBuildRange{static_cast<std::uint32_t>(m_blasInstances.size()), 0x0, 0, 0x0}; AddGeometry(asGeometry, asBuildRange); barrier.Record(cmdBuffer); AccelerationStructure::BuildAccelerationStructure(cmdBuffer); } void TopLevelAccelerationStructure::FinalizeBuild() { m_instancesBuffer = nullptr; AccelerationStructure::FinalizeBuild(); } vk::AccelerationStructureKHR TopLevelAccelerationStructure::GetAccelerationStructure( vk::AccessFlags2KHR access, vk::PipelineStageFlags2KHR pipelineStages, PipelineBarrier& barrier) const { AccessBarrier(access, pipelineStages, barrier); return GetHandle(); } }
42.986667
117
0.674007
dasmysh
8f2deded733a34983b8dd130499b2a5b23a713d0
3,136
cpp
C++
source/graphics/texture.cpp
TheCandianVendingMachine/TacticalShooter
3ef34a0cb7be3db75e31e19b3ed3e3ff3804f67f
[ "MIT" ]
null
null
null
source/graphics/texture.cpp
TheCandianVendingMachine/TacticalShooter
3ef34a0cb7be3db75e31e19b3ed3e3ff3804f67f
[ "MIT" ]
null
null
null
source/graphics/texture.cpp
TheCandianVendingMachine/TacticalShooter
3ef34a0cb7be3db75e31e19b3ed3e3ff3804f67f
[ "MIT" ]
null
null
null
#include "texture.hpp" #include <stb_image.h> #include <glad/glad.h> #include <utility> void texture::loadFromMemoryInternal(unsigned char *pixels, bool useSRGB) { glGenTextures(1, &m_id); glBindTexture(GL_TEXTURE_2D, m_id); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); if (pixels) { constexpr GLint possibleFormats[] = { GL_NONE, GL_RED, GL_RG, GL_RGB, GL_RGBA }; GLint sourceFormat = possibleFormats[m_channels]; GLint destFormat = possibleFormats[m_channels]; if (useSRGB) { sourceFormat = GL_SRGB; if (m_channels == 4) { sourceFormat = GL_SRGB_ALPHA; destFormat = GL_RGBA; } } glTexImage2D(GL_TEXTURE_2D, 0, sourceFormat, width, height, 0, destFormat, GL_UNSIGNED_BYTE, pixels); glGenerateMipmap(GL_TEXTURE_2D); } } texture::texture(const char *file, bool useSRGB) { loadFromFile(file, useSRGB); } texture::texture(const texture &rhs) { *this = rhs; } texture::texture(texture &&rhs) { *this = std::move(rhs); } void texture::loadFromFile(const char *file, bool useSRGB) { stbi_set_flip_vertically_on_load(true); unsigned char *pixels = stbi_load(file, &m_width, &m_height, &m_channels, 0); loadFromMemoryInternal(pixels, useSRGB); stbi_image_free(pixels); } void texture::loadFromMemory(unsigned char *pixels, std::size_t length, bool useSRGB) { unsigned char *memoryPixels = stbi_load_from_memory(pixels, length, &m_width, &m_height, &m_channels, 0); loadFromMemoryInternal(memoryPixels, useSRGB); stbi_image_free(memoryPixels); } void texture::bind(int textureUnit) const { glActiveTexture(textureUnit); glBindTexture(GL_TEXTURE_2D, id); } texture &texture::operator=(const texture &rhs) { if (&rhs != this) { m_width = rhs.width; m_height = rhs.height; m_channels = rhs.channels; m_id = rhs.id; type = rhs.type; } return *this; } texture &texture::operator=(texture &&rhs) { if (&rhs != this) { m_width = std::move(rhs.m_width); m_height = std::move(rhs.m_height); m_channels = std::move(rhs.m_channels); m_id = std::move(rhs.m_id); type = std::move(rhs.type); } return *this; }
29.866667
117
0.539222
TheCandianVendingMachine
8f30bbcccb1590e21c60c0666869d0ea9baa0d33
19,940
cpp
C++
lib/AFE-APIs/AFE-API-MQTT-Standard.cpp
lukasz-pekala/AFE-Firmware
59e10dd2f9665ba816c22905e63eaa60ec8fda09
[ "MIT" ]
null
null
null
lib/AFE-APIs/AFE-API-MQTT-Standard.cpp
lukasz-pekala/AFE-Firmware
59e10dd2f9665ba816c22905e63eaa60ec8fda09
[ "MIT" ]
null
null
null
lib/AFE-APIs/AFE-API-MQTT-Standard.cpp
lukasz-pekala/AFE-Firmware
59e10dd2f9665ba816c22905e63eaa60ec8fda09
[ "MIT" ]
null
null
null
/* AFE Firmware for smart home devices, Website: https://afe.smartnydom.pl/ */ #include "AFE-API-MQTT-Standard.h" #ifndef AFE_CONFIG_API_DOMOTICZ_ENABLED AFEAPIMQTTStandard::AFEAPIMQTTStandard() : AFEAPI(){}; #ifdef AFE_CONFIG_HARDWARE_LED void AFEAPIMQTTStandard::begin(AFEDataAccess *Data, AFEDevice *Device, AFELED *Led) { AFEAPI::begin(Data, Device, Led); } #else void AFEAPIMQTTStandard::begin(AFEDataAccess *Data, AFEDevice *Device) { AFEAPI::begin(Data, Device); } #endif void AFEAPIMQTTStandard::listener() { if (Mqtt.listener()) { #ifdef AFE_CONFIG_API_PROCESS_REQUESTS processRequest(); #endif } } void AFEAPIMQTTStandard::synchronize() { #ifdef DEBUG Serial << endl << F("INFO: Sending current device state to MQTT Broker ..."); #endif Mqtt.publish(Mqtt.configuration.lwt.topic, "connected"); /* Synchronize: Relay */ #ifdef AFE_CONFIG_HARDWARE_RELAY for (uint8_t i = 0; i < _Device->configuration.noOfRelays; i++) { if (!_Relay[i]->setRelayAfterRestoringMQTTConnection()) { /* Requesting state from MQTT Broker / service */ Mqtt.publish(_Relay[i]->mqttStateTopic, "get"); } else { /* Updating relay state after setting default value after MQTT connected */ publishRelayState(i); } } #endif /* Synchronize: Switch */ #ifdef AFE_CONFIG_HARDWARE_SWITCH for (uint8_t i = 0; i < _Device->configuration.noOfSwitches; i++) { publishSwitchState(i); } #endif /* Synchronize: Gate */ #ifdef AFE_CONFIG_HARDWARE_GATE for (uint8_t i = 0; i < _Device->configuration.noOfGates; i++) { publishGateState(i); } #endif /* Synchronize: Contactron */ #ifdef AFE_CONFIG_HARDWARE_CONTACTRON for (uint8_t i = 0; i < _Device->configuration.noOfContactrons; i++) { publishContactronState(i); } #endif } void AFEAPIMQTTStandard::subscribe() { #ifdef DEBUG Serial << endl << F("INFO: Subsribing to MQTT Topics ..."); #endif /* Subscribe: Relay */ #ifdef AFE_CONFIG_HARDWARE_RELAY for (uint8_t i = 0; i < _Device->configuration.noOfRelays; i++) { Mqtt.subscribe(_Relay[i]->mqttCommandTopic); if (strlen(_Relay[i]->mqttCommandTopic) > 0) { sprintf(mqttTopicsCache[currentCacheSize].message.topic, _Relay[i]->mqttCommandTopic); mqttTopicsCache[currentCacheSize].id = i; mqttTopicsCache[currentCacheSize].type = AFE_MQTT_DEVICE_RELAY; currentCacheSize++; } } #endif /* Subscribe: Switch */ #ifdef AFE_CONFIG_HARDWARE_SWITCH for (uint8_t i = 0; i < _Device->configuration.noOfSwitches; i++) { Mqtt.subscribe(_Switch[i]->mqttCommandTopic); if (strlen(_Switch[i]->mqttCommandTopic) > 0) { sprintf(mqttTopicsCache[currentCacheSize].message.topic, _Switch[i]->mqttCommandTopic); mqttTopicsCache[currentCacheSize].id = i; mqttTopicsCache[currentCacheSize].type = AFE_MQTT_DEVICE_SWITCH; currentCacheSize++; } } #endif /* Subscribe: ADC */ #ifdef AFE_CONFIG_HARDWARE_ADC_VCC if (_Device->configuration.isAnalogInput) { Mqtt.subscribe(_AnalogInput->mqttCommandTopic); if (strlen(_AnalogInput->mqttCommandTopic) > 0) { sprintf(mqttTopicsCache[currentCacheSize].message.topic, _AnalogInput->mqttCommandTopic); mqttTopicsCache[currentCacheSize].type = AFE_MQTT_DEVICE_ADC; currentCacheSize++; } } #endif /* Subscribe: BMx80 */ #ifdef AFE_CONFIG_HARDWARE_BMEX80 for (uint8_t i = 0; i < _Device->configuration.noOfBMEX80s; i++) { Mqtt.subscribe(_BMx80Sensor[i]->mqttCommandTopic); if (strlen(_BMx80Sensor[i]->mqttCommandTopic) > 0) { sprintf(mqttTopicsCache[currentCacheSize].message.topic, _BMx80Sensor[i]->mqttCommandTopic); mqttTopicsCache[currentCacheSize].id = i; mqttTopicsCache[currentCacheSize].type = AFE_MQTT_DEVICE_BMX80; currentCacheSize++; } } #endif /* Subscribe: BH1750 */ #ifdef AFE_CONFIG_HARDWARE_BH1750 for (uint8_t i = 0; i < _Device->configuration.noOfBH1750s; i++) { Mqtt.subscribe(_BH1750Sensor[i]->mqttCommandTopic); if (strlen(_BH1750Sensor[i]->mqttCommandTopic) > 0) { sprintf(mqttTopicsCache[currentCacheSize].message.topic, _BH1750Sensor[i]->mqttCommandTopic); mqttTopicsCache[currentCacheSize].id = i; mqttTopicsCache[currentCacheSize].type = AFE_MQTT_DEVICE_BH1750; currentCacheSize++; } } #endif /* Subscribe: AS3935 */ #ifdef AFE_CONFIG_HARDWARE_AS3935 for (uint8_t i = 0; i < _Device->configuration.noOfAS3935s; i++) { Mqtt.subscribe(_AS3935Sensor[i]->mqttCommandTopic); if (strlen(_AS3935Sensor[i]->mqttCommandTopic) > 0) { sprintf(mqttTopicsCache[currentCacheSize].message.topic, _AS3935Sensor[i]->mqttCommandTopic); mqttTopicsCache[currentCacheSize].id = i; mqttTopicsCache[currentCacheSize].type = AFE_MQTT_DEVICE_AS3935; currentCacheSize++; } } #endif /* Subscribe: HPMA115S0 */ #ifdef AFE_CONFIG_HARDWARE_HPMA115S0 for (uint8_t i = 0; i < _Device->configuration.noOfHPMA115S0s; i++) { Mqtt.subscribe(_HPMA115S0Sensor[i]->mqttCommandTopic); if (strlen(_HPMA115S0Sensor[i]->mqttCommandTopic) > 0) { sprintf(mqttTopicsCache[currentCacheSize].message.topic, _HPMA115S0Sensor[i]->mqttCommandTopic); mqttTopicsCache[currentCacheSize].id = i; mqttTopicsCache[currentCacheSize].type = AFE_MQTT_DEVICE_HPMA115S0; currentCacheSize++; } } #endif /* Subscribe: ANEMOMETER */ #ifdef AFE_CONFIG_HARDWARE_ANEMOMETER_SENSOR if (_Device->configuration.noOfAnemometerSensors > 0) { Mqtt.subscribe(_AnemometerSensor->mqttCommandTopic); if (strlen(_AnemometerSensor->mqttCommandTopic) > 0) { sprintf(mqttTopicsCache[currentCacheSize].message.topic, _AnemometerSensor->mqttCommandTopic); mqttTopicsCache[currentCacheSize].type = AFE_MQTT_DEVICE_ANEMOMETER; currentCacheSize++; } } #endif /* Subscribe: RAIN */ #ifdef AFE_CONFIG_HARDWARE_RAINMETER_SENSOR if (_Device->configuration.noOfRainmeterSensors > 0) { Mqtt.subscribe(_RainmeterSensor->mqttCommandTopic); if (strlen(_RainmeterSensor->mqttCommandTopic) > 0) { sprintf(mqttTopicsCache[currentCacheSize].message.topic, _RainmeterSensor->mqttCommandTopic); mqttTopicsCache[currentCacheSize].type = AFE_MQTT_DEVICE_RAINMETER; currentCacheSize++; } } #endif /* Subscribe: Contactron */ #ifdef AFE_CONFIG_HARDWARE_CONTACTRON for (uint8_t i = 0; i < _Device->configuration.noOfContactrons; i++) { Mqtt.subscribe(_Contactron[i]->mqttCommandTopic); if (strlen(_Contactron[i]->mqttCommandTopic) > 0) { sprintf(mqttTopicsCache[currentCacheSize].message.topic, _Contactron[i]->mqttCommandTopic); mqttTopicsCache[currentCacheSize].id = i; mqttTopicsCache[currentCacheSize].type = AFE_MQTT_DEVICE_CONTACTRON; currentCacheSize++; } } #endif /* Subscribe: Contactron */ #ifdef AFE_CONFIG_HARDWARE_GATE for (uint8_t i = 0; i < _Device->configuration.noOfGates; i++) { Mqtt.subscribe(_Gate[i]->mqttCommandTopic); if (strlen(_Gate[i]->mqttCommandTopic) > 0) { sprintf(mqttTopicsCache[currentCacheSize].message.topic, _Gate[i]->mqttCommandTopic); mqttTopicsCache[currentCacheSize].id = i; mqttTopicsCache[currentCacheSize].type = AFE_MQTT_DEVICE_GATE; currentCacheSize++; } } #endif } #ifdef AFE_CONFIG_API_PROCESS_REQUESTS void AFEAPIMQTTStandard::processRequest() { #ifdef DEBUG Serial << endl << F("INFO: MQTT: Got message: ") << Mqtt.message.topic << F(" | "); for (uint8_t i = 0; i < Mqtt.message.length; i++) { Serial << (char)Mqtt.message.content[i]; } #endif for (uint8_t i = 0; i < currentCacheSize; i++) { if (strcmp(Mqtt.message.topic, mqttTopicsCache[i].message.topic) == 0) { #ifdef DEBUG Serial << endl << F("INFO: MQTT: Found topic in cache: Device Type=") << mqttTopicsCache[i].type; #endif switch (mqttTopicsCache[i].type) { #ifdef AFE_CONFIG_HARDWARE_RELAY case AFE_MQTT_DEVICE_RELAY: // RELAY processRelay(&mqttTopicsCache[i].id); break; #endif #ifdef AFE_CONFIG_HARDWARE_SWITCH case AFE_MQTT_DEVICE_SWITCH: processSwitch(&mqttTopicsCache[i].id); break; #endif #ifdef AFE_CONFIG_HARDWARE_ADC_VCC case AFE_MQTT_DEVICE_ADC: // ADC processADC(); break; #endif #ifdef AFE_CONFIG_HARDWARE_BH1750 case AFE_MQTT_DEVICE_BH1750: processBH1750(&mqttTopicsCache[i].id); break; #endif #ifdef AFE_CONFIG_HARDWARE_BMEX80 case AFE_MQTT_DEVICE_BMX80: processBMEX80(&mqttTopicsCache[i].id); break; #endif #ifdef AFE_CONFIG_HARDWARE_AS3935 case AFE_MQTT_DEVICE_AS3935: processAS3935(&mqttTopicsCache[i].id); break; #endif #ifdef AFE_CONFIG_HARDWARE_ANEMOMETER_SENSOR case AFE_MQTT_DEVICE_ANEMOMETER: processAnemometerSensor(); break; #endif #ifdef AFE_CONFIG_HARDWARE_RAINMETER_SENSOR case AFE_MQTT_DEVICE_RAINMETER: processRainSensor(); break; #endif #ifdef AFE_CONFIG_HARDWARE_HPMA115S0 case AFE_MQTT_DEVICE_HPMA115S0: processHPMA115S0(&mqttTopicsCache[i].id); break; #endif #ifdef AFE_CONFIG_HARDWARE_GATE case AFE_MQTT_DEVICE_GATE: processGate(&mqttTopicsCache[i].id); break; #endif #ifdef AFE_CONFIG_HARDWARE_CONTACTRON case AFE_MQTT_DEVICE_CONTACTRON: processContactron(&mqttTopicsCache[i].id); break; #endif default: #ifdef DEBUG Serial << endl << F("ERROR: Device type ") << mqttTopicsCache[i].type << F(" not found"); #endif break; } break; } } } #endif // AFE_CONFIG_API_PROCESS_REQUESTS #ifdef AFE_CONFIG_HARDWARE_RELAY boolean AFEAPIMQTTStandard::publishRelayState(uint8_t id) { boolean publishStatus = false; if (enabled) { publishStatus = Mqtt.publish(_Relay[id]->mqttStateTopic, _Relay[id]->get() == AFE_RELAY_ON ? "on" : "off"); } return publishStatus; } #endif // AFE_CONFIG_HARDWARE_RELAY #if defined(AFE_CONFIG_HARDWARE_RELAY) && \ defined(AFE_CONFIG_API_PROCESS_REQUESTS) void AFEAPIMQTTStandard::processRelay(uint8_t *id) { boolean publishState = true; #ifdef DEBUG Serial << endl << F("INFO: MQTT: Processing Relay ID: ") << *id; #endif if ((char)Mqtt.message.content[0] == 'o' && Mqtt.message.length == 2) { _Relay[*id]->on(); } else if ((char)Mqtt.message.content[0] == 'o' && Mqtt.message.length == 3) { _Relay[*id]->off(); } else if ((char)Mqtt.message.content[0] == 't' && Mqtt.message.length == 6) { _Relay[*id]->toggle(); } else if ((char)Mqtt.message.content[0] == 'g' && Mqtt.message.length == 3) { } else { publishState = false; #ifdef DEBUG Serial << endl << F("WARN: MQTT: Command not implemented"); #endif } if (publishState) { publishRelayState(*id); } } #endif // AFE_CONFIG_HARDWARE_RELAY && AFE_CONFIG_API_PROCESS_REQUESTS #ifdef AFE_CONFIG_HARDWARE_SWITCH void AFEAPIMQTTStandard::processSwitch(uint8_t *id) { #ifdef DEBUG Serial << endl << F("INFO: MQTT: Processing Switch ID: ") << *id; #endif if ((char)Mqtt.message.content[0] == 'g' && Mqtt.message.length == 3) { publishSwitchState(*id); } #ifdef DEBUG else { Serial << endl << F("WARN: MQTT: Command not implemented"); } #endif } #endif // AFE_CONFIG_HARDWARE_SWITCH #ifdef AFE_CONFIG_HARDWARE_SWITCH boolean AFEAPIMQTTStandard::publishSwitchState(uint8_t id) { boolean publishStatus = false; if (enabled) { publishStatus = Mqtt.publish(_Switch[id]->mqttStateTopic, _Switch[id]->getPhisicalState() ? "open" : "closed"); } return publishStatus; } #endif // AFE_CONFIG_HARDWARE_SWITCH #ifdef AFE_CONFIG_HARDWARE_ADC_VCC void AFEAPIMQTTStandard::publishADCValues() { if (enabled) { char message[AFE_CONFIG_API_JSON_ADC_DATA_LENGTH]; _AnalogInput->getJSON(message); Mqtt.publish(_AnalogInput->configuration.mqtt.topic, message); } } #endif // AFE_CONFIG_HARDWARE_ADC_VCC #if defined(AFE_CONFIG_HARDWARE_ADC_VCC) && \ defined(AFE_CONFIG_API_PROCESS_REQUESTS) void AFEAPIMQTTStandard::processADC() { #ifdef DEBUG Serial << endl << F("INFO: MQTT: Processing ADC: "); #endif if ((char)Mqtt.message.content[0] == 'g' && Mqtt.message.length == 3) { publishADCValues(); } #ifdef DEBUG else { Serial << endl << F("WARN: MQTT: Command not implemented"); } #endif } #endif // AFE_CONFIG_HARDWARE_ADC_VCC && AFE_CONFIG_API_PROCESS_REQUESTS #ifdef AFE_CONFIG_FUNCTIONALITY_BATTERYMETER void AFEAPIMQTTStandard::processBatteryMeter() { #ifdef DEBUG Serial << endl << F("INFO: MQTT: Processing BatteryMeter: "); #endif if ((char)Mqtt.message.content[0] == 'g' && Mqtt.message.length == 3) { publishBatteryMeterValues(); } #ifdef DEBUG else { Serial << endl << F("WARN: MQTT: Command not implemented"); } #endif } boolean AFEAPIMQTTStandard::publishBatteryMeterValues() { boolean _ret = false; if (enabled) { char message[AFE_CONFIG_API_JSON_BATTERYMETER_DATA_LENGTH]; _AnalogInput->getBatteryMeterJSON(message); _ret = Mqtt.publish(_AnalogInput->configuration.battery.mqtt.topic, message); } return _ret; } #endif // AFE_CONFIG_FUNCTIONALITY_BATTERYMETER #ifdef AFE_CONFIG_HARDWARE_BMEX80 void AFEAPIMQTTStandard::processBMEX80(uint8_t *id) { #ifdef DEBUG Serial << endl << F("INFO: MQTT: Processing BMX80 ID: ") << *id; #endif if ((char)Mqtt.message.content[0] == 'g' && Mqtt.message.length == 3) { publishBMx80SensorData(*id); } #ifdef DEBUG else { Serial << endl << F("WARN: MQTT: Command not implemented"); } #endif } boolean AFEAPIMQTTStandard::publishBMx80SensorData(uint8_t id) { boolean publishStatus = false; if (enabled) { char message[AFE_CONFIG_API_JSON_BMEX80_DATA_LENGTH]; _BMx80Sensor[id]->getJSON(message); publishStatus = Mqtt.publish(_BMx80Sensor[id]->configuration.mqtt.topic, message); } return publishStatus; } #endif #ifdef AFE_CONFIG_HARDWARE_HPMA115S0 void AFEAPIMQTTStandard::processHPMA115S0(uint8_t *id) { #ifdef DEBUG Serial << endl << F("INFO: MQTT: Processing HPMA115S0 ID: ") << *id; #endif if ((char)Mqtt.message.content[0] == 'g' && Mqtt.message.length == 3) { publishHPMA115S0SensorData(*id); } #ifdef DEBUG else { Serial << endl << F("WARN: MQTT: Command not implemented"); } #endif } boolean AFEAPIMQTTStandard::publishHPMA115S0SensorData(uint8_t id) { boolean publishStatus = false; if (enabled) { char message[AFE_CONFIG_API_JSON_HPMA115S0_DATA_LENGTH]; _HPMA115S0Sensor[id]->getJSON(message); publishStatus = Mqtt.publish(_HPMA115S0Sensor[id]->configuration.mqtt.topic, message); } return publishStatus; } #endif #ifdef AFE_CONFIG_HARDWARE_BH1750 void AFEAPIMQTTStandard::processBH1750(uint8_t *id) { #ifdef DEBUG Serial << endl << F("INFO: MQTT: Processing BH1750 ID: ") << *id; #endif if ((char)Mqtt.message.content[0] == 'g' && Mqtt.message.length == 3) { publishBH1750SensorData(*id); } #ifdef DEBUG else { Serial << endl << F("WARN: MQTT: Command not implemented"); } #endif } boolean AFEAPIMQTTStandard::publishBH1750SensorData(uint8_t id) { boolean publishStatus = false; if (enabled) { char message[AFE_CONFIG_API_JSON_BH1750_DATA_LENGTH]; _BH1750Sensor[id]->getJSON(message); publishStatus = Mqtt.publish(_BH1750Sensor[id]->configuration.mqtt.topic, message); } return publishStatus; } #endif #ifdef AFE_CONFIG_HARDWARE_AS3935 void AFEAPIMQTTStandard::processAS3935(uint8_t *id) { #ifdef DEBUG Serial << endl << F("INFO: MQTT: Processing AS3935 ID: ") << *id; #endif if ((char)Mqtt.message.content[0] == 'g' && Mqtt.message.length == 3) { publishAS3935SensorData(*id); } #ifdef DEBUG else { Serial << endl << F("WARN: MQTT: Command not implemented"); } #endif } boolean AFEAPIMQTTStandard::publishAS3935SensorData(uint8_t id) { boolean publishStatus = false; if (enabled) { char message[AFE_CONFIG_API_JSON_AS3935_DATA_LENGTH]; _AS3935Sensor[id]->getJSON(message); publishStatus = Mqtt.publish(_AS3935Sensor[id]->configuration.mqtt.topic, message); } return publishStatus; } #endif #ifdef AFE_CONFIG_HARDWARE_ANEMOMETER_SENSOR void AFEAPIMQTTStandard::publishAnemometerSensorData() { if (enabled) { char message[AFE_CONFIG_API_JSON_ANEMOMETER_DATA_LENGTH]; _AnemometerSensor->getJSON(message); Mqtt.publish(_AnemometerSensor->configuration.mqtt.topic, message); } } void AFEAPIMQTTStandard::processAnemometerSensor() { #ifdef DEBUG Serial << endl << F("INFO: MQTT: Processing Anemometer: "); #endif if ((char)Mqtt.message.content[0] == 'g' && Mqtt.message.length == 3) { publishAnemometerSensorData(); } #ifdef DEBUG else { Serial << endl << F("WARN: MQTT: Command not implemented"); } #endif } #endif // AFE_CONFIG_HARDWARE_ANEMOMETER_SENSOR #ifdef AFE_CONFIG_HARDWARE_RAINMETER_SENSOR void AFEAPIMQTTStandard::publishRainSensorData() { if (enabled) { char message[AFE_CONFIG_API_JSON_RAINMETER_DATA_LENGTH]; _RainmeterSensor->getJSON(message); Mqtt.publish(_RainmeterSensor->configuration.mqtt.topic, message); } } void AFEAPIMQTTStandard::processRainSensor() { #ifdef DEBUG Serial << endl << F("INFO: MQTT: Processing Rain: "); #endif if ((char)Mqtt.message.content[0] == 'g' && Mqtt.message.length == 3) { publishRainSensorData(); } #ifdef DEBUG else { Serial << endl << F("WARN: MQTT: Command not implemented"); } #endif } #endif // AFE_CONFIG_HARDWARE_RAINMETER_SENSOR #ifdef AFE_CONFIG_HARDWARE_GATE void AFEAPIMQTTStandard::processGate(uint8_t *id) { #ifdef DEBUG Serial << endl << F("INFO: MQTT: Processing Gate ID: ") << *id; #endif if ((char)Mqtt.message.content[0] == 't' && Mqtt.message.length == 6) { _Gate[*id]->toggle(); } else if ((char)Mqtt.message.content[0] == 'g' && Mqtt.message.length == 3) { publishGateState(*id); } #ifdef DEBUG else { Serial << endl << F("WARN: MQTT: Command not implemented"); } #endif } boolean AFEAPIMQTTStandard::publishGateState(uint8_t id) { boolean publishStatus = false; if (enabled) { uint8_t _state = _Gate[id]->get(); publishStatus = Mqtt.publish(_Gate[id]->mqttStateTopic, _state == AFE_GATE_OPEN ? AFE_MQTT_GATE_OPEN : _state == AFE_GATE_CLOSED ? AFE_MQTT_GATE_CLOSED : _state == AFE_GATE_PARTIALLY_OPEN ? AFE_MQTT_GATE_PARTIALLY_OPEN : AFE_MQTT_GATE_UNKNOWN); } return publishStatus; } #endif // AFE_CONFIG_HARDWARE_GATE #ifdef AFE_CONFIG_HARDWARE_CONTACTRON void AFEAPIMQTTStandard::processContactron(uint8_t *id) { #ifdef DEBUG Serial << endl << F("INFO: MQTT: Processing Contactron ID: ") << *id; #endif if ((char)Mqtt.message.content[0] == 'g' && Mqtt.message.length == 3) { publishContactronState(*id); } #ifdef DEBUG else { Serial << endl << F("WARN: MQTT: Command not implemented"); } #endif } boolean AFEAPIMQTTStandard::publishContactronState(uint8_t id) { boolean publishStatus = false; if (enabled) { publishStatus = Mqtt.publish(_Contactron[id]->mqttStateTopic, _Contactron[id]->get() == AFE_CONTACTRON_OPEN ? AFE_MQTT_CONTACTRON_OPEN : AFE_MQTT_CONTACTRON_CLOSED); } return publishStatus; } #endif // AFE_CONFIG_HARDWARE_CONTACTRON #endif // AFE_CONFIG_API_DOMOTICZ_ENABLED
30.489297
80
0.683751
lukasz-pekala
8f32b6f0fa3f7058f2ba2296338d8bab8e45641f
1,000
cpp
C++
0155_Min Stack.cpp
RickTseng/Cpp_LeetCode
6a710b8abc268eba767bc17d91d046b90a7e34a9
[ "MIT" ]
1
2021-09-13T00:58:59.000Z
2021-09-13T00:58:59.000Z
0155_Min Stack.cpp
RickTseng/Cpp_LeetCode
6a710b8abc268eba767bc17d91d046b90a7e34a9
[ "MIT" ]
null
null
null
0155_Min Stack.cpp
RickTseng/Cpp_LeetCode
6a710b8abc268eba767bc17d91d046b90a7e34a9
[ "MIT" ]
null
null
null
#include <vector> #include <stdio.h> #include <stdlib.h> #include <string> #include <map> #include <algorithm> #include <stack> using namespace std; class MinStack { public: stack<pair<int,int>> rec; MinStack() { } void push(int val) { if(rec.empty()||rec.top().second>=val){ rec.push({val,val}); } else{ rec.push({val,rec.top().second}); } } void pop() { rec.pop(); } int top() { return rec.top().first; } int getMin() { return rec.top().second; } }; /** * Your MinStack object will be instantiated and called as such: * MinStack* obj = new MinStack(); * obj->push(val); * obj->pop(); * int param_3 = obj->top(); * int param_4 = obj->getMin(); * * * -2^31 <= val <= 2^31 - 1 * Methods pop, top and getMin operations will always be called on non-empty stacks. * At most 3 * 10^4 calls will be made to push, pop, top, and getMin. */
19.607843
84
0.54
RickTseng
8f366a1d514f1fc6c8f8f1d16e6c6e2e56c1e447
1,177
cpp
C++
codeforces/gym/PSUT Coding Marathon 2019/g.cpp
tysm/cpsols
262212646203e516d1706edf962290de93762611
[ "MIT" ]
4
2020-10-05T19:24:10.000Z
2021-07-15T00:45:43.000Z
codeforces/gym/PSUT Coding Marathon 2019/g.cpp
tysm/cpsols
262212646203e516d1706edf962290de93762611
[ "MIT" ]
null
null
null
codeforces/gym/PSUT Coding Marathon 2019/g.cpp
tysm/cpsols
262212646203e516d1706edf962290de93762611
[ "MIT" ]
null
null
null
#include <cpplib/stdinc.hpp> int32_t main(){ desync(); int n, b; cin >> n >> b; set<int> st; for(int i=0; i<b; ++i) st.insert(i); vi arr(n); int rep = 0; map<int, int> cnt; for(int &i:arr){ cin >> i; st.erase(i); cnt[i]++; if(cnt[i] == 2) rep++; } reverse(all(arr)); bool ok = false; for(int i=0; i<n and !ok; ++i){ int cur = arr[i]; cnt[cur]--; if(cnt[cur] == 1) rep--; else if(cnt[cur] == 0) st.insert(cur); if(cur == b-1 or rep) continue; auto it = st.upper_bound(cur); if(it == st.end()) continue; ok = true; int res = *it; st.erase(it); arr[i] = res; for(int j=i-1; j>=0; --j){ arr[j] = *st.begin(); st.erase(st.begin()); } } if(ok){ reverse(all(arr)); cout << arr << endl; } else{ vi ans(n+1); ans[0] = 1; ans[1] = 0; for(int i=2; i<n+1; ++i) ans[i] = i; cout << ans << endl; } return 0; }
18.107692
38
0.373832
tysm
8f3a4296444341957903dddfbc0933a8848de5a0
35
hpp
C++
src/boost_static_assert.hpp
miathedev/BoostForArduino
919621dcd0c157094bed4df752b583ba6ea6409e
[ "BSL-1.0" ]
10
2018-03-17T00:58:42.000Z
2021-07-06T02:48:49.000Z
src/boost_static_assert.hpp
miathedev/BoostForArduino
919621dcd0c157094bed4df752b583ba6ea6409e
[ "BSL-1.0" ]
2
2021-03-26T15:17:35.000Z
2021-05-20T23:55:08.000Z
src/boost_static_assert.hpp
miathedev/BoostForArduino
919621dcd0c157094bed4df752b583ba6ea6409e
[ "BSL-1.0" ]
4
2019-05-28T21:06:37.000Z
2021-07-06T03:06:52.000Z
#include <boost/static_assert.hpp>
17.5
34
0.8
miathedev
8f40a6e2659a5f1ab86b44133b9e11fb73f31649
1,776
cpp
C++
test/type_traits/add_rvalue_reference_test.cpp
nekko1119/nek
be43faf5c541fa067ab1e1bcb7a43ebcfefe34e7
[ "BSD-3-Clause" ]
null
null
null
test/type_traits/add_rvalue_reference_test.cpp
nekko1119/nek
be43faf5c541fa067ab1e1bcb7a43ebcfefe34e7
[ "BSD-3-Clause" ]
null
null
null
test/type_traits/add_rvalue_reference_test.cpp
nekko1119/nek
be43faf5c541fa067ab1e1bcb7a43ebcfefe34e7
[ "BSD-3-Clause" ]
null
null
null
#include <nek/type_traits/add_rvalue_reference.hpp> #include <gtest/gtest.h> #include "static_assert.hpp" TEST(add_rvalue_reference_test, normal) { // non-spec, lref, rref STATIC_ASSERT_EQ(nek::add_rvalue_reference<int>::type, int&&); STATIC_ASSERT_EQ(nek::add_rvalue_reference<int&>::type, int&); STATIC_ASSERT_EQ(nek::add_rvalue_reference<int&&>::type, int&&); // cv-spec, lref, rref STATIC_ASSERT_EQ(nek::add_rvalue_reference<int const>::type, int const&&); STATIC_ASSERT_EQ(nek::add_rvalue_reference<int volatile>::type, int volatile&&); STATIC_ASSERT_EQ(nek::add_rvalue_reference<int const volatile>::type, int const volatile&&); STATIC_ASSERT_EQ(nek::add_rvalue_reference<int const&>::type, int const&); STATIC_ASSERT_EQ(nek::add_rvalue_reference<int volatile&>::type, int volatile&); STATIC_ASSERT_EQ(nek::add_rvalue_reference<int const volatile&>::type, int const volatile&); STATIC_ASSERT_EQ(nek::add_rvalue_reference<int const&&>::type, int const&&); STATIC_ASSERT_EQ(nek::add_rvalue_reference<int volatile&&>::type, int volatile&&); STATIC_ASSERT_EQ(nek::add_rvalue_reference<int const volatile&&>::type, int const volatile&&); // void STATIC_ASSERT_EQ(nek::add_rvalue_reference<void>::type, void); STATIC_ASSERT_EQ(nek::add_rvalue_reference<void const>::type, void const); STATIC_ASSERT_EQ(nek::add_rvalue_reference<void volatile>::type, void volatile); STATIC_ASSERT_EQ(nek::add_rvalue_reference<void const volatile>::type, void const volatile); // others STATIC_ASSERT_EQ(nek::add_rvalue_reference<int*>::type, int*&&); STATIC_ASSERT_EQ(nek::add_rvalue_reference<int[]>::type, int(&&)[]); STATIC_ASSERT_EQ(nek::add_rvalue_reference<void()>::type, void(&&)()); }
48
98
0.736486
nekko1119
8f427b7b609e5b6bb7713da937170ccd47daf325
721
cpp
C++
Algorithms/04-MST/MST/main.cpp
Dinlon5566/CS-learning
e83920b761f487af3ca37811497e795ec01077c7
[ "MIT" ]
null
null
null
Algorithms/04-MST/MST/main.cpp
Dinlon5566/CS-learning
e83920b761f487af3ca37811497e795ec01077c7
[ "MIT" ]
null
null
null
Algorithms/04-MST/MST/main.cpp
Dinlon5566/CS-learning
e83920b761f487af3ca37811497e795ec01077c7
[ "MIT" ]
null
null
null
#include <iostream> #include "bits/stdc++.h" using namespace std; struct edge{ int x,y; int cost; }; int cmp(edge e1,edge e2){ return e1.cost<e2.cost; } int findCost(vector<int>& graph,int n){ if(graph[n]==n) return n; return 0; } int main() { int m,n; cin>>m>>n;//m=edge count,n=line count int todo=m-1; vector<int> graph(m,0); vector<edge> edgepool; for(int i=0;i<m;i++){ graph[i]=i; } int x,y,z; for(int i=0;i<n;i++){ cin>>x>>y>>z; edgepool.push_back({x,y,z}); } for(edge tmp:edgepool){ x=findCost(graph,tmp.x); y=findCost(graph,tmp.y); if(x==y) continue; } return 0; }
15.340426
41
0.51595
Dinlon5566
8f4682ce749e72ae89d9a6d4a8dfea693fb3b0e7
979
cpp
C++
myApps/mylibs/Range.cpp
room7364/EVcalculator
958bd1dd3453ab07939c2783b154181ed2ccdbf7
[ "Zlib", "0BSD" ]
null
null
null
myApps/mylibs/Range.cpp
room7364/EVcalculator
958bd1dd3453ab07939c2783b154181ed2ccdbf7
[ "Zlib", "0BSD" ]
null
null
null
myApps/mylibs/Range.cpp
room7364/EVcalculator
958bd1dd3453ab07939c2783b154181ed2ccdbf7
[ "Zlib", "0BSD" ]
null
null
null
#include "../mylibs/HodlemCalc.h" namespace hc { void Range::gethands(std::string& require) { omp::CardRange range(require); comblist combs = range.combinations(); for (int i = 0; i < combs.size(); i++) { std::string comb = combtostring(combs[i]); addhand(comb, 0.0); } } void Range::getequties(std::string range, std::string board) { for (int i = 0; i < hands.size(); i++) { omp::EquityCalculator ec; std::vector<omp::CardRange> ranges; ranges.push_back(hands[i].getvalue()); ranges.push_back(range); uint64_t board_mask = board == "preflop" ? 0 : omp::CardRange::getCardMask(board); ec.start(ranges, board_mask); ec.wait(); auto results = ec.getResults(); hands[i].setequity(results.equity[0]); std::cout << "hand " << i << "from" << hands.size() << "set\n"; } } }
33.758621
94
0.52809
room7364
8f4a16efa26cfe6874a74b655b2eb0e4287d16a0
12,022
cpp
C++
Nebula-Storm/src/EditorLayer.cpp
GalacticKittenSS/Nebula
1620a1dab815d6721b1ae1e3e390ae16313309da
[ "Apache-2.0" ]
3
2021-11-21T21:05:44.000Z
2021-12-27T20:44:08.000Z
Nebula-Storm/src/EditorLayer.cpp
GalacticKittenSS/Nebula
1620a1dab815d6721b1ae1e3e390ae16313309da
[ "Apache-2.0" ]
null
null
null
Nebula-Storm/src/EditorLayer.cpp
GalacticKittenSS/Nebula
1620a1dab815d6721b1ae1e3e390ae16313309da
[ "Apache-2.0" ]
null
null
null
#include "EditorLayer.h" namespace Nebula { extern const std::filesystem::path s_AssetPath = "assets"; EditorLayer::EditorLayer() : Layer("Editor") { } void EditorLayer::Attach() { NB_PROFILE_FUNCTION(); m_PlayIcon = Texture2D::Create("Resources/Icons/PlayButton.png"); m_StopIcon = Texture2D::Create("Resources/Icons/StopButton.png"); FrameBufferSpecification fbSpec; fbSpec.Attachments = { FramebufferTextureFormat::RGBA8, FramebufferTextureFormat::RED_INT, FramebufferTextureFormat::Depth }; fbSpec.Width = 1280; fbSpec.Height = 720; frameBuffer = FrameBuffer::Create(fbSpec); timer = Timer(); auto commandLineArgs = Application::Get().GetCommandLineArgs(); if (commandLineArgs.Count > 1) { auto sceneFilePath = commandLineArgs[1]; SceneSerializer serializer(m_ActiveScene); serializer.Deserialize(sceneFilePath); } m_EditorCam = EditorCamera(60.0f, 16.0f / 9.0f, 0.01f, 1000.0f); m_ActiveScene = CreateRef<Scene>(); m_ActiveScene->OnViewportResize((uint32_t)m_GameViewSize.x, (uint32_t)m_GameViewSize.y); m_SceneHierarchy.SetContext(m_ActiveScene); SceneSerializer(m_ActiveScene).Deserialize("assets/scenes/PinkCube.nebula"); } void EditorLayer::Detach() { } void EditorLayer::Update(Timestep ts) { NB_PROFILE_FUNCTION(); FrameBufferSpecification spec = frameBuffer->GetFrameBufferSpecifications(); if (m_GameViewSize.x > 0.0f && m_GameViewSize.y > 0.0f && (spec.Width != m_GameViewSize.x || spec.Height != m_GameViewSize.y)) { frameBuffer->Resize((uint32_t)m_GameViewSize.x, (uint32_t)m_GameViewSize.y); m_ActiveScene->OnViewportResize((uint32_t)m_GameViewSize.x, (uint32_t)m_GameViewSize.y); m_EditorCam.SetViewPortSize(m_GameViewSize.x, m_GameViewSize.y); } if (!m_UsingGizmo && m_GameViewHovered && m_SceneState == SceneState::Edit) m_EditorCam.Update(); if (m_GameViewFocus) m_ActiveScene->UpdateRuntime(); } void EditorLayer::Render() { NB_PROFILE_FUNCTION(); frameBuffer->Bind(); RenderCommand::SetClearColour({ 0.1f, 0.1f, 0.1f, 1.0f }); RenderCommand::Clear(); frameBuffer->ClearAttachment(1, -1); switch (m_SceneState) { case SceneState::Edit: { m_ActiveScene->UpdateEditor(m_EditorCam); auto [mx, my] = ImGui::GetMousePos(); mx -= m_ViewPortBounds[0].x; my -= m_ViewPortBounds[0].y; vec2 viewportSize = m_ViewPortBounds[1] - m_ViewPortBounds[0]; my = viewportSize.y - my; if (mx >= 0 && my >= 0 && mx < viewportSize.x && my < viewportSize.y) { int pixelData = frameBuffer->ReadPixel(1, (int)mx, (int)my); m_HoveredEntity = pixelData == -1 ? Entity() : Entity((entt::entity)pixelData, m_ActiveScene.get()); } break; } case SceneState::Play: { m_ActiveScene->RenderRuntime(); break; } } frameBuffer->Unbind(); } void EditorLayer::ImGuiRender() { static bool dockspaceOpen = true; static ImGuiDockNodeFlags dockspace_flags = ImGuiDockNodeFlags_None; ImGuiWindowFlags window_flags = ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking; ImGuiViewport* viewport = ImGui::GetMainViewport(); ImGui::SetNextWindowPos(viewport->Pos); ImGui::SetNextWindowSize(viewport->Size); ImGui::SetNextWindowViewport(viewport->ID); ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f); ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f); window_flags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove; window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus; ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f)); ImGui::Begin("Nebula Storm", &dockspaceOpen, window_flags); ImGui::PopStyleVar(3); ImGuiStyle& style = ImGui::GetStyle(); float minWinSize = style.WindowMinSize.x; style.WindowMinSize.x = 370.0f; ImGuiID dockspace_id = ImGui::GetID("Nebula Storm"); ImGui::DockSpace(dockspace_id, ImVec2(0.0f, 0.0f), dockspace_flags); style.WindowMinSize.x = minWinSize; if (ImGui::BeginMenuBar()) { if (ImGui::BeginMenu("File")) { if (ImGui::MenuItem("New", "Ctrl+N")) NewScene(); if (ImGui::MenuItem("Open...", "Ctrl+O")) LoadScene(); if (ImGui::MenuItem("Save As...", "Ctrl+Shift+S")) SaveSceneAs(); if (ImGui::MenuItem("Quit")) Application::Get().Close(); ImGui::EndMenu(); } if (ImGui::BeginMenu("Create Entity")) { if (ImGui::MenuItem("Empty")) auto& sprite = m_ActiveScene->CreateEntity("Entity"); if (ImGui::MenuItem("Sprite")) { auto& sprite = m_ActiveScene->CreateEntity("Sprite"); sprite.AddComponent<SpriteRendererComponent>(); } if (ImGui::MenuItem("Camera")) { auto& sprite = m_ActiveScene->CreateEntity("Camera"); sprite.AddComponent<CameraComponent>(); } ImGui::EndMenu(); } ImGui::EndMenuBar(); } m_SceneHierarchy.OnImGuiRender(); m_ContentBrowser.OnImGuiRender(); ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f)); ImGui::Begin("Game View", nullptr, ImGuiWindowFlags_NoCollapse); auto viewportMinRegion = ImGui::GetWindowContentRegionMin(); auto viewportMaxRegion = ImGui::GetWindowContentRegionMax(); auto viewportOffset = ImGui::GetWindowPos(); m_ViewPortBounds[0] = { viewportMinRegion.x + viewportOffset.x, viewportMinRegion.y + viewportOffset.y }; m_ViewPortBounds[1] = { viewportMaxRegion.x + viewportOffset.x, viewportMaxRegion.y + viewportOffset.y }; m_GameViewFocus = ImGui::IsWindowFocused(); m_GameViewHovered = ImGui::IsWindowHovered(); Application::Get().GetImGuiLayer()->SetBlockEvents(!m_GameViewFocus && !m_GameViewHovered); ImVec2 panelSize = ImGui::GetContentRegionAvail(); m_GameViewSize = { panelSize.x, panelSize.y }; uint32_t textureID = frameBuffer->GetColourAttachmentRendererID(); ImGui::Image((void*)textureID, panelSize, ImVec2{ 0, 1 }, ImVec2{ 1, 0 }); if (ImGui::BeginDragDropTarget()) { if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("CONTENT_BROWSER_ITEM")) { const wchar_t* path = (const wchar_t*)payload->Data; LoadScene(s_AssetPath / path); } ImGui::EndDragDropTarget(); } m_UsingGizmo = ImGuizmo::IsOver(); //Gizmos if (m_SceneState == SceneState::Edit) { Entity selectedEntity = m_SceneHierarchy.GetSelectedEntity(); if (selectedEntity && m_GizmoType != -1) { ImGuizmo::SetOrthographic(false); ImGuizmo::SetDrawlist(); ImGuizmo::SetRect(m_ViewPortBounds[0].x, m_ViewPortBounds[0].y, m_ViewPortBounds[1].x - m_ViewPortBounds[0].x, m_ViewPortBounds[1].y - m_ViewPortBounds[0].y); float windowWidth = (float)ImGui::GetWindowWidth(); float windowHeight = (float)ImGui::GetWindowHeight(); ImGuizmo::SetRect(ImGui::GetWindowPos().x, ImGui::GetWindowPos().y, windowWidth, windowHeight); const mat4& cameraProj = m_EditorCam.GetProjection(); mat4 cameraView = m_EditorCam.GetViewMatrix(); auto& tc = selectedEntity.GetComponent<TransformComponent>(); mat4 transform = tc.CalculateMatrix(); bool snap = Input::IsKeyPressed(Key::LeftControl); float snapValue = 0.25f; if (m_GizmoType == ImGuizmo::OPERATION::ROTATE) snapValue = 22.5f; float snapValues[3] = { snapValue, snapValue, snapValue }; ImGuizmo::Manipulate(value_ptr(cameraView), value_ptr(cameraProj), (ImGuizmo::OPERATION)m_GizmoType, ImGuizmo::LOCAL, value_ptr(transform), nullptr, snap ? snapValues : nullptr); if (ImGuizmo::IsUsing()) { vec3 translation, rotation, scale; DecomposeTransform(transform, translation, rotation, scale); vec3 deltaRotation = rotation - tc.Rotation; tc.Translation = translation; tc.Rotation += deltaRotation; tc.Scale = scale; } } } ImGui::End(); ImGui::PopStyleVar(); UI_Toolbar(); ImGui::End(); } void EditorLayer::UI_Toolbar() { ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 2)); ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, ImVec2(0, 0)); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); auto& colours = ImGui::GetStyle().Colors; const auto& buttonHovered = colours[ImGuiCol_ButtonHovered]; ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(buttonHovered.x, buttonHovered.y, buttonHovered.z, 0.5f)); const auto& buttonActive = colours[ImGuiCol_ButtonActive]; ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(buttonActive.x, buttonActive.y, buttonActive.z, 0.5f)); ImGui::Begin("##toolbar", nullptr, ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse); float size = ImGui::GetWindowHeight() - 4.0f; Ref<Texture2D> icon = m_SceneState == SceneState::Edit ? m_PlayIcon : m_StopIcon; ImGui::SetCursorPosX((ImGui::GetWindowContentRegionMax().x * 0.5f) - (size * 0.5f)); if (ImGui::ImageButton((ImTextureID)icon->GetRendererID(), ImVec2(size, size), ImVec2(0, 0), ImVec2(1, 1), 0)) { if (m_SceneState == SceneState::Edit) OnScenePlay(); else if (m_SceneState == SceneState::Play) OnSceneStop(); } ImGui::PopStyleVar(2); ImGui::PopStyleColor(3); ImGui::End(); } void EditorLayer::OnEvent(Event& e) { m_EditorCam.OnEvent(e); Dispatcher d(e); d.Dispatch<KeyPressedEvent>(BIND_EVENT(EditorLayer::OnKeyPressed)); d.Dispatch<MouseButtonPressedEvent>(BIND_EVENT(EditorLayer::OnMousePressed)); } bool EditorLayer::OnKeyPressed(KeyPressedEvent& e) { if (e.GetRepeatCount() > 0) return false; bool control = Input::IsKeyPressed(KeyCode::LeftControl) || Input::IsKeyPressed(KeyCode::RightControl); bool shift = Input::IsKeyPressed(KeyCode::LeftShift) || Input::IsKeyPressed(KeyCode::RightShift); switch (e.GetKeyCode()) { //Scene Saving/Loading case KeyCode::S: if (control && shift) SaveSceneAs(); break; case KeyCode::N: if (control) NewScene(); break; case KeyCode::O: if (control) LoadScene(); break; //Gizmos case KeyCode::Q: if (!m_UsingGizmo) m_GizmoType = -1; break; case KeyCode::W: if (!m_UsingGizmo) m_GizmoType = ImGuizmo::OPERATION::TRANSLATE; break; case KeyCode::E: if (!m_UsingGizmo) m_GizmoType = ImGuizmo::OPERATION::ROTATE; break; case KeyCode::R: if (!m_UsingGizmo) m_GizmoType = ImGuizmo::OPERATION::SCALE; break; } return true; } bool EditorLayer::OnMousePressed(MouseButtonPressedEvent& e) { if (e.GetMouseButton() == Mouse::Button0 && !m_UsingGizmo && m_GameViewHovered && m_SceneState == SceneState::Edit) m_SceneHierarchy.SetSelectedEntity(m_HoveredEntity); return false; } void EditorLayer::NewScene() { m_ActiveScene = CreateRef<Scene>(); m_ActiveScene->OnViewportResize((uint32_t)m_GameViewSize.x, (uint32_t)m_GameViewSize.y); m_SceneHierarchy.SetContext(m_ActiveScene); m_HoveredEntity = { }; } void EditorLayer::SaveSceneAs() { std::string filepath = FileDialogs::SaveFile("Nebula Scene (*.nebula)\0*.nebula\0"); std::string ending = ".nebula"; if (!equal(ending.rbegin(), ending.rend(), filepath.rbegin())) filepath += ending; if (!filepath.empty()) SceneSerializer(m_ActiveScene).Serialize(filepath); } void EditorLayer::LoadScene() { std::string filepath = FileDialogs::OpenFile("Nebula Scene (*.nebula)\0*.nebula\0"); if (!filepath.empty()) { LoadScene(filepath); } } void EditorLayer::LoadScene(const std::filesystem::path& path) { if (path.extension().string() != ".nebula") { NB_WARN("Could not load {0} - not a scene file", path.filename().string()); return; } Ref<Scene> empty = CreateRef<Scene>(); if (SceneSerializer(empty).Deserialize(path.string())) { m_ActiveScene = empty; m_ActiveScene->OnViewportResize((uint32_t)m_GameViewSize.x, (uint32_t)m_GameViewSize.y); m_SceneHierarchy.SetContext(m_ActiveScene); } } void EditorLayer::OnScenePlay() { m_SceneState = SceneState::Play; } void EditorLayer::OnSceneStop() { m_SceneState = SceneState::Edit; } }
31.553806
162
0.708451
GalacticKittenSS
8f4afcf80ff9c86669cef010ede171adf81acf63
48,325
hpp
C++
test/unittests/lib/validator/validate_Instr_Control_unittest.hpp
yuhao-kuo/WasmVM
b4dcd4f752f07ba4180dc275d47764c363776301
[ "BSD-3-Clause" ]
125
2018-10-22T19:00:25.000Z
2022-03-14T06:33:25.000Z
test/unittests/lib/validator/validate_Instr_Control_unittest.hpp
yuhao-kuo/WasmVM
b4dcd4f752f07ba4180dc275d47764c363776301
[ "BSD-3-Clause" ]
80
2018-10-18T06:35:07.000Z
2020-04-20T02:40:22.000Z
test/unittests/lib/validator/validate_Instr_Control_unittest.hpp
yuhao-kuo/WasmVM
b4dcd4f752f07ba4180dc275d47764c363776301
[ "BSD-3-Clause" ]
27
2018-11-04T12:05:35.000Z
2021-09-06T05:11:50.000Z
#include <skypat/skypat.h> #define _Bool bool extern "C" { #include <stdint.h> #include <stdlib.h> #include <dataTypes/Value.h> #include <dataTypes/vector_p.h> #include <dataTypes/stack_p.h> #include <dataTypes/FuncType.h> #include <structures/instrs/Control.h> #include <structures/WasmFunc.h> #include <structures/WasmTable.h> #include <structures/WasmModule.h> #include <Validates.h> #include <Opcodes.h> #include <Context.h> } #undef _Bool static void clean(stack_p opds, stack_p ctrls) { free_stack_p(opds); free_stack_p(ctrls); } SKYPAT_F(Validate_Instr_nop, valid) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_nop; // Check EXPECT_EQ(validate_Instr_nop(instr, context, opds, ctrls), 0); // Clean free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_block, valid) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_block; ValueType* resType1 = (ValueType*)malloc(sizeof(ValueType)); *resType1 = Value_i32; vector_push_back(instr->resultTypes, resType1); ValueType* resType2 = (ValueType*)malloc(sizeof(ValueType)); *resType2 = Value_i64; vector_push_back(instr->resultTypes, resType2); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_f32; stack_push(opds, opdType1); // Check EXPECT_EQ(validate_Instr_block(instr, context, opds, ctrls), 0); EXPECT_EQ(stack_size(ctrls), 2); ctrl_frame* frame = stack_top(ctrl_frame*, ctrls); EXPECT_EQ(vector_size(frame->label_types), 2); EXPECT_EQ(vector_size(frame->end_types), 2); // Clean free(resType2); free(resType1); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_loop, valid) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_loop; ValueType* resType1 = (ValueType*)malloc(sizeof(ValueType)); *resType1 = Value_i32; vector_push_back(instr->resultTypes, resType1); ValueType* resType2 = (ValueType*)malloc(sizeof(ValueType)); *resType2 = Value_i64; vector_push_back(instr->resultTypes, resType2); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_f32; stack_push(opds, opdType1); // Check EXPECT_EQ(validate_Instr_loop(instr, context, opds, ctrls), 0); EXPECT_EQ(stack_size(ctrls), 2); ctrl_frame* frame = stack_top(ctrl_frame*, ctrls); EXPECT_EQ(vector_size(frame->label_types), 0); EXPECT_EQ(vector_size(frame->end_types), 2); // Clean free(resType2); free(resType1); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_if, no_enough_operand) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_if; ValueType* resType1 = (ValueType*)malloc(sizeof(ValueType)); *resType1 = Value_i32; vector_push_back(instr->resultTypes, resType1); ValueType* resType2 = (ValueType*)malloc(sizeof(ValueType)); *resType2 = Value_i64; vector_push_back(instr->resultTypes, resType2); // Check EXPECT_EQ(validate_Instr_if(instr, context, opds, ctrls), -1); // Clean free(resType2); free(resType1); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_if, wrong_type_of_operand) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_if; ValueType* resType1 = (ValueType*)malloc(sizeof(ValueType)); *resType1 = Value_i32; vector_push_back(instr->resultTypes, resType1); ValueType* resType2 = (ValueType*)malloc(sizeof(ValueType)); *resType2 = Value_i64; vector_push_back(instr->resultTypes, resType2); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); ValueType* opdType2 = (ValueType*)malloc(sizeof(ValueType)); *opdType2 = Value_f32; stack_push(opds, opdType2); // Check EXPECT_EQ(validate_Instr_if(instr, context, opds, ctrls), -1); // Clean free(resType2); free(resType1); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_if, valid) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_if; ValueType* resType1 = (ValueType*)malloc(sizeof(ValueType)); *resType1 = Value_i32; vector_push_back(instr->resultTypes, resType1); ValueType* resType2 = (ValueType*)malloc(sizeof(ValueType)); *resType2 = Value_i64; vector_push_back(instr->resultTypes, resType2); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); // Check EXPECT_EQ(validate_Instr_if(instr, context, opds, ctrls), 0); EXPECT_EQ(stack_size(ctrls), 2); ctrl_frame* frame = stack_top(ctrl_frame*, ctrls); EXPECT_EQ(vector_size(frame->label_types), 2); EXPECT_EQ(vector_size(frame->end_types), 2); // Clean free(resType2); free(resType1); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_end, valid) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); ctrl_frame* frame = new_ctrl_frame(opds); ValueType* endType1 = (ValueType*)malloc(sizeof(ValueType)); *endType1 = Value_i32; vector_push_back(frame->end_types, endType1); ValueType* endType2 = (ValueType*)malloc(sizeof(ValueType)); *endType2 = Value_f32; vector_push_back(frame->end_types, endType2); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_end; ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); ValueType* opdType2 = (ValueType*)malloc(sizeof(ValueType)); *opdType2 = Value_f32; stack_push(opds, opdType2); // Check EXPECT_EQ(validate_Instr_end(instr, context, opds, ctrls), 0); EXPECT_EQ(stack_size(ctrls), 0); EXPECT_EQ(stack_size(opds), 2); // Clean free(endType2); free(endType1); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_end, no_frame_to_end) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_end; ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); ValueType* opdType2 = (ValueType*)malloc(sizeof(ValueType)); *opdType2 = Value_f32; stack_push(opds, opdType2); // Check EXPECT_EQ(validate_Instr_end(instr, context, opds, ctrls), -1); // Clean free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_end, no_enough_operand) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); ctrl_frame* frame = new_ctrl_frame(opds); ValueType* endType1 = (ValueType*)malloc(sizeof(ValueType)); *endType1 = Value_i32; vector_push_back(frame->end_types, endType1); ValueType* endType2 = (ValueType*)malloc(sizeof(ValueType)); *endType2 = Value_f32; vector_push_back(frame->end_types, endType2); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_end; ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); // Check EXPECT_EQ(validate_Instr_end(instr, context, opds, ctrls), -2); // Clean free(endType2); free(endType1); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_end, too_much_operand) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); ctrl_frame* frame = new_ctrl_frame(opds); ValueType* endType1 = (ValueType*)malloc(sizeof(ValueType)); *endType1 = Value_i32; vector_push_back(frame->end_types, endType1); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_end; ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_f32; stack_push(opds, opdType1); ValueType* opdType2 = (ValueType*)malloc(sizeof(ValueType)); *opdType2 = Value_i32; stack_push(opds, opdType2); // Check EXPECT_EQ(validate_Instr_end(instr, context, opds, ctrls), -3); // Clean free_WasmControlInstr(instr); free(endType1); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_else, valid) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); ctrl_frame* frame = new_ctrl_frame(opds); ValueType* endType1 = (ValueType*)malloc(sizeof(ValueType)); *endType1 = Value_i32; vector_push_back(frame->end_types, endType1); ValueType* endType2 = (ValueType*)malloc(sizeof(ValueType)); *endType2 = Value_f32; vector_push_back(frame->end_types, endType2); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_else; ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); ValueType* opdType2 = (ValueType*)malloc(sizeof(ValueType)); *opdType2 = Value_f32; stack_push(opds, opdType2); // Check EXPECT_EQ(validate_Instr_else(instr, context, opds, ctrls), 0); EXPECT_EQ(stack_size(ctrls), 1); EXPECT_EQ(stack_size(opds), 0); // Clean free(endType2); free(endType1); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_else, no_frame_to_end) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_else; ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); ValueType* opdType2 = (ValueType*)malloc(sizeof(ValueType)); *opdType2 = Value_f32; stack_push(opds, opdType2); // Check EXPECT_EQ(validate_Instr_else(instr, context, opds, ctrls), -1); // Clean free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_else, no_enough_operand) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); ctrl_frame* frame = new_ctrl_frame(opds); ValueType* endType1 = (ValueType*)malloc(sizeof(ValueType)); *endType1 = Value_i32; vector_push_back(frame->end_types, endType1); ValueType* endType2 = (ValueType*)malloc(sizeof(ValueType)); *endType2 = Value_f32; vector_push_back(frame->end_types, endType2); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_else; ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); // Check EXPECT_EQ(validate_Instr_else(instr, context, opds, ctrls), -2); // Clean free_WasmControlInstr(instr); free(endType2); free(endType1); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_else, too_much_operand) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); ctrl_frame* frame = new_ctrl_frame(opds); ValueType* endType1 = (ValueType*)malloc(sizeof(ValueType)); *endType1 = Value_i32; vector_push_back(frame->end_types, endType1); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_else; ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_f32; stack_push(opds, opdType1); ValueType* opdType2 = (ValueType*)malloc(sizeof(ValueType)); *opdType2 = Value_i32; stack_push(opds, opdType2); // Check EXPECT_EQ(validate_Instr_end(instr, context, opds, ctrls), -3); // Clean free_WasmControlInstr(instr); free(endType1); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_br, valid) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 0; vector_push_back(instr->indices, index); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); ValueType* labelType1 = (ValueType*)malloc(sizeof(ValueType)); *labelType1 = Value_i32; vector_push_back(frame->label_types, labelType1); vector_push_back(frame->end_types, labelType1); // Check EXPECT_EQ(validate_Instr_br(instr, context, opds, ctrls), 0); EXPECT_TRUE(frame->unreachable); EXPECT_EQ(stack_size(opds), 0); // Clean free(labelType1); free_WasmControlInstr(instr); free(index); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_br, index_out_of_range) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 2; vector_push_back(instr->indices, index); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); ValueType* labelType1 = (ValueType*)malloc(sizeof(ValueType)); *labelType1 = Value_i32; vector_push_back(frame->label_types, labelType1); vector_push_back(frame->end_types, labelType1); // Check EXPECT_EQ(validate_Instr_br(instr, context, opds, ctrls), -1); // Clean free(labelType1); free_WasmControlInstr(instr); free(index); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_br, no_enough_operand) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 0; vector_push_back(instr->indices, index); ValueType* labelType1 = (ValueType*)malloc(sizeof(ValueType)); *labelType1 = Value_i32; vector_push_back(frame->label_types, labelType1); vector_push_back(frame->end_types, labelType1); // Check EXPECT_EQ(validate_Instr_br(instr, context, opds, ctrls), -2); // Clean free(labelType1); free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_br_if, valid) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br_if; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 0; vector_push_back(instr->indices, index); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_f32; stack_push(opds, opdType1); ValueType* opdType2 = (ValueType*)malloc(sizeof(ValueType)); *opdType2 = Value_i32; stack_push(opds, opdType2); ValueType* labelType1 = (ValueType*)malloc(sizeof(ValueType)); *labelType1 = Value_f32; vector_push_back(frame->label_types, labelType1); vector_push_back(frame->end_types, labelType1); // Check EXPECT_EQ(validate_Instr_br_if(instr, context, opds, ctrls), 0); EXPECT_FALSE(frame->unreachable); EXPECT_EQ(stack_size(opds), 1); // Clean free(labelType1); free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_br_if, index_out_of_range) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br_if; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 2; vector_push_back(instr->indices, index); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); // Check EXPECT_EQ(validate_Instr_br_if(instr, context, opds, ctrls), -1); // Clean free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(validate_Instr_br_if, no_condition_operand) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br_if; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 0; vector_push_back(instr->indices, index); // Check EXPECT_EQ(validate_Instr_br_if(instr, context, opds, ctrls), -2); // Clean free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_br_if, no_enough_operand) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br_if; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 0; vector_push_back(instr->indices, index); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); ValueType* labelType1 = (ValueType*)malloc(sizeof(ValueType)); *labelType1 = Value_f32; vector_push_back(frame->label_types, labelType1); vector_push_back(frame->end_types, labelType1); // Check EXPECT_EQ(validate_Instr_br_if(instr, context, opds, ctrls), -3); // Clean free(labelType1); free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(validate_Instr_br_table, valid) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br_table; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 2; vector_push_back(instr->indices, index); *index = 0; vector_push_back(instr->indices, index); *index = 1; vector_push_back(instr->indices, index); ValueType* labelType = (ValueType*)malloc(sizeof(ValueType)); *labelType = Value_f32; vector_push_back(frame->label_types, labelType); vector_push_back(frame->end_types, labelType); ctrl_frame* frame1 = new_ctrl_frame(opds); stack_push(ctrls, frame1); *labelType = Value_f32; vector_push_back(frame1->label_types, labelType); vector_push_back(frame1->end_types, labelType); ctrl_frame* frame2 = new_ctrl_frame(opds); stack_push(ctrls, frame2); *labelType = Value_f32; vector_push_back(frame2->label_types, labelType); vector_push_back(frame2->end_types, labelType); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_f32; stack_push(opds, opdType1); ValueType* opdType2 = (ValueType*)malloc(sizeof(ValueType)); *opdType2 = Value_i32; stack_push(opds, opdType2); // Check EXPECT_EQ(validate_Instr_br_table(instr, context, opds, ctrls), 0); EXPECT_TRUE(frame2->unreachable); // Clean free(labelType); free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(validate_Instr_br_table, index_out_of_range) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br_table; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 2; vector_push_back(instr->indices, index); *index = 0; vector_push_back(instr->indices, index); *index = 5; vector_push_back(instr->indices, index); ValueType* labelType = (ValueType*)malloc(sizeof(ValueType)); *labelType = Value_f32; vector_push_back(frame->label_types, labelType); vector_push_back(frame->end_types, labelType); ctrl_frame* frame1 = new_ctrl_frame(opds); stack_push(ctrls, frame1); *labelType = Value_f32; vector_push_back(frame1->label_types, labelType); vector_push_back(frame1->end_types, labelType); ctrl_frame* frame2 = new_ctrl_frame(opds); stack_push(ctrls, frame2); *labelType = Value_f32; vector_push_back(frame2->label_types, labelType); vector_push_back(frame2->end_types, labelType); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_f32; stack_push(opds, opdType1); ValueType* opdType2 = (ValueType*)malloc(sizeof(ValueType)); *opdType2 = Value_i32; stack_push(opds, opdType2); // Check EXPECT_EQ(validate_Instr_br_table(instr, context, opds, ctrls), -1); // Clean free(labelType); free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(validate_Instr_br_table, index_in_table_out_of_range) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br_table; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 2; vector_push_back(instr->indices, index); *index = 5; vector_push_back(instr->indices, index); *index = 1; vector_push_back(instr->indices, index); ValueType* labelType = (ValueType*)malloc(sizeof(ValueType)); *labelType = Value_f32; vector_push_back(frame->label_types, labelType); vector_push_back(frame->end_types, labelType); ctrl_frame* frame1 = new_ctrl_frame(opds); stack_push(ctrls, frame1); *labelType = Value_f32; vector_push_back(frame1->label_types, labelType); vector_push_back(frame1->end_types, labelType); ctrl_frame* frame2 = new_ctrl_frame(opds); stack_push(ctrls, frame2); *labelType = Value_f32; vector_push_back(frame2->label_types, labelType); vector_push_back(frame2->end_types, labelType); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_f32; stack_push(opds, opdType1); ValueType* opdType2 = (ValueType*)malloc(sizeof(ValueType)); *opdType2 = Value_i32; stack_push(opds, opdType2); // Check EXPECT_EQ(validate_Instr_br_table(instr, context, opds, ctrls), -2); // Clean free(labelType); free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(validate_Instr_br_table, other_frame_no_enough_label) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br_table; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 2; vector_push_back(instr->indices, index); *index = 0; vector_push_back(instr->indices, index); *index = 1; vector_push_back(instr->indices, index); ValueType* labelType = (ValueType*)malloc(sizeof(ValueType)); *labelType = Value_f32; vector_push_back(frame->label_types, labelType); vector_push_back(frame->end_types, labelType); ctrl_frame* frame1 = new_ctrl_frame(opds); stack_push(ctrls, frame1); *labelType = Value_f32; vector_push_back(frame1->label_types, labelType); vector_push_back(frame1->end_types, labelType); *labelType = Value_f64; vector_push_back(frame1->label_types, labelType); vector_push_back(frame1->end_types, labelType); ctrl_frame* frame2 = new_ctrl_frame(opds); stack_push(ctrls, frame2); *labelType = Value_f32; vector_push_back(frame2->label_types, labelType); vector_push_back(frame2->end_types, labelType); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_f32; stack_push(opds, opdType1); ValueType* opdType2 = (ValueType*)malloc(sizeof(ValueType)); *opdType2 = Value_i32; stack_push(opds, opdType2); // Check EXPECT_EQ(validate_Instr_br_table(instr, context, opds, ctrls), -3); // Clean free(labelType); free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(validate_Instr_br_table, other_frame_wrong_type_label) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br_table; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 2; vector_push_back(instr->indices, index); *index = 0; vector_push_back(instr->indices, index); *index = 1; vector_push_back(instr->indices, index); ValueType* labelType = (ValueType*)malloc(sizeof(ValueType)); *labelType = Value_f32; vector_push_back(frame->label_types, labelType); vector_push_back(frame->end_types, labelType); ctrl_frame* frame1 = new_ctrl_frame(opds); stack_push(ctrls, frame1); *labelType = Value_f32; vector_push_back(frame1->label_types, labelType); vector_push_back(frame1->end_types, labelType); ctrl_frame* frame2 = new_ctrl_frame(opds); stack_push(ctrls, frame2); *labelType = Value_f64; vector_push_back(frame2->label_types, labelType); vector_push_back(frame2->end_types, labelType); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_f32; stack_push(opds, opdType1); ValueType* opdType2 = (ValueType*)malloc(sizeof(ValueType)); *opdType2 = Value_i32; stack_push(opds, opdType2); // Check EXPECT_EQ(validate_Instr_br_table(instr, context, opds, ctrls), -4); // Clean free(labelType); free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(validate_Instr_br_table, no_enough_operand) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br_table; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 2; vector_push_back(instr->indices, index); *index = 0; vector_push_back(instr->indices, index); *index = 1; vector_push_back(instr->indices, index); ValueType* labelType = (ValueType*)malloc(sizeof(ValueType)); *labelType = Value_f32; vector_push_back(frame->label_types, labelType); vector_push_back(frame->end_types, labelType); ctrl_frame* frame1 = new_ctrl_frame(opds); stack_push(ctrls, frame1); *labelType = Value_f32; vector_push_back(frame1->label_types, labelType); vector_push_back(frame1->end_types, labelType); ctrl_frame* frame2 = new_ctrl_frame(opds); stack_push(ctrls, frame2); *labelType = Value_f32; vector_push_back(frame2->label_types, labelType); vector_push_back(frame2->end_types, labelType); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_f32; stack_push(opds, opdType1); // Check EXPECT_EQ(validate_Instr_br_table(instr, context, opds, ctrls), -5); // Clean free(labelType); free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(validate_Instr_br_table, no_enough_label) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br_table; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 2; vector_push_back(instr->indices, index); *index = 0; vector_push_back(instr->indices, index); *index = 1; vector_push_back(instr->indices, index); ValueType* labelType = (ValueType*)malloc(sizeof(ValueType)); *labelType = Value_f32; vector_push_back(frame->label_types, labelType); vector_push_back(frame->end_types, labelType); ctrl_frame* frame1 = new_ctrl_frame(opds); stack_push(ctrls, frame1); *labelType = Value_f32; vector_push_back(frame1->label_types, labelType); vector_push_back(frame1->end_types, labelType); ctrl_frame* frame2 = new_ctrl_frame(opds); stack_push(ctrls, frame2); *labelType = Value_f32; vector_push_back(frame2->label_types, labelType); vector_push_back(frame2->end_types, labelType); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); // Check EXPECT_EQ(validate_Instr_br_table(instr, context, opds, ctrls), -6); // Clean free(index); free(labelType); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(validate_Instr_return, valid) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_return; // Check EXPECT_EQ(validate_Instr_return(instr, context, opds, ctrls), 0); // Clean free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmModule(module); } SKYPAT_F(validate_Instr_call, valid) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func1 = new_WasmFunc(); func1->type = 0; vector_push_back(module->funcs, func1); WasmFunc* func2 = new_WasmFunc(); func2->type = 0; vector_push_back(module->funcs, func2); FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func1); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_call; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 0; vector_push_back(instr->indices, index); // Check EXPECT_EQ(validate_Instr_call(instr, context, opds, ctrls), 0); // Clean free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmModule(module); } SKYPAT_F(validate_Instr_call, index_out_of_range) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func1 = new_WasmFunc(); func1->type = 0; vector_push_back(module->funcs, func1); WasmFunc* func2 = new_WasmFunc(); func2->type = 0; vector_push_back(module->funcs, func2); FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func1); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_call; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 2; vector_push_back(instr->indices, index); // Check EXPECT_EQ(validate_Instr_call(instr, context, opds, ctrls), -1); // Clean free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmModule(module); } SKYPAT_F(validate_Instr_call_indirect, valid) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func1 = new_WasmFunc(); func1->type = 0; vector_push_back(module->funcs, func1); FuncType type = new_FuncType(); vector_push_back(module->types, type); WasmTable* table = (WasmTable*) malloc(sizeof(WasmTable)); table->min = 0; table->max = 1; vector_push_back(module->tables, table); Context* context = new_Context(module, func1); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_call_indirect; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 0; vector_push_back(instr->indices, index); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); // Check EXPECT_EQ(validate_Instr_call_indirect(instr, context, opds, ctrls), 0); // Clean free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmModule(module); } SKYPAT_F(validate_Instr_call_indirect, no_table) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func1 = new_WasmFunc(); func1->type = 0; vector_push_back(module->funcs, func1); FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func1); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_call_indirect; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 0; vector_push_back(instr->indices, index); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); // Check EXPECT_EQ(validate_Instr_call_indirect(instr, context, opds, ctrls), -1); // Clean free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmModule(module); } SKYPAT_F(validate_Instr_call_indirect, index_out_of_range) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func1 = new_WasmFunc(); func1->type = 0; vector_push_back(module->funcs, func1); FuncType type = new_FuncType(); vector_push_back(module->types, type); WasmTable* table = (WasmTable*) malloc(sizeof(WasmTable)); table->min = 0; table->max = 1; vector_push_back(module->tables, table); Context* context = new_Context(module, func1); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_call_indirect; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 1; vector_push_back(instr->indices, index); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); // Check EXPECT_EQ(validate_Instr_call_indirect(instr, context, opds, ctrls), -2); // Clean free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmModule(module); } SKYPAT_F(validate_Instr_call_indirect, no_enough_operand) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func1 = new_WasmFunc(); func1->type = 0; vector_push_back(module->funcs, func1); FuncType type = new_FuncType(); vector_push_back(module->types, type); WasmTable* table = (WasmTable*) malloc(sizeof(WasmTable)); table->min = 0; table->max = 1; vector_push_back(module->tables, table); Context* context = new_Context(module, func1); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_call_indirect; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 0; vector_push_back(instr->indices, index); // Check EXPECT_EQ(validate_Instr_call_indirect(instr, context, opds, ctrls), -4); // Clean free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmModule(module); }
31.750986
77
0.691278
yuhao-kuo
8f4cfc93e5f38c6b768bad606f7860ce54e1022f
3,311
cpp
C++
src/GVis/RenderTextureTarget.cpp
matthew-reid/Graphtane
3148039993da185cfb328f89b96c9e5a5b384197
[ "MIT" ]
38
2015-01-01T05:55:38.000Z
2022-03-12T23:19:50.000Z
src/GVis/RenderTextureTarget.cpp
matthew-reid/Graphtane
3148039993da185cfb328f89b96c9e5a5b384197
[ "MIT" ]
1
2019-07-29T21:48:40.000Z
2020-01-13T12:08:08.000Z
src/GVis/RenderTextureTarget.cpp
matthew-reid/Graphtane
3148039993da185cfb328f89b96c9e5a5b384197
[ "MIT" ]
8
2016-04-22T06:41:47.000Z
2021-11-23T23:44:22.000Z
// Copyright (c) 2013-2014 Matthew Paul Reid // 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 "RenderTextureTarget.h" #include "Texture.h" #include "Convert.h" #include <stdexcept> namespace GVis { RenderTextureTarget::RenderTextureTarget(const RenderTextureTargetConfig& config) : m_texture(config.texture), m_techniqueCategory(config.techniqueCategory), m_depthBuffer(0), m_colorAttachmentCount(0) { glGenFramebuffers(1, &m_framebuffer); glBindFramebuffer(GL_FRAMEBUFFER, m_framebuffer); // Create depth buffer if (config.attachment == FrameBufferAttachment_Color) { glGenRenderbuffers(1, &m_depthBuffer); glBindRenderbuffer(GL_RENDERBUFFER, m_depthBuffer); glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, config.texture->getWidth(), config.texture->getHeight()); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthBuffer); } glFramebufferTexture(GL_FRAMEBUFFER, toGlFrameBufferAttachment(config.attachment), config.texture->_getGlTextureId(), 0); switch(config.attachment) { case FrameBufferAttachment_Color: glDrawBuffer(GL_COLOR_ATTACHMENT0); ++m_colorAttachmentCount; break; case FrameBufferAttachment_Depth: glDrawBuffer(GL_NONE); // No color buffer is drawn to. break; } if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { throw std::runtime_error("Could not create RenderTextureTarget"); } } RenderTextureTarget::~RenderTextureTarget() { if (m_depthBuffer) glDeleteRenderbuffers(1, &m_depthBuffer); glDeleteFramebuffers(1, &m_framebuffer); } void RenderTextureTarget::addColorAttachment(const Texture& texture) { glBindFramebuffer(GL_FRAMEBUFFER, m_framebuffer); glFramebufferTexture(GL_FRAMEBUFFER, toGlFrameBufferAttachment(FrameBufferAttachment_Color) + m_colorAttachmentCount, texture._getGlTextureId(), 0); ++m_colorAttachmentCount; std::vector<GLenum> buffers; for (int i = 0; i < m_colorAttachmentCount; ++i) { buffers.push_back(GL_COLOR_ATTACHMENT0_EXT + i); } assert(!buffers.empty()); glDrawBuffers(m_colorAttachmentCount, &buffers[0]); } int RenderTextureTarget::getWidth() const { return m_texture->getWidth(); } int RenderTextureTarget::getHeight() const { return m_texture->getHeight(); } } // namespace GVis
33.11
149
0.783449
matthew-reid
8f4e9848506820c86aaf976a1fd9f58a01caa48d
9,447
cc
C++
src/scripting-v8.cc
h0x91b/redis
76b25a2546ed457265df32bee905006eafbad0e5
[ "BSD-3-Clause" ]
null
null
null
src/scripting-v8.cc
h0x91b/redis
76b25a2546ed457265df32bee905006eafbad0e5
[ "BSD-3-Clause" ]
null
null
null
src/scripting-v8.cc
h0x91b/redis
76b25a2546ed457265df32bee905006eafbad0e5
[ "BSD-3-Clause" ]
null
null
null
#include "scripting-v8.h" extern "C" { #include "server.h" #include "cluster.h" } #include <stdio.h> #include <stdlib.h> #include <string.h> #include "libplatform/libplatform.h" #include "v8.h" #include "../deps/hiredis/hiredis.h" using namespace v8; v8::Platform* platform; sds wrapped_script; Isolate* isolate; class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { public: virtual void* Allocate(size_t length) { void* data = AllocateUninitialized(length); return data == NULL ? data : memset(data, 0, length); } virtual void* AllocateUninitialized(size_t length) { return zmalloc(length); } virtual void Free(void* data, size_t) { zfree(data); } }; void redisLog(const v8::FunctionCallbackInfo<v8::Value>& args) { serverLog(LL_NOTICE, "V8 redisLog()"); for (int i = 0; i < args.Length(); i++) { v8::HandleScope handle_scope(args.GetIsolate()); v8::String::Utf8Value str( args[i]->ToString() ); serverLogRaw(LL_NOTICE, *str); } } Local<Value> parseResponse(redisReply *reply) { EscapableHandleScope scope(isolate); Local<Value> resp; Local<Array> arr = Array::New(isolate); switch(reply->type) { case REDIS_REPLY_NIL: resp = Null(isolate); break; case REDIS_REPLY_INTEGER: resp = Integer::New(isolate, reply->integer); break; case REDIS_REPLY_STATUS: case REDIS_REPLY_STRING: resp = String::NewFromUtf8(isolate, reply->str, v8::NewStringType::kNormal, reply->len).ToLocalChecked(); break; case REDIS_REPLY_ARRAY: for (size_t i=0; i<reply->elements; i++) { arr->Set(Integer::New(isolate, i), parseResponse(reply->element[i])); } resp = arr; break; default: serverLog(LL_WARNING, "Redis rotocol error, unknown type %d\n", reply->type); } return scope.Escape(resp); } void redisCall(const v8::FunctionCallbackInfo<v8::Value>& args) { //printf("redisCall %d args\n", args.Length()); HandleScope handle_scope(isolate); client *c = server.v8_client; sds reply = NULL; int reply_len = 0; struct redisCommand *cmd; static robj **argv = NULL; static int argv_size = 0; int argc = args.Length(); redisReader *reader = redisReaderCreate(); redisReply *redisReaderResponse = NULL; v8::Handle<v8::Value> ret_value; int call_flags = CMD_CALL_SLOWLOG | CMD_CALL_STATS; if (argv_size < argc) { argv = (robj **)zrealloc(argv,sizeof(robj*)*argc); argv_size = argc; } for (int i = 0; i < args.Length(); i++) { v8::HandleScope handle_scope(isolate); v8::String::Utf8Value str( args[i]->ToString() ); argv[i] = createStringObject(*str, str.length()); } c->argv = argv; c->argc = argc; /* If this is a Redis Cluster node, we need to make sure Lua is not * trying to access non-local keys, with the exception of commands * received from our master. */ if (server.cluster_enabled && !(server.v8_caller->flags & CLIENT_MASTER)) { /* Duplicate relevant flags in the lua client. */ c->flags &= ~(CLIENT_READONLY|CLIENT_ASKING); c->flags |= server.v8_caller->flags & (CLIENT_READONLY|CLIENT_ASKING); if (getNodeByQuery(c,c->cmd,c->argv,c->argc,NULL,NULL) != server.cluster->myself) { args.GetReturnValue().Set(Exception::Error( v8::String::NewFromUtf8(isolate, "Lua script attempted to access a non local key in a cluster node", v8::NewStringType::kNormal).ToLocalChecked() )); goto cleanup; } } cmd = lookupCommand((sds)argv[0]->ptr); if (!cmd || ((cmd->arity > 0 && cmd->arity != argc) || (argc < -cmd->arity))) { if (cmd) { args.GetReturnValue().Set(Exception::Error( v8::String::NewFromUtf8(isolate, "Wrong number of args calling Redis command From Lua script", v8::NewStringType::kNormal).ToLocalChecked() )); } else { args.GetReturnValue().Set(Exception::Error( v8::String::NewFromUtf8(isolate, "Unknown Redis command called from Lua script", v8::NewStringType::kNormal).ToLocalChecked() )); } goto cleanup; } c->cmd = c->lastcmd = cmd; if (cmd->flags & CMD_NOSCRIPT) { args.GetReturnValue().Set(Exception::Error( v8::String::NewFromUtf8(isolate, "This Redis command is not allowed from scripts", v8::NewStringType::kNormal).ToLocalChecked() )); goto cleanup; } call(c, call_flags); /* Convert the result of the Redis command into a suitable Lua type. * The first thing we need is to create a single string from the client * output buffers. */ if (listLength(c->reply) == 0 && c->bufpos < PROTO_REPLY_CHUNK_BYTES) { /* This is a fast path for the common case of a reply inside the * client static buffer. Don't create an SDS string but just use * the client buffer directly. */ reply_len = c->bufpos; c->buf[c->bufpos] = '\0'; reply = c->buf; c->bufpos = 0; } else { reply_len = c->bufpos; reply = sdsnewlen(c->buf,c->bufpos); c->bufpos = 0; while(listLength(c->reply)) { sds o = (sds)listNodeValue(listFirst(c->reply)); reply_len += sdslen(o); reply = sdscatsds(reply,o); listDelNode(c->reply,listFirst(c->reply)); } } //printf("reply: `%s`\n", reply); redisReaderFeed(reader, reply, reply_len); redisReaderGetReply(reader, (void**)&redisReaderResponse); if(redisReaderResponse->type == REDIS_REPLY_ERROR) { serverLog(LL_WARNING, "reply error %s", redisReaderResponse->str); args.GetReturnValue().Set(Exception::Error( v8::String::NewFromUtf8(isolate, redisReaderResponse->str, v8::NewStringType::kNormal, redisReaderResponse->len).ToLocalChecked() )); goto cleanup; } else { ret_value = parseResponse(redisReaderResponse); } args.GetReturnValue().Set(ret_value); cleanup: if(redisReaderResponse != NULL) freeReplyObject(redisReaderResponse); redisReaderFree(reader); for (int j = 0; j < c->argc; j++) { robj *o = c->argv[j]; decrRefCount(o); } if (c->argv != argv) { zfree(c->argv); argv = NULL; argv_size = 0; } if(reply != NULL && reply != c->buf) sdsfree(reply); } void initV8() { // Initialize V8. V8::InitializeICU(); // V8::InitializeExternalStartupData(""); ::platform = v8::platform::CreateDefaultPlatform(); V8::InitializePlatform(::platform); V8::Initialize(); wrapped_script = sdsempty(); ArrayBufferAllocator allocator; Isolate::CreateParams create_params; create_params.array_buffer_allocator = &allocator; isolate = Isolate::New(create_params); serverLog(LL_WARNING,"V8 initialized"); } void shutdownV8() { isolate->Dispose(); V8::Dispose(); V8::ShutdownPlatform(); delete ::platform; sdsfree(wrapped_script); serverLog(LL_WARNING,"V8 destroyed"); } void jsEvalCommand(client *c) { Isolate::Scope isolate_scope(isolate); HandleScope handle_scope(isolate); server.v8_caller = c; server.v8_time_start = mstime(); v8::Local<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate); global->Set( v8::String::NewFromUtf8(isolate, "log", v8::NewStringType::kNormal).ToLocalChecked(), v8::FunctionTemplate::New(isolate, redisLog) ); global->Set( v8::String::NewFromUtf8(isolate, "redisCall", v8::NewStringType::kNormal).ToLocalChecked(), v8::FunctionTemplate::New(isolate, redisCall) ); Local<Context> context = Context::New(isolate, NULL, global); Context::Scope context_scope(context); //flush previous data wrapped_script[0] = '\0'; sdsupdatelen(wrapped_script); wrapped_script = sdscatlen(wrapped_script, "JSON.stringify((function wrap(){\n", 33); wrapped_script = sdscatlen(wrapped_script, (const char*)c->argv[1]->ptr, sdslen((const sds)c->argv[1]->ptr)); wrapped_script = sdscatlen(wrapped_script, "\n})(), null, '\\t');", 19); Local<String> source = String::NewFromUtf8( isolate, wrapped_script, NewStringType::kNormal, sdslen((const sds)c->argv[1]->ptr) + 33 + 19 ).ToLocalChecked(); TryCatch trycatch(isolate); Local<Script> script; if(!Script::Compile(context, source).ToLocal(&script)) { String::Utf8Value error(trycatch.Exception()); serverLog(LL_WARNING, "JS Compile exception %s\n", *error); addReplyErrorFormat(c, "JS Compile exception %s", *error); return; } Local<Value> result; if(!script->Run(context).ToLocal(&result)) { String::Utf8Value error(trycatch.Exception()); serverLog(LL_WARNING, "JS Runtime exception %s\n", *error); addReplyErrorFormat(c, "JS Runtime exception %s", *error); } else { String::Utf8Value utf8(result); robj *o; o = createObject(OBJ_STRING,sdsnew(*utf8)); addReplyBulk(c,o); decrRefCount(o); } }
33.264085
160
0.614057
h0x91b
8f5043e17e6c193b0aa74680cf975a43c80b2b56
89,815
hpp
C++
Blocks/Game/Assets/bh22.hpp
salindersidhu/Blocks
b36c916717873cf43e61afb4e978d65025953a33
[ "MIT" ]
5
2018-06-16T06:54:59.000Z
2021-12-23T15:24:42.000Z
Blocks/Game/Assets/bh22.hpp
salindersidhu/Blocks
b36c916717873cf43e61afb4e978d65025953a33
[ "MIT" ]
1
2016-01-15T08:04:18.000Z
2016-01-15T08:04:18.000Z
Blocks/Game/Assets/bh22.hpp
SalinderSidhu/Blocks
b36c916717873cf43e61afb4e978d65025953a33
[ "MIT" ]
null
null
null
#ifndef BH22_HPP #define BH22_HPP static const unsigned char bh22[] = { 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x39, 0x08, 0x06, 0x00, 0x00, 0x00, 0x15, 0xCC, 0x98, 0x75, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0B, 0x13, 0x00, 0x00, 0x0B, 0x13, 0x01, 0x00, 0x9A, 0x9C, 0x18, 0x00, 0x00, 0x0A, 0x4F, 0x69, 0x43, 0x43, 0x50, 0x50, 0x68, 0x6F, 0x74, 0x6F, 0x73, 0x68, 0x6F, 0x70, 0x20, 0x49, 0x43, 0x43, 0x20, 0x70, 0x72, 0x6F, 0x66, 0x69, 0x6C, 0x65, 0x00, 0x00, 0x78, 0xDA, 0x9D, 0x53, 0x67, 0x54, 0x53, 0xE9, 0x16, 0x3D, 0xF7, 0xDE, 0xF4, 0x42, 0x4B, 0x88, 0x80, 0x94, 0x4B, 0x6F, 0x52, 0x15, 0x08, 0x20, 0x52, 0x42, 0x8B, 0x80, 0x14, 0x91, 0x26, 0x2A, 0x21, 0x09, 0x10, 0x4A, 0x88, 0x21, 0xA1, 0xD9, 0x15, 0x51, 0xC1, 0x11, 0x45, 0x45, 0x04, 0x1B, 0xC8, 0xA0, 0x88, 0x03, 0x8E, 0x8E, 0x80, 0x8C, 0x15, 0x51, 0x2C, 0x0C, 0x8A, 0x0A, 0xD8, 0x07, 0xE4, 0x21, 0xA2, 0x8E, 0x83, 0xA3, 0x88, 0x8A, 0xCA, 0xFB, 0xE1, 0x7B, 0xA3, 0x6B, 0xD6, 0xBC, 0xF7, 0xE6, 0xCD, 0xFE, 0xB5, 0xD7, 0x3E, 0xE7, 0xAC, 0xF3, 0x9D, 0xB3, 0xCF, 0x07, 0xC0, 0x08, 0x0C, 0x96, 0x48, 0x33, 0x51, 0x35, 0x80, 0x0C, 0xA9, 0x42, 0x1E, 0x11, 0xE0, 0x83, 0xC7, 0xC4, 0xC6, 0xE1, 0xE4, 0x2E, 0x40, 0x81, 0x0A, 0x24, 0x70, 0x00, 0x10, 0x08, 0xB3, 0x64, 0x21, 0x73, 0xFD, 0x23, 0x01, 0x00, 0xF8, 0x7E, 0x3C, 0x3C, 0x2B, 0x22, 0xC0, 0x07, 0xBE, 0x00, 0x01, 0x78, 0xD3, 0x0B, 0x08, 0x00, 0xC0, 0x4D, 0x9B, 0xC0, 0x30, 0x1C, 0x87, 0xFF, 0x0F, 0xEA, 0x42, 0x99, 0x5C, 0x01, 0x80, 0x84, 0x01, 0xC0, 0x74, 0x91, 0x38, 0x4B, 0x08, 0x80, 0x14, 0x00, 0x40, 0x7A, 0x8E, 0x42, 0xA6, 0x00, 0x40, 0x46, 0x01, 0x80, 0x9D, 0x98, 0x26, 0x53, 0x00, 0xA0, 0x04, 0x00, 0x60, 0xCB, 0x63, 0x62, 0xE3, 0x00, 0x50, 0x2D, 0x00, 0x60, 0x27, 0x7F, 0xE6, 0xD3, 0x00, 0x80, 0x9D, 0xF8, 0x99, 0x7B, 0x01, 0x00, 0x5B, 0x94, 0x21, 0x15, 0x01, 0xA0, 0x91, 0x00, 0x20, 0x13, 0x65, 0x88, 0x44, 0x00, 0x68, 0x3B, 0x00, 0xAC, 0xCF, 0x56, 0x8A, 0x45, 0x00, 0x58, 0x30, 0x00, 0x14, 0x66, 0x4B, 0xC4, 0x39, 0x00, 0xD8, 0x2D, 0x00, 0x30, 0x49, 0x57, 0x66, 0x48, 0x00, 0xB0, 0xB7, 0x00, 0xC0, 0xCE, 0x10, 0x0B, 0xB2, 0x00, 0x08, 0x0C, 0x00, 0x30, 0x51, 0x88, 0x85, 0x29, 0x00, 0x04, 0x7B, 0x00, 0x60, 0xC8, 0x23, 0x23, 0x78, 0x00, 0x84, 0x99, 0x00, 0x14, 0x46, 0xF2, 0x57, 0x3C, 0xF1, 0x2B, 0xAE, 0x10, 0xE7, 0x2A, 0x00, 0x00, 0x78, 0x99, 0x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, 0xDA, 0x88, 0x01, 0x62, 0x8A, 0x58, 0x23, 0x8E, 0x08, 0x17, 0x99, 0x85, 0xF8, 0x21, 0xC1, 0x48, 0x04, 0x12, 0x8B, 0x24, 0x20, 0xC9, 0x88, 0x14, 0x51, 0x22, 0x4B, 0x91, 0x35, 0x48, 0x31, 0x52, 0x8A, 0x54, 0x20, 0x55, 0x48, 0x1D, 0xF2, 0x3D, 0x72, 0x02, 0x39, 0x87, 0x5C, 0x46, 0xBA, 0x91, 0x3B, 0xC8, 0x00, 0x32, 0x82, 0xFC, 0x86, 0xBC, 0x47, 0x31, 0x94, 0x81, 0xB2, 0x51, 0x3D, 0xD4, 0x0C, 0xB5, 0x43, 0xB9, 0xA8, 0x37, 0x1A, 0x84, 0x46, 0xA2, 0x0B, 0xD0, 0x64, 0x74, 0x31, 0x9A, 0x8F, 0x16, 0xA0, 0x9B, 0xD0, 0x72, 0xB4, 0x1A, 0x3D, 0x8C, 0x36, 0xA1, 0xE7, 0xD0, 0xAB, 0x68, 0x0F, 0xDA, 0x8F, 0x3E, 0x43, 0xC7, 0x30, 0xC0, 0xE8, 0x18, 0x07, 0x33, 0xC4, 0x6C, 0x30, 0x2E, 0xC6, 0xC3, 0x42, 0xB1, 0x38, 0x2C, 0x09, 0x93, 0x63, 0xCB, 0xB1, 0x22, 0xAC, 0x0C, 0xAB, 0xC6, 0x1A, 0xB0, 0x56, 0xAC, 0x03, 0xBB, 0x89, 0xF5, 0x63, 0xCF, 0xB1, 0x77, 0x04, 0x12, 0x81, 0x45, 0xC0, 0x09, 0x36, 0x04, 0x77, 0x42, 0x20, 0x61, 0x1E, 0x41, 0x48, 0x58, 0x4C, 0x58, 0x4E, 0xD8, 0x48, 0xA8, 0x20, 0x1C, 0x24, 0x34, 0x11, 0xDA, 0x09, 0x37, 0x09, 0x03, 0x84, 0x51, 0xC2, 0x27, 0x22, 0x93, 0xA8, 0x4B, 0xB4, 0x26, 0xBA, 0x11, 0xF9, 0xC4, 0x18, 0x62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0xE8, 0x3A, 0x1C, 0x52, 0x73, 0xD6, 0xBE, 0x94, 0xD3, 0xF2, 0xCD, 0x75, 0x21, 0x6F, 0xF2, 0x7E, 0x3D, 0x84, 0x4C, 0x0D, 0xB4, 0xEC, 0x51, 0x75, 0xA1, 0xFD, 0x4D, 0xE6, 0x77, 0x76, 0x2E, 0x13, 0x8F, 0x93, 0xD1, 0x3B, 0x02, 0xA8, 0x7A, 0x4A, 0x24, 0xFE, 0xFF, 0x53, 0xE8, 0xDD, 0x06, 0x57, 0x6F, 0xAA, 0x9B, 0xB6, 0x27, 0xB5, 0x5A, 0x1B, 0x98, 0xDB, 0x71, 0x8D, 0x65, 0xAC, 0x84, 0x0D, 0xED, 0x8C, 0xAE, 0x6E, 0xE6, 0xFE, 0xFC, 0xF7, 0x55, 0x89, 0x56, 0x0A, 0x5A, 0x2B, 0x38, 0x02, 0x4A, 0xBD, 0xEF, 0x68, 0xC7, 0xB3, 0x90, 0x68, 0x02, 0x9A, 0xC7, 0xEE, 0x39, 0x00, 0xFC, 0x36, 0xC0, 0xDE, 0x3F, 0xCB, 0x68, 0x05, 0x55, 0xEE, 0x6B, 0xD7, 0x42, 0x1C, 0x01, 0x80, 0xC3, 0x5B, 0xE4, 0x5F, 0xD7, 0x54, 0x27, 0xA9, 0xD5, 0xCE, 0x91, 0xF6, 0x51, 0xD0, 0xC8, 0x01, 0x47, 0xEC, 0xA2, 0xC1, 0xCE, 0x00, 0x2A, 0x06, 0x54, 0xBB, 0x34, 0xFA, 0xFE, 0x32, 0xA4, 0x48, 0x05, 0xFF, 0x7F, 0x00, 0x01, 0xD8, 0x77, 0xA0, 0x37, 0x12, 0xB7, 0xA9, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44, 0xAE, 0x42, 0x60, 0x82, 0x00 }; #endif
238.236074
241
0.661226
salindersidhu
8f554b17373363848ba03cadd47a7a4c9663306a
111
cpp
C++
source/ashes/renderer/GlRenderer/Core/GlIcdObject.cpp
DragonJoker/Ashes
a6ed950b3fd8fb9626c60b4291fbd52ea75ac66e
[ "MIT" ]
227
2018-09-17T16:03:35.000Z
2022-03-19T02:02:45.000Z
source/ashes/renderer/GlRenderer/Core/GlIcdObject.cpp
DragonJoker/RendererLib
0f8ad8edec1b0929ebd10247d3dd0a9ee8f8c91a
[ "MIT" ]
39
2018-02-06T22:22:24.000Z
2018-08-29T07:11:06.000Z
source/ashes/renderer/GlRenderer/Core/GlIcdObject.cpp
DragonJoker/Ashes
a6ed950b3fd8fb9626c60b4291fbd52ea75ac66e
[ "MIT" ]
8
2019-05-04T10:33:32.000Z
2021-04-05T13:19:27.000Z
/** *\author * Sylvain Doremus */ #include "renderer/GlRenderer/Core/GlIcdObject.hpp" namespace ashes::gl { }
11.1
51
0.711712
DragonJoker
8f5a120f2d8abb9e0329b3b1401a8c971b138b82
3,282
hpp
C++
src/matching.hpp
HE-Xinyu/algorithms
009b8a9786192001dab0ce48bf8088a5ff62556e
[ "MIT" ]
1
2020-06-11T11:44:40.000Z
2020-06-11T11:44:40.000Z
src/matching.hpp
HE-Xinyu/algorithms
009b8a9786192001dab0ce48bf8088a5ff62556e
[ "MIT" ]
null
null
null
src/matching.hpp
HE-Xinyu/algorithms
009b8a9786192001dab0ce48bf8088a5ff62556e
[ "MIT" ]
1
2021-01-28T12:30:08.000Z
2021-01-28T12:30:08.000Z
#include <vector> #include <unordered_set> #include "max_flow.hpp" #pragma once using std::vector; using std::pair; using std::unordered_set; class MaximumBipartiteMatching { public: using Edges = vector<pair<int, int>>; /* * elements are edges (u, v) in E. * * It does not need to be (x, y). (y, x) is also fine. * The index should be continuous. */ Edges e; explicit MaximumBipartiteMatching(Edges _e) : e(_e) {} Edges compute() const { /* * Calculate the maximum matching using the Edmonds-Karp (Ford-Fulkerson) algorithm * * Although for normal graphs the time complexity is O(|E|^2 |V|), in bipartite matching it is * O(|E||V|), because there are only O(|V|) augmenting paths. * * We denote the bipartite sets of vertices as X and Y. Suppose X + Y is continuous and starting from 0. * We have source vertex s = |X| + |Y|, t = |X| + |Y| + 1. * We add (s, x) and (y, t) to the graph, each having capacity 1. * * It is guaranteed that if the input edges ((x_1, y_1), (x_2, y_2), ..., (x_n, y_n)) can be separated by * X = unique(x_1, x_2, ... x_n}), Y = unique({y_1, y_2, ... y_n}), * the algorithm will make the desired separation. */ unordered_set<int> X, Y; for (const auto& p : e) { // if u or v has already been added, // the other vertex has no choice. if (X.count(p.first)) { Y.insert(p.second); } else if (X.count(p.second)) { Y.insert(p.first); } else if (Y.count(p.first)) { X.insert(p.second); } else if (Y.count(p.second)) { X.insert(p.first); } else { // either u or v is assigned. // we can choose arbitrarily. X.insert(p.first); Y.insert(p.second); } } // The entire graph contains |X| + |Y| + 2 vertices. size_t total_num = X.size() + Y.size(); int s = static_cast<int>(total_num); int t = static_cast<int>(total_num + 1); vector<vector<int>> adj(total_num + 2); vector<vector<int>> cap(total_num + 2, vector<int>(total_num + 2, 0)); for (const auto& p : e) { int u = p.first, v = p.second; if (X.count(u)) { cap[u][v] = 1; } else { cap[v][u] = 1; } adj[u].push_back(v); adj[v].push_back(u); } for (int x : X) { // x -> s is useless. cap[s][x] = 1; adj[s].push_back(x); } for (int y : Y) { // t -> y is useless. cap[y][t] = 1; adj[y].push_back(t); } EdmondsKarp<int> EK(adj, cap, s, t); EK.compute(); vector<vector<int>> flow = EK.getFlow(); Edges ret; for (int x: X) { for (int y: Y) { if (flow[x][y]) { ret.push_back({ x, y }); } } } return ret; } };
29.303571
114
0.462523
HE-Xinyu
8f5c17999d992a1091bb3bf968c1a82f0831db3a
2,496
cpp
C++
AdamAttack/src/utilities.cpp
TheAdamProject/adams
697cf865725229335c860fe034d02637dbb5deb3
[ "MIT" ]
15
2021-02-23T19:47:15.000Z
2022-02-17T17:23:13.000Z
AdamAttack/src/utilities.cpp
TheAdamProject/adams
697cf865725229335c860fe034d02637dbb5deb3
[ "MIT" ]
1
2021-12-13T07:15:13.000Z
2021-12-22T14:38:42.000Z
AdamAttack/src/utilities.cpp
TheAdamProject/adams
697cf865725229335c860fe034d02637dbb5deb3
[ "MIT" ]
2
2022-02-15T07:05:30.000Z
2022-02-17T17:29:59.000Z
#include "utilities.h" void *Malloc(size_t sz, const char *name) { void *ptr; ptr = malloc(sz); if (!ptr) { fprintf(stderr, "Cannot allocate %zu bytes for %s\n\n", sz, name); exit(EXIT_FAILURE); } return ptr; } void *Calloc(size_t nmemb, size_t size, const char *name){ void *ptr; ptr=calloc(nmemb,size); if (!ptr) { fprintf(stderr, "Cannot allocate %zu bytes for %s\n\n", (nmemb*size), name); exit(EXIT_FAILURE); } return ptr; } FILE *Fopen(const char *path, const char *mode){ FILE *fp = NULL; fp = fopen(path, mode); if (!fp) { fprintf(stderr, "Cannot open file %s...\n", path); exit(EXIT_FAILURE); } return fp; } void Mkdir(char * path, mode_t mode){ int status = 0; status = mkdir(path,mode); if( status != 0 && errno != EEXIST){ fprintf(stderr,"Cannot create dir %s\n",path); exit(EXIT_FAILURE); } } char *printDate(){ time_t now; time(&now); char *timeString = ctime(&now); int l = strlen(timeString); timeString[l-1] ='\0'; return timeString; } namespace fs = std::experimental::filesystem; void getModelFromDir(const char* home, char **modelpath, char **rulespath, float *budget){ char buf[BUFFER_SIZE]; sprintf(buf, "%s/%s", home, MODEL); if(*modelpath == NULL) *modelpath = strdup(buf); sprintf(buf, "%s/%s", home, RULES); if (*rulespath == NULL) *rulespath = strdup(buf); sprintf(buf, "%s/%s", home, PARAMS); if(*budget == 0.0){ FILE *f; if ((f = fopen(buf, "r")) == NULL){ printf("[ERROR] opening PARAMS\n"); exit(1); } if(!fscanf(f,"%f", budget)){ printf("[ERROR] reading PARAMS\n"); exit(1); } fclose(f); } } ssize_t Read(int fd, void *buf, size_t count){ if(count==0){return 0;} ssize_t bs = recv(fd,buf,count,MSG_WAITALL); if(bs == -1){ fprintf(stderr,"[ERROR]: read failed with error %d\n",errno); exit(EXIT_FAILURE); } if(bs != count){ fprintf(stderr,"[WARN]: read returned %lu\n",count); } return bs; } ssize_t Write(int fd, const void *buf, size_t count){ if (count == 0){return 0;} ssize_t bs=send(fd,buf,count,0); if(bs == -1){ fprintf(stderr,"[ERROR]: write failed with error %d\n",errno); exit(EXIT_FAILURE); } if(bs != count){ fprintf(stderr,"[WARN]: write returned %lu\n",count); } return bs; }
21.704348
90
0.564904
TheAdamProject
8f64237be4d822ab784aca49bd0ad286d2fc30af
15,434
cpp
C++
export/windows/obj/src/flixel/math/FlxAngle.cpp
seanbashaw/frozenlight
47c540d30d63e946ea2dc787b4bb602cc9347d21
[ "MIT" ]
null
null
null
export/windows/obj/src/flixel/math/FlxAngle.cpp
seanbashaw/frozenlight
47c540d30d63e946ea2dc787b4bb602cc9347d21
[ "MIT" ]
null
null
null
export/windows/obj/src/flixel/math/FlxAngle.cpp
seanbashaw/frozenlight
47c540d30d63e946ea2dc787b4bb602cc9347d21
[ "MIT" ]
null
null
null
// Generated by Haxe 3.4.7 #include <hxcpp.h> #ifndef INCLUDED_95f339a1d026d52c #define INCLUDED_95f339a1d026d52c #include "hxMath.h" #endif #ifndef INCLUDED_flixel_FlxBasic #include <flixel/FlxBasic.h> #endif #ifndef INCLUDED_flixel_FlxCamera #include <flixel/FlxCamera.h> #endif #ifndef INCLUDED_flixel_FlxG #include <flixel/FlxG.h> #endif #ifndef INCLUDED_flixel_FlxObject #include <flixel/FlxObject.h> #endif #ifndef INCLUDED_flixel_FlxSprite #include <flixel/FlxSprite.h> #endif #ifndef INCLUDED_flixel_input_FlxPointer #include <flixel/input/FlxPointer.h> #endif #ifndef INCLUDED_flixel_input_IFlxInputManager #include <flixel/input/IFlxInputManager.h> #endif #ifndef INCLUDED_flixel_input_mouse_FlxMouse #include <flixel/input/mouse/FlxMouse.h> #endif #ifndef INCLUDED_flixel_math_FlxAngle #include <flixel/math/FlxAngle.h> #endif #ifndef INCLUDED_flixel_math_FlxPoint #include <flixel/math/FlxPoint.h> #endif #ifndef INCLUDED_flixel_util_FlxPool_flixel_math_FlxPoint #include <flixel/util/FlxPool_flixel_math_FlxPoint.h> #endif #ifndef INCLUDED_flixel_util_IFlxDestroyable #include <flixel/util/IFlxDestroyable.h> #endif #ifndef INCLUDED_flixel_util_IFlxPool #include <flixel/util/IFlxPool.h> #endif #ifndef INCLUDED_flixel_util_IFlxPooled #include <flixel/util/IFlxPooled.h> #endif HX_LOCAL_STACK_FRAME(_hx_pos_5b56d9e1983dc02b_65_wrapAngle,"flixel.math.FlxAngle","wrapAngle",0xae3043f0,"flixel.math.FlxAngle.wrapAngle","flixel/math/FlxAngle.hx",65,0x32e99189) HX_LOCAL_STACK_FRAME(_hx_pos_5b56d9e1983dc02b_87_asDegrees,"flixel.math.FlxAngle","asDegrees",0x8ea59f1c,"flixel.math.FlxAngle.asDegrees","flixel/math/FlxAngle.hx",87,0x32e99189) HX_LOCAL_STACK_FRAME(_hx_pos_5b56d9e1983dc02b_99_asRadians,"flixel.math.FlxAngle","asRadians",0x7b3b01e7,"flixel.math.FlxAngle.asRadians","flixel/math/FlxAngle.hx",99,0x32e99189) HX_LOCAL_STACK_FRAME(_hx_pos_5b56d9e1983dc02b_112_angleBetween,"flixel.math.FlxAngle","angleBetween",0x83e3464e,"flixel.math.FlxAngle.angleBetween","flixel/math/FlxAngle.hx",112,0x32e99189) HX_LOCAL_STACK_FRAME(_hx_pos_5b56d9e1983dc02b_132_angleBetweenPoint,"flixel.math.FlxAngle","angleBetweenPoint",0x0a124322,"flixel.math.FlxAngle.angleBetweenPoint","flixel/math/FlxAngle.hx",132,0x32e99189) HX_LOCAL_STACK_FRAME(_hx_pos_5b56d9e1983dc02b_154_angleBetweenMouse,"flixel.math.FlxAngle","angleBetweenMouse",0x4fe7a4f7,"flixel.math.FlxAngle.angleBetweenMouse","flixel/math/FlxAngle.hx",154,0x32e99189) HX_LOCAL_STACK_FRAME(_hx_pos_5b56d9e1983dc02b_208_angleFromFacing,"flixel.math.FlxAngle","angleFromFacing",0x8474a75e,"flixel.math.FlxAngle.angleFromFacing","flixel/math/FlxAngle.hx",208,0x32e99189) HX_LOCAL_STACK_FRAME(_hx_pos_5b56d9e1983dc02b_233_getCartesianCoords,"flixel.math.FlxAngle","getCartesianCoords",0x688d1f29,"flixel.math.FlxAngle.getCartesianCoords","flixel/math/FlxAngle.hx",233,0x32e99189) HX_LOCAL_STACK_FRAME(_hx_pos_5b56d9e1983dc02b_252_getPolarCoords,"flixel.math.FlxAngle","getPolarCoords",0xf74e15df,"flixel.math.FlxAngle.getPolarCoords","flixel/math/FlxAngle.hx",252,0x32e99189) HX_LOCAL_STACK_FRAME(_hx_pos_5b56d9e1983dc02b_264_get_TO_DEG,"flixel.math.FlxAngle","get_TO_DEG",0x36e6a544,"flixel.math.FlxAngle.get_TO_DEG","flixel/math/FlxAngle.hx",264,0x32e99189) HX_LOCAL_STACK_FRAME(_hx_pos_5b56d9e1983dc02b_269_get_TO_RAD,"flixel.math.FlxAngle","get_TO_RAD",0x36f14153,"flixel.math.FlxAngle.get_TO_RAD","flixel/math/FlxAngle.hx",269,0x32e99189) namespace flixel{ namespace math{ void FlxAngle_obj::__construct() { } Dynamic FlxAngle_obj::__CreateEmpty() { return new FlxAngle_obj; } void *FlxAngle_obj::_hx_vtable = 0; Dynamic FlxAngle_obj::__Create(hx::DynamicArray inArgs) { hx::ObjectPtr< FlxAngle_obj > _hx_result = new FlxAngle_obj(); _hx_result->__construct(); return _hx_result; } bool FlxAngle_obj::_hx_isInstanceOf(int inClassId) { return inClassId==(int)0x00000001 || inClassId==(int)0x0071e2b9; } Float FlxAngle_obj::wrapAngle(Float angle){ HX_STACKFRAME(&_hx_pos_5b56d9e1983dc02b_65_wrapAngle) HXLINE( 66) if ((angle > (int)180)) { HXLINE( 68) angle = ::flixel::math::FlxAngle_obj::wrapAngle((angle - (int)360)); } else { HXLINE( 70) if ((angle < (int)-180)) { HXLINE( 72) angle = ::flixel::math::FlxAngle_obj::wrapAngle((angle + (int)360)); } } HXLINE( 75) return angle; } STATIC_HX_DEFINE_DYNAMIC_FUNC1(FlxAngle_obj,wrapAngle,return ) Float FlxAngle_obj::asDegrees(Float radians){ HX_STACKFRAME(&_hx_pos_5b56d9e1983dc02b_87_asDegrees) HXDLIN( 87) return (radians * ((Float)(int)180 / (Float)::Math_obj::PI)); } STATIC_HX_DEFINE_DYNAMIC_FUNC1(FlxAngle_obj,asDegrees,return ) Float FlxAngle_obj::asRadians(Float degrees){ HX_STACKFRAME(&_hx_pos_5b56d9e1983dc02b_99_asRadians) HXDLIN( 99) return (degrees * ((Float)::Math_obj::PI / (Float)(int)180)); } STATIC_HX_DEFINE_DYNAMIC_FUNC1(FlxAngle_obj,asRadians,return ) Float FlxAngle_obj::angleBetween( ::flixel::FlxSprite SpriteA, ::flixel::FlxSprite SpriteB,hx::Null< bool > __o_AsDegrees){ bool AsDegrees = __o_AsDegrees.Default(false); HX_STACKFRAME(&_hx_pos_5b56d9e1983dc02b_112_angleBetween) HXLINE( 113) Float dx = (SpriteB->x + SpriteB->origin->x); HXDLIN( 113) Float dx1 = (dx - (SpriteA->x + SpriteA->origin->x)); HXLINE( 114) Float dy = (SpriteB->y + SpriteB->origin->y); HXDLIN( 114) Float dy1 = (dy - (SpriteA->y + SpriteA->origin->y)); HXLINE( 116) if (AsDegrees) { HXLINE( 117) return (::Math_obj::atan2(dy1,dx1) * ((Float)(int)180 / (Float)::Math_obj::PI)); } else { HXLINE( 119) return ::Math_obj::atan2(dy1,dx1); } HXLINE( 116) return ((Float)0.); } STATIC_HX_DEFINE_DYNAMIC_FUNC3(FlxAngle_obj,angleBetween,return ) Float FlxAngle_obj::angleBetweenPoint( ::flixel::FlxSprite Sprite, ::flixel::math::FlxPoint Target,hx::Null< bool > __o_AsDegrees){ bool AsDegrees = __o_AsDegrees.Default(false); HX_STACKFRAME(&_hx_pos_5b56d9e1983dc02b_132_angleBetweenPoint) HXLINE( 133) Float Target1 = Target->x; HXDLIN( 133) Float dx = (Target1 - (Sprite->x + Sprite->origin->x)); HXLINE( 134) Float Target2 = Target->y; HXDLIN( 134) Float dy = (Target2 - (Sprite->y + Sprite->origin->y)); HXLINE( 136) if (Target->_weak) { HXLINE( 136) Target->put(); } HXLINE( 138) if (AsDegrees) { HXLINE( 139) return (::Math_obj::atan2(dy,dx) * ((Float)(int)180 / (Float)::Math_obj::PI)); } else { HXLINE( 141) return ::Math_obj::atan2(dy,dx); } HXLINE( 138) return ((Float)0.); } STATIC_HX_DEFINE_DYNAMIC_FUNC3(FlxAngle_obj,angleBetweenPoint,return ) Float FlxAngle_obj::angleBetweenMouse( ::flixel::FlxObject Object,hx::Null< bool > __o_AsDegrees){ bool AsDegrees = __o_AsDegrees.Default(false); HX_STACKFRAME(&_hx_pos_5b56d9e1983dc02b_154_angleBetweenMouse) HXLINE( 156) if (hx::IsNull( Object )) { HXLINE( 157) return (int)0; } HXLINE( 159) ::flixel::math::FlxPoint p = Object->getScreenPosition(null(),null()); HXLINE( 161) Float dx = (::flixel::FlxG_obj::mouse->screenX - p->x); HXLINE( 162) Float dy = (::flixel::FlxG_obj::mouse->screenY - p->y); HXLINE( 164) p->put(); HXLINE( 166) if (AsDegrees) { HXLINE( 167) return (::Math_obj::atan2(dy,dx) * ((Float)(int)180 / (Float)::Math_obj::PI)); } else { HXLINE( 169) return ::Math_obj::atan2(dy,dx); } HXLINE( 166) return ((Float)0.); } STATIC_HX_DEFINE_DYNAMIC_FUNC2(FlxAngle_obj,angleBetweenMouse,return ) Float FlxAngle_obj::angleFromFacing(int FacingBitmask,hx::Null< bool > __o_AsDegrees){ bool AsDegrees = __o_AsDegrees.Default(false); HX_STACKFRAME(&_hx_pos_5b56d9e1983dc02b_208_angleFromFacing) HXLINE( 209) int degrees; HXDLIN( 209) switch((int)(FacingBitmask)){ case (int)1: { HXLINE( 209) degrees = (int)180; } break; case (int)16: { HXLINE( 209) degrees = (int)0; } break; case (int)256: { HXLINE( 209) degrees = (int)-90; } break; case (int)4096: { HXLINE( 209) degrees = (int)90; } break; default:{ HXLINE( 215) int f = FacingBitmask; HXDLIN( 215) if ((f == (int)257)) { HXLINE( 209) degrees = (int)-135; } else { HXLINE( 216) int f1 = FacingBitmask; HXDLIN( 216) if ((f1 == (int)272)) { HXLINE( 209) degrees = (int)-45; } else { HXLINE( 217) int f2 = FacingBitmask; HXDLIN( 217) if ((f2 == (int)4097)) { HXLINE( 209) degrees = (int)135; } else { HXLINE( 218) int f3 = FacingBitmask; HXDLIN( 218) if ((f3 == (int)4112)) { HXLINE( 209) degrees = (int)45; } else { HXLINE( 209) degrees = (int)0; } } } } } } HXLINE( 221) if (AsDegrees) { HXLINE( 221) return degrees; } else { HXLINE( 221) return (degrees * ((Float)::Math_obj::PI / (Float)(int)180)); } HXDLIN( 221) return ((Float)0.); } STATIC_HX_DEFINE_DYNAMIC_FUNC2(FlxAngle_obj,angleFromFacing,return ) ::flixel::math::FlxPoint FlxAngle_obj::getCartesianCoords(Float Radius,Float Angle, ::flixel::math::FlxPoint point){ HX_STACKFRAME(&_hx_pos_5b56d9e1983dc02b_233_getCartesianCoords) HXLINE( 234) ::flixel::math::FlxPoint p = point; HXLINE( 235) if (hx::IsNull( p )) { HXLINE( 236) ::flixel::math::FlxPoint point1 = ::flixel::math::FlxPoint_obj::_pool->get()->set((int)0,(int)0); HXDLIN( 236) point1->_inPool = false; HXDLIN( 236) p = point1; } HXLINE( 238) p->set_x((Radius * ::Math_obj::cos((Angle * ((Float)::Math_obj::PI / (Float)(int)180))))); HXLINE( 239) p->set_y((Radius * ::Math_obj::sin((Angle * ((Float)::Math_obj::PI / (Float)(int)180))))); HXLINE( 240) return p; } STATIC_HX_DEFINE_DYNAMIC_FUNC3(FlxAngle_obj,getCartesianCoords,return ) ::flixel::math::FlxPoint FlxAngle_obj::getPolarCoords(Float X,Float Y, ::flixel::math::FlxPoint point){ HX_STACKFRAME(&_hx_pos_5b56d9e1983dc02b_252_getPolarCoords) HXLINE( 253) ::flixel::math::FlxPoint p = point; HXLINE( 254) if (hx::IsNull( p )) { HXLINE( 255) ::flixel::math::FlxPoint point1 = ::flixel::math::FlxPoint_obj::_pool->get()->set((int)0,(int)0); HXDLIN( 255) point1->_inPool = false; HXDLIN( 255) p = point1; } HXLINE( 257) p->set_x(::Math_obj::sqrt(((X * X) + (Y * Y)))); HXLINE( 258) Float _hx_tmp = ::Math_obj::atan2(Y,X); HXDLIN( 258) p->set_y((_hx_tmp * ((Float)(int)180 / (Float)::Math_obj::PI))); HXLINE( 259) return p; } STATIC_HX_DEFINE_DYNAMIC_FUNC3(FlxAngle_obj,getPolarCoords,return ) Float FlxAngle_obj::get_TO_DEG(){ HX_STACKFRAME(&_hx_pos_5b56d9e1983dc02b_264_get_TO_DEG) HXDLIN( 264) return ((Float)(int)180 / (Float)::Math_obj::PI); } STATIC_HX_DEFINE_DYNAMIC_FUNC0(FlxAngle_obj,get_TO_DEG,return ) Float FlxAngle_obj::get_TO_RAD(){ HX_STACKFRAME(&_hx_pos_5b56d9e1983dc02b_269_get_TO_RAD) HXDLIN( 269) return ((Float)::Math_obj::PI / (Float)(int)180); } STATIC_HX_DEFINE_DYNAMIC_FUNC0(FlxAngle_obj,get_TO_RAD,return ) FlxAngle_obj::FlxAngle_obj() { } bool FlxAngle_obj::__GetStatic(const ::String &inName, Dynamic &outValue, hx::PropertyAccess inCallProp) { switch(inName.length) { case 6: if (HX_FIELD_EQ(inName,"TO_DEG") ) { if (inCallProp == hx::paccAlways) { outValue = ( get_TO_DEG() ); return true; } } if (HX_FIELD_EQ(inName,"TO_RAD") ) { if (inCallProp == hx::paccAlways) { outValue = ( get_TO_RAD() ); return true; } } break; case 9: if (HX_FIELD_EQ(inName,"wrapAngle") ) { outValue = wrapAngle_dyn(); return true; } if (HX_FIELD_EQ(inName,"asDegrees") ) { outValue = asDegrees_dyn(); return true; } if (HX_FIELD_EQ(inName,"asRadians") ) { outValue = asRadians_dyn(); return true; } break; case 10: if (HX_FIELD_EQ(inName,"get_TO_DEG") ) { outValue = get_TO_DEG_dyn(); return true; } if (HX_FIELD_EQ(inName,"get_TO_RAD") ) { outValue = get_TO_RAD_dyn(); return true; } break; case 12: if (HX_FIELD_EQ(inName,"angleBetween") ) { outValue = angleBetween_dyn(); return true; } break; case 14: if (HX_FIELD_EQ(inName,"getPolarCoords") ) { outValue = getPolarCoords_dyn(); return true; } break; case 15: if (HX_FIELD_EQ(inName,"angleFromFacing") ) { outValue = angleFromFacing_dyn(); return true; } break; case 17: if (HX_FIELD_EQ(inName,"angleBetweenPoint") ) { outValue = angleBetweenPoint_dyn(); return true; } if (HX_FIELD_EQ(inName,"angleBetweenMouse") ) { outValue = angleBetweenMouse_dyn(); return true; } break; case 18: if (HX_FIELD_EQ(inName,"getCartesianCoords") ) { outValue = getCartesianCoords_dyn(); return true; } } return false; } #if HXCPP_SCRIPTABLE static hx::StorageInfo *FlxAngle_obj_sMemberStorageInfo = 0; static hx::StaticInfo *FlxAngle_obj_sStaticStorageInfo = 0; #endif static void FlxAngle_obj_sMarkStatics(HX_MARK_PARAMS) { HX_MARK_MEMBER_NAME(FlxAngle_obj::__mClass,"__mClass"); }; #ifdef HXCPP_VISIT_ALLOCS static void FlxAngle_obj_sVisitStatics(HX_VISIT_PARAMS) { HX_VISIT_MEMBER_NAME(FlxAngle_obj::__mClass,"__mClass"); }; #endif hx::Class FlxAngle_obj::__mClass; static ::String FlxAngle_obj_sStaticFields[] = { HX_HCSTRING("wrapAngle","\xa9","\xbd","\x58","\xc6"), HX_HCSTRING("asDegrees","\xd5","\x18","\xce","\xa6"), HX_HCSTRING("asRadians","\xa0","\x7b","\x63","\x93"), HX_HCSTRING("angleBetween","\x35","\xe6","\xd4","\x69"), HX_HCSTRING("angleBetweenPoint","\xdb","\x9d","\x50","\x15"), HX_HCSTRING("angleBetweenMouse","\xb0","\xff","\x25","\x5b"), HX_HCSTRING("angleFromFacing","\xd7","\xb1","\xc0","\xdc"), HX_HCSTRING("getCartesianCoords","\x50","\x26","\xde","\x33"), HX_HCSTRING("getPolarCoords","\x86","\xbd","\xd4","\x74"), HX_HCSTRING("get_TO_DEG","\x6b","\xad","\x28","\x42"), HX_HCSTRING("get_TO_RAD","\x7a","\x49","\x33","\x42"), ::String(null()) }; void FlxAngle_obj::__register() { hx::Object *dummy = new FlxAngle_obj; FlxAngle_obj::_hx_vtable = *(void **)dummy; hx::Static(__mClass) = new hx::Class_obj(); __mClass->mName = HX_HCSTRING("flixel.math.FlxAngle","\xf5","\x97","\xd6","\x2c"); __mClass->mSuper = &super::__SGetClass(); __mClass->mConstructEmpty = &__CreateEmpty; __mClass->mConstructArgs = &__Create; __mClass->mGetStaticField = &FlxAngle_obj::__GetStatic; __mClass->mSetStaticField = &hx::Class_obj::SetNoStaticField; __mClass->mMarkFunc = FlxAngle_obj_sMarkStatics; __mClass->mStatics = hx::Class_obj::dupFunctions(FlxAngle_obj_sStaticFields); __mClass->mMembers = hx::Class_obj::dupFunctions(0 /* sMemberFields */); __mClass->mCanCast = hx::TCanCast< FlxAngle_obj >; #ifdef HXCPP_VISIT_ALLOCS __mClass->mVisitFunc = FlxAngle_obj_sVisitStatics; #endif #ifdef HXCPP_SCRIPTABLE __mClass->mMemberStorageInfo = FlxAngle_obj_sMemberStorageInfo; #endif #ifdef HXCPP_SCRIPTABLE __mClass->mStaticStorageInfo = FlxAngle_obj_sStaticStorageInfo; #endif hx::_hx_RegisterClass(__mClass->mName, __mClass); } } // end namespace flixel } // end namespace math
39.676093
207
0.69308
seanbashaw
8f69113c165724b1a4315ce911c755ebb5908fb5
1,963
hxx
C++
live555/test/h264_subsession.hxx
triminalt/snippets
ced19012a55b0cc8e5fcd33fe3fc4947cb399366
[ "MIT" ]
1
2017-01-29T16:14:23.000Z
2017-01-29T16:14:23.000Z
live555/test/h264_subsession.hxx
triminalt/snippets
ced19012a55b0cc8e5fcd33fe3fc4947cb399366
[ "MIT" ]
null
null
null
live555/test/h264_subsession.hxx
triminalt/snippets
ced19012a55b0cc8e5fcd33fe3fc4947cb399366
[ "MIT" ]
null
null
null
// // @author trimnalt AT gmail DOT com // @version initial // @date 2018-07-03 // #ifndef H264_SUBSESSION_HXX #define H264_SUBSESSION_HXX #include <string> #include <memory> #include <OnDemandServerMediaSubsession.hh> #include <H264VideoStreamFramer.hh> #include <H264VideoRTPSink.hh> #include "./h264_pump.hxx" #include "./h264_source.hxx" #include "./h264_sink.hxx" class h264_subsession final: public OnDemandServerMediaSubsession { public: h264_subsession( UsageEnvironment& env , Boolean reused , std::shared_ptr<h264_pump> const& pump , unsigned fps , std::string sps , std::string pps) : OnDemandServerMediaSubsession(env, reused) , pump_(pump) , fps_(fps) , sps_(sps) , pps_(pps) { // EMPTY } virtual ~h264_subsession() = default; protected: virtual FramedSource* createNewStreamSource( unsigned , unsigned& bitrate) override { bitrate = 1024; return H264VideoStreamFramer::createNew( envir() , new h264_source( envir() , pump_ , fps_) , true); } virtual RTPSink* createNewRTPSink( Groupsock* rtp , unsigned char rtp_payload_type_if_dynamic , FramedSource*) override { return new h264_sink( envir() , rtp , rtp_payload_type_if_dynamic , sps_ , pps_); } private: std::shared_ptr<h264_pump> pump_; unsigned fps_; std::string sps_; std::string pps_; }; #endif // H264_SUBSESSION_HXX
29.742424
80
0.501274
triminalt
8f6e259e1c954e447098a4f6fdcc4f7c36370c45
54,502
hpp
C++
Source/Tools/alive_api/AOTlvs.hpp
THEONLYDarkShadow/alive_reversing
680d87088023f2d5f2a40c42d6543809281374fb
[ "MIT" ]
1
2021-04-11T23:44:43.000Z
2021-04-11T23:44:43.000Z
Source/Tools/alive_api/AOTlvs.hpp
THEONLYDarkShadow/alive_reversing
680d87088023f2d5f2a40c42d6543809281374fb
[ "MIT" ]
null
null
null
Source/Tools/alive_api/AOTlvs.hpp
THEONLYDarkShadow/alive_reversing
680d87088023f2d5f2a40c42d6543809281374fb
[ "MIT" ]
null
null
null
#pragma once #include "TlvObjectBase.hpp" #include "../AliveLibAO/HoistRocksEffect.hpp" #include "../AliveLibAO/Abe.hpp" #include "../AliveLibAO/Door.hpp" #include "../AliveLibAO/Switch.hpp" #include "../AliveLibAO/DoorLight.hpp" #include "../AliveLibAO/ElectricWall.hpp" #include "../AliveLibAO/Well.hpp" #include "../AliveLibAO/Slig.hpp" #include "../AliveLibAO/SecurityOrb.hpp" #include "../AliveLibAO/FallingItem.hpp" #include "../AliveLibAO/Mine.hpp" #include "../AliveLibAO/Dove.hpp" #include "../AliveLibAO/UXB.hpp" #include "../AliveLibAO/HintFly.hpp" #include "../AliveLibAO/Bat.hpp" #include "../AliveLibAO/ShadowZone.hpp" #include "../AliveLibAO/BellHammer.hpp" #include "../AliveLibAO/IdSplitter.hpp" #include "../AliveLibAO/PullRingRope.hpp" #include "../AliveLibAO/MusicTrigger.hpp" #include "../AliveLibAO/Elum.hpp" #include "../AliveLibAO/LiftPoint.hpp" #include "../AliveLibAO/MovingBomb.hpp" #include "../AliveLibAO/Mudokon.hpp" #include "../AliveLibAO/MeatSaw.hpp" #include "../AliveLibAO/LCDScreen.hpp" #include "../AliveLibAO/InvisibleSwitch.hpp" #include "../AliveLibAO/TrapDoor.hpp" #include "../AliveLibAO/BirdPortal.hpp" #include "../AliveLibAO/BoomMachine.hpp" #include "../AliveLibAO/Slog.hpp" #include "../AliveLibAO/ChimeLock.hpp" #include "../AliveLibAO/FlintLockFire.hpp" #include "../AliveLibAO/LiftMover.hpp" #include "../AliveLibAO/Scrab.hpp" #include "../AliveLibAO/SlogSpawner.hpp" #include "../AliveLibAO/Rock.hpp" #include "../AliveLibAO/SlogHut.hpp" #include "../AliveLibAO/SecurityClaw.hpp" #include "../AliveLibAO/SecurityDoor.hpp" #include "../AliveLibAO/TimedMine.hpp" #include "../AliveLibAO/MotionDetector.hpp" #include "../AliveLibAO/BackgroundAnimation.hpp" #include "../AliveLibAO/LCDStatusBoard.hpp" #include "../AliveLibAO/HoneySack.hpp" #include "../AliveLibAO/SlingMudokon.hpp" #include "../AliveLibAO/BeeSwarmHole.hpp" #include "../AliveLibAO/Meat.hpp" #include "../AliveLibAO/RollingBall.hpp" #include "../AliveLibAO/RollingBallStopper.hpp" #include "../AliveLibAO/ZBall.hpp" #include "../AliveLibAO/FootSwitch.hpp" #include "../AliveLibAO/Paramite.hpp" #define CTOR_AO(className, objectTypeName, tlvType) className() : TlvObjectBaseAO(tlvType, objectTypeName) {} className(TypesCollection& globalTypes, AO::Path_TLV* pTlv = nullptr) : TlvObjectBaseAO(tlvType, objectTypeName, pTlv) namespace AO { struct Path_HoneyDripTarget : public Path_TLV { // No fields }; struct Path_Honey : public Path_TLV { __int16 id; __int16 state; int scale; }; struct Path_Bees : public Path_TLV { __int16 id; __int16 swarm_size; __int16 chase_time; __int16 speed; __int16 disable_resources; __int16 num_bees; }; struct Path_ScrabNoFall : public Path_TLV { // No fields }; struct Path_ScrabLeftBound : public Path_TLV { // No fields }; struct Path_ScrabRightBound : public Path_TLV { // No fields }; struct Path_ZSligCover : public Path_TLV { // No fields }; struct Path_AbeStart : public Path_TLV { int scale; }; struct Path_MudokonPathTrans : public Path_TLV { LevelIds level; __int16 path; int camera; }; struct Path_Pulley : public Path_TLV { int scale; }; struct Path_Preloader : public Path_TLV { int unload_cams_ASAP; }; struct Path_SligSpawner : public Path_TLV { enum class StartState : __int16 { Listening_0 = 0, Paused_1 = 1, Sleeping_2 = 2, Chase_3 = 3, GameEnder_4 = 4, Paused_5 = 5, }; __int16 field_18_scale; StartState field_1A_start_state; __int16 field_1C_pause_time; __int16 field_1E_pause_left_min; __int16 field_20_pause_left_max; __int16 field_22_pause_right_min; __int16 field_24_pause_right_max; __int16 field_26_chal_type; __int16 field_28_chal_time; __int16 field_2A_number_of_times_to_shoot; __int16 field_2C_unknown; // TODO: Part of above field, check me? __int16 field_2E_code1; __int16 field_30_code2; __int16 field_32_chase_abe; __int16 field_34_start_direction; __int16 field_36_panic_timeout; __int16 field_38_num_panic_sounds; __int16 field_3A_panic_sound_timeout; __int16 field_3C_stop_chase_delay; __int16 field_3E_time_to_wait_before_chase; __int16 field_40_slig_id; __int16 field_42_listen_time; __int16 field_44_percent_say_what; __int16 field_46_percent_beat_mud; __int16 field_48_talk_to_abe; __int16 field_4A_dont_shoot; __int16 field_4C_z_shoot_delay; __int16 field_4E_stay_awake; __int16 field_50_disable_resources; __int16 field_52_noise_wake_up_distance; int field_54_id; }; struct Path_ContinueZone : public Path_TLV { int field_10_zone_number; }; struct Path_StartController : public Path_TLV { // No fields }; struct Path_InvisibleZone : public Path_TLV { // No fields }; struct Path_DeathDrop : public Path_TLV { __int16 animation; __int16 sound; __int16 id; __int16 action; int set_value; }; struct Path_ElumStart : public Path_TLV { // No fields }; struct Path_ElumWall : public Path_TLV { // No fields }; struct Path_HandStone : public Path_TLV { Path_Handstone_data mData; }; struct Path_BellsongStone : public Path_TLV { Path_BellsongStone_data mData; }; struct Path_MovieStone : public Path_TLV { Path_Moviestone_data mData; }; } namespace AOTlvs { struct Path_MovieStone : public TlvObjectBaseAO<AO::Path_MovieStone> { CTOR_AO(Path_MovieStone, "MovieStone", AO::TlvTypes::MovieStone_51) { ADD("fmv_id", mTlv.mData.fmvId); ADD("scale", mTlv.mData.scale); } }; struct Path_BellsongStone : public TlvObjectBaseAO<AO::Path_BellsongStone> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::BellsongTypes>("Enum_BellsongTypes", { {AO::BellsongTypes::eWhistle, "whistle"}, {AO::BellsongTypes::eChimes, "chimes"}, }); } CTOR_AO(Path_BellsongStone, "BellSongStone", AO::TlvTypes::BellSongStone_54) { ADD("scale", mTlv.mData.scale); ADD("type", mTlv.mData.type); ADD("code1", mTlv.mData.code1); ADD("code2", mTlv.mData.code2); ADD("id", mTlv.mData.id); } }; struct Path_HandStone : public TlvObjectBaseAO<AO::Path_HandStone> { CTOR_AO(Path_HandStone, "HandStone", AO::TlvTypes::HandStone_100) { ADD("scale", mTlv.mData.scale); ADD("camera1_level", mTlv.mData.camera1.level); ADD("camera1_path", mTlv.mData.camera1.path); ADD("camera1_camera", mTlv.mData.camera1.camera); ADD("camera2_level", mTlv.mData.camera2.level); ADD("camera2_path", mTlv.mData.camera2.path); ADD("camera2_camera", mTlv.mData.camera2.camera); ADD("camera3_level", mTlv.mData.camera3.level); ADD("camera3_path", mTlv.mData.camera3.path); ADD("camera3_camera", mTlv.mData.camera3.camera); } }; struct Path_Door : public TlvObjectBaseAO<AO::Path_Door> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::DoorStates>("Enum_DoorStates", { {AO::DoorStates::eOpen_0, "Open"}, {AO::DoorStates::eClosed_1, "Closed"}, {AO::DoorStates::eOpening_2, "Opening"}, {AO::DoorStates::eClosing_3, "Closing"}, }); } CTOR_AO(Path_Door, "Door", AO::TlvTypes::Door_6) { ADD("Level", mTlv.field_18_level); ADD("Path", mTlv.field_1A_path); ADD("Camera", mTlv.field_1C_camera); ADD("Scale", mTlv.field_1E_scale); ADD("DoorNumber", mTlv.field_20_door_number); ADD("Id", mTlv.field_22_id); ADD("TargetDoorNumber", mTlv.field_24_target_door_number); ADD("StartState", mTlv.field_26_start_state); ADD("DoorClosed", mTlv.field_28_door_closed); ADD("Hub1", mTlv.field_2A_hub1); ADD("Hub2", mTlv.field_2A_hub2); ADD("Hub3", mTlv.field_2A_hub3); ADD("Hub4", mTlv.field_2A_hub4); ADD("Hub5", mTlv.field_2A_hub5); ADD("Hub6", mTlv.field_2A_hub6); ADD("Hub7", mTlv.field_2A_hub7); ADD("Hub8", mTlv.field_2A_hub8); ADD("WipeEffect", mTlv.field_3A_wipe_effect); ADD("MovieNumber", mTlv.field_3C_movie_number); ADD("XOffset", mTlv.field_3E_x_offset); ADD("YOffset", mTlv.field_40_y_offset); ADD("WipeXOrg", mTlv.field_42_wipe_x_org); ADD("WipeYOrg", mTlv.field_44_wipe_y_org); ADD("AbeDirection", mTlv.field_46_abe_direction); } }; struct Path_ContinuePoint : public TlvObjectBaseAO<AO::Path_ContinuePoint> { CTOR_AO(Path_ContinuePoint, "ContinuePoint", AO::TlvTypes::ContinuePoint_0) { ADD("ZoneNumber", mTlv.field_18_zone_number); ADD("ClearFromId", mTlv.field_1A_clear_from_id); ADD("ClearToId", mTlv.field_1C_clear_to_id); ADD("ElumRestarts", mTlv.field_1E_elum_restarts); ADD("AbeSpawnDirection", mTlv.field_20_abe_direction); } }; struct Path_Hoist : public TlvObjectBaseAO<AO::Path_Hoist> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::Path_Hoist::Type>("Enum_HoistType", { {AO::Path_Hoist::Type::eNextEdge, "next_edge"}, {AO::Path_Hoist::Type::eNextFloor, "next_floor"}, {AO::Path_Hoist::Type::eOffScreen, "off_screen"}, }); types.AddEnum<AO::Path_Hoist::EdgeType>("Enum_HoistEdgeType", { {AO::Path_Hoist::EdgeType::eBoth, "both"}, {AO::Path_Hoist::EdgeType::eLeft, "left"}, {AO::Path_Hoist::EdgeType::eRight, "right"}, }); } CTOR_AO(Path_Hoist, "Hoist", AO::TlvTypes::Hoist_3) { ADD("HoistType", mTlv.field_18_hoist_type); ADD("HoistEdgeType", mTlv.field_1A_edge_type); ADD("Id", mTlv.field_1C_id); } }; struct Path_Change : public TlvObjectBaseAO<AO::Path_ChangeTLV> { CTOR_AO(Path_Change, "PathTransition", AO::TlvTypes::PathTransition_1) { ADD("Level", mTlv.field_18_level); ADD("HoistEdgeType", mTlv.field_1A_path); ADD("Camera", mTlv.field_1C_camera); ADD("Movie", mTlv.field_1E_movie); // TODO: Enum ADD("Wipe", mTlv.field_20_wipe); // TODO: Enum ADD("Scale", mTlv.field_22_scale); // TODO: Enum } }; struct Path_Switch : public TlvObjectBaseAO<AO::Path_Switch> { CTOR_AO(Path_Switch, "Switch", AO::TlvTypes::Switch_26) { ADD("TriggerObject", mTlv.field_18_trigger_object); ADD("TriggerAction", mTlv.field_1A_trigger_object_action); ADD("Scale", mTlv.field_1C_scale); ADD("OnSound", mTlv.field_1E_on_sound); // TODO: Enum ADD("OffSound", mTlv.field_20_off_sound); // TODO: Enum ADD("SoundDirection", mTlv.field_22_sound_direction); // TODO: Enum } }; struct Path_LightEffect : public TlvObjectBaseAO<AO::Path_LightEffect> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::Path_LightEffect::Type>("Enum_LightType", { {AO::Path_LightEffect::Type::Star_0, "Star"}, {AO::Path_LightEffect::Type::RedGlow_1, "RedGlow"}, {AO::Path_LightEffect::Type::GreenGlow_2, "GreenGlow"}, {AO::Path_LightEffect::Type::FlintGlow_3, "FlintGlow"}, {AO::Path_LightEffect::Type::Switchable_RedGreenDoorLights_4, "RedGreenDoorLight"}, {AO::Path_LightEffect::Type::Switchable_RedGreenHubLight_5, "RedGreenHubLight"}, }); } CTOR_AO(Path_LightEffect, "LightEffect", AO::TlvTypes::LightEffect_106) { ADD("Type", mTlv.field_18_type); ADD("Size", mTlv.field_1A_size); ADD("Id", mTlv.field_1C_id); ADD("FlipX", mTlv.field_1E_flip_x); } }; struct Path_ElectricWall : public TlvObjectBaseAO<AO::Path_ElectricWall> { CTOR_AO(Path_ElectricWall, "ElectricWall", AO::TlvTypes::ElectricWall_67) { ADD("Scale", mTlv.field_18_scale); ADD("Id", mTlv.field_1A_id); ADD("State", mTlv.field_1C_start_state); // TODO: Enum } }; struct Path_ContinueZone : public TlvObjectBaseAO<AO::Path_ContinueZone> { CTOR_AO(Path_ContinueZone, "ContinueZone", AO::TlvTypes::ContinueZone_2) { ADD("ZoneNumber", mTlv.field_10_zone_number); } }; struct Path_StartController : public TlvObjectBaseAO<AO::Path_StartController> { CTOR_AO(Path_StartController, "StartController", AO::TlvTypes::StartController_28) { // No fields } }; struct Path_Edge : public TlvObjectBaseAO<AO::Path_Edge> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::Path_Edge::Type>("Enum_EdgeType", { {AO::Path_Edge::Type::eLeft, "left"}, {AO::Path_Edge::Type::eRight, "right"}, {AO::Path_Edge::Type::eBoth, "both"}, }); } CTOR_AO(Path_Edge, "Edge", AO::TlvTypes::Edge_4) { ADD("type", mTlv.field_18_type); ADD("can_grab", mTlv.field_1A_can_grab); } }; struct Path_WellLocal : public TlvObjectBaseAO<AO::Path_WellLocal> { CTOR_AO(Path_WellLocal, "WellLocal", AO::TlvTypes::WellLocal_11) { // Well base ADD("scale", mTlv.field_18_scale); ADD("trigger_id", mTlv.field_1A_trigger_id); ADD("well_id", mTlv.field_1C_well_id); ADD("resource_id", mTlv.field_1E_res_id); ADD("exit_x", mTlv.field_20_exit_x); ADD("exit_y", mTlv.field_22_exit_y); ADD("dx", mTlv.field_24_off_level_or_dx.dx); ADD("dy", mTlv.field_26_off_path_or_dy); // Well local ADD("on_dx", mTlv.field_28_on_dx); ADD("on_dy", mTlv.field_2A_on_dy); ADD("emit_leaves", mTlv.field_2C_bEmit_leaves); ADD("leaf_x", mTlv.field_2E_leaf_x); ADD("leaf_y", mTlv.field_30_leaf_y); } }; struct Path_WellExpress : public TlvObjectBaseAO<AO::Path_WellExpress> { CTOR_AO(Path_WellExpress, "WellExpress", AO::TlvTypes::WellExpress_45) { // Well base ADD("scale", mTlv.field_18_scale); ADD("trigger_id", mTlv.field_1A_trigger_id); ADD("well_id", mTlv.field_1C_well_id); ADD("resource_id", mTlv.field_1E_res_id); ADD("exit_x", mTlv.field_20_exit_x); ADD("exit_y", mTlv.field_22_exit_y); ADD("off_level", mTlv.field_24_off_level_or_dx.level); ADD("off_path", mTlv.field_26_off_path_or_dy); // Well express ADD("off_camera", mTlv.field_28_off_camera); ADD("off_well_id", mTlv.field_2A_off_well_id); ADD("on_level", mTlv.field_2C_on_level); ADD("on_path", mTlv.field_2E_on_path); ADD("on_camera", mTlv.field_30_on_camera); ADD("on_well_id", mTlv.field_32_on_well_id); ADD("emit_leaves", mTlv.field_34_emit_leaves); ADD("leaf_x", mTlv.field_36_leaf_x); ADD("leaf_y", mTlv.field_38_leaf_y); ADD("movie_id", mTlv.field_3A_movie_id); } }; struct Path_InvisibleZone : public TlvObjectBaseAO<AO::Path_InvisibleZone> { CTOR_AO(Path_InvisibleZone, "InvisibleZone", AO::TlvTypes::InvisibleZone_58) { // No fields } }; struct Path_EnemyStopper : public TlvObjectBaseAO<AO::Path_EnemyStopper> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::Path_EnemyStopper::StopDirection>("Enum_StopDirection", { {AO::Path_EnemyStopper::StopDirection::Left_0, "left"}, {AO::Path_EnemyStopper::StopDirection::Right_1, "right"}, {AO::Path_EnemyStopper::StopDirection::Both_2, "both"}, }); } CTOR_AO(Path_EnemyStopper, "EnemyStopper", AO::TlvTypes::EnemyStopper_79) { ADD("direction", mTlv.field_18_direction); ADD("id", mTlv.field_1A_id); } }; struct Path_Slig : public TlvObjectBaseAO<AO::Path_Slig> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::Path_Slig::StartState>("Enum_SligStartState", { {AO::Path_Slig::StartState::Listening_0, "listening"}, {AO::Path_Slig::StartState::Paused_1, "paused"}, {AO::Path_Slig::StartState::Sleeping_2, "sleeping"}, {AO::Path_Slig::StartState::Chase_3, "chase"}, {AO::Path_Slig::StartState::GameEnder_4, "game_ender"}, {AO::Path_Slig::StartState::Paused_5, "paused"}, }); } CTOR_AO(Path_Slig, "Slig", AO::TlvTypes::Slig_24) { ADD("scale", mTlv.field_18_scale); ADD("start_state", mTlv.field_1A_start_state); ADD("pause_time", mTlv.field_1C_pause_time); ADD("pause_left_min", mTlv.field_1E_pause_left_min); ADD("pause_left_max", mTlv.field_20_pause_left_max); ADD("pause_right_min", mTlv.field_22_pause_right_min); ADD("pause_right_max", mTlv.field_24_pause_right_max); ADD("chal_type", mTlv.field_26_chal_type); ADD("chal_time", mTlv.field_28_chal_time); ADD("number_of_times_to_shoot", mTlv.field_2A_number_of_times_to_shoot); ADD("unknown", mTlv.field_2C_unknown); ADD("code1", mTlv.field_2E_code1); ADD("code2", mTlv.field_30_code2); ADD("chase_abe", mTlv.field_32_chase_abe); ADD("start_direction", mTlv.field_34_start_direction); ADD("panic_timeout", mTlv.field_36_panic_timeout); ADD("num_panic_sounds", mTlv.field_38_num_panic_sounds); ADD("panic_sound_timeout", mTlv.field_3A_panic_sound_timeout); ADD("stop_chase_delay", mTlv.field_3C_stop_chase_delay); ADD("time_to_wait_before_chase", mTlv.field_3E_time_to_wait_before_chase); ADD("slig_id", mTlv.field_40_slig_id); ADD("listen_time", mTlv.field_42_listen_time); ADD("percent_say_what", mTlv.field_44_percent_say_what); ADD("percent_beat_mud", mTlv.field_46_percent_beat_mud); ADD("talk_to_abe", mTlv.field_48_talk_to_abe); ADD("dont_shoot", mTlv.field_4A_dont_shoot); ADD("z_shoot_delay", mTlv.field_4C_z_shoot_delay); ADD("stay_awake", mTlv.field_4E_stay_awake); ADD("disable_resources", mTlv.field_50_disable_resources.Raw().all); ADD("noise_wake_up_distance", mTlv.field_52_noise_wake_up_distance); ADD("id", mTlv.field_54_id); } }; struct Path_DeathDrop : public TlvObjectBaseAO<AO::Path_DeathDrop> { CTOR_AO(Path_DeathDrop, "DeathDrop", AO::TlvTypes::DeathDrop_5) { ADD_HIDDEN("animation", mTlv.animation); ADD_HIDDEN("sound", mTlv.sound); ADD_HIDDEN("id", mTlv.id); ADD_HIDDEN("action", mTlv.action); ADD_HIDDEN("set_value", mTlv.set_value); } }; struct Path_SligLeftBound : public TlvObjectBaseAO<AO::Path_SligLeftBound> { CTOR_AO(Path_SligLeftBound, "SligLeftBound", AO::TlvTypes::eSligBoundLeft_57) { ADD("id", mTlv.field_18_slig_id); ADD("disabled_resources", mTlv.field_1A_disabled_resources.Raw().all); } }; struct Path_SligRightBound : public TlvObjectBaseAO<AO::Path_SligRightBound> { CTOR_AO(Path_SligRightBound, "SligRightBound", AO::TlvTypes::eSligBoundRight_76) { ADD("id", mTlv.field_18_slig_id); ADD("disabled_resources", mTlv.field_1A_disabled_resources.Raw().all); } }; struct Path_SligPersist : public TlvObjectBaseAO<AO::Path_SligPersist> { CTOR_AO(Path_SligPersist, "SligPersist", AO::TlvTypes::eSligPersist_77) { ADD("id", mTlv.field_18_slig_id); ADD("disabled_resources", mTlv.field_1A_disabled_resources.Raw().all); } }; struct Path_SecurityOrb : public TlvObjectBaseAO<AO::Path_SecurityOrb> { CTOR_AO(Path_SecurityOrb, "SecurityOrb", AO::TlvTypes::SecurityOrb_29) { ADD("scale", mTlv.field_18_scale); ADD("disabled_resources", mTlv.field_1A_disable_resources); } }; struct Path_FallingItem : public TlvObjectBaseAO<AO::Path_FallingItem> { CTOR_AO(Path_FallingItem, "FallingItem", AO::TlvTypes::FallingItem_15) { ADD("id", mTlv.field_18_id); ADD("scale", mTlv.field_1A_scale); ADD("delay_time", mTlv.field_1C_delay_time); ADD("number_of_items", mTlv.field_1E_number_of_items); ADD("reset_id", mTlv.field_20_reset_id); } }; struct Path_Mine : public TlvObjectBaseAO<AO::Path_Mine> { CTOR_AO(Path_Mine, "Mine", AO::TlvTypes::Mine_46) { ADD("num_patterns", mTlv.field_18_num_patterns); ADD("pattern", mTlv.field_1A_pattern); ADD("scale", mTlv.field_1C_scale); ADD("disabled_resources", mTlv.field_1E_disabled_resources); ADD("persists_offscreen", mTlv.field_20_persists_offscreen); } }; struct Path_Dove : public TlvObjectBaseAO<AO::Path_Dove> { CTOR_AO(Path_Dove, "Dove", AO::TlvTypes::Dove_12) { ADD("dove_count", mTlv.field_18_dove_count); ADD("pixel_perfect", mTlv.field_1A_pixel_perfect); ADD("scale", mTlv.field_1C_scale); } }; struct Path_UXB : public TlvObjectBaseAO<AO::Path_UXB> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::UXB_State>("UXB_State", { {AO::UXB_State::eArmed_0, "Armed"}, {AO::UXB_State::eDisarmed_1, "Disarmed"}, }); } CTOR_AO(Path_UXB, "UXB", AO::TlvTypes::UXB_47) { ADD("num_patterns", mTlv.field_18_num_patterns); ADD("pattern", mTlv.field_1A_pattern); ADD("scale", mTlv.field_1C_scale); ADD("state", mTlv.field_1E_state); ADD("disabled_resources", mTlv.field_20_disabled_resources); } }; struct Path_HintFly : public TlvObjectBaseAO<AO::Path_HintFly> { CTOR_AO(Path_HintFly, "HintFly", AO::TlvTypes::HintFly_92) { ADD("message_id", mTlv.field_18_message_id); } }; struct Path_Bat : public TlvObjectBaseAO<AO::Path_Bat> { CTOR_AO(Path_Bat, "Bat", AO::TlvTypes::Bat_49) { ADD("ticks_before_moving", mTlv.field_18_ticks_before_moving); ADD("speed", mTlv.field_1A_speed); ADD("scale", mTlv.field_1C_scale); ADD("attack_duration", mTlv.field_1E_attack_duration); } }; struct Path_ShadowZone : public TlvObjectBaseAO<AO::Path_ShadowZone> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::ShadowZoneScale>("Enum_ShadowZoneScale", { {AO::ShadowZoneScale::eBoth_0, "both"}, {AO::ShadowZoneScale::eHalf_1, "half"}, {AO::ShadowZoneScale::eFull_2, "full"}, }); } CTOR_AO(Path_ShadowZone, "ShadowZone", AO::TlvTypes::ShadowZone_7) { ADD("centre_w", mTlv.field_18_centre_w); ADD("centre_h", mTlv.field_1A_centre_h); ADD("r", mTlv.field_1C_r); ADD("g", mTlv.field_1E_g); ADD("b", mTlv.field_20_b); ADD("id", mTlv.field_22_id); ADD("scale", mTlv.field_24_scale); } }; struct Path_BellHammer : public TlvObjectBaseAO<AO::Path_BellHammer> { CTOR_AO(Path_BellHammer, "BellHammer", AO::TlvTypes::BellHammer_27) { ADD("id", mTlv.field_18_id); ADD("action", mTlv.field_1A_action); ADD("scale", mTlv.field_1C_scale); ADD("direction", mTlv.field_1E_direction); } }; struct Path_IdSplitter : public TlvObjectBaseAO<AO::Path_IdSplitter> { CTOR_AO(Path_IdSplitter, "IdSplitter", AO::TlvTypes::IdSplitter_94) { ADD("source_id", mTlv.field_18_source_id); ADD("delay", mTlv.field_1A_delay); ADD("id_1", mTlv.field_1C_id1); ADD("id_2", mTlv.field_1C_id2); ADD("id_3", mTlv.field_1C_id3); ADD("id_4", mTlv.field_1C_id4); } }; struct Path_PullRingRope : public TlvObjectBaseAO<AO::Path_PullRingRope> { CTOR_AO(Path_PullRingRope, "PullRingRope", AO::TlvTypes::PullRingRope_18) { ADD("id", mTlv.field_18_id); ADD("action", mTlv.field_1A_action); ADD("rope_length", mTlv.field_1C_rope_length); ADD("scale", mTlv.field_1E_scale); ADD("on_sound", mTlv.field_20_on_sound); ADD("off_sound", mTlv.field_22_off_sound); ADD("sound_direction", mTlv.field_24_sound_direction); } }; struct Path_MusicTrigger : public TlvObjectBaseAO<AO::Path_MusicTrigger> { CTOR_AO(Path_MusicTrigger, "MusicTrigger", AO::TlvTypes::MusicTrigger_105) { ADD("type", mTlv.field_18_type); ADD("enabled_by", mTlv.field_1A_enabled_by); ADD("id", mTlv.field_1C_id); ADD("timer", mTlv.field_1E_timer); } }; struct Path_ElumPathTrans : public TlvObjectBaseAO<AO::Path_ElumPathTrans> { CTOR_AO(Path_ElumPathTrans, "ElumPathTrans", AO::TlvTypes::ElumPathTrans_99) { ADD("level", mTlv.field_18_level); ADD("path", mTlv.field_1A_path); ADD("camera", mTlv.field_1C_camera); } }; struct Path_ElumStart : public TlvObjectBaseAO<AO::Path_ElumStart> { CTOR_AO(Path_ElumStart, "ElumStart", AO::TlvTypes::ElumStart_38) { // No fields } }; struct Path_ElumWall : public TlvObjectBaseAO<AO::Path_ElumWall> { CTOR_AO(Path_ElumWall, "ElumWall", AO::TlvTypes::ElumWall_40) { // No fields } }; struct Path_LiftPoint : public TlvObjectBaseAO<AO::Path_LiftPoint> { CTOR_AO(Path_LiftPoint, "LiftPoint", AO::TlvTypes::LiftPoint_8) { ADD("id", mTlv.field_18_id); ADD("is_start_point", mTlv.field_1A_bstart_point); ADD("lift_type", mTlv.field_1C_lift_type); ADD("lift_point_stop_type", mTlv.field_1E_lift_point_stop_type); ADD("scale", mTlv.field_20_scale); ADD("ignore_lift_mover", mTlv.field_22_bIgnore_lift_mover); } }; struct Path_MovingBomb : public TlvObjectBaseAO<AO::Path_MovingBomb> { CTOR_AO(Path_MovingBomb, "MovingBomb", AO::TlvTypes::MovingBomb_86) { ADD("speed", mTlv.field_18_speed); ADD("id", mTlv.field_1A_id); ADD("start_type_triggered_by_alarm", mTlv.field_1C_bStart_type_triggered_by_alarm); ADD("scale", mTlv.field_1E_scale); ADD("max_rise", mTlv.field_20_max_rise); ADD("disabled_resources", mTlv.field_22_disabled_resources); ADD("start_speed", mTlv.field_24_start_speed); ADD("persist_offscreen", mTlv.field_26_persist_offscreen); } }; struct Path_MovingBombStopper : public TlvObjectBaseAO<AO::Path_MovingBombStopper> { CTOR_AO(Path_MovingBombStopper, "MovingBombStopper", AO::TlvTypes::MovingBombStopper_87) { ADD("min_delay", mTlv.field_18_min_delay); ADD("max_delay", mTlv.field_1A_max_delay); } }; struct Path_RingMudokon : public TlvObjectBaseAO<AO::Path_RingMudokon> { CTOR_AO(Path_RingMudokon, "RingMudokon", AO::TlvTypes::RingMudokon_50) { ADD("facing", mTlv.field_18_facing); ADD("abe_must_be_same_direction", mTlv.field_1A_abe_must_be_same_direction); ADD("scale", mTlv.field_1C_scale); ADD("silent", mTlv.field_1E_silent); ADD("code1", mTlv.field_20_code1); ADD("code2", mTlv.field_22_code2); ADD("action", mTlv.field_24_action); ADD("ring_timeout", mTlv.field_26_ring_timeout); ADD("instant_powerup", mTlv.field_28_instant_powerup); } }; struct Path_RingCancel : public TlvObjectBaseAO<AO::Path_RingCancel> // TODO: correct size is 24 not 28 { CTOR_AO(Path_RingCancel, "RingCancel", AO::TlvTypes::RingCancel_109) { // No properties } }; struct Path_MeatSaw : public TlvObjectBaseAO<AO::Path_MeatSaw> { CTOR_AO(Path_MeatSaw, "MeatSaw", AO::TlvTypes::MeatSaw_88) { ADD("scale", mTlv.field_18_scale_background); ADD("min_time_off1", mTlv.field_1A_min_time_off1); ADD("max_time_off1", mTlv.field_1C_max_time_off1); ADD("max_rise_time", mTlv.field_1E_max_rise_time); ADD("id", mTlv.field_20_id); ADD("type", mTlv.field_22_type); ADD("speed", mTlv.field_24_speed); ADD("start_state", mTlv.field_26_start_state); ADD("off_speed", mTlv.field_28_off_speed); ADD("min_time_off2", mTlv.field_2A_min_time_off2); ADD("max_time_off2", mTlv.field_2C_max_time_off2); ADD("initial_position", mTlv.field_2E_inital_position); } }; struct Path_LCDScreen : public TlvObjectBaseAO<AO::Path_LCDScreen> { CTOR_AO(Path_LCDScreen, "LCDScreen", AO::TlvTypes::LCDScreen_98) { ADD("message_1_id", mTlv.field_18_message_1_id); ADD("message_rand_min", mTlv.field_1A_message_rand_min); ADD("message_rand_max", mTlv.field_1C_message_rand_max); } }; struct Path_InvisibleSwitch : public TlvObjectBaseAO<AO::Path_InvisibleSwitch> { CTOR_AO(Path_InvisibleSwitch, "InvisibleSwitch", AO::TlvTypes::InvisibleSwitch_81) { ADD("id", mTlv.field_18_id); ADD("action", mTlv.field_1A_action); ADD("delay", mTlv.field_1C_delay); ADD("set_off_alarm", mTlv.field_1E_set_off_alarm); ADD("scale", mTlv.field_20_scale); } }; struct Path_TrapDoor : public TlvObjectBaseAO<AO::Path_TrapDoor> { CTOR_AO(Path_TrapDoor, "TrapDoor", AO::TlvTypes::TrapDoor_55) { ADD("id", mTlv.field_18_id); ADD("start_state", mTlv.field_1A_start_state); ADD("self_closing", mTlv.field_1C_self_closing); ADD("scale", mTlv.field_1E_scale); ADD("dest_level", mTlv.field_20_dest_level); ADD("direction", mTlv.field_22_direction); ADD("anim_offset", mTlv.field_24_anim_offset); } }; struct Path_BirdPortal : public TlvObjectBaseAO<AO::Path_BirdPortal> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::PortalSide>("Enum_PortalSide", { {AO::PortalSide::eRight_0, "right"}, {AO::PortalSide::eLeft_1, "left"}, }); types.AddEnum<AO::PortalType>("Enum_PortalType", { {AO::PortalType::eAbe_0, "abe"}, {AO::PortalType::eWorker_1, "worker"}, {AO::PortalType::eShrykull_2, "shrykull"}, {AO::PortalType::eMudTeleport_3, "mud_teleport"}, }); } CTOR_AO(Path_BirdPortal, "BirdPortal", AO::TlvTypes::BirdPortal_52) { ADD("side", mTlv.field_18_side); ADD("dest_level", mTlv.field_1A_dest_level); ADD("dest_path", mTlv.field_1C_dest_path); ADD("dest_camera", mTlv.field_1E_dest_camera); ADD("scale", mTlv.field_20_scale); ADD("movie_id", mTlv.field_22_movie_id); ADD("portal_type", mTlv.field_24_portal_type); ADD("num_muds_for_shrykull", mTlv.field_26_num_muds_for_shrykul); } }; struct Path_BoomMachine : public TlvObjectBaseAO<AO::Path_BoomMachine> { CTOR_AO(Path_BoomMachine, "BoomMachine", AO::TlvTypes::BoomMachine_97) { ADD("scale", mTlv.field_18_scale); ADD("nozzle_side", mTlv.field_1A_nozzle_side); ADD("disabled_resources", mTlv.field_1C_disabled_resources); ADD("number_of_grenades", mTlv.field_1E_number_of_grenades); } }; struct Path_Mudokon : public TlvObjectBaseAO<AO::Path_Mudokon> { CTOR_AO(Path_Mudokon, "Mudokon", AO::TlvTypes::Mudokon_82) { ADD("scale", mTlv.field_18_scale); ADD("job", mTlv.field_1A_job); ADD("direction", mTlv.field_1C_direction); ADD("voice_adjust", mTlv.field_1E_voice_adjust); ADD("rescue_id", mTlv.field_20_rescue_id); ADD("deaf", mTlv.field_22_deaf); ADD("disabled_resources", mTlv.field_24_disabled_resources); ADD("persist", mTlv.field_26_persist); } }; struct Path_BirdPortalExit : public TlvObjectBaseAO<AO::Path_BirdPortalExit> { CTOR_AO(Path_BirdPortalExit, "BirdPortalExit", AO::TlvTypes::BirdPortalExit_53) { ADD("side", mTlv.field_18_side); ADD("scale", mTlv.field_1A_scale); } }; struct Path_Slog : public TlvObjectBaseAO<AO::Path_Slog> { CTOR_AO(Path_Slog, "Slog", AO::TlvTypes::Slog_25) { ADD("scale", mTlv.field_18_scale); ADD("direction", mTlv.field_1A_direction); ADD("wakeup_anger", mTlv.field_1C_wakeup_anger); ADD("bark_anger", mTlv.field_1E_bark_anger); ADD("sleeps", mTlv.field_20_sleeps); ADD("chase_anger", mTlv.field_22_chase_anger); ADD("jump_attack_delay", mTlv.field_24_jump_attack_delay); ADD("disabled_resources", mTlv.field_26_disabled_resources); ADD("anger_trigger_id", mTlv.field_28_anger_trigger_id); } }; struct Path_ChimeLock : public TlvObjectBaseAO<AO::Path_ChimeLock> { CTOR_AO(Path_ChimeLock, "ChimeLock", AO::TlvTypes::ChimeLock_69) { ADD("scale", mTlv.field_18_scale); ADD("solve_id", mTlv.field_1A_solve_id); ADD("code1", mTlv.field_1C_code1); ADD("code2", mTlv.field_1E_code2); ADD("id", mTlv.field_20_id); } }; struct Path_FlintLockFire : public TlvObjectBaseAO<AO::Path_FlintLockFire> { CTOR_AO(Path_FlintLockFire, "FlintLockFire", AO::TlvTypes::FlintLockFire_73) { ADD("scale", mTlv.field_18_scale); ADD("id", mTlv.field_1A_id); } }; struct Path_LiftMover : public TlvObjectBaseAO<AO::Path_LiftMover> { CTOR_AO(Path_LiftMover, "LiftMover", AO::TlvTypes::LiftMover_68) { ADD("switch_id", mTlv.field_18_switch_id); ADD("lift_id", mTlv.field_1A_lift_id); ADD("direction", mTlv.field_1C_direction); } }; struct Path_Scrab : public TlvObjectBaseAO<AO::Path_Scrab> { CTOR_AO(Path_Scrab, "Scrab", AO::TlvTypes::Scrab_72) { ADD("scale", mTlv.field_18_scale); ADD("attack_delay", mTlv.field_1A_attack_delay); ADD("patrol_type", mTlv.field_1C_patrol_type); ADD("left_min_delay", mTlv.field_1E_left_min_delay); ADD("left_max_delay", mTlv.field_20_left_max_delay); ADD("right_min_delay", mTlv.field_22_right_min_delay); ADD("right_max_delay", mTlv.field_24_right_max_delay); ADD("attack_duration", mTlv.field_26_attack_duration); ADD("disable_resources", mTlv.field_28_disable_resources); ADD("roar_randomly", mTlv.field_2A_roar_randomly); } }; struct Path_SlogSpawner : public TlvObjectBaseAO<AO::Path_SlogSpawner> { CTOR_AO(Path_SlogSpawner, "SlogSpawner", AO::TlvTypes::SlogSpawner_107) { ADD("scale", mTlv.field_18_scale); ADD("num_slogs", mTlv.field_1A_num_slogs); ADD("num_at_a_time", mTlv.field_1C_num_at_a_time); ADD("direction", mTlv.field_1E_direction); ADD("ticks_between_slogs", mTlv.field_20_ticks_between_slogs); ADD("start_id", mTlv.field_22_start_id); } }; struct Path_RockSack : public TlvObjectBaseAO<AO::Path_RockSack> { CTOR_AO(Path_RockSack, "RockSack", AO::TlvTypes::RockSack_13) { ADD("side", mTlv.field_18_side); ADD("x_vel", mTlv.field_1A_x_vel); ADD("y_vel", mTlv.field_1C_y_vel); ADD("scale", mTlv.field_1E_scale); ADD("num_rocks", mTlv.field_20_num_rocks); } }; struct Path_SlogHut : public TlvObjectBaseAO<AO::Path_SlogHut> { CTOR_AO(Path_SlogHut, "SlogHut", AO::TlvTypes::SlogHut_111) { ADD("scale", mTlv.field_18_scale); ADD("switch_id", mTlv.field_1A_switch_id); ADD("z_delay", mTlv.field_1C_z_delay); } }; struct Path_SecurityClaw : public TlvObjectBaseAO<AO::Path_SecurityClaw> { CTOR_AO(Path_SecurityClaw, "SecurityClaw", AO::TlvTypes::SecurityClaw_61) { ADD("scale", mTlv.field_18_scale); ADD("alarm_id", mTlv.field_1A_alarm_id); ADD("alarm_time", mTlv.field_1C_alarm_time); ADD("disabled_resources", mTlv.field_1E_disabled_resources); } }; struct Path_SecurityDoor : public TlvObjectBaseAO<AO::Path_SecurityDoor> { CTOR_AO(Path_SecurityDoor, "SecurityDoor", AO::TlvTypes::SecurityDoor_95) { ADD("scale", mTlv.field_18_scale); ADD("id", mTlv.field_1A_id); ADD("code_1", mTlv.field_1C_code_1); ADD("code_2", mTlv.field_1E_code2); ADD("xpos", mTlv.field_20_xpos); ADD("ypos", mTlv.field_22_ypos); } }; struct Path_TimedMine : public TlvObjectBaseAO<AO::Path_TimedMine> { CTOR_AO(Path_TimedMine, "TimedMine", AO::TlvTypes::TimedMine_22) { ADD("id", mTlv.field_18_id); ADD("state", mTlv.field_1A_state); ADD("scale", mTlv.field_1C_scale); ADD("ticks_before_explode", mTlv.field_1E_ticks_before_explode); ADD("disable_resources", mTlv.field_20_disable_resources); } }; struct Path_SligSpawner : public TlvObjectBaseAO<AO::Path_SligSpawner> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::Path_SligSpawner::StartState>("Enum_SligSpawnerStartState", { {AO::Path_SligSpawner::StartState::Listening_0, "listening"}, {AO::Path_SligSpawner::StartState::Paused_1, "paused"}, {AO::Path_SligSpawner::StartState::Sleeping_2, "sleeping"}, {AO::Path_SligSpawner::StartState::Chase_3, "chase"}, {AO::Path_SligSpawner::StartState::GameEnder_4, "game_ender"}, {AO::Path_SligSpawner::StartState::Paused_5, "paused"}, }); } CTOR_AO(Path_SligSpawner, "SligSpawner", AO::TlvTypes::SligSpawner_66) { ADD("scale", mTlv.field_18_scale); ADD("start_state", mTlv.field_1A_start_state); ADD("pause_time", mTlv.field_1C_pause_time); ADD("pause_left_min", mTlv.field_1E_pause_left_min); ADD("pause_left_max", mTlv.field_20_pause_left_max); ADD("pause_right_min", mTlv.field_22_pause_right_min); ADD("pause_right_max", mTlv.field_24_pause_right_max); ADD("chal_type", mTlv.field_26_chal_type); ADD("chal_time", mTlv.field_28_chal_time); ADD("number_of_times_to_shoot", mTlv.field_2A_number_of_times_to_shoot); ADD("unknown", mTlv.field_2C_unknown); ADD("code1", mTlv.field_2E_code1); ADD("code2", mTlv.field_30_code2); ADD("chase_abe", mTlv.field_32_chase_abe); ADD("start_direction", mTlv.field_34_start_direction); ADD("panic_timeout", mTlv.field_36_panic_timeout); ADD("num_panic_sounds", mTlv.field_38_num_panic_sounds); ADD("panic_sound_timeout", mTlv.field_3A_panic_sound_timeout); ADD("stop_chase_delay", mTlv.field_3C_stop_chase_delay); ADD("time_to_wait_before_chase", mTlv.field_3E_time_to_wait_before_chase); ADD("slig_id", mTlv.field_40_slig_id); ADD("listen_time", mTlv.field_42_listen_time); ADD("percent_say_what", mTlv.field_44_percent_say_what); ADD("percent_beat_mud", mTlv.field_46_percent_beat_mud); ADD("talk_to_abe", mTlv.field_48_talk_to_abe); ADD("dont_shoot", mTlv.field_4A_dont_shoot); ADD("z_shoot_delay", mTlv.field_4C_z_shoot_delay); ADD("stay_awake", mTlv.field_4E_stay_awake); ADD("disable_resources", mTlv.field_50_disable_resources); ADD("noise_wake_up_distance", mTlv.field_52_noise_wake_up_distance); ADD("id", mTlv.field_54_id); } }; struct Path_MotionDetector : public TlvObjectBaseAO<AO::Path_MotionDetector> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::Path_MotionDetector::StartMoveDirection>("Enum_MotionDetectorStartMoveDirection", { {AO::Path_MotionDetector::StartMoveDirection::eRight_0, "right"}, {AO::Path_MotionDetector::StartMoveDirection::eLeft_1, "left"}, }); } CTOR_AO(Path_MotionDetector, "MotionDetector", AO::TlvTypes::MotionDetector_62) { ADD("scale", mTlv.field_18_scale); ADD("device_x", mTlv.field_1A_device_x); ADD("device_y", mTlv.field_1C_device_y); ADD("speed_x256", mTlv.field_1E_speed_x256); ADD("start_move_direction", mTlv.field_20_start_move_direction); ADD("draw_flare", mTlv.field_22_draw_flare); ADD("disable_id", mTlv.field_24_disable_id); ADD("alarm_id", mTlv.field_26_alarm_id); ADD("alarm_ticks", mTlv.field_28_alarm_ticks); } }; struct Path_BackgroundAnimation : public TlvObjectBaseAO<AO::Path_BackgroundAnimation> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::TPageAbr>("Enum_TPageAbr", { {AO::TPageAbr::eBlend_1, "blend_1"}, {AO::TPageAbr::eBlend_2, "blend_2"}, {AO::TPageAbr::eBlend_3, "blend_3"}, {AO::TPageAbr::eBlend_0, "blend_0"}, }); } CTOR_AO(Path_BackgroundAnimation, "BackgroundAnimation", AO::TlvTypes::BackgroundAnimation_19) { ADD("animation_id", mTlv.field_18_animation_id); ADD("is_semi_trans", mTlv.field_1A_is_semi_trans); ADD("semi_trans_mode", mTlv.field_1C_semi_trans_mode); ADD("sound_effect", mTlv.field_1E_sound_effect); } }; struct Path_LCDStatusBoard : public TlvObjectBaseAO<AO::Path_LCDStatusBoard> { CTOR_AO(Path_LCDStatusBoard, "LCDStatusBoard", AO::TlvTypes::LCDStatusBoard_103) { // No fields } }; struct Path_Preloader : public TlvObjectBaseAO<AO::Path_Preloader> { CTOR_AO(Path_Preloader, "Preloader", AO::TlvTypes::Preloader_102) { ADD("unload_cams_asap", mTlv.unload_cams_ASAP); } }; struct Path_Pulley : public TlvObjectBaseAO<AO::Path_Pulley> { CTOR_AO(Path_Pulley, "Pulley", AO::TlvTypes::Pulley_35) { ADD("scale", mTlv.scale); } }; struct Path_SoftLanding : public TlvObjectBaseAO<AO::Path_SoftLanding> { CTOR_AO(Path_SoftLanding, "SoftLanding", AO::TlvTypes::SoftLanding_114) { // No fields } }; struct Path_MudokonPathTrans : public TlvObjectBaseAO<AO::Path_MudokonPathTrans> { CTOR_AO(Path_MudokonPathTrans, "MudokonPathTrans", AO::TlvTypes::MudokonPathTrans_89) { ADD("level", mTlv.level); ADD("path", mTlv.path); ADD("camera", mTlv.camera); } }; struct Path_AbeStart : public TlvObjectBaseAO<AO::Path_AbeStart> { CTOR_AO(Path_AbeStart, "AbeStart", AO::TlvTypes::AbeStart_37) { ADD("scale", mTlv.scale); } }; struct Path_ZSligCover : public TlvObjectBaseAO<AO::Path_ZSligCover> { CTOR_AO(Path_ZSligCover, "ZSligCover", AO::TlvTypes::ZSligCover_83) { // No fields } }; struct Path_ScrabLeftBound : public TlvObjectBaseAO<AO::Path_ScrabLeftBound> { CTOR_AO(Path_ScrabLeftBound, "ScrabLeftBound", AO::TlvTypes::ScrabLeftBound_74) { // No fields } }; struct Path_ScrabRightBound : public TlvObjectBaseAO<AO::Path_ScrabRightBound> { CTOR_AO(Path_ScrabRightBound, "ScrabRightBound", AO::TlvTypes::ScrabRightBound_75) { // No fields } }; struct Path_ScrabNoFall : public TlvObjectBaseAO<AO::Path_ScrabNoFall> { CTOR_AO(Path_ScrabNoFall, "ScrabNoFall", AO::TlvTypes::ScrabNoFall_93) { // No fields } }; struct Path_LiftMudokon : public TlvObjectBaseAO<AO::Path_LiftMudokon> { CTOR_AO(Path_LiftMudokon, "LiftMudokon", AO::TlvTypes::LiftMudokon_32) { ADD("how_far_to_walk", mTlv.field_18_how_far_to_walk); ADD("lift_id", mTlv.field_1A_lift_id); ADD("direction", mTlv.field_1C_direction); ADD("silent", mTlv.field_1E_silent); ADD("scale", mTlv.field_20_scale); ADD("code1", mTlv.field_22_code1); ADD("code2", mTlv.field_24_code2); } }; struct Path_HoneySack : public TlvObjectBaseAO<AO::Path_HoneySack> { CTOR_AO(Path_HoneySack, "HoneySack", AO::TlvTypes::HoneySack_36) { ADD("chase_ticks", mTlv.field_18_chase_ticks); ADD("scale", mTlv.field_1A_scale); } }; struct Path_SlingMudokon : public TlvObjectBaseAO<AO::Path_SlingMudokon> { CTOR_AO(Path_SlingMudokon, "SlingMudokon", AO::TlvTypes::SlingMudokon_41) { ADD("scale", mTlv.field_18_scale); ADD("silent", mTlv.field_1A_silent); ADD("code1", mTlv.field_1C_code_1); ADD("code2", mTlv.field_1E_code_2); } }; struct Path_BeeSwarmHole : public TlvObjectBaseAO<AO::Path_BeeSwarmHole> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::Path_BeeSwarmHole::MovementType>("Enum_BeeSwarmHoleMovementType", { {AO::Path_BeeSwarmHole::MovementType::eHover_0, "hover"}, {AO::Path_BeeSwarmHole::MovementType::eAttack_1, "attack"}, {AO::Path_BeeSwarmHole::MovementType::eFollowPath_2, "follow_path"}, }); } CTOR_AO(Path_BeeSwarmHole, "BeeSwarmHole", AO::TlvTypes::BeeSwarmHole_34) { ADD("what_to_spawn", mTlv.field_18_what_to_spawn); ADD("interval", mTlv.field_1A_interval); ADD("id", mTlv.field_1C_id); ADD("movement_type", mTlv.field_1E_movement_type); ADD("size", mTlv.field_20_size); ADD("chase_time", mTlv.field_22_chase_time); ADD("speed", mTlv.field_24_speed); ADD("scale", mTlv.field_26_scale); } }; struct Path_MeatSack : public TlvObjectBaseAO<AO::Path_MeatSack> { CTOR_AO(Path_MeatSack, "MeatSack", AO::TlvTypes::MeatSack_71) { ADD("side", mTlv.field_18_side); ADD("x_vel", mTlv.field_1A_x_vel); ADD("y_vel", mTlv.field_1C_y_vel); ADD("scale", mTlv.field_1E_scale); ADD("amount_of_meat", mTlv.field_20_amount_of_meat); } }; struct Path_RollingBall : public TlvObjectBaseAO<AO::Path_RollingBall> { CTOR_AO(Path_RollingBall, "RollingBall", AO::TlvTypes::RollingBall_56) { ADD("scale", mTlv.field_18_scale); ADD("roll_direction", mTlv.field_1A_roll_direction); ADD("release", mTlv.field_1C_release); ADD("speed", mTlv.field_1E_speed); ADD("acceleration", mTlv.field_20_acceleration); } }; struct Path_RollingBallStopper : public TlvObjectBaseAO<AO::Path_RollingBallStopper> { CTOR_AO(Path_RollingBallStopper, "RollingBallStopper", AO::TlvTypes::RollingBallStopper_59) { ADD("id_on", mTlv.field_18_id_on); ADD("scale", mTlv.field_1A_scale); ADD("id_off", mTlv.field_1C_id_off); ADD("direction", mTlv.field_1E_direction); } }; struct Path_Bees : public TlvObjectBaseAO<AO::Path_Bees> { CTOR_AO(Path_Bees, "Bees", AO::TlvTypes::Bees_43) { ADD("id", mTlv.id); ADD("swarm_size", mTlv.swarm_size); ADD("chase_time", mTlv.chase_time); ADD("speed", mTlv.speed); ADD("disable_resources", mTlv.disable_resources); ADD("num_bees", mTlv.num_bees); } }; struct Path_ZBall : public TlvObjectBaseAO<AO::Path_ZBall> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::Path_ZBall::StartPos>("Enum_ZBallStartPos", { {AO::Path_ZBall::StartPos::eCenter_0, "center"}, {AO::Path_ZBall::StartPos::eOut_1, "out"}, {AO::Path_ZBall::StartPos::eIn_2, "in"}, }); types.AddEnum<AO::Path_ZBall::Speed>("Enum_ZBallSpeed", { {AO::Path_ZBall::Speed::eNormal_0, "normal"}, {AO::Path_ZBall::Speed::eFast_1, "fast"}, {AO::Path_ZBall::Speed::eSlow_2, "slow"}, }); } CTOR_AO(Path_ZBall, "ZBall", AO::TlvTypes::ZBall_14) { ADD("start_pos", mTlv.field_18_start_pos); ADD("scale", mTlv.field_1A_scale); ADD("speed", mTlv.field_1C_speed); } }; struct Path_FootSwitch : public TlvObjectBaseAO<AO::Path_FootSwitch> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::FootSwitchTriggerBy>("Enum_FootSwitchTriggeredBy", { {AO::FootSwitchTriggerBy::eOnlyAbe_0, "only_abe"}, {AO::FootSwitchTriggerBy::eAnyone_1, "anyone"}, }); } CTOR_AO(Path_FootSwitch, "FootSwitch", AO::TlvTypes::FootSwitch_60) { ADD("id", mTlv.field_18_id); ADD("scale", mTlv.field_1A_scale); ADD("action", mTlv.field_1C_action); ADD("triggered_by", mTlv.field_1E_trigger_by); } }; struct Path_Paramite : public TlvObjectBaseAO<AO::Path_Paramite> { CTOR_AO(Path_Paramite, "Paramite", AO::TlvTypes::Paramite_48) { ADD("scale", mTlv.field_18_scale); ADD("enter_from_web", mTlv.field_1A_bEnter_from_web); ADD("attack_delay", mTlv.field_1C_attack_delay); ADD("drop_in_timer", mTlv.field_1E_drop_in_timer); ADD("meat_eating_time", mTlv.field_20_meat_eating_time); ADD("attack_duration", mTlv.field_22_attack_duration); ADD("disabled_resources", mTlv.field_24_disabled_resources); ADD("id", mTlv.field_26_id); ADD("hiss_before_attack", mTlv.field_28_hiss_before_attack); ADD("delete_when_far_away", mTlv.field_2A_delete_when_far_away); } }; struct Path_Honey : public TlvObjectBaseAO<AO::Path_Honey> { CTOR_AO(Path_Honey, "Honey", AO::TlvTypes::Honey_20) { ADD("id", mTlv.id); ADD("state", mTlv.state); ADD("scale", mTlv.scale); } }; struct Path_HoneyDripTarget : public TlvObjectBaseAO<AO::Path_HoneyDripTarget> { CTOR_AO(Path_HoneyDripTarget, "HoneyDripTarget", AO::TlvTypes::HoneyDripTarget_42) { // No fields } }; }
36.701684
229
0.604253
THEONLYDarkShadow
8f76125695a45a68e86f37957b4ab31a9db03fa4
979
cpp
C++
modules/complex-number/test/test_Andrich_Maria_complex_number.cpp
BalovaElena/devtools-course-practice
f8d5774dbb78ec50200c45fd17665ed40fc8c4c5
[ "CC-BY-4.0" ]
null
null
null
modules/complex-number/test/test_Andrich_Maria_complex_number.cpp
BalovaElena/devtools-course-practice
f8d5774dbb78ec50200c45fd17665ed40fc8c4c5
[ "CC-BY-4.0" ]
null
null
null
modules/complex-number/test/test_Andrich_Maria_complex_number.cpp
BalovaElena/devtools-course-practice
f8d5774dbb78ec50200c45fd17665ed40fc8c4c5
[ "CC-BY-4.0" ]
null
null
null
// Copyright 2022 Andrich Maria #include <gtest/gtest.h> #include "include/complex_number.h" TEST(Andrich_Maria_ComplexNumberTest, addition) { double re = 0.0; double im = 0.0; ComplexNumber num(re, im); EXPECT_EQ(re, num.getRe()); EXPECT_EQ(im, num.getIm()); } TEST(Andrich_Maria_ComplexNumberTest, Sum) { double re = 3.0; double im = 2.5; double re1 = 2.0; double im1 = 1.5; ComplexNumber a(re, im); ComplexNumber b(re1, im1); ComplexNumber c = a + b; EXPECT_EQ(5.0, c.getRe()); EXPECT_EQ(4.0, c.getIm()); } TEST(Andrich_Maria_ComplexNumberTest, Divide_by_zero) { double re = 1.7; double im = 0.8; double re1 = 0.0; double im1 = 0.0; ComplexNumber a(re, im); ComplexNumber b(re1, im1); ASSERT_ANY_THROW(a / b); } TEST(Andrich_Maria_ComplexNumberTest, Comparison) { double re = 2.0; double im = 3.0; double re1 = 2.0; double im1 = 3.0; ComplexNumber a(re, im); ComplexNumber b(re1, im1); EXPECT_EQ(a, b); }
17.8
55
0.657814
BalovaElena
8f788e2be14f32174830c4b227eab817df0b9861
4,577
cpp
C++
disc-fe/src/Panzer_GlobalEvaluationDataContainer.cpp
hillyuan/Panzer
13ece3ea4c145c4d7b6339e3ad6332a501932ea8
[ "BSD-3-Clause" ]
1
2022-03-22T03:49:50.000Z
2022-03-22T03:49:50.000Z
disc-fe/src/Panzer_GlobalEvaluationDataContainer.cpp
hillyuan/Panzer
13ece3ea4c145c4d7b6339e3ad6332a501932ea8
[ "BSD-3-Clause" ]
null
null
null
disc-fe/src/Panzer_GlobalEvaluationDataContainer.cpp
hillyuan/Panzer
13ece3ea4c145c4d7b6339e3ad6332a501932ea8
[ "BSD-3-Clause" ]
null
null
null
// @HEADER // *********************************************************************** // // Panzer: A partial differential equation assembly // engine for strongly coupled complex multiphysics systems // Copyright (2011) Sandia Corporation // // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, // the U.S. Government retains certain rights in this software. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // 3. Neither the name of the Corporation nor the names of the // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE // 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. // // Questions? Contact Roger P. Pawlowski (rppawlo@sandia.gov) and // Eric C. Cyr (eccyr@sandia.gov) // *********************************************************************** // @HEADER #include "Panzer_GlobalEvaluationDataContainer.hpp" namespace panzer { GlobalEvaluationData::~GlobalEvaluationData() {} /** Add a data object to be used in evaluation loop. */ void GlobalEvaluationDataContainer::addDataObject(const std::string & key, const Teuchos::RCP<GlobalEvaluationData> & ged) { lookupTable_[key] = ged; } /** Does this containe have a match to a certain key. */ bool GlobalEvaluationDataContainer::containsDataObject(const std::string & key) const { return lookupTable_.find(key)!=lookupTable_.end(); } /** Get the data object associated with the key. */ Teuchos::RCP<GlobalEvaluationData> GlobalEvaluationDataContainer::getDataObject(const std::string & key) const { std::unordered_map<std::string,Teuchos::RCP<GlobalEvaluationData> >::const_iterator itr; for(itr=begin();itr!=end();++itr) { if(itr->first==key) return itr->second; } { std::stringstream ss; ss << "Valid keys = "; for(const_iterator litr=begin();litr!=end();++litr) ss << "\"" << litr->first << "\" "; TEUCHOS_TEST_FOR_EXCEPTION(true,std::logic_error, "In GlobalEvaluationDataContainer::getDataObject(key) failed to find the data object specified by \""+key+"\"\n " + ss.str()); } return Teuchos::null; /* std::unordered_map<std::string,Teuchos::RCP<GlobalEvaluationData> >::const_iterator itr = lookupTable_.find(key); if(itr==lookupTable_.end()) { std::stringstream ss; ss << "Valid keys = "; for(const_iterator litr=begin();litr!=end();++litr) ss << "\"" << litr->first << "\" "; TEUCHOS_TEST_FOR_EXCEPTION(itr==lookupTable_.end(),std::logic_error, "In GlobalEvaluationDataContainer::getDataObject(key) failed to find the data object specified by \""+key+"\"\n " + ss.str()); } return itr->second; */ } //! Call ghost to global on all the containers void GlobalEvaluationDataContainer::ghostToGlobal(int p) { for(iterator itr=begin();itr!=end();++itr) itr->second->ghostToGlobal(p); } //! Call global to ghost on all the containers void GlobalEvaluationDataContainer::globalToGhost(int p) { for(iterator itr=begin();itr!=end();++itr) itr->second->globalToGhost(p); } //! Call global to ghost on all the containers void GlobalEvaluationDataContainer::initialize() { for(iterator itr=begin();itr!=end();++itr) itr->second->initializeData(); } }
36.91129
152
0.678829
hillyuan
8f7b44104365e4e421935f84bf8c342c827d1a1f
702
cpp
C++
.Codeforces/Codeforces Round #571 (Div. 2)/C. Vus the Cossack and Strings/C. Vus the Cossack and Strings/C. Vus the Cossack and Strings.cpp
sxweetlollipop2912/MaCode
661d77a2096e4d772fda2b6a7f80c84113b2cde9
[ "MIT" ]
null
null
null
.Codeforces/Codeforces Round #571 (Div. 2)/C. Vus the Cossack and Strings/C. Vus the Cossack and Strings/C. Vus the Cossack and Strings.cpp
sxweetlollipop2912/MaCode
661d77a2096e4d772fda2b6a7f80c84113b2cde9
[ "MIT" ]
null
null
null
.Codeforces/Codeforces Round #571 (Div. 2)/C. Vus the Cossack and Strings/C. Vus the Cossack and Strings/C. Vus the Cossack and Strings.cpp
sxweetlollipop2912/MaCode
661d77a2096e4d772fda2b6a7f80c84113b2cde9
[ "MIT" ]
null
null
null
#include "pch.h" #include <iostream> #include <algorithm> #include <string> #define maxN 1000001 typedef long maxn; typedef std::string str; maxn na, nb, da[maxN], res; str a, b; bool even; void Prepare() { std::cin >> a >> b; na = a.size(); nb = b.size(); for (maxn i = 1; i < na; i++) { da[i] = da[i - 1] + (bool)(a[i] != a[i - 1]); } } void Process() { even = 1; for (maxn i = 0; i < nb; i++) if (a[i] != b[i]) even = !even; res = even; for (maxn l = 1; l <= na - nb; l++) { maxn r = l + nb - 1; if ((da[r] - da[l - 1]) & 1) even = !even; res += even; } std::cout << res; } int main() { std::ios_base::sync_with_stdio(0); std::cin.tie(0); Prepare(); Process(); }
14.625
47
0.519943
sxweetlollipop2912
8f80c838ff86b3a778f6b22384ef7d21882094b1
688
cpp
C++
20160813_ABC043_Complete/c.cpp
miyalab/AtCoder
a57c8a6195463a9a8edd1c3ddd36cc56f145c60d
[ "MIT" ]
null
null
null
20160813_ABC043_Complete/c.cpp
miyalab/AtCoder
a57c8a6195463a9a8edd1c3ddd36cc56f145c60d
[ "MIT" ]
null
null
null
20160813_ABC043_Complete/c.cpp
miyalab/AtCoder
a57c8a6195463a9a8edd1c3ddd36cc56f145c60d
[ "MIT" ]
null
null
null
// インクルード #include <iostream> #include <vector> #include <string> #include <cmath> #include <algorithm> #include <iomanip> // 名前空間省略 using namespace std; // メイン int main() { // 入出力の高速化 ios::sync_with_stdio(false); cin.tie(nullptr); // 表示精度変更 cout << fixed << setprecision(16); int n; cin >> n; vector<int> a(n); for(int i=0;i<n;i++) cin >> a[i]; int ans=(1<<30); // -100 ~ 100まで全探索 for(int i=-100;i<=100;i++){ int sum=0; // コスト計算 for(int j=0;j<n;j++){ sum += (a[j]-i)*(a[j]-i); } // 最小値を保存 ans = min(ans,sum); } cout << ans << endl; }
15.636364
38
0.472384
miyalab
8f8383e60bbdfaf947e7ee28a2e9f7032078d580
10,370
cpp
C++
src/ui/widget/SourceCodeLocationWidget.cpp
vitorjna/LoggerClient
b447f36224e98919045138bb08a849df211e5491
[ "MIT" ]
null
null
null
src/ui/widget/SourceCodeLocationWidget.cpp
vitorjna/LoggerClient
b447f36224e98919045138bb08a849df211e5491
[ "MIT" ]
null
null
null
src/ui/widget/SourceCodeLocationWidget.cpp
vitorjna/LoggerClient
b447f36224e98919045138bb08a849df211e5491
[ "MIT" ]
null
null
null
#include "SourceCodeLocationWidget.h" #include "application/AppSettings.h" #include "application/GlobalConstants.h" #include "ui/ToastNotificationWidget.h" #include "util/NetworkUtils.h" #include "view/StandardItemView.h" SourceCodeLocationWidget::SourceCodeLocationWidget(QWidget *parent) : QWidget(parent) { setupUi(); setupSignalsAndSlots(); loadSettings(); } void SourceCodeLocationWidget::setValues(const QString &szProjectName, const QString &szSourceLocation) { lineEditProject->setText(szProjectName); lineEditSourceLocation->setText(szSourceLocation); } QStringList SourceCodeLocationWidget::getProjectNames() { QStringList szaProjectNames; szaProjectNames.reserve(tableModelLocations->rowCount()); for (int nRow = 0; nRow < tableModelLocations->rowCount(); ++nRow) { const QString szProjectName = tableModelLocations->item(nRow, SourceCodeLocationsEnum::COLUMN_PROJECT_NAME)->text(); if (szaProjectNames.contains(szProjectName) == false) { szaProjectNames.append(szProjectName); } } return szaProjectNames; } void SourceCodeLocationWidget::buttonSaveLocationPushed(bool checked) { Q_UNUSED(checked) const QString szProjectName = lineEditProject->text(); const QString szSourceLocation = lineEditSourceLocation->text(); if (szSourceLocation.isEmpty() == true) { ToastNotificationWidget::showMessage(this, tr("Please add source location"), ToastNotificationWidget::ERROR, 2000); return; } if (tableModelLocations->indexOf(szProjectName, SourceCodeLocationsEnum::COLUMN_PROJECT_NAME) == -1) { emit newProjectAdded(szProjectName); } int nRow; while ((nRow = tableModelLocations->indexOf(szSourceLocation, SourceCodeLocationsEnum::COLUMN_SOURCE_PATH)) != -1) { //found entry with same path if (tableModelLocations->item(nRow, SourceCodeLocationsEnum::COLUMN_PROJECT_NAME)->text() == szProjectName) { //entry also has same project name ToastNotificationWidget::showMessage(this, tr("Combination Project/Source already exists"), ToastNotificationWidget::INFO, 2000); return; } } //NOTE The same location can be added to different project without being a global location, so this is not checked. Ex: adding a location to 2 projects, but not to a 3rd one QList<QStandardItem *> myTableRow; myTableRow.append(new QStandardItem(szProjectName)); myTableRow.append(new QStandardItem(szSourceLocation)); tableModelLocations->appendRow(myTableRow); saveSettings(); } void SourceCodeLocationWidget::buttonPickLocationPushed(bool bState) { Q_UNUSED(bState) QFileDialog *myFileDialog = new QFileDialog(this); myFileDialog->setAcceptMode(QFileDialog::AcceptOpen); myFileDialog->setFileMode(QFileDialog::Directory); myFileDialog->setOption(QFileDialog::ShowDirsOnly, true); myFileDialog->open(); QObject::connect(myFileDialog, &QFileDialog::fileSelected, this, [ myFileDialog, this ](const QString & szFolder) { lineEditSourceLocation->setText(szFolder); myFileDialog->deleteLater(); } ); } void SourceCodeLocationWidget::setupUi() { int nCurrentRow = 0; QGridLayout *myMainLayout = new QGridLayout(this); myMainLayout->setContentsMargins(10, 10, 10, 10); myMainLayout->setSpacing(20); QHBoxLayout *myEditsLayout = new QHBoxLayout(); { lineEditProject = new QLineEdit(this); lineEditProject->setPlaceholderText(tr("Project")); lineEditProject->setToolTip(tr("Project Name")); lineEditSourceLocation = new QLineEdit(this); lineEditSourceLocation->setPlaceholderText(tr("Source path")); lineEditSourceLocation->setToolTip(tr("Source code path")); pushButtonPickLocation = new QPushButton(this); pushButtonPickLocation->setCheckable(false); pushButtonPickLocation->setText(tr("Pick path")); pushButtonSaveLocation = new QPushButton(this); pushButtonSaveLocation->setCheckable(false); pushButtonSaveLocation->setText(tr("Save")); connect(lineEditProject, SIGNAL(returnPressed()), pushButtonSaveLocation, SLOT(click())); connect(lineEditSourceLocation, SIGNAL(returnPressed()), pushButtonSaveLocation, SLOT(click())); myEditsLayout->addWidget(lineEditProject); myEditsLayout->addWidget(lineEditSourceLocation); myEditsLayout->addWidget(pushButtonPickLocation); myEditsLayout->addWidget(pushButtonSaveLocation); } { tableModelLocations = new SourceCodeLocationsModel(this); tableModelLocations->setAllowDuplicates(false); // tableModelLocations->setSortColumn(SourceCodeLocationsEnum::COLUMN_PROJECT_NAME); tableViewLocations = new StandardItemView(this); tableViewLocations->setAlternatingRowColors(true); tableViewLocations->setModel(tableModelLocations); tableViewLocations->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); // tableViewLocations->setSortingEnabled(true); tableViewLocations->setShowGrid(true); tableViewLocations->setContextMenuPolicy(Qt::CustomContextMenu); tableViewLocations->setSelectionMode(QAbstractItemView::ExtendedSelection); tableViewLocations->setSelectionBehavior(QAbstractItemView::SelectRows); tableViewLocations->setWordWrap(false); tableViewLocations->setDragDropMode(QAbstractItemView::InternalMove); //TODO //allows reordering //Horizontal tableViewLocations->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); tableViewLocations->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); tableViewLocations->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); tableViewLocations->horizontalHeader()->setHighlightSections(false); tableViewLocations->horizontalHeader()->setStretchLastSection(true); //Vertical tableViewLocations->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); tableViewLocations->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); tableViewLocations->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed); tableViewLocations->verticalHeader()->setVisible(false); } myMainLayout->addLayout(myEditsLayout, nCurrentRow, 0); ++nCurrentRow; // myMainLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed), 0, 1); myMainLayout->addWidget(tableViewLocations, nCurrentRow, 0, 2, -1); this->setLayout(myMainLayout); this->setAttribute(Qt::WA_DeleteOnClose, false); // this->setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); // this->resize(800, 600); //TODO doesn't work with large font sizes // this->setWindowIcon(QIcon(":/icons/themes/icons/appIcon.svg")); // this->setWindowTitle(tr("Source Code Location Manager")); // this->hide(); //using embed mode in OptionsWidget. May change in the future } void SourceCodeLocationWidget::setupSignalsAndSlots() { connect(pushButtonPickLocation, &QPushButton::clicked, this, &SourceCodeLocationWidget::buttonPickLocationPushed); connect(pushButtonSaveLocation, &QPushButton::clicked, this, &SourceCodeLocationWidget::buttonSaveLocationPushed); } void SourceCodeLocationWidget::loadSettings() { const QString szSourceLocations = AppSettings::getValue(AppSettings::KEY_CODE_SOURCE_LOCATION).toString(); if (szSourceLocations.isEmpty() == false) { const QStringList szaSourceLocations = szSourceLocations.split(GlobalConstants::SEPARATOR_SETTINGS_LIST); if (szSourceLocations.contains(GlobalConstants::SEPARATOR_SETTINGS_LIST_2) == true) { for (int nRow = 0; nRow < szaSourceLocations.size(); ++nRow) { const QStringList szaSourceLocation = szaSourceLocations.at(nRow).split(GlobalConstants::SEPARATOR_SETTINGS_LIST_2); if (szaSourceLocation.size() != SourceCodeLocationsEnum::COUNT_TABLE_COLUMNS) { ToastNotificationWidget::showMessage(this, tr("Could not parse source location: ") + szaSourceLocations.at(nRow), ToastNotificationWidget::ERROR, 3000); continue; } QList<QStandardItem *> myTableRow; for (int nCol = 0; nCol < SourceCodeLocationsEnum::COUNT_TABLE_COLUMNS; ++nCol) { myTableRow.append(new QStandardItem(szaSourceLocation.at(nCol))); } tableModelLocations->appendRow(myTableRow); } } else { //parse first data type, containing only source locations for (int nRow = 0; nRow < szaSourceLocations.size(); ++nRow) { QList<QStandardItem *> myTableRow; myTableRow.append(new QStandardItem()); myTableRow.append(new QStandardItem(szaSourceLocations.at(nRow))); tableModelLocations->appendRow(myTableRow); } } } } void SourceCodeLocationWidget::saveSettings() { QStringList szaSourceLocations; szaSourceLocations.reserve(tableModelLocations->rowCount()); for (int nRow = 0; nRow < tableModelLocations->rowCount(); ++nRow) { QStringList szaSourceLocation; for (int nColumn = 0; nColumn < SourceCodeLocationsEnum::COUNT_TABLE_COLUMNS; ++nColumn) { const QString szText = tableModelLocations->item(nRow, nColumn)->text(); szaSourceLocation.append(szText); } szaSourceLocations.append(szaSourceLocation.join(GlobalConstants::SEPARATOR_SETTINGS_LIST_2)); } AppSettings::setValue(AppSettings::KEY_CODE_SOURCE_LOCATION, szaSourceLocations.join(GlobalConstants::SEPARATOR_SETTINGS_LIST)); } void SourceCodeLocationWidget::hideEvent(QHideEvent *event) { emit aboutToHide(); QWidget::hideEvent(event); saveSettings(); lineEditProject->clear(); lineEditSourceLocation->clear(); } void SourceCodeLocationWidget::closeEvent(QCloseEvent *event) { emit aboutToHide(); QWidget::closeEvent(event); }
38.265683
177
0.708486
vitorjna
8f8473751b532346aab55db7660f6b0ceecd08a1
24,939
cpp
C++
components/scream/src/share/atm_process/atmosphere_process.cpp
ambrad/scream
52da60f65e870b8a3994bdbf4a6022fdcac7cab5
[ "BSD-3-Clause" ]
null
null
null
components/scream/src/share/atm_process/atmosphere_process.cpp
ambrad/scream
52da60f65e870b8a3994bdbf4a6022fdcac7cab5
[ "BSD-3-Clause" ]
null
null
null
components/scream/src/share/atm_process/atmosphere_process.cpp
ambrad/scream
52da60f65e870b8a3994bdbf4a6022fdcac7cab5
[ "BSD-3-Clause" ]
null
null
null
#include "share/atm_process/atmosphere_process.hpp" #include "share/util/scream_timing.hpp" #include "ekat/ekat_assert.hpp" #include <set> #include <stdexcept> #include <string> namespace scream { AtmosphereProcess:: AtmosphereProcess (const ekat::Comm& comm, const ekat::ParameterList& params) : m_comm (comm) , m_params (params) { if (m_params.isParameter("Logger")) { m_atm_logger = m_params.get<std::shared_ptr<logger_t>>("Logger"); } else { // Create a console-only logger, that logs all ranks using namespace ekat::logger; using logger_impl_t = Logger<LogNoFile,LogAllRanks>; m_atm_logger = std::make_shared<logger_impl_t>("",LogLevel::trace,m_comm); } if (m_params.isParameter("Number of Subcycles")) { m_num_subcycles = m_params.get<int>("Number of Subcycles"); } EKAT_REQUIRE_MSG (m_num_subcycles>0, "Error! Invalid number of subcycles in param list " + m_params.name() + ".\n" " - Num subcycles: " + std::to_string(m_num_subcycles) + "\n"); m_timer_prefix = m_params.get<std::string>("Timer Prefix","EAMxx::"); } void AtmosphereProcess::initialize (const TimeStamp& t0, const RunType run_type) { if (this->type()!=AtmosphereProcessType::Group) { start_timer (m_timer_prefix + this->name() + "::init"); } set_fields_and_groups_pointers(); m_time_stamp = t0; initialize_impl(run_type); if (this->type()!=AtmosphereProcessType::Group) { stop_timer (m_timer_prefix + this->name() + "::init"); } } void AtmosphereProcess::run (const int dt) { start_timer (m_timer_prefix + this->name() + "::run"); if (m_params.get("Enable Precondition Checks", true)) { // Run 'pre-condition' property checks stored in this AP run_precondition_checks(); } EKAT_REQUIRE_MSG ( (dt % m_num_subcycles)==0, "Error! The number of subcycle iterations does not exactly divide the time step.\n" " - Atm proc name: " + this->name() + "\n" " - Num subcycles: " + std::to_string(m_num_subcycles) + "\n" " - Time step : " + std::to_string(dt) + "\n"); // Let the derived class do the actual run auto dt_sub = dt / m_num_subcycles; for (m_subcycle_iter=0; m_subcycle_iter<m_num_subcycles; ++m_subcycle_iter) { run_impl(dt_sub); } if (m_params.get("Enable Postcondition Checks", true)) { // Run 'post-condition' property checks stored in this AP run_postcondition_checks(); } m_time_stamp += dt; if (m_update_time_stamps) { // Update all output fields time stamps update_time_stamps (); } stop_timer (m_timer_prefix + this->name() + "::run"); } void AtmosphereProcess::finalize (/* what inputs? */) { finalize_impl(/* what inputs? */); } void AtmosphereProcess::set_required_field (const Field& f) { // Sanity check EKAT_REQUIRE_MSG (has_required_field(f.get_header().get_identifier()), "Error! Input field is not required by this atm process.\n" " field id: " + f.get_header().get_identifier().get_id_string() + "\n" " atm process: " + this->name() + "\n" "Something is wrong up the call stack. Please, contact developers.\n"); if (not ekat::contains(m_fields_in,f)) { m_fields_in.emplace_back(f); } // AtmosphereProcessGroup is just a "container" of *real* atm processes, // so don't add me as customer if I'm an atm proc group. if (this->type()!=AtmosphereProcessType::Group) { // Add myself as customer to the field add_me_as_customer(f); } set_required_field_impl (f); } void AtmosphereProcess::set_computed_field (const Field& f) { // Sanity check EKAT_REQUIRE_MSG (has_computed_field(f.get_header().get_identifier()), "Error! Input field is not computed by this atm process.\n" " field id: " + f.get_header().get_identifier().get_id_string() + "\n" " atm process: " + this->name() + "\n" "Something is wrong up the call stack. Please, contact developers.\n"); if (not ekat::contains(m_fields_out,f)) { m_fields_out.emplace_back(f); } // AtmosphereProcessGroup is just a "container" of *real* atm processes, // so don't add me as provider if I'm an atm proc group. if (this->type()!=AtmosphereProcessType::Group) { // Add myself as provider for the field add_me_as_provider(f); } set_computed_field_impl (f); } void AtmosphereProcess::set_required_group (const FieldGroup& group) { // Sanity check EKAT_REQUIRE_MSG (has_required_group(group.m_info->m_group_name,group.grid_name()), "Error! This atmosphere process does not require the input group.\n" " group name: " + group.m_info->m_group_name + "\n" " grid name : " + group.grid_name() + "\n" " atm process: " + this->name() + "\n" "Something is wrong up the call stack. Please, contact developers.\n"); if (not ekat::contains(m_groups_in,group)) { m_groups_in.emplace_back(group); // AtmosphereProcessGroup is just a "container" of *real* atm processes, // so don't add me as customer if I'm an atm proc group. if (this->type()!=AtmosphereProcessType::Group) { if (group.m_bundle) { add_me_as_customer(*group.m_bundle); } else { for (auto& it : group.m_fields) { add_me_as_customer(*it.second); } } } } set_required_group_impl(group); } void AtmosphereProcess::set_computed_group (const FieldGroup& group) { // Sanity check EKAT_REQUIRE_MSG (has_computed_group(group.m_info->m_group_name,group.grid_name()), "Error! This atmosphere process does not compute the input group.\n" " group name: " + group.m_info->m_group_name + "\n" " grid name : " + group.grid_name() + "\n" " atm process: " + this->name() + "\n" "Something is wrong up the call stack. Please, contact developers.\n"); if (not ekat::contains(m_groups_out,group)) { m_groups_out.emplace_back(group); // AtmosphereProcessGroup is just a "container" of *real* atm processes, // so don't add me as provider if I'm an atm proc group. if (this->type()!=AtmosphereProcessType::Group) { if (group.m_bundle) { add_me_as_provider(*group.m_bundle); } else { for (auto& it : group.m_fields) { add_me_as_provider(*it.second); } } } } set_computed_group_impl(group); } void AtmosphereProcess::run_precondition_checks () const { // Run all pre-condition property checks for (const auto& it : m_precondition_checks) { const auto& pc = it.second; auto check_result = pc->check(); if (check_result.pass) { continue; } // Failed check. if (pc->can_repair()) { // Ok, just fix it pc->repair(); } else if (it.first==CheckFailHandling::Warning) { // Still ok, but warn the user log (LogLevel::warn, "WARNING: Pre-condition property check failed.\n" " - Property check name: " + pc->name() + "\n" " - Atmosphere process name: " + name() + "\n" " - Atmosphere process MPI Rank: " + std::to_string(m_comm.rank()) + "\n" " - Message: " + check_result.msg); } else { // No hope. Crash. EKAT_ERROR_MSG( "Error! Failed pre-condition check (cannot be repaired).\n" " - Atm process name: " + name() + "\n" " - Property check name: " + pc->name() + "\n" " - Atmosphere process MPI Rank: " + std::to_string(m_comm.rank()) + "\n" " - Message: " + check_result.msg); } } } void AtmosphereProcess::run_postcondition_checks () const { // Run all post-condition property checks for (const auto& it : m_postcondition_checks) { const auto& pc = it.second; auto check_result = pc->check(); if (check_result.pass) { continue; } // Failed check. if (pc->can_repair()) { // Ok, just fix it pc->repair(); std::cout << "WARNING: Post-condition property check failed and repaired.\n" " - Property check name: " + pc->name() + "\n" " - Atmosphere process name: " + name() + "\n" " - Atmosphere process MPI Rank: " + std::to_string(m_comm.rank()) + "\n"; } else if (it.first==CheckFailHandling::Warning) { // Still ok, but warn the user log (LogLevel::warn, "WARNING: Post-condition property check failed.\n" " - Property check name: " + pc->name() + "\n" " - Atmosphere process name: " + name() + "\n" " - Atmosphere process MPI Rank: " + std::to_string(m_comm.rank()) + "\n" " - Error message: " + check_result.msg); } else { // No hope. Crash. EKAT_ERROR_MSG( "Error! Failed post-condition check (cannot be repaired).\n" " - Atm process name: " + name() + "\n" " - Property check name: " + pc->name() + "\n" " - Atmosphere process MPI Rank: " + std::to_string(m_comm.rank()) + "\n" " - Error message: " + check_result.msg); } } } bool AtmosphereProcess::has_required_field (const FieldIdentifier& id) const { for (const auto& it : m_required_field_requests) { if (it.fid==id) { return true; } } return false; } bool AtmosphereProcess::has_computed_field (const FieldIdentifier& id) const { for (const auto& it : m_computed_field_requests) { if (it.fid==id) { return true; } } return false; } bool AtmosphereProcess::has_required_group (const std::string& name, const std::string& grid) const { for (const auto& it : m_required_group_requests) { if (it.name==name && it.grid==grid) { return true; } } return false; } bool AtmosphereProcess::has_computed_group (const std::string& name, const std::string& grid) const { for (const auto& it : m_computed_group_requests) { if (it.name==name && it.grid==grid) { return true; } } return false; } void AtmosphereProcess::log (const LogLevel lev, const std::string& msg) const { m_atm_logger->log(lev,msg); } void AtmosphereProcess::set_update_time_stamps (const bool do_update) { m_update_time_stamps = do_update; } void AtmosphereProcess::update_time_stamps () { const auto& t = timestamp(); // Update *all* output fields/groups, regardless of whether // they were touched at all during this time step. // TODO: this might have to be changed for (auto& f : m_fields_out) { f.get_header().get_tracking().update_time_stamp(t); } for (auto& g : m_groups_out) { if (g.m_bundle) { g.m_bundle->get_header().get_tracking().update_time_stamp(t); } else { for (auto& f : g.m_fields) { f.second->get_header().get_tracking().update_time_stamp(t); } } } } void AtmosphereProcess::add_me_as_provider (const Field& f) { f.get_header_ptr()->get_tracking().add_provider(weak_from_this()); } void AtmosphereProcess::add_me_as_customer (const Field& f) { f.get_header_ptr()->get_tracking().add_customer(weak_from_this()); } void AtmosphereProcess::add_internal_field (const Field& f) { m_internal_fields.push_back(f); } const Field& AtmosphereProcess:: get_field_in(const std::string& field_name, const std::string& grid_name) const { return get_field_in_impl(field_name,grid_name); } Field& AtmosphereProcess:: get_field_in(const std::string& field_name, const std::string& grid_name) { return get_field_in_impl(field_name,grid_name); } const Field& AtmosphereProcess:: get_field_in(const std::string& field_name) const { return get_field_in_impl(field_name); } Field& AtmosphereProcess:: get_field_in(const std::string& field_name) { return get_field_in_impl(field_name); } const Field& AtmosphereProcess:: get_field_out(const std::string& field_name, const std::string& grid_name) const { return get_field_out_impl(field_name,grid_name); } Field& AtmosphereProcess:: get_field_out(const std::string& field_name, const std::string& grid_name) { return get_field_out_impl(field_name,grid_name); } const Field& AtmosphereProcess:: get_field_out(const std::string& field_name) const { return get_field_out_impl (field_name); } Field& AtmosphereProcess:: get_field_out(const std::string& field_name) { return get_field_out_impl (field_name); } const FieldGroup& AtmosphereProcess:: get_group_in(const std::string& group_name, const std::string& grid_name) const { return get_group_in_impl (group_name,grid_name); } FieldGroup& AtmosphereProcess:: get_group_in(const std::string& group_name, const std::string& grid_name) { return get_group_in_impl (group_name,grid_name); } const FieldGroup& AtmosphereProcess:: get_group_in(const std::string& group_name) const { return get_group_in_impl(group_name); } FieldGroup& AtmosphereProcess:: get_group_in(const std::string& group_name) { return get_group_in_impl(group_name); } const FieldGroup& AtmosphereProcess:: get_group_out(const std::string& group_name, const std::string& grid_name) const { return get_group_out_impl(group_name,grid_name); } FieldGroup& AtmosphereProcess:: get_group_out(const std::string& group_name, const std::string& grid_name) { return get_group_out_impl(group_name,grid_name); } const FieldGroup& AtmosphereProcess:: get_group_out(const std::string& group_name) const { return get_group_out_impl(group_name); } FieldGroup& AtmosphereProcess:: get_group_out(const std::string& group_name) { return get_group_out_impl(group_name); } const Field& AtmosphereProcess:: get_internal_field(const std::string& field_name, const std::string& grid_name) const { return get_internal_field_impl(field_name,grid_name); } Field& AtmosphereProcess:: get_internal_field(const std::string& field_name, const std::string& grid_name) { return get_internal_field_impl(field_name,grid_name); } Field& AtmosphereProcess:: get_internal_field(const std::string& field_name) { return get_internal_field_impl(field_name); } const Field& AtmosphereProcess:: get_internal_field(const std::string& field_name) const { return get_internal_field_impl(field_name); } void AtmosphereProcess::set_fields_and_groups_pointers () { for (auto& f : m_fields_in) { const auto& fid = f.get_header().get_identifier(); m_fields_in_pointers[fid.name()][fid.get_grid_name()] = &f; } for (auto& f : m_fields_out) { const auto& fid = f.get_header().get_identifier(); m_fields_out_pointers[fid.name()][fid.get_grid_name()] = &f; } for (auto& g : m_groups_in) { const auto& group_name = g.m_info->m_group_name; m_groups_in_pointers[group_name][g.grid_name()] = &g; } for (auto& g : m_groups_out) { const auto& group_name = g.m_info->m_group_name; m_groups_out_pointers[group_name][g.grid_name()] = &g; } for (auto& f : m_internal_fields) { const auto& fid = f.get_header().get_identifier(); m_internal_fields_pointers[fid.name()][fid.get_grid_name()] = &f; } } void AtmosphereProcess:: alias_field_in (const std::string& field_name, const std::string& grid_name, const std::string& alias_name) { try { m_fields_in_pointers[alias_name][grid_name] = m_fields_in_pointers.at(field_name).at(grid_name); } catch (const std::out_of_range&) { // std::out_of_range message would not help detecting where // the exception originated, so print a more meaningful message. EKAT_ERROR_MSG ( "Error! Could not locate input field for aliasing request.\n" " - field name: " + field_name + "\n" " - grid name: " + grid_name + "\n"); } } void AtmosphereProcess:: alias_field_out (const std::string& field_name, const std::string& grid_name, const std::string& alias_name) { try { m_fields_out_pointers[alias_name][grid_name] = m_fields_out_pointers.at(field_name).at(grid_name); } catch (const std::out_of_range&) { // std::out_of_range message would not help detecting where // the exception originated, so print a more meaningful message. EKAT_ERROR_MSG ( "Error! Could not locate output field for aliasing request.\n" " - field name: " + field_name + "\n" " - grid name: " + grid_name + "\n"); } } void AtmosphereProcess:: alias_group_in (const std::string& group_name, const std::string& grid_name, const std::string& alias_name) { try { m_groups_in_pointers[alias_name][grid_name] = m_groups_in_pointers.at(group_name).at(grid_name); } catch (const std::out_of_range&) { // std::out_of_range message would not help detecting where // the exception originated, so print a more meaningful message. EKAT_ERROR_MSG ( "Error! Could not locate input group for aliasing request.\n" " - group name: " + group_name + "\n" " - grid name: " + grid_name + "\n"); } } void AtmosphereProcess:: alias_group_out (const std::string& group_name, const std::string& grid_name, const std::string& alias_name) { try { m_groups_out_pointers[alias_name][grid_name] = m_groups_out_pointers.at(group_name).at(grid_name); } catch (const std::out_of_range&) { // std::out_of_range message would not help detecting where // the exception originated, so print a more meaningful message. EKAT_ERROR_MSG ( "Error! Could not locate output group for aliasing request.\n" " - group name: " + group_name + "\n" " - grid name: " + grid_name + "\n"); } } Field& AtmosphereProcess:: get_field_in_impl(const std::string& field_name, const std::string& grid_name) const { try { return *m_fields_in_pointers.at(field_name).at(grid_name); } catch (const std::out_of_range&) { // std::out_of_range message would not help detecting where // the exception originated, so print a more meaningful message. EKAT_ERROR_MSG ( "Error! Could not locate input field in this atm proces.\n" " atm proc name: " + this->name() + "\n" " field name: " + field_name + "\n" " grid name: " + grid_name + "\n"); } } Field& AtmosphereProcess:: get_field_in_impl(const std::string& field_name) const { try { auto& copies = m_fields_in_pointers.at(field_name); EKAT_REQUIRE_MSG (copies.size()==1, "Error! Attempt to find input field providing only the name,\n" " but multiple copies (on different grids) are present.\n" " field name: " + field_name + "\n" " atm process: " + this->name() + "\n" " number of copies: " + std::to_string(copies.size()) + "\n"); return *copies.begin()->second; } catch (const std::out_of_range&) { // std::out_of_range message would not help detecting where // the exception originated, so print a more meaningful message. EKAT_ERROR_MSG ( "Error! Could not locate input field in this atm proces.\n" " atm proc name: " + this->name() + "\n" " field name: " + field_name + "\n"); } } Field& AtmosphereProcess:: get_field_out_impl(const std::string& field_name, const std::string& grid_name) const { try { return *m_fields_out_pointers.at(field_name).at(grid_name); } catch (const std::out_of_range&) { // std::out_of_range message would not help detecting where // the exception originated, so print a more meaningful message. EKAT_ERROR_MSG ( "Error! Could not locate output field in this atm proces.\n" " atm proc name: " + this->name() + "\n" " field name: " + field_name + "\n" " grid name: " + grid_name + "\n"); } } Field& AtmosphereProcess:: get_field_out_impl(const std::string& field_name) const { try { auto& copies = m_fields_out_pointers.at(field_name); EKAT_REQUIRE_MSG (copies.size()==1, "Error! Attempt to find output field providing only the name,\n" " but multiple copies (on different grids) are present.\n" " field name: " + field_name + "\n" " atm process: " + this->name() + "\n" " number of copies: " + std::to_string(copies.size()) + "\n"); return *copies.begin()->second; } catch (const std::out_of_range&) { // std::out_of_range message would not help detecting where // the exception originated, so print a more meaningful message. EKAT_ERROR_MSG ( "Error! Could not locate output field in this atm proces.\n" " atm proc name: " + this->name() + "\n" " field name: " + field_name + "\n"); } } FieldGroup& AtmosphereProcess:: get_group_in_impl(const std::string& group_name, const std::string& grid_name) const { try { return *m_groups_in_pointers.at(group_name).at(grid_name); } catch (const std::out_of_range&) { // std::out_of_range message would not help detecting where // the exception originated, so print a more meaningful message. EKAT_ERROR_MSG ( "Error! Could not locate input group in this atm proces.\n" " atm proc name: " + this->name() + "\n" " group name: " + group_name + "\n" " grid name: " + grid_name + "\n"); } } FieldGroup& AtmosphereProcess:: get_group_in_impl(const std::string& group_name) const { try { auto& copies = m_groups_in_pointers.at(group_name); EKAT_REQUIRE_MSG (copies.size()==1, "Error! Attempt to find input group providing only the name,\n" " but multiple copies (on different grids) are present.\n" " group name: " + group_name + "\n" " atm process: " + this->name() + "\n" " number of copies: " + std::to_string(copies.size()) + "\n"); return *copies.begin()->second; } catch (const std::out_of_range&) { // std::out_of_range message would not help detecting where // the exception originated, so print a more meaningful message. EKAT_ERROR_MSG ( "Error! Could not locate input group in this atm proces.\n" " atm proc name: " + this->name() + "\n" " group name: " + group_name + "\n"); } } FieldGroup& AtmosphereProcess:: get_group_out_impl(const std::string& group_name, const std::string& grid_name) const { try { return *m_groups_out_pointers.at(group_name).at(grid_name); } catch (const std::out_of_range&) { // std::out_of_range message would not help detecting where // the exception originated, so print a more meaningful message. EKAT_ERROR_MSG ( "Error! Could not locate output group in this atm proces.\n" " atm proc name: " + this->name() + "\n" " group name: " + group_name + "\n" " grid name: " + grid_name + "\n"); } } FieldGroup& AtmosphereProcess:: get_group_out_impl(const std::string& group_name) const { try { auto& copies = m_groups_out_pointers.at(group_name); EKAT_REQUIRE_MSG (copies.size()==1, "Error! Attempt to find output group providing only the name,\n" " but multiple copies (on different grids) are present.\n" " group name: " + group_name + "\n" " atm process: " + this->name() + "\n" " number of copies: " + std::to_string(copies.size()) + "\n"); return *copies.begin()->second; } catch (const std::out_of_range&) { // std::out_of_range would message would not help detecting where // the exception originated, so print a more meaningful message. EKAT_ERROR_MSG ( "Error! Could not locate output group in this atm proces.\n" " atm proc name: " + this->name() + "\n" " group name: " + group_name + "\n"); } } Field& AtmosphereProcess:: get_internal_field_impl(const std::string& field_name, const std::string& grid_name) const { try { return *m_internal_fields_pointers.at(field_name).at(grid_name); } catch (const std::out_of_range&) { // std::out_of_range message would not help detecting where // the exception originated, so print a more meaningful message. EKAT_ERROR_MSG ( "Error! Could not locate internal field in this atm proces.\n" " atm proc name: " + this->name() + "\n" " field name: " + field_name + "\n" " grid name: " + grid_name + "\n"); } } Field& AtmosphereProcess:: get_internal_field_impl(const std::string& field_name) const { try { auto& copies = m_internal_fields_pointers.at(field_name); EKAT_REQUIRE_MSG (copies.size()==1, "Error! Attempt to find internal field providing only the name,\n" " but multiple copies (on different grids) are present.\n" " field name: " + field_name + "\n" " atm process: " + this->name() + "\n" " number of copies: " + std::to_string(copies.size()) + "\n"); return *copies.begin()->second; } catch (const std::out_of_range&) { // std::out_of_range message would not help detecting where // the exception originated, so print a more meaningful message. EKAT_ERROR_MSG ( "Error! Could not locate internal field in this atm proces.\n" " atm proc name: " + this->name() + "\n" " field name: " + field_name + "\n"); } } } // namespace scream
35.475107
102
0.659489
ambrad
8f8f47f9f3162c68e63f7c660aecf8a93df3f47a
1,225
cc
C++
src/utils/simple_http_client.cc
negibokken/toyscopy
f82d7b3e16d2088e74f036aedc7602a84af781e2
[ "MIT" ]
9
2019-12-31T10:33:14.000Z
2021-11-21T00:35:19.000Z
src/utils/simple_http_client.cc
negibokken/toyscopy
f82d7b3e16d2088e74f036aedc7602a84af781e2
[ "MIT" ]
18
2019-11-01T16:08:08.000Z
2021-01-09T10:40:39.000Z
src/utils/simple_http_client.cc
negibokken/toyscopy
f82d7b3e16d2088e74f036aedc7602a84af781e2
[ "MIT" ]
1
2022-03-16T06:22:41.000Z
2022-03-16T06:22:41.000Z
#include "simple_http_client.h" namespace ToyScopyUtil { inline size_t write(void* contents, size_t size, size_t nmemb, std::string* s) { size_t newLength = size * nmemb; try { s->append((char*)contents, newLength); } catch (std::bad_alloc& e) { // handle memory problem return 0; } return newLength; } inline std::string getProtocolfromUrl(std::string url) { int cnt = 0; char protocol[4096]; for (int i = 0; i < url.size(); i++) { if (url[i] == ':') { if (i + 2 > url.size()) { return "invalid"; } if (url[i + 1] == '/' && url[i + 2] == '/') { protocol[cnt] = '\0'; return protocol; } } protocol[cnt] = url[i]; } return protocol; } std::string ToyScopyUtil::SimpleHttpClient::fetch(std::string url) { if (getProtocolfromUrl(url) == "invalid") { return ""; } CURL* curl = curl_easy_init(); std::string s = ""; if (curl) { CURLcode res; curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &s); res = curl_easy_perform(curl); curl_easy_cleanup(curl); } return s; } } // namespace ToyScopyUtil
24.019608
80
0.602449
negibokken
8f9113a54dd64e37202c551bfa14f417142a00f4
3,067
cpp
C++
Src/StateMachine.cpp
Condzi/Engine
10f6acdf33b24b8d0aab9efcec570821a73423a1
[ "MIT" ]
1
2018-07-30T10:51:23.000Z
2018-07-30T10:51:23.000Z
Src/StateMachine.cpp
Condzi/Engine
10f6acdf33b24b8d0aab9efcec570821a73423a1
[ "MIT" ]
null
null
null
Src/StateMachine.cpp
Condzi/Engine
10f6acdf33b24b8d0aab9efcec570821a73423a1
[ "MIT" ]
null
null
null
/* Conrad 'Condzi' Kubacki 2018 https://github.com/condzi */ #include "Engine/EnginePCH.hpp" #include "Engine/StateMachine.hpp" namespace con::priv { std::unique_ptr<State> con::priv::StateFactory::createState( StateID id ) { auto result = functions.find( id ); if ( result != functions.end() ) return result->second(); print( LogPriority::Error, "no scene of id %.", id ); return nullptr; } } namespace con { void StateMachine::push( StateID id ) { requestAction( { Operation::Push, id } ); } void StateMachine::pop() { requestAction( { Operation::Pop } ); } void StateMachine::enableCurrentState() { requestAction( { Operation::Enable } ); } void StateMachine::disableCurrentState() { requestAction( { Operation::Disable } ); } void StateMachine::update() { applyActions(); updateStates(); } std::optional<State*> StateMachine::getStateOnTop() { if ( states.empty() ) return {}; return states.back().get(); } std::string StateMachine::loggerName() const { return "State Machine"; } void StateMachine::requestAction( Action && action ) { auto op = [&] { switch ( action.operation ) { case Operation::Push: return "Push"; case Operation::Pop: return "Pop"; case Operation::Enable: return "Enable"; case Operation::Disable: return "Disable"; } }( ); if ( action.operation == Operation::Push ) print( LogPriority::Info, "request %, scene id: %.", op, action.state ); else print( LogPriority::Info, "request %.", op ); actionBuffer.emplace_back( std::move( action ) ); } void StateMachine::applyPush( StateID id ) { auto state = factory.createState( id ); if ( state ) { state->StateMachine = this; state->_setId( id ); // passing 'Push' as argument to have coloring. print( LogPriority::Info, "applying %, state id: %.", "Push", id ); states.emplace_back( std::move( state ) )->onPush(); } else print( LogPriority::Error, "failed to apply %, state id: %.", "Push", id ); } void StateMachine::applyPop() { if ( states.empty() ) return print( LogPriority::Error, "failed to apply %: empty stack.", "Pop" ); print( LogPriority::Info, "applying %.", "Pop" ); states.back()->onPop(); states.pop_back(); } void StateMachine::applyEnable() { if ( states.empty() ) return print( LogPriority::Error, "failed to apply %: empty stack.", "Enable" ); states.back()->enable(); } void StateMachine::applyDisable() { if ( states.empty() ) return print( LogPriority::Error, "failed to apply %: empty stack.", "Disable" ); states.back()->disable(); } void StateMachine::applyActions() { pendingActions = actionBuffer; actionBuffer.clear(); // Action is that small it's not worth using reference for ( auto action : pendingActions ) { switch ( action.operation ) { case Operation::Push: applyPush( action.state ); break; case Operation::Pop: applyPop(); break; case Operation::Enable: applyEnable(); break; case Operation::Disable: applyDisable(); break; } } pendingActions.clear(); } void StateMachine::updateStates() { for ( auto& state : states ) state->_update(); } }
21.006849
83
0.669384
Condzi
8f981c90f5cfaf6f6d485231292f6cb867dcc33e
5,335
cpp
C++
engine/src/render/PointLight.cpp
Birdy2014/Birdy3d
96421f262ab6ba7448cae8381063aab32ac830fe
[ "MIT" ]
1
2021-11-01T20:22:41.000Z
2021-11-01T20:22:41.000Z
engine/src/render/PointLight.cpp
Birdy2014/Birdy3d
96421f262ab6ba7448cae8381063aab32ac830fe
[ "MIT" ]
1
2021-11-02T12:45:20.000Z
2021-11-02T12:45:20.000Z
engine/src/render/PointLight.cpp
Birdy2014/Birdy3d
96421f262ab6ba7448cae8381063aab32ac830fe
[ "MIT" ]
1
2021-11-02T12:28:58.000Z
2021-11-02T12:28:58.000Z
#include "render/PointLight.hpp" #include "core/ResourceManager.hpp" #include "ecs/Entity.hpp" #include "ecs/Scene.hpp" #include "render/ModelComponent.hpp" #include "render/Shader.hpp" #include <glm/gtc/matrix_transform.hpp> namespace Birdy3d::render { PointLight::PointLight(glm::vec3 ambient, glm::vec3 diffuse, float linear, float quadratic, bool shadow_enabled) : ambient(ambient) , diffuse(diffuse) , linear(linear) , quadratic(quadratic) , shadow_enabled(shadow_enabled) { } void PointLight::setup_shadow_map() { m_depth_shader = core::ResourceManager::get_shader("point_light_depth.glsl"); // framebuffer glGenFramebuffers(1, &m_shadow_map_fbo); // shadow map glGenTextures(1, &m_shadow_map); glBindTexture(GL_TEXTURE_CUBE_MAP, m_shadow_map); for (unsigned int i = 0; i < 6; i++) glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_DEPTH_COMPONENT, SHADOW_WIDTH, SHADOW_HEIGHT, 0, GL_DEPTH_COMPONENT, GL_FLOAT, nullptr); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); // bind framebuffer glBindFramebuffer(GL_FRAMEBUFFER, m_shadow_map_fbo); glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, m_shadow_map, 0); glDrawBuffer(GL_NONE); glReadBuffer(GL_NONE); glBindFramebuffer(GL_FRAMEBUFFER, 0); } void PointLight::use(const Shader& lightShader, int id, int textureid) { if (!m_shadow_map_updated) { gen_shadow_map(); m_shadow_map_updated = true; } std::string name = "pointLights[" + std::to_string(id) + "]."; lightShader.use(); lightShader.set_bool(name + "shadow_enabled", shadow_enabled); lightShader.set_vec3(name + "position", entity->transform.world_position()); lightShader.set_vec3(name + "ambient", ambient); lightShader.set_vec3(name + "diffuse", diffuse); lightShader.set_float(name + "linear", linear); lightShader.set_float(name + "quadratic", quadratic); glActiveTexture(GL_TEXTURE0 + textureid); glBindTexture(GL_TEXTURE_CUBE_MAP, m_shadow_map); lightShader.set_int(name + "shadowMap", textureid); lightShader.set_float(name + "far", m_far); } void PointLight::gen_shadow_map() { glm::vec3 world_pos = entity->transform.world_position(); GLint viewport[4]; glGetIntegerv(GL_VIEWPORT, viewport); glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT); glBindFramebuffer(GL_FRAMEBUFFER, m_shadow_map_fbo); glClear(GL_DEPTH_BUFFER_BIT); glCullFace(GL_FRONT); glEnable(GL_DEPTH_TEST); m_depth_shader->use(); float aspect = (float)SHADOW_WIDTH / (float)SHADOW_HEIGHT; float near = 1.0f; glm::mat4 shadow_proj = glm::perspective(glm::radians(90.0f), aspect, near, m_far); m_depth_shader->set_mat4("shadowMatrices[0]", shadow_proj * glm::lookAt(world_pos, world_pos + glm::vec3(1.0, 0.0, 0.0), glm::vec3(0.0, -1.0, 0.0))); m_depth_shader->set_mat4("shadowMatrices[1]", shadow_proj * glm::lookAt(world_pos, world_pos + glm::vec3(-1.0, 0.0, 0.0), glm::vec3(0.0, -1.0, 0.0))); m_depth_shader->set_mat4("shadowMatrices[2]", shadow_proj * glm::lookAt(world_pos, world_pos + glm::vec3(0.0, 1.0, 0.0), glm::vec3(0.0, 0.0, 1.0))); m_depth_shader->set_mat4("shadowMatrices[3]", shadow_proj * glm::lookAt(world_pos, world_pos + glm::vec3(0.0, -1.0, 0.0), glm::vec3(0.0, 0.0, -1.0))); m_depth_shader->set_mat4("shadowMatrices[4]", shadow_proj * glm::lookAt(world_pos, world_pos + glm::vec3(0.0, 0.0, 1.0), glm::vec3(0.0, -1.0, 0.0))); m_depth_shader->set_mat4("shadowMatrices[5]", shadow_proj * glm::lookAt(world_pos, world_pos + glm::vec3(0.0, 0.0, -1.0), glm::vec3(0.0, -1.0, 0.0))); m_depth_shader->set_float("far_plane", m_far); m_depth_shader->set_vec3("lightPos", world_pos); for (auto m : entity->scene->get_components<ModelComponent>(false, true)) { m->render_depth(*m_depth_shader); } // reset framebuffer and viewport glBindFramebuffer(GL_FRAMEBUFFER, 0); glViewport(0, 0, viewport[2], viewport[3]); glClear(GL_DEPTH_BUFFER_BIT); glCullFace(GL_BACK); } void PointLight::start() { setup_shadow_map(); } void PointLight::update() { if (shadow_enabled) m_shadow_map_updated = false; } void PointLight::serialize(serializer::Adapter& adapter) { adapter("shadow_enabled", shadow_enabled); adapter("ambient", ambient); adapter("diffuse", diffuse); adapter("linear", linear); adapter("quadratic", quadratic); adapter("far", m_far); } BIRDY3D_REGISTER_DERIVED_TYPE_DEF(ecs::Component, PointLight); }
45.598291
158
0.667104
Birdy2014
8f984605c4290d323c814c4dff1f0b5f4dec7ef6
1,077
cpp
C++
src/autowiring/test/CreationRulesTest.cpp
CaseyCarter/autowiring
48e95a71308318c8ffb7ed1348e034fd9110f70c
[ "Apache-2.0" ]
87
2015-01-18T00:43:06.000Z
2022-02-11T17:40:50.000Z
src/autowiring/test/CreationRulesTest.cpp
CaseyCarter/autowiring
48e95a71308318c8ffb7ed1348e034fd9110f70c
[ "Apache-2.0" ]
274
2015-01-03T04:50:49.000Z
2021-03-08T09:01:09.000Z
src/autowiring/test/CreationRulesTest.cpp
CaseyCarter/autowiring
48e95a71308318c8ffb7ed1348e034fd9110f70c
[ "Apache-2.0" ]
15
2015-09-30T20:58:43.000Z
2020-12-19T21:24:56.000Z
// Copyright (C) 2012-2018 Leap Motion, Inc. All rights reserved. #include "stdafx.h" #include "TestFixtures/Decoration.hpp" #include <autowiring/CreationRules.h> class CreationRulesTest: public testing::Test {}; struct AlignedFreer { void operator()(void* pMem) const { autowiring::aligned_free(pMem); } }; TEST_F(CreationRulesTest, AlignedAllocation) { // Use a vector because we don't want the underlying allocator to give us the same memory block // over and over--we are, after all, freeing memory and then immediately asking for another block // with identical size requirements. std::vector<std::unique_ptr<void, AlignedFreer>> memory; memory.resize(100); // Allocate one byte of 256-byte aligned memory 100 times. If the aligned allocator isn't working // properly, then the odds are good that at least one of these allocations will be wrong. for (auto& ptr : memory) { ptr.reset(autowiring::aligned_malloc(1, 256)); ASSERT_EQ(0UL, (size_t)ptr.get() % 256) << "Aligned allocator did not return a correctly aligned pointer"; } }
35.9
110
0.732591
CaseyCarter
8fa172122e2e29bdaf5c7175351d35f131a84ab5
69,810
cpp
C++
thrift/gen-cpp/BlockMasterWorkerService.cpp
pspringer/AlluxioWorker
df07f554449c91b1e0f70abe2317b76903f97545
[ "Apache-2.0" ]
null
null
null
thrift/gen-cpp/BlockMasterWorkerService.cpp
pspringer/AlluxioWorker
df07f554449c91b1e0f70abe2317b76903f97545
[ "Apache-2.0" ]
null
null
null
thrift/gen-cpp/BlockMasterWorkerService.cpp
pspringer/AlluxioWorker
df07f554449c91b1e0f70abe2317b76903f97545
[ "Apache-2.0" ]
null
null
null
/** * Autogenerated by Thrift Compiler (0.10.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ #include "BlockMasterWorkerService.h" BlockMasterWorkerService_commitBlock_args::~BlockMasterWorkerService_commitBlock_args() throw() { } uint32_t BlockMasterWorkerService_commitBlock_args::read(::apache::thrift::protocol::TProtocol* iprot) { apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; int16_t fid; xfer += iprot->readStructBegin(fname); using ::apache::thrift::protocol::TProtocolException; while (true) { xfer += iprot->readFieldBegin(fname, ftype, fid); if (ftype == ::apache::thrift::protocol::T_STOP) { break; } switch (fid) { case 1: if (ftype == ::apache::thrift::protocol::T_I64) { xfer += iprot->readI64(this->workerId); this->__isset.workerId = true; } else { xfer += iprot->skip(ftype); } break; case 2: if (ftype == ::apache::thrift::protocol::T_I64) { xfer += iprot->readI64(this->usedBytesOnTier); this->__isset.usedBytesOnTier = true; } else { xfer += iprot->skip(ftype); } break; case 3: if (ftype == ::apache::thrift::protocol::T_STRING) { xfer += iprot->readString(this->tierAlias); this->__isset.tierAlias = true; } else { xfer += iprot->skip(ftype); } break; case 4: if (ftype == ::apache::thrift::protocol::T_I64) { xfer += iprot->readI64(this->blockId); this->__isset.blockId = true; } else { xfer += iprot->skip(ftype); } break; case 5: if (ftype == ::apache::thrift::protocol::T_I64) { xfer += iprot->readI64(this->length); this->__isset.length = true; } else { xfer += iprot->skip(ftype); } break; default: xfer += iprot->skip(ftype); break; } xfer += iprot->readFieldEnd(); } xfer += iprot->readStructEnd(); return xfer; } uint32_t BlockMasterWorkerService_commitBlock_args::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("BlockMasterWorkerService_commitBlock_args"); xfer += oprot->writeFieldBegin("workerId", ::apache::thrift::protocol::T_I64, 1); xfer += oprot->writeI64(this->workerId); xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldBegin("usedBytesOnTier", ::apache::thrift::protocol::T_I64, 2); xfer += oprot->writeI64(this->usedBytesOnTier); xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldBegin("tierAlias", ::apache::thrift::protocol::T_STRING, 3); xfer += oprot->writeString(this->tierAlias); xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldBegin("blockId", ::apache::thrift::protocol::T_I64, 4); xfer += oprot->writeI64(this->blockId); xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldBegin("length", ::apache::thrift::protocol::T_I64, 5); xfer += oprot->writeI64(this->length); xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); return xfer; } BlockMasterWorkerService_commitBlock_pargs::~BlockMasterWorkerService_commitBlock_pargs() throw() { } uint32_t BlockMasterWorkerService_commitBlock_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("BlockMasterWorkerService_commitBlock_pargs"); xfer += oprot->writeFieldBegin("workerId", ::apache::thrift::protocol::T_I64, 1); xfer += oprot->writeI64((*(this->workerId))); xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldBegin("usedBytesOnTier", ::apache::thrift::protocol::T_I64, 2); xfer += oprot->writeI64((*(this->usedBytesOnTier))); xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldBegin("tierAlias", ::apache::thrift::protocol::T_STRING, 3); xfer += oprot->writeString((*(this->tierAlias))); xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldBegin("blockId", ::apache::thrift::protocol::T_I64, 4); xfer += oprot->writeI64((*(this->blockId))); xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldBegin("length", ::apache::thrift::protocol::T_I64, 5); xfer += oprot->writeI64((*(this->length))); xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); return xfer; } BlockMasterWorkerService_commitBlock_result::~BlockMasterWorkerService_commitBlock_result() throw() { } uint32_t BlockMasterWorkerService_commitBlock_result::read(::apache::thrift::protocol::TProtocol* iprot) { apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; int16_t fid; xfer += iprot->readStructBegin(fname); using ::apache::thrift::protocol::TProtocolException; while (true) { xfer += iprot->readFieldBegin(fname, ftype, fid); if (ftype == ::apache::thrift::protocol::T_STOP) { break; } switch (fid) { case 1: if (ftype == ::apache::thrift::protocol::T_STRUCT) { xfer += this->e.read(iprot); this->__isset.e = true; } else { xfer += iprot->skip(ftype); } break; default: xfer += iprot->skip(ftype); break; } xfer += iprot->readFieldEnd(); } xfer += iprot->readStructEnd(); return xfer; } uint32_t BlockMasterWorkerService_commitBlock_result::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; xfer += oprot->writeStructBegin("BlockMasterWorkerService_commitBlock_result"); if (this->__isset.e) { xfer += oprot->writeFieldBegin("e", ::apache::thrift::protocol::T_STRUCT, 1); xfer += this->e.write(oprot); xfer += oprot->writeFieldEnd(); } xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); return xfer; } BlockMasterWorkerService_commitBlock_presult::~BlockMasterWorkerService_commitBlock_presult() throw() { } uint32_t BlockMasterWorkerService_commitBlock_presult::read(::apache::thrift::protocol::TProtocol* iprot) { apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; int16_t fid; xfer += iprot->readStructBegin(fname); using ::apache::thrift::protocol::TProtocolException; while (true) { xfer += iprot->readFieldBegin(fname, ftype, fid); if (ftype == ::apache::thrift::protocol::T_STOP) { break; } switch (fid) { case 1: if (ftype == ::apache::thrift::protocol::T_STRUCT) { xfer += this->e.read(iprot); this->__isset.e = true; } else { xfer += iprot->skip(ftype); } break; default: xfer += iprot->skip(ftype); break; } xfer += iprot->readFieldEnd(); } xfer += iprot->readStructEnd(); return xfer; } BlockMasterWorkerService_getWorkerId_args::~BlockMasterWorkerService_getWorkerId_args() throw() { } uint32_t BlockMasterWorkerService_getWorkerId_args::read(::apache::thrift::protocol::TProtocol* iprot) { apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; int16_t fid; xfer += iprot->readStructBegin(fname); using ::apache::thrift::protocol::TProtocolException; while (true) { xfer += iprot->readFieldBegin(fname, ftype, fid); if (ftype == ::apache::thrift::protocol::T_STOP) { break; } switch (fid) { case 1: if (ftype == ::apache::thrift::protocol::T_STRUCT) { xfer += this->workerNetAddress.read(iprot); this->__isset.workerNetAddress = true; } else { xfer += iprot->skip(ftype); } break; default: xfer += iprot->skip(ftype); break; } xfer += iprot->readFieldEnd(); } xfer += iprot->readStructEnd(); return xfer; } uint32_t BlockMasterWorkerService_getWorkerId_args::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("BlockMasterWorkerService_getWorkerId_args"); xfer += oprot->writeFieldBegin("workerNetAddress", ::apache::thrift::protocol::T_STRUCT, 1); xfer += this->workerNetAddress.write(oprot); xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); return xfer; } BlockMasterWorkerService_getWorkerId_pargs::~BlockMasterWorkerService_getWorkerId_pargs() throw() { } uint32_t BlockMasterWorkerService_getWorkerId_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("BlockMasterWorkerService_getWorkerId_pargs"); xfer += oprot->writeFieldBegin("workerNetAddress", ::apache::thrift::protocol::T_STRUCT, 1); xfer += (*(this->workerNetAddress)).write(oprot); xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); return xfer; } BlockMasterWorkerService_getWorkerId_result::~BlockMasterWorkerService_getWorkerId_result() throw() { } uint32_t BlockMasterWorkerService_getWorkerId_result::read(::apache::thrift::protocol::TProtocol* iprot) { apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; int16_t fid; xfer += iprot->readStructBegin(fname); using ::apache::thrift::protocol::TProtocolException; while (true) { xfer += iprot->readFieldBegin(fname, ftype, fid); if (ftype == ::apache::thrift::protocol::T_STOP) { break; } switch (fid) { case 0: if (ftype == ::apache::thrift::protocol::T_I64) { xfer += iprot->readI64(this->success); this->__isset.success = true; } else { xfer += iprot->skip(ftype); } break; case 1: if (ftype == ::apache::thrift::protocol::T_STRUCT) { xfer += this->e.read(iprot); this->__isset.e = true; } else { xfer += iprot->skip(ftype); } break; default: xfer += iprot->skip(ftype); break; } xfer += iprot->readFieldEnd(); } xfer += iprot->readStructEnd(); return xfer; } uint32_t BlockMasterWorkerService_getWorkerId_result::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; xfer += oprot->writeStructBegin("BlockMasterWorkerService_getWorkerId_result"); if (this->__isset.success) { xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_I64, 0); xfer += oprot->writeI64(this->success); xfer += oprot->writeFieldEnd(); } else if (this->__isset.e) { xfer += oprot->writeFieldBegin("e", ::apache::thrift::protocol::T_STRUCT, 1); xfer += this->e.write(oprot); xfer += oprot->writeFieldEnd(); } xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); return xfer; } BlockMasterWorkerService_getWorkerId_presult::~BlockMasterWorkerService_getWorkerId_presult() throw() { } uint32_t BlockMasterWorkerService_getWorkerId_presult::read(::apache::thrift::protocol::TProtocol* iprot) { apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; int16_t fid; xfer += iprot->readStructBegin(fname); using ::apache::thrift::protocol::TProtocolException; while (true) { xfer += iprot->readFieldBegin(fname, ftype, fid); if (ftype == ::apache::thrift::protocol::T_STOP) { break; } switch (fid) { case 0: if (ftype == ::apache::thrift::protocol::T_I64) { xfer += iprot->readI64((*(this->success))); this->__isset.success = true; } else { xfer += iprot->skip(ftype); } break; case 1: if (ftype == ::apache::thrift::protocol::T_STRUCT) { xfer += this->e.read(iprot); this->__isset.e = true; } else { xfer += iprot->skip(ftype); } break; default: xfer += iprot->skip(ftype); break; } xfer += iprot->readFieldEnd(); } xfer += iprot->readStructEnd(); return xfer; } BlockMasterWorkerService_heartbeat_args::~BlockMasterWorkerService_heartbeat_args() throw() { } uint32_t BlockMasterWorkerService_heartbeat_args::read(::apache::thrift::protocol::TProtocol* iprot) { apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; int16_t fid; xfer += iprot->readStructBegin(fname); using ::apache::thrift::protocol::TProtocolException; while (true) { xfer += iprot->readFieldBegin(fname, ftype, fid); if (ftype == ::apache::thrift::protocol::T_STOP) { break; } switch (fid) { case 1: if (ftype == ::apache::thrift::protocol::T_I64) { xfer += iprot->readI64(this->workerId); this->__isset.workerId = true; } else { xfer += iprot->skip(ftype); } break; case 2: if (ftype == ::apache::thrift::protocol::T_MAP) { { this->usedBytesOnTiers.clear(); uint32_t _size13; ::apache::thrift::protocol::TType _ktype14; ::apache::thrift::protocol::TType _vtype15; xfer += iprot->readMapBegin(_ktype14, _vtype15, _size13); uint32_t _i17; for (_i17 = 0; _i17 < _size13; ++_i17) { std::string _key18; xfer += iprot->readString(_key18); int64_t& _val19 = this->usedBytesOnTiers[_key18]; xfer += iprot->readI64(_val19); } xfer += iprot->readMapEnd(); } this->__isset.usedBytesOnTiers = true; } else { xfer += iprot->skip(ftype); } break; case 3: if (ftype == ::apache::thrift::protocol::T_LIST) { { this->removedBlockIds.clear(); uint32_t _size20; ::apache::thrift::protocol::TType _etype23; xfer += iprot->readListBegin(_etype23, _size20); this->removedBlockIds.resize(_size20); uint32_t _i24; for (_i24 = 0; _i24 < _size20; ++_i24) { xfer += iprot->readI64(this->removedBlockIds[_i24]); } xfer += iprot->readListEnd(); } this->__isset.removedBlockIds = true; } else { xfer += iprot->skip(ftype); } break; case 4: if (ftype == ::apache::thrift::protocol::T_MAP) { { this->addedBlocksOnTiers.clear(); uint32_t _size25; ::apache::thrift::protocol::TType _ktype26; ::apache::thrift::protocol::TType _vtype27; xfer += iprot->readMapBegin(_ktype26, _vtype27, _size25); uint32_t _i29; for (_i29 = 0; _i29 < _size25; ++_i29) { std::string _key30; xfer += iprot->readString(_key30); std::vector<int64_t> & _val31 = this->addedBlocksOnTiers[_key30]; { _val31.clear(); uint32_t _size32; ::apache::thrift::protocol::TType _etype35; xfer += iprot->readListBegin(_etype35, _size32); _val31.resize(_size32); uint32_t _i36; for (_i36 = 0; _i36 < _size32; ++_i36) { xfer += iprot->readI64(_val31[_i36]); } xfer += iprot->readListEnd(); } } xfer += iprot->readMapEnd(); } this->__isset.addedBlocksOnTiers = true; } else { xfer += iprot->skip(ftype); } break; default: xfer += iprot->skip(ftype); break; } xfer += iprot->readFieldEnd(); } xfer += iprot->readStructEnd(); return xfer; } uint32_t BlockMasterWorkerService_heartbeat_args::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("BlockMasterWorkerService_heartbeat_args"); xfer += oprot->writeFieldBegin("workerId", ::apache::thrift::protocol::T_I64, 1); xfer += oprot->writeI64(this->workerId); xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldBegin("usedBytesOnTiers", ::apache::thrift::protocol::T_MAP, 2); { xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_I64, static_cast<uint32_t>(this->usedBytesOnTiers.size())); std::map<std::string, int64_t> ::const_iterator _iter37; for (_iter37 = this->usedBytesOnTiers.begin(); _iter37 != this->usedBytesOnTiers.end(); ++_iter37) { xfer += oprot->writeString(_iter37->first); xfer += oprot->writeI64(_iter37->second); } xfer += oprot->writeMapEnd(); } xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldBegin("removedBlockIds", ::apache::thrift::protocol::T_LIST, 3); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_I64, static_cast<uint32_t>(this->removedBlockIds.size())); std::vector<int64_t> ::const_iterator _iter38; for (_iter38 = this->removedBlockIds.begin(); _iter38 != this->removedBlockIds.end(); ++_iter38) { xfer += oprot->writeI64((*_iter38)); } xfer += oprot->writeListEnd(); } xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldBegin("addedBlocksOnTiers", ::apache::thrift::protocol::T_MAP, 4); { xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_LIST, static_cast<uint32_t>(this->addedBlocksOnTiers.size())); std::map<std::string, std::vector<int64_t> > ::const_iterator _iter39; for (_iter39 = this->addedBlocksOnTiers.begin(); _iter39 != this->addedBlocksOnTiers.end(); ++_iter39) { xfer += oprot->writeString(_iter39->first); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_I64, static_cast<uint32_t>(_iter39->second.size())); std::vector<int64_t> ::const_iterator _iter40; for (_iter40 = _iter39->second.begin(); _iter40 != _iter39->second.end(); ++_iter40) { xfer += oprot->writeI64((*_iter40)); } xfer += oprot->writeListEnd(); } } xfer += oprot->writeMapEnd(); } xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); return xfer; } BlockMasterWorkerService_heartbeat_pargs::~BlockMasterWorkerService_heartbeat_pargs() throw() { } uint32_t BlockMasterWorkerService_heartbeat_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("BlockMasterWorkerService_heartbeat_pargs"); xfer += oprot->writeFieldBegin("workerId", ::apache::thrift::protocol::T_I64, 1); xfer += oprot->writeI64((*(this->workerId))); xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldBegin("usedBytesOnTiers", ::apache::thrift::protocol::T_MAP, 2); { xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_I64, static_cast<uint32_t>((*(this->usedBytesOnTiers)).size())); std::map<std::string, int64_t> ::const_iterator _iter41; for (_iter41 = (*(this->usedBytesOnTiers)).begin(); _iter41 != (*(this->usedBytesOnTiers)).end(); ++_iter41) { xfer += oprot->writeString(_iter41->first); xfer += oprot->writeI64(_iter41->second); } xfer += oprot->writeMapEnd(); } xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldBegin("removedBlockIds", ::apache::thrift::protocol::T_LIST, 3); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_I64, static_cast<uint32_t>((*(this->removedBlockIds)).size())); std::vector<int64_t> ::const_iterator _iter42; for (_iter42 = (*(this->removedBlockIds)).begin(); _iter42 != (*(this->removedBlockIds)).end(); ++_iter42) { xfer += oprot->writeI64((*_iter42)); } xfer += oprot->writeListEnd(); } xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldBegin("addedBlocksOnTiers", ::apache::thrift::protocol::T_MAP, 4); { xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_LIST, static_cast<uint32_t>((*(this->addedBlocksOnTiers)).size())); std::map<std::string, std::vector<int64_t> > ::const_iterator _iter43; for (_iter43 = (*(this->addedBlocksOnTiers)).begin(); _iter43 != (*(this->addedBlocksOnTiers)).end(); ++_iter43) { xfer += oprot->writeString(_iter43->first); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_I64, static_cast<uint32_t>(_iter43->second.size())); std::vector<int64_t> ::const_iterator _iter44; for (_iter44 = _iter43->second.begin(); _iter44 != _iter43->second.end(); ++_iter44) { xfer += oprot->writeI64((*_iter44)); } xfer += oprot->writeListEnd(); } } xfer += oprot->writeMapEnd(); } xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); return xfer; } BlockMasterWorkerService_heartbeat_result::~BlockMasterWorkerService_heartbeat_result() throw() { } uint32_t BlockMasterWorkerService_heartbeat_result::read(::apache::thrift::protocol::TProtocol* iprot) { apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; int16_t fid; xfer += iprot->readStructBegin(fname); using ::apache::thrift::protocol::TProtocolException; while (true) { xfer += iprot->readFieldBegin(fname, ftype, fid); if (ftype == ::apache::thrift::protocol::T_STOP) { break; } switch (fid) { case 0: if (ftype == ::apache::thrift::protocol::T_STRUCT) { xfer += this->success.read(iprot); this->__isset.success = true; } else { xfer += iprot->skip(ftype); } break; case 1: if (ftype == ::apache::thrift::protocol::T_STRUCT) { xfer += this->e.read(iprot); this->__isset.e = true; } else { xfer += iprot->skip(ftype); } break; default: xfer += iprot->skip(ftype); break; } xfer += iprot->readFieldEnd(); } xfer += iprot->readStructEnd(); return xfer; } uint32_t BlockMasterWorkerService_heartbeat_result::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; xfer += oprot->writeStructBegin("BlockMasterWorkerService_heartbeat_result"); if (this->__isset.success) { xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRUCT, 0); xfer += this->success.write(oprot); xfer += oprot->writeFieldEnd(); } else if (this->__isset.e) { xfer += oprot->writeFieldBegin("e", ::apache::thrift::protocol::T_STRUCT, 1); xfer += this->e.write(oprot); xfer += oprot->writeFieldEnd(); } xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); return xfer; } BlockMasterWorkerService_heartbeat_presult::~BlockMasterWorkerService_heartbeat_presult() throw() { } uint32_t BlockMasterWorkerService_heartbeat_presult::read(::apache::thrift::protocol::TProtocol* iprot) { apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; int16_t fid; xfer += iprot->readStructBegin(fname); using ::apache::thrift::protocol::TProtocolException; while (true) { xfer += iprot->readFieldBegin(fname, ftype, fid); if (ftype == ::apache::thrift::protocol::T_STOP) { break; } switch (fid) { case 0: if (ftype == ::apache::thrift::protocol::T_STRUCT) { xfer += (*(this->success)).read(iprot); this->__isset.success = true; } else { xfer += iprot->skip(ftype); } break; case 1: if (ftype == ::apache::thrift::protocol::T_STRUCT) { xfer += this->e.read(iprot); this->__isset.e = true; } else { xfer += iprot->skip(ftype); } break; default: xfer += iprot->skip(ftype); break; } xfer += iprot->readFieldEnd(); } xfer += iprot->readStructEnd(); return xfer; } BlockMasterWorkerService_registerWorker_args::~BlockMasterWorkerService_registerWorker_args() throw() { } uint32_t BlockMasterWorkerService_registerWorker_args::read(::apache::thrift::protocol::TProtocol* iprot) { apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; int16_t fid; xfer += iprot->readStructBegin(fname); using ::apache::thrift::protocol::TProtocolException; while (true) { xfer += iprot->readFieldBegin(fname, ftype, fid); if (ftype == ::apache::thrift::protocol::T_STOP) { break; } switch (fid) { case 1: if (ftype == ::apache::thrift::protocol::T_I64) { xfer += iprot->readI64(this->workerId); this->__isset.workerId = true; } else { xfer += iprot->skip(ftype); } break; case 2: if (ftype == ::apache::thrift::protocol::T_LIST) { { this->storageTiers.clear(); uint32_t _size45; ::apache::thrift::protocol::TType _etype48; xfer += iprot->readListBegin(_etype48, _size45); this->storageTiers.resize(_size45); uint32_t _i49; for (_i49 = 0; _i49 < _size45; ++_i49) { xfer += iprot->readString(this->storageTiers[_i49]); } xfer += iprot->readListEnd(); } this->__isset.storageTiers = true; } else { xfer += iprot->skip(ftype); } break; case 3: if (ftype == ::apache::thrift::protocol::T_MAP) { { this->totalBytesOnTiers.clear(); uint32_t _size50; ::apache::thrift::protocol::TType _ktype51; ::apache::thrift::protocol::TType _vtype52; xfer += iprot->readMapBegin(_ktype51, _vtype52, _size50); uint32_t _i54; for (_i54 = 0; _i54 < _size50; ++_i54) { std::string _key55; xfer += iprot->readString(_key55); int64_t& _val56 = this->totalBytesOnTiers[_key55]; xfer += iprot->readI64(_val56); } xfer += iprot->readMapEnd(); } this->__isset.totalBytesOnTiers = true; } else { xfer += iprot->skip(ftype); } break; case 4: if (ftype == ::apache::thrift::protocol::T_MAP) { { this->usedBytesOnTiers.clear(); uint32_t _size57; ::apache::thrift::protocol::TType _ktype58; ::apache::thrift::protocol::TType _vtype59; xfer += iprot->readMapBegin(_ktype58, _vtype59, _size57); uint32_t _i61; for (_i61 = 0; _i61 < _size57; ++_i61) { std::string _key62; xfer += iprot->readString(_key62); int64_t& _val63 = this->usedBytesOnTiers[_key62]; xfer += iprot->readI64(_val63); } xfer += iprot->readMapEnd(); } this->__isset.usedBytesOnTiers = true; } else { xfer += iprot->skip(ftype); } break; case 5: if (ftype == ::apache::thrift::protocol::T_MAP) { { this->currentBlocksOnTiers.clear(); uint32_t _size64; ::apache::thrift::protocol::TType _ktype65; ::apache::thrift::protocol::TType _vtype66; xfer += iprot->readMapBegin(_ktype65, _vtype66, _size64); uint32_t _i68; for (_i68 = 0; _i68 < _size64; ++_i68) { std::string _key69; xfer += iprot->readString(_key69); std::vector<int64_t> & _val70 = this->currentBlocksOnTiers[_key69]; { _val70.clear(); uint32_t _size71; ::apache::thrift::protocol::TType _etype74; xfer += iprot->readListBegin(_etype74, _size71); _val70.resize(_size71); uint32_t _i75; for (_i75 = 0; _i75 < _size71; ++_i75) { xfer += iprot->readI64(_val70[_i75]); } xfer += iprot->readListEnd(); } } xfer += iprot->readMapEnd(); } this->__isset.currentBlocksOnTiers = true; } else { xfer += iprot->skip(ftype); } break; default: xfer += iprot->skip(ftype); break; } xfer += iprot->readFieldEnd(); } xfer += iprot->readStructEnd(); return xfer; } uint32_t BlockMasterWorkerService_registerWorker_args::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("BlockMasterWorkerService_registerWorker_args"); xfer += oprot->writeFieldBegin("workerId", ::apache::thrift::protocol::T_I64, 1); xfer += oprot->writeI64(this->workerId); xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldBegin("storageTiers", ::apache::thrift::protocol::T_LIST, 2); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->storageTiers.size())); std::vector<std::string> ::const_iterator _iter76; for (_iter76 = this->storageTiers.begin(); _iter76 != this->storageTiers.end(); ++_iter76) { xfer += oprot->writeString((*_iter76)); } xfer += oprot->writeListEnd(); } xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldBegin("totalBytesOnTiers", ::apache::thrift::protocol::T_MAP, 3); { xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_I64, static_cast<uint32_t>(this->totalBytesOnTiers.size())); std::map<std::string, int64_t> ::const_iterator _iter77; for (_iter77 = this->totalBytesOnTiers.begin(); _iter77 != this->totalBytesOnTiers.end(); ++_iter77) { xfer += oprot->writeString(_iter77->first); xfer += oprot->writeI64(_iter77->second); } xfer += oprot->writeMapEnd(); } xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldBegin("usedBytesOnTiers", ::apache::thrift::protocol::T_MAP, 4); { xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_I64, static_cast<uint32_t>(this->usedBytesOnTiers.size())); std::map<std::string, int64_t> ::const_iterator _iter78; for (_iter78 = this->usedBytesOnTiers.begin(); _iter78 != this->usedBytesOnTiers.end(); ++_iter78) { xfer += oprot->writeString(_iter78->first); xfer += oprot->writeI64(_iter78->second); } xfer += oprot->writeMapEnd(); } xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldBegin("currentBlocksOnTiers", ::apache::thrift::protocol::T_MAP, 5); { xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_LIST, static_cast<uint32_t>(this->currentBlocksOnTiers.size())); std::map<std::string, std::vector<int64_t> > ::const_iterator _iter79; for (_iter79 = this->currentBlocksOnTiers.begin(); _iter79 != this->currentBlocksOnTiers.end(); ++_iter79) { xfer += oprot->writeString(_iter79->first); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_I64, static_cast<uint32_t>(_iter79->second.size())); std::vector<int64_t> ::const_iterator _iter80; for (_iter80 = _iter79->second.begin(); _iter80 != _iter79->second.end(); ++_iter80) { xfer += oprot->writeI64((*_iter80)); } xfer += oprot->writeListEnd(); } } xfer += oprot->writeMapEnd(); } xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); return xfer; } BlockMasterWorkerService_registerWorker_pargs::~BlockMasterWorkerService_registerWorker_pargs() throw() { } uint32_t BlockMasterWorkerService_registerWorker_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("BlockMasterWorkerService_registerWorker_pargs"); xfer += oprot->writeFieldBegin("workerId", ::apache::thrift::protocol::T_I64, 1); xfer += oprot->writeI64((*(this->workerId))); xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldBegin("storageTiers", ::apache::thrift::protocol::T_LIST, 2); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>((*(this->storageTiers)).size())); std::vector<std::string> ::const_iterator _iter81; for (_iter81 = (*(this->storageTiers)).begin(); _iter81 != (*(this->storageTiers)).end(); ++_iter81) { xfer += oprot->writeString((*_iter81)); } xfer += oprot->writeListEnd(); } xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldBegin("totalBytesOnTiers", ::apache::thrift::protocol::T_MAP, 3); { xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_I64, static_cast<uint32_t>((*(this->totalBytesOnTiers)).size())); std::map<std::string, int64_t> ::const_iterator _iter82; for (_iter82 = (*(this->totalBytesOnTiers)).begin(); _iter82 != (*(this->totalBytesOnTiers)).end(); ++_iter82) { xfer += oprot->writeString(_iter82->first); xfer += oprot->writeI64(_iter82->second); } xfer += oprot->writeMapEnd(); } xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldBegin("usedBytesOnTiers", ::apache::thrift::protocol::T_MAP, 4); { xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_I64, static_cast<uint32_t>((*(this->usedBytesOnTiers)).size())); std::map<std::string, int64_t> ::const_iterator _iter83; for (_iter83 = (*(this->usedBytesOnTiers)).begin(); _iter83 != (*(this->usedBytesOnTiers)).end(); ++_iter83) { xfer += oprot->writeString(_iter83->first); xfer += oprot->writeI64(_iter83->second); } xfer += oprot->writeMapEnd(); } xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldBegin("currentBlocksOnTiers", ::apache::thrift::protocol::T_MAP, 5); { xfer += oprot->writeMapBegin(::apache::thrift::protocol::T_STRING, ::apache::thrift::protocol::T_LIST, static_cast<uint32_t>((*(this->currentBlocksOnTiers)).size())); std::map<std::string, std::vector<int64_t> > ::const_iterator _iter84; for (_iter84 = (*(this->currentBlocksOnTiers)).begin(); _iter84 != (*(this->currentBlocksOnTiers)).end(); ++_iter84) { xfer += oprot->writeString(_iter84->first); { xfer += oprot->writeListBegin(::apache::thrift::protocol::T_I64, static_cast<uint32_t>(_iter84->second.size())); std::vector<int64_t> ::const_iterator _iter85; for (_iter85 = _iter84->second.begin(); _iter85 != _iter84->second.end(); ++_iter85) { xfer += oprot->writeI64((*_iter85)); } xfer += oprot->writeListEnd(); } } xfer += oprot->writeMapEnd(); } xfer += oprot->writeFieldEnd(); xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); return xfer; } BlockMasterWorkerService_registerWorker_result::~BlockMasterWorkerService_registerWorker_result() throw() { } uint32_t BlockMasterWorkerService_registerWorker_result::read(::apache::thrift::protocol::TProtocol* iprot) { apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; int16_t fid; xfer += iprot->readStructBegin(fname); using ::apache::thrift::protocol::TProtocolException; while (true) { xfer += iprot->readFieldBegin(fname, ftype, fid); if (ftype == ::apache::thrift::protocol::T_STOP) { break; } switch (fid) { case 1: if (ftype == ::apache::thrift::protocol::T_STRUCT) { xfer += this->e.read(iprot); this->__isset.e = true; } else { xfer += iprot->skip(ftype); } break; default: xfer += iprot->skip(ftype); break; } xfer += iprot->readFieldEnd(); } xfer += iprot->readStructEnd(); return xfer; } uint32_t BlockMasterWorkerService_registerWorker_result::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; xfer += oprot->writeStructBegin("BlockMasterWorkerService_registerWorker_result"); if (this->__isset.e) { xfer += oprot->writeFieldBegin("e", ::apache::thrift::protocol::T_STRUCT, 1); xfer += this->e.write(oprot); xfer += oprot->writeFieldEnd(); } xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); return xfer; } BlockMasterWorkerService_registerWorker_presult::~BlockMasterWorkerService_registerWorker_presult() throw() { } uint32_t BlockMasterWorkerService_registerWorker_presult::read(::apache::thrift::protocol::TProtocol* iprot) { apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; int16_t fid; xfer += iprot->readStructBegin(fname); using ::apache::thrift::protocol::TProtocolException; while (true) { xfer += iprot->readFieldBegin(fname, ftype, fid); if (ftype == ::apache::thrift::protocol::T_STOP) { break; } switch (fid) { case 1: if (ftype == ::apache::thrift::protocol::T_STRUCT) { xfer += this->e.read(iprot); this->__isset.e = true; } else { xfer += iprot->skip(ftype); } break; default: xfer += iprot->skip(ftype); break; } xfer += iprot->readFieldEnd(); } xfer += iprot->readStructEnd(); return xfer; } void BlockMasterWorkerServiceClient::commitBlock(const int64_t workerId, const int64_t usedBytesOnTier, const std::string& tierAlias, const int64_t blockId, const int64_t length) { send_commitBlock(workerId, usedBytesOnTier, tierAlias, blockId, length); recv_commitBlock(); } void BlockMasterWorkerServiceClient::send_commitBlock(const int64_t workerId, const int64_t usedBytesOnTier, const std::string& tierAlias, const int64_t blockId, const int64_t length) { int32_t cseqid = 0; oprot_->writeMessageBegin("commitBlock", ::apache::thrift::protocol::T_CALL, cseqid); BlockMasterWorkerService_commitBlock_pargs args; args.workerId = &workerId; args.usedBytesOnTier = &usedBytesOnTier; args.tierAlias = &tierAlias; args.blockId = &blockId; args.length = &length; args.write(oprot_); oprot_->writeMessageEnd(); oprot_->getTransport()->writeEnd(); oprot_->getTransport()->flush(); } void BlockMasterWorkerServiceClient::recv_commitBlock() { int32_t rseqid = 0; std::string fname; ::apache::thrift::protocol::TMessageType mtype; iprot_->readMessageBegin(fname, mtype, rseqid); if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { ::apache::thrift::TApplicationException x; x.read(iprot_); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); throw x; } if (mtype != ::apache::thrift::protocol::T_REPLY) { iprot_->skip(::apache::thrift::protocol::T_STRUCT); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); } if (fname.compare("commitBlock") != 0) { iprot_->skip(::apache::thrift::protocol::T_STRUCT); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); } BlockMasterWorkerService_commitBlock_presult result; result.read(iprot_); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); if (result.__isset.e) { throw result.e; } return; } int64_t BlockMasterWorkerServiceClient::getWorkerId(const ::WorkerNetAddress& workerNetAddress) { send_getWorkerId(workerNetAddress); return recv_getWorkerId(); } void BlockMasterWorkerServiceClient::send_getWorkerId(const ::WorkerNetAddress& workerNetAddress) { int32_t cseqid = 0; oprot_->writeMessageBegin("getWorkerId", ::apache::thrift::protocol::T_CALL, cseqid); BlockMasterWorkerService_getWorkerId_pargs args; args.workerNetAddress = &workerNetAddress; args.write(oprot_); oprot_->writeMessageEnd(); oprot_->getTransport()->writeEnd(); oprot_->getTransport()->flush(); } int64_t BlockMasterWorkerServiceClient::recv_getWorkerId() { int32_t rseqid = 0; std::string fname; ::apache::thrift::protocol::TMessageType mtype; iprot_->readMessageBegin(fname, mtype, rseqid); if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { ::apache::thrift::TApplicationException x; x.read(iprot_); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); throw x; } if (mtype != ::apache::thrift::protocol::T_REPLY) { iprot_->skip(::apache::thrift::protocol::T_STRUCT); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); } if (fname.compare("getWorkerId") != 0) { iprot_->skip(::apache::thrift::protocol::T_STRUCT); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); } int64_t _return; BlockMasterWorkerService_getWorkerId_presult result; result.success = &_return; result.read(iprot_); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); if (result.__isset.success) { return _return; } if (result.__isset.e) { throw result.e; } throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "getWorkerId failed: unknown result"); } void BlockMasterWorkerServiceClient::heartbeat( ::Command& _return, const int64_t workerId, const std::map<std::string, int64_t> & usedBytesOnTiers, const std::vector<int64_t> & removedBlockIds, const std::map<std::string, std::vector<int64_t> > & addedBlocksOnTiers) { send_heartbeat(workerId, usedBytesOnTiers, removedBlockIds, addedBlocksOnTiers); recv_heartbeat(_return); } void BlockMasterWorkerServiceClient::send_heartbeat(const int64_t workerId, const std::map<std::string, int64_t> & usedBytesOnTiers, const std::vector<int64_t> & removedBlockIds, const std::map<std::string, std::vector<int64_t> > & addedBlocksOnTiers) { int32_t cseqid = 0; oprot_->writeMessageBegin("heartbeat", ::apache::thrift::protocol::T_CALL, cseqid); BlockMasterWorkerService_heartbeat_pargs args; args.workerId = &workerId; args.usedBytesOnTiers = &usedBytesOnTiers; args.removedBlockIds = &removedBlockIds; args.addedBlocksOnTiers = &addedBlocksOnTiers; args.write(oprot_); oprot_->writeMessageEnd(); oprot_->getTransport()->writeEnd(); oprot_->getTransport()->flush(); } void BlockMasterWorkerServiceClient::recv_heartbeat( ::Command& _return) { int32_t rseqid = 0; std::string fname; ::apache::thrift::protocol::TMessageType mtype; iprot_->readMessageBegin(fname, mtype, rseqid); if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { ::apache::thrift::TApplicationException x; x.read(iprot_); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); throw x; } if (mtype != ::apache::thrift::protocol::T_REPLY) { iprot_->skip(::apache::thrift::protocol::T_STRUCT); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); } if (fname.compare("heartbeat") != 0) { iprot_->skip(::apache::thrift::protocol::T_STRUCT); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); } BlockMasterWorkerService_heartbeat_presult result; result.success = &_return; result.read(iprot_); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); if (result.__isset.success) { // _return pointer has now been filled return; } if (result.__isset.e) { throw result.e; } throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "heartbeat failed: unknown result"); } void BlockMasterWorkerServiceClient::registerWorker(const int64_t workerId, const std::vector<std::string> & storageTiers, const std::map<std::string, int64_t> & totalBytesOnTiers, const std::map<std::string, int64_t> & usedBytesOnTiers, const std::map<std::string, std::vector<int64_t> > & currentBlocksOnTiers) { send_registerWorker(workerId, storageTiers, totalBytesOnTiers, usedBytesOnTiers, currentBlocksOnTiers); recv_registerWorker(); } void BlockMasterWorkerServiceClient::send_registerWorker(const int64_t workerId, const std::vector<std::string> & storageTiers, const std::map<std::string, int64_t> & totalBytesOnTiers, const std::map<std::string, int64_t> & usedBytesOnTiers, const std::map<std::string, std::vector<int64_t> > & currentBlocksOnTiers) { int32_t cseqid = 0; oprot_->writeMessageBegin("registerWorker", ::apache::thrift::protocol::T_CALL, cseqid); BlockMasterWorkerService_registerWorker_pargs args; args.workerId = &workerId; args.storageTiers = &storageTiers; args.totalBytesOnTiers = &totalBytesOnTiers; args.usedBytesOnTiers = &usedBytesOnTiers; args.currentBlocksOnTiers = &currentBlocksOnTiers; args.write(oprot_); oprot_->writeMessageEnd(); oprot_->getTransport()->writeEnd(); oprot_->getTransport()->flush(); } void BlockMasterWorkerServiceClient::recv_registerWorker() { int32_t rseqid = 0; std::string fname; ::apache::thrift::protocol::TMessageType mtype; iprot_->readMessageBegin(fname, mtype, rseqid); if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { ::apache::thrift::TApplicationException x; x.read(iprot_); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); throw x; } if (mtype != ::apache::thrift::protocol::T_REPLY) { iprot_->skip(::apache::thrift::protocol::T_STRUCT); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); } if (fname.compare("registerWorker") != 0) { iprot_->skip(::apache::thrift::protocol::T_STRUCT); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); } BlockMasterWorkerService_registerWorker_presult result; result.read(iprot_); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); if (result.__isset.e) { throw result.e; } return; } bool BlockMasterWorkerServiceProcessor::dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext) { ProcessMap::iterator pfn; pfn = processMap_.find(fname); if (pfn == processMap_.end()) { return ::AlluxioServiceProcessor::dispatchCall(iprot, oprot, fname, seqid, callContext); } (this->*(pfn->second))(seqid, iprot, oprot, callContext); return true; } void BlockMasterWorkerServiceProcessor::process_commitBlock(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) { void* ctx = NULL; if (this->eventHandler_.get() != NULL) { ctx = this->eventHandler_->getContext("BlockMasterWorkerService.commitBlock", callContext); } ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "BlockMasterWorkerService.commitBlock"); if (this->eventHandler_.get() != NULL) { this->eventHandler_->preRead(ctx, "BlockMasterWorkerService.commitBlock"); } BlockMasterWorkerService_commitBlock_args args; args.read(iprot); iprot->readMessageEnd(); uint32_t bytes = iprot->getTransport()->readEnd(); if (this->eventHandler_.get() != NULL) { this->eventHandler_->postRead(ctx, "BlockMasterWorkerService.commitBlock", bytes); } BlockMasterWorkerService_commitBlock_result result; try { iface_->commitBlock(args.workerId, args.usedBytesOnTier, args.tierAlias, args.blockId, args.length); } catch ( ::AlluxioTException &e) { result.e = e; result.__isset.e = true; } catch (const std::exception& e) { if (this->eventHandler_.get() != NULL) { this->eventHandler_->handlerError(ctx, "BlockMasterWorkerService.commitBlock"); } ::apache::thrift::TApplicationException x(e.what()); oprot->writeMessageBegin("commitBlock", ::apache::thrift::protocol::T_EXCEPTION, seqid); x.write(oprot); oprot->writeMessageEnd(); oprot->getTransport()->writeEnd(); oprot->getTransport()->flush(); return; } if (this->eventHandler_.get() != NULL) { this->eventHandler_->preWrite(ctx, "BlockMasterWorkerService.commitBlock"); } oprot->writeMessageBegin("commitBlock", ::apache::thrift::protocol::T_REPLY, seqid); result.write(oprot); oprot->writeMessageEnd(); bytes = oprot->getTransport()->writeEnd(); oprot->getTransport()->flush(); if (this->eventHandler_.get() != NULL) { this->eventHandler_->postWrite(ctx, "BlockMasterWorkerService.commitBlock", bytes); } } void BlockMasterWorkerServiceProcessor::process_getWorkerId(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) { void* ctx = NULL; if (this->eventHandler_.get() != NULL) { ctx = this->eventHandler_->getContext("BlockMasterWorkerService.getWorkerId", callContext); } ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "BlockMasterWorkerService.getWorkerId"); if (this->eventHandler_.get() != NULL) { this->eventHandler_->preRead(ctx, "BlockMasterWorkerService.getWorkerId"); } BlockMasterWorkerService_getWorkerId_args args; args.read(iprot); iprot->readMessageEnd(); uint32_t bytes = iprot->getTransport()->readEnd(); if (this->eventHandler_.get() != NULL) { this->eventHandler_->postRead(ctx, "BlockMasterWorkerService.getWorkerId", bytes); } BlockMasterWorkerService_getWorkerId_result result; try { result.success = iface_->getWorkerId(args.workerNetAddress); result.__isset.success = true; } catch ( ::AlluxioTException &e) { result.e = e; result.__isset.e = true; } catch (const std::exception& e) { if (this->eventHandler_.get() != NULL) { this->eventHandler_->handlerError(ctx, "BlockMasterWorkerService.getWorkerId"); } ::apache::thrift::TApplicationException x(e.what()); oprot->writeMessageBegin("getWorkerId", ::apache::thrift::protocol::T_EXCEPTION, seqid); x.write(oprot); oprot->writeMessageEnd(); oprot->getTransport()->writeEnd(); oprot->getTransport()->flush(); return; } if (this->eventHandler_.get() != NULL) { this->eventHandler_->preWrite(ctx, "BlockMasterWorkerService.getWorkerId"); } oprot->writeMessageBegin("getWorkerId", ::apache::thrift::protocol::T_REPLY, seqid); result.write(oprot); oprot->writeMessageEnd(); bytes = oprot->getTransport()->writeEnd(); oprot->getTransport()->flush(); if (this->eventHandler_.get() != NULL) { this->eventHandler_->postWrite(ctx, "BlockMasterWorkerService.getWorkerId", bytes); } } void BlockMasterWorkerServiceProcessor::process_heartbeat(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) { void* ctx = NULL; if (this->eventHandler_.get() != NULL) { ctx = this->eventHandler_->getContext("BlockMasterWorkerService.heartbeat", callContext); } ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "BlockMasterWorkerService.heartbeat"); if (this->eventHandler_.get() != NULL) { this->eventHandler_->preRead(ctx, "BlockMasterWorkerService.heartbeat"); } BlockMasterWorkerService_heartbeat_args args; args.read(iprot); iprot->readMessageEnd(); uint32_t bytes = iprot->getTransport()->readEnd(); if (this->eventHandler_.get() != NULL) { this->eventHandler_->postRead(ctx, "BlockMasterWorkerService.heartbeat", bytes); } BlockMasterWorkerService_heartbeat_result result; try { iface_->heartbeat(result.success, args.workerId, args.usedBytesOnTiers, args.removedBlockIds, args.addedBlocksOnTiers); result.__isset.success = true; } catch ( ::AlluxioTException &e) { result.e = e; result.__isset.e = true; } catch (const std::exception& e) { if (this->eventHandler_.get() != NULL) { this->eventHandler_->handlerError(ctx, "BlockMasterWorkerService.heartbeat"); } ::apache::thrift::TApplicationException x(e.what()); oprot->writeMessageBegin("heartbeat", ::apache::thrift::protocol::T_EXCEPTION, seqid); x.write(oprot); oprot->writeMessageEnd(); oprot->getTransport()->writeEnd(); oprot->getTransport()->flush(); return; } if (this->eventHandler_.get() != NULL) { this->eventHandler_->preWrite(ctx, "BlockMasterWorkerService.heartbeat"); } oprot->writeMessageBegin("heartbeat", ::apache::thrift::protocol::T_REPLY, seqid); result.write(oprot); oprot->writeMessageEnd(); bytes = oprot->getTransport()->writeEnd(); oprot->getTransport()->flush(); if (this->eventHandler_.get() != NULL) { this->eventHandler_->postWrite(ctx, "BlockMasterWorkerService.heartbeat", bytes); } } void BlockMasterWorkerServiceProcessor::process_registerWorker(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) { void* ctx = NULL; if (this->eventHandler_.get() != NULL) { ctx = this->eventHandler_->getContext("BlockMasterWorkerService.registerWorker", callContext); } ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "BlockMasterWorkerService.registerWorker"); if (this->eventHandler_.get() != NULL) { this->eventHandler_->preRead(ctx, "BlockMasterWorkerService.registerWorker"); } BlockMasterWorkerService_registerWorker_args args; args.read(iprot); iprot->readMessageEnd(); uint32_t bytes = iprot->getTransport()->readEnd(); if (this->eventHandler_.get() != NULL) { this->eventHandler_->postRead(ctx, "BlockMasterWorkerService.registerWorker", bytes); } BlockMasterWorkerService_registerWorker_result result; try { iface_->registerWorker(args.workerId, args.storageTiers, args.totalBytesOnTiers, args.usedBytesOnTiers, args.currentBlocksOnTiers); } catch ( ::AlluxioTException &e) { result.e = e; result.__isset.e = true; } catch (const std::exception& e) { if (this->eventHandler_.get() != NULL) { this->eventHandler_->handlerError(ctx, "BlockMasterWorkerService.registerWorker"); } ::apache::thrift::TApplicationException x(e.what()); oprot->writeMessageBegin("registerWorker", ::apache::thrift::protocol::T_EXCEPTION, seqid); x.write(oprot); oprot->writeMessageEnd(); oprot->getTransport()->writeEnd(); oprot->getTransport()->flush(); return; } if (this->eventHandler_.get() != NULL) { this->eventHandler_->preWrite(ctx, "BlockMasterWorkerService.registerWorker"); } oprot->writeMessageBegin("registerWorker", ::apache::thrift::protocol::T_REPLY, seqid); result.write(oprot); oprot->writeMessageEnd(); bytes = oprot->getTransport()->writeEnd(); oprot->getTransport()->flush(); if (this->eventHandler_.get() != NULL) { this->eventHandler_->postWrite(ctx, "BlockMasterWorkerService.registerWorker", bytes); } } ::boost::shared_ptr< ::apache::thrift::TProcessor > BlockMasterWorkerServiceProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { ::apache::thrift::ReleaseHandler< BlockMasterWorkerServiceIfFactory > cleanup(handlerFactory_); ::boost::shared_ptr< BlockMasterWorkerServiceIf > handler(handlerFactory_->getHandler(connInfo), cleanup); ::boost::shared_ptr< ::apache::thrift::TProcessor > processor(new BlockMasterWorkerServiceProcessor(handler)); return processor; } void BlockMasterWorkerServiceConcurrentClient::commitBlock(const int64_t workerId, const int64_t usedBytesOnTier, const std::string& tierAlias, const int64_t blockId, const int64_t length) { int32_t seqid = send_commitBlock(workerId, usedBytesOnTier, tierAlias, blockId, length); recv_commitBlock(seqid); } int32_t BlockMasterWorkerServiceConcurrentClient::send_commitBlock(const int64_t workerId, const int64_t usedBytesOnTier, const std::string& tierAlias, const int64_t blockId, const int64_t length) { int32_t cseqid = this->sync_.generateSeqId(); ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); oprot_->writeMessageBegin("commitBlock", ::apache::thrift::protocol::T_CALL, cseqid); BlockMasterWorkerService_commitBlock_pargs args; args.workerId = &workerId; args.usedBytesOnTier = &usedBytesOnTier; args.tierAlias = &tierAlias; args.blockId = &blockId; args.length = &length; args.write(oprot_); oprot_->writeMessageEnd(); oprot_->getTransport()->writeEnd(); oprot_->getTransport()->flush(); sentry.commit(); return cseqid; } void BlockMasterWorkerServiceConcurrentClient::recv_commitBlock(const int32_t seqid) { int32_t rseqid = 0; std::string fname; ::apache::thrift::protocol::TMessageType mtype; // the read mutex gets dropped and reacquired as part of waitForWork() // The destructor of this sentry wakes up other clients ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); while(true) { if(!this->sync_.getPending(fname, mtype, rseqid)) { iprot_->readMessageBegin(fname, mtype, rseqid); } if(seqid == rseqid) { if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { ::apache::thrift::TApplicationException x; x.read(iprot_); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); sentry.commit(); throw x; } if (mtype != ::apache::thrift::protocol::T_REPLY) { iprot_->skip(::apache::thrift::protocol::T_STRUCT); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); } if (fname.compare("commitBlock") != 0) { iprot_->skip(::apache::thrift::protocol::T_STRUCT); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); // in a bad state, don't commit using ::apache::thrift::protocol::TProtocolException; throw TProtocolException(TProtocolException::INVALID_DATA); } BlockMasterWorkerService_commitBlock_presult result; result.read(iprot_); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); if (result.__isset.e) { sentry.commit(); throw result.e; } sentry.commit(); return; } // seqid != rseqid this->sync_.updatePending(fname, mtype, rseqid); // this will temporarily unlock the readMutex, and let other clients get work done this->sync_.waitForWork(seqid); } // end while(true) } int64_t BlockMasterWorkerServiceConcurrentClient::getWorkerId(const ::WorkerNetAddress& workerNetAddress) { int32_t seqid = send_getWorkerId(workerNetAddress); return recv_getWorkerId(seqid); } int32_t BlockMasterWorkerServiceConcurrentClient::send_getWorkerId(const ::WorkerNetAddress& workerNetAddress) { int32_t cseqid = this->sync_.generateSeqId(); ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); oprot_->writeMessageBegin("getWorkerId", ::apache::thrift::protocol::T_CALL, cseqid); BlockMasterWorkerService_getWorkerId_pargs args; args.workerNetAddress = &workerNetAddress; args.write(oprot_); oprot_->writeMessageEnd(); oprot_->getTransport()->writeEnd(); oprot_->getTransport()->flush(); sentry.commit(); return cseqid; } int64_t BlockMasterWorkerServiceConcurrentClient::recv_getWorkerId(const int32_t seqid) { int32_t rseqid = 0; std::string fname; ::apache::thrift::protocol::TMessageType mtype; // the read mutex gets dropped and reacquired as part of waitForWork() // The destructor of this sentry wakes up other clients ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); while(true) { if(!this->sync_.getPending(fname, mtype, rseqid)) { iprot_->readMessageBegin(fname, mtype, rseqid); } if(seqid == rseqid) { if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { ::apache::thrift::TApplicationException x; x.read(iprot_); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); sentry.commit(); throw x; } if (mtype != ::apache::thrift::protocol::T_REPLY) { iprot_->skip(::apache::thrift::protocol::T_STRUCT); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); } if (fname.compare("getWorkerId") != 0) { iprot_->skip(::apache::thrift::protocol::T_STRUCT); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); // in a bad state, don't commit using ::apache::thrift::protocol::TProtocolException; throw TProtocolException(TProtocolException::INVALID_DATA); } int64_t _return; BlockMasterWorkerService_getWorkerId_presult result; result.success = &_return; result.read(iprot_); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); if (result.__isset.success) { sentry.commit(); return _return; } if (result.__isset.e) { sentry.commit(); throw result.e; } // in a bad state, don't commit throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "getWorkerId failed: unknown result"); } // seqid != rseqid this->sync_.updatePending(fname, mtype, rseqid); // this will temporarily unlock the readMutex, and let other clients get work done this->sync_.waitForWork(seqid); } // end while(true) } void BlockMasterWorkerServiceConcurrentClient::heartbeat( ::Command& _return, const int64_t workerId, const std::map<std::string, int64_t> & usedBytesOnTiers, const std::vector<int64_t> & removedBlockIds, const std::map<std::string, std::vector<int64_t> > & addedBlocksOnTiers) { int32_t seqid = send_heartbeat(workerId, usedBytesOnTiers, removedBlockIds, addedBlocksOnTiers); recv_heartbeat(_return, seqid); } int32_t BlockMasterWorkerServiceConcurrentClient::send_heartbeat(const int64_t workerId, const std::map<std::string, int64_t> & usedBytesOnTiers, const std::vector<int64_t> & removedBlockIds, const std::map<std::string, std::vector<int64_t> > & addedBlocksOnTiers) { int32_t cseqid = this->sync_.generateSeqId(); ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); oprot_->writeMessageBegin("heartbeat", ::apache::thrift::protocol::T_CALL, cseqid); BlockMasterWorkerService_heartbeat_pargs args; args.workerId = &workerId; args.usedBytesOnTiers = &usedBytesOnTiers; args.removedBlockIds = &removedBlockIds; args.addedBlocksOnTiers = &addedBlocksOnTiers; args.write(oprot_); oprot_->writeMessageEnd(); oprot_->getTransport()->writeEnd(); oprot_->getTransport()->flush(); sentry.commit(); return cseqid; } void BlockMasterWorkerServiceConcurrentClient::recv_heartbeat( ::Command& _return, const int32_t seqid) { int32_t rseqid = 0; std::string fname; ::apache::thrift::protocol::TMessageType mtype; // the read mutex gets dropped and reacquired as part of waitForWork() // The destructor of this sentry wakes up other clients ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); while(true) { if(!this->sync_.getPending(fname, mtype, rseqid)) { iprot_->readMessageBegin(fname, mtype, rseqid); } if(seqid == rseqid) { if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { ::apache::thrift::TApplicationException x; x.read(iprot_); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); sentry.commit(); throw x; } if (mtype != ::apache::thrift::protocol::T_REPLY) { iprot_->skip(::apache::thrift::protocol::T_STRUCT); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); } if (fname.compare("heartbeat") != 0) { iprot_->skip(::apache::thrift::protocol::T_STRUCT); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); // in a bad state, don't commit using ::apache::thrift::protocol::TProtocolException; throw TProtocolException(TProtocolException::INVALID_DATA); } BlockMasterWorkerService_heartbeat_presult result; result.success = &_return; result.read(iprot_); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); if (result.__isset.success) { // _return pointer has now been filled sentry.commit(); return; } if (result.__isset.e) { sentry.commit(); throw result.e; } // in a bad state, don't commit throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "heartbeat failed: unknown result"); } // seqid != rseqid this->sync_.updatePending(fname, mtype, rseqid); // this will temporarily unlock the readMutex, and let other clients get work done this->sync_.waitForWork(seqid); } // end while(true) } void BlockMasterWorkerServiceConcurrentClient::registerWorker(const int64_t workerId, const std::vector<std::string> & storageTiers, const std::map<std::string, int64_t> & totalBytesOnTiers, const std::map<std::string, int64_t> & usedBytesOnTiers, const std::map<std::string, std::vector<int64_t> > & currentBlocksOnTiers) { int32_t seqid = send_registerWorker(workerId, storageTiers, totalBytesOnTiers, usedBytesOnTiers, currentBlocksOnTiers); recv_registerWorker(seqid); } int32_t BlockMasterWorkerServiceConcurrentClient::send_registerWorker(const int64_t workerId, const std::vector<std::string> & storageTiers, const std::map<std::string, int64_t> & totalBytesOnTiers, const std::map<std::string, int64_t> & usedBytesOnTiers, const std::map<std::string, std::vector<int64_t> > & currentBlocksOnTiers) { int32_t cseqid = this->sync_.generateSeqId(); ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); oprot_->writeMessageBegin("registerWorker", ::apache::thrift::protocol::T_CALL, cseqid); BlockMasterWorkerService_registerWorker_pargs args; args.workerId = &workerId; args.storageTiers = &storageTiers; args.totalBytesOnTiers = &totalBytesOnTiers; args.usedBytesOnTiers = &usedBytesOnTiers; args.currentBlocksOnTiers = &currentBlocksOnTiers; args.write(oprot_); oprot_->writeMessageEnd(); oprot_->getTransport()->writeEnd(); oprot_->getTransport()->flush(); sentry.commit(); return cseqid; } void BlockMasterWorkerServiceConcurrentClient::recv_registerWorker(const int32_t seqid) { int32_t rseqid = 0; std::string fname; ::apache::thrift::protocol::TMessageType mtype; // the read mutex gets dropped and reacquired as part of waitForWork() // The destructor of this sentry wakes up other clients ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); while(true) { if(!this->sync_.getPending(fname, mtype, rseqid)) { iprot_->readMessageBegin(fname, mtype, rseqid); } if(seqid == rseqid) { if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { ::apache::thrift::TApplicationException x; x.read(iprot_); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); sentry.commit(); throw x; } if (mtype != ::apache::thrift::protocol::T_REPLY) { iprot_->skip(::apache::thrift::protocol::T_STRUCT); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); } if (fname.compare("registerWorker") != 0) { iprot_->skip(::apache::thrift::protocol::T_STRUCT); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); // in a bad state, don't commit using ::apache::thrift::protocol::TProtocolException; throw TProtocolException(TProtocolException::INVALID_DATA); } BlockMasterWorkerService_registerWorker_presult result; result.read(iprot_); iprot_->readMessageEnd(); iprot_->getTransport()->readEnd(); if (result.__isset.e) { sentry.commit(); throw result.e; } sentry.commit(); return; } // seqid != rseqid this->sync_.updatePending(fname, mtype, rseqid); // this will temporarily unlock the readMutex, and let other clients get work done this->sync_.waitForWork(seqid); } // end while(true) }
33.354037
330
0.656596
pspringer
8fa1afbc0840585b82c990f9b8dcd8c42a399cba
898
cpp
C++
class 11.cpp
AxlidinovJ/masalalar_C
ca48c0db29155016a729fbe23030d4a638175d9b
[ "MIT" ]
3
2021-12-02T20:28:27.000Z
2021-12-08T10:21:24.000Z
class 11.cpp
AxlidnovJ/masalalar_C
e0643137e115d7b9b26651a0d5acc24bc79f8d4f
[ "MIT" ]
null
null
null
class 11.cpp
AxlidnovJ/masalalar_C
e0643137e115d7b9b26651a0d5acc24bc79f8d4f
[ "MIT" ]
null
null
null
#include <iostream> #include <math.h> using namespace std; class Uchburchak{ private: int a, b, c; public: void setter(int x, int y, int z){ a = x; b = y; c = z; } int per_getter(){ int p; p = a + b + c; return p; } double yuza_getter(){ double s, p; p = (a + b + c) / 2; s = sqrt(p * (p - a) * (p - b) * (p - c)); return s; } void turi(int a, int b, int c){ if(a==b or a==c or b==c){ cout<<"\nTeng yonli "; }else if(a!=b or a!=c or b!=c){ cout<<"\nTurli tomonli"; }else if(a==b==c){ cout<<"\nTeng tomonli"; } } }; int main(){ Uchburchak u1; int a, b, c; cout << " a = "; cin >> a; cout << " b = "; cin >> b; cout << " c = "; cin >> c; u1.setter(a, b, c); cout << "per = " << u1.per_getter() << endl; cout << "yuza = " << u1.yuza_getter(); u1.turi(a,b,c); return 0; }
16.327273
47
0.45657
AxlidinovJ
8fa3b61e812f9168c39a33e35cc43ccc6921b9ec
8,795
cpp
C++
Cpp/SDK/SortableColumnButton_functions.cpp
MrManiak/Squad-SDK
742feb5991ae43d6f0cedd2d6b32b949923ca4f9
[ "Apache-2.0" ]
1
2020-08-15T08:31:55.000Z
2020-08-15T08:31:55.000Z
Cpp/SDK/SortableColumnButton_functions.cpp
MrManiak/Squad-SDK
742feb5991ae43d6f0cedd2d6b32b949923ca4f9
[ "Apache-2.0" ]
2
2020-08-15T08:43:56.000Z
2021-01-15T05:04:48.000Z
Cpp/SDK/SortableColumnButton_functions.cpp
MrManiak/Squad-SDK
742feb5991ae43d6f0cedd2d6b32b949923ca4f9
[ "Apache-2.0" ]
2
2020-08-10T12:05:42.000Z
2021-02-12T19:56:10.000Z
// Name: S, Version: b #include "../SDK.h" #ifdef _MSC_VER #pragma pack(push, 0x01) #endif /*!!HELPER_DEF!!*/ /*!!DEFINE!!*/ namespace UFT { //--------------------------------------------------------------------------- // Functions //--------------------------------------------------------------------------- // Function SortableColumnButton.SortableColumnButton_C.Set Sort State // (Public, BlueprintCallable, BlueprintEvent) // Parameters: // ESQSortStates SortState (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash) // bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor) void USortableColumnButton_C::Set_Sort_State(ESQSortStates SortState, bool bSelected) { static auto fn = UObject::FindObject<UFunction>("Function SortableColumnButton.SortableColumnButton_C.Set Sort State"); USortableColumnButton_C_Set_Sort_State_Params params; params.SortState = SortState; params.bSelected = bSelected; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function SortableColumnButton.SortableColumnButton_C.Set Arrow // (Public, HasOutParms, BlueprintCallable, BlueprintEvent, BlueprintPure) // Parameters: // ESlateVisibility ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash) ESlateVisibility USortableColumnButton_C::Set_Arrow() { static auto fn = UObject::FindObject<UFunction>("Function SortableColumnButton.SortableColumnButton_C.Set Arrow"); USortableColumnButton_C_Set_Arrow_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function SortableColumnButton.SortableColumnButton_C.Set Text // (Public, HasDefaults, BlueprintCallable, BlueprintEvent) // Parameters: // struct FText Text (BlueprintVisible, BlueprintReadOnly, Parm) void USortableColumnButton_C::Set_Text(const struct FText& Text) { static auto fn = UObject::FindObject<UFunction>("Function SortableColumnButton.SortableColumnButton_C.Set Text"); USortableColumnButton_C_Set_Text_Params params; params.Text = Text; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function SortableColumnButton.SortableColumnButton_C.Update Widget // (Public, HasDefaults, BlueprintCallable, BlueprintEvent) void USortableColumnButton_C::Update_Widget() { static auto fn = UObject::FindObject<UFunction>("Function SortableColumnButton.SortableColumnButton_C.Update Widget"); USortableColumnButton_C_Update_Widget_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function SortableColumnButton.SortableColumnButton_C.Set Selected // (Public, BlueprintCallable, BlueprintEvent) // Parameters: // bool bSelected (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor) void USortableColumnButton_C::Set_Selected(bool bSelected) { static auto fn = UObject::FindObject<UFunction>("Function SortableColumnButton.SortableColumnButton_C.Set Selected"); USortableColumnButton_C_Set_Selected_Params params; params.bSelected = bSelected; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function SortableColumnButton.SortableColumnButton_C.BndEvt__Button_K2Node_ComponentBoundEvent_17_OnButtonClickedEvent__DelegateSignature // (BlueprintEvent) void USortableColumnButton_C::BndEvt__Button_K2Node_ComponentBoundEvent_17_OnButtonClickedEvent__DelegateSignature() { static auto fn = UObject::FindObject<UFunction>("Function SortableColumnButton.SortableColumnButton_C.BndEvt__Button_K2Node_ComponentBoundEvent_17_OnButtonClickedEvent__DelegateSignature"); USortableColumnButton_C_BndEvt__Button_K2Node_ComponentBoundEvent_17_OnButtonClickedEvent__DelegateSignature_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function SortableColumnButton.SortableColumnButton_C.PreConstruct // (BlueprintCosmetic, Event, Public, BlueprintEvent) // Parameters: // bool IsDesignTime (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor) void USortableColumnButton_C::PreConstruct(bool IsDesignTime) { static auto fn = UObject::FindObject<UFunction>("Function SortableColumnButton.SortableColumnButton_C.PreConstruct"); USortableColumnButton_C_PreConstruct_Params params; params.IsDesignTime = IsDesignTime; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function SortableColumnButton.SortableColumnButton_C.Tick // (BlueprintCosmetic, Event, Public, BlueprintEvent) // Parameters: // struct FGeometry MyGeometry (BlueprintVisible, BlueprintReadOnly, Parm, IsPlainOldData, NoDestructor) // float InDeltaTime (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash) void USortableColumnButton_C::Tick(const struct FGeometry& MyGeometry, float InDeltaTime) { static auto fn = UObject::FindObject<UFunction>("Function SortableColumnButton.SortableColumnButton_C.Tick"); USortableColumnButton_C_Tick_Params params; params.MyGeometry = MyGeometry; params.InDeltaTime = InDeltaTime; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function SortableColumnButton.SortableColumnButton_C.Construct // (BlueprintCosmetic, Event, Public, BlueprintEvent) void USortableColumnButton_C::Construct() { static auto fn = UObject::FindObject<UFunction>("Function SortableColumnButton.SortableColumnButton_C.Construct"); USortableColumnButton_C_Construct_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function SortableColumnButton.SortableColumnButton_C.ExecuteUbergraph_SortableColumnButton // (Final, HasDefaults) // Parameters: // int EntryPoint (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash) void USortableColumnButton_C::ExecuteUbergraph_SortableColumnButton(int EntryPoint) { static auto fn = UObject::FindObject<UFunction>("Function SortableColumnButton.SortableColumnButton_C.ExecuteUbergraph_SortableColumnButton"); USortableColumnButton_C_ExecuteUbergraph_SortableColumnButton_Params params; params.EntryPoint = EntryPoint; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function SortableColumnButton.SortableColumnButton_C.OnHover__DelegateSignature // (Public, Delegate, BlueprintCallable, BlueprintEvent) // Parameters: // bool bHovered (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor) void USortableColumnButton_C::OnHover__DelegateSignature(bool bHovered) { static auto fn = UObject::FindObject<UFunction>("Function SortableColumnButton.SortableColumnButton_C.OnHover__DelegateSignature"); USortableColumnButton_C_OnHover__DelegateSignature_Params params; params.bHovered = bHovered; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function SortableColumnButton.SortableColumnButton_C.OnClicked__DelegateSignature // (Public, Delegate, BlueprintCallable, BlueprintEvent) // Parameters: // bool bIsAscending (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor) // TEnumAsByte<E_SortType> Sort_Type (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash) void USortableColumnButton_C::OnClicked__DelegateSignature(bool bIsAscending, TEnumAsByte<E_SortType> Sort_Type) { static auto fn = UObject::FindObject<UFunction>("Function SortableColumnButton.SortableColumnButton_C.OnClicked__DelegateSignature"); USortableColumnButton_C_OnClicked__DelegateSignature_Params params; params.bIsAscending = bIsAscending; params.Sort_Type = Sort_Type; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } } #ifdef _MSC_VER #pragma pack(pop) #endif
35.18
190
0.758158
MrManiak
8faa21fc4f32d49cb9eaa405dd7554a463191c11
3,628
cc
C++
schemelib/scheme/kinematics/Director.gtest.cc
YaoYinYing/rifdock
cbde6bbeefd29a066273bdf2937cf36b0d2e6335
[ "Apache-2.0" ]
25
2019-07-23T01:03:48.000Z
2022-03-31T04:16:08.000Z
schemelib/scheme/kinematics/Director.gtest.cc
YaoYinYing/rifdock
cbde6bbeefd29a066273bdf2937cf36b0d2e6335
[ "Apache-2.0" ]
13
2018-01-30T17:45:57.000Z
2022-03-28T11:02:44.000Z
schemelib/scheme/kinematics/Director.gtest.cc
YaoYinYing/rifdock
cbde6bbeefd29a066273bdf2937cf36b0d2e6335
[ "Apache-2.0" ]
14
2018-02-08T01:42:28.000Z
2022-03-31T12:56:17.000Z
#include <gtest/gtest.h> #include "scheme/nest/NEST.hh" #include "scheme/nest/pmap/ScaleMap.hh" #include "scheme/kinematics/Director.hh" #include "scheme/numeric/X1dim.hh" #include "scheme/util/Timer.hh" namespace scheme { namespace kinematics { namespace test_director { using std::cout; using std::endl; using numeric::X1dim; struct TestScene : public SceneBase<X1dim> { TestScene() : SceneBase<X1dim>() {} virtual ~TestScene(){} void add_position( X1dim const & x ) { this->positions_.push_back(x); update_symmetry(positions_.size()); } virtual shared_ptr<SceneBase<X1dim> > clone_deep() const { return make_shared<TestScene>(*this); } }; std::ostream & operator<<( std::ostream & out, TestScene const & s ){ out << "TestScene"; BOOST_FOREACH( X1dim x, s.positions_ ) out << "\t" << x; return out; } TEST( Director, test_NestDirector ){ typedef scheme::nest::NEST<1,X1dim> Nest1D; TestScene scene; scene.add_position(0); scene.add_position(0); scene.add_position(0); scene.add_position(0); NestDirector< Nest1D, typename Nest1D::Index > d0(0); NestDirector< Nest1D, typename Nest1D::Index > d2(2); d0.set_scene( 7, 3, scene ); ASSERT_EQ( Nest1D().set_and_get(7,3) , scene.position(0) ); ASSERT_EQ( X1dim(0.0) , scene.position(1) ); ASSERT_EQ( X1dim(0.0) , scene.position(2) ); ASSERT_EQ( X1dim(0.0) , scene.position(3) ); d2.set_scene( 7, 3, scene ); ASSERT_EQ( Nest1D().set_and_get(7,3) , scene.position(0) ); ASSERT_EQ( X1dim(0.0) , scene.position(1) ); ASSERT_EQ( Nest1D().set_and_get(7,3) , scene.position(2) ); ASSERT_EQ( X1dim(0.0) , scene.position(3) ); } TEST( Director, test_TreeDirector ){ // cout << "Director" << endl; TestScene scene; scene.add_position(0); scene.add_position(0); // cout << scene << endl; shared_ptr<scheme::nest::NestBase<> > x1nest = make_shared<scheme::nest::NEST<1,X1dim> >(1); shared_ptr<scheme::nest::NestBase<> > x1nest2 = make_shared<scheme::nest::NEST<1,X1dim> >(2); shared_ptr< SceneTree< X1dim > > child = make_shared< SceneTree< X1dim > >(10); child->add_body(1); child->add_position_nest(x1nest2); shared_ptr< SceneTree< X1dim > > root = make_shared< SceneTree< X1dim > >(20); root->add_body(0); root->add_position_nest(x1nest); root->add_child(child); TreeDirector< numeric::X1dim > director(root); nest::NEST<2,util::SimpleArray<2>,nest::pmap::ScaleMap> refnest( util::SimpleArray<2>(20.0,10.0), util::SimpleArray<2>(21.0,12.0), util::SimpleArray<2,uint64_t>(1,2) ); util::Timer<> t; int count = 0; for( int resl = 0; resl < 8; ++resl ){ // cout << "================== resl " << resl << " ======================" << endl; for( uint64_t i = 0; i < director.size(resl, (typename TreeDirector< numeric::X1dim >::BigIndex)(0)); ++i){ util::SimpleArray<2> tmp = refnest.set_and_get(i,resl); // scene.set_position( 0, tmp[0] ); // scene.set_position( 1, tmp[1] ); director.set_scene( i, resl, scene ); ++count; // cout << scene << " " << refnest.set_and_get(i,resl) << endl; ASSERT_EQ( scene.position(0)[0], tmp[0] ); ASSERT_EQ( scene.position(1)[0], tmp[1] ); } } cout << "set_scene rate: " << (double)count / t.elapsed() << " / sec " << endl; shared_ptr<SceneBase<X1dim> > test = scene.clone_deep(); // cout << test->position(0) << " " << scene.position(0) << endl; ASSERT_EQ( test->position(0)[0] , scene.position(0)[0] ); test->set_position(0,0); // cout << test->position(0) << " " << scene.position(0) << endl; ASSERT_NE( test->position(0)[0] , scene.position(0)[0] ); } } } }
29.258065
109
0.639195
YaoYinYing
2630ec8a3760317999e45c17f64d502b5928e572
1,714
hpp
C++
testing/TestCases.hpp
leighgarbs/toolbox
fd9ceada534916fa8987cfcb5220cece2188b304
[ "MIT" ]
null
null
null
testing/TestCases.hpp
leighgarbs/toolbox
fd9ceada534916fa8987cfcb5220cece2188b304
[ "MIT" ]
null
null
null
testing/TestCases.hpp
leighgarbs/toolbox
fd9ceada534916fa8987cfcb5220cece2188b304
[ "MIT" ]
null
null
null
#if !defined TEST_CASES_HPP #define TEST_CASES_HPP #include <list> #include <string> #include "Test.hpp" // This class allows sets of related Tests to be grouped and executed together. // It does this by storing an internal list of Tests and then implementing the // Test::body() pure virtual member function in such a way that when a TestCases // (which is itself a Test) is run, all tests in its internal list are run and // the result of all those tests is aggregated into a single result and // returned. See documentation for the TestCases::body() function for a // description of how test case results are aggregated. class TestCases : public Test { public: // Sets the name TestCases(const std::string& name); // Deletes all the added test cases virtual ~TestCases(); // Adds all test cases by calling addTestCases(), then runs them all in the // order they were added. Test::FAILED is returned if any test cases fail // (return Test::FAILED). If no test cases fail and at least one test case // passed (returned Test::PASSED), Test::PASSED is returned. If no test // cases pass or fail, Test::SKIPPED is returned. virtual Test::Result body(); protected: // Adds a test case to the end of the list of test cases that will be run // when run() is called void addTestCase(Test* test); // Derived classes must implement this to add their desired test cases using // addTestCase() virtual void addTestCases() = 0; private: std::list<Test*> test_cases; }; //============================================================================== inline void TestCases::addTestCase(Test* test) { test_cases.push_back(test); } #endif
31.163636
80
0.675613
leighgarbs
26355cc569cfa486632991b5be49c6fbc91a4d1e
1,089
cpp
C++
A/1044.cpp
chenjiajia9411/PATest
061c961f5d7bf7b23c3a1b70d3d443cb57263700
[ "Apache-2.0" ]
1
2017-11-24T15:06:29.000Z
2017-11-24T15:06:29.000Z
A/1044.cpp
chenjiajia9411/PAT
061c961f5d7bf7b23c3a1b70d3d443cb57263700
[ "Apache-2.0" ]
null
null
null
A/1044.cpp
chenjiajia9411/PAT
061c961f5d7bf7b23c3a1b70d3d443cb57263700
[ "Apache-2.0" ]
null
null
null
#include <iostream> #include <vector> #include <limits> #include <algorithm> using namespace std; typedef struct { int begin; int end; } result; int main() { int n,m; cin>>n>>m; vector<int> v(n); for(int i = 0; i < n; i++) cin>>v[i]; vector<result> r; int min_difference = numeric_limits<int>::max(); for(int begin = 0,end = 0,sum = v.front(); begin < n;) { if(sum >= m) { if(sum - m <= min_difference) { if(sum - m < min_difference) { min_difference = sum - m; r.clear(); } result temp; temp.begin = begin; temp.end = end; r.push_back(temp); } begin++; end = begin; sum = v[begin]; } else if(end < n) { end++; sum += v[end]; } else break; } for_each(r.begin(),r.end(),[&](result a)->void{cout<<a.begin + 1<<"-"<<a.end + 1<<endl;}); }
22.22449
94
0.413223
chenjiajia9411
263d9a3e46d754966994a417afcc6fbfad79b1fa
666
hh
C++
src/include/log.hh
tomblackwhite/alpha-emu
a371f7d094acbf02c83aa3940ff043f033b7cfe8
[ "BSD-2-Clause" ]
null
null
null
src/include/log.hh
tomblackwhite/alpha-emu
a371f7d094acbf02c83aa3940ff043f033b7cfe8
[ "BSD-2-Clause" ]
null
null
null
src/include/log.hh
tomblackwhite/alpha-emu
a371f7d094acbf02c83aa3940ff043f033b7cfe8
[ "BSD-2-Clause" ]
null
null
null
#pragma once #include <filesystem> #include <spdlog/spdlog.h> namespace filesystem = std::filesystem; class Log { public: // using TextSink = sinks::synchronous_sink<sinks::text_ostream_backend>; //初始化log Log(filesystem::path filePath = "") : m_filePath(filePath) {} void info(std::string_view str) const { spdlog::info("{}", str); } void warn(std::string_view str) const { spdlog::warn("{}", str); } void error(std::string_view str) const { spdlog::error("{}", str); } void debug(std::string_view str) const { spdlog::debug("{}", str); } static Log& GetInstance(){ static Log log; return log; } private: filesystem::path m_filePath; };
30.272727
75
0.674174
tomblackwhite
263e68702d09cc979b8659452db449638263da33
9,180
cpp
C++
src/gLists.cpp
xnevs/FocusSearchCpp
65ad71b8de09d879bed5c6f98b5487bdba233e12
[ "MIT" ]
1
2019-01-05T15:35:47.000Z
2019-01-05T15:35:47.000Z
src/gLists.cpp
xnevs/FocusSearchCpp
65ad71b8de09d879bed5c6f98b5487bdba233e12
[ "MIT" ]
null
null
null
src/gLists.cpp
xnevs/FocusSearchCpp
65ad71b8de09d879bed5c6f98b5487bdba233e12
[ "MIT" ]
1
2021-09-16T02:18:08.000Z
2021-09-16T02:18:08.000Z
/* * gLists.cpp * * Created on: Feb 27, 2012 * Author: bovi */ /* Copyright (c) 2013 by Rosalba Giugno FocusSearchC++ is part of the RI Project. FocusSearchC++ is a C++ implementation of the original software developed in Modula2 and provided by the authors of: Ullmann JR: Bit-vector algorithms for binary constraint satisfaction and subgraph isomorphism. J. Exp. Algorithmics 2011, 15:1.6:1.1-1.6:1.64. FocusSearchC++ is provided under the terms of The MIT License (MIT): 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 "defdebug.h" //#define MSL_CALLS //#define MSL_INSTRS //#define MSL_CICLES //#define MSL_INS //#define MSL_DOMAINS #include "gLists.h" void o_gLists_t::mcSeLists( o_domains_t& o_domains, o_match_state_t& o_mstate, o_vars_order_t& o_varsorder ){ #ifdef MSL_CALLS std::cout<<">>gLists::mcSeLists\n"; #endif //M2: VAR //M2: iDomain, row: domainType; //M2: matPtr: bitMatrixPointerType; //M2: ptr: adjVarPtrType; //M2: seListPtr, seList, iPtr, jPtr: DlistPtrType; //M2: i, j, u, v, jOrd, firstVar, ordLastSingleton: CARDINAL; domain_t iDomain, row; bitMatrix_t *matPtr; adjVar_rec_t *ptr; Dlist_rec_t *seListPtr, *seList, *iPtr, *jPtr; cardinal_t i, j, u, v, jOrd, firstVar, ordLastSingleton; //M2: BEGIN //M2: firstVar:= varAtOrd[0]; ordLastSingleton:= 0; --a //M2: IF Dcards[firstVar] = 1 THEN --b //M2: valueAt[firstVar]^:= Dlists[firstVar]^.value; firstVar:= varAtOrd[1]; //M2: END; #ifdef MSL_DOMAINS o_mstate.print_valueAt(pattern); #endif firstVar = o_varsorder.varAtOrd[0]; ordLastSingleton = 0; if(o_domains.Dcards[firstVar] == 1){ *(o_mstate.valueAt[firstVar]) = o_domains.Dlists[firstVar]->value; firstVar = o_varsorder.varAtOrd[1]; } #ifdef MSL_DOMAINS o_mstate.print_valueAt(pattern); #endif //M2: FOR jOrd:= 1 TO alphaUB DO //M2: j:= varAtOrd[jOrd]; --c for(jOrd = 1; jOrd < pattern.nof_nodes; jOrd++){ j = o_varsorder.varAtOrd[jOrd]; #ifdef MSL_CICLES std::cout<<".gLists::mcSeLists: j="<<j<<"\n"; #endif //M2: IF Dcards[j] > 1 THEN //M2: ptr:= adjVarInfo[j]; --d if(o_domains.Dcards[j] > 1){ ptr = adjVarInfo[j]; #ifdef MSL_INS std::cout<<"j= "<<j<<"; jOrd= "<<jOrd<<"; "; if(ptr == NULL)std::cout<<"adjVarInfo["<<j<<"] = ptr == NUL\n"; else std::cout<<"adjVarInfo["<<j<<"] = ptr != NUL\n"; #endif //M2: LOOP --e //M2: IF ptr = NIL THEN //M2: meepCard('No SeList for j = ', j, 4); meepCard(', jOrd = ', jOrd, 2); peepLn; HALT //M2: END; //M2: IF ordOfVar[ptr^.adjVar] < jOrd THEN i:= ptr^.adjVar; EXIT END; //M2: ptr:= ptr^.next; //M2: END; while(true){ if(ptr == NULL){ std::cout<<"gLists: No SeLits for j="<<j<<"\n"; exit(1); } #ifdef MSL_INS std::cout<<"o_varsorder.ordOfVar["<<ptr->adjVar<<"] < jOrd\n"; std::cout<<"\t=>"<<o_varsorder.ordOfVar[ptr->adjVar]<<" < "<<jOrd<<"\n"; #endif if(o_varsorder.ordOfVar[ptr->adjVar] < jOrd){ i = ptr->adjVar; break; } ptr = ptr->next; } //M2: selector[j]:= valueAt[i]; (* i is the selector for j *) //M2: iDomain:= Dsets[i]; //M2: iPtr:= Dlists[i]; matPtr:= ptr^.jMiPtr; --f //M2: o_mstate.selector[j] = o_mstate.valueAt[i]; iDomain = o_domains.Dsets[i]; iPtr = o_domains.Dlists[i]; matPtr = (ptr->jMiPtr); //M2: WHILE iPtr # NIL DO --g //M2: u:= iPtr^.value; row:= matPtr^[u]; jPtr:= Dlists[j]; seList:= NIL; --h //M2: WHILE jPtr # NIL DO --i //M2: v:= jPtr^.value; //M2: IF v IN row THEN //M2: NEW(seListPtr); //M2: WITH seListPtr^ DO value:= v; nextValue:= seList END; //M2: seList:= seListPtr; //M2: END; //M2: jPtr:= jPtr^.nextValue; //M2: END; //M2: seLists[j,u]:= seList; iPtr:= iPtr^.nextValue; //M2: END; while(iPtr != NULL){ #ifdef MSL_INS std::cout<<".while.iPtr\n"; #endif u = iPtr->value; row = *((matPtr)[u]); jPtr = o_domains.Dlists[j]; seList = NULL; while(jPtr != NULL){ #ifdef MSL_INS std::cout<<".while.jPtr\n"; #endif v = jPtr->value; if(row.get(v)){ #ifdef MSL_INS std::cout<<".row.get(v) == true\n"; #endif seListPtr = new Dlist_rec_t(); seListPtr->value = v; seListPtr->nextValue = seList; seList = seListPtr; } #ifdef MSL_INS std::cout<<"<.while.jPtr\n"; #endif jPtr = jPtr->nextValue; } #ifdef MSL_INS std::cout<<"END.while.jPtr\n"; #endif seLists[j][u] = seList; iPtr = iPtr->nextValue; } //M2: ELSE ordLastSingleton:= jOrd; valueAt[j]^:= Dlists[j]^.value; --j //M2: END; (* IF Dcards > *) }else{ ordLastSingleton = jOrd; *(o_mstate.valueAt[j]) = o_domains.Dlists[j]->value; #ifdef MSL_DOMAINS o_mstate.print_valueAt(pattern); #endif } //M2: END; (* FOR j *) } #ifdef MSL_INS std::cout<<"<.while\n"; #endif #ifdef DL_INSTRCS std::cout<<"-gLists::mcSeLists:--\n"; #endif //M2: IF ordLastSingleton > 0 THEN //M2: firstVar:= varAtOrd[ordLastSingleton + 1]; --k //M2: j:= varAtOrd[0]; valueAt[j]^:= Dlists[j]^.value; --l //M2: END; if(ordLastSingleton > 0){ firstVar = o_varsorder.varAtOrd[ordLastSingleton + 1]; j = o_varsorder.varAtOrd[0]; *(o_mstate.valueAt[j]) = o_domains.Dlists[j]->value; } //M2: END mcSeLists; #ifdef DL_CALLS std::cout<<"<gLists::mcSeLists\n"; #endif }; void o_gLists_t::mcAdjVarInfo(o_predicate_t& o_predicates, bool isordered){ #ifdef DL_CALLS std::cout<<">>o_gLists_t::mcAdjVarInfo()\n"; #endif //M2: VAR //M2: ptr: adjVarPtrType; //M2: g, i, k, first, second, otherVar: CARDINAL; //M2: BEGIN //M2: degree:= cardPatternType{0 BY nAlpha}; //M2: FOR g:= 1 TO eAlpha DO //M2: FOR k:= 0 TO 1 DO //M2: first:= alphaEdges[g, 0]; //M2: second:= alphaEdges[g, 1]; //M2: NEW(ptr); ptr^.lineNo:= g; //M2: IF k = 0 THEN //M2: i:= first; //M2: ptr^.adjVar:= second; //M2: ptr^.iMjPtr:= Rb1[g]; //M2: ptr^.jMiPtr:= Rb2[g]; //M2: INC(degree[first]); INC(degree[second]); //M2: ELSE //M2: i:= second; //M2: ptr^.adjVar:= first; //M2: ptr^.iMjPtr:= Rb2[g]; //M2: ptr^.jMiPtr:= Rb1[g] //M2: END; //M2: ptr^.next:= adjVarInfo[i]; //M2: adjVarInfo[i]:= ptr; //M2: END; //M2: END; //M2: END mcAdjVarInfo; //adjVarInfo = new adjVar_rec_t*[pattern.nof_nodes];//see gLists.h // init_degree(pattern); // init_adjVarInfo(pattern); // // // for(u_size_t i = 0; i<pattern.nof_nodes; i++) // adjVarInfo[i] = NULL; adjVar_rec_t *ptr; cardinal_t first, second, otherVar; for(u_size_t g = 0; g<pattern.nof_edges; g++){ first = pattern.edges[g].source; second = pattern.edges[g].target; adjVar_rec_t *ptr = new adjVar_rec_t(); ptr->lineNo = g; ptr->adjVar = second; ptr->iMjPtr = o_predicates.Rb1[g]; ptr->jMiPtr = o_predicates.Rb2[g]; // ptr->e = g; // ptr->iMjPtr_size = reference.nof_nodes; // ptr->node = first; // if(isordered){ ptr->direction = ETYPE_F;} // else{ ptr->direction = ETYPE_N;} ptr->next = adjVarInfo[first]; adjVarInfo[first] = ptr; // degree[first]++; degree[second]++; // adjVar_rec_t *ptr2 = new adjVar_rec_t(); ptr2->lineNo = g; ptr2->adjVar = first; ptr2->iMjPtr = o_predicates.Rb2[g]; ptr2->jMiPtr = o_predicates.Rb1[g]; // ptr2->e = g; // ptr2->iMjPtr_size = reference.nof_nodes; // ptr2->node = second; // // if(isordered){ ptr->direction = ETYPE_B;} // else{ ptr->direction = ETYPE_N;} ptr2->next = adjVarInfo[second]; adjVarInfo[second] = ptr2; } #ifdef DL_CALLS std::cout<<"<o_gLists_t::mcAdjVarInfo()\n"; #endif };
28.958991
97
0.590087
xnevs
263ed64a680453e1ce31ed1c7336c5bc7b9c56eb
9,971
cpp
C++
Source/Cpp/WfCpp_Statement.cpp
vczh2/Workflow
7ad7d53927ee66ae1df7d68b35e185ce9edcfcf1
[ "RSA-MD" ]
1
2018-10-17T16:00:38.000Z
2018-10-17T16:00:38.000Z
Source/Cpp/WfCpp_Statement.cpp
vczh2/Workflow
7ad7d53927ee66ae1df7d68b35e185ce9edcfcf1
[ "RSA-MD" ]
null
null
null
Source/Cpp/WfCpp_Statement.cpp
vczh2/Workflow
7ad7d53927ee66ae1df7d68b35e185ce9edcfcf1
[ "RSA-MD" ]
null
null
null
#include "WfCpp.h" namespace vl { namespace workflow { namespace cppcodegen { using namespace collections; using namespace reflection; using namespace reflection::description; using namespace analyzer; class WfGenerateStatementVisitor : public Object, public WfStatement::IVisitor { public: WfCppConfig* config; Ptr<FunctionRecord> functionRecord; stream::StreamWriter& writer; WString prefixBlock; WString prefix; ITypeInfo* returnType; WfGenerateStatementVisitor(WfCppConfig* _config, Ptr<FunctionRecord> _functionRecord, stream::StreamWriter& _writer, const WString& _prefixBlock, const WString& _prefix, ITypeInfo* _returnType) :config(_config) , functionRecord(_functionRecord) , writer(_writer) , prefixBlock(_prefixBlock) , prefix(_prefix) , returnType(_returnType) { } void Call(Ptr<WfStatement> node, WString prefixDelta = WString(L"\t", false)) { GenerateStatement(config, functionRecord, writer, node, prefix, prefixDelta, returnType); } void Visit(WfBreakStatement* node)override { writer.WriteString(prefix); writer.WriteLine(L"break;"); } void Visit(WfContinueStatement* node)override { writer.WriteString(prefix); writer.WriteLine(L"continue;"); } void Visit(WfReturnStatement* node)override { writer.WriteString(prefix); if (node->expression) { writer.WriteString(L"return "); GenerateExpression(config, writer, node->expression, returnType); writer.WriteLine(L";"); } else { writer.WriteLine(L"return;"); } } void Visit(WfDeleteStatement* node)override { writer.WriteString(prefix); writer.WriteString(L"::vl::__vwsn::This("); GenerateExpression(config, writer, node->expression, nullptr); writer.WriteLine(L")->Dispose(true);"); } void Visit(WfRaiseExceptionStatement* node)override { if (node->expression) { writer.WriteString(prefix); writer.WriteString(L"throw ::vl::Exception("); auto result = config->manager->expressionResolvings[node->expression.Obj()]; bool throwString = result.type->GetTypeDescriptor() == description::GetTypeDescriptor<WString>(); if (!throwString) { writer.WriteString(L"::vl::__vwsn::This("); } GenerateExpression(config, writer, node->expression, result.type.Obj()); if (!throwString) { writer.WriteString(L".Obj())->GetMessage()"); } writer.WriteLine(L");"); } else { writer.WriteString(prefix); writer.WriteLine(L"throw;"); } } void Visit(WfIfStatement* node)override { writer.WriteString(prefix); while (node) { writer.WriteString(L"if ("); if (node->type) { auto result = config->manager->expressionResolvings[node->expression.Obj()]; auto scope = config->manager->nodeScopes[node].Obj(); auto typeInfo = CreateTypeInfoFromType(scope, node->type); writer.WriteString(L"auto "); writer.WriteString(config->ConvertName(node->name.value)); writer.WriteString(L" = "); ConvertType(config, writer, result.type.Obj(), typeInfo.Obj(), [&]() {GenerateExpression(config, writer, node->expression, nullptr); }, false); } else { GenerateExpression(config, writer, node->expression, TypeInfoRetriver<bool>::CreateTypeInfo().Obj()); } writer.WriteLine(L")"); Call(node->trueBranch); if (node->falseBranch) { writer.WriteString(prefix); if (auto ifStat = node->falseBranch.Cast<WfIfStatement>()) { writer.WriteString(L"else "); node = ifStat.Obj(); continue; } else { writer.WriteLine(L"else"); Call(node->falseBranch); } } break; } } void Visit(WfWhileStatement* node)override { writer.WriteString(prefix); writer.WriteString(L"while ("); GenerateExpression(config, writer, node->condition, TypeInfoRetriver<bool>::CreateTypeInfo().Obj()); writer.WriteLine(L")"); Call(node->statement); } void Visit(WfTryStatement* node)override { auto exName = L"__vwsne_" + itow(functionRecord->exprCounter++); WString tryPrefix = prefix; if (node->finallyStatement) { auto blockName = L"__vwsnb_" + itow(functionRecord->blockCounter++); tryPrefix += L"\t"; writer.WriteString(prefix); writer.WriteLine(L"{"); writer.WriteString(tryPrefix); writer.WriteString(L"auto "); writer.WriteString(blockName); writer.WriteLine(L" = [&]()"); GenerateStatement(config, functionRecord, writer, node->finallyStatement, tryPrefix, WString(L"\t", false), returnType); writer.WriteString(tryPrefix); writer.WriteLine(L";"); writer.WriteString(tryPrefix); writer.WriteString(L"::vl::__vwsn::RunOnExit<::vl::RemoveCVR<decltype("); writer.WriteString(blockName); writer.WriteString(L")>::Type> "); writer.WriteString(blockName); writer.WriteString(L"_dtor(&"); writer.WriteString(blockName); writer.WriteLine(L");"); } WString bodyPrefix = tryPrefix + L"\t"; writer.WriteString(tryPrefix); writer.WriteLine(L"try"); writer.WriteString(tryPrefix); writer.WriteLine(L"{"); GenerateStatement(config, functionRecord, writer, node->protectedStatement, bodyPrefix, WString(L"\t", false), returnType); writer.WriteString(tryPrefix); writer.WriteLine(L"}"); writer.WriteString(tryPrefix); writer.WriteString(L"catch(const ::vl::Exception&"); if (node->catchStatement) { writer.WriteString(L" "); writer.WriteString(exName); } writer.WriteLine(L")"); writer.WriteString(tryPrefix); writer.WriteLine(L"{"); if (node->catchStatement) { writer.WriteString(bodyPrefix); writer.WriteString(L"auto "); writer.WriteString(config->ConvertName(node->name.value)); writer.WriteString(L" = ::vl::reflection::description::IValueException::Create("); writer.WriteString(exName); writer.WriteLine(L".Message());"); GenerateStatement(config, functionRecord, writer, node->catchStatement, bodyPrefix, WString(L"\t", false), returnType); } writer.WriteString(tryPrefix); writer.WriteLine(L"}"); if (node->finallyStatement) { writer.WriteString(prefix); writer.WriteLine(L"}"); } } void Visit(WfBlockStatement* node)override { writer.WriteString(prefixBlock); writer.WriteLine(L"{"); auto oldPrefix = prefix; if (node->endLabel.value != L"") { auto name = config->ConvertName(node->endLabel.value, L"__vwsnl_" + itow(functionRecord->labelCounter++) + L"_"); functionRecord->labelNames.Add(node->endLabel.value, name); writer.WriteString(prefixBlock); writer.WriteLine(L"\t{"); prefix += L"\t"; } FOREACH(Ptr<WfStatement>, statement, node->statements) { statement = SearchUntilNonVirtualStatement(statement); if (statement.Cast<WfBlockStatement>()) { Call(statement); } else { Call(statement, WString::Empty); } } if (node->endLabel.value != L"") { prefix = oldPrefix; writer.WriteString(prefixBlock); writer.WriteLine(L"\t}"); writer.WriteString(prefixBlock); writer.WriteString(L"\t"); writer.WriteString(functionRecord->labelNames[node->endLabel.value]); writer.WriteLine(L":;"); functionRecord->labelNames.Remove(node->endLabel.value); } writer.WriteString(prefixBlock); writer.WriteLine(L"}"); } void Visit(WfGotoStatement* node)override { writer.WriteString(prefix); writer.WriteString(L"goto "); writer.WriteString(functionRecord->labelNames[node->label.value]); writer.WriteLine(L";"); } void Visit(WfExpressionStatement* node)override { writer.WriteString(prefix); GenerateExpression(config, writer, node->expression, nullptr, false); writer.WriteLine(L";"); } void Visit(WfVariableStatement* node)override { auto scope = config->manager->nodeScopes[node->variable.Obj()]; auto symbol = scope->symbols[node->variable->name.value][0].Obj(); writer.WriteString(prefix); if (node->variable->expression) { writer.WriteString(L"auto"); } else { writer.WriteString(config->ConvertType(symbol->typeInfo.Obj())); } writer.WriteString(L" "); writer.WriteString(config->ConvertName(node->variable->name.value)); if (node->variable->expression) { writer.WriteString(L" = "); GenerateExpression(config, writer, node->variable->expression, symbol->typeInfo.Obj()); } writer.WriteLine(L";"); } void Visit(WfVirtualCseStatement* node)override { node->expandedStatement->Accept(this); } void Visit(WfCoroutineStatement* node)override { CHECK_FAIL(L"WfGenerateStatementVisitor::Visit(WfCoroutineStatement*)#Internal error, All coroutine statements do not generate C++ code."); } void Visit(WfStateMachineStatement* node)override { CHECK_FAIL(L"WfGenerateStatementVisitor::Visit(WfStateMachineStatement*)#Internal error, All state machine statements do not generate C++ code."); } }; void GenerateStatement(WfCppConfig* config, Ptr<FunctionRecord> functionRecord, stream::StreamWriter& writer, Ptr<WfStatement> node, const WString& prefix, const WString& prefixDelta, reflection::description::ITypeInfo* returnType) { WfGenerateStatementVisitor visitor(config, functionRecord, writer, prefix, prefix + prefixDelta, returnType); node->Accept(&visitor); } } } }
30.306991
234
0.64497
vczh2
2642754770705bde48bb61534d60f348c5bdcede
4,290
cpp
C++
AudioDataTag.cpp
luotuo44/FlvExploere
daf15700ec2ab0114d13352d3d395ecd99851720
[ "BSD-3-Clause" ]
1
2019-12-30T03:55:14.000Z
2019-12-30T03:55:14.000Z
AudioDataTag.cpp
luotuo44/FlvExploere
daf15700ec2ab0114d13352d3d395ecd99851720
[ "BSD-3-Clause" ]
null
null
null
AudioDataTag.cpp
luotuo44/FlvExploere
daf15700ec2ab0114d13352d3d395ecd99851720
[ "BSD-3-Clause" ]
null
null
null
//Author: luotuo44@gmail.com //Use of this source code is governed by a BSD-style license #include"AudioDataTag.h" #include<assert.h> #include<fstream> #include<iostream> #include<vector> #include<string> #include"helper.h" using uchar = unsigned char; namespace FLV { AudioDataTag::AudioDataTag(std::ifstream &in) : m_in(in) { } void AudioDataTag::parse() { parseHeader(); parseBody(); parseTailer(); } //从第二个字节开始,第一个字节已经被client读取,用于确定是何种tag void AudioDataTag::parseHeader() { readTagHeader(); m_start_count_read_bytes = true; } void AudioDataTag::parseBody() { readTagData(); } void AudioDataTag::parseTailer() { readPreTagSize(); } std::vector<std::vector<std::string>> AudioDataTag::getPrintTable()const { std::vector<std::vector<std::string>> vec = { {"ts", "codec type", "sample rate", "sample depth", "sound type", "tag data len"}, {std::to_string(m_tag_ts), codecTypeString(), sampleRateTypeString(), sampleDepthTypeString(), soundTypeString(), std::to_string(m_tag_data_len)} }; return vec; } void AudioDataTag::print(std::ostream &os, const std::string &prefix, const std::string &suffix) { os<<prefix<<"ts = "<<m_tag_ts<<"\tcodec type "<<codecTypeString()<<"\tsample rate = "<<sampleRateTypeString() <<"\tsample depth = "<<sampleDepthTypeString()<<"\tsound type ="<<soundTypeString()<<suffix; } std::string AudioDataTag::codecTypeString()const { static std::string codec_type_str[] = { "unknown", "Linear PCM, platform endian", "ADPCM", "MP3", "Linear PCM, little endian", "Nellymoser 16 kHz mono", "Nellymoser 8 kHz mono", "Nellymoser", "G.711 A-law logarithmic PCM", "G.711 mu-law logarithmic PCM", "reserved", "AAC", "Speex", "None",//12 undefined "None",//13 undefined "MP3 8 KHz", "Device-specific sound" }; return codec_type_str[m_codec_type + 1]; } std::string AudioDataTag::sampleRateTypeString()const { static std::string sample_rate_str[] = { "unknown", "5.5 kHz", "11 kHz", "22 kHz", "44 kHz" }; return sample_rate_str[m_sample_rate_type + 1]; } std::string AudioDataTag::sampleDepthTypeString()const { static std::string sample_depth_str[] = { "unknown", "8-bit samples", "16-bit samples" }; return sample_depth_str[m_sample_depth_type + 1]; } std::string AudioDataTag::soundTypeString()const { static std::string sound_type_str[] = { "unknown", "Mono sound", "Stereo sound" }; return sound_type_str[m_sound_type + 1]; } //======================================================================================= void AudioDataTag::readBytes(char *arr, size_t bytes) { m_in.read(arr, bytes); if( m_start_count_read_bytes ) m_read_bytes += bytes; } size_t AudioDataTag::readInt(size_t bytes) { if( bytes == 0) return 0; std::vector<uchar> vec(bytes); readBytes(vec.data(), bytes); size_t val = Helper::getSizeValue(vec); return val; } //从第二个字节开始,第一个字节已经被client读取,用于确定是何种tag void AudioDataTag::readTagHeader() { //读取tag data 长度 m_tag_data_len = readInt(3); //读取tag 时间戳 std::vector<uchar> ts(4); readBytes(ts.data()+1, 3); readBytes(ts.data(), 1); m_tag_ts = Helper::getSizeValue(ts); //读取stream id std::vector<uchar> stream_id(3); readBytes(stream_id.data(), stream_id.size()); } void AudioDataTag::readAudioHeader() { char ch; readBytes(&ch, 1); parseMetaData(ch); if( m_codec_type == 10)//AAC { //需要继续读取 } } void AudioDataTag::readTagData() { readAudioHeader(); m_in.seekg(m_tag_data_len-m_read_bytes, std::ios_base::cur); } void AudioDataTag::readPreTagSize() { size_t prev_tag_size = readInt(4); assert(prev_tag_size == m_tag_data_len + 11); (void)prev_tag_size; } void AudioDataTag::parseMetaData(char ch) { m_codec_type = Helper::getNBits<4>(ch, 4); m_sample_rate_type = Helper::getNBits<2>(ch, 2); m_sample_depth_type = Helper::getNBits<1>(ch, 1); m_sound_type = Helper::getNBits<1>(ch, 0); } }
18.177966
153
0.617016
luotuo44
2654b5e3efc5be1d0082f933405667a1ae294b99
1,394
cpp
C++
Engine/Buffer.cpp
vazgriz/VoxelGame
28b85445dc64606aecd840c977fb0557008e37a0
[ "MIT" ]
49
2020-02-12T21:09:07.000Z
2021-11-19T00:43:55.000Z
Engine/Buffer.cpp
vazgriz/VoxelGame
28b85445dc64606aecd840c977fb0557008e37a0
[ "MIT" ]
3
2020-08-11T14:36:00.000Z
2020-08-17T08:50:11.000Z
Engine/Buffer.cpp
vazgriz/VoxelGame
28b85445dc64606aecd840c977fb0557008e37a0
[ "MIT" ]
4
2020-02-18T08:55:16.000Z
2021-05-13T01:50:37.000Z
#include "Engine/Buffer.h" using namespace VoxelEngine; BufferState::BufferState(Engine* engine, vk::Buffer&& buffer, VmaAllocation allocation) : buffer(std::move(buffer)) { this->engine = engine; this->allocation = allocation; } BufferState::BufferState(BufferState&& other) : buffer(std::move(other.buffer)) { engine = other.engine; allocation = other.allocation; other.allocation = {}; } BufferState& BufferState::operator = (BufferState&& other) { engine = other.engine; allocation = other.allocation; other.allocation = VK_NULL_HANDLE; return *this; } BufferState::~BufferState() { vmaFreeMemory(engine->getGraphics().memory().allocator(), allocation); } Buffer::Buffer(Engine& engine, const vk::BufferCreateInfo& info, const VmaAllocationCreateInfo& allocInfo) { m_engine = &engine; VmaAllocator allocator = engine.getGraphics().memory().allocator(); info.marshal(); VkBuffer buffer; VmaAllocation allocation; vmaCreateBuffer(allocator, info.getInfo(), &allocInfo, &buffer, &allocation, &m_allocationInfo); m_bufferState = std::make_unique<BufferState>(m_engine, vk::Buffer(engine.getGraphics().device(), buffer, true, &info), allocation); } Buffer::~Buffer() { m_engine->renderGraph().queueDestroy(std::move(*m_bufferState)); } void* Buffer::getMapping() const { return m_allocationInfo.pMappedData; }
30.304348
135
0.716643
vazgriz
26590ee46fa324305d9056a31b982b5229718cb6
2,512
cc
C++
examples/hough_extruder_main.cc
WLChopSticks/vpp
2e17b21c56680bcfa94292ef5117f73572bf277d
[ "MIT" ]
624
2015-01-05T16:40:41.000Z
2022-03-01T03:09:43.000Z
examples/hough_extruder_main.cc
WLChopSticks/vpp
2e17b21c56680bcfa94292ef5117f73572bf277d
[ "MIT" ]
10
2015-01-22T20:50:13.000Z
2018-05-15T10:41:34.000Z
examples/hough_extruder_main.cc
WLChopSticks/vpp
2e17b21c56680bcfa94292ef5117f73572bf277d
[ "MIT" ]
113
2015-01-19T11:58:35.000Z
2022-03-28T05:15:20.000Z
#include <iostream> #include <time.h> #include "hough_extruder_example.hh" #include <chrono> using namespace std; using namespace Eigen; using namespace cv; using namespace vpp; using namespace std::chrono; int main(int argc, char *argv[]) { // Start the computation of the time used by the function to compute high_resolution_clock::time_point t1 = high_resolution_clock::now(); /** * @brief fast_dht_matching * This function allows to perform fast dense one-to-one Hough Transform * The fisrt parameter represents the type media you want to use. you can use either an image or a video * The second parameter represents the value of theta you want to use. This parameter defines the height of the array accumulator * The third parameter represents the scaling which will be used for rho. This parameter can be used to reduced the size of the accumulator * The parameter Type_video_hough represents the way the user wants to use after the tracking * The parameter Type_Lines defines the way we describe lines. A line can be described by polar coordinates , the list of all points forming this lines , by the extremities of this lines * The parameter With_Kalman_Filter represents the facts if the user wants to use kalman filter to perform prediction * The parameter With_Transparency represents the way the user wants to print the trajectories with transpenrcy * The parameter With_Entries represents the fact if the user wants the tracking to be performed with entries */ fast_dht_matching(dense_ht,Theta_max::SMALL, Sclare_rho::SAME, Type_video_hough::ALL_POINTS, Type_output::ORIGINAL_VIDEO, Type_Lines::ONLY_POLAR, Frequence::ALL_FRAME, With_Kalman_Filter::NO, With_Transparency::YES, With_Entries::YES, _rayon_exclusion_theta = 15, _rayon_exclusion_rho = 12, _slot_hough = 1, _link_of_video_image = "m.png", _acc_threshold = 100, _m_first_lines = 5, _max_trajectory_length = 5, _nombre_max_frame_without_update =5);/**/ high_resolution_clock::time_point t2 = high_resolution_clock::now(); auto duration = duration_cast<microseconds>( t2 - t1 ).count(); //Show the time used to compute cout << "la duree " << duration << endl ; return 0; }
47.396226
190
0.678742
WLChopSticks
265e672da87c5a8a88e40c9ae7d868741a0f41d6
2,246
hpp
C++
include/ipmi_to_redfish_hooks.hpp
tohas1986/intel-ipmi-oem
ca99ef5912b9296e09c8f9cb246ce291f9970750
[ "Apache-2.0" ]
null
null
null
include/ipmi_to_redfish_hooks.hpp
tohas1986/intel-ipmi-oem
ca99ef5912b9296e09c8f9cb246ce291f9970750
[ "Apache-2.0" ]
null
null
null
include/ipmi_to_redfish_hooks.hpp
tohas1986/intel-ipmi-oem
ca99ef5912b9296e09c8f9cb246ce291f9970750
[ "Apache-2.0" ]
null
null
null
/* // Copyright (c) 2019 Intel Corporation // // 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. */ #pragma once #include <storagecommands.hpp> namespace intel_oem::ipmi::sel { bool checkRedfishHooks(uint16_t recordID, uint8_t recordType, uint32_t timestamp, uint16_t generatorID, uint8_t evmRev, uint8_t sensorType, uint8_t sensorNum, uint8_t eventType, uint8_t eventData1, uint8_t eventData2, uint8_t eventData3); bool checkRedfishHooks(uint8_t generatorID, uint8_t evmRev, uint8_t sensorType, uint8_t sensorNum, uint8_t eventType, uint8_t eventData1, uint8_t eventData2, uint8_t eventData3); namespace redfish_hooks { struct SELData { int generatorID; int sensorNum; int eventType; int offset; int eventData2; int eventData3; }; enum class BIOSSensors { memoryRASConfigStatus = 0x02, biosPOSTError = 0x06, intelUPILinkWidthReduced = 0x09, memoryRASModeSelect = 0x12, bootEvent = 0x83, }; enum class BIOSSMISensors { mirroringRedundancyState = 0x01, memoryECCError = 0x02, legacyPCIError = 0x03, pcieFatalError = 0x04, pcieCorrectableError = 0x05, sparingRedundancyState = 0x11, memoryParityError = 0x13, pcieFatalError2 = 0x14, biosRecovery = 0x15, adddcError = 0x20, }; enum class BIOSEventTypes { digitalDiscrete = 0x09, discreteRedundancyStates = 0x0b, sensorSpecificOffset = 0x6f, oemDiscrete0 = 0x70, oemDiscrete1 = 0x71, oemDiscrete6 = 0x76, oemDiscrete7 = 0x77, reservedA0 = 0xa0, reservedF0 = 0xf0, }; } // namespace redfish_hooks } // namespace intel_oem::ipmi::sel
28.43038
80
0.691451
tohas1986
265e76f8f5673089b30487c90c8cee60c9f4dfc2
1,839
cpp
C++
GeeksForGeeks/C Plus Plus/Chocolate_Distribution_Problem.cpp
ankit-sr/Competitive-Programming
3397b313b80a32a47cfe224426a6e9c7cf05dec2
[ "MIT" ]
4
2021-06-19T14:15:34.000Z
2021-06-21T13:53:53.000Z
GeeksForGeeks/C Plus Plus/Chocolate_Distribution_Problem.cpp
ankit-sr/Competitive-Programming
3397b313b80a32a47cfe224426a6e9c7cf05dec2
[ "MIT" ]
2
2021-07-02T12:41:06.000Z
2021-07-12T09:37:50.000Z
GeeksForGeeks/C Plus Plus/Chocolate_Distribution_Problem.cpp
ankit-sr/Competitive-Programming
3397b313b80a32a47cfe224426a6e9c7cf05dec2
[ "MIT" ]
3
2021-06-19T15:19:20.000Z
2021-07-02T17:24:51.000Z
/* Problem Statement: ------------------ Given an array A[ ] of positive integers of size N, where each value represents the number of chocolates in a packet. Each packet can have a variable number of chocolates. There are M students, the task is to distribute chocolate packets among M students such that : 1. Each student gets exactly one packet. 2. The difference between maximum number of chocolates given to a student and minimum number of chocolates given to a student is minimum. Example 1: --------- Input: N = 8, M = 5 A = {3, 4, 1, 9, 56, 7, 9, 12} Output: 6 Explanation: The minimum difference between maximum chocolates and minimum chocolates is 9 - 3 = 6 by choosing following M packets : {3, 4, 9, 7, 9}. Example 2: --------- Input: N = 7, M = 3 A = {7, 3, 2, 4, 9, 12, 56} Output: 2 Explanation: The minimum difference between maximum chocolates and minimum chocolates is 4 - 2 = 2 by choosing following M packets : {3, 2, 4}. Your Task: You don't need to take any input or print anything. Your task is to complete the function findMinDiff() which takes array A[ ], N and M as input parameters and returns the minimum possible difference between maximum number of chocolates given to a student and minimum number of chocolates given to a student. Expected Time Complexity: O(N*Log(N)) Expected Auxiliary Space: O(1) */ // Link --> https://practice.geeksforgeeks.org/problems/chocolate-distribution-problem3825/1 // Code: class Solution { public: long long findMinDiff(vector<long long> a, long long n, long long m) { sort(a.begin(), a.end()); long long minDifference = INT_MAX; for(long long i=0 ; i<(n-m+1) ; i++) { if(abs(a[i] - a[i+m-1]) < minDifference) minDifference = abs(a[i] - a[i+m-1]); } return minDifference; } };
36.78
172
0.677542
ankit-sr
265eb2b49680b8932ba23fad9cf73db463c4dc83
7,490
cpp
C++
Path planning visualizer/src/Grid.cpp
wholol/graph-visualizer
d63b20b9b6846ec86face6db131eca56c030f280
[ "MIT" ]
4
2020-10-02T14:34:43.000Z
2021-11-15T11:42:20.000Z
Path planning visualizer/src/Grid.cpp
wholol/graph-visualizer
d63b20b9b6846ec86face6db131eca56c030f280
[ "MIT" ]
null
null
null
Path planning visualizer/src/Grid.cpp
wholol/graph-visualizer
d63b20b9b6846ec86face6db131eca56c030f280
[ "MIT" ]
1
2021-07-09T09:32:26.000Z
2021-07-09T09:32:26.000Z
#include "Grid.h" #include <iostream> #include <thread> Grid::Grid(int screenwidth, int screenheight, const sf::Mouse& mouse, sf::RenderWindow& createwindow) :screenwidth(screenwidth), screenheight(screenheight), mouse(mouse), createwindow(createwindow) { /*compute Number of Tiles*/ NumTilesX = screenwidth / TileDimension; NumTilesY = screenheight / TileDimension; /* initialize default src and targ et pos*/ srcpos = { 0 ,0 }; targetpos = { NumTilesX - 1 , NumTilesY - 1 }; for (int i = 0; i < NumTilesX * NumTilesY; ++i) { //initialize all tile objects TileMap.emplace_back(sf::Vector2f(TileDimension, TileDimension)); //costruct dimensions } for (int x = 0; x < NumTilesX; ++x) { for (int y = 0; y < NumTilesY; ++y) { TileMap[x * NumTilesX + y].setPosition(sf::Vector2f(x * TileDimension, y * TileDimension)); TileMap[x * NumTilesX + y].setFillColor(openTileColour); TileMap[x * NumTilesX + y].setOutlineColor(sf::Color::Black); TileMap[x * NumTilesX + y].setOutlineThickness(-OutlineThickness); } } /* colour src and target pos*/ TileMap[srcpos.posx * NumTilesX + srcpos.posy].setFillColor(srcTileColour); TileMap[targetpos.posx * NumTilesX + targetpos.posy].setFillColor(targetTileColour); } void Grid::drawGrid() { for (const auto& Tiles : TileMap) { createwindow.draw(Tiles); } //draw tiles } void Grid::drawPath() { if (vertices.size() > 0) { createwindow.draw(&vertices[0], vertices.size(), sf::Lines); } } void Grid::setObstacle() { int mouseposx = mouse.getPosition(createwindow).x; int mouseposy = mouse.getPosition(createwindow).y; int x = (int)(mouseposx / TileDimension); //scale mouse coodinates int y = (int)(mouseposy / TileDimension); //scale mouse coordinats if (outofBounds(x, y)) { return; } Location mouseloc = { x , y }; //cache mouse location of the grid //reset obstacle colour to open colour if (getTileColor(mouseloc) == obstacleTileColour) { setTileColor(mouseloc, openTileColour); Obstacles.erase(std::remove(Obstacles.begin(), Obstacles.end(), mouseloc), Obstacles.end()); return; } if (getTileColor(mouseloc) == srcTileColour) { //do not set obstacle for src colour return; } if (getTileColor(mouseloc) == targetTileColour) { //do not set obstacle for colourd tile return; } setTileColor(mouseloc, obstacleTileColour); //set the tile colour Obstacles.emplace_back(mouseloc); } void Grid::setTarget() { int mouseposx = mouse.getPosition(createwindow).x; int mouseposy = mouse.getPosition(createwindow).y; int x = (int)(mouseposx / TileDimension); int y = (int)(mouseposy / TileDimension); if (outofBounds(x, y)) { return; } Location prevTargetLoc; //cache the previous Target location Location mouseLoc = { x , y }; if (getTileColor(mouseLoc) == targetTileColour) { changingTargetPos = true; //set putting source position to true prevTargetLoc = { x , y }; } while (changingTargetPos) { //while the user is tryig to change the position of the source. int mouseposx = mouse.getPosition(createwindow).x; int mouseposy = mouse.getPosition(createwindow).y; int x = (int)(mouseposx / TileDimension); int y = (int)(mouseposy / TileDimension); Location newTargetLoc = { x , y }; //keep polling for new target location if (sf::Keyboard::isKeyPressed(sf::Keyboard::Enter)) { if (getTileColor(newTargetLoc) == obstacleTileColour) { //if tile is obstacle, continue continue; } if (getTileColor(newTargetLoc) == srcTileColour) { //if user chooses target tile changingSrcPos = false; //do not let changing target pos be true if user is trying to chang src pos. continue; } if (getTileColor(newTargetLoc) == openTileColour) { //if the new target tile is open setTileColor(newTargetLoc, targetTileColour); //set the tile colour updateTargetPos(newTargetLoc); //update the target position. setTileColor(prevTargetLoc, openTileColour); //set the tile colour of the old target position to open changingTargetPos = false; break; } } } } void Grid::setSource() { int mouseposx = mouse.getPosition(createwindow).x; int mouseposy = mouse.getPosition(createwindow).y; int x = (int)(mouseposx / TileDimension); int y = (int)(mouseposy / TileDimension); if (outofBounds(x, y)) { return; } Location prevSrcLoc; //cache the previous source location Location mouseLoc = { x , y }; if (getTileColor(mouseLoc) == srcTileColour) { changingSrcPos = true; //set putting source position to true prevSrcLoc = { x , y }; } while (changingSrcPos) { //while the user is tryig to change the position of the source. int mouseposx = mouse.getPosition(createwindow).x; int mouseposy = mouse.getPosition(createwindow).y; int x = (int)(mouseposx / TileDimension); int y = (int)(mouseposy / TileDimension); Location newSrcLoc = { x , y }; if (sf::Keyboard::isKeyPressed(sf::Keyboard::Enter)) { if (getTileColor(newSrcLoc) == obstacleTileColour) { continue; } if (getTileColor(newSrcLoc) == targetTileColour) { //if user chooses target tile changingTargetPos = false; //do not let changing target pos be true if user is trying to chang src pos. continue; } if (getTileColor(newSrcLoc) == openTileColour) { //if the new src tile is open setTileColor(newSrcLoc, srcTileColour); //set the tile colour updateSrcPos(newSrcLoc); //update the source position. setTileColor(prevSrcLoc, openTileColour); //set the tile colour of the old src position to open changingSrcPos = false; break; } } } } void Grid::ColourVisitedTile(const Location& loc) { if (loc == srcpos || loc == targetpos) return; //do not recolour srcpos setTileColor(loc, visitedTileColour); } void Grid::ColourVisitingTile(const Location& loc) { if (loc == srcpos || loc == targetpos) return; //do not recolour target pos setTileColor(loc, visitngTileColour); } void Grid::ColourPathTile(const Location& loc_1 , const Location& loc_2) { vertices.push_back(sf::Vertex(sf::Vector2f(loc_1.posx * TileDimension + (TileDimension / 2), loc_1.posy * TileDimension + (TileDimension / 2)))); vertices.push_back(sf::Vertex(sf::Vector2f(loc_2.posx * TileDimension + (TileDimension / 2), loc_2.posy * TileDimension + (TileDimension / 2)))); } void Grid::resetGrid() { for (auto& tile : TileMap) { if (tile.getFillColor() == obstacleTileColour) { continue; } tile.setFillColor(openTileColour); } setTileColor(srcpos, srcTileColour); setTileColor(targetpos, targetTileColour); vertices.clear(); } std::vector<Location> Grid::getObstacleLocation() const { return Obstacles; } std::tuple<int, int> Grid::getTileNums() const { return std::make_tuple(NumTilesX, NumTilesY); } Location Grid::getTargetPos() const { return targetpos; } Location Grid::getSrcPos() const { return srcpos; } void Grid::updateSrcPos(const Location& loc) { srcpos.posx = loc.posx; srcpos.posy = loc.posy; } void Grid::updateTargetPos(const Location& loc) { targetpos.posx = loc.posx; targetpos.posy = loc.posy; } sf::Color Grid::getTileColor(const Location& loc) const { return TileMap[loc.posx * NumTilesX + loc.posy].getFillColor(); } void Grid::setTileColor(const Location& loc ,const sf::Color& color) { TileMap[loc.posx * NumTilesX + loc.posy].setFillColor(color); } bool Grid::outofBounds(int x, int y) { if (x < 0 || y < 0 || x >= screenwidth || y >= screenheight) { //bound check return true; } return false; }
27.947761
146
0.702403
wholol
265fe908e1cdd09ce0559bedcb32a0d19133feb5
121
cpp
C++
test/NoiseGenerator_test.cpp
leiz86/staircase_code_simulator
bba297c1c1fbb4921855b0e4f43afb505c1235fa
[ "Apache-2.0" ]
null
null
null
test/NoiseGenerator_test.cpp
leiz86/staircase_code_simulator
bba297c1c1fbb4921855b0e4f43afb505c1235fa
[ "Apache-2.0" ]
null
null
null
test/NoiseGenerator_test.cpp
leiz86/staircase_code_simulator
bba297c1c1fbb4921855b0e4f43afb505c1235fa
[ "Apache-2.0" ]
null
null
null
/* * NoiseGenerator_test.cpp * * Created on: Nov 26, 2017 * Author: leizhang */ #include <NoiseGenerator.h>
12.1
28
0.628099
leiz86