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
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d3759e3a804dce73d189f0e9dda534bb93ff88c0
| 1,609
|
cpp
|
C++
|
day20/load.cpp
|
bcafuk/AoC-2019
|
5ff9b86f8483cd7a6e229d572ae9e34b894eb574
|
[
"Zlib"
] | null | null | null |
day20/load.cpp
|
bcafuk/AoC-2019
|
5ff9b86f8483cd7a6e229d572ae9e34b894eb574
|
[
"Zlib"
] | null | null | null |
day20/load.cpp
|
bcafuk/AoC-2019
|
5ff9b86f8483cd7a6e229d572ae9e34b894eb574
|
[
"Zlib"
] | 2
|
2020-11-02T09:24:35.000Z
|
2020-12-02T09:46:27.000Z
|
#include <queue>
#include <string>
#include "day20.hpp"
Maze load(std::istream &stream) {
const std::string startPortal = "AA";
const std::string endPortal = "ZZ";
Maze maze{0, 0};
while (true) {
std::string line;
std::getline(stream, line);
if (stream.eof()) {
break;
}
maze.m_width = line.size();
++maze.m_height;
maze.m_grid.insert(maze.m_grid.end(), line.begin(), line.end());
}
std::map<std::string, Position> portals;
auto link = [&portals, &maze](const std::string &name, Position pos) {
auto it = portals.find(name);
if (it == portals.end()) {
portals.insert({name, pos});
} else {
maze.m_portals.insert({it->second, pos});
maze.m_portals.insert({pos, it->second});
portals.erase(it);
}
};
for (int y = 0; y < maze.m_height; ++y) {
for (int x = 0; x < maze.m_width; ++x) {
if (maze(x, y) >= 'A' && maze(x, y) <= 'Z') {
std::string portalName;
portalName += maze(x, y);
if (maze(x + 1, y) >= 'A' && maze(x + 1, y) <= 'Z') {
portalName += maze(x + 1, y);
if (maze(x + 2, y) == '.') {
link(portalName, {x + 2, y, 0});
} else if (maze(x - 1, y) == '.') {
link(portalName, {x - 1, y, 0});
}
} else if (maze(x, y + 1) >= 'A' && maze(x, y + 1) <= 'Z') {
portalName += maze(x, y + 1);
if (maze(x, y + 2) == '.') {
link(portalName, {x, y + 2, 0});
} else if (maze(x, y - 1) == '.') {
link(portalName, {x, y - 1, 0});
}
}
}
}
}
maze.m_start = portals[startPortal];
maze.m_start.z = 0;
maze.m_end = portals[endPortal];
maze.m_end.z = 0;
return maze;
}
| 22.347222
| 71
| 0.523928
|
bcafuk
|
c9667a0dfb661760eb362e1b4134f00986ebabc3
| 493
|
hpp
|
C++
|
libs/options/include/fcppt/options/parse_error.hpp
|
pmiddend/fcppt
|
9f437acbb10258e6df6982a550213a05815eb2be
|
[
"BSL-1.0"
] | null | null | null |
libs/options/include/fcppt/options/parse_error.hpp
|
pmiddend/fcppt
|
9f437acbb10258e6df6982a550213a05815eb2be
|
[
"BSL-1.0"
] | null | null | null |
libs/options/include/fcppt/options/parse_error.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_OPTIONS_PARSE_ERROR_HPP_INCLUDED
#define FCPPT_OPTIONS_PARSE_ERROR_HPP_INCLUDED
#include <fcppt/options/missing_error.hpp>
#include <fcppt/options/other_error.hpp>
#include <fcppt/options/parse_error_fwd.hpp>
#include <fcppt/variant/variadic.hpp>
#endif
| 29
| 61
| 0.764706
|
pmiddend
|
c96f38806d285844ee4228c89112622d11d5bd62
| 611
|
cpp
|
C++
|
GameState.cpp
|
naiIs/VillainTycoon
|
5eff5197b147419588b4f92b4f292039b2194b43
|
[
"MIT"
] | null | null | null |
GameState.cpp
|
naiIs/VillainTycoon
|
5eff5197b147419588b4f92b4f292039b2194b43
|
[
"MIT"
] | null | null | null |
GameState.cpp
|
naiIs/VillainTycoon
|
5eff5197b147419588b4f92b4f292039b2194b43
|
[
"MIT"
] | null | null | null |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: GameState.cpp
* Author: logan
*
* Created on May 17, 2017, 11:43 AM
*/
#include "GameState.h"
GameState::GameState() {
}
GameState::GameState(const GameState& orig) {
}
GameState::~GameState() {
}
void GameState::init(){
}
void GameState::handleEvents(sf::Event &event, sf::RenderWindow * window){
}
void GameState::update(){
}
void GameState::draw(sf::RenderWindow &window){
}
| 15.666667
| 79
| 0.666121
|
naiIs
|
c9732d53ebfb71b216ad4cff5a536e0895d48f5b
| 1,738
|
hpp
|
C++
|
include/codegen/include/NUnit/Framework/Internal/ParameterizedMethodSuite.hpp
|
Futuremappermydud/Naluluna-Modifier-Quest
|
bfda34370764b275d90324b3879f1a429a10a873
|
[
"MIT"
] | 1
|
2021-11-12T09:29:31.000Z
|
2021-11-12T09:29:31.000Z
|
include/codegen/include/NUnit/Framework/Internal/ParameterizedMethodSuite.hpp
|
Futuremappermydud/Naluluna-Modifier-Quest
|
bfda34370764b275d90324b3879f1a429a10a873
|
[
"MIT"
] | null | null | null |
include/codegen/include/NUnit/Framework/Internal/ParameterizedMethodSuite.hpp
|
Futuremappermydud/Naluluna-Modifier-Quest
|
bfda34370764b275d90324b3879f1a429a10a873
|
[
"MIT"
] | 2
|
2021-10-03T02:14:20.000Z
|
2021-11-12T09:29:36.000Z
|
// Autogenerated from CppHeaderCreator on 7/27/2020 3:09:57 PM
// Created by Sc2ad
// =========================================================================
#pragma once
#pragma pack(push, 8)
// Begin includes
#include "utils/typedefs.h"
// Including type: NUnit.Framework.Internal.TestSuite
#include "NUnit/Framework/Internal/TestSuite.hpp"
#include "utils/il2cpp-utils.hpp"
// Completed includes
// Begin forward declares
// Forward declaring namespace: NUnit::Framework::Interfaces
namespace NUnit::Framework::Interfaces {
// Forward declaring type: IMethodInfo
class IMethodInfo;
}
// Completed forward declares
// Type namespace: NUnit.Framework.Internal
namespace NUnit::Framework::Internal {
// Autogenerated type: NUnit.Framework.Internal.ParameterizedMethodSuite
class ParameterizedMethodSuite : public NUnit::Framework::Internal::TestSuite {
public:
// private System.Boolean _isTheory
// Offset: 0x89
bool isTheory;
// public System.Void .ctor(NUnit.Framework.Interfaces.IMethodInfo method)
// Offset: 0x18D59D8
// Implemented from: NUnit.Framework.Internal.Test
// Base method: System.Void Test::.ctor(NUnit.Framework.Interfaces.IMethodInfo method)
static ParameterizedMethodSuite* New_ctor(NUnit::Framework::Interfaces::IMethodInfo* method);
// public override System.String get_TestType()
// Offset: 0x18D5C6C
// Implemented from: NUnit.Framework.Internal.Test
// Base method: System.String Test::get_TestType()
::Il2CppString* get_TestType();
}; // NUnit.Framework.Internal.ParameterizedMethodSuite
}
DEFINE_IL2CPP_ARG_TYPE(NUnit::Framework::Internal::ParameterizedMethodSuite*, "NUnit.Framework.Internal", "ParameterizedMethodSuite");
#pragma pack(pop)
| 42.390244
| 134
| 0.73015
|
Futuremappermydud
|
c9758ac0087a8ce8566974f46f98e098d40b34fd
| 3,082
|
cpp
|
C++
|
core123/ut/ut_mulhilo.cpp
|
fennm/fs123
|
559b97659352620ce16030824f9acd26f590f4e1
|
[
"BSD-3-Clause"
] | 22
|
2019-04-10T18:05:35.000Z
|
2021-12-30T12:26:39.000Z
|
core123/ut/ut_mulhilo.cpp
|
fennm/fs123
|
559b97659352620ce16030824f9acd26f590f4e1
|
[
"BSD-3-Clause"
] | 13
|
2019-04-09T00:19:29.000Z
|
2021-11-04T15:57:13.000Z
|
core123/ut/ut_mulhilo.cpp
|
fennm/fs123
|
559b97659352620ce16030824f9acd26f590f4e1
|
[
"BSD-3-Clause"
] | 4
|
2019-04-07T16:33:44.000Z
|
2020-07-02T02:58:51.000Z
|
/** @page LICENSE
Copyright 2010-2012, D. E. Shaw Research.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions, and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions, and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of D. E. Shaw Research nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "core123/intutils.hpp"
#include <cassert>
#include <iostream>
#include <typeinfo>
#include <tuple>
#include <random>
using std::uniform_int_distribution;
using std::mt19937;
using core123::mulhilo;
using core123::mulhilo_halfword;
int FAIL = 0;
#define Assert(P) do{ if(!(P)){ std::cerr << "Assertion failed on line " << __LINE__ << ": " #P << std::endl; FAIL++; } } while(0)
//#define BOOST_TEST_MAIN
//#include <boost/test/unit_test.hpp>
#define BOOST_AUTO_TEST_CASE(f) void f()
#define BOOST_CHECK_NE(a, b) Assert(a!=b)
#define BOOST_CHECK_EQUAL(a, b) Assert(a == b)
#define BOOST_CHECK_GE(a, b) Assert(a>=b)
#define BOOST_CHECK_LE(a, b) Assert(a<=b)
#define BOOST_CHECK(expr) Assert(expr)
template <typename UINT>
void doit(){
uniform_int_distribution<UINT> D;
mt19937 mt;
for(int i=0; i<1000000; ++i){
UINT a = D(mt);
UINT b = D(mt);
UINT hi, lo;
std::tie(lo, hi) = mulhilo(a, b);
BOOST_CHECK_EQUAL(lo, (UINT)(a*b) );
// Can't we say something about hi/a and b
// and hi/b and a?
UINT hi_hw, lo_hw;
std::tie(lo_hw, hi_hw) = mulhilo_halfword(a, b);
BOOST_CHECK_EQUAL(lo_hw, lo);
BOOST_CHECK_EQUAL(hi_hw, hi);
//std::cout << a << " * " << b << " = " << hi << "." << lo << "\n";
}
}
BOOST_AUTO_TEST_CASE(test_mulhilo)
{
doit<uint8_t>();
doit<uint16_t>();
doit<uint32_t>();
doit<uint64_t>();
}
int main(int, char **){
test_mulhilo();
std::cout << FAIL << " Failed tests" << std::endl;
return !!FAIL;
}
| 33.868132
| 131
| 0.703764
|
fennm
|
c977a1984f371910059768a0747ce8b1f2296673
| 9,928
|
cpp
|
C++
|
NightEngine2/src/Editor/RenderSettingEditor.cpp
|
rittikornt/NightEngine2
|
14004b48d1708736373010a3fe47d05d876e0baa
|
[
"MIT"
] | 2
|
2020-03-09T06:24:46.000Z
|
2022-02-04T23:09:23.000Z
|
NightEngine2/src/Editor/RenderSettingEditor.cpp
|
rittikornt/NightEngine2
|
14004b48d1708736373010a3fe47d05d876e0baa
|
[
"MIT"
] | null | null | null |
NightEngine2/src/Editor/RenderSettingEditor.cpp
|
rittikornt/NightEngine2
|
14004b48d1708736373010a3fe47d05d876e0baa
|
[
"MIT"
] | 2
|
2020-09-07T03:04:36.000Z
|
2022-02-04T23:09:24.000Z
|
/*!
@file RenderSettingEditor.cpp
@author Rittikorn Tangtrongchit
@brief Contain the Implementation of RenderSettingEditor
*/
#include "Editor/RenderSettingEditor.hpp"
#include "Editor/MemberSerializerEditor.hpp"
#include "Editor/GameObjectHierarchy.hpp"
#include "Editor/ConfirmationBox.hpp"
#include "imgui/imgui.h"
#include "NightEngine2.hpp"
#include "Core/EC/GameObject.hpp"
#include "Core/EC/ArchetypeManager.hpp"
#include "Core/EC/SceneManager.hpp"
#include "Core/Reflection/ReflectionMacros.hpp"
#include "Graphics/Opengl/Window.hpp"
#include "Graphics/Opengl/Postprocess/PostProcessSetting.hpp"
#include "Graphics/IRenderLoop.hpp"
#include "Graphics/RenderLoopOpengl.hpp"
using namespace NightEngine;
using namespace NightEngine::EC;
using namespace NightEngine::Rendering::Opengl::Postprocess;
using namespace NightEngine::Rendering::Opengl;
using namespace NightEngine::Rendering;
using namespace Reflection;
namespace Editor
{
static ImVec4 g_color_blue = ImVec4(0.165f, 0.6f, 1.0f, 1.0f);
static ImVec4 g_color_orange_dark = ImVec4(0.96, 0.68f, 0.05f, 1.0f);
static ImVec4 g_color_orange_light = ImVec4(0.96, 0.86f, 0.05f, 1.0f);
static ImVec4 g_color_green = ImVec4(0.165f, 0.86f, 0.33f, 1.0f);
//Confirmation Box
static ConfirmationBox g_confirmBox{ ConfirmationBox::WindowType::Popup };
static std::string g_confirmBoxDesc{ "" };
//Component/GameObject Editor Shared States
static PostProcessSetting* g_postprocessSetting;
void RenderSettingEditor::Update(MemberSerializerEditor& memberSerializer)
{
if (m_show)
{
Draw(&m_show, memberSerializer);
}
g_confirmBox.Update();
}
void RenderSettingEditor::Draw(bool* show, MemberSerializerEditor& memberSerializer)
{
g_postprocessSetting = &(SceneManager::GetPostProcessSetting());
float width = 310.0f;
float height = Window::GetHeight() * 0.5f;
float topMenuHeight = 20.0f;
ImGui::SetNextWindowPos(ImVec2(10, topMenuHeight + height), ImGuiCond_Appearing);
ImGui::SetNextWindowSize(ImVec2(width, height - topMenuHeight), ImGuiCond_Appearing);
//********************************************************
// Window
//********************************************************
if (ImGui::Begin("Render Settings", show
, ImGuiWindowFlags_NoSavedSettings))
{
width = ImGui::GetWindowWidth();
int treeNodeFlag = ImGuiTreeNodeFlags_DefaultOpen;
auto engine = NightEngine::Engine::GetInstance();
auto irenderLoop = engine->GetRenderLoop();
RenderLoopOpengl* rlgl = irenderLoop->GetAPI() == GraphicsAPI::OPENGL ?
static_cast<RenderLoopOpengl*>(irenderLoop) : nullptr;
// Component PostProcessSettingEditor
ImGui::BeginGroup();
{
ImGui::BeginChild("Rendering Settings Headers", ImVec2(0, -ImGui::GetFrameHeightWithSpacing()));
{
//GameObject Property, if not null
if (g_postprocessSetting != nullptr
&& ImGui::CollapsingHeader("PostProcess Settings", treeNodeFlag))
{
auto& postProcessEffects = g_postprocessSetting->GetEffectsMetas();
{
ImGui::TextColored(g_color_orange_light
, "PostProcessEffect Count: ");
ImGui::SameLine();
ImGui::Text("%d", postProcessEffects.size());
}
//All PostProcessEffects
int nameMingle = 0;
Variable tempVar{ METATYPE_FROM_STRING("int"),nullptr };
for (auto& effect : postProcessEffects)
{
//Traverse MetaType's Member
auto metatype = effect->m_metaType;// m_variable.GetMetaType();
auto& typeName = metatype->GetName();
ImGui::Columns(1, "Effect Header");
if (ImGui::CollapsingHeader(typeName.c_str()))
{
ImGui::Checkbox((typeName + " enable").c_str(), &(effect->m_enable));
//Column header
ImGui::Columns(3, "Effect Property");
ImGui::TextColored(g_color_green, "TYPE"); ImGui::NextColumn();
ImGui::TextColored(g_color_green, "NAME"); ImGui::NextColumn();
ImGui::TextColored(g_color_green, "VALUE"); ImGui::NextColumn();
ImGui::Separator();
//Members
auto& members = metatype->GetMembers();
for (auto& member : members)
{
//TYPE
ImGui::TextColored(g_color_blue
, member.GetMetaType()->GetName().c_str());
ImGui::NextColumn();
//Name
ImGui::Text(member.GetName().c_str());
ImGui::NextColumn();
//Value Editor
effect->GetVariable(tempVar);
memberSerializer.DrawMemberEditor(member
, tempVar.GetValue(), std::to_string(nameMingle));
ImGui::NextColumn();
}
}
++nameMingle;
}
//Clear Column
ImGui::Columns(1);
}
ImGui::Separator();
//Debug View ComboBox
if (ImGui::CollapsingHeader("Debug View Settings", treeNodeFlag))
{
ImGui::Indent();
{
static int s_debugViewEnum = 0;
static int s_debugShadowViewEnum = 0;
bool changed = ImGui::Combo("Debug View", &s_debugViewEnum
, k_debugViewStr, (int)NightEngine::Rendering::DebugView::COUNT);
changed |= ImGui::Combo("Shadow Debug View", &s_debugShadowViewEnum
, k_debugShadowViewStr, (int)NightEngine::Rendering::DebugShadowView::COUNT);
static float s_zoom = 1.0f;
if (ImGui::SliderFloat("Zoom", &s_zoom, 1.0f, 10.0f))
{
if (rlgl != nullptr)
{
rlgl->screenZoomScale = s_zoom;
}
}
if (changed)
{
NightEngine::Rendering::DebugView dv = (NightEngine::Rendering::DebugView)s_debugViewEnum;
NightEngine::Rendering::DebugShadowView dsv = (NightEngine::Rendering::DebugShadowView)s_debugShadowViewEnum;
engine->GetRenderLoop()->SetDebugViews(dv, dsv);
}
}
ImGui::Unindent();
}
if (rlgl != nullptr)
{
if (ImGui::CollapsingHeader("Lighting Settings", treeNodeFlag))
{
ImGui::Indent();
{
static float s_ai_min = 0.0f;
static float s_ai_max = 1.0f;
ImGui::DragScalar("Ambient Intensity", ImGuiDataType_Float
, &(rlgl->ambientStrength), 0.1f, &s_ai_min, &s_ai_max);
static float s_rs_min = 0.1f;
static float s_rs_max = 2.0f;
ImGui::DragScalar("Render Scale", ImGuiDataType_Float
, &(rlgl->m_camera.m_renderScale), 0.1f, &s_rs_min, &s_rs_max);
rlgl->m_camera.m_renderScale = max(rlgl->m_camera.m_renderScale, s_rs_min);
static float s_cfov_min = 10.0f;
static float s_cfov_max = 120.0f;
ImGui::DragScalar("Camera FOV", ImGuiDataType_Float
, &(rlgl->cameraFOV), 0.5f, &s_cfov_min, &s_cfov_max);
static float s_cfp_min = 10.0f;
static float s_cfp_max = 2000.0f;
ImGui::DragScalar("Camera Far Plane", ImGuiDataType_Float
, &(rlgl->cameraFarPlane), 0.5f, &s_cfp_min, &s_cfp_max);
}
ImGui::Unindent();
}
if (ImGui::CollapsingHeader("Shadows Settings", treeNodeFlag))
{
ImGui::Indent();
{
static float s_sf_min = 0.0f;
static float s_sf_max = 1000.0f;
ImGui::DragScalar("Main Shadow Far Plane", ImGuiDataType_Float
, &(rlgl->mainShadowsFarPlane), 0.5f, &s_sf_min, &s_sf_max);
static int s_mscc_min = 0;
static int s_mscc_max = 4;
ImGui::DragScalar("Main Shadow Cascade Count", ImGuiDataType_S32
, &(rlgl->mainShadowscascadeCount), 1.0f, &s_mscc_min, &s_mscc_max);
//Shadows Resolutions
static int s_currentMSItem = 2;
static int s_currentPSItem = 1;
static std::vector <std::string> s_items;
static std::vector <const char*> s_itemsPtr;
static bool s_init = false;
if (!s_init)
{
for (auto res : k_shadowResEnum)
{
std::string rstr = std::to_string((int)res);
s_items.emplace_back(rstr);
}
for (auto& resStr : s_items)
{
s_itemsPtr.emplace_back(resStr.c_str());
}
s_init = true;
}
bool changed = ImGui::Combo("Main Shadow Resolution", &s_currentMSItem
, s_itemsPtr.data(), s_itemsPtr.size());
if (changed)
{
rlgl->mainShadowResolution = k_shadowResEnum[s_currentMSItem];
}
changed = ImGui::Combo("Point Shadow Resolution", &s_currentPSItem
, s_itemsPtr.data(), s_itemsPtr.size());
if (changed)
{
rlgl->mainShadowResolution = k_shadowResEnum[s_currentPSItem];
}
}
ImGui::Unindent();
}
}
}
ImGui::EndChild();
}
ImGui::EndGroup();
}
ImGui::End();
}
}
| 36.907063
| 125
| 0.554795
|
rittikornt
|
c97845305ed19800abe28fceb0845c4431cef6f2
| 620
|
cpp
|
C++
|
competitive_programming/programming_contests/uri/counting_crow.cpp
|
LeandroTk/Algorithms
|
569ed68eba3eeff902f8078992099c28ce4d7cd6
|
[
"MIT"
] | 205
|
2018-12-01T17:49:49.000Z
|
2021-12-22T07:02:27.000Z
|
competitive_programming/programming_contests/uri/counting_crow.cpp
|
LeandroTk/Algorithms
|
569ed68eba3eeff902f8078992099c28ce4d7cd6
|
[
"MIT"
] | 2
|
2020-01-01T16:34:29.000Z
|
2020-04-26T19:11:13.000Z
|
competitive_programming/programming_contests/uri/counting_crow.cpp
|
LeandroTk/Algorithms
|
569ed68eba3eeff902f8078992099c28ce4d7cd6
|
[
"MIT"
] | 50
|
2018-11-28T20:51:36.000Z
|
2021-11-29T04:08:25.000Z
|
// https://www.urionlinejudge.com.br/judge/en/problems/view/1848
#include <iostream>
#include <string>
using namespace std;
int main() {
int scream_counter = 0, blink_counter = 0;
string s;
while (scream_counter < 3) {
cin >> s;
if (s == "caw") {
scream_counter++;
cin >> s;
cout << blink_counter << endl;
blink_counter = 0;
} else {
for (int i = 0; i < 3; i++) {
if (s[i] == '*') {
if (i == 0) blink_counter+= 4;
else if (i == 1) blink_counter+= 2;
else if (i == 2) blink_counter+= 1;
}
}
}
}
return 0;
}
| 18.787879
| 64
| 0.503226
|
LeandroTk
|
c97884cc021e94fc49050e68b8d10bdbee9b74da
| 4,424
|
cpp
|
C++
|
VS/Utils/VS_Menu.cpp
|
vectorstorm/vectorstorm
|
7306214108b23fa97d4a1a598197bbaa52c17d3a
|
[
"Zlib"
] | 19
|
2017-04-03T09:06:21.000Z
|
2022-03-05T19:06:07.000Z
|
VS/Utils/VS_Menu.cpp
|
vectorstorm/vectorstorm
|
7306214108b23fa97d4a1a598197bbaa52c17d3a
|
[
"Zlib"
] | 2
|
2019-05-24T14:40:07.000Z
|
2020-04-15T01:10:23.000Z
|
VS/Utils/VS_Menu.cpp
|
vectorstorm/vectorstorm
|
7306214108b23fa97d4a1a598197bbaa52c17d3a
|
[
"Zlib"
] | 2
|
2020-03-08T07:14:49.000Z
|
2020-03-09T10:39:52.000Z
|
/*
* UT_Menu.cpp
* VectorStorm
*
* Created by Trevor Powell on 29/12/07.
* Copyright 2007 Trevor Powell. All rights reserved.
*
*/
#include "VS_Menu.h"
#include "VS_DisplayList.h"
#include "VS_BuiltInFont.h"
#include "VS_Sprite.h"
#include "Core.h"
#include "CORE_Game.h"
#include "VS_Input.h"
#define PULSE_DURATION (2.0f)
#ifdef VS_DEFAULT_VIRTUAL_CONTROLLER
vsSimpleMenu::vsSimpleMenu(int count, float letterSize, float capSize, float lineSpacing):
vsSprite(NULL),
m_itemLabel(NULL),
m_itemValue(NULL),
m_itemCount(count),
m_highlightedId(0),
m_pulseTimer(0.f),
m_letterSize(letterSize),
m_capSize(capSize),
m_lineSpacing(lineSpacing)
{
m_itemLabel = new vsSprite*[count];
m_itemValue = new vsSprite*[count];
for ( int i = 0; i < count; i++ )
{
m_itemLabel[i] = NULL;
m_itemValue[i] = NULL;
}
}
vsSimpleMenu::~vsSimpleMenu()
{
for ( int i = 0; i < m_itemCount; i++ )
{
if ( m_itemLabel[i] )
{
RemoveChild( m_itemLabel[i] );
vsDelete(m_itemLabel[i]);
}
if ( m_itemValue[i] )
{
RemoveChild( m_itemValue[i] );
vsDelete(m_itemValue[i]);
}
}
vsDeleteArray( m_itemLabel );
vsDeleteArray( m_itemValue );
}
void
vsSimpleMenu::Update(float timeStep)
{
if ( !GetVisible() )
return;
// clear out any actions from the previous frame
m_action.Clear();
vsInput *input = core::GetGame()->GetInput();
if ( input->WasPressed( CID_Down ) || input->WasPressed( CID_LDown ) )
{
m_highlightedId++;
//core::GetGame()->GetSound()->PlaySound(m_tickSound);
if ( m_highlightedId >= m_itemCount )
m_highlightedId = 0;
}
if ( input->WasPressed( CID_Up ) || input->WasPressed( CID_LUp ) )
{
//core::GetGame()->GetSound()->PlaySound(m_tickSound);
m_highlightedId--;
if ( m_highlightedId < 0 )
m_highlightedId = m_itemCount-1;
}
if ( input->WasPressed( CID_Left ) )
m_action.Left(m_highlightedId);
if ( input->WasPressed( CID_Right ) )
m_action.Right(m_highlightedId);
if ( input->WasPressed( CID_A ) )
m_action.Select(m_highlightedId);
else if ( input->WasPressed( CID_B ) )
m_action.Cancel();
m_pulseTimer += timeStep;
if ( m_pulseTimer > PULSE_DURATION )
m_pulseTimer -= PULSE_DURATION;
float frac = m_pulseTimer / PULSE_DURATION;
float pulseAmt = vsCos(TWOPI * frac); // [ -1..1 ]
pulseAmt = (pulseAmt * 0.5f) + 0.5f; // [ 0..1 ]
for ( int i = 0; i < m_itemCount; i++ )
{
if ( m_itemLabel[i] )
{
vsColor c = c_blue;
if ( i == m_highlightedId )
{
vsColor lightBlue(0.5f,0.5f,1.0f,0.8f);
c = vsInterpolate( pulseAmt, lightBlue, c_white );
}
m_itemLabel[i]->SetColor( c );
if ( m_itemValue[i] )
m_itemValue[i]->SetColor( c );
}
}
}
void
vsSimpleMenu::Draw( vsRenderQueue *queue )
{
ArrangeItems();
Parent::Draw(queue);
}
void
vsSimpleMenu::ArrangeItems()
{
int line = 0;
float maxWidth = 0.f;
// first, figure out what our widest label is
for ( int i = 0; i < m_itemCount; i++ )
{
if ( m_itemLabel[i] )
{
float width = m_itemLabel[i]->GetBoundingRadius();
if ( width > maxWidth )
maxWidth = width;
}
}
// now move our items into place, with the values far enough over that they won't overlap any long labels.
for ( int i = 0; i < m_itemCount; i++ )
{
if ( m_itemLabel[i] )
{
vsVector2D pos( 0, line * (m_capSize + m_lineSpacing) );
vsVector2D vpos( maxWidth + 50.f, line * (m_capSize + m_lineSpacing) );
m_itemLabel[i]->SetPosition(pos);
if ( m_itemValue[i] )
m_itemValue[i]->SetPosition(vpos);
line++;
}
}
}
void
vsSimpleMenu::SetItemCount(int count)
{
m_itemCount = count;
}
void
vsSimpleMenu::SetItemLabel( int itemId, const vsString & label )
{
vsAssert(itemId < m_itemCount && itemId >= 0, "itemId out of bounds!");
if ( m_itemLabel[itemId] )
{
RemoveChild( m_itemLabel[itemId] );
delete m_itemLabel[itemId];
}
m_itemLabel[itemId] = new vsSprite(vsBuiltInFont::CreateString(label, m_letterSize, m_capSize));
m_itemLabel[itemId]->SetColor(c_blue);
AddChild( m_itemLabel[itemId] );
}
void
vsSimpleMenu::SetItemValue( int itemId, const vsString & value )
{
vsAssert(itemId < m_itemCount && itemId >= 0, "itemId out of bounds!");
if ( m_itemValue[itemId] )
delete m_itemValue[itemId];
m_itemValue[itemId] = new vsSprite(vsBuiltInFont::CreateString(value, m_letterSize, m_capSize));
m_itemValue[itemId]->SetColor(c_blue);
AddChild( m_itemValue[itemId] );
}
#endif // VS_DEFAULT_VIRTUAL_CONTROLLER
| 21.371981
| 107
| 0.674503
|
vectorstorm
|
c97f9c9f74a0ec4738878c19343af85506cf9307
| 933
|
cpp
|
C++
|
client/src/responses/RemoveDailyPlanTaskResponseHandler.cpp
|
Hvvang/uTracker
|
f865d969ca7d550ac2d4b20b4fd1f834f90578b2
|
[
"MIT"
] | null | null | null |
client/src/responses/RemoveDailyPlanTaskResponseHandler.cpp
|
Hvvang/uTracker
|
f865d969ca7d550ac2d4b20b4fd1f834f90578b2
|
[
"MIT"
] | null | null | null |
client/src/responses/RemoveDailyPlanTaskResponseHandler.cpp
|
Hvvang/uTracker
|
f865d969ca7d550ac2d4b20b4fd1f834f90578b2
|
[
"MIT"
] | null | null | null |
//
// Created by Artem Shemidko on 18.03.2021.
//
#include "RemoveDailyPlanTaskResponseHandler.h"
#include <QJsonDocument>
#include <QJsonObject>
#include "Client.h"
RemoveDailyPlanTaskResponseHandler::RemoveDailyPlanTaskResponseHandler(QObject *parent)
: AbstractResponseHandler(parent) {
connect(this, &AbstractResponseHandler::removeDailyPlanTask,
this, &RemoveDailyPlanTaskResponseHandler::processResponse);
}
void RemoveDailyPlanTaskResponseHandler::processResponse(const QByteArray &data) {
if (error(data) == AbstractResponseHandler::ResponseErrorType::NotValid) {
qWarning() << "An error occurred: " << handleMessage(data);
emit m_client->notification(handleMessage(data));
}
else {
QJsonDocument itemDoc = QJsonDocument::fromJson(data);
QJsonObject rootObject = itemDoc.object();
m_client->deleteDailyTask(rootObject["taskId"].toInt());
}
}
| 34.555556
| 87
| 0.729904
|
Hvvang
|
c985af7dbc4dd1f4f8e9e7366c70d04336142e6f
| 938
|
cpp
|
C++
|
Source/anchorGrabberSuites.cpp
|
shspage/anchorGrabber_aip
|
bbd335a9fb47e90b142c90768bdccbc1b9446c69
|
[
"MIT"
] | 2
|
2022-03-14T00:04:54.000Z
|
2022-03-14T01:32:39.000Z
|
Source/anchorGrabberSuites.cpp
|
shspage/anchorGrabber_aip
|
bbd335a9fb47e90b142c90768bdccbc1b9446c69
|
[
"MIT"
] | null | null | null |
Source/anchorGrabberSuites.cpp
|
shspage/anchorGrabber_aip
|
bbd335a9fb47e90b142c90768bdccbc1b9446c69
|
[
"MIT"
] | null | null | null |
#include "IllustratorSDK.h"
#include "anchorGrabberSuites.h"
// Suite externs
extern "C"
{
SPBlocksSuite* sSPBlocks = NULL;
AIUnicodeStringSuite* sAIUnicodeString = NULL;
AIToolSuite* sAITool = nullptr;
AIArtSuite* sAIArt = NULL;
AIPathSuite* sAIPath = NULL;
AIHitTestSuite* sAIHitTest = NULL;
AIDocumentViewSuite* sAIDocumentView = NULL;
AIMatchingArtSuite* sAIMatchingArt = NULL;
}
// Import suites
ImportSuite gImportSuites[] =
{
kSPBlocksSuite, kSPBlocksSuiteVersion, &sSPBlocks,
kAIUnicodeStringSuite, kAIUnicodeStringVersion, &sAIUnicodeString,
kAIToolSuite, kAIToolVersion, &sAITool,
kAIArtSuite, kAIArtSuiteVersion, &sAIArt,
kAIPathSuite, kAIPathSuiteVersion, &sAIPath,
kAIHitTestSuite, kAIHitTestSuiteVersion, &sAIHitTest,
kAIDocumentViewSuite, kAIDocumentViewSuiteVersion, &sAIDocumentView,
kAIMatchingArtSuite, kAIMatchingArtSuiteVersion, &sAIMatchingArt,
nil, 0, nil
};
| 31.266667
| 72
| 0.771855
|
shspage
|
c98ce15c8279dbcef4e4315146b23f3cdbc26e93
| 21,525
|
cpp
|
C++
|
Seagull-Core/Core/Source/Text/FontStash.cpp
|
CrystaLamb/SeagullEngine
|
2a4d776ff525dcfef1eb5d8ea53abe3aa2f9a462
|
[
"MIT"
] | 4
|
2021-12-10T10:28:19.000Z
|
2021-12-29T05:39:17.000Z
|
Seagull-Core/Core/Source/Text/FontStash.cpp
|
ILLmew/SeagullEngine
|
2a4d776ff525dcfef1eb5d8ea53abe3aa2f9a462
|
[
"MIT"
] | null | null | null |
Seagull-Core/Core/Source/Text/FontStash.cpp
|
ILLmew/SeagullEngine
|
2a4d776ff525dcfef1eb5d8ea53abe3aa2f9a462
|
[
"MIT"
] | null | null | null |
#include "FontStash.h"
#define FONTSTASH_IMPLEMENTATION
#ifdef SG_PLATFORM_WINDOWS
#include <windows.h>
#endif
#include <include/fontstash.h>
#include "include/IRenderer.h"
#include "include/IResourceLoader.h"
#include "Interface/IFileSystem.h"
#include <include/tinyimageformat_query.h>
#include <include/EASTL/vector.h>
#include <include/EASTL/string.h>
#include "Interface/IMemory.h"
namespace SG
{
typedef struct GPURingBuffer
{
Renderer* pRenderer;
Buffer* pBuffer;
uint32_t bufferAlignment;
uint64_t maxBufferSize;
uint64_t currentBufferOffset;
} GPURingBuffer;
typedef struct GPURingBufferOffset
{
Buffer* pBuffer;
uint64_t offset;
} GPURingBufferOffset;
static inline uint32_t round_up(uint32_t value, uint32_t multiple) { return ((value + multiple - 1) / multiple) * multiple; }
static inline void add_gpu_ring_buffer(Renderer* pRenderer, const BufferCreateDesc* pBufferDesc, GPURingBuffer** ppRingBuffer)
{
GPURingBuffer* pRingBuffer = (GPURingBuffer*)sg_calloc(1, sizeof(GPURingBuffer));
pRingBuffer->pRenderer = pRenderer;
pRingBuffer->maxBufferSize = pBufferDesc->size;
pRingBuffer->bufferAlignment = sizeof(float[4]);
BufferLoadDesc loadDesc = {};
loadDesc.desc = *pBufferDesc;
loadDesc.ppBuffer = &pRingBuffer->pBuffer;
add_resource(&loadDesc, nullptr);
*ppRingBuffer = pRingBuffer;
}
static inline void add_uniform_gpu_ring_buffer(Renderer* pRenderer, uint32_t requiredUniformBufferSize, GPURingBuffer** ppRingBuffer, bool const ownMemory = false, ResourceMemoryUsage memoryUsage = SG_RESOURCE_MEMORY_USAGE_CPU_TO_GPU)
{
GPURingBuffer* pRingBuffer = (GPURingBuffer*)sg_calloc(1, sizeof(GPURingBuffer));
pRingBuffer->pRenderer = pRenderer;
const uint32_t uniformBufferAlignment = (uint32_t)pRenderer->pActiveGpuSettings->uniformBufferAlignment;
const uint32_t maxUniformBufferSize = requiredUniformBufferSize;
pRingBuffer->bufferAlignment = uniformBufferAlignment;
pRingBuffer->maxBufferSize = maxUniformBufferSize;
BufferCreateDesc ubDesc = {};
#if defined(SG_GRAPHIC_API_D3D11)
ubDesc.memoryUsage = SG_RESOURCE_MEMORY_USAGE_CPU_ONLY;
ubDesc.flags = SG_BUFFER_CREATION_FLAG_NO_DESCRIPTOR_VIEW_CREATION;
#else
ubDesc.descriptors = SG_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
ubDesc.memoryUsage = memoryUsage;
ubDesc.flags = (ubDesc.memoryUsage != SG_RESOURCE_MEMORY_USAGE_GPU_ONLY ? SG_BUFFER_CREATION_FLAG_PERSISTENT_MAP_BIT : SG_BUFFER_CREATION_FLAG_NONE) |
SG_BUFFER_CREATION_FLAG_NO_DESCRIPTOR_VIEW_CREATION;
#endif
if (ownMemory)
ubDesc.flags |= SG_BUFFER_CREATION_FLAG_OWN_MEMORY_BIT;
ubDesc.size = maxUniformBufferSize;
BufferLoadDesc loadDesc = {};
loadDesc.desc = ubDesc;
loadDesc.ppBuffer = &pRingBuffer->pBuffer;
add_resource(&loadDesc, nullptr);
*ppRingBuffer = pRingBuffer;
}
static inline void remove_gpu_ring_buffer(GPURingBuffer* pRingBuffer)
{
remove_resource(pRingBuffer->pBuffer);
sg_free(pRingBuffer);
}
static inline void reset_gpu_ring_buffer(GPURingBuffer* pRingBuffer)
{
pRingBuffer->currentBufferOffset = 0;
}
static inline GPURingBufferOffset get_gpu_ring_buffer_offset(GPURingBuffer* pRingBuffer, uint32_t memoryRequirement, uint32_t alignment = 0)
{
uint32_t alignedSize = round_up(memoryRequirement, alignment ? alignment : pRingBuffer->bufferAlignment);
if (alignedSize > pRingBuffer->maxBufferSize)
{
ASSERT(false && "Ring Buffer too small for memory requirement");
return { nullptr, 0 };
}
if (pRingBuffer->currentBufferOffset + alignedSize >= pRingBuffer->maxBufferSize) // exceed the max buffer size bound
{
pRingBuffer->currentBufferOffset = 0;
}
GPURingBufferOffset ret = { pRingBuffer->pBuffer, pRingBuffer->currentBufferOffset };
pRingBuffer->currentBufferOffset += alignedSize;
return ret;
}
class FontStash_Impl
{
public:
FontStash_Impl()
{
pCurrentTexture = {};
width = 0;
height = 0;
pContext = nullptr;
isText3D = false;
}
bool OnInit(Renderer* renderer, int width, int height, uint32_t ringSizeBytes)
{
pRenderer = renderer;
// create image for font atlas texture
TextureCreateDesc desc = {};
desc.arraySize = 1;
desc.depth = 1;
desc.descriptors = SG_DESCRIPTOR_TYPE_TEXTURE;
desc.format = TinyImageFormat_R8_UNORM;
desc.height = height;
desc.mipLevels = 1;
desc.sampleCount = SG_SAMPLE_COUNT_1;
desc.startState = SG_RESOURCE_STATE_COMMON;
desc.width = width;
desc.name = "FontStash Texture";
TextureLoadDesc loadDesc = {};
loadDesc.ppTexture = &pCurrentTexture;
loadDesc.desc = &desc;
add_resource(&loadDesc, nullptr);
// create FONS context
FONSparams params;
memset(¶ms, 0, sizeof(params));
params.width = width;
params.height = height;
params.flags = (unsigned char)FONS_ZERO_TOPLEFT;
params.renderCreate = FonsImplGenerateTexture;
params.renderUpdate = FonsImplModifyTexture;
params.renderDelete = FonsImplRemoveTexture;
params.renderDraw = FonsImplRenderText;
params.userPtr = this;
pContext = fonsCreateInternal(¶ms);
// Rendering resources
SamplerCreateDesc samplerDesc = { SG_FILTER_LINEAR,
SG_FILTER_LINEAR,
SG_MIPMAP_MODE_NEAREST,
SG_ADDRESS_MODE_CLAMP_TO_EDGE,
SG_ADDRESS_MODE_CLAMP_TO_EDGE,
SG_ADDRESS_MODE_CLAMP_TO_EDGE };
add_sampler(pRenderer, &samplerDesc, &pDefaultSampler);
#ifdef USE_TEXT_PRECOMPILED_SHADERS
BinaryShaderCreateDesc binaryShaderDesc = {};
binaryShaderDesc.stages = SG_SHADER_STAGE_VERT | SG_SHADER_STAGE_FRAG;
binaryShaderDesc.vert.byteCodeSize = sizeof(gShaderFontstash2DVert);
binaryShaderDesc.vert.pByteCode = (char*)gShaderFontstash2DVert;
binaryShaderDesc.vert.pEntryPoint = "main";
binaryShaderDesc.frag.byteCodeSize = sizeof(gShaderFontstashFrag);
binaryShaderDesc.frag.pByteCode = (char*)gShaderFontstashFrag;
binaryShaderDesc.frag.pEntryPoint = "main";
add_shader_binary(pRenderer, &binaryShaderDesc, &pShaders[0]);
binaryShaderDesc.vert.byteCodeSize = sizeof(gShaderFontstash3DVert);
binaryShaderDesc.vert.pByteCode = (char*)gShaderFontstash3DVert;
binaryShaderDesc.vert.pEntryPoint = "main";
add_shader_binary(pRenderer, &binaryShaderDesc, &pShaders[1]);
#else
ShaderLoadDesc text2DShaderDesc = {};
text2DShaderDesc.stages[0] = { "FontsShader/fontstash2D.vert", nullptr, 0, nullptr };
text2DShaderDesc.stages[1] = { "FontsShader/fontstash.frag", nullptr, 0, nullptr };
ShaderLoadDesc text3DShaderDesc = {};
text3DShaderDesc.stages[0] = { "FontsShader/fontstash3D.vert", nullptr, 0, nullptr };
text3DShaderDesc.stages[1] = { "FontsShader/fontstash.frag", nullptr, 0, nullptr };
add_shader(pRenderer, &text2DShaderDesc, &pShaders[0]);
add_shader(pRenderer, &text3DShaderDesc, &pShaders[1]);
#endif
RootSignatureCreateDesc textureRootDesc = { pShaders, 2 };
const char* pStaticSamplers[] = { "uSampler0" };
textureRootDesc.staticSamplerCount = 1;
textureRootDesc.ppStaticSamplerNames = pStaticSamplers;
textureRootDesc.ppStaticSamplers = &pDefaultSampler;
add_root_signature(pRenderer, &textureRootDesc, &pRootSignature);
add_uniform_gpu_ring_buffer(pRenderer, 65536, &pUniformRingBuffer, true);
uint64_t size = sizeof(Matrix4);
DescriptorSetCreateDesc setDesc = { pRootSignature, SG_DESCRIPTOR_UPDATE_FREQ_NONE, 2 };
add_descriptor_set(pRenderer, &setDesc, &pDescriptorSets);
DescriptorData setParams[2] = {};
setParams[0].name = "uniformBlock_rootcbv";
setParams[0].ppBuffers = &pUniformRingBuffer->pBuffer;
setParams[0].sizes = &size;
setParams[1].name = "uTex0";
setParams[1].ppTextures = &pCurrentTexture;
update_descriptor_set(pRenderer, 0, pDescriptorSets, 2, setParams);
update_descriptor_set(pRenderer, 1, pDescriptorSets, 2, setParams);
BufferCreateDesc vbDesc = {};
vbDesc.descriptors = SG_DESCRIPTOR_TYPE_VERTEX_BUFFER;
vbDesc.memoryUsage = SG_RESOURCE_MEMORY_USAGE_CPU_TO_GPU;
vbDesc.size = ringSizeBytes;
vbDesc.flags = SG_BUFFER_CREATION_FLAG_PERSISTENT_MAP_BIT;
add_gpu_ring_buffer(pRenderer, &vbDesc, &pMeshRingBuffer);
return true;
}
void OnExit()
{
// unload fontstash context
fonsDeleteInternal(pContext);
remove_resource(pCurrentTexture);
// unload font buffers
for (unsigned int i = 0; i < (uint32_t)fontBuffers.size(); i++)
sg_free(fontBuffers[i]);
remove_descriptor_set(pRenderer, pDescriptorSets);
remove_root_signature(pRenderer, pRootSignature);
for (uint32_t i = 0; i < 2; ++i)
{
remove_shader(pRenderer, pShaders[i]);
}
remove_gpu_ring_buffer(pMeshRingBuffer);
remove_gpu_ring_buffer(pUniformRingBuffer);
remove_sampler(pRenderer, pDefaultSampler);
}
bool OnLoad(RenderTarget** pRts, uint32_t count, PipelineCache* pCache)
{
VertexLayout vertexLayout = {};
vertexLayout.attribCount = 2;
vertexLayout.attribs[0].semantic = SG_SEMANTIC_POSITION;
vertexLayout.attribs[0].format = TinyImageFormat_R32G32_SFLOAT;
vertexLayout.attribs[0].binding = 0;
vertexLayout.attribs[0].location = 0;
vertexLayout.attribs[0].offset = 0;
vertexLayout.attribs[1].semantic = SG_SEMANTIC_TEXCOORD0;
vertexLayout.attribs[1].format = TinyImageFormat_R32G32_SFLOAT;
vertexLayout.attribs[1].binding = 0;
vertexLayout.attribs[1].location = 1;
vertexLayout.attribs[1].offset = TinyImageFormat_BitSizeOfBlock(vertexLayout.attribs[0].format) / 8;
BlendStateDesc blendStateDesc = {};
blendStateDesc.srcFactors[0] = SG_BLEND_CONST_SRC_ALPHA;
blendStateDesc.dstFactors[0] = SG_BLEND_CONST_ONE_MINUS_SRC_ALPHA;
blendStateDesc.srcAlphaFactors[0] = SG_BLEND_CONST_SRC_ALPHA;
blendStateDesc.dstAlphaFactors[0] = SG_BLEND_CONST_ONE_MINUS_SRC_ALPHA;
blendStateDesc.masks[0] = SG_BLEND_COLOR_MASK_ALL;
blendStateDesc.renderTargetMask = SG_BLEND_STATE_TARGET_ALL;
blendStateDesc.independentBlend = false;
DepthStateDesc depthStateDesc[2] = {}; // one for 2D, one for 3D
depthStateDesc[0].depthTest = false;
depthStateDesc[0].depthWrite = false;
depthStateDesc[1].depthTest = true;
depthStateDesc[1].depthWrite = true;
depthStateDesc[1].depthFunc = SG_COMPARE_MODE_LEQUAL;
RasterizerStateDesc rasterizerStateDesc[2] = {};
rasterizerStateDesc[0].cullMode = SG_CULL_MODE_NONE;
rasterizerStateDesc[0].scissor = true;
rasterizerStateDesc[1].cullMode = SG_CULL_MODE_BACK;
rasterizerStateDesc[1].scissor = true;
PipelineCreateDesc pipelineDesc = {};
pipelineDesc.pCache = pCache;
pipelineDesc.type = SG_PIPELINE_TYPE_GRAPHICS;
pipelineDesc.graphicsDesc.primitiveTopo = SG_PRIMITIVE_TOPO_TRI_LIST;
pipelineDesc.graphicsDesc.renderTargetCount = 1;
pipelineDesc.graphicsDesc.sampleCount = SG_SAMPLE_COUNT_1;
pipelineDesc.graphicsDesc.pBlendState = &blendStateDesc;
pipelineDesc.graphicsDesc.pRootSignature = pRootSignature;
pipelineDesc.graphicsDesc.pVertexLayout = &vertexLayout;
pipelineDesc.graphicsDesc.renderTargetCount = 1;
pipelineDesc.graphicsDesc.sampleCount = pRts[0]->sampleCount;
pipelineDesc.graphicsDesc.sampleQuality = pRts[0]->sampleQuality;
pipelineDesc.graphicsDesc.pColorFormats = &pRts[0]->format;
for (uint32_t i = 0; i < eastl::min(count, 2U); ++i)
{
pipelineDesc.graphicsDesc.depthStencilFormat = (i > 0) ? pRts[1]->format : TinyImageFormat_UNDEFINED;
pipelineDesc.graphicsDesc.pShaderProgram = pShaders[i];
pipelineDesc.graphicsDesc.pDepthState = &depthStateDesc[i];
pipelineDesc.graphicsDesc.pRasterizerState = &rasterizerStateDesc[i];
add_pipeline(pRenderer, &pipelineDesc, &pPipelines[i]);
}
scaleBias = { 2.0f / (float)pRts[0]->width, -2.0f / (float)pRts[0]->height };
return true;
}
void OnUnload()
{
for (uint32_t i = 0; i < 2; ++i)
{
if (pPipelines[i])
remove_pipeline(pRenderer, pPipelines[i]);
pPipelines[i] = {};
}
}
static int FonsImplGenerateTexture(void* userPtr, int width, int height);
static void FonsImplModifyTexture(void* userPtr, int* rect, const unsigned char* data);
static void FonsImplRenderText(void* userPtr, const float* verts, const float* tcoords, const unsigned int* colors, int nverts);
static void FonsImplRemoveTexture(void* userPtr);
Renderer* pRenderer;
FONScontext* pContext;
const uint8_t* pPixels;
Texture* pCurrentTexture;
bool hadUpdateTexture;
uint32_t width;
uint32_t height;
Vec2 scaleBias;
eastl::vector<void*> fontBuffers;
eastl::vector<uint32_t> fontBufferSizes;
eastl::vector<eastl::string> fontNames;
Matrix4 projViewMat;
Matrix4 worldMat;
Cmd* pCmd;
Shader* pShaders[2];
RootSignature* pRootSignature;
DescriptorSet* pDescriptorSets;
Pipeline* pPipelines[2];
Sampler* pDefaultSampler;
GPURingBuffer* pUniformRingBuffer;
GPURingBuffer* pMeshRingBuffer;
Vec2 dpiScale;
float dpiScaleMin;
bool isText3D;
};
bool FontStash::OnInit(Renderer* pRenderer, uint32_t width, uint32_t height, uint32_t ringSizeBytes)
{
impl = sg_placement_new<FontStash_Impl>(sg_calloc(1, sizeof(FontStash_Impl)));
impl->dpiScale = get_dpi_scale();
impl->dpiScaleMin = eastl::min(impl->dpiScale.x, impl->dpiScale.y);
width = width * (int)ceilf(impl->dpiScale.x);
height = height * (int)ceilf(impl->dpiScale.y);
bool success = impl->OnInit(pRenderer, width, height, ringSizeBytes);
fontMaxSize = eastl::min(width, height) / 10.0f; // see fontstash.h, line 1271, for fontSize calculation
return success;
}
void FontStash::OnExit()
{
impl->OnExit();
impl->~FontStash_Impl();
sg_free(impl);
}
bool FontStash::OnLoad(RenderTarget** pRts, uint32_t count, PipelineCache* pCache)
{
return impl->OnLoad(pRts, count, pCache);
}
void FontStash::OnUnload()
{
impl->OnUnload();
}
// read the font's data from the filestream and use Fons to
int FontStash::DefineFont(const char* identification, const char* pFontPath)
{
FONScontext* fs = impl->pContext;
FileStream fh = {};
if (sgfs_open_stream_from_path(SG_RD_FONTS, pFontPath, SG_FM_READ_BINARY, &fh))
{
ssize_t bytes = sgfs_get_stream_file_size(&fh);
void* buffer = sg_malloc(bytes);
sgfs_read_from_stream(&fh, buffer, bytes);
// add buffer to font buffers for cleanup
impl->fontBuffers.emplace_back(buffer);
impl->fontBufferSizes.emplace_back((uint32_t)bytes);
impl->fontNames.emplace_back(pFontPath);
sgfs_close_stream(&fh);
return fonsAddFontMem(fs, identification, (unsigned char*)buffer, (int)bytes, 0);
}
return -1;
}
void* FontStash::GetFontBuffer(uint32_t fontId)
{
if (fontId < impl->fontBuffers.size())
return impl->fontBuffers[fontId];
return nullptr;
}
uint32_t FontStash::GetFontBufferSize(uint32_t fontId)
{
if (fontId < impl->fontBufferSizes.size())
return impl->fontBufferSizes[fontId];
return UINT_MAX;
}
void FontStash::OnDrawText(Cmd* pCmd, const char* message, float x, float y, int fontID, unsigned int color, float size, float spacing, float blur)
{
impl->isText3D = false;
impl->pCmd = pCmd;
// clamp the font size to max size.
// precomputed font texture puts limitation to the maximum size.
size = eastl::min(size, fontMaxSize);
FONScontext* fs = impl->pContext;
fonsSetSize(fs, size * impl->dpiScaleMin);
fonsSetFont(fs, fontID);
fonsSetColor(fs, color);
fonsSetSpacing(fs, spacing * impl->dpiScaleMin);
fonsSetBlur(fs, blur);
fonsSetAlign(fs, FONS_ALIGN_LEFT | FONS_ALIGN_TOP);
// considering the retina scaling:
// the render target is already scaled up (w/ retina) and the (x,y) position given to this function
// is expected to be in the render target's area. Hence, we don't scale up the position again.
fonsDrawText(fs, x /** impl->mDpiScale.x*/, y /** impl->mDpiScale.y*/, message, nullptr);
}
void FontStash::OnDrawText(struct Cmd* pCmd, const char* message, const Matrix4& projView, const Matrix4& worldMat, int fontID, unsigned int color /*= 0xffffffff*/, float size /*= 16.0f*/, float spacing /*= 0.0f*/, float blur /*= 0.0f*/)
{
impl->isText3D = true;
impl->projViewMat = projView;
impl->worldMat = worldMat;
impl->pCmd = pCmd;
// clamp the font size to max size.
// Precomputed font texture puts limitation to the maximum size.
size = eastl::min(size, fontMaxSize);
FONScontext* fs = impl->pContext;
fonsSetSize(fs, size * impl->dpiScaleMin);
fonsSetFont(fs, fontID);
fonsSetColor(fs, color);
fonsSetSpacing(fs, spacing * impl->dpiScaleMin);
fonsSetBlur(fs, blur);
fonsSetAlign(fs, FONS_ALIGN_CENTER | FONS_ALIGN_MIDDLE);
fonsDrawText(fs, 0.0f, 0.0f, message, nullptr);
}
float FontStash::MeasureText(float* outBounds, const char* message, float x, float y, int fontID, unsigned int color /*= 0xffffffff*/, float size /*= 16.0f*/, float spacing /*= 0.0f*/, float blur /*= 0.0f*/)
{
if (outBounds == nullptr)
return 0;
const int messageLength = (int)strlen(message);
FONScontext* fs = impl->pContext;
fonsSetSize(fs, size * impl->dpiScaleMin);
fonsSetFont(fs, fontID);
fonsSetColor(fs, color);
fonsSetSpacing(fs, spacing * impl->dpiScaleMin);
fonsSetBlur(fs, blur);
fonsSetAlign(fs, FONS_ALIGN_LEFT | FONS_ALIGN_TOP);
// considering the retina scaling:
// the render target is already scaled up (w/ retina) and the (x,y) position given to this function
// is expected to be in the render target's area. Hence, we don't scale up the position again.
return fonsTextBounds(fs, x /** impl->mDpiScale.x*/, y /** impl->mDpiScale.y*/, message, message + messageLength, outBounds);
}
/// FONS renderer implementation overwritten
int FontStash_Impl::FonsImplGenerateTexture(void* userPtr, int width, int height)
{
FontStash_Impl* ctx = (FontStash_Impl*)userPtr;
ctx->width = width;
ctx->height = height;
ctx->hadUpdateTexture = true;
return 1;
}
void FontStash_Impl::FonsImplModifyTexture(void* userPtr, int* rect, const unsigned char* data)
{
UNREF_PARAM(rect);
FontStash_Impl* ctx = (FontStash_Impl*)userPtr;
ctx->pPixels = data;
ctx->hadUpdateTexture = true;
}
void FontStash_Impl::FonsImplRenderText(void* userPtr, const float* verts, const float* tcoords, const unsigned int* colors, int nverts)
{
FontStash_Impl* ctx = (FontStash_Impl*)userPtr;
if (!ctx->pCurrentTexture)
return;
Cmd* pCmd = ctx->pCmd;
if (ctx->hadUpdateTexture)
{
// #TODO: Investigate - Causes hang on low-mid end Android phones (tested on Samsung Galaxy A50s)
#ifndef __ANDROID__
wait_queue_idle(pCmd->pQueue);
#endif
SyncToken token = {};
TextureUpdateDesc updateDesc = {};
updateDesc.pTexture = ctx->pCurrentTexture;
begin_update_resource(&updateDesc);
for (uint32_t r = 0; r < updateDesc.rowCount; ++r)
{
memcpy(updateDesc.pMappedData + r * updateDesc.dstRowStride,
ctx->pPixels + r * updateDesc.srcRowStride, updateDesc.srcRowStride);
}
end_update_resource(&updateDesc, &token);
wait_for_token(&token);
ctx->hadUpdateTexture = false;
}
GPURingBufferOffset buffer = get_gpu_ring_buffer_offset(ctx->pMeshRingBuffer, nverts * sizeof(Vec4));
BufferUpdateDesc update = { buffer.pBuffer, buffer.offset };
begin_update_resource(&update);
Vec4* vtx = (Vec4*)update.pMappedData;
// build vertices
for (int impl = 0; impl < nverts; impl++)
{
vtx[impl].x = verts[impl * 2 + 0];
vtx[impl].y = verts[impl * 2 + 1];
vtx[impl].z = tcoords[impl * 2 + 0];
vtx[impl].w = tcoords[impl * 2 + 1];
}
end_update_resource(&update, nullptr);
// extract color
uint8_t* colorByte = (uint8_t*)colors;
Vec4 color;
for (int i = 0; i < 4; i++)
color[i] = ((float)colorByte[i]) / 255.0f;
uint32_t pipelineIndex = ctx->isText3D ? 1 : 0;
Pipeline* pPipeline = ctx->pPipelines[pipelineIndex];
ASSERT(pPipeline);
cmd_bind_pipeline(pCmd, pPipeline);
struct UniformData
{
Vec4 color;
Vec2 scaleBias;
} data;
data.color = color;
data.scaleBias = ctx->scaleBias;
if (ctx->isText3D)
{
Matrix4 mvp = ctx->projViewMat * ctx->worldMat;
data.color = color;
data.scaleBias.x = -data.scaleBias.x;
// update the matrix
GPURingBufferOffset uniformBlock = {};
uniformBlock = get_gpu_ring_buffer_offset(ctx->pUniformRingBuffer, sizeof(mvp));
BufferUpdateDesc updateDesc = { uniformBlock.pBuffer, uniformBlock.offset };
begin_update_resource(&updateDesc);
*((Matrix4*)updateDesc.pMappedData) = mvp;
end_update_resource(&updateDesc, nullptr);
const uint64_t size = sizeof(mvp);
const uint32_t stride = sizeof(Vec4);
DescriptorData params[1] = {};
params[0].name = "uniformBlock_rootcbv";
params[0].ppBuffers = &uniformBlock.pBuffer;
params[0].offsets = &uniformBlock.offset;
params[0].sizes = &size;
update_descriptor_set(ctx->pRenderer, pipelineIndex, ctx->pDescriptorSets, 1, params);
cmd_bind_descriptor_set(pCmd, pipelineIndex, ctx->pDescriptorSets);
cmd_bind_push_constants(pCmd, ctx->pRootSignature, "uRootConstants", &data);
cmd_bind_vertex_buffer(pCmd, 1, &buffer.pBuffer, &stride, &buffer.offset);
cmd_draw(pCmd, nverts, 0);
}
else
{
const uint32_t stride = sizeof(Vec4);
cmd_bind_descriptor_set(pCmd, pipelineIndex, ctx->pDescriptorSets);
cmd_bind_push_constants(pCmd, ctx->pRootSignature, "uRootConstants", &data);
cmd_bind_vertex_buffer(pCmd, 1, &buffer.pBuffer, &stride, &buffer.offset);
cmd_draw(pCmd, nverts, 0);
}
}
void FontStash_Impl::FonsImplRemoveTexture(void* userPtr)
{
UNREF_PARAM(userPtr);
}
}
| 33.791209
| 238
| 0.735703
|
CrystaLamb
|
c9915c20252c5c149bf9bb65ec1eb3000fd667dd
| 2,649
|
cpp
|
C++
|
base/file_handle.cpp
|
clarfonthey/laf
|
305592194e3d89dfe6d16648bf84576a2f7b05a5
|
[
"MIT"
] | null | null | null |
base/file_handle.cpp
|
clarfonthey/laf
|
305592194e3d89dfe6d16648bf84576a2f7b05a5
|
[
"MIT"
] | null | null | null |
base/file_handle.cpp
|
clarfonthey/laf
|
305592194e3d89dfe6d16648bf84576a2f7b05a5
|
[
"MIT"
] | null | null | null |
// LAF Base Library
// Copyright (c) 2020 Igara Studio S.A.
// Copyright (c) 2001-2018 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "base/file_handle.h"
#include "base/string.h"
#include <stdexcept>
#ifdef _WIN32
#include <windows.h>
#include <io.h>
#endif
#include <sys/stat.h>
#include <fcntl.h>
#ifndef O_BINARY
#define O_BINARY 0
#define O_TEXT 0
#endif
using namespace std;
namespace base {
static void fclose_if_valid(FILE* f)
{
if (f)
fclose(f);
}
static void throw_cannot_open_exception(const string& filename, const string& mode)
{
if (mode.find('w') != string::npos)
throw std::runtime_error("Cannot save file " + filename + " in the given location");
else
throw std::runtime_error("Cannot open file " + filename);
}
FILE* open_file_raw(const string& filename, const string& mode)
{
#ifdef _WIN32
return _wfopen(from_utf8(filename).c_str(),
from_utf8(mode).c_str());
#else
return fopen(filename.c_str(), mode.c_str());
#endif
}
FileHandle open_file(const string& filename, const string& mode)
{
return FileHandle(open_file_raw(filename, mode), fclose_if_valid);
}
FileHandle open_file_with_exception(const string& filename, const string& mode)
{
FileHandle f(open_file_raw(filename, mode), fclose_if_valid);
if (!f)
throw_cannot_open_exception(filename, mode);
return f;
}
FileHandle open_file_with_exception_sync_on_close(const std::string& filename, const std::string& mode)
{
FileHandle f(open_file_raw(filename, mode), close_file_and_sync);
if (!f)
throw_cannot_open_exception(filename, mode);
return f;
}
int open_file_descriptor_with_exception(const string& filename, const string& mode)
{
int flags = 0;
if (mode.find('r') != string::npos) flags |= O_RDONLY;
if (mode.find('w') != string::npos) flags |= O_RDWR | O_CREAT | O_TRUNC;
if (mode.find('b') != string::npos) flags |= O_BINARY;
int fd;
#ifdef _WIN32
fd = _wopen(from_utf8(filename).c_str(), flags, _S_IREAD | _S_IWRITE);
#else
fd = open(filename.c_str(), flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
#endif
if (fd == -1)
throw_cannot_open_exception(filename, mode);
return fd;
}
void sync_file_descriptor(int fd)
{
#ifdef _WIN32
HANDLE handle = (HANDLE)_get_osfhandle(fd);
if (handle)
FlushFileBuffers(handle);
#endif
}
void close_file_and_sync(FILE* file)
{
if (!file)
return;
fflush(file);
#ifdef _WIN32
int fd = _fileno(file);
if (fd)
sync_file_descriptor(fd);
#endif
fclose(file);
}
}
| 21.362903
| 103
| 0.705172
|
clarfonthey
|
c9941ffb64d8cc6ed9e9e3bb7c73abe1c1a4e87a
| 456
|
cpp
|
C++
|
source/03_Dynamic Programming/02_DP DNC.cpp
|
KerakTelor86/AlgoCopypasta
|
900d989c0651b51b55c551d336c2e92faead0fc8
|
[
"WTFPL"
] | 1
|
2021-06-25T05:46:11.000Z
|
2021-06-25T05:46:11.000Z
|
source/03_Dynamic Programming/02_DP DNC.cpp
|
KerakTelor86/AlgoCopypasta
|
900d989c0651b51b55c551d336c2e92faead0fc8
|
[
"WTFPL"
] | null | null | null |
source/03_Dynamic Programming/02_DP DNC.cpp
|
KerakTelor86/AlgoCopypasta
|
900d989c0651b51b55c551d336c2e92faead0fc8
|
[
"WTFPL"
] | null | null | null |
void f(int rem, int l, int r, int optl, int optr) {
if(l > r)
return;
int mid = l + r >> 1;
int opt = MOD, optid = mid;
for(int i = optl; i <= mid && i <= optr; ++i) {
if(dp[rem - 1][i] + c[i][mid] < opt) {
opt = dp[rem - 1][i] + c[i][mid];
optid = i;
}
}
dp[rem][mid] = opt;
f(rem, l, mid - 1, optl, optid);
f(rem, mid + 1, r, optid, optr);
return;
}
rep(i, 1, n)dp[1][i] = c[0][i];
rep(i, 2, k)f(i, i, n, i, n);
| 24
| 51
| 0.451754
|
KerakTelor86
|
c995a477d5ae6a2b0eddd2896d07fe36d71fc814
| 1,031
|
cpp
|
C++
|
timerCPU.cpp
|
SwarthmoreCS-PDC/CUDAVis
|
33090cfad734d0104670ebc7aae50b6416cf5a04
|
[
"Apache-2.0"
] | 5
|
2019-04-22T20:29:22.000Z
|
2022-01-17T20:49:56.000Z
|
timerCPU.cpp
|
SwarthmoreCS-PDC/CUDAVis
|
33090cfad734d0104670ebc7aae50b6416cf5a04
|
[
"Apache-2.0"
] | null | null | null |
timerCPU.cpp
|
SwarthmoreCS-PDC/CUDAVis
|
33090cfad734d0104670ebc7aae50b6416cf5a04
|
[
"Apache-2.0"
] | null | null | null |
/* Copyright 2016-2018
* Swarthmore College Computer Science, Swarthmore PA
* T. Newhall, A. Danner
*/
#include "timerCPU.h"
#include <cstdio>
CPUTimer::CPUTimer() {
gettimeofday(&startTime, NULL);
gettimeofday(&stopTime, NULL);
}
void CPUTimer::start() { gettimeofday(&startTime, NULL); }
void CPUTimer::stop() {
gettimeofday(&stopTime, NULL);
timeSub(stopDiff, startTime, stopTime);
}
void CPUTimer::timeSub(struct timeval &result, struct timeval before,
struct timeval after) {
if (after.tv_usec < before.tv_usec) {
after.tv_sec -= 1;
after.tv_usec += 1000000;
}
result.tv_sec = after.tv_sec - before.tv_sec;
result.tv_usec = after.tv_usec - before.tv_usec;
}
void CPUTimer::print() {
float diff = stopDiff.tv_sec * 1000 + stopDiff.tv_usec / 1000.0;
printf("Elapsed time: %.3f \n", diff);
}
float CPUTimer::elapsed() {
struct timeval now;
gettimeofday(&now, NULL);
timeSub(curDiff, startTime, now);
return curDiff.tv_sec * 1000 + curDiff.tv_usec / (1000.);
}
| 24.547619
| 69
| 0.678952
|
SwarthmoreCS-PDC
|
c99fa90c5c5c41bb8e0da2f24cd80289328283b2
| 1,348
|
cpp
|
C++
|
owl/color/gamma_correction.cpp
|
soerenkoenig/owl
|
ab10054514a7a5b12a6b81665b3b264cfe37b0f3
|
[
"MIT"
] | null | null | null |
owl/color/gamma_correction.cpp
|
soerenkoenig/owl
|
ab10054514a7a5b12a6b81665b3b264cfe37b0f3
|
[
"MIT"
] | null | null | null |
owl/color/gamma_correction.cpp
|
soerenkoenig/owl
|
ab10054514a7a5b12a6b81665b3b264cfe37b0f3
|
[
"MIT"
] | null | null | null |
#include "owl/color/gamma_correction.hpp"
namespace owl
{
namespace color
{
double linear_2_gamma_corrected(double u, gamma_correction_model::s_rgb cm)
{
constexpr double a = 1.055;
constexpr double b = -0.055;
constexpr double c = 12.92;
constexpr double d = 0.0031308;
constexpr double gamma = 1.0/2.4;
if(u < 0)
return -linear_2_gamma_corrected(-u, cm);
if(u < d)
return c * u;
return a * std::pow(u, gamma) + b;
}
double gamma_corrected_2_linear(double u, gamma_correction_model::s_rgb cm)
{
constexpr double a = 1/1.055;
constexpr double b = 0.055/1.055;
constexpr double c = 1/12.92;
constexpr double d = 0.04045;
constexpr double gamma = 2.4;
if(u < 0)
return -linear_2_gamma_corrected(-u, cm);
if(u < d)
return c * u;
return std::pow(a * u + b, gamma);
}
double linear_2_gamma_corrected(double u, gamma_correction_model::adobe_rgb cm)
{
constexpr double gamma = 1.0/2.19921875;
if(u < 0)
return -linear_2_gamma_corrected(-u, cm);
return std::pow(u,gamma);
}
double gamma_corrected_2_linear(double u, gamma_correction_model::adobe_rgb cm)
{
constexpr double gamma = 2.19921875;
return std::pow(u,gamma);
}
}
}
| 25.433962
| 83
| 0.60905
|
soerenkoenig
|
c9a1b4f69a63b196484bd96a0c5597626e93da5a
| 3,409
|
cpp
|
C++
|
framework/box.cpp
|
neyustudies/programmiersprachen-raytracer
|
220a979fb67c6179ceffc4172c721c4338f5e90e
|
[
"MIT"
] | null | null | null |
framework/box.cpp
|
neyustudies/programmiersprachen-raytracer
|
220a979fb67c6179ceffc4172c721c4338f5e90e
|
[
"MIT"
] | null | null | null |
framework/box.cpp
|
neyustudies/programmiersprachen-raytracer
|
220a979fb67c6179ceffc4172c721c4338f5e90e
|
[
"MIT"
] | 1
|
2022-01-05T13:55:17.000Z
|
2022-01-05T13:55:17.000Z
|
#include "box.hpp"
#include <algorithm>
#include <cmath>
#include <vector>
#include "hitpoint.hpp"
#include "util.hpp"
Box::Box() : Box{{}, {}, "Unnamed Box", {}} {}
Box::Box(glm::vec3 const& min, glm::vec3 const& max)
: Box{min, max, "Unnamed Box", {}} {}
Box::Box(glm::vec3 const& min, glm::vec3 const& max, std::string const& name)
: Box{min, max, name, {}} {}
Box::Box(glm::vec3 const& min,
glm::vec3 const& max,
std::string const& name,
std::shared_ptr<Material> const& material)
: Shape{name, material} {
min_.x = std::min(min.x, max.x);
min_.y = std::min(min.y, max.y);
min_.z = std::min(min.z, max.z);
max_.x = std::max(min.x, max.x);
max_.y = std::max(min.y, max.y);
max_.z = std::max(min.z, max.z);
}
Box::~Box() {}
glm::vec3 Box::min() const { return min_; }
glm::vec3 Box::max() const { return max_; }
float Box::area() const {
return 2.0f * std::abs(max_.x - min_.x) + 2.0f * std::abs(max_.y - min_.y) +
2.0f * std::abs(max_.z - min_.z);
}
float Box::volume() const {
return std::abs(max_.x - min_.x) * std::abs(max_.y - min_.y) *
std::abs(max_.z - min_.z);
}
HitPoint Box::hitpoint(Ray const& ray) const {
std::vector<float> distances;
float minX = (min_.x - ray.origin.x) / ray.direction.x;
float maxX = (max_.x - ray.origin.x) / ray.direction.x;
float minY = (min_.y - ray.origin.y) / ray.direction.y;
float maxY = (max_.y - ray.origin.y) / ray.direction.y;
float minZ = (min_.z - ray.origin.z) / ray.direction.z;
float maxZ = (max_.z - ray.origin.z) / ray.direction.z;
distances.push_back(minX);
distances.push_back(maxX);
distances.push_back(minY);
distances.push_back(maxY);
distances.push_back(minZ);
distances.push_back(maxZ);
std::sort(distances.begin(), distances.end());
for (auto d : distances) {
if (!std::isinf(d)) {
glm::vec3 hitpoint = ray.origin + (d * ray.direction);
if ( // intersection!
in_between_epsilon(min_.x, hitpoint.x, max_.x) &&
in_between_epsilon(min_.y, hitpoint.y, max_.y) &&
in_between_epsilon(min_.z, hitpoint.z, max_.z)) {
glm::vec3 normal{};
if (maxX == d)
normal = {1, 0, 0};
if (minX == d)
normal = {-1, 0, 0};
if (maxY == d)
normal = {0, 1, 0};
if (minY == d)
normal = {0, -1, 0};
if (maxZ == d)
normal = {0, 0, 1};
if (minZ == d)
normal = {0, 0, -1};
return {true, d, name_, material_->ka, hitpoint,
ray.direction, normal};
}
}
}
return {};
}
HitPoint Box::intersect(Ray const& ray) const {
if (ray.direction.x == 0 && ray.direction.y == 0 && ray.direction.z == 0)
throw "direction should not be zero";
Ray tray = transformRay(world_transform_inv_, ray);
auto hit = hitpoint(tray);
transformBack(hit, world_transform_, glm::transpose(world_transform_inv_));
return hit;
}
std::ostream& Box::print(std::ostream & os) const {
Shape::print(os);
return os << "Minimum: (" << min_.x << "," << min_.y << "," << min_.z
<< ")\nMaximum: (" << max_.x << "," << max_.y << "," << max_.z
<< ")\nArea: " << area() << "\nVolume: " << volume() << "\n";
}
| 31.275229
| 80
| 0.536814
|
neyustudies
|
c9a5c13ad593c56da57f74231ddca1a2b5f822bf
| 2,827
|
cpp
|
C++
|
tc 160+/MinDifference.cpp
|
ibudiselic/contest-problem-solutions
|
88082981b4d87da843472e3ca9ed5f4c42b3f0aa
|
[
"BSD-2-Clause"
] | 3
|
2015-05-25T06:24:37.000Z
|
2016-09-10T07:58:00.000Z
|
tc 160+/MinDifference.cpp
|
ibudiselic/contest-problem-solutions
|
88082981b4d87da843472e3ca9ed5f4c42b3f0aa
|
[
"BSD-2-Clause"
] | null | null | null |
tc 160+/MinDifference.cpp
|
ibudiselic/contest-problem-solutions
|
88082981b4d87da843472e3ca9ed5f4c42b3f0aa
|
[
"BSD-2-Clause"
] | 5
|
2015-05-25T06:24:40.000Z
|
2021-08-19T19:22:29.000Z
|
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
using namespace std;
class MinDifference {
public:
int closestElements(int A0, int X, int Y, int M, int n) {
vector<int> v;
v.reserve(n);
v.push_back(A0);
for (int i=1; i<n; ++i) {
v.push_back((v.back()*X + Y) % M);
}
sort(v.begin(), v.end());
int sol = 12345678;
for (int i=1; i<(int)v.size(); ++i) {
sol = min(sol, v[i]-v[i-1]);
}
return sol;
}
// BEGIN CUT HERE
public:
void run_test(int Case) { if ((Case == -1) || (Case == 0)) test_case_0(); if ((Case == -1) || (Case == 1)) test_case_1(); if ((Case == -1) || (Case == 2)) test_case_2(); if ((Case == -1) || (Case == 3)) test_case_3(); if ((Case == -1) || (Case == 4)) test_case_4(); if ((Case == -1) || (Case == 5)) test_case_5(); }
private:
template <typename T> string print_array(const vector<T> &V) { ostringstream os; os << "{ "; for (typename vector<T>::const_iterator iter = V.begin(); iter != V.end(); ++iter) os << '\"' << *iter << "\","; os << " }"; return os.str(); }
void verify_case(int Case, const int &Expected, const int &Received) { cerr << "Test Case #" << Case << "..."; if (Expected == Received) cerr << "PASSED" << endl; else { cerr << "FAILED" << endl; cerr << "\tExpected: \"" << Expected << '\"' << endl; cerr << "\tReceived: \"" << Received << '\"' << endl; } }
void test_case_0() { int Arg0 = 3; int Arg1 = 7; int Arg2 = 1; int Arg3 = 101; int Arg4 = 5; int Arg5 = 6; verify_case(0, Arg5, closestElements(Arg0, Arg1, Arg2, Arg3, Arg4)); }
void test_case_1() { int Arg0 = 3; int Arg1 = 9; int Arg2 = 8; int Arg3 = 32; int Arg4 = 8; int Arg5 = 0; verify_case(1, Arg5, closestElements(Arg0, Arg1, Arg2, Arg3, Arg4)); }
void test_case_2() { int Arg0 = 67; int Arg1 = 13; int Arg2 = 17; int Arg3 = 4003; int Arg4 = 23; int Arg5 = 14; verify_case(2, Arg5, closestElements(Arg0, Arg1, Arg2, Arg3, Arg4)); }
void test_case_3() { int Arg0 = 1; int Arg1 = 1221; int Arg2 = 3553; int Arg3 = 9889; int Arg4 = 11; int Arg5 = 275; verify_case(3, Arg5, closestElements(Arg0, Arg1, Arg2, Arg3, Arg4)); }
void test_case_4() { int Arg0 = 1; int Arg1 = 1; int Arg2 = 1; int Arg3 = 2; int Arg4 = 10000; int Arg5 = 0; verify_case(4, Arg5, closestElements(Arg0, Arg1, Arg2, Arg3, Arg4)); }
void test_case_5() { int Arg0 = 1567; int Arg1 = 5003; int Arg2 = 9661; int Arg3 = 8929; int Arg4 = 43; int Arg5 = 14; verify_case(5, Arg5, closestElements(Arg0, Arg1, Arg2, Arg3, Arg4)); }
// END CUT HERE
};
// BEGIN CUT HERE
int main()
{
MinDifference ___test;
___test.run_test(-1);
}
// END CUT HERE
| 44.873016
| 317
| 0.569508
|
ibudiselic
|
c9ac7bb3b9eed2b73424734ace5480cb6de4271c
| 1,596
|
cpp
|
C++
|
Codeforces/C - Classy Numbers .cpp
|
Harry-kp/Cp
|
94e687a3a5256913467f50d8f757b12640529513
|
[
"MIT"
] | 2
|
2020-11-19T19:21:24.000Z
|
2021-04-22T10:53:16.000Z
|
Codeforces/C - Classy Numbers .cpp
|
Harry-kp/Cp
|
94e687a3a5256913467f50d8f757b12640529513
|
[
"MIT"
] | null | null | null |
Codeforces/C - Classy Numbers .cpp
|
Harry-kp/Cp
|
94e687a3a5256913467f50d8f757b12640529513
|
[
"MIT"
] | 1
|
2021-12-02T06:03:17.000Z
|
2021-12-02T06:03:17.000Z
|
#include <bits/stdc++.h>
using namespace std;
#define fastio \
ios_base::sync_with_stdio(0); \
cin.tie(NULL); \
cout.tie(NULL)
#define PI(a, b) pair<a, b>
#define MP make_pair
#define EB emplace_back
#define MOD 1000000007
#define int long long int
#define S second
#define F first
#define FOR(var, len) for (var = 0; var < len; var++)
#define debug1 cout << "debug1" << '\n'
#define debug2 cout << "debug2" << '\n'
#define debug3 cout << "debug3" << '\n'
// Maths Utils
int binExp(int a, int b, int m)
{
int r = 1;
while (b)
{
if (b % 2 == 1)
r = (r * a) % m;
a = (a * a) % m;
b = b / 2;
}
return r;
}
string s;
int dp[20][5][2];
int solve(int pos, int cnt, int tight)
{
if (dp[pos][cnt][tight] != -1)
return dp[pos][cnt][tight];
if (s.size() == pos)
{
return 1;
}
int ans = 0;
int j;
if (tight)
j = s[pos] - '0';
else
j = 9;
for (int i = 0; i <= j; i++)
{
int cnt_up = cnt + (i > 0);
if (cnt_up <= 3)
ans += solve(pos + 1, cnt + (i > 0), tight & ((s[pos] - '0') == i));
}
return dp[pos][cnt][tight] = ans;
}
int32_t main()
{
fastio;
int t = 1;
cin >> t;
while (t--)
{
int l, r;
cin >> l >> r;
// L
memset(dp, -1, sizeof dp);
s = to_string(l - 1);
int y = solve(0, 0, 1);
//R
memset(dp, -1, sizeof dp);
s = to_string(r);
int x = solve(0, 0, 1);
cout << x - y << '\n';
}
}
| 19.228916
| 80
| 0.447368
|
Harry-kp
|
c9ae759dbd4a33d2fbd9ca8bcd9938db6d7e7282
| 2,617
|
hh
|
C++
|
src/angle/AzimuthalQuadrature.hh
|
baklanovp/libdetran
|
820efab9d03ae425ccefb9520bdb6c086fdbf939
|
[
"MIT"
] | 4
|
2015-03-07T16:20:23.000Z
|
2020-02-10T13:40:16.000Z
|
src/angle/AzimuthalQuadrature.hh
|
baklanovp/libdetran
|
820efab9d03ae425ccefb9520bdb6c086fdbf939
|
[
"MIT"
] | 3
|
2018-02-27T21:24:22.000Z
|
2020-12-16T00:56:44.000Z
|
src/angle/AzimuthalQuadrature.hh
|
baklanovp/libdetran
|
820efab9d03ae425ccefb9520bdb6c086fdbf939
|
[
"MIT"
] | 9
|
2015-03-07T16:20:26.000Z
|
2022-01-29T00:14:23.000Z
|
//----------------------------------*-C++-*-----------------------------------//
/**
* @file AzimuthalQuadrature.hh
* @brief AzimuthalQuadrature class definition
* @note Copyright (C) 2013 Jeremy Roberts
*/
//----------------------------------------------------------------------------//
#ifndef detran_angle_AZIMUTHALQUADRATURE_HH_
#define detran_angle_AZIMUTHALQUADRATURE_HH_
#include "angle/Quadrature.hh"
// Various base quadratures
#include "angle/BaseGL.hh"
#include "angle/BaseUniform.hh"
#include "angle/AbuShumaysQuadrupleRange.hh"
namespace detran_angle
{
/**
* @class AzimuthalQuadrature
* @brief Defines a quadrature over [0, pi/2]
*
* Unlike @ref PolarQuadrature, this class is not a complete transport
* quadrature. It is only used for defining product quadratures.
*
* @tparam B Base quadrature class
*/
template <class B>
class ANGLE_EXPORT AzimuthalQuadrature
{
public:
typedef Quadrature::vec_dbl vec_dbl;
typedef Quadrature::size_t size_t;
/// Constructor, with optional normalization of weights to @f$ \pi/2 @f$
AzimuthalQuadrature(const size_t number_azimuth, bool normalize = false);
/// Number of polar angles per half space
size_t number_azimuth() const;
/// Get azimuths
const vec_dbl& phi() const;
/// Get azimuth cosines
const vec_dbl& cos_phi() const;
/// Get azimuth sines
const vec_dbl& sin_phi() const;
/// Get all azimuthal weights
const vec_dbl& weights() const;
/// Return base name
static std::string name() {return B::name();}
private:
/// Number of azimuths per quadrant
size_t d_number_azimuth;
/// Vector of azimuths
vec_dbl d_phi;
/// Vector of azimuths
vec_dbl d_cos_phi;
/// Vector of azimuths
vec_dbl d_sin_phi;
/// Vector of weights
vec_dbl d_weight;
};
//----------------------------------------------------------------------------//
// CONVENIENCE TYPEDEFS
//----------------------------------------------------------------------------//
typedef AzimuthalQuadrature<BaseGL> AzimuthalGL;
typedef AzimuthalQuadrature<BaseDGL> AzimuthalDGL;
typedef AzimuthalQuadrature<BaseUniform> AzimuthalU;
typedef AzimuthalQuadrature<BaseSimpson> AzimuthalS;
typedef AzimuthalQuadrature<AbuShumaysQuadrupleRange> AzimuthalASQR;
} // end namespace detran_angle
#endif /* detran_angle_AZIMUTHALQUADRATURE_HH_ */
//----------------------------------------------------------------------------//
// end of AzimuthalQuadrature.hh
//----------------------------------------------------------------------------//
| 30.430233
| 80
| 0.587696
|
baklanovp
|
c9af57acaf292d9e5dded59e15a94507fd51e092
| 3,568
|
hpp
|
C++
|
include/cass/iterator.hpp
|
API92/cassaforte
|
27eb8fdd822c0fc5d7b078228b698cb2e0804e01
|
[
"BSD-2-Clause"
] | null | null | null |
include/cass/iterator.hpp
|
API92/cassaforte
|
27eb8fdd822c0fc5d7b078228b698cb2e0804e01
|
[
"BSD-2-Clause"
] | null | null | null |
include/cass/iterator.hpp
|
API92/cassaforte
|
27eb8fdd822c0fc5d7b078228b698cb2e0804e01
|
[
"BSD-2-Clause"
] | null | null | null |
/*
* Copyright (C) Andrey Pikas
*/
#pragma once
#include "delete_defaults.hpp"
#include "forward.hpp"
#include "impexp.hpp"
typedef struct CassIterator_ CassIterator;
namespace cass {
class CASSA_IMPEXP iterator : delete_defaults {
public:
static iterator * ptr(::CassIterator *p);
::CassIterator * backend();
::CassIterator const * backend() const;
void free();
static iterator_ptr from_result(cass::result const *result);
static iterator_ptr from_row(cass::row const *row);
static iterator_ptr from_collection(cass::value const *value);
static iterator_ptr from_map(cass::value const *value);
static iterator_ptr from_tuple(cass::value const *value);
static iterator_ptr fields_from_user_type(
cass::value const *value);
static iterator_ptr keyspaces_from_schema_meta(
cass::schema_meta const *schema_meta);
static iterator_ptr tables_from_keyspace_meta(
cass::keyspace_meta const *keyspace_meta);
static iterator_ptr materialized_views_from_keyspace_meta(
cass::keyspace_meta const *keyspace_meta);
static iterator_ptr user_types_from_keyspace_meta(
cass::keyspace_meta const *keyspace_meta);
static iterator_ptr functions_from_keyspace_meta(
cass::keyspace_meta const *keyspace_meta);
static iterator_ptr aggregates_from_keyspace_meta(
cass::keyspace_meta const *keyspace_meta);
static iterator_ptr fields_from_keyspace_meta(
cass::keyspace_meta const *keyspace_meta);
static iterator_ptr columns_from_table_meta(
cass::table_meta const *table_meta);
static iterator_ptr indexes_from_table_meta(
cass::table_meta const *table_meta);
static iterator_ptr materialized_views_from_table_meta(
cass::table_meta const *table_meta);
static iterator_ptr fields_from_table_meta(
cass::table_meta const *table_meta);
static iterator_ptr columns_from_materialized_view_meta(
materialized_view_meta const *view_meta);
static iterator_ptr fields_from_materialized_view_meta(
materialized_view_meta const *view_meta);
static iterator_ptr fields_from_column_meta(
cass::column_meta const *column_meta);
static iterator_ptr fields_from_index_meta(
cass::index_meta const *index_meta);
static iterator_ptr fields_from_function_meta(
cass::function_meta const *function_meta);
static iterator_ptr fields_from_aggregate_meta(
cass::aggregate_meta const *aggregate_meta);
iterator_type type();
bool next();
row const * get_row() const;
value const * get_column() const;
value const * get_value() const;
value const * get_map_key() const;
value const * get_map_value() const;
error get_user_type_field_name(char const **name,
size_t *name_length);
value const * get_user_type_field_value();
keyspace_meta const * get_keyspace_meta() const;
table_meta const * get_table_meta() const;
materialized_view_meta const * get_materialized_view_meta()
const;
data_type const * get_user_type() const;
function_meta const * get_function_meta() const;
aggregate_meta const * get_aggregate_meta() const;
column_meta const * get_column_meta() const;
index_meta const * get_index_meta() const;
error get_meta_field_name(char const **name, size_t *name_length);
value const * get_meta_field_value() const;
};
} // namespace cass
| 27.446154
| 70
| 0.716928
|
API92
|
c9bac0dfcabc1430d6ca3e5a4f613c339bdb21de
| 4,402
|
hpp
|
C++
|
include/IteratorRecognition/Exchange/JSONTransfer.hpp
|
robcasloz/IteratorRecognition
|
fa1a1e67c36cde3639ac40528228ae85e54e3b13
|
[
"MIT"
] | null | null | null |
include/IteratorRecognition/Exchange/JSONTransfer.hpp
|
robcasloz/IteratorRecognition
|
fa1a1e67c36cde3639ac40528228ae85e54e3b13
|
[
"MIT"
] | 6
|
2019-05-29T21:11:03.000Z
|
2021-07-01T10:47:02.000Z
|
include/IteratorRecognition/Exchange/JSONTransfer.hpp
|
robcasloz/IteratorRecognition
|
fa1a1e67c36cde3639ac40528228ae85e54e3b13
|
[
"MIT"
] | 1
|
2019-05-13T11:55:39.000Z
|
2019-05-13T11:55:39.000Z
|
//
//
//
#pragma once
#include "IteratorRecognition/Config.hpp"
#include "IteratorRecognition/Support/Utils/Extras.hpp"
#include "IteratorRecognition/Support/Utils/DebugInfo.hpp"
#include "IteratorRecognition/Support/CondensationGraph.hpp"
#include "IteratorRecognition/Analysis/GraphUpdater.hpp"
#include "IteratorRecognition/Analysis/IteratorRecognition.hpp"
#include "IteratorRecognition/Analysis/Passes/PayloadDependenceGraphPass.hpp"
#include "llvm/Support/JSON.h"
// using json::Value
// using json::Object
// using json::Array
#include "llvm/ADT/StringRef.h"
// using llvm::StringRef
#include <llvm/ADT/GraphTraits.h>
// using llvm::GraphTraits
#include "llvm/Support/raw_ostream.h"
// using llvm::raw_string_ostream
#include "boost/iterator/indirect_iterator.hpp"
// using boost::make_indirect_iterator
#include "boost/range/adaptors.hpp"
// using boost::adaptors::filtered
#include "boost/range/algorithm.hpp"
// using boost::range::transform
#include <string>
// using std::string
#include <algorithm>
// using std::transform
#include <iterator>
// using std::back_inserter
// using std::make_move_iterator
#include <utility>
// using std::move
#include <type_traits>
// using std::enable_if
// namespace aliases
namespace ba = boost::adaptors;
namespace br = boost::range;
//
namespace llvm {
class Instruction;
class Loop;
} // namespace llvm
namespace iteratorrecognition {
namespace json {
template <typename GraphT, typename GT = llvm::GraphTraits<GraphT *>>
std::enable_if_t<has_unit_t<typename GT::NodeRef>::value, llvm::json::Value>
toJSON(const CondensationGraphNode<GraphT *> &CGN) {
llvm::json::Object root;
llvm::json::Object mapping;
std::string outs;
llvm::raw_string_ostream ss(outs);
llvm::json::Array condensationsArray;
br::transform(CGN | ba::filtered(is_not_null_unit),
std::back_inserter(condensationsArray), [&](const auto &e) {
outs.clear();
ss << *e->unit();
return ss.str();
});
mapping["condensation"] = std::move(condensationsArray);
root = std::move(mapping);
return std::move(root);
}
template <typename GraphT, typename GT = llvm::GraphTraits<GraphT *>>
std::enable_if_t<!has_unit_t<typename GT::NodeRef>::value, llvm::json::Value>
toJSON(const CondensationGraphNode<GraphT *> &CGN) {
llvm::json::Object root;
llvm::json::Object mapping;
std::string outs;
llvm::raw_string_ostream ss(outs);
llvm::json::Array condensationsArray;
br::transform(CGN, std::back_inserter(condensationsArray),
[&](const auto &e) { return toJSON(*e); });
mapping["condensation"] = std::move(condensationsArray);
root = std::move(mapping);
return std::move(root);
}
template <typename GraphT>
llvm::json::Value toJSON(const CondensationGraph<GraphT *> &G) {
llvm::json::Object root;
llvm::json::Array condensations;
for (const auto &cn : G) {
condensations.push_back(toJSON(*cn));
}
root["condensations"] = std::move(condensations);
return std::move(root);
}
llvm::json::Value toJSON(const llvm::Instruction &Instruction);
llvm::json::Value toJSON(const llvm::Loop &CurLoop);
llvm::json::Value toJSON(const dbg::LoopDebugInfoT &Info);
llvm::json::Value
toJSON(const IteratorRecognitionInfo::CondensationToLoopsMapT &Map);
llvm::json::Value toJSON(const UpdateAction &UA);
llvm::json::Value toJSON(const StaticCommutativityProperty &SCP);
llvm::json::Value toJSON(const StaticCommutativityResult &SCR);
} // namespace json
} // namespace iteratorrecognition
namespace iteratorrecognition {
template <typename PreambleT, typename IteratorT>
llvm::json::Value
ConvertToJSON(llvm::StringRef PreambleText, llvm::StringRef SequenceText,
const PreambleT &Preamble, IteratorT Begin, IteratorT End) {
llvm::json::Object mapping;
llvm::json::Array updates;
mapping[PreambleText] = json::toJSON(Preamble);
// TODO maybe detect if the pointee is a pointer itself with SFINAE in order
// to decide on the use of indirect_iterator or not
std::transform(boost::make_indirect_iterator(Begin),
boost::make_indirect_iterator(End),
std::back_inserter(updates),
[](const auto &e) { return json::toJSON(e); });
mapping[SequenceText] = std::move(updates);
return std::move(mapping);
}
} // namespace iteratorrecognition
| 25.593023
| 78
| 0.714448
|
robcasloz
|
c9bdf38f640c35fba71055c1b023061cfc1190b5
| 2,117
|
cc
|
C++
|
nipXray/src/NXHit.cc
|
maxwell-herrmann/geant4-simple-examples
|
0052d40fdc05baef05b4a6873c03d0d54885ad40
|
[
"BSD-2-Clause"
] | 9
|
2015-04-27T11:54:19.000Z
|
2022-01-30T23:42:00.000Z
|
nipXray/src/NXHit.cc
|
maxwell-herrmann/geant4-simple-examples
|
0052d40fdc05baef05b4a6873c03d0d54885ad40
|
[
"BSD-2-Clause"
] | null | null | null |
nipXray/src/NXHit.cc
|
maxwell-herrmann/geant4-simple-examples
|
0052d40fdc05baef05b4a6873c03d0d54885ad40
|
[
"BSD-2-Clause"
] | 3
|
2019-12-18T21:11:57.000Z
|
2020-05-28T17:30:03.000Z
|
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "NXHit.hh"
#include "G4UnitsTable.hh"
#include "G4VVisManager.hh"
#include "G4Circle.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
G4Allocator<NXHit> NXHitAllocator;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
NXHit::NXHit() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
NXHit::~NXHit() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
NXHit::NXHit(const NXHit& right) :
G4VHit()
{
trackID = right.trackID;
chamberNb = right.chamberNb;
edep = right.edep;
pos = right.pos;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const NXHit& NXHit::operator=(const NXHit& right)
{
trackID = right.trackID;
chamberNb = right.chamberNb;
edep = right.edep;
pos = right.pos;
return *this;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int NXHit::operator==(const NXHit& right) const
{
return (this==&right) ? 1 : 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void NXHit::Draw()
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
{
G4Circle circle(pos);
circle.SetScreenSize(2.);
circle.SetFillStyle(G4Circle::filled);
G4Colour colour(1.,0.,0.);
G4VisAttributes attribs(colour);
circle.SetVisAttributes(attribs);
pVVisManager->Draw(circle);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void NXHit::Print()
{
G4cout << " trackID: " << trackID << " chamberNb: " << chamberNb
<< " energy deposit: " << G4BestUnit(edep,"Energy")
<< " position: " << G4BestUnit(pos,"Length") << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
| 27.141026
| 80
| 0.58479
|
maxwell-herrmann
|
c9c01d9391098e84726256cf59347d89fb4ed591
| 1,132
|
cpp
|
C++
|
Crypt.cpp
|
wolframtheta/cell
|
71c14c391c00b2a125621a5134b5440a48c39d98
|
[
"MIT"
] | null | null | null |
Crypt.cpp
|
wolframtheta/cell
|
71c14c391c00b2a125621a5134b5440a48c39d98
|
[
"MIT"
] | null | null | null |
Crypt.cpp
|
wolframtheta/cell
|
71c14c391c00b2a125621a5134b5440a48c39d98
|
[
"MIT"
] | null | null | null |
#include "utils.hpp"
#include "ListCells.hpp"
#include "Crypt.hpp"
Crypt::Crypt(){
this->rate = -1;
}
Crypt::Crypt(Cell cellCrypt) {
this->cell = cellCrypt;
this->rate = 0.0;
this->listCells = ListCells();
this->meanIntensity = 0.0;
this->meanRawIntensity = 0.0;
}
double Crypt::getMeanIntensity() {
return this->meanIntensity;
}
double Crypt::getMeanRawIntensity() {
return this->meanRawIntensity;
}
void Crypt::setMeanIntensity(double meanIntensity) {
this->meanIntensity = meanIntensity;
}
void Crypt::setMeanRawIntensity(double meanRawIntensity) {
this->meanRawIntensity = meanRawIntensity;
}
ListCells Crypt::getListCells() {
return this->listCells;
}
double Crypt::getRate() {
return this->rate;
}
Cell Crypt::getCell() {
return this->cell;
}
void Crypt::addCell(Cell cell) {
this->listCells.addCell(cell);
}
void Crypt::setRate(double rate) {
this->rate = rate;
}
void Crypt::print() {
cout << "Crypt: " << cell.getPerimeter() << " Rate: " << this->rate << " Intensity: " << cell.getIntensity() << endl;
listCells.print();
}
bool Crypt::isEmpty() {
return (this->rate == -1);
}
| 18.258065
| 118
| 0.675795
|
wolframtheta
|
c9c4d5fa82d61f0418e3b3411dec22be8bf588fe
| 1,066
|
hpp
|
C++
|
library/ATF/_personal_automine_uninstall_circle_zoclInfo.hpp
|
lemkova/Yorozuya
|
f445d800078d9aba5de28f122cedfa03f26a38e4
|
[
"MIT"
] | 29
|
2017-07-01T23:08:31.000Z
|
2022-02-19T10:22:45.000Z
|
library/ATF/_personal_automine_uninstall_circle_zoclInfo.hpp
|
kotopes/Yorozuya
|
605c97d3a627a8f6545cc09f2a1b0a8afdedd33a
|
[
"MIT"
] | 90
|
2017-10-18T21:24:51.000Z
|
2019-06-06T02:30:33.000Z
|
library/ATF/_personal_automine_uninstall_circle_zoclInfo.hpp
|
kotopes/Yorozuya
|
605c97d3a627a8f6545cc09f2a1b0a8afdedd33a
|
[
"MIT"
] | 44
|
2017-12-19T08:02:59.000Z
|
2022-02-24T23:15:01.000Z
|
// This file auto generated by plugin for ida pro. Generated code only for x64. Please, dont change manually
#pragma once
#include <common/common.h>
#include <_personal_automine_uninstall_circle_zocl.hpp>
START_ATF_NAMESPACE
namespace Info
{
using _personal_automine_uninstall_circle_zoclctor__personal_automine_uninstall_circle_zocl2_ptr = void (WINAPIV*)(struct _personal_automine_uninstall_circle_zocl*);
using _personal_automine_uninstall_circle_zoclctor__personal_automine_uninstall_circle_zocl2_clbk = void (WINAPIV*)(struct _personal_automine_uninstall_circle_zocl*, _personal_automine_uninstall_circle_zoclctor__personal_automine_uninstall_circle_zocl2_ptr);
using _personal_automine_uninstall_circle_zoclsize4_ptr = int (WINAPIV*)(struct _personal_automine_uninstall_circle_zocl*);
using _personal_automine_uninstall_circle_zoclsize4_clbk = int (WINAPIV*)(struct _personal_automine_uninstall_circle_zocl*, _personal_automine_uninstall_circle_zoclsize4_ptr);
}; // end namespace Info
END_ATF_NAMESPACE
| 59.222222
| 266
| 0.839587
|
lemkova
|
c9d2d6f7e2aae925899a9b18fde73b32451fed98
| 2,123
|
cpp
|
C++
|
GpuMiner/XDagCore/XTaskWrapper.cpp
|
swordlet/DaggerAOCLminer
|
f4fa5b5aec4942863c234463d3aeb244c472eae4
|
[
"MIT"
] | 5
|
2019-03-08T11:26:35.000Z
|
2022-01-15T12:53:57.000Z
|
GpuMiner/XDagCore/XTaskWrapper.cpp
|
swordlet/DaggerAOCLminer
|
f4fa5b5aec4942863c234463d3aeb244c472eae4
|
[
"MIT"
] | null | null | null |
GpuMiner/XDagCore/XTaskWrapper.cpp
|
swordlet/DaggerAOCLminer
|
f4fa5b5aec4942863c234463d3aeb244c472eae4
|
[
"MIT"
] | 6
|
2019-03-07T08:46:33.000Z
|
2022-02-15T17:38:18.000Z
|
// Task data
// Author: Evgeniy Sukhomlinov
// 2018
// Licensed under GNU General Public License, Version 3. See the LICENSE file.
#include "XTaskWrapper.h"
#include "Core/Log.h"
#include "Utils/Utils.h"
#include "Utils/Random.h"
#include "Hash/sha256_mod.h"
#define bytereverse(x) ( ((x) << 24) | (((x) << 8) & 0x00ff0000) | (((x) >> 8) & 0x0000ff00) | ((x) >> 24) )
XTaskWrapper::XTaskWrapper()
:_taskIndex(0),
_isShareFound(false)
{
}
XTaskWrapper::~XTaskWrapper()
{
}
void XTaskWrapper::FillAndPrecalc(xdag_field* data, xdag_hash_t addressHash)
{
_task.main_time = GetMainTime();
XHash::SetHashState(&_task.ctx, data[0].data, sizeof(struct xdag_block) - 2 * sizeof(struct xdag_field));
XHash::HashUpdate(&_task.ctx, data[1].data, sizeof(struct xdag_field));
XHash::HashUpdate(&_task.ctx, addressHash, sizeof(xdag_hashlow_t));
CRandom::FillRandomArray((uint8_t*)&_task.nonce.amount, sizeof(uint64_t));
memcpy(_task.nonce.data, addressHash, sizeof(xdag_hashlow_t));
memcpy(_task.lastfield.data, _task.nonce.data, sizeof(xdag_hash_t));
//we manually set the initial target difficulty of shares
memset(_task.minhash.data, 0xff, 24);
_task.minhash.data[3] = 0x000008ffffffffff;
//some precalculations on task data for GPU mining
shamod::PrecalcState(_task.ctx.state, _task.ctx.data, _preCalcState);
for(uint32_t i = 0; i < 14; ++i)
{
_reversedData[i] = bytereverse(((uint32_t*)_task.ctx.data)[i]);
}
}
void XTaskWrapper::SetShare(xdag_hash_t last, xdag_hash_t hash)
{
if(XHash::CompareHashes(hash, _task.minhash.data) < 0)
{
_shareMutex.lock();
if(XHash::CompareHashes(hash, _task.minhash.data) < 0)
{
memcpy(_task.minhash.data, hash, sizeof(xdag_hash_t));
memcpy(_task.lastfield.data, last, sizeof(xdag_hash_t));
_isShareFound = true;
}
_shareMutex.unlock();
}
}
void XTaskWrapper::DumpTask()
{
clog(XDag::DebugChannel) << "MinHash " << HashToHexString(_task.minhash.data);
}
| 31.220588
| 110
| 0.651908
|
swordlet
|
c9d983f1ac0e5afdc7de86f2ec2f35749dcded16
| 96,717
|
cpp
|
C++
|
build/linux-build/Sources/src/nape/constraint/LineJoint.cpp
|
HedgehogFog/TimeOfDeath
|
b78abacf940e1a88c8b987d99764ebb6876c5dc6
|
[
"MIT"
] | null | null | null |
build/linux-build/Sources/src/nape/constraint/LineJoint.cpp
|
HedgehogFog/TimeOfDeath
|
b78abacf940e1a88c8b987d99764ebb6876c5dc6
|
[
"MIT"
] | null | null | null |
build/linux-build/Sources/src/nape/constraint/LineJoint.cpp
|
HedgehogFog/TimeOfDeath
|
b78abacf940e1a88c8b987d99764ebb6876c5dc6
|
[
"MIT"
] | null | null | null |
// Generated by Haxe 4.0.0-preview.5
#include <hxcpp.h>
#ifndef INCLUDED_nape_constraint_Constraint
#include <hxinc/nape/constraint/Constraint.h>
#endif
#ifndef INCLUDED_nape_constraint_LineJoint
#include <hxinc/nape/constraint/LineJoint.h>
#endif
#ifndef INCLUDED_nape_geom_MatMN
#include <hxinc/nape/geom/MatMN.h>
#endif
#ifndef INCLUDED_nape_geom_Vec2
#include <hxinc/nape/geom/Vec2.h>
#endif
#ifndef INCLUDED_nape_geom_Vec3
#include <hxinc/nape/geom/Vec3.h>
#endif
#ifndef INCLUDED_nape_phys_Body
#include <hxinc/nape/phys/Body.h>
#endif
#ifndef INCLUDED_nape_phys_Interactor
#include <hxinc/nape/phys/Interactor.h>
#endif
#ifndef INCLUDED_nape_space_Space
#include <hxinc/nape/space/Space.h>
#endif
#ifndef INCLUDED_zpp_nape_constraint_ZPP_Constraint
#include <hxinc/zpp_nape/constraint/ZPP_Constraint.h>
#endif
#ifndef INCLUDED_zpp_nape_constraint_ZPP_LineJoint
#include <hxinc/zpp_nape/constraint/ZPP_LineJoint.h>
#endif
#ifndef INCLUDED_zpp_nape_geom_ZPP_MatMN
#include <hxinc/zpp_nape/geom/ZPP_MatMN.h>
#endif
#ifndef INCLUDED_zpp_nape_geom_ZPP_Vec2
#include <hxinc/zpp_nape/geom/ZPP_Vec2.h>
#endif
#ifndef INCLUDED_zpp_nape_phys_ZPP_Body
#include <hxinc/zpp_nape/phys/ZPP_Body.h>
#endif
#ifndef INCLUDED_zpp_nape_phys_ZPP_Interactor
#include <hxinc/zpp_nape/phys/ZPP_Interactor.h>
#endif
#ifndef INCLUDED_zpp_nape_space_ZPP_Space
#include <hxinc/zpp_nape/space/ZPP_Space.h>
#endif
#ifndef INCLUDED_zpp_nape_util_ZNPList_ZPP_Constraint
#include <hxinc/zpp_nape/util/ZNPList_ZPP_Constraint.h>
#endif
#ifndef INCLUDED_zpp_nape_util_ZPP_PubPool
#include <hxinc/zpp_nape/util/ZPP_PubPool.h>
#endif
HX_DEFINE_STACK_FRAME(_hx_pos_09c49cc38fbc8a37_208_new,"nape.constraint.LineJoint","new",0xe137bcfd,"nape.constraint.LineJoint.new","nape/constraint/LineJoint.hx",208,0xe7850eb3)
HX_LOCAL_STACK_FRAME(_hx_pos_09c49cc38fbc8a37_222_get_body1,"nape.constraint.LineJoint","get_body1",0x71dff003,"nape.constraint.LineJoint.get_body1","nape/constraint/LineJoint.hx",222,0xe7850eb3)
HX_LOCAL_STACK_FRAME(_hx_pos_09c49cc38fbc8a37_224_set_body1,"nape.constraint.LineJoint","set_body1",0x5530dc0f,"nape.constraint.LineJoint.set_body1","nape/constraint/LineJoint.hx",224,0xe7850eb3)
HX_LOCAL_STACK_FRAME(_hx_pos_09c49cc38fbc8a37_260_get_body2,"nape.constraint.LineJoint","get_body2",0x71dff004,"nape.constraint.LineJoint.get_body2","nape/constraint/LineJoint.hx",260,0xe7850eb3)
HX_LOCAL_STACK_FRAME(_hx_pos_09c49cc38fbc8a37_262_set_body2,"nape.constraint.LineJoint","set_body2",0x5530dc10,"nape.constraint.LineJoint.set_body2","nape/constraint/LineJoint.hx",262,0xe7850eb3)
HX_LOCAL_STACK_FRAME(_hx_pos_09c49cc38fbc8a37_296_get_anchor1,"nape.constraint.LineJoint","get_anchor1",0x6f599dd0,"nape.constraint.LineJoint.get_anchor1","nape/constraint/LineJoint.hx",296,0xe7850eb3)
HX_LOCAL_STACK_FRAME(_hx_pos_09c49cc38fbc8a37_300_set_anchor1,"nape.constraint.LineJoint","set_anchor1",0x79c6a4dc,"nape.constraint.LineJoint.set_anchor1","nape/constraint/LineJoint.hx",300,0xe7850eb3)
HX_LOCAL_STACK_FRAME(_hx_pos_09c49cc38fbc8a37_321_get_anchor2,"nape.constraint.LineJoint","get_anchor2",0x6f599dd1,"nape.constraint.LineJoint.get_anchor2","nape/constraint/LineJoint.hx",321,0xe7850eb3)
HX_LOCAL_STACK_FRAME(_hx_pos_09c49cc38fbc8a37_325_set_anchor2,"nape.constraint.LineJoint","set_anchor2",0x79c6a4dd,"nape.constraint.LineJoint.set_anchor2","nape/constraint/LineJoint.hx",325,0xe7850eb3)
HX_LOCAL_STACK_FRAME(_hx_pos_09c49cc38fbc8a37_347_get_direction,"nape.constraint.LineJoint","get_direction",0xdf8ee8f3,"nape.constraint.LineJoint.get_direction","nape/constraint/LineJoint.hx",347,0xe7850eb3)
HX_LOCAL_STACK_FRAME(_hx_pos_09c49cc38fbc8a37_351_set_direction,"nape.constraint.LineJoint","set_direction",0x2494caff,"nape.constraint.LineJoint.set_direction","nape/constraint/LineJoint.hx",351,0xe7850eb3)
HX_LOCAL_STACK_FRAME(_hx_pos_09c49cc38fbc8a37_373_get_jointMin,"nape.constraint.LineJoint","get_jointMin",0x0929c634,"nape.constraint.LineJoint.get_jointMin","nape/constraint/LineJoint.hx",373,0xe7850eb3)
HX_LOCAL_STACK_FRAME(_hx_pos_09c49cc38fbc8a37_375_set_jointMin,"nape.constraint.LineJoint","set_jointMin",0x1e22e9a8,"nape.constraint.LineJoint.set_jointMin","nape/constraint/LineJoint.hx",375,0xe7850eb3)
HX_LOCAL_STACK_FRAME(_hx_pos_09c49cc38fbc8a37_398_get_jointMax,"nape.constraint.LineJoint","get_jointMax",0x0929bf46,"nape.constraint.LineJoint.get_jointMax","nape/constraint/LineJoint.hx",398,0xe7850eb3)
HX_LOCAL_STACK_FRAME(_hx_pos_09c49cc38fbc8a37_400_set_jointMax,"nape.constraint.LineJoint","set_jointMax",0x1e22e2ba,"nape.constraint.LineJoint.set_jointMax","nape/constraint/LineJoint.hx",400,0xe7850eb3)
HX_LOCAL_STACK_FRAME(_hx_pos_09c49cc38fbc8a37_455_impulse,"nape.constraint.LineJoint","impulse",0xf2f04fd2,"nape.constraint.LineJoint.impulse","nape/constraint/LineJoint.hx",455,0xe7850eb3)
HX_LOCAL_STACK_FRAME(_hx_pos_09c49cc38fbc8a37_464_bodyImpulse,"nape.constraint.LineJoint","bodyImpulse",0x465fc7d0,"nape.constraint.LineJoint.bodyImpulse","nape/constraint/LineJoint.hx",464,0xe7850eb3)
HX_LOCAL_STACK_FRAME(_hx_pos_09c49cc38fbc8a37_483_visitBodies,"nape.constraint.LineJoint","visitBodies",0xcb1c4548,"nape.constraint.LineJoint.visitBodies","nape/constraint/LineJoint.hx",483,0xe7850eb3)
namespace nape{
namespace constraint{
void LineJoint_obj::__construct( ::nape::phys::Body body1, ::nape::phys::Body body2, ::nape::geom::Vec2 anchor1, ::nape::geom::Vec2 anchor2, ::nape::geom::Vec2 direction,Float jointMin,Float jointMax){
HX_GC_STACKFRAME(&_hx_pos_09c49cc38fbc8a37_208_new)
HXLINE( 212) this->zpp_inner_zn = null();
HXLINE( 430) this->zpp_inner_zn = ::zpp_nape::constraint::ZPP_LineJoint_obj::__alloc( HX_CTX );
HXLINE( 431) this->zpp_inner = this->zpp_inner_zn;
HXLINE( 432) this->zpp_inner->outer = hx::ObjectPtr<OBJ_>(this);
HXLINE( 433) this->zpp_inner_zn->outer_zn = hx::ObjectPtr<OBJ_>(this);
HXLINE( 435) ::nape::constraint::Constraint_obj::zpp_internalAlloc = true;
HXLINE( 436) super::__construct();
HXLINE( 437) ::nape::constraint::Constraint_obj::zpp_internalAlloc = false;
HXLINE( 442) {
HXLINE( 442) {
HXLINE( 442) this->zpp_inner->immutable_midstep((HX_("Constraint::",7d,10,25,6e) + HX_("body1",4f,d3,ef,b6)));
HXDLIN( 442) ::zpp_nape::phys::ZPP_Body inbody1;
HXDLIN( 442) if (hx::IsNull( body1 )) {
HXLINE( 442) inbody1 = null();
}
else {
HXLINE( 442) inbody1 = body1->zpp_inner;
}
HXDLIN( 442) if (hx::IsNotEq( inbody1,this->zpp_inner_zn->b1 )) {
HXLINE( 442) if (hx::IsNotNull( this->zpp_inner_zn->b1 )) {
HXLINE( 442) bool _hx_tmp;
HXDLIN( 442) ::nape::space::Space _hx_tmp1;
HXDLIN( 442) if (hx::IsNull( this->zpp_inner->space )) {
HXLINE( 442) _hx_tmp1 = null();
}
else {
HXLINE( 442) _hx_tmp1 = this->zpp_inner->space->outer;
}
HXDLIN( 442) if (hx::IsNotNull( _hx_tmp1 )) {
HXLINE( 442) _hx_tmp = hx::IsNotEq( this->zpp_inner_zn->b2,this->zpp_inner_zn->b1 );
}
else {
HXLINE( 442) _hx_tmp = false;
}
HXDLIN( 442) if (_hx_tmp) {
HXLINE( 442) if (hx::IsNotNull( this->zpp_inner_zn->b1 )) {
HXLINE( 442) this->zpp_inner_zn->b1->constraints->remove(this->zpp_inner);
}
}
HXDLIN( 442) bool _hx_tmp2;
HXDLIN( 442) if (this->zpp_inner->active) {
HXLINE( 442) ::nape::space::Space _hx_tmp3;
HXDLIN( 442) if (hx::IsNull( this->zpp_inner->space )) {
HXLINE( 442) _hx_tmp3 = null();
}
else {
HXLINE( 442) _hx_tmp3 = this->zpp_inner->space->outer;
}
HXDLIN( 442) _hx_tmp2 = hx::IsNotNull( _hx_tmp3 );
}
else {
HXLINE( 442) _hx_tmp2 = false;
}
HXDLIN( 442) if (_hx_tmp2) {
HXLINE( 442) this->zpp_inner_zn->b1->wake();
}
}
HXDLIN( 442) this->zpp_inner_zn->b1 = inbody1;
HXDLIN( 442) bool _hx_tmp4;
HXDLIN( 442) bool _hx_tmp5;
HXDLIN( 442) ::nape::space::Space _hx_tmp6;
HXDLIN( 442) if (hx::IsNull( this->zpp_inner->space )) {
HXLINE( 442) _hx_tmp6 = null();
}
else {
HXLINE( 442) _hx_tmp6 = this->zpp_inner->space->outer;
}
HXDLIN( 442) if (hx::IsNotNull( _hx_tmp6 )) {
HXLINE( 442) _hx_tmp5 = hx::IsNotNull( inbody1 );
}
else {
HXLINE( 442) _hx_tmp5 = false;
}
HXDLIN( 442) if (_hx_tmp5) {
HXLINE( 442) _hx_tmp4 = hx::IsNotEq( this->zpp_inner_zn->b2,inbody1 );
}
else {
HXLINE( 442) _hx_tmp4 = false;
}
HXDLIN( 442) if (_hx_tmp4) {
HXLINE( 442) if (hx::IsNotNull( inbody1 )) {
HXLINE( 442) inbody1->constraints->add(this->zpp_inner);
}
}
HXDLIN( 442) bool _hx_tmp7;
HXDLIN( 442) if (this->zpp_inner->active) {
HXLINE( 442) ::nape::space::Space _hx_tmp8;
HXDLIN( 442) if (hx::IsNull( this->zpp_inner->space )) {
HXLINE( 442) _hx_tmp8 = null();
}
else {
HXLINE( 442) _hx_tmp8 = this->zpp_inner->space->outer;
}
HXDLIN( 442) _hx_tmp7 = hx::IsNotNull( _hx_tmp8 );
}
else {
HXLINE( 442) _hx_tmp7 = false;
}
HXDLIN( 442) if (_hx_tmp7) {
HXLINE( 442) this->zpp_inner->wake();
HXDLIN( 442) if (hx::IsNotNull( inbody1 )) {
HXLINE( 442) inbody1->wake();
}
}
}
}
HXDLIN( 442) bool _hx_tmp9 = hx::IsNull( this->zpp_inner_zn->b1 );
}
HXLINE( 443) {
HXLINE( 443) {
HXLINE( 443) this->zpp_inner->immutable_midstep((HX_("Constraint::",7d,10,25,6e) + HX_("body2",50,d3,ef,b6)));
HXDLIN( 443) ::zpp_nape::phys::ZPP_Body inbody2;
HXDLIN( 443) if (hx::IsNull( body2 )) {
HXLINE( 443) inbody2 = null();
}
else {
HXLINE( 443) inbody2 = body2->zpp_inner;
}
HXDLIN( 443) if (hx::IsNotEq( inbody2,this->zpp_inner_zn->b2 )) {
HXLINE( 443) if (hx::IsNotNull( this->zpp_inner_zn->b2 )) {
HXLINE( 443) bool _hx_tmp10;
HXDLIN( 443) ::nape::space::Space _hx_tmp11;
HXDLIN( 443) if (hx::IsNull( this->zpp_inner->space )) {
HXLINE( 443) _hx_tmp11 = null();
}
else {
HXLINE( 443) _hx_tmp11 = this->zpp_inner->space->outer;
}
HXDLIN( 443) if (hx::IsNotNull( _hx_tmp11 )) {
HXLINE( 443) _hx_tmp10 = hx::IsNotEq( this->zpp_inner_zn->b1,this->zpp_inner_zn->b2 );
}
else {
HXLINE( 443) _hx_tmp10 = false;
}
HXDLIN( 443) if (_hx_tmp10) {
HXLINE( 443) if (hx::IsNotNull( this->zpp_inner_zn->b2 )) {
HXLINE( 443) this->zpp_inner_zn->b2->constraints->remove(this->zpp_inner);
}
}
HXDLIN( 443) bool _hx_tmp12;
HXDLIN( 443) if (this->zpp_inner->active) {
HXLINE( 443) ::nape::space::Space _hx_tmp13;
HXDLIN( 443) if (hx::IsNull( this->zpp_inner->space )) {
HXLINE( 443) _hx_tmp13 = null();
}
else {
HXLINE( 443) _hx_tmp13 = this->zpp_inner->space->outer;
}
HXDLIN( 443) _hx_tmp12 = hx::IsNotNull( _hx_tmp13 );
}
else {
HXLINE( 443) _hx_tmp12 = false;
}
HXDLIN( 443) if (_hx_tmp12) {
HXLINE( 443) this->zpp_inner_zn->b2->wake();
}
}
HXDLIN( 443) this->zpp_inner_zn->b2 = inbody2;
HXDLIN( 443) bool _hx_tmp14;
HXDLIN( 443) bool _hx_tmp15;
HXDLIN( 443) ::nape::space::Space _hx_tmp16;
HXDLIN( 443) if (hx::IsNull( this->zpp_inner->space )) {
HXLINE( 443) _hx_tmp16 = null();
}
else {
HXLINE( 443) _hx_tmp16 = this->zpp_inner->space->outer;
}
HXDLIN( 443) if (hx::IsNotNull( _hx_tmp16 )) {
HXLINE( 443) _hx_tmp15 = hx::IsNotNull( inbody2 );
}
else {
HXLINE( 443) _hx_tmp15 = false;
}
HXDLIN( 443) if (_hx_tmp15) {
HXLINE( 443) _hx_tmp14 = hx::IsNotEq( this->zpp_inner_zn->b1,inbody2 );
}
else {
HXLINE( 443) _hx_tmp14 = false;
}
HXDLIN( 443) if (_hx_tmp14) {
HXLINE( 443) if (hx::IsNotNull( inbody2 )) {
HXLINE( 443) inbody2->constraints->add(this->zpp_inner);
}
}
HXDLIN( 443) bool _hx_tmp17;
HXDLIN( 443) if (this->zpp_inner->active) {
HXLINE( 443) ::nape::space::Space _hx_tmp18;
HXDLIN( 443) if (hx::IsNull( this->zpp_inner->space )) {
HXLINE( 443) _hx_tmp18 = null();
}
else {
HXLINE( 443) _hx_tmp18 = this->zpp_inner->space->outer;
}
HXDLIN( 443) _hx_tmp17 = hx::IsNotNull( _hx_tmp18 );
}
else {
HXLINE( 443) _hx_tmp17 = false;
}
HXDLIN( 443) if (_hx_tmp17) {
HXLINE( 443) this->zpp_inner->wake();
HXDLIN( 443) if (hx::IsNotNull( inbody2 )) {
HXLINE( 443) inbody2->wake();
}
}
}
}
HXDLIN( 443) bool _hx_tmp19 = hx::IsNull( this->zpp_inner_zn->b2 );
}
HXLINE( 444) {
HXLINE( 444) {
HXLINE( 444) bool _hx_tmp20;
HXDLIN( 444) if (hx::IsNotNull( anchor1 )) {
HXLINE( 444) _hx_tmp20 = anchor1->zpp_disp;
}
else {
HXLINE( 444) _hx_tmp20 = false;
}
HXDLIN( 444) if (_hx_tmp20) {
HXLINE( 444) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 444) if (hx::IsNull( anchor1 )) {
HXLINE( 444) HX_STACK_DO_THROW(((HX_("Error: Constraint::",cb,f5,02,d5) + HX_("anchor1",1c,ec,a1,02)) + HX_(" cannot be null",07,dc,5d,15)));
}
HXDLIN( 444) {
HXLINE( 444) if (hx::IsNull( this->zpp_inner_zn->wrap_a1 )) {
HXLINE( 444) this->zpp_inner_zn->setup_a1();
}
HXDLIN( 444) ::nape::geom::Vec2 _this = this->zpp_inner_zn->wrap_a1;
HXDLIN( 444) bool _hx_tmp21;
HXDLIN( 444) if (hx::IsNotNull( _this )) {
HXLINE( 444) _hx_tmp21 = _this->zpp_disp;
}
else {
HXLINE( 444) _hx_tmp21 = false;
}
HXDLIN( 444) if (_hx_tmp21) {
HXLINE( 444) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 444) bool _hx_tmp22;
HXDLIN( 444) if (hx::IsNotNull( anchor1 )) {
HXLINE( 444) _hx_tmp22 = anchor1->zpp_disp;
}
else {
HXLINE( 444) _hx_tmp22 = false;
}
HXDLIN( 444) if (_hx_tmp22) {
HXLINE( 444) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 444) {
HXLINE( 444) ::zpp_nape::geom::ZPP_Vec2 _this1 = _this->zpp_inner;
HXDLIN( 444) if (_this1->_immutable) {
HXLINE( 444) HX_STACK_DO_THROW(HX_("Error: Vec2 is immutable",60,ee,1f,bc));
}
HXDLIN( 444) if (hx::IsNotNull( _this1->_isimmutable )) {
HXLINE( 444) _this1->_isimmutable();
}
}
HXDLIN( 444) if (hx::IsNull( anchor1 )) {
HXLINE( 444) HX_STACK_DO_THROW(HX_("Error: Cannot assign null Vec2",95,15,46,66));
}
HXDLIN( 444) bool _hx_tmp23;
HXDLIN( 444) if (hx::IsNotNull( anchor1 )) {
HXLINE( 444) _hx_tmp23 = anchor1->zpp_disp;
}
else {
HXLINE( 444) _hx_tmp23 = false;
}
HXDLIN( 444) if (_hx_tmp23) {
HXLINE( 444) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 444) {
HXLINE( 444) ::zpp_nape::geom::ZPP_Vec2 _this2 = anchor1->zpp_inner;
HXDLIN( 444) if (hx::IsNotNull( _this2->_validate )) {
HXLINE( 444) _this2->_validate();
}
}
HXDLIN( 444) Float x = anchor1->zpp_inner->x;
HXDLIN( 444) bool _hx_tmp24;
HXDLIN( 444) if (hx::IsNotNull( anchor1 )) {
HXLINE( 444) _hx_tmp24 = anchor1->zpp_disp;
}
else {
HXLINE( 444) _hx_tmp24 = false;
}
HXDLIN( 444) if (_hx_tmp24) {
HXLINE( 444) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 444) {
HXLINE( 444) ::zpp_nape::geom::ZPP_Vec2 _this3 = anchor1->zpp_inner;
HXDLIN( 444) if (hx::IsNotNull( _this3->_validate )) {
HXLINE( 444) _this3->_validate();
}
}
HXDLIN( 444) Float y = anchor1->zpp_inner->y;
HXDLIN( 444) bool _hx_tmp25;
HXDLIN( 444) if (hx::IsNotNull( _this )) {
HXLINE( 444) _hx_tmp25 = _this->zpp_disp;
}
else {
HXLINE( 444) _hx_tmp25 = false;
}
HXDLIN( 444) if (_hx_tmp25) {
HXLINE( 444) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 444) {
HXLINE( 444) ::zpp_nape::geom::ZPP_Vec2 _this4 = _this->zpp_inner;
HXDLIN( 444) if (_this4->_immutable) {
HXLINE( 444) HX_STACK_DO_THROW(HX_("Error: Vec2 is immutable",60,ee,1f,bc));
}
HXDLIN( 444) if (hx::IsNotNull( _this4->_isimmutable )) {
HXLINE( 444) _this4->_isimmutable();
}
}
HXDLIN( 444) bool _hx_tmp26;
HXDLIN( 444) if ((x == x)) {
HXLINE( 444) _hx_tmp26 = (y != y);
}
else {
HXLINE( 444) _hx_tmp26 = true;
}
HXDLIN( 444) if (_hx_tmp26) {
HXLINE( 444) HX_STACK_DO_THROW(HX_("Error: Vec2 components cannot be NaN",85,ba,d8,c1));
}
HXDLIN( 444) bool _hx_tmp27;
HXDLIN( 444) bool _hx_tmp28;
HXDLIN( 444) if (hx::IsNotNull( _this )) {
HXLINE( 444) _hx_tmp28 = _this->zpp_disp;
}
else {
HXLINE( 444) _hx_tmp28 = false;
}
HXDLIN( 444) if (_hx_tmp28) {
HXLINE( 444) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 444) {
HXLINE( 444) ::zpp_nape::geom::ZPP_Vec2 _this5 = _this->zpp_inner;
HXDLIN( 444) if (hx::IsNotNull( _this5->_validate )) {
HXLINE( 444) _this5->_validate();
}
}
HXDLIN( 444) if ((_this->zpp_inner->x == x)) {
HXLINE( 444) bool _hx_tmp29;
HXDLIN( 444) if (hx::IsNotNull( _this )) {
HXLINE( 444) _hx_tmp29 = _this->zpp_disp;
}
else {
HXLINE( 444) _hx_tmp29 = false;
}
HXDLIN( 444) if (_hx_tmp29) {
HXLINE( 444) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 444) {
HXLINE( 444) ::zpp_nape::geom::ZPP_Vec2 _this6 = _this->zpp_inner;
HXDLIN( 444) if (hx::IsNotNull( _this6->_validate )) {
HXLINE( 444) _this6->_validate();
}
}
HXDLIN( 444) _hx_tmp27 = (_this->zpp_inner->y == y);
}
else {
HXLINE( 444) _hx_tmp27 = false;
}
HXDLIN( 444) if (!(_hx_tmp27)) {
HXLINE( 444) {
HXLINE( 444) _this->zpp_inner->x = x;
HXDLIN( 444) _this->zpp_inner->y = y;
}
HXDLIN( 444) {
HXLINE( 444) ::zpp_nape::geom::ZPP_Vec2 _this7 = _this->zpp_inner;
HXDLIN( 444) if (hx::IsNotNull( _this7->_invalidate )) {
HXLINE( 444) _this7->_invalidate(_this7);
}
}
}
HXDLIN( 444) ::nape::geom::Vec2 ret = _this;
HXDLIN( 444) if (anchor1->zpp_inner->weak) {
HXLINE( 444) bool _hx_tmp30;
HXDLIN( 444) if (hx::IsNotNull( anchor1 )) {
HXLINE( 444) _hx_tmp30 = anchor1->zpp_disp;
}
else {
HXLINE( 444) _hx_tmp30 = false;
}
HXDLIN( 444) if (_hx_tmp30) {
HXLINE( 444) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 444) {
HXLINE( 444) ::zpp_nape::geom::ZPP_Vec2 _this8 = anchor1->zpp_inner;
HXDLIN( 444) if (_this8->_immutable) {
HXLINE( 444) HX_STACK_DO_THROW(HX_("Error: Vec2 is immutable",60,ee,1f,bc));
}
HXDLIN( 444) if (hx::IsNotNull( _this8->_isimmutable )) {
HXLINE( 444) _this8->_isimmutable();
}
}
HXDLIN( 444) if (anchor1->zpp_inner->_inuse) {
HXLINE( 444) HX_STACK_DO_THROW(HX_("Error: This Vec2 is not disposable",b5,d1,d1,d8));
}
HXDLIN( 444) ::zpp_nape::geom::ZPP_Vec2 inner = anchor1->zpp_inner;
HXDLIN( 444) anchor1->zpp_inner->outer = null();
HXDLIN( 444) anchor1->zpp_inner = null();
HXDLIN( 444) {
HXLINE( 444) ::nape::geom::Vec2 o = anchor1;
HXDLIN( 444) o->zpp_pool = null();
HXDLIN( 444) if (hx::IsNotNull( ::zpp_nape::util::ZPP_PubPool_obj::nextVec2 )) {
HXLINE( 444) ::zpp_nape::util::ZPP_PubPool_obj::nextVec2->zpp_pool = o;
}
else {
HXLINE( 444) ::zpp_nape::util::ZPP_PubPool_obj::poolVec2 = o;
}
HXDLIN( 444) ::zpp_nape::util::ZPP_PubPool_obj::nextVec2 = o;
HXDLIN( 444) o->zpp_disp = true;
}
HXDLIN( 444) {
HXLINE( 444) ::zpp_nape::geom::ZPP_Vec2 o1 = inner;
HXDLIN( 444) {
HXLINE( 444) if (hx::IsNotNull( o1->outer )) {
HXLINE( 444) o1->outer->zpp_inner = null();
HXDLIN( 444) o1->outer = null();
}
HXDLIN( 444) o1->_isimmutable = null();
HXDLIN( 444) o1->_validate = null();
HXDLIN( 444) o1->_invalidate = null();
}
HXDLIN( 444) o1->next = ::zpp_nape::geom::ZPP_Vec2_obj::zpp_pool;
HXDLIN( 444) ::zpp_nape::geom::ZPP_Vec2_obj::zpp_pool = o1;
}
}
}
}
HXDLIN( 444) if (hx::IsNull( this->zpp_inner_zn->wrap_a1 )) {
HXLINE( 444) this->zpp_inner_zn->setup_a1();
}
}
HXLINE( 445) {
HXLINE( 445) {
HXLINE( 445) bool _hx_tmp31;
HXDLIN( 445) if (hx::IsNotNull( anchor2 )) {
HXLINE( 445) _hx_tmp31 = anchor2->zpp_disp;
}
else {
HXLINE( 445) _hx_tmp31 = false;
}
HXDLIN( 445) if (_hx_tmp31) {
HXLINE( 445) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 445) if (hx::IsNull( anchor2 )) {
HXLINE( 445) HX_STACK_DO_THROW(((HX_("Error: Constraint::",cb,f5,02,d5) + HX_("anchor2",1d,ec,a1,02)) + HX_(" cannot be null",07,dc,5d,15)));
}
HXDLIN( 445) {
HXLINE( 445) if (hx::IsNull( this->zpp_inner_zn->wrap_a2 )) {
HXLINE( 445) this->zpp_inner_zn->setup_a2();
}
HXDLIN( 445) ::nape::geom::Vec2 _this9 = this->zpp_inner_zn->wrap_a2;
HXDLIN( 445) bool _hx_tmp32;
HXDLIN( 445) if (hx::IsNotNull( _this9 )) {
HXLINE( 445) _hx_tmp32 = _this9->zpp_disp;
}
else {
HXLINE( 445) _hx_tmp32 = false;
}
HXDLIN( 445) if (_hx_tmp32) {
HXLINE( 445) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 445) bool _hx_tmp33;
HXDLIN( 445) if (hx::IsNotNull( anchor2 )) {
HXLINE( 445) _hx_tmp33 = anchor2->zpp_disp;
}
else {
HXLINE( 445) _hx_tmp33 = false;
}
HXDLIN( 445) if (_hx_tmp33) {
HXLINE( 445) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 445) {
HXLINE( 445) ::zpp_nape::geom::ZPP_Vec2 _this10 = _this9->zpp_inner;
HXDLIN( 445) if (_this10->_immutable) {
HXLINE( 445) HX_STACK_DO_THROW(HX_("Error: Vec2 is immutable",60,ee,1f,bc));
}
HXDLIN( 445) if (hx::IsNotNull( _this10->_isimmutable )) {
HXLINE( 445) _this10->_isimmutable();
}
}
HXDLIN( 445) if (hx::IsNull( anchor2 )) {
HXLINE( 445) HX_STACK_DO_THROW(HX_("Error: Cannot assign null Vec2",95,15,46,66));
}
HXDLIN( 445) bool _hx_tmp34;
HXDLIN( 445) if (hx::IsNotNull( anchor2 )) {
HXLINE( 445) _hx_tmp34 = anchor2->zpp_disp;
}
else {
HXLINE( 445) _hx_tmp34 = false;
}
HXDLIN( 445) if (_hx_tmp34) {
HXLINE( 445) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 445) {
HXLINE( 445) ::zpp_nape::geom::ZPP_Vec2 _this11 = anchor2->zpp_inner;
HXDLIN( 445) if (hx::IsNotNull( _this11->_validate )) {
HXLINE( 445) _this11->_validate();
}
}
HXDLIN( 445) Float x1 = anchor2->zpp_inner->x;
HXDLIN( 445) bool _hx_tmp35;
HXDLIN( 445) if (hx::IsNotNull( anchor2 )) {
HXLINE( 445) _hx_tmp35 = anchor2->zpp_disp;
}
else {
HXLINE( 445) _hx_tmp35 = false;
}
HXDLIN( 445) if (_hx_tmp35) {
HXLINE( 445) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 445) {
HXLINE( 445) ::zpp_nape::geom::ZPP_Vec2 _this12 = anchor2->zpp_inner;
HXDLIN( 445) if (hx::IsNotNull( _this12->_validate )) {
HXLINE( 445) _this12->_validate();
}
}
HXDLIN( 445) Float y1 = anchor2->zpp_inner->y;
HXDLIN( 445) bool _hx_tmp36;
HXDLIN( 445) if (hx::IsNotNull( _this9 )) {
HXLINE( 445) _hx_tmp36 = _this9->zpp_disp;
}
else {
HXLINE( 445) _hx_tmp36 = false;
}
HXDLIN( 445) if (_hx_tmp36) {
HXLINE( 445) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 445) {
HXLINE( 445) ::zpp_nape::geom::ZPP_Vec2 _this13 = _this9->zpp_inner;
HXDLIN( 445) if (_this13->_immutable) {
HXLINE( 445) HX_STACK_DO_THROW(HX_("Error: Vec2 is immutable",60,ee,1f,bc));
}
HXDLIN( 445) if (hx::IsNotNull( _this13->_isimmutable )) {
HXLINE( 445) _this13->_isimmutable();
}
}
HXDLIN( 445) bool _hx_tmp37;
HXDLIN( 445) if ((x1 == x1)) {
HXLINE( 445) _hx_tmp37 = (y1 != y1);
}
else {
HXLINE( 445) _hx_tmp37 = true;
}
HXDLIN( 445) if (_hx_tmp37) {
HXLINE( 445) HX_STACK_DO_THROW(HX_("Error: Vec2 components cannot be NaN",85,ba,d8,c1));
}
HXDLIN( 445) bool _hx_tmp38;
HXDLIN( 445) bool _hx_tmp39;
HXDLIN( 445) if (hx::IsNotNull( _this9 )) {
HXLINE( 445) _hx_tmp39 = _this9->zpp_disp;
}
else {
HXLINE( 445) _hx_tmp39 = false;
}
HXDLIN( 445) if (_hx_tmp39) {
HXLINE( 445) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 445) {
HXLINE( 445) ::zpp_nape::geom::ZPP_Vec2 _this14 = _this9->zpp_inner;
HXDLIN( 445) if (hx::IsNotNull( _this14->_validate )) {
HXLINE( 445) _this14->_validate();
}
}
HXDLIN( 445) if ((_this9->zpp_inner->x == x1)) {
HXLINE( 445) bool _hx_tmp40;
HXDLIN( 445) if (hx::IsNotNull( _this9 )) {
HXLINE( 445) _hx_tmp40 = _this9->zpp_disp;
}
else {
HXLINE( 445) _hx_tmp40 = false;
}
HXDLIN( 445) if (_hx_tmp40) {
HXLINE( 445) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 445) {
HXLINE( 445) ::zpp_nape::geom::ZPP_Vec2 _this15 = _this9->zpp_inner;
HXDLIN( 445) if (hx::IsNotNull( _this15->_validate )) {
HXLINE( 445) _this15->_validate();
}
}
HXDLIN( 445) _hx_tmp38 = (_this9->zpp_inner->y == y1);
}
else {
HXLINE( 445) _hx_tmp38 = false;
}
HXDLIN( 445) if (!(_hx_tmp38)) {
HXLINE( 445) {
HXLINE( 445) _this9->zpp_inner->x = x1;
HXDLIN( 445) _this9->zpp_inner->y = y1;
}
HXDLIN( 445) {
HXLINE( 445) ::zpp_nape::geom::ZPP_Vec2 _this16 = _this9->zpp_inner;
HXDLIN( 445) if (hx::IsNotNull( _this16->_invalidate )) {
HXLINE( 445) _this16->_invalidate(_this16);
}
}
}
HXDLIN( 445) ::nape::geom::Vec2 ret1 = _this9;
HXDLIN( 445) if (anchor2->zpp_inner->weak) {
HXLINE( 445) bool _hx_tmp41;
HXDLIN( 445) if (hx::IsNotNull( anchor2 )) {
HXLINE( 445) _hx_tmp41 = anchor2->zpp_disp;
}
else {
HXLINE( 445) _hx_tmp41 = false;
}
HXDLIN( 445) if (_hx_tmp41) {
HXLINE( 445) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 445) {
HXLINE( 445) ::zpp_nape::geom::ZPP_Vec2 _this17 = anchor2->zpp_inner;
HXDLIN( 445) if (_this17->_immutable) {
HXLINE( 445) HX_STACK_DO_THROW(HX_("Error: Vec2 is immutable",60,ee,1f,bc));
}
HXDLIN( 445) if (hx::IsNotNull( _this17->_isimmutable )) {
HXLINE( 445) _this17->_isimmutable();
}
}
HXDLIN( 445) if (anchor2->zpp_inner->_inuse) {
HXLINE( 445) HX_STACK_DO_THROW(HX_("Error: This Vec2 is not disposable",b5,d1,d1,d8));
}
HXDLIN( 445) ::zpp_nape::geom::ZPP_Vec2 inner1 = anchor2->zpp_inner;
HXDLIN( 445) anchor2->zpp_inner->outer = null();
HXDLIN( 445) anchor2->zpp_inner = null();
HXDLIN( 445) {
HXLINE( 445) ::nape::geom::Vec2 o2 = anchor2;
HXDLIN( 445) o2->zpp_pool = null();
HXDLIN( 445) if (hx::IsNotNull( ::zpp_nape::util::ZPP_PubPool_obj::nextVec2 )) {
HXLINE( 445) ::zpp_nape::util::ZPP_PubPool_obj::nextVec2->zpp_pool = o2;
}
else {
HXLINE( 445) ::zpp_nape::util::ZPP_PubPool_obj::poolVec2 = o2;
}
HXDLIN( 445) ::zpp_nape::util::ZPP_PubPool_obj::nextVec2 = o2;
HXDLIN( 445) o2->zpp_disp = true;
}
HXDLIN( 445) {
HXLINE( 445) ::zpp_nape::geom::ZPP_Vec2 o3 = inner1;
HXDLIN( 445) {
HXLINE( 445) if (hx::IsNotNull( o3->outer )) {
HXLINE( 445) o3->outer->zpp_inner = null();
HXDLIN( 445) o3->outer = null();
}
HXDLIN( 445) o3->_isimmutable = null();
HXDLIN( 445) o3->_validate = null();
HXDLIN( 445) o3->_invalidate = null();
}
HXDLIN( 445) o3->next = ::zpp_nape::geom::ZPP_Vec2_obj::zpp_pool;
HXDLIN( 445) ::zpp_nape::geom::ZPP_Vec2_obj::zpp_pool = o3;
}
}
}
}
HXDLIN( 445) if (hx::IsNull( this->zpp_inner_zn->wrap_a2 )) {
HXLINE( 445) this->zpp_inner_zn->setup_a2();
}
}
HXLINE( 446) {
HXLINE( 446) {
HXLINE( 446) bool _hx_tmp42;
HXDLIN( 446) if (hx::IsNotNull( direction )) {
HXLINE( 446) _hx_tmp42 = direction->zpp_disp;
}
else {
HXLINE( 446) _hx_tmp42 = false;
}
HXDLIN( 446) if (_hx_tmp42) {
HXLINE( 446) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 446) if (hx::IsNull( direction )) {
HXLINE( 446) HX_STACK_DO_THROW(((HX_("Error: Constraint::",cb,f5,02,d5) + HX_("direction",3f,62,40,10)) + HX_(" cannot be null",07,dc,5d,15)));
}
HXDLIN( 446) {
HXLINE( 446) if (hx::IsNull( this->zpp_inner_zn->wrap_n )) {
HXLINE( 446) this->zpp_inner_zn->setup_n();
}
HXDLIN( 446) ::nape::geom::Vec2 _this18 = this->zpp_inner_zn->wrap_n;
HXDLIN( 446) bool _hx_tmp43;
HXDLIN( 446) if (hx::IsNotNull( _this18 )) {
HXLINE( 446) _hx_tmp43 = _this18->zpp_disp;
}
else {
HXLINE( 446) _hx_tmp43 = false;
}
HXDLIN( 446) if (_hx_tmp43) {
HXLINE( 446) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 446) bool _hx_tmp44;
HXDLIN( 446) if (hx::IsNotNull( direction )) {
HXLINE( 446) _hx_tmp44 = direction->zpp_disp;
}
else {
HXLINE( 446) _hx_tmp44 = false;
}
HXDLIN( 446) if (_hx_tmp44) {
HXLINE( 446) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 446) {
HXLINE( 446) ::zpp_nape::geom::ZPP_Vec2 _this19 = _this18->zpp_inner;
HXDLIN( 446) if (_this19->_immutable) {
HXLINE( 446) HX_STACK_DO_THROW(HX_("Error: Vec2 is immutable",60,ee,1f,bc));
}
HXDLIN( 446) if (hx::IsNotNull( _this19->_isimmutable )) {
HXLINE( 446) _this19->_isimmutable();
}
}
HXDLIN( 446) if (hx::IsNull( direction )) {
HXLINE( 446) HX_STACK_DO_THROW(HX_("Error: Cannot assign null Vec2",95,15,46,66));
}
HXDLIN( 446) bool _hx_tmp45;
HXDLIN( 446) if (hx::IsNotNull( direction )) {
HXLINE( 446) _hx_tmp45 = direction->zpp_disp;
}
else {
HXLINE( 446) _hx_tmp45 = false;
}
HXDLIN( 446) if (_hx_tmp45) {
HXLINE( 446) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 446) {
HXLINE( 446) ::zpp_nape::geom::ZPP_Vec2 _this20 = direction->zpp_inner;
HXDLIN( 446) if (hx::IsNotNull( _this20->_validate )) {
HXLINE( 446) _this20->_validate();
}
}
HXDLIN( 446) Float x2 = direction->zpp_inner->x;
HXDLIN( 446) bool _hx_tmp46;
HXDLIN( 446) if (hx::IsNotNull( direction )) {
HXLINE( 446) _hx_tmp46 = direction->zpp_disp;
}
else {
HXLINE( 446) _hx_tmp46 = false;
}
HXDLIN( 446) if (_hx_tmp46) {
HXLINE( 446) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 446) {
HXLINE( 446) ::zpp_nape::geom::ZPP_Vec2 _this21 = direction->zpp_inner;
HXDLIN( 446) if (hx::IsNotNull( _this21->_validate )) {
HXLINE( 446) _this21->_validate();
}
}
HXDLIN( 446) Float y2 = direction->zpp_inner->y;
HXDLIN( 446) bool _hx_tmp47;
HXDLIN( 446) if (hx::IsNotNull( _this18 )) {
HXLINE( 446) _hx_tmp47 = _this18->zpp_disp;
}
else {
HXLINE( 446) _hx_tmp47 = false;
}
HXDLIN( 446) if (_hx_tmp47) {
HXLINE( 446) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 446) {
HXLINE( 446) ::zpp_nape::geom::ZPP_Vec2 _this22 = _this18->zpp_inner;
HXDLIN( 446) if (_this22->_immutable) {
HXLINE( 446) HX_STACK_DO_THROW(HX_("Error: Vec2 is immutable",60,ee,1f,bc));
}
HXDLIN( 446) if (hx::IsNotNull( _this22->_isimmutable )) {
HXLINE( 446) _this22->_isimmutable();
}
}
HXDLIN( 446) bool _hx_tmp48;
HXDLIN( 446) if ((x2 == x2)) {
HXLINE( 446) _hx_tmp48 = (y2 != y2);
}
else {
HXLINE( 446) _hx_tmp48 = true;
}
HXDLIN( 446) if (_hx_tmp48) {
HXLINE( 446) HX_STACK_DO_THROW(HX_("Error: Vec2 components cannot be NaN",85,ba,d8,c1));
}
HXDLIN( 446) bool _hx_tmp49;
HXDLIN( 446) bool _hx_tmp50;
HXDLIN( 446) if (hx::IsNotNull( _this18 )) {
HXLINE( 446) _hx_tmp50 = _this18->zpp_disp;
}
else {
HXLINE( 446) _hx_tmp50 = false;
}
HXDLIN( 446) if (_hx_tmp50) {
HXLINE( 446) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 446) {
HXLINE( 446) ::zpp_nape::geom::ZPP_Vec2 _this23 = _this18->zpp_inner;
HXDLIN( 446) if (hx::IsNotNull( _this23->_validate )) {
HXLINE( 446) _this23->_validate();
}
}
HXDLIN( 446) if ((_this18->zpp_inner->x == x2)) {
HXLINE( 446) bool _hx_tmp51;
HXDLIN( 446) if (hx::IsNotNull( _this18 )) {
HXLINE( 446) _hx_tmp51 = _this18->zpp_disp;
}
else {
HXLINE( 446) _hx_tmp51 = false;
}
HXDLIN( 446) if (_hx_tmp51) {
HXLINE( 446) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 446) {
HXLINE( 446) ::zpp_nape::geom::ZPP_Vec2 _this24 = _this18->zpp_inner;
HXDLIN( 446) if (hx::IsNotNull( _this24->_validate )) {
HXLINE( 446) _this24->_validate();
}
}
HXDLIN( 446) _hx_tmp49 = (_this18->zpp_inner->y == y2);
}
else {
HXLINE( 446) _hx_tmp49 = false;
}
HXDLIN( 446) if (!(_hx_tmp49)) {
HXLINE( 446) {
HXLINE( 446) _this18->zpp_inner->x = x2;
HXDLIN( 446) _this18->zpp_inner->y = y2;
}
HXDLIN( 446) {
HXLINE( 446) ::zpp_nape::geom::ZPP_Vec2 _this25 = _this18->zpp_inner;
HXDLIN( 446) if (hx::IsNotNull( _this25->_invalidate )) {
HXLINE( 446) _this25->_invalidate(_this25);
}
}
}
HXDLIN( 446) ::nape::geom::Vec2 ret2 = _this18;
HXDLIN( 446) if (direction->zpp_inner->weak) {
HXLINE( 446) bool _hx_tmp52;
HXDLIN( 446) if (hx::IsNotNull( direction )) {
HXLINE( 446) _hx_tmp52 = direction->zpp_disp;
}
else {
HXLINE( 446) _hx_tmp52 = false;
}
HXDLIN( 446) if (_hx_tmp52) {
HXLINE( 446) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 446) {
HXLINE( 446) ::zpp_nape::geom::ZPP_Vec2 _this26 = direction->zpp_inner;
HXDLIN( 446) if (_this26->_immutable) {
HXLINE( 446) HX_STACK_DO_THROW(HX_("Error: Vec2 is immutable",60,ee,1f,bc));
}
HXDLIN( 446) if (hx::IsNotNull( _this26->_isimmutable )) {
HXLINE( 446) _this26->_isimmutable();
}
}
HXDLIN( 446) if (direction->zpp_inner->_inuse) {
HXLINE( 446) HX_STACK_DO_THROW(HX_("Error: This Vec2 is not disposable",b5,d1,d1,d8));
}
HXDLIN( 446) ::zpp_nape::geom::ZPP_Vec2 inner2 = direction->zpp_inner;
HXDLIN( 446) direction->zpp_inner->outer = null();
HXDLIN( 446) direction->zpp_inner = null();
HXDLIN( 446) {
HXLINE( 446) ::nape::geom::Vec2 o4 = direction;
HXDLIN( 446) o4->zpp_pool = null();
HXDLIN( 446) if (hx::IsNotNull( ::zpp_nape::util::ZPP_PubPool_obj::nextVec2 )) {
HXLINE( 446) ::zpp_nape::util::ZPP_PubPool_obj::nextVec2->zpp_pool = o4;
}
else {
HXLINE( 446) ::zpp_nape::util::ZPP_PubPool_obj::poolVec2 = o4;
}
HXDLIN( 446) ::zpp_nape::util::ZPP_PubPool_obj::nextVec2 = o4;
HXDLIN( 446) o4->zpp_disp = true;
}
HXDLIN( 446) {
HXLINE( 446) ::zpp_nape::geom::ZPP_Vec2 o5 = inner2;
HXDLIN( 446) {
HXLINE( 446) if (hx::IsNotNull( o5->outer )) {
HXLINE( 446) o5->outer->zpp_inner = null();
HXDLIN( 446) o5->outer = null();
}
HXDLIN( 446) o5->_isimmutable = null();
HXDLIN( 446) o5->_validate = null();
HXDLIN( 446) o5->_invalidate = null();
}
HXDLIN( 446) o5->next = ::zpp_nape::geom::ZPP_Vec2_obj::zpp_pool;
HXDLIN( 446) ::zpp_nape::geom::ZPP_Vec2_obj::zpp_pool = o5;
}
}
}
}
HXDLIN( 446) if (hx::IsNull( this->zpp_inner_zn->wrap_n )) {
HXLINE( 446) this->zpp_inner_zn->setup_n();
}
}
HXLINE( 447) {
HXLINE( 447) this->zpp_inner->immutable_midstep(HX_("LineJoint::jointMin",3e,e1,3a,51));
HXDLIN( 447) if ((jointMin != jointMin)) {
HXLINE( 447) HX_STACK_DO_THROW(HX_("Error: AngleJoint::jointMin cannot be NaN",a8,63,9e,8c));
}
HXDLIN( 447) if ((this->zpp_inner_zn->jointMin != jointMin)) {
HXLINE( 447) this->zpp_inner_zn->jointMin = jointMin;
HXDLIN( 447) this->zpp_inner->wake();
}
}
HXLINE( 448) {
HXLINE( 448) this->zpp_inner->immutable_midstep(HX_("LineJoint::jointMax",50,da,3a,51));
HXDLIN( 448) if ((jointMax != jointMax)) {
HXLINE( 448) HX_STACK_DO_THROW(HX_("Error: AngleJoint::jointMax cannot be NaN",3a,58,f1,24));
}
HXDLIN( 448) if ((this->zpp_inner_zn->jointMax != jointMax)) {
HXLINE( 448) this->zpp_inner_zn->jointMax = jointMax;
HXDLIN( 448) this->zpp_inner->wake();
}
}
}
Dynamic LineJoint_obj::__CreateEmpty() { return new LineJoint_obj; }
void *LineJoint_obj::_hx_vtable = 0;
Dynamic LineJoint_obj::__Create(hx::DynamicArray inArgs)
{
hx::ObjectPtr< LineJoint_obj > _hx_result = new LineJoint_obj();
_hx_result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6]);
return _hx_result;
}
bool LineJoint_obj::_hx_isInstanceOf(int inClassId) {
if (inClassId<=(int)0x00e9fd26) {
return inClassId==(int)0x00000001 || inClassId==(int)0x00e9fd26;
} else {
return inClassId==(int)0x4a50e1f1;
}
}
::nape::phys::Body LineJoint_obj::get_body1(){
HX_STACKFRAME(&_hx_pos_09c49cc38fbc8a37_222_get_body1)
HXDLIN( 222) if (hx::IsNull( this->zpp_inner_zn->b1 )) {
HXDLIN( 222) return null();
}
else {
HXDLIN( 222) return this->zpp_inner_zn->b1->outer;
}
HXDLIN( 222) return null();
}
HX_DEFINE_DYNAMIC_FUNC0(LineJoint_obj,get_body1,return )
::nape::phys::Body LineJoint_obj::set_body1( ::nape::phys::Body body1){
HX_STACKFRAME(&_hx_pos_09c49cc38fbc8a37_224_set_body1)
HXLINE( 225) {
HXLINE( 226) this->zpp_inner->immutable_midstep((HX_("Constraint::",7d,10,25,6e) + HX_("body1",4f,d3,ef,b6)));
HXLINE( 227) ::zpp_nape::phys::ZPP_Body inbody1;
HXDLIN( 227) if (hx::IsNull( body1 )) {
HXLINE( 227) inbody1 = null();
}
else {
HXLINE( 227) inbody1 = body1->zpp_inner;
}
HXLINE( 228) if (hx::IsNotEq( inbody1,this->zpp_inner_zn->b1 )) {
HXLINE( 229) if (hx::IsNotNull( this->zpp_inner_zn->b1 )) {
HXLINE( 230) bool _hx_tmp;
HXDLIN( 230) ::nape::space::Space _hx_tmp1;
HXDLIN( 230) if (hx::IsNull( this->zpp_inner->space )) {
HXLINE( 230) _hx_tmp1 = null();
}
else {
HXLINE( 230) _hx_tmp1 = this->zpp_inner->space->outer;
}
HXDLIN( 230) if (hx::IsNotNull( _hx_tmp1 )) {
HXLINE( 230) _hx_tmp = hx::IsNotEq( this->zpp_inner_zn->b2,this->zpp_inner_zn->b1 );
}
else {
HXLINE( 230) _hx_tmp = false;
}
HXDLIN( 230) if (_hx_tmp) {
HXLINE( 232) if (hx::IsNotNull( this->zpp_inner_zn->b1 )) {
HXLINE( 232) this->zpp_inner_zn->b1->constraints->remove(this->zpp_inner);
}
}
HXLINE( 235) bool _hx_tmp2;
HXDLIN( 235) if (this->zpp_inner->active) {
HXLINE( 235) ::nape::space::Space _hx_tmp3;
HXDLIN( 235) if (hx::IsNull( this->zpp_inner->space )) {
HXLINE( 235) _hx_tmp3 = null();
}
else {
HXLINE( 235) _hx_tmp3 = this->zpp_inner->space->outer;
}
HXDLIN( 235) _hx_tmp2 = hx::IsNotNull( _hx_tmp3 );
}
else {
HXLINE( 235) _hx_tmp2 = false;
}
HXDLIN( 235) if (_hx_tmp2) {
HXLINE( 235) this->zpp_inner_zn->b1->wake();
}
}
HXLINE( 237) this->zpp_inner_zn->b1 = inbody1;
HXLINE( 238) bool _hx_tmp4;
HXDLIN( 238) bool _hx_tmp5;
HXDLIN( 238) ::nape::space::Space _hx_tmp6;
HXDLIN( 238) if (hx::IsNull( this->zpp_inner->space )) {
HXLINE( 238) _hx_tmp6 = null();
}
else {
HXLINE( 238) _hx_tmp6 = this->zpp_inner->space->outer;
}
HXDLIN( 238) if (hx::IsNotNull( _hx_tmp6 )) {
HXLINE( 238) _hx_tmp5 = hx::IsNotNull( inbody1 );
}
else {
HXLINE( 238) _hx_tmp5 = false;
}
HXDLIN( 238) if (_hx_tmp5) {
HXLINE( 238) _hx_tmp4 = hx::IsNotEq( this->zpp_inner_zn->b2,inbody1 );
}
else {
HXLINE( 238) _hx_tmp4 = false;
}
HXDLIN( 238) if (_hx_tmp4) {
HXLINE( 240) if (hx::IsNotNull( inbody1 )) {
HXLINE( 240) inbody1->constraints->add(this->zpp_inner);
}
}
HXLINE( 243) bool _hx_tmp7;
HXDLIN( 243) if (this->zpp_inner->active) {
HXLINE( 243) ::nape::space::Space _hx_tmp8;
HXDLIN( 243) if (hx::IsNull( this->zpp_inner->space )) {
HXLINE( 243) _hx_tmp8 = null();
}
else {
HXLINE( 243) _hx_tmp8 = this->zpp_inner->space->outer;
}
HXDLIN( 243) _hx_tmp7 = hx::IsNotNull( _hx_tmp8 );
}
else {
HXLINE( 243) _hx_tmp7 = false;
}
HXDLIN( 243) if (_hx_tmp7) {
HXLINE( 244) this->zpp_inner->wake();
HXLINE( 245) if (hx::IsNotNull( inbody1 )) {
HXLINE( 245) inbody1->wake();
}
}
}
}
HXLINE( 249) if (hx::IsNull( this->zpp_inner_zn->b1 )) {
HXLINE( 249) return null();
}
else {
HXLINE( 249) return this->zpp_inner_zn->b1->outer;
}
HXDLIN( 249) return null();
}
HX_DEFINE_DYNAMIC_FUNC1(LineJoint_obj,set_body1,return )
::nape::phys::Body LineJoint_obj::get_body2(){
HX_STACKFRAME(&_hx_pos_09c49cc38fbc8a37_260_get_body2)
HXDLIN( 260) if (hx::IsNull( this->zpp_inner_zn->b2 )) {
HXDLIN( 260) return null();
}
else {
HXDLIN( 260) return this->zpp_inner_zn->b2->outer;
}
HXDLIN( 260) return null();
}
HX_DEFINE_DYNAMIC_FUNC0(LineJoint_obj,get_body2,return )
::nape::phys::Body LineJoint_obj::set_body2( ::nape::phys::Body body2){
HX_STACKFRAME(&_hx_pos_09c49cc38fbc8a37_262_set_body2)
HXLINE( 263) {
HXLINE( 264) this->zpp_inner->immutable_midstep((HX_("Constraint::",7d,10,25,6e) + HX_("body2",50,d3,ef,b6)));
HXLINE( 265) ::zpp_nape::phys::ZPP_Body inbody2;
HXDLIN( 265) if (hx::IsNull( body2 )) {
HXLINE( 265) inbody2 = null();
}
else {
HXLINE( 265) inbody2 = body2->zpp_inner;
}
HXLINE( 266) if (hx::IsNotEq( inbody2,this->zpp_inner_zn->b2 )) {
HXLINE( 267) if (hx::IsNotNull( this->zpp_inner_zn->b2 )) {
HXLINE( 268) bool _hx_tmp;
HXDLIN( 268) ::nape::space::Space _hx_tmp1;
HXDLIN( 268) if (hx::IsNull( this->zpp_inner->space )) {
HXLINE( 268) _hx_tmp1 = null();
}
else {
HXLINE( 268) _hx_tmp1 = this->zpp_inner->space->outer;
}
HXDLIN( 268) if (hx::IsNotNull( _hx_tmp1 )) {
HXLINE( 268) _hx_tmp = hx::IsNotEq( this->zpp_inner_zn->b1,this->zpp_inner_zn->b2 );
}
else {
HXLINE( 268) _hx_tmp = false;
}
HXDLIN( 268) if (_hx_tmp) {
HXLINE( 270) if (hx::IsNotNull( this->zpp_inner_zn->b2 )) {
HXLINE( 270) this->zpp_inner_zn->b2->constraints->remove(this->zpp_inner);
}
}
HXLINE( 273) bool _hx_tmp2;
HXDLIN( 273) if (this->zpp_inner->active) {
HXLINE( 273) ::nape::space::Space _hx_tmp3;
HXDLIN( 273) if (hx::IsNull( this->zpp_inner->space )) {
HXLINE( 273) _hx_tmp3 = null();
}
else {
HXLINE( 273) _hx_tmp3 = this->zpp_inner->space->outer;
}
HXDLIN( 273) _hx_tmp2 = hx::IsNotNull( _hx_tmp3 );
}
else {
HXLINE( 273) _hx_tmp2 = false;
}
HXDLIN( 273) if (_hx_tmp2) {
HXLINE( 273) this->zpp_inner_zn->b2->wake();
}
}
HXLINE( 275) this->zpp_inner_zn->b2 = inbody2;
HXLINE( 276) bool _hx_tmp4;
HXDLIN( 276) bool _hx_tmp5;
HXDLIN( 276) ::nape::space::Space _hx_tmp6;
HXDLIN( 276) if (hx::IsNull( this->zpp_inner->space )) {
HXLINE( 276) _hx_tmp6 = null();
}
else {
HXLINE( 276) _hx_tmp6 = this->zpp_inner->space->outer;
}
HXDLIN( 276) if (hx::IsNotNull( _hx_tmp6 )) {
HXLINE( 276) _hx_tmp5 = hx::IsNotNull( inbody2 );
}
else {
HXLINE( 276) _hx_tmp5 = false;
}
HXDLIN( 276) if (_hx_tmp5) {
HXLINE( 276) _hx_tmp4 = hx::IsNotEq( this->zpp_inner_zn->b1,inbody2 );
}
else {
HXLINE( 276) _hx_tmp4 = false;
}
HXDLIN( 276) if (_hx_tmp4) {
HXLINE( 278) if (hx::IsNotNull( inbody2 )) {
HXLINE( 278) inbody2->constraints->add(this->zpp_inner);
}
}
HXLINE( 281) bool _hx_tmp7;
HXDLIN( 281) if (this->zpp_inner->active) {
HXLINE( 281) ::nape::space::Space _hx_tmp8;
HXDLIN( 281) if (hx::IsNull( this->zpp_inner->space )) {
HXLINE( 281) _hx_tmp8 = null();
}
else {
HXLINE( 281) _hx_tmp8 = this->zpp_inner->space->outer;
}
HXDLIN( 281) _hx_tmp7 = hx::IsNotNull( _hx_tmp8 );
}
else {
HXLINE( 281) _hx_tmp7 = false;
}
HXDLIN( 281) if (_hx_tmp7) {
HXLINE( 282) this->zpp_inner->wake();
HXLINE( 283) if (hx::IsNotNull( inbody2 )) {
HXLINE( 283) inbody2->wake();
}
}
}
}
HXLINE( 287) if (hx::IsNull( this->zpp_inner_zn->b2 )) {
HXLINE( 287) return null();
}
else {
HXLINE( 287) return this->zpp_inner_zn->b2->outer;
}
HXDLIN( 287) return null();
}
HX_DEFINE_DYNAMIC_FUNC1(LineJoint_obj,set_body2,return )
::nape::geom::Vec2 LineJoint_obj::get_anchor1(){
HX_STACKFRAME(&_hx_pos_09c49cc38fbc8a37_296_get_anchor1)
HXLINE( 297) if (hx::IsNull( this->zpp_inner_zn->wrap_a1 )) {
HXLINE( 297) this->zpp_inner_zn->setup_a1();
}
HXLINE( 298) return this->zpp_inner_zn->wrap_a1;
}
HX_DEFINE_DYNAMIC_FUNC0(LineJoint_obj,get_anchor1,return )
::nape::geom::Vec2 LineJoint_obj::set_anchor1( ::nape::geom::Vec2 anchor1){
HX_STACKFRAME(&_hx_pos_09c49cc38fbc8a37_300_set_anchor1)
HXLINE( 301) {
HXLINE( 304) bool _hx_tmp;
HXDLIN( 304) if (hx::IsNotNull( anchor1 )) {
HXLINE( 304) _hx_tmp = anchor1->zpp_disp;
}
else {
HXLINE( 304) _hx_tmp = false;
}
HXDLIN( 304) if (_hx_tmp) {
HXLINE( 304) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXLINE( 308) if (hx::IsNull( anchor1 )) {
HXLINE( 308) HX_STACK_DO_THROW(((HX_("Error: Constraint::",cb,f5,02,d5) + HX_("anchor1",1c,ec,a1,02)) + HX_(" cannot be null",07,dc,5d,15)));
}
HXLINE( 310) {
HXLINE( 310) if (hx::IsNull( this->zpp_inner_zn->wrap_a1 )) {
HXLINE( 310) this->zpp_inner_zn->setup_a1();
}
HXDLIN( 310) ::nape::geom::Vec2 _this = this->zpp_inner_zn->wrap_a1;
HXDLIN( 310) bool _hx_tmp1;
HXDLIN( 310) if (hx::IsNotNull( _this )) {
HXLINE( 310) _hx_tmp1 = _this->zpp_disp;
}
else {
HXLINE( 310) _hx_tmp1 = false;
}
HXDLIN( 310) if (_hx_tmp1) {
HXLINE( 310) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 310) bool _hx_tmp2;
HXDLIN( 310) if (hx::IsNotNull( anchor1 )) {
HXLINE( 310) _hx_tmp2 = anchor1->zpp_disp;
}
else {
HXLINE( 310) _hx_tmp2 = false;
}
HXDLIN( 310) if (_hx_tmp2) {
HXLINE( 310) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 310) {
HXLINE( 310) ::zpp_nape::geom::ZPP_Vec2 _this1 = _this->zpp_inner;
HXDLIN( 310) if (_this1->_immutable) {
HXLINE( 310) HX_STACK_DO_THROW(HX_("Error: Vec2 is immutable",60,ee,1f,bc));
}
HXDLIN( 310) if (hx::IsNotNull( _this1->_isimmutable )) {
HXLINE( 310) _this1->_isimmutable();
}
}
HXDLIN( 310) if (hx::IsNull( anchor1 )) {
HXLINE( 310) HX_STACK_DO_THROW(HX_("Error: Cannot assign null Vec2",95,15,46,66));
}
HXDLIN( 310) bool _hx_tmp3;
HXDLIN( 310) if (hx::IsNotNull( anchor1 )) {
HXLINE( 310) _hx_tmp3 = anchor1->zpp_disp;
}
else {
HXLINE( 310) _hx_tmp3 = false;
}
HXDLIN( 310) if (_hx_tmp3) {
HXLINE( 310) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 310) {
HXLINE( 310) ::zpp_nape::geom::ZPP_Vec2 _this2 = anchor1->zpp_inner;
HXDLIN( 310) if (hx::IsNotNull( _this2->_validate )) {
HXLINE( 310) _this2->_validate();
}
}
HXDLIN( 310) Float x = anchor1->zpp_inner->x;
HXDLIN( 310) bool _hx_tmp4;
HXDLIN( 310) if (hx::IsNotNull( anchor1 )) {
HXLINE( 310) _hx_tmp4 = anchor1->zpp_disp;
}
else {
HXLINE( 310) _hx_tmp4 = false;
}
HXDLIN( 310) if (_hx_tmp4) {
HXLINE( 310) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 310) {
HXLINE( 310) ::zpp_nape::geom::ZPP_Vec2 _this3 = anchor1->zpp_inner;
HXDLIN( 310) if (hx::IsNotNull( _this3->_validate )) {
HXLINE( 310) _this3->_validate();
}
}
HXDLIN( 310) Float y = anchor1->zpp_inner->y;
HXDLIN( 310) bool _hx_tmp5;
HXDLIN( 310) if (hx::IsNotNull( _this )) {
HXLINE( 310) _hx_tmp5 = _this->zpp_disp;
}
else {
HXLINE( 310) _hx_tmp5 = false;
}
HXDLIN( 310) if (_hx_tmp5) {
HXLINE( 310) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 310) {
HXLINE( 310) ::zpp_nape::geom::ZPP_Vec2 _this4 = _this->zpp_inner;
HXDLIN( 310) if (_this4->_immutable) {
HXLINE( 310) HX_STACK_DO_THROW(HX_("Error: Vec2 is immutable",60,ee,1f,bc));
}
HXDLIN( 310) if (hx::IsNotNull( _this4->_isimmutable )) {
HXLINE( 310) _this4->_isimmutable();
}
}
HXDLIN( 310) bool _hx_tmp6;
HXDLIN( 310) if ((x == x)) {
HXLINE( 310) _hx_tmp6 = (y != y);
}
else {
HXLINE( 310) _hx_tmp6 = true;
}
HXDLIN( 310) if (_hx_tmp6) {
HXLINE( 310) HX_STACK_DO_THROW(HX_("Error: Vec2 components cannot be NaN",85,ba,d8,c1));
}
HXDLIN( 310) bool _hx_tmp7;
HXDLIN( 310) bool _hx_tmp8;
HXDLIN( 310) if (hx::IsNotNull( _this )) {
HXLINE( 310) _hx_tmp8 = _this->zpp_disp;
}
else {
HXLINE( 310) _hx_tmp8 = false;
}
HXDLIN( 310) if (_hx_tmp8) {
HXLINE( 310) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 310) {
HXLINE( 310) ::zpp_nape::geom::ZPP_Vec2 _this5 = _this->zpp_inner;
HXDLIN( 310) if (hx::IsNotNull( _this5->_validate )) {
HXLINE( 310) _this5->_validate();
}
}
HXDLIN( 310) if ((_this->zpp_inner->x == x)) {
HXLINE( 310) bool _hx_tmp9;
HXDLIN( 310) if (hx::IsNotNull( _this )) {
HXLINE( 310) _hx_tmp9 = _this->zpp_disp;
}
else {
HXLINE( 310) _hx_tmp9 = false;
}
HXDLIN( 310) if (_hx_tmp9) {
HXLINE( 310) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 310) {
HXLINE( 310) ::zpp_nape::geom::ZPP_Vec2 _this6 = _this->zpp_inner;
HXDLIN( 310) if (hx::IsNotNull( _this6->_validate )) {
HXLINE( 310) _this6->_validate();
}
}
HXDLIN( 310) _hx_tmp7 = (_this->zpp_inner->y == y);
}
else {
HXLINE( 310) _hx_tmp7 = false;
}
HXDLIN( 310) if (!(_hx_tmp7)) {
HXLINE( 310) {
HXLINE( 310) _this->zpp_inner->x = x;
HXDLIN( 310) _this->zpp_inner->y = y;
}
HXDLIN( 310) {
HXLINE( 310) ::zpp_nape::geom::ZPP_Vec2 _this7 = _this->zpp_inner;
HXDLIN( 310) if (hx::IsNotNull( _this7->_invalidate )) {
HXLINE( 310) _this7->_invalidate(_this7);
}
}
}
HXDLIN( 310) ::nape::geom::Vec2 ret = _this;
HXDLIN( 310) if (anchor1->zpp_inner->weak) {
HXLINE( 310) bool _hx_tmp10;
HXDLIN( 310) if (hx::IsNotNull( anchor1 )) {
HXLINE( 310) _hx_tmp10 = anchor1->zpp_disp;
}
else {
HXLINE( 310) _hx_tmp10 = false;
}
HXDLIN( 310) if (_hx_tmp10) {
HXLINE( 310) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 310) {
HXLINE( 310) ::zpp_nape::geom::ZPP_Vec2 _this8 = anchor1->zpp_inner;
HXDLIN( 310) if (_this8->_immutable) {
HXLINE( 310) HX_STACK_DO_THROW(HX_("Error: Vec2 is immutable",60,ee,1f,bc));
}
HXDLIN( 310) if (hx::IsNotNull( _this8->_isimmutable )) {
HXLINE( 310) _this8->_isimmutable();
}
}
HXDLIN( 310) if (anchor1->zpp_inner->_inuse) {
HXLINE( 310) HX_STACK_DO_THROW(HX_("Error: This Vec2 is not disposable",b5,d1,d1,d8));
}
HXDLIN( 310) ::zpp_nape::geom::ZPP_Vec2 inner = anchor1->zpp_inner;
HXDLIN( 310) anchor1->zpp_inner->outer = null();
HXDLIN( 310) anchor1->zpp_inner = null();
HXDLIN( 310) {
HXLINE( 310) ::nape::geom::Vec2 o = anchor1;
HXDLIN( 310) o->zpp_pool = null();
HXDLIN( 310) if (hx::IsNotNull( ::zpp_nape::util::ZPP_PubPool_obj::nextVec2 )) {
HXLINE( 310) ::zpp_nape::util::ZPP_PubPool_obj::nextVec2->zpp_pool = o;
}
else {
HXLINE( 310) ::zpp_nape::util::ZPP_PubPool_obj::poolVec2 = o;
}
HXDLIN( 310) ::zpp_nape::util::ZPP_PubPool_obj::nextVec2 = o;
HXDLIN( 310) o->zpp_disp = true;
}
HXDLIN( 310) {
HXLINE( 310) ::zpp_nape::geom::ZPP_Vec2 o1 = inner;
HXDLIN( 310) {
HXLINE( 310) if (hx::IsNotNull( o1->outer )) {
HXLINE( 310) o1->outer->zpp_inner = null();
HXDLIN( 310) o1->outer = null();
}
HXDLIN( 310) o1->_isimmutable = null();
HXDLIN( 310) o1->_validate = null();
HXDLIN( 310) o1->_invalidate = null();
}
HXDLIN( 310) o1->next = ::zpp_nape::geom::ZPP_Vec2_obj::zpp_pool;
HXDLIN( 310) ::zpp_nape::geom::ZPP_Vec2_obj::zpp_pool = o1;
}
}
}
}
HXLINE( 312) if (hx::IsNull( this->zpp_inner_zn->wrap_a1 )) {
HXLINE( 312) this->zpp_inner_zn->setup_a1();
}
HXDLIN( 312) return this->zpp_inner_zn->wrap_a1;
}
HX_DEFINE_DYNAMIC_FUNC1(LineJoint_obj,set_anchor1,return )
::nape::geom::Vec2 LineJoint_obj::get_anchor2(){
HX_STACKFRAME(&_hx_pos_09c49cc38fbc8a37_321_get_anchor2)
HXLINE( 322) if (hx::IsNull( this->zpp_inner_zn->wrap_a2 )) {
HXLINE( 322) this->zpp_inner_zn->setup_a2();
}
HXLINE( 323) return this->zpp_inner_zn->wrap_a2;
}
HX_DEFINE_DYNAMIC_FUNC0(LineJoint_obj,get_anchor2,return )
::nape::geom::Vec2 LineJoint_obj::set_anchor2( ::nape::geom::Vec2 anchor2){
HX_STACKFRAME(&_hx_pos_09c49cc38fbc8a37_325_set_anchor2)
HXLINE( 326) {
HXLINE( 329) bool _hx_tmp;
HXDLIN( 329) if (hx::IsNotNull( anchor2 )) {
HXLINE( 329) _hx_tmp = anchor2->zpp_disp;
}
else {
HXLINE( 329) _hx_tmp = false;
}
HXDLIN( 329) if (_hx_tmp) {
HXLINE( 329) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXLINE( 333) if (hx::IsNull( anchor2 )) {
HXLINE( 333) HX_STACK_DO_THROW(((HX_("Error: Constraint::",cb,f5,02,d5) + HX_("anchor2",1d,ec,a1,02)) + HX_(" cannot be null",07,dc,5d,15)));
}
HXLINE( 335) {
HXLINE( 335) if (hx::IsNull( this->zpp_inner_zn->wrap_a2 )) {
HXLINE( 335) this->zpp_inner_zn->setup_a2();
}
HXDLIN( 335) ::nape::geom::Vec2 _this = this->zpp_inner_zn->wrap_a2;
HXDLIN( 335) bool _hx_tmp1;
HXDLIN( 335) if (hx::IsNotNull( _this )) {
HXLINE( 335) _hx_tmp1 = _this->zpp_disp;
}
else {
HXLINE( 335) _hx_tmp1 = false;
}
HXDLIN( 335) if (_hx_tmp1) {
HXLINE( 335) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 335) bool _hx_tmp2;
HXDLIN( 335) if (hx::IsNotNull( anchor2 )) {
HXLINE( 335) _hx_tmp2 = anchor2->zpp_disp;
}
else {
HXLINE( 335) _hx_tmp2 = false;
}
HXDLIN( 335) if (_hx_tmp2) {
HXLINE( 335) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 335) {
HXLINE( 335) ::zpp_nape::geom::ZPP_Vec2 _this1 = _this->zpp_inner;
HXDLIN( 335) if (_this1->_immutable) {
HXLINE( 335) HX_STACK_DO_THROW(HX_("Error: Vec2 is immutable",60,ee,1f,bc));
}
HXDLIN( 335) if (hx::IsNotNull( _this1->_isimmutable )) {
HXLINE( 335) _this1->_isimmutable();
}
}
HXDLIN( 335) if (hx::IsNull( anchor2 )) {
HXLINE( 335) HX_STACK_DO_THROW(HX_("Error: Cannot assign null Vec2",95,15,46,66));
}
HXDLIN( 335) bool _hx_tmp3;
HXDLIN( 335) if (hx::IsNotNull( anchor2 )) {
HXLINE( 335) _hx_tmp3 = anchor2->zpp_disp;
}
else {
HXLINE( 335) _hx_tmp3 = false;
}
HXDLIN( 335) if (_hx_tmp3) {
HXLINE( 335) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 335) {
HXLINE( 335) ::zpp_nape::geom::ZPP_Vec2 _this2 = anchor2->zpp_inner;
HXDLIN( 335) if (hx::IsNotNull( _this2->_validate )) {
HXLINE( 335) _this2->_validate();
}
}
HXDLIN( 335) Float x = anchor2->zpp_inner->x;
HXDLIN( 335) bool _hx_tmp4;
HXDLIN( 335) if (hx::IsNotNull( anchor2 )) {
HXLINE( 335) _hx_tmp4 = anchor2->zpp_disp;
}
else {
HXLINE( 335) _hx_tmp4 = false;
}
HXDLIN( 335) if (_hx_tmp4) {
HXLINE( 335) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 335) {
HXLINE( 335) ::zpp_nape::geom::ZPP_Vec2 _this3 = anchor2->zpp_inner;
HXDLIN( 335) if (hx::IsNotNull( _this3->_validate )) {
HXLINE( 335) _this3->_validate();
}
}
HXDLIN( 335) Float y = anchor2->zpp_inner->y;
HXDLIN( 335) bool _hx_tmp5;
HXDLIN( 335) if (hx::IsNotNull( _this )) {
HXLINE( 335) _hx_tmp5 = _this->zpp_disp;
}
else {
HXLINE( 335) _hx_tmp5 = false;
}
HXDLIN( 335) if (_hx_tmp5) {
HXLINE( 335) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 335) {
HXLINE( 335) ::zpp_nape::geom::ZPP_Vec2 _this4 = _this->zpp_inner;
HXDLIN( 335) if (_this4->_immutable) {
HXLINE( 335) HX_STACK_DO_THROW(HX_("Error: Vec2 is immutable",60,ee,1f,bc));
}
HXDLIN( 335) if (hx::IsNotNull( _this4->_isimmutable )) {
HXLINE( 335) _this4->_isimmutable();
}
}
HXDLIN( 335) bool _hx_tmp6;
HXDLIN( 335) if ((x == x)) {
HXLINE( 335) _hx_tmp6 = (y != y);
}
else {
HXLINE( 335) _hx_tmp6 = true;
}
HXDLIN( 335) if (_hx_tmp6) {
HXLINE( 335) HX_STACK_DO_THROW(HX_("Error: Vec2 components cannot be NaN",85,ba,d8,c1));
}
HXDLIN( 335) bool _hx_tmp7;
HXDLIN( 335) bool _hx_tmp8;
HXDLIN( 335) if (hx::IsNotNull( _this )) {
HXLINE( 335) _hx_tmp8 = _this->zpp_disp;
}
else {
HXLINE( 335) _hx_tmp8 = false;
}
HXDLIN( 335) if (_hx_tmp8) {
HXLINE( 335) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 335) {
HXLINE( 335) ::zpp_nape::geom::ZPP_Vec2 _this5 = _this->zpp_inner;
HXDLIN( 335) if (hx::IsNotNull( _this5->_validate )) {
HXLINE( 335) _this5->_validate();
}
}
HXDLIN( 335) if ((_this->zpp_inner->x == x)) {
HXLINE( 335) bool _hx_tmp9;
HXDLIN( 335) if (hx::IsNotNull( _this )) {
HXLINE( 335) _hx_tmp9 = _this->zpp_disp;
}
else {
HXLINE( 335) _hx_tmp9 = false;
}
HXDLIN( 335) if (_hx_tmp9) {
HXLINE( 335) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 335) {
HXLINE( 335) ::zpp_nape::geom::ZPP_Vec2 _this6 = _this->zpp_inner;
HXDLIN( 335) if (hx::IsNotNull( _this6->_validate )) {
HXLINE( 335) _this6->_validate();
}
}
HXDLIN( 335) _hx_tmp7 = (_this->zpp_inner->y == y);
}
else {
HXLINE( 335) _hx_tmp7 = false;
}
HXDLIN( 335) if (!(_hx_tmp7)) {
HXLINE( 335) {
HXLINE( 335) _this->zpp_inner->x = x;
HXDLIN( 335) _this->zpp_inner->y = y;
}
HXDLIN( 335) {
HXLINE( 335) ::zpp_nape::geom::ZPP_Vec2 _this7 = _this->zpp_inner;
HXDLIN( 335) if (hx::IsNotNull( _this7->_invalidate )) {
HXLINE( 335) _this7->_invalidate(_this7);
}
}
}
HXDLIN( 335) ::nape::geom::Vec2 ret = _this;
HXDLIN( 335) if (anchor2->zpp_inner->weak) {
HXLINE( 335) bool _hx_tmp10;
HXDLIN( 335) if (hx::IsNotNull( anchor2 )) {
HXLINE( 335) _hx_tmp10 = anchor2->zpp_disp;
}
else {
HXLINE( 335) _hx_tmp10 = false;
}
HXDLIN( 335) if (_hx_tmp10) {
HXLINE( 335) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 335) {
HXLINE( 335) ::zpp_nape::geom::ZPP_Vec2 _this8 = anchor2->zpp_inner;
HXDLIN( 335) if (_this8->_immutable) {
HXLINE( 335) HX_STACK_DO_THROW(HX_("Error: Vec2 is immutable",60,ee,1f,bc));
}
HXDLIN( 335) if (hx::IsNotNull( _this8->_isimmutable )) {
HXLINE( 335) _this8->_isimmutable();
}
}
HXDLIN( 335) if (anchor2->zpp_inner->_inuse) {
HXLINE( 335) HX_STACK_DO_THROW(HX_("Error: This Vec2 is not disposable",b5,d1,d1,d8));
}
HXDLIN( 335) ::zpp_nape::geom::ZPP_Vec2 inner = anchor2->zpp_inner;
HXDLIN( 335) anchor2->zpp_inner->outer = null();
HXDLIN( 335) anchor2->zpp_inner = null();
HXDLIN( 335) {
HXLINE( 335) ::nape::geom::Vec2 o = anchor2;
HXDLIN( 335) o->zpp_pool = null();
HXDLIN( 335) if (hx::IsNotNull( ::zpp_nape::util::ZPP_PubPool_obj::nextVec2 )) {
HXLINE( 335) ::zpp_nape::util::ZPP_PubPool_obj::nextVec2->zpp_pool = o;
}
else {
HXLINE( 335) ::zpp_nape::util::ZPP_PubPool_obj::poolVec2 = o;
}
HXDLIN( 335) ::zpp_nape::util::ZPP_PubPool_obj::nextVec2 = o;
HXDLIN( 335) o->zpp_disp = true;
}
HXDLIN( 335) {
HXLINE( 335) ::zpp_nape::geom::ZPP_Vec2 o1 = inner;
HXDLIN( 335) {
HXLINE( 335) if (hx::IsNotNull( o1->outer )) {
HXLINE( 335) o1->outer->zpp_inner = null();
HXDLIN( 335) o1->outer = null();
}
HXDLIN( 335) o1->_isimmutable = null();
HXDLIN( 335) o1->_validate = null();
HXDLIN( 335) o1->_invalidate = null();
}
HXDLIN( 335) o1->next = ::zpp_nape::geom::ZPP_Vec2_obj::zpp_pool;
HXDLIN( 335) ::zpp_nape::geom::ZPP_Vec2_obj::zpp_pool = o1;
}
}
}
}
HXLINE( 337) if (hx::IsNull( this->zpp_inner_zn->wrap_a2 )) {
HXLINE( 337) this->zpp_inner_zn->setup_a2();
}
HXDLIN( 337) return this->zpp_inner_zn->wrap_a2;
}
HX_DEFINE_DYNAMIC_FUNC1(LineJoint_obj,set_anchor2,return )
::nape::geom::Vec2 LineJoint_obj::get_direction(){
HX_STACKFRAME(&_hx_pos_09c49cc38fbc8a37_347_get_direction)
HXLINE( 348) if (hx::IsNull( this->zpp_inner_zn->wrap_n )) {
HXLINE( 348) this->zpp_inner_zn->setup_n();
}
HXLINE( 349) return this->zpp_inner_zn->wrap_n;
}
HX_DEFINE_DYNAMIC_FUNC0(LineJoint_obj,get_direction,return )
::nape::geom::Vec2 LineJoint_obj::set_direction( ::nape::geom::Vec2 direction){
HX_STACKFRAME(&_hx_pos_09c49cc38fbc8a37_351_set_direction)
HXLINE( 352) {
HXLINE( 355) bool _hx_tmp;
HXDLIN( 355) if (hx::IsNotNull( direction )) {
HXLINE( 355) _hx_tmp = direction->zpp_disp;
}
else {
HXLINE( 355) _hx_tmp = false;
}
HXDLIN( 355) if (_hx_tmp) {
HXLINE( 355) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXLINE( 359) if (hx::IsNull( direction )) {
HXLINE( 359) HX_STACK_DO_THROW(((HX_("Error: Constraint::",cb,f5,02,d5) + HX_("direction",3f,62,40,10)) + HX_(" cannot be null",07,dc,5d,15)));
}
HXLINE( 361) {
HXLINE( 361) if (hx::IsNull( this->zpp_inner_zn->wrap_n )) {
HXLINE( 361) this->zpp_inner_zn->setup_n();
}
HXDLIN( 361) ::nape::geom::Vec2 _this = this->zpp_inner_zn->wrap_n;
HXDLIN( 361) bool _hx_tmp1;
HXDLIN( 361) if (hx::IsNotNull( _this )) {
HXLINE( 361) _hx_tmp1 = _this->zpp_disp;
}
else {
HXLINE( 361) _hx_tmp1 = false;
}
HXDLIN( 361) if (_hx_tmp1) {
HXLINE( 361) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 361) bool _hx_tmp2;
HXDLIN( 361) if (hx::IsNotNull( direction )) {
HXLINE( 361) _hx_tmp2 = direction->zpp_disp;
}
else {
HXLINE( 361) _hx_tmp2 = false;
}
HXDLIN( 361) if (_hx_tmp2) {
HXLINE( 361) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 361) {
HXLINE( 361) ::zpp_nape::geom::ZPP_Vec2 _this1 = _this->zpp_inner;
HXDLIN( 361) if (_this1->_immutable) {
HXLINE( 361) HX_STACK_DO_THROW(HX_("Error: Vec2 is immutable",60,ee,1f,bc));
}
HXDLIN( 361) if (hx::IsNotNull( _this1->_isimmutable )) {
HXLINE( 361) _this1->_isimmutable();
}
}
HXDLIN( 361) if (hx::IsNull( direction )) {
HXLINE( 361) HX_STACK_DO_THROW(HX_("Error: Cannot assign null Vec2",95,15,46,66));
}
HXDLIN( 361) bool _hx_tmp3;
HXDLIN( 361) if (hx::IsNotNull( direction )) {
HXLINE( 361) _hx_tmp3 = direction->zpp_disp;
}
else {
HXLINE( 361) _hx_tmp3 = false;
}
HXDLIN( 361) if (_hx_tmp3) {
HXLINE( 361) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 361) {
HXLINE( 361) ::zpp_nape::geom::ZPP_Vec2 _this2 = direction->zpp_inner;
HXDLIN( 361) if (hx::IsNotNull( _this2->_validate )) {
HXLINE( 361) _this2->_validate();
}
}
HXDLIN( 361) Float x = direction->zpp_inner->x;
HXDLIN( 361) bool _hx_tmp4;
HXDLIN( 361) if (hx::IsNotNull( direction )) {
HXLINE( 361) _hx_tmp4 = direction->zpp_disp;
}
else {
HXLINE( 361) _hx_tmp4 = false;
}
HXDLIN( 361) if (_hx_tmp4) {
HXLINE( 361) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 361) {
HXLINE( 361) ::zpp_nape::geom::ZPP_Vec2 _this3 = direction->zpp_inner;
HXDLIN( 361) if (hx::IsNotNull( _this3->_validate )) {
HXLINE( 361) _this3->_validate();
}
}
HXDLIN( 361) Float y = direction->zpp_inner->y;
HXDLIN( 361) bool _hx_tmp5;
HXDLIN( 361) if (hx::IsNotNull( _this )) {
HXLINE( 361) _hx_tmp5 = _this->zpp_disp;
}
else {
HXLINE( 361) _hx_tmp5 = false;
}
HXDLIN( 361) if (_hx_tmp5) {
HXLINE( 361) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 361) {
HXLINE( 361) ::zpp_nape::geom::ZPP_Vec2 _this4 = _this->zpp_inner;
HXDLIN( 361) if (_this4->_immutable) {
HXLINE( 361) HX_STACK_DO_THROW(HX_("Error: Vec2 is immutable",60,ee,1f,bc));
}
HXDLIN( 361) if (hx::IsNotNull( _this4->_isimmutable )) {
HXLINE( 361) _this4->_isimmutable();
}
}
HXDLIN( 361) bool _hx_tmp6;
HXDLIN( 361) if ((x == x)) {
HXLINE( 361) _hx_tmp6 = (y != y);
}
else {
HXLINE( 361) _hx_tmp6 = true;
}
HXDLIN( 361) if (_hx_tmp6) {
HXLINE( 361) HX_STACK_DO_THROW(HX_("Error: Vec2 components cannot be NaN",85,ba,d8,c1));
}
HXDLIN( 361) bool _hx_tmp7;
HXDLIN( 361) bool _hx_tmp8;
HXDLIN( 361) if (hx::IsNotNull( _this )) {
HXLINE( 361) _hx_tmp8 = _this->zpp_disp;
}
else {
HXLINE( 361) _hx_tmp8 = false;
}
HXDLIN( 361) if (_hx_tmp8) {
HXLINE( 361) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 361) {
HXLINE( 361) ::zpp_nape::geom::ZPP_Vec2 _this5 = _this->zpp_inner;
HXDLIN( 361) if (hx::IsNotNull( _this5->_validate )) {
HXLINE( 361) _this5->_validate();
}
}
HXDLIN( 361) if ((_this->zpp_inner->x == x)) {
HXLINE( 361) bool _hx_tmp9;
HXDLIN( 361) if (hx::IsNotNull( _this )) {
HXLINE( 361) _hx_tmp9 = _this->zpp_disp;
}
else {
HXLINE( 361) _hx_tmp9 = false;
}
HXDLIN( 361) if (_hx_tmp9) {
HXLINE( 361) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 361) {
HXLINE( 361) ::zpp_nape::geom::ZPP_Vec2 _this6 = _this->zpp_inner;
HXDLIN( 361) if (hx::IsNotNull( _this6->_validate )) {
HXLINE( 361) _this6->_validate();
}
}
HXDLIN( 361) _hx_tmp7 = (_this->zpp_inner->y == y);
}
else {
HXLINE( 361) _hx_tmp7 = false;
}
HXDLIN( 361) if (!(_hx_tmp7)) {
HXLINE( 361) {
HXLINE( 361) _this->zpp_inner->x = x;
HXDLIN( 361) _this->zpp_inner->y = y;
}
HXDLIN( 361) {
HXLINE( 361) ::zpp_nape::geom::ZPP_Vec2 _this7 = _this->zpp_inner;
HXDLIN( 361) if (hx::IsNotNull( _this7->_invalidate )) {
HXLINE( 361) _this7->_invalidate(_this7);
}
}
}
HXDLIN( 361) ::nape::geom::Vec2 ret = _this;
HXDLIN( 361) if (direction->zpp_inner->weak) {
HXLINE( 361) bool _hx_tmp10;
HXDLIN( 361) if (hx::IsNotNull( direction )) {
HXLINE( 361) _hx_tmp10 = direction->zpp_disp;
}
else {
HXLINE( 361) _hx_tmp10 = false;
}
HXDLIN( 361) if (_hx_tmp10) {
HXLINE( 361) HX_STACK_DO_THROW(((HX_("Error: ",4e,a8,5b,b7) + HX_("Vec2",7e,53,25,39)) + HX_(" has been disposed and cannot be used!",2e,07,ae,74)));
}
HXDLIN( 361) {
HXLINE( 361) ::zpp_nape::geom::ZPP_Vec2 _this8 = direction->zpp_inner;
HXDLIN( 361) if (_this8->_immutable) {
HXLINE( 361) HX_STACK_DO_THROW(HX_("Error: Vec2 is immutable",60,ee,1f,bc));
}
HXDLIN( 361) if (hx::IsNotNull( _this8->_isimmutable )) {
HXLINE( 361) _this8->_isimmutable();
}
}
HXDLIN( 361) if (direction->zpp_inner->_inuse) {
HXLINE( 361) HX_STACK_DO_THROW(HX_("Error: This Vec2 is not disposable",b5,d1,d1,d8));
}
HXDLIN( 361) ::zpp_nape::geom::ZPP_Vec2 inner = direction->zpp_inner;
HXDLIN( 361) direction->zpp_inner->outer = null();
HXDLIN( 361) direction->zpp_inner = null();
HXDLIN( 361) {
HXLINE( 361) ::nape::geom::Vec2 o = direction;
HXDLIN( 361) o->zpp_pool = null();
HXDLIN( 361) if (hx::IsNotNull( ::zpp_nape::util::ZPP_PubPool_obj::nextVec2 )) {
HXLINE( 361) ::zpp_nape::util::ZPP_PubPool_obj::nextVec2->zpp_pool = o;
}
else {
HXLINE( 361) ::zpp_nape::util::ZPP_PubPool_obj::poolVec2 = o;
}
HXDLIN( 361) ::zpp_nape::util::ZPP_PubPool_obj::nextVec2 = o;
HXDLIN( 361) o->zpp_disp = true;
}
HXDLIN( 361) {
HXLINE( 361) ::zpp_nape::geom::ZPP_Vec2 o1 = inner;
HXDLIN( 361) {
HXLINE( 361) if (hx::IsNotNull( o1->outer )) {
HXLINE( 361) o1->outer->zpp_inner = null();
HXDLIN( 361) o1->outer = null();
}
HXDLIN( 361) o1->_isimmutable = null();
HXDLIN( 361) o1->_validate = null();
HXDLIN( 361) o1->_invalidate = null();
}
HXDLIN( 361) o1->next = ::zpp_nape::geom::ZPP_Vec2_obj::zpp_pool;
HXDLIN( 361) ::zpp_nape::geom::ZPP_Vec2_obj::zpp_pool = o1;
}
}
}
}
HXLINE( 363) if (hx::IsNull( this->zpp_inner_zn->wrap_n )) {
HXLINE( 363) this->zpp_inner_zn->setup_n();
}
HXDLIN( 363) return this->zpp_inner_zn->wrap_n;
}
HX_DEFINE_DYNAMIC_FUNC1(LineJoint_obj,set_direction,return )
Float LineJoint_obj::get_jointMin(){
HX_STACKFRAME(&_hx_pos_09c49cc38fbc8a37_373_get_jointMin)
HXDLIN( 373) return this->zpp_inner_zn->jointMin;
}
HX_DEFINE_DYNAMIC_FUNC0(LineJoint_obj,get_jointMin,return )
Float LineJoint_obj::set_jointMin(Float jointMin){
HX_STACKFRAME(&_hx_pos_09c49cc38fbc8a37_375_set_jointMin)
HXLINE( 376) {
HXLINE( 377) this->zpp_inner->immutable_midstep(HX_("LineJoint::jointMin",3e,e1,3a,51));
HXLINE( 379) if ((jointMin != jointMin)) {
HXLINE( 380) HX_STACK_DO_THROW(HX_("Error: AngleJoint::jointMin cannot be NaN",a8,63,9e,8c));
}
HXLINE( 383) if ((this->zpp_inner_zn->jointMin != jointMin)) {
HXLINE( 384) this->zpp_inner_zn->jointMin = jointMin;
HXLINE( 385) this->zpp_inner->wake();
}
}
HXLINE( 388) return this->zpp_inner_zn->jointMin;
}
HX_DEFINE_DYNAMIC_FUNC1(LineJoint_obj,set_jointMin,return )
Float LineJoint_obj::get_jointMax(){
HX_STACKFRAME(&_hx_pos_09c49cc38fbc8a37_398_get_jointMax)
HXDLIN( 398) return this->zpp_inner_zn->jointMax;
}
HX_DEFINE_DYNAMIC_FUNC0(LineJoint_obj,get_jointMax,return )
Float LineJoint_obj::set_jointMax(Float jointMax){
HX_STACKFRAME(&_hx_pos_09c49cc38fbc8a37_400_set_jointMax)
HXLINE( 401) {
HXLINE( 402) this->zpp_inner->immutable_midstep(HX_("LineJoint::jointMax",50,da,3a,51));
HXLINE( 404) if ((jointMax != jointMax)) {
HXLINE( 405) HX_STACK_DO_THROW(HX_("Error: AngleJoint::jointMax cannot be NaN",3a,58,f1,24));
}
HXLINE( 408) if ((this->zpp_inner_zn->jointMax != jointMax)) {
HXLINE( 409) this->zpp_inner_zn->jointMax = jointMax;
HXLINE( 410) this->zpp_inner->wake();
}
}
HXLINE( 413) return this->zpp_inner_zn->jointMax;
}
HX_DEFINE_DYNAMIC_FUNC1(LineJoint_obj,set_jointMax,return )
::nape::geom::MatMN LineJoint_obj::impulse(){
HX_GC_STACKFRAME(&_hx_pos_09c49cc38fbc8a37_455_impulse)
HXLINE( 456) ::nape::geom::MatMN ret = ::nape::geom::MatMN_obj::__alloc( HX_CTX ,2,1);
HXLINE( 457) {
HXLINE( 457) bool _hx_tmp;
HXDLIN( 457) if ((0 < ret->zpp_inner->m)) {
HXLINE( 457) _hx_tmp = (0 >= ret->zpp_inner->n);
}
else {
HXLINE( 457) _hx_tmp = true;
}
HXDLIN( 457) if (_hx_tmp) {
HXLINE( 457) HX_STACK_DO_THROW(HX_("Error: MatMN indices out of range",cc,72,58,e6));
}
HXDLIN( 457) ret->zpp_inner->x[(0 * ret->zpp_inner->n)] = this->zpp_inner_zn->jAccx;
}
HXLINE( 458) {
HXLINE( 458) bool _hx_tmp1;
HXDLIN( 458) if ((1 < ret->zpp_inner->m)) {
HXLINE( 458) _hx_tmp1 = (0 >= ret->zpp_inner->n);
}
else {
HXLINE( 458) _hx_tmp1 = true;
}
HXDLIN( 458) if (_hx_tmp1) {
HXLINE( 458) HX_STACK_DO_THROW(HX_("Error: MatMN indices out of range",cc,72,58,e6));
}
HXDLIN( 458) ret->zpp_inner->x[ret->zpp_inner->n] = this->zpp_inner_zn->jAccy;
}
HXLINE( 459) return ret;
}
::nape::geom::Vec3 LineJoint_obj::bodyImpulse( ::nape::phys::Body body){
HX_STACKFRAME(&_hx_pos_09c49cc38fbc8a37_464_bodyImpulse)
HXLINE( 466) if (hx::IsNull( body )) {
HXLINE( 467) HX_STACK_DO_THROW(HX_("Error: Cannot evaluate impulse on null body",9d,b5,dc,16));
}
HXLINE( 469) bool _hx_tmp;
HXDLIN( 469) ::nape::phys::Body _hx_tmp1;
HXDLIN( 469) if (hx::IsNull( this->zpp_inner_zn->b1 )) {
HXLINE( 469) _hx_tmp1 = null();
}
else {
HXLINE( 469) _hx_tmp1 = this->zpp_inner_zn->b1->outer;
}
HXDLIN( 469) if (hx::IsNotEq( body,_hx_tmp1 )) {
HXLINE( 469) ::nape::phys::Body _hx_tmp2;
HXDLIN( 469) if (hx::IsNull( this->zpp_inner_zn->b2 )) {
HXLINE( 469) _hx_tmp2 = null();
}
else {
HXLINE( 469) _hx_tmp2 = this->zpp_inner_zn->b2->outer;
}
HXDLIN( 469) _hx_tmp = hx::IsNotEq( body,_hx_tmp2 );
}
else {
HXLINE( 469) _hx_tmp = false;
}
HXDLIN( 469) if (_hx_tmp) {
HXLINE( 470) HX_STACK_DO_THROW(HX_("Error: Body is not linked to this constraint",2e,e5,48,bf));
}
HXLINE( 473) if (!(this->zpp_inner->active)) {
HXLINE( 474) return ::nape::geom::Vec3_obj::get(null(),null(),null());
}
else {
HXLINE( 477) return this->zpp_inner_zn->bodyImpulse(body->zpp_inner);
}
HXLINE( 473) return null();
}
void LineJoint_obj::visitBodies( ::Dynamic lambda){
HX_STACKFRAME(&_hx_pos_09c49cc38fbc8a37_483_visitBodies)
HXLINE( 484) ::nape::phys::Body _hx_tmp;
HXDLIN( 484) if (hx::IsNull( this->zpp_inner_zn->b1 )) {
HXLINE( 484) _hx_tmp = null();
}
else {
HXLINE( 484) _hx_tmp = this->zpp_inner_zn->b1->outer;
}
HXDLIN( 484) if (hx::IsNotNull( _hx_tmp )) {
HXLINE( 485) ::nape::phys::Body _hx_tmp1;
HXDLIN( 485) if (hx::IsNull( this->zpp_inner_zn->b1 )) {
HXLINE( 485) _hx_tmp1 = null();
}
else {
HXLINE( 485) _hx_tmp1 = this->zpp_inner_zn->b1->outer;
}
HXDLIN( 485) lambda(_hx_tmp1);
}
HXLINE( 487) bool _hx_tmp2;
HXDLIN( 487) ::nape::phys::Body _hx_tmp3;
HXDLIN( 487) if (hx::IsNull( this->zpp_inner_zn->b2 )) {
HXLINE( 487) _hx_tmp3 = null();
}
else {
HXLINE( 487) _hx_tmp3 = this->zpp_inner_zn->b2->outer;
}
HXDLIN( 487) if (hx::IsNotNull( _hx_tmp3 )) {
HXLINE( 487) ::nape::phys::Body _hx_tmp4;
HXDLIN( 487) if (hx::IsNull( this->zpp_inner_zn->b2 )) {
HXLINE( 487) _hx_tmp4 = null();
}
else {
HXLINE( 487) _hx_tmp4 = this->zpp_inner_zn->b2->outer;
}
HXDLIN( 487) ::nape::phys::Body _hx_tmp5;
HXDLIN( 487) if (hx::IsNull( this->zpp_inner_zn->b1 )) {
HXLINE( 487) _hx_tmp5 = null();
}
else {
HXLINE( 487) _hx_tmp5 = this->zpp_inner_zn->b1->outer;
}
HXDLIN( 487) _hx_tmp2 = hx::IsNotEq( _hx_tmp4,_hx_tmp5 );
}
else {
HXLINE( 487) _hx_tmp2 = false;
}
HXDLIN( 487) if (_hx_tmp2) {
HXLINE( 488) ::nape::phys::Body _hx_tmp6;
HXDLIN( 488) if (hx::IsNull( this->zpp_inner_zn->b2 )) {
HXLINE( 488) _hx_tmp6 = null();
}
else {
HXLINE( 488) _hx_tmp6 = this->zpp_inner_zn->b2->outer;
}
HXDLIN( 488) lambda(_hx_tmp6);
}
}
hx::ObjectPtr< LineJoint_obj > LineJoint_obj::__new( ::nape::phys::Body body1, ::nape::phys::Body body2, ::nape::geom::Vec2 anchor1, ::nape::geom::Vec2 anchor2, ::nape::geom::Vec2 direction,Float jointMin,Float jointMax) {
hx::ObjectPtr< LineJoint_obj > __this = new LineJoint_obj();
__this->__construct(body1,body2,anchor1,anchor2,direction,jointMin,jointMax);
return __this;
}
hx::ObjectPtr< LineJoint_obj > LineJoint_obj::__alloc(hx::Ctx *_hx_ctx, ::nape::phys::Body body1, ::nape::phys::Body body2, ::nape::geom::Vec2 anchor1, ::nape::geom::Vec2 anchor2, ::nape::geom::Vec2 direction,Float jointMin,Float jointMax) {
LineJoint_obj *__this = (LineJoint_obj*)(hx::Ctx::alloc(_hx_ctx, sizeof(LineJoint_obj), true, "nape.constraint.LineJoint"));
*(void **)__this = LineJoint_obj::_hx_vtable;
__this->__construct(body1,body2,anchor1,anchor2,direction,jointMin,jointMax);
return __this;
}
LineJoint_obj::LineJoint_obj()
{
}
void LineJoint_obj::__Mark(HX_MARK_PARAMS)
{
HX_MARK_BEGIN_CLASS(LineJoint);
HX_MARK_MEMBER_NAME(zpp_inner_zn,"zpp_inner_zn");
::nape::constraint::Constraint_obj::__Mark(HX_MARK_ARG);
HX_MARK_END_CLASS();
}
void LineJoint_obj::__Visit(HX_VISIT_PARAMS)
{
HX_VISIT_MEMBER_NAME(zpp_inner_zn,"zpp_inner_zn");
::nape::constraint::Constraint_obj::__Visit(HX_VISIT_ARG);
}
hx::Val LineJoint_obj::__Field(const ::String &inName,hx::PropertyAccess inCallProp)
{
switch(inName.length) {
case 5:
if (HX_FIELD_EQ(inName,"body1") ) { if (inCallProp == hx::paccAlways) return hx::Val( get_body1() ); }
if (HX_FIELD_EQ(inName,"body2") ) { if (inCallProp == hx::paccAlways) return hx::Val( get_body2() ); }
break;
case 7:
if (HX_FIELD_EQ(inName,"anchor1") ) { if (inCallProp == hx::paccAlways) return hx::Val( get_anchor1() ); }
if (HX_FIELD_EQ(inName,"anchor2") ) { if (inCallProp == hx::paccAlways) return hx::Val( get_anchor2() ); }
if (HX_FIELD_EQ(inName,"impulse") ) { return hx::Val( impulse_dyn() ); }
break;
case 8:
if (HX_FIELD_EQ(inName,"jointMin") ) { if (inCallProp == hx::paccAlways) return hx::Val( get_jointMin() ); }
if (HX_FIELD_EQ(inName,"jointMax") ) { if (inCallProp == hx::paccAlways) return hx::Val( get_jointMax() ); }
break;
case 9:
if (HX_FIELD_EQ(inName,"get_body1") ) { return hx::Val( get_body1_dyn() ); }
if (HX_FIELD_EQ(inName,"set_body1") ) { return hx::Val( set_body1_dyn() ); }
if (HX_FIELD_EQ(inName,"get_body2") ) { return hx::Val( get_body2_dyn() ); }
if (HX_FIELD_EQ(inName,"set_body2") ) { return hx::Val( set_body2_dyn() ); }
if (HX_FIELD_EQ(inName,"direction") ) { if (inCallProp == hx::paccAlways) return hx::Val( get_direction() ); }
break;
case 11:
if (HX_FIELD_EQ(inName,"get_anchor1") ) { return hx::Val( get_anchor1_dyn() ); }
if (HX_FIELD_EQ(inName,"set_anchor1") ) { return hx::Val( set_anchor1_dyn() ); }
if (HX_FIELD_EQ(inName,"get_anchor2") ) { return hx::Val( get_anchor2_dyn() ); }
if (HX_FIELD_EQ(inName,"set_anchor2") ) { return hx::Val( set_anchor2_dyn() ); }
if (HX_FIELD_EQ(inName,"bodyImpulse") ) { return hx::Val( bodyImpulse_dyn() ); }
if (HX_FIELD_EQ(inName,"visitBodies") ) { return hx::Val( visitBodies_dyn() ); }
break;
case 12:
if (HX_FIELD_EQ(inName,"zpp_inner_zn") ) { return hx::Val( zpp_inner_zn ); }
if (HX_FIELD_EQ(inName,"get_jointMin") ) { return hx::Val( get_jointMin_dyn() ); }
if (HX_FIELD_EQ(inName,"set_jointMin") ) { return hx::Val( set_jointMin_dyn() ); }
if (HX_FIELD_EQ(inName,"get_jointMax") ) { return hx::Val( get_jointMax_dyn() ); }
if (HX_FIELD_EQ(inName,"set_jointMax") ) { return hx::Val( set_jointMax_dyn() ); }
break;
case 13:
if (HX_FIELD_EQ(inName,"get_direction") ) { return hx::Val( get_direction_dyn() ); }
if (HX_FIELD_EQ(inName,"set_direction") ) { return hx::Val( set_direction_dyn() ); }
}
return super::__Field(inName,inCallProp);
}
hx::Val LineJoint_obj::__SetField(const ::String &inName,const hx::Val &inValue,hx::PropertyAccess inCallProp)
{
switch(inName.length) {
case 5:
if (HX_FIELD_EQ(inName,"body1") ) { if (inCallProp == hx::paccAlways) return hx::Val( set_body1(inValue.Cast< ::nape::phys::Body >()) ); }
if (HX_FIELD_EQ(inName,"body2") ) { if (inCallProp == hx::paccAlways) return hx::Val( set_body2(inValue.Cast< ::nape::phys::Body >()) ); }
break;
case 7:
if (HX_FIELD_EQ(inName,"anchor1") ) { if (inCallProp == hx::paccAlways) return hx::Val( set_anchor1(inValue.Cast< ::nape::geom::Vec2 >()) ); }
if (HX_FIELD_EQ(inName,"anchor2") ) { if (inCallProp == hx::paccAlways) return hx::Val( set_anchor2(inValue.Cast< ::nape::geom::Vec2 >()) ); }
break;
case 8:
if (HX_FIELD_EQ(inName,"jointMin") ) { if (inCallProp == hx::paccAlways) return hx::Val( set_jointMin(inValue.Cast< Float >()) ); }
if (HX_FIELD_EQ(inName,"jointMax") ) { if (inCallProp == hx::paccAlways) return hx::Val( set_jointMax(inValue.Cast< Float >()) ); }
break;
case 9:
if (HX_FIELD_EQ(inName,"direction") ) { if (inCallProp == hx::paccAlways) return hx::Val( set_direction(inValue.Cast< ::nape::geom::Vec2 >()) ); }
break;
case 12:
if (HX_FIELD_EQ(inName,"zpp_inner_zn") ) { zpp_inner_zn=inValue.Cast< ::zpp_nape::constraint::ZPP_LineJoint >(); return inValue; }
}
return super::__SetField(inName,inValue,inCallProp);
}
void LineJoint_obj::__GetFields(Array< ::String> &outFields)
{
outFields->push(HX_("zpp_inner_zn",22,84,fa,e0));
outFields->push(HX_("body1",4f,d3,ef,b6));
outFields->push(HX_("body2",50,d3,ef,b6));
outFields->push(HX_("anchor1",1c,ec,a1,02));
outFields->push(HX_("anchor2",1d,ec,a1,02));
outFields->push(HX_("direction",3f,62,40,10));
outFields->push(HX_("jointMin",68,fa,25,55));
outFields->push(HX_("jointMax",7a,f3,25,55));
super::__GetFields(outFields);
};
#ifdef HXCPP_SCRIPTABLE
static hx::StorageInfo LineJoint_obj_sMemberStorageInfo[] = {
{hx::fsObject /* ::zpp_nape::constraint::ZPP_LineJoint */ ,(int)offsetof(LineJoint_obj,zpp_inner_zn),HX_("zpp_inner_zn",22,84,fa,e0)},
{ hx::fsUnknown, 0, null()}
};
static hx::StaticInfo *LineJoint_obj_sStaticStorageInfo = 0;
#endif
static ::String LineJoint_obj_sMemberFields[] = {
HX_("zpp_inner_zn",22,84,fa,e0),
HX_("get_body1",a6,2f,99,fa),
HX_("set_body1",b2,1b,ea,dd),
HX_("get_body2",a7,2f,99,fa),
HX_("set_body2",b3,1b,ea,dd),
HX_("get_anchor1",33,4c,9c,88),
HX_("set_anchor1",3f,53,09,93),
HX_("get_anchor2",34,4c,9c,88),
HX_("set_anchor2",40,53,09,93),
HX_("get_direction",16,36,a4,d1),
HX_("set_direction",22,18,aa,16),
HX_("get_jointMin",71,ae,3f,0a),
HX_("set_jointMin",e5,d1,38,1f),
HX_("get_jointMax",83,a7,3f,0a),
HX_("set_jointMax",f7,ca,38,1f),
HX_("impulse",b5,50,bd,6d),
HX_("bodyImpulse",33,76,a2,5f),
HX_("visitBodies",ab,f3,5e,e4),
::String(null()) };
hx::Class LineJoint_obj::__mClass;
void LineJoint_obj::__register()
{
LineJoint_obj _hx_dummy;
LineJoint_obj::_hx_vtable = *(void **)&_hx_dummy;
hx::Static(__mClass) = new hx::Class_obj();
__mClass->mName = HX_("nape.constraint.LineJoint",8b,7a,04,05);
__mClass->mSuper = &super::__SGetClass();
__mClass->mConstructEmpty = &__CreateEmpty;
__mClass->mConstructArgs = &__Create;
__mClass->mGetStaticField = &hx::Class_obj::GetNoStaticField;
__mClass->mSetStaticField = &hx::Class_obj::SetNoStaticField;
__mClass->mStatics = hx::Class_obj::dupFunctions(0 /* sStaticFields */);
__mClass->mMembers = hx::Class_obj::dupFunctions(LineJoint_obj_sMemberFields);
__mClass->mCanCast = hx::TCanCast< LineJoint_obj >;
#ifdef HXCPP_SCRIPTABLE
__mClass->mMemberStorageInfo = LineJoint_obj_sMemberStorageInfo;
#endif
#ifdef HXCPP_SCRIPTABLE
__mClass->mStaticStorageInfo = LineJoint_obj_sStaticStorageInfo;
#endif
hx::_hx_RegisterClass(__mClass->mName, __mClass);
}
} // end namespace nape
} // end namespace constraint
| 41.349722
| 241
| 0.570169
|
HedgehogFog
|
c9e0859e598a2be5cb4d3bef0e9a451794c877ba
| 1,321
|
cpp
|
C++
|
src/intro_tf2/src/intro_tf2_broadcaster.cpp
|
davidmball/ros_examples
|
c5ee7a4de5a61c4ffc0e0c36f3a62728220be3e8
|
[
"BSD-3-Clause"
] | 1
|
2017-09-26T07:15:19.000Z
|
2017-09-26T07:15:19.000Z
|
src/intro_tf2/src/intro_tf2_broadcaster.cpp
|
davidmball/ros_examples
|
c5ee7a4de5a61c4ffc0e0c36f3a62728220be3e8
|
[
"BSD-3-Clause"
] | 5
|
2017-07-01T22:43:09.000Z
|
2017-10-02T22:18:22.000Z
|
src/intro_tf2/src/intro_tf2_broadcaster.cpp
|
davidmball/ros_examples
|
c5ee7a4de5a61c4ffc0e0c36f3a62728220be3e8
|
[
"BSD-3-Clause"
] | null | null | null |
#include <ros/ros.h>
#include <tf2/LinearMath/Quaternion.h>
#include <tf2_ros/transform_broadcaster.h>
#include <geometry_msgs/TransformStamped.h>
class BroadcasterNode
{
public:
BroadcasterNode()
: tf2_br_() {}
void broadcast_robot_pose(double x, double y, double theta)
{
geometry_msgs::TransformStamped transform_stamped;
transform_stamped.header.stamp = ros::Time::now();
transform_stamped.header.frame_id = "map";
transform_stamped.child_frame_id = "base_link";
transform_stamped.transform.translation.x = x;
transform_stamped.transform.translation.y = y;
transform_stamped.transform.translation.z = 0.0;
tf2::Quaternion q;
q.setRPY(0, 0, theta);
transform_stamped.transform.rotation.x = q.x();
transform_stamped.transform.rotation.y = q.y();
transform_stamped.transform.rotation.z = q.z();
transform_stamped.transform.rotation.w = q.w();
tf2_br_.sendTransform(transform_stamped);
}
void spin()
{
ros::Rate rate(5);
while (ros::ok())
{
broadcast_robot_pose(0,0,0);
ros::spinOnce();
rate.sleep();
}
}
private:
tf2_ros::TransformBroadcaster tf2_br_;
};
int main(int argc, char** argv)
{
ros::init(argc, argv, "tf2_broadcaster_node");
BroadcasterNode node;
node.spin();
return EXIT_SUCCESS;
}
| 24.018182
| 61
| 0.696442
|
davidmball
|
c9e0d00a9b69f145b2e0c116fc58f3d65ed095de
| 3,689
|
hpp
|
C++
|
Nacro/SDK/FN_SK_M_Med_Soldier_04_Skeleton_AnimBP_classes.hpp
|
Milxnor/Nacro
|
eebabf662bbce6d5af41820ea0342d3567a0aecc
|
[
"BSD-2-Clause"
] | 11
|
2021-08-08T23:25:10.000Z
|
2022-02-19T23:07:22.000Z
|
Nacro/SDK/FN_SK_M_Med_Soldier_04_Skeleton_AnimBP_classes.hpp
|
Milxnor/Nacro
|
eebabf662bbce6d5af41820ea0342d3567a0aecc
|
[
"BSD-2-Clause"
] | 1
|
2022-01-01T22:51:59.000Z
|
2022-01-08T16:14:15.000Z
|
Nacro/SDK/FN_SK_M_Med_Soldier_04_Skeleton_AnimBP_classes.hpp
|
Milxnor/Nacro
|
eebabf662bbce6d5af41820ea0342d3567a0aecc
|
[
"BSD-2-Clause"
] | 8
|
2021-08-09T13:51:54.000Z
|
2022-01-26T20:33:37.000Z
|
#pragma once
// Fortnite (1.8) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
namespace SDK
{
//---------------------------------------------------------------------------
//Classes
//---------------------------------------------------------------------------
// AnimBlueprintGeneratedClass SK_M_Med_Soldier_04_Skeleton_AnimBP.SK_M_Med_Soldier_04_Skeleton_AnimBP_C
// 0x1728 (0x1B38 - 0x0410)
class USK_M_Med_Soldier_04_Skeleton_AnimBP_C : public UCustomCharacterPartAnimInstance
{
public:
struct FPointerToUberGraphFrame UberGraphFrame; // 0x0410(0x0008) (Transient, DuplicateTransient)
struct FAnimNode_Root AnimGraphNode_Root_78EB935A430054ADF5E2E89005D9D000; // 0x0418(0x0048)
struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_5B5C2BC342A9E2373684A581DE190146;// 0x0460(0x0268)
struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_58B7F723420BD05107F77090484DA4F7;// 0x06C8(0x0268)
struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_B614050A427F32E2A71520A396D4981D;// 0x0930(0x0268)
struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_D4E756144665125C57D74F847DF5CAE2;// 0x0B98(0x0268)
struct FAnimNode_ConvertLocalToComponentSpace AnimGraphNode_LocalToComponentSpace_D3F10A774DCEBBC7CF6FACA843FAA56D;// 0x0E00(0x0048)
struct FAnimNode_ConvertComponentToLocalSpace AnimGraphNode_ComponentToLocalSpace_F50D097B4AF8FD409EBDB7A56995EB71;// 0x0E48(0x0048)
struct FAnimNode_CopyPoseFromMesh AnimGraphNode_CopyPoseFromMesh_5984D2B3487D5E3495C1419E61FA91AE;// 0x0E90(0x0098)
struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_AF49CEBA41A86A5239B445ACCA2A35D2;// 0x0F28(0x0268)
struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_E019B8DC42D4A76813488292D50D4442;// 0x1190(0x0268)
struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_53B6F76442E1E5367E83198574A7E337;// 0x13F8(0x0268)
struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_3B49A128489AAE9305B9BEACDF5446C4;// 0x1660(0x0268)
struct FAnimNode_AnimDynamics AnimGraphNode_AnimDynamics_01F0D350476ED069A3D9B380171159E1;// 0x18C8(0x0268)
class USkeletalMeshComponent* MeshToCopy; // 0x1B30(0x0008) (Edit, BlueprintVisible, ZeroConstructor, DisableEditOnInstance, IsPlainOldData)
static UClass* StaticClass()
{
static auto ptr = UObject::FindClass("AnimBlueprintGeneratedClass SK_M_Med_Soldier_04_Skeleton_AnimBP.SK_M_Med_Soldier_04_Skeleton_AnimBP_C");
return ptr;
}
void EvaluateGraphExposedInputs_ExecuteUbergraph_SK_M_Med_Soldier_04_Skeleton_AnimBP_AnimGraphNode_AnimDynamics_53B6F76442E1E5367E83198574A7E337();
void EvaluateGraphExposedInputs_ExecuteUbergraph_SK_M_Med_Soldier_04_Skeleton_AnimBP_AnimGraphNode_AnimDynamics_E019B8DC42D4A76813488292D50D4442();
void EvaluateGraphExposedInputs_ExecuteUbergraph_SK_M_Med_Soldier_04_Skeleton_AnimBP_AnimGraphNode_AnimDynamics_AF49CEBA41A86A5239B445ACCA2A35D2();
void EvaluateGraphExposedInputs_ExecuteUbergraph_SK_M_Med_Soldier_04_Skeleton_AnimBP_AnimGraphNode_CopyPoseFromMesh_5984D2B3487D5E3495C1419E61FA91AE();
void EvaluateGraphExposedInputs_ExecuteUbergraph_SK_M_Med_Soldier_04_Skeleton_AnimBP_AnimGraphNode_AnimDynamics_3B49A128489AAE9305B9BEACDF5446C4();
void BlueprintInitializeAnimation();
void ExecuteUbergraph_SK_M_Med_Soldier_04_Skeleton_AnimBP(int EntryPoint);
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| 63.603448
| 208
| 0.765248
|
Milxnor
|
51870a2f12b4852111ca8ae3f50067e51cd9929f
| 697
|
cpp
|
C++
|
Source/Core/Matrix/Vector3.cpp
|
X1aoyueyue/KVS
|
ad47d62bef4fdd9ddd3412a26ee6557b63f0543b
|
[
"BSD-3-Clause"
] | 42
|
2015-07-24T23:05:07.000Z
|
2022-03-16T01:31:04.000Z
|
Source/Core/Matrix/Vector3.cpp
|
X1aoyueyue/KVS
|
ad47d62bef4fdd9ddd3412a26ee6557b63f0543b
|
[
"BSD-3-Clause"
] | 4
|
2015-03-17T05:42:49.000Z
|
2020-08-09T15:21:45.000Z
|
Source/Core/Matrix/Vector3.cpp
|
X1aoyueyue/KVS
|
ad47d62bef4fdd9ddd3412a26ee6557b63f0543b
|
[
"BSD-3-Clause"
] | 29
|
2015-01-03T05:56:32.000Z
|
2021-10-05T15:28:33.000Z
|
/****************************************************************************/
/**
* @file Vector3.cpp
* @author Naohisa Sakamoto
*/
/****************************************************************************/
#include "Vector3.h"
#include <kvs/Type>
namespace kvs
{
// Template instantiation.
template class Vector3<kvs::Int8>;
template class Vector3<kvs::UInt8>;
template class Vector3<kvs::Int16>;
template class Vector3<kvs::UInt16>;
template class Vector3<kvs::Int32>;
template class Vector3<kvs::UInt32>;
template class Vector3<kvs::Int64>;
template class Vector3<kvs::UInt64>;
template class Vector3<kvs::Real32>;
template class Vector3<kvs::Real64>;
} // end of namespace kvs
| 25.814815
| 78
| 0.571019
|
X1aoyueyue
|
518958fd446c4f34d0736d90e32e6f3cf68a2a65
| 5,515
|
cpp
|
C++
|
src/Runtime/RtMemRef.cpp
|
gperrotta/onnx-mlir
|
75930ffbcf14cfbaccd8417c47c3598f56342926
|
[
"Apache-2.0"
] | null | null | null |
src/Runtime/RtMemRef.cpp
|
gperrotta/onnx-mlir
|
75930ffbcf14cfbaccd8417c47c3598f56342926
|
[
"Apache-2.0"
] | null | null | null |
src/Runtime/RtMemRef.cpp
|
gperrotta/onnx-mlir
|
75930ffbcf14cfbaccd8417c47c3598f56342926
|
[
"Apache-2.0"
] | null | null | null |
//===----------- RtMemRef.cpp - Dynamic MemRef Implementation ------------===//
//
// Copyright 2019-2020 The IBM Research Authors.
//
// =============================================================================
//
// This file contains implementations of Dynamic MemRef data structures and
// helper functions.
//
//===----------------------------------------------------------------------===//
#include <cassert>
#include <map>
#include <string>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "RtMemRef.h"
namespace {
// Helper function to compute cartisian product.
inline std::vector<std::vector<INDEX_TYPE>> CartProduct(
const std::vector<std::vector<INDEX_TYPE>> &v) {
std::vector<std::vector<INDEX_TYPE>> s = {{}};
for (const auto &u : v) {
std::vector<std::vector<INDEX_TYPE>> r;
for (const auto &x : s) {
for (const auto y : u) {
r.push_back(x);
r.back().push_back(y);
}
}
s = move(r);
}
return s;
}
} // namespace
RtMemRef::RtMemRef(int _rank) {
rank = _rank;
sizes = (INDEX_TYPE *)malloc(rank * sizeof(INDEX_TYPE));
strides = (int64_t *)malloc(rank * sizeof(int64_t));
}
INDEX_TYPE RtMemRef::size() const {
return std::accumulate(sizes, sizes + rank, 1, std::multiplies<>());
}
std::vector<std::vector<INDEX_TYPE>> RtMemRef::indexSet() const {
// First, we create index set of each dimension separately.
// i.e., for a tensor/RMR of shape (2, 3), its dimWiseIdxSet will be:
// {{0,1}, {0,1,2}};
std::vector<std::vector<INDEX_TYPE>> dimWiseIdxSet;
for (auto dimSize : std::vector<INDEX_TYPE>(sizes, sizes + rank)) {
std::vector<INDEX_TYPE> dimIdxSet(dimSize);
std::iota(std::begin(dimIdxSet), std::end(dimIdxSet), 0);
dimWiseIdxSet.emplace_back(dimIdxSet);
}
// Then, the cartesian product of vectors within dimWiseIdxSet will be the
// index set for the whole RMR.
return CartProduct(dimWiseIdxSet);
}
INDEX_TYPE RtMemRef::computeOffset(std::vector<INDEX_TYPE> &idxs) const {
auto dimStrides = std::vector<INDEX_TYPE>(strides, strides + rank);
INDEX_TYPE elemOffset = std::inner_product(
idxs.begin(), idxs.end(), dimStrides.begin(), (INDEX_TYPE)0);
return elemOffset;
}
std::vector<int64_t> RtMemRef::computeStridesFromSizes() const {
// Shift dimension sizes one to the left, fill in the vacated rightmost
// element with 1; this gets us a vector that'll be more useful for computing
// strides of memory access along each dimension using prefix product (aka
// partial_sum with a multiply operator below). The intuition is that the size
// of the leading dimension does not matter when computing strides.
std::vector<int64_t> sizesVec(sizes + 1, sizes + rank);
sizesVec.push_back(1);
std::vector<int64_t> dimStrides(rank);
std::partial_sum(sizesVec.rbegin(), sizesVec.rend(), dimStrides.rbegin(),
std::multiplies<>());
return dimStrides;
}
RtMemRef::~RtMemRef() {
free(data);
free(sizes);
free(strides);
}
// An ordered dynamic MemRef dictionary.
// The goal is to support accessing dynamic memory ref by name and by index.
// Currently, only accessing by index is supported.
struct OrderedRtMemRefDict {
std::map<std::string, RtMemRef *> tensorDict;
std::vector<std::string> orderedNames;
};
int numRtMemRefs(OrderedRtMemRefDict *dict) {
return dict->orderedNames.size();
}
OrderedRtMemRefDict *createOrderedRtMemRefDict() {
return new OrderedRtMemRefDict();
}
RtMemRef *createRtMemRef(int rank) { return new RtMemRef(rank); }
RtMemRef *getRtMemRef(OrderedRtMemRefDict *tensorDict, int idx) {
return tensorDict->tensorDict[tensorDict->orderedNames[idx]];
}
void setRtMemRef(OrderedRtMemRefDict *tensorDict, int idx, RtMemRef *tensor) {
if (tensorDict->orderedNames.size() <= idx)
tensorDict->orderedNames.resize(idx + 1);
// The dynamic memref is essentially anonymous, since we are storing it by
// indexed position.
// TODO: can use random string as names to reduce chance of collision.
auto unique_name = std::to_string(idx);
assert(tensorDict->tensorDict.count(unique_name) == 0 &&
"duplicate dynamic mem ref name");
tensorDict->orderedNames[idx] = unique_name;
tensorDict->tensorDict[tensorDict->orderedNames[idx]] = tensor;
}
void *getData(RtMemRef *dynMemRef) { return dynMemRef->data; }
void setData(RtMemRef *dynMemRef, void *dataPtr) { dynMemRef->data = dataPtr; }
void *getAlignedData(RtMemRef *dynMemRef) { return dynMemRef->alignedData; }
void setAlignedData(RtMemRef *dynMemRef, void *dataPtr) {
dynMemRef->alignedData = dataPtr;
}
INDEX_TYPE *getSizes(RtMemRef *dynMemRef) { return dynMemRef->sizes; }
void setSizes(RtMemRef *dynMemRef, INDEX_TYPE *sizes) {
for (int i = 0; i < dynMemRef->rank; i++)
dynMemRef->sizes[i] = sizes[i];
}
int64_t *getStrides(RtMemRef *dynMemRef) { return dynMemRef->strides; }
int64_t getSize(OrderedRtMemRefDict *dict) { return dict->orderedNames.size(); }
INDEX_TYPE getDataSize(RtMemRef *rtMemRef) {
INDEX_TYPE n = rtMemRef->sizes[0];
for (int i = 1; i < rtMemRef->rank; i++)
n *= rtMemRef->sizes[i];
return n;
}
void setDType(RtMemRef *dynMemRef, int onnxType) {
dynMemRef->onnx_dtype = onnxType;
}
int getDType(RtMemRef *dynMemRef) { return dynMemRef->onnx_dtype; }
unsigned int getRank(RtMemRef *dynMemRef) { return dynMemRef->rank; }
void setStrides(RtMemRef *dynMemRef, int64_t *strides) {
for (int i = 0; i < dynMemRef->rank; i++)
dynMemRef->strides[i] = strides[i];
}
| 32.063953
| 80
| 0.682684
|
gperrotta
|
5196b437b54d2d77be1f81d5f74bf370d5cabb38
| 7,547
|
cxx
|
C++
|
osprey/be/cg/cg_swp_allocator_test.cxx
|
sharugupta/OpenUH
|
daddd76858a53035f5d713f648d13373c22506e8
|
[
"BSD-2-Clause"
] | null | null | null |
osprey/be/cg/cg_swp_allocator_test.cxx
|
sharugupta/OpenUH
|
daddd76858a53035f5d713f648d13373c22506e8
|
[
"BSD-2-Clause"
] | null | null | null |
osprey/be/cg/cg_swp_allocator_test.cxx
|
sharugupta/OpenUH
|
daddd76858a53035f5d713f648d13373c22506e8
|
[
"BSD-2-Clause"
] | null | null | null |
/*
Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2 of the GNU General Public License as
published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU General Public License along
with this program; if not, write the Free Software Foundation, Inc., 59
Temple Place - Suite 330, Boston MA 02111-1307, USA.
Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
//-*-c++-*-
// =======================================================================
// =======================================================================
//
// Module: cg_swp_allocator_test.cxx
// $Revision: 1.2 $
// $Date: 02/11/07 23:41:21-00:00 $
// $Author: fchow@keyresearch.com $
// $Source: /scratch/mee/2.4-65/kpro64-pending/be/cg/SCCS/s.cg_swp_allocator_test.cxx $
//
// Revision comments:
//
// 01-May-1999 - Initial version
//
// Description:
// ------------
// Build the tester as follows to produce an a.out file.
//
// $TOOLROOT/usr/bin/CC -g -DSTANDALONE_SWP_ALLOCATOR
// -I../../common/util -I../../common/com -I../../common/stl
// cg_swp_allocator.cxx cg_swp_allocator_test.cxx
//
// The tester provides a simple command-line interface to enter
// lifetimes and test the register allocatator for correctness and
// optimality. It outputs time vs register plots of the resultant
// allocation, and indicates illegal allocations by the '*' character
// in the plot (i.e. for overlapping register usages).
//
// An example, taken from Rau's paper, is built into this
// implementation, and an interesting supplement to his example
// can be created by appending the following lifetimes:
//
// 10 15 2 3
// 20 27 1 0
// 30 35 0 2
// 10 20 2 2
// 1 2 0 0
//
// where using a sort based only on start-time does better than the
// adjacency sort. Appending
//
// 6 8 0 0
//
// will cause adjacency sort to do better.
//
// ====================================================================
// ====================================================================
#include <stdio.h>
#include <vector>
#include "defs.h"
#include "cg_swp_allocator.h"
static const char *
Read_Line()
{
static char line[512];
if (gets(line) == NULL)
line[0] = '\0';
return line;
}
static INT32
Get_A_Number()
{
INT32 num, status = 0;
while (status != 1)
{
status = sscanf(Read_Line(), "%d", &num);
if (status != 1)
printf("\n<Try again! Enter a single integer> ");
}
return num;
} // Get_A_Number
static INT32
Get_Bounded_Number(INT32 min, INT32 max)
{
INT32 num = Get_A_Number();
while (num > max || num < min)
{
printf("\nInvalid option! Enter a digit between %d and %d>", min, max);
num = Get_A_Number();
}
return num;
}
static void
Get_A_Lifetime(SWP_LIFETIME <)
{
INT32 from_tunit, to_tunit, omega, alpha, status = 0;
printf("\n<Enter lifetime (start_cycle end_cycle omega alpha)> ");
while (status != 4)
{
status = sscanf(Read_Line(), "%d %d %d %d",
&from_tunit, &to_tunit, &omega, &alpha);
if (status != 4)
printf("\n<Try again! Enter 4 space separated integers> ");
}
lt = SWP_LIFETIME(from_tunit, to_tunit, omega, alpha);
} // Get_A_Lifetime
static void
Get_Lifetimes(std::vector<SWP_LIFETIME> <v)
{
INT32 number_of_values = -1;
SWP_LIFETIME lt;
printf("\n<How many lifetimes do you wish to enter> ");
number_of_values = Get_Bounded_Number(0, 100);
for (INT32 i = 0; i < number_of_values; i++)
{
Get_A_Lifetime(lt);
ltv.push_back(lt);
} // for each value
} // Get_Lifetimes
void main()
{
BOOL more = TRUE;
INT32 option;
std::vector<SWP_LIFETIME> ltv;
INT32 ii = 2, sc = 10, num_regs = 64, num_its = 15, num_cols = 70;
while (more)
{
printf("\n----------- Testing swp allocator -----------");
printf("\n");
printf("\n 0) Exit");
printf("\n 1) Set ii (default %d)", ii);
printf("\n 2) Set sc (default %d)", sc);
printf("\n 3) Set max registers (default %d)", num_regs);
printf("\n 4) Set number of iterations to plot (default %d)", num_its);
printf("\n 5) Set column-width of plot (default %d)", num_cols);
printf("\n 6) Enter new set of lifetimes");
printf("\n 7) Append to existing set of lifetimes");
printf("\n 8) Allocate and trace with adjacency ordering");
printf("\n 9) Allocate and trace without adjacency ordering");
printf("\n 10) Example from Rau's paper (page 287)");
printf("\n");
printf("\nNOTES on plot:\n");
printf("\n \">\" indicates live value carried in/out of loop");
printf("\n \"*\" indicates overlapped lifetimes (i.e. an error)");
printf("\n");
printf("\n<Enter an option (0-10)> ");
option = Get_Bounded_Number(0, 10);
switch (option)
{
case 0: // Exit
more = FALSE;
break;
case 1: // Set ii
printf("\nEnter ii (1..1000)> ");
ii = Get_Bounded_Number(1, 1000);
break;
case 2: // Set sc
printf("\nEnter sc (1..1000)> ");
sc = Get_Bounded_Number(1, 1000);
break;
case 3: // Set max registers
printf("\nEnter number of registers (1..256)> ");
num_regs = Get_Bounded_Number(1, 256);
break;
case 4: // Set number of iterations to plot
printf("\nEnter number of iteration (1..256)> ");
num_its = Get_Bounded_Number(1, 256);
break;
case 5: // Set column-width of plot
printf("\nEnter number of columns (1..256)> ");
num_cols = Get_Bounded_Number(1, 256);
break;
case 6: // Enter new set of lifetimes
ltv.clear();
Get_Lifetimes(ltv);
break;
case 7: // Add to existing set of lifetimes
Get_Lifetimes(ltv);
break;
case 8: // Allocate and trace
{
SWP_ALLOCATOR reg_alloc(ii, sc, num_regs, ltv.begin(), ltv.end(),
Malloc_Mem_Pool, TRUE);
reg_alloc.print(stdout, num_its, num_cols);
break;
}
case 9: // Allocate and trace without adjacency ordering
{
SWP_ALLOCATOR reg_alloc(ii, sc, num_regs, ltv.begin(), ltv.end(),
Malloc_Mem_Pool, FALSE);
reg_alloc.print(stdout, num_its, num_cols);
break;
}
case 10: // Rau's example
{
ii = 2;
sc = 10;
num_regs = 64;
ltv.clear();
ltv.push_back(SWP_LIFETIME(13,17,1,1));
ltv.push_back(SWP_LIFETIME(18,21,0,0));
ltv.push_back(SWP_LIFETIME(15,20,0,0));
ltv.push_back(SWP_LIFETIME(0,20,0,0));
ltv.push_back(SWP_LIFETIME(0,23,1,0));
SWP_ALLOCATOR reg_alloc(ii, sc, num_regs, ltv.begin(), ltv.end());
reg_alloc.print(stdout, num_its, num_cols);
break;
}
} // switch on option
} // while more
} // main
| 29.365759
| 88
| 0.619054
|
sharugupta
|
519c6b3abe3e2cd2428dde8de641453fe9b49c0d
| 11,793
|
cpp
|
C++
|
qactionmanager/keyconfigdialog.cpp
|
SAT1226/XManga
|
d69f4c31838ffa99efde0bd10f5ca1c5f818eb80
|
[
"MIT"
] | 1
|
2022-03-19T11:52:44.000Z
|
2022-03-19T11:52:44.000Z
|
qactionmanager/keyconfigdialog.cpp
|
SAT1226/XManga
|
d69f4c31838ffa99efde0bd10f5ca1c5f818eb80
|
[
"MIT"
] | null | null | null |
qactionmanager/keyconfigdialog.cpp
|
SAT1226/XManga
|
d69f4c31838ffa99efde0bd10f5ca1c5f818eb80
|
[
"MIT"
] | null | null | null |
#include <QtWidgets>
#include "keyconfigdialog.h"
#include "shortcutbutton.h"
#include "ui_keyconfigdialog.h"
static int translateModifiers(Qt::KeyboardModifiers state,
const QString &text)
{
int result = 0;
// The shift modifier only counts when it is not used to type a symbol
// that is only reachable using the shift key anyway
if ((state & Qt::ShiftModifier) && (text.size() == 0
|| !text.at(0).isPrint()
|| text.at(0).isLetterOrNumber()
|| text.at(0).isSpace()))
result |= Qt::SHIFT;
if (state & Qt::ControlModifier)
result |= Qt::CTRL;
if (state & Qt::MetaModifier)
result |= Qt::META;
if (state & Qt::AltModifier)
result |= Qt::ALT;
if (state & Qt::KeypadModifier)
result |= Qt::KeypadModifier;
return result;
}
static QString keySequenceToEditString(const QKeySequence &sequence)
{
QString text = sequence.toString(QKeySequence::PortableText);
// if (Utils::HostOsInfo::isMacHost()) {
// // adapt the modifier names
// text.replace(QLatin1String("Ctrl"), QLatin1String("Cmd"), Qt::CaseInsensitive);
// text.replace(QLatin1String("Alt"), QLatin1String("Opt"), Qt::CaseInsensitive);
// text.replace(QLatin1String("Meta"), QLatin1String("Ctrl"), Qt::CaseInsensitive);
// }
return text;
}
static QKeySequence keySequenceFromEditString(const QString &editString)
{
QString text = editString;
// if (Utils::HostOsInfo::isMacHost()) {
// // adapt the modifier names
// text.replace(QLatin1String("Opt"), QLatin1String("Alt"), Qt::CaseInsensitive);
// text.replace(QLatin1String("Ctrl"), QLatin1String("Meta"), Qt::CaseInsensitive);
// text.replace(QLatin1String("Cmd"), QLatin1String("Ctrl"), Qt::CaseInsensitive);
// }
return QKeySequence::fromString(text, QKeySequence::PortableText);
}
static bool keySequenceIsValid(const QKeySequence &sequence)
{
if (sequence.isEmpty())
return true;
for (int i = 0; i < sequence.count(); ++i) {
if (sequence[i] == Qt::Key_unknown)
return false;
}
return true;
}
ShortcutButton::ShortcutButton(QWidget *parent)
: QPushButton(parent)
, m_key({{0, 0, 0, 0}})
{
// Using ShortcutButton::tr() as workaround for QTBUG-34128
setToolTip(ShortcutButton::tr("Click and enter a new shortcut key.", "Gray text to be displayed on LineEdit to input the shortcut key"));
setCheckable(true);
m_checkedText = ShortcutButton::tr("Stop Recording", "Button for canceling shortcut key input");
m_uncheckedText = ShortcutButton::tr("Record", "Button for starting entering the shortcut key");
updateText();
connect(this, &ShortcutButton::toggled, this, &ShortcutButton::handleToggleChange);
}
QSize ShortcutButton::sizeHint() const
{
if (m_preferredWidth < 0) { // initialize size hint
const QString originalText = text();
ShortcutButton *that = const_cast<ShortcutButton *>(this);
that->setText(m_checkedText);
m_preferredWidth = QPushButton::sizeHint().width();
that->setText(m_uncheckedText);
int otherWidth = QPushButton::sizeHint().width();
if (otherWidth > m_preferredWidth)
m_preferredWidth = otherWidth;
that->setText(originalText);
}
return QSize(m_preferredWidth, QPushButton::sizeHint().height());
}
bool ShortcutButton::eventFilter(QObject *obj, QEvent *evt)
{
if (evt->type() == QEvent::ShortcutOverride) {
evt->accept();
return true;
}
if (evt->type() == QEvent::KeyRelease
|| evt->type() == QEvent::Shortcut
|| evt->type() == QEvent::Close/*Escape tries to close dialog*/) {
return true;
}
if (evt->type() == QEvent::MouseButtonPress && isChecked()) {
setChecked(false);
return true;
}
if (evt->type() == QEvent::KeyPress) {
QKeyEvent *k = static_cast<QKeyEvent*>(evt);
int nextKey = k->key();
if (m_keyNum > 3
|| nextKey == Qt::Key_Control
|| nextKey == Qt::Key_Shift
|| nextKey == Qt::Key_Meta
|| nextKey == Qt::Key_Alt) {
return false;
}
nextKey |= translateModifiers(k->modifiers(), k->text());
switch (m_keyNum) {
case 0:
m_key[0] = nextKey;
break;
case 1:
m_key[1] = nextKey;
break;
case 2:
m_key[2] = nextKey;
break;
case 3:
m_key[3] = nextKey;
break;
default:
break;
}
m_keyNum++;
k->accept();
emit keySequenceChanged(QKeySequence(m_key[0], m_key[1], m_key[2], m_key[3]));
if (m_keyNum > 3)
setChecked(false);
return true;
}
return QPushButton::eventFilter(obj, evt);
}
void ShortcutButton::updateText()
{
setText(isChecked() ? m_checkedText : m_uncheckedText);
}
void ShortcutButton::handleToggleChange(bool toogleState)
{
updateText();
m_keyNum = m_key[0] = m_key[1] = m_key[2] = m_key[3] = 0;
if (toogleState) {
if (qApp->focusWidget())
qApp->focusWidget()->clearFocus(); // funny things happen otherwise
qApp->installEventFilter(this);
} else {
qApp->removeEventFilter(this);
}
}
KeyConfigDialog::KeyConfigDialog(KeyConfigDialog::KeyActionManager &keyActions, QWidget *parent)
: QDialog(parent)
, ui(new Ui::KeyConfigDialog)
, m_keyActions(keyActions)
, m_keyCapturing(false)
, m_ignoreEdited(false)
{
ui->setupUi(this);
ui->frameMouseOptions->setVisible(false);
ui->addSequenceButton->setVisible(false);
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(onStandardButton_clicked(QAbstractButton*)));
connect(ui->treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(onTreeWidget_currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)));
connect(ui->resetButton, SIGNAL(clicked()), this, SLOT(onResetButton_clicked()));
connect(ui->shortcutEdit, SIGNAL(textChanged(QString)), this, SLOT(onShortcutEdit_textChanged(QString)));
connect(ui->recordButton, &ShortcutButton::keySequenceChanged,
this, &KeyConfigDialog::onRecordButton_keySequenceChanged);
ui->treeWidget->sortByColumn(0, Qt::AscendingOrder);
QTreeWidgetItem *header = ui->treeWidget->headerItem();
// header->setText(0, tr("Motions", "Title of the column of Action to be registered with the shortcut key"));
header->setText(0, tr("Group", "Group of the Action to be registered with the shortcut key"));
header->setText(1, tr("Description", "Title of the column that displays the meaning of the action to be registered with the shortcut key"));
header->setText(2, tr("CurrentShortcut", "Title of the column of the content of the shortcut key registered for Action"));
// header->setSizeHint(0, QSize(100, 30));
// header->setSizeHint(1, QSize(300, 30));
// header->setSizeHint(2, QSize(300, 30));
resetView();
}
void KeyConfigDialog::resetView()
{
ui->treeWidget->clear();
m_actionNameByIconText.clear();
QMap<QString, QAction*>& actions = m_keyActions.actions();
QMap<QString, QKeySequence>& keyconfigs = m_keyActions.keyMaps();
// foreach(const QString& key, actions.keys()) {
// QAction* action = actions[key];
// if(!action) continue;
// QTreeWidgetItem* item = new QTreeWidgetItem;
// item->setText(0, key);
// item->setText(1, action->iconText());
// item->setText(2, keyconfigs.contains(key) ? keyconfigs[key].toString() : "");
//// item->setSizeHint(0, QSize(240, 20));
//// item->setSizeHint(1, QSize(240, 20));
// ui->treeWidget->addTopLevelItem(item);
// }
const QMultiMap<QString, QString>& nameByGroups = m_keyActions.nameByGroups();
foreach(const QString& groupName, nameByGroups.uniqueKeys()) {
foreach(const QString& key, nameByGroups.values(groupName)) {
QAction* action = actions[key];
if(!action) continue;
QTreeWidgetItem* item = new QTreeWidgetItem;
item->setText(0, groupName);
item->setText(1, action->iconText());
item->setText(2, keyconfigs.contains(key) ? keyconfigs[key].toString() : "");
// item->setSizeHint(0, QSize(240, 20));
// item->setSizeHint(1, QSize(300, 20));
ui->treeWidget->addTopLevelItem(item);
m_actionNameByIconText[action->iconText()] = key;
}
}
}
KeyConfigDialog::~KeyConfigDialog()
{
delete ui;
}
bool KeyConfigDialog::eventFilter(QObject *obj, QEvent *event)
{
return QObject::eventFilter(obj, event);
}
void KeyConfigDialog::setEditTextWithoutSignal(QString text)
{
m_ignoreEdited = true;
ui->shortcutEdit->setText(text);
m_ignoreEdited = false;
}
void KeyConfigDialog::onTreeWidget_currentItemChanged(QTreeWidgetItem *item, QTreeWidgetItem *)
{
//qDebug() << "on_currentCommandChanged: " << (item ? item->text(0):"nullptr") << (previous ? previous->text(0) :"nullptr");
if(item) {
// m_actionName = item->text(0);
m_actionName = m_actionNameByIconText[item->text(1)];
ui->shortcutGroupBox->setEnabled(true);
ui->shortcutEdit->setText(item->text(2));
}
}
void KeyConfigDialog::onRecordButton_keySequenceChanged(QKeySequence key)
{
QString shortcutText = keySequenceToEditString(key);
setEditTextWithoutSignal(shortcutText);
if(!keySequenceIsValid(key)) {
ui->warningLabel->setText(tr("Invalid key sequence.", "Message when rejecting input contents of inappropriate shortcut key"));
return;
}
if(m_keyActions.markCollisions(m_actionName, key)) {
ui->warningLabel->setText(tr("Key sequence has potential conflicts.", "Text to be displayed when the entered shortcut key conflicts with another shortcut key"));
return;
}
ui->warningLabel->clear();
QTreeWidgetItem *current = ui->treeWidget->currentItem();
current->setText(2, shortcutText);
m_keyActions.updateKey(m_actionName, key);
}
void KeyConfigDialog::onResetButton_clicked()
{
QKeySequence key = m_keyActions.getKeyDefault(m_actionName);
QString shortcutText = keySequenceToEditString(key);
setEditTextWithoutSignal(shortcutText);
if(m_keyActions.markCollisions(m_actionName, key)) {
ui->warningLabel->setText(tr("Key sequence has potential conflicts.", "Text to be displayed when the entered shortcut key conflicts with another shortcut key"));
return;
}
ui->warningLabel->clear();
QTreeWidgetItem *current = ui->treeWidget->currentItem();
current->setText(2, shortcutText);
m_keyActions.updateKey(m_actionName, key);
}
void KeyConfigDialog::onShortcutEdit_textChanged(QString text)
{
if(!m_ignoreEdited) {
QKeySequence key(text);
if(!keySequenceIsValid(key)) {
ui->warningLabel->setText(tr("Invalid key sequence.", "Message when rejecting input contents of inappropriate shortcut key"));
return;
}
onRecordButton_keySequenceChanged(key);
}
}
void KeyConfigDialog::onStandardButton_clicked(QAbstractButton *button)
{
switch(ui->buttonBox->standardButton(button)) {
case QDialogButtonBox::RestoreDefaults:
m_keyActions.resetByDefault();
resetView();
break;
}
}
| 36.968652
| 171
| 0.642669
|
SAT1226
|
51aaf6f4b44684083721281ac37c12423528dac2
| 2,313
|
cpp
|
C++
|
mdec/movie/main.cpp
|
ggrtk/ps1-tests
|
072a2f2dc2cc2ce5e63414147917969231808485
|
[
"MIT"
] | 34
|
2019-09-22T15:52:29.000Z
|
2022-01-16T16:14:15.000Z
|
mdec/movie/main.cpp
|
ggrtk/ps1-tests
|
072a2f2dc2cc2ce5e63414147917969231808485
|
[
"MIT"
] | 3
|
2020-03-28T15:12:56.000Z
|
2021-02-08T09:25:29.000Z
|
mdec/movie/main.cpp
|
ggrtk/ps1-tests
|
072a2f2dc2cc2ce5e63414147917969231808485
|
[
"MIT"
] | 8
|
2020-03-20T13:15:33.000Z
|
2022-01-15T03:43:58.000Z
|
#include <common.h>
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <io.h>
#include <dma.hpp>
#include <mdec.h>
#include <gpu.h>
#include "bad_apple.h"
#define SCR_W 256
#define SCR_H 240
uint32_t* buffer = nullptr;
void decodeAndDisplayFrame(uint8_t* frame, size_t frameLen, uint16_t frameWidth, uint16_t frameHeight) {
const int STRIPE_WIDTH = 16;
const int STRIPE_HEIGHT = frameHeight;
#ifdef USE_24BIT
const ColorDepth depth = ColorDepth::bit_24;
const int copyWidth = STRIPE_WIDTH * 3/2;
#define BYTES_PER_PIXEL 3
#else
const ColorDepth depth = ColorDepth::bit_15;
const int copyWidth = STRIPE_WIDTH;
#define BYTES_PER_PIXEL 2
#endif
mdec_decodeDma((uint16_t*)frame, frameLen, depth, false, false);
if (buffer == nullptr) {
buffer = (uint32_t*)malloc(STRIPE_WIDTH * STRIPE_HEIGHT * BYTES_PER_PIXEL / 4 * sizeof(uint32_t));
}
for (int c = 0; c < frameWidth / STRIPE_WIDTH; c++) {
mdec_readDecodedDma(buffer, STRIPE_WIDTH * STRIPE_HEIGHT * BYTES_PER_PIXEL);
vramWriteDMA(c * copyWidth, 0, copyWidth, STRIPE_HEIGHT, (uint16_t*)buffer);
}
}
int main() {
SetVideoMode(MODE_NTSC);
initVideo(SCR_W, SCR_H);
printf("\nmdec/frame\n");
#ifdef USE_24BIT
extern DISPENV disp;
disp.isrgb24 = true;
PutDispEnv(&disp);
printf("Using framebuffer in 24bit mode\n");
#endif
clearScreen();
mdec_reset();
mdec_quantTable(quant, true);
mdec_idctTable((int16_t*)idct);
mdec_enableDma();
for (int i = 0; i<60*2; i++) {
VSync(0);
}
for (int i = 0; i<FRAME_COUNT; i++) {
frame_t frame = frames[i];
decodeAndDisplayFrame(&movieBitstream[frame.offset], frame.size, SCR_W, SCR_H);
VSync(0);
}
free(buffer);
printf("Done\n");
// Stop all pending DMA transfers
write32(DMA::CH_CONTROL_ADDR + 0x10 * (int)DMA::Channel::MDECin, 0);
write32(DMA::CH_CONTROL_ADDR + 0x10 * (int)DMA::Channel::MDECout, 0);
write32(DMA::CH_CONTROL_ADDR + 0x10 * (int)DMA::Channel::GPU, 0);
DMA::masterEnable(DMA::Channel::MDECout, false);
DMA::masterEnable(DMA::Channel::MDECin, false);
DMA::masterEnable(DMA::Channel::GPU, false);
mdec_reset();
for (;;) {
VSync(0);
}
return 0;
}
| 27.211765
| 106
| 0.65067
|
ggrtk
|
51b0bc5023b24223395db4d64ca1adbbb8738c5a
| 1,256
|
cpp
|
C++
|
7_shortcutkey_diff_by_beyondcompare_in_qtcreator/main.cpp
|
ZYV037/QT_Example
|
916e343894346389f796f42a63d4162bb8429555
|
[
"WTFPL"
] | 4
|
2018-12-26T11:10:21.000Z
|
2021-02-05T10:31:30.000Z
|
7_shortcutkey_diff_by_beyondcompare_in_qtcreator/main.cpp
|
ZYV037/QT_Example
|
916e343894346389f796f42a63d4162bb8429555
|
[
"WTFPL"
] | null | null | null |
7_shortcutkey_diff_by_beyondcompare_in_qtcreator/main.cpp
|
ZYV037/QT_Example
|
916e343894346389f796f42a63d4162bb8429555
|
[
"WTFPL"
] | 2
|
2021-02-05T10:31:37.000Z
|
2021-04-04T17:25:07.000Z
|
#include <stdio.h>
#include<stdlib.h>
#include <string>
#include <iostream>
#include <QProcess>
#pragma comment( linker, “/subsystem:windows /entry:mainCRTStartup” )
//"C:\Program Files\TortoiseSVN\bin\svn_wrapper.exe" diff System/WMPS/DIS/UI/DisEventVariationUI/DisEventVariationUI.cpp
//C:\WtgeoProducts: "C:\Program Files\TortoiseSVN\bin\svn_wrapper.exe" diff --internal-diff System/WMPS/App/DIS/DIS.pro
int main(int argc, char *argv[])
{
if(argc < 3)
{
std::string cmd = "Cmd error: " ;
for(int i = 0; i < argc; ++ i)
{
cmd += argv[i];
cmd += " ";
}
std::cout << cmd << std::endl;
return -1;
}
std::string cmd1 = argv[1];
if( cmd1 != "diff" )
{
return -1;
}
if(argc == 3)
{
std::string cmd = "TortoiseProc.exe /command:diff /path:";
cmd += argv[2];
return QProcess::execute(cmd.c_str());
}
std::string cmd2 = argv[2];
if( cmd2 == "--internal-diff" )
{
std::string cmd = "TortoiseProc.exe /command:diff /path:";
cmd += argv[3];
return QProcess::execute(cmd.c_str());
}
// int res = system(cmd.c_str());
// std::cout << cmd << std::endl;
return -1;
}
| 24.153846
| 120
| 0.55414
|
ZYV037
|
51b28c7a4ec3d325b98b22d50a9c84f2f6f40bd0
| 110
|
cpp
|
C++
|
src/main.cpp
|
payano/mMesh
|
151ab475ad6ea66a608566098755dbad39eca058
|
[
"MIT"
] | null | null | null |
src/main.cpp
|
payano/mMesh
|
151ab475ad6ea66a608566098755dbad39eca058
|
[
"MIT"
] | 37
|
2020-03-02T18:31:57.000Z
|
2020-05-20T07:18:14.000Z
|
src/main.cpp
|
payano/mMesh
|
151ab475ad6ea66a608566098755dbad39eca058
|
[
"MIT"
] | 2
|
2020-03-10T17:35:27.000Z
|
2020-04-24T10:51:47.000Z
|
#ifdef UNIX
#include "Mesh.h"
#include <stdio.h>
int main(void)
{
printf("MAIN MAIN\n");
return 0;
}
#endif
| 11
| 23
| 0.654545
|
payano
|
51b8a7338093cc50265f302911d9b11b6fca5810
| 207
|
cpp
|
C++
|
VerifEye/main.cpp
|
sanket26jadhav/VerifEye
|
493f9ef0872b20ad482fcec0fa60306457ec44c7
|
[
"Apache-2.0"
] | 4
|
2018-04-07T11:04:51.000Z
|
2018-12-27T15:34:14.000Z
|
VerifEye/main.cpp
|
sanket26jadhav/VerifEye
|
493f9ef0872b20ad482fcec0fa60306457ec44c7
|
[
"Apache-2.0"
] | null | null | null |
VerifEye/main.cpp
|
sanket26jadhav/VerifEye
|
493f9ef0872b20ad482fcec0fa60306457ec44c7
|
[
"Apache-2.0"
] | 3
|
2018-04-07T06:44:15.000Z
|
2018-10-27T08:15:49.000Z
|
#include "VerifEye.h"
#include <direct.h>
#include <QtWidgets/QApplication>
int main(int argc, char *argv[])
{
_mkdir("./data-db");
QApplication a(argc, argv);
VerifEye w;
w.show();
return a.exec();
}
| 15.923077
| 33
| 0.666667
|
sanket26jadhav
|
51b90dfb14d924ecafc66fe11b4134cdcfc78a8a
| 903
|
hpp
|
C++
|
gearoenix/glc3/pipeline/gx-glc3-pip-skybox-cube-resource-set.hpp
|
Hossein-Noroozpour/gearoenix
|
c8fa8b8946c03c013dad568d6d7a97d81097c051
|
[
"BSD-Source-Code"
] | 35
|
2018-01-07T02:34:38.000Z
|
2022-02-09T05:19:03.000Z
|
gearoenix/glc3/pipeline/gx-glc3-pip-skybox-cube-resource-set.hpp
|
Hossein-Noroozpour/gearoenix
|
c8fa8b8946c03c013dad568d6d7a97d81097c051
|
[
"BSD-Source-Code"
] | 111
|
2017-09-20T09:12:36.000Z
|
2020-12-27T12:52:03.000Z
|
gearoenix/glc3/pipeline/gx-glc3-pip-skybox-cube-resource-set.hpp
|
Hossein-Noroozpour/gearoenix
|
c8fa8b8946c03c013dad568d6d7a97d81097c051
|
[
"BSD-Source-Code"
] | 5
|
2020-02-11T11:17:37.000Z
|
2021-01-08T17:55:43.000Z
|
#ifndef GEAROENIX_GLC3_PIPELINE_SKYBOX_CUBE_RESOURCE_SET_HPP
#define GEAROENIX_GLC3_PIPELINE_SKYBOX_CUBE_RESOURCE_SET_HPP
#include "../../core/gx-cr-build-configuration.hpp"
#ifdef GX_USE_OPENGL_CLASS_3
#include "../../core/sync/gx-cr-sync-end-caller.hpp"
#include "../../gl/gx-gl-types.hpp"
#include "../../render/pipeline/gx-rnd-pip-skybox-cube-resource-set.hpp"
namespace gearoenix::glc3::shader {
class SkyboxCube;
}
namespace gearoenix::glc3::pipeline {
class SkyboxCube;
class ResourceSet;
class SkyboxCubeResourceSet final : public render::pipeline::SkyboxCubeResourceSet {
GX_GET_UCPTR_PRV(glc3::pipeline::ResourceSet, base)
public:
SkyboxCubeResourceSet(const std::shared_ptr<shader::SkyboxCube>& shd, std::shared_ptr<SkyboxCube const> pip) noexcept;
~SkyboxCubeResourceSet() noexcept final;
void bind_final(gl::uint& bound_shader_program) const noexcept;
};
}
#endif
#endif
| 33.444444
| 122
| 0.781838
|
Hossein-Noroozpour
|
51b95da646c64f4066b8b497711aab313801eafb
| 363
|
hpp
|
C++
|
src/Traits.hpp
|
spraetor/amdis2
|
53c45c81a65752a8fafbb54f9ae6724a86639dcd
|
[
"MIT"
] | 2
|
2018-07-04T16:44:04.000Z
|
2021-01-03T07:26:27.000Z
|
src/Traits.hpp
|
spraetor/amdis2
|
53c45c81a65752a8fafbb54f9ae6724a86639dcd
|
[
"MIT"
] | null | null | null |
src/Traits.hpp
|
spraetor/amdis2
|
53c45c81a65752a8fafbb54f9ae6724a86639dcd
|
[
"MIT"
] | null | null | null |
#pragma once
// #include <iostream>
#include "AMDiS_fwd.hpp"
#include "FixVec.hpp"
#include "MatrixVector.hpp"
#include "traits/basic.hpp"
#include "traits/category.hpp"
#include "traits/meta_basic.hpp"
#include "traits/num_cols.hpp"
#include "traits/num_rows.hpp"
#include "traits/size.hpp"
#include "traits/tag.hpp"
namespace AMDiS {} // end namespace AMDiS
| 21.352941
| 41
| 0.746556
|
spraetor
|
51c58ff0cb05e1a6ccc41dd496e0e79b871e4ed7
| 817
|
cpp
|
C++
|
src/shapes/cubic_asymmetric_vertex.cpp
|
kariem2k/rive-cpp
|
f58c3b3d48ea03947a76971bce17e7f567cf0de0
|
[
"MIT"
] | 139
|
2020-08-17T20:10:24.000Z
|
2022-03-28T12:22:44.000Z
|
src/shapes/cubic_asymmetric_vertex.cpp
|
kariem2k/rive-cpp
|
f58c3b3d48ea03947a76971bce17e7f567cf0de0
|
[
"MIT"
] | 89
|
2020-08-28T16:41:01.000Z
|
2022-03-28T19:10:49.000Z
|
src/shapes/cubic_asymmetric_vertex.cpp
|
kariem2k/rive-cpp
|
f58c3b3d48ea03947a76971bce17e7f567cf0de0
|
[
"MIT"
] | 19
|
2020-10-19T00:54:40.000Z
|
2022-02-28T05:34:17.000Z
|
#include "rive/shapes/cubic_asymmetric_vertex.hpp"
#include "rive/math/vec2d.hpp"
#include <cmath>
using namespace rive;
void CubicAsymmetricVertex::computeIn()
{
Vec2D::add(m_InPoint,
Vec2D(x(), y()),
Vec2D(cos(rotation()) * -inDistance(),
sin(rotation()) * -inDistance()));
}
void CubicAsymmetricVertex::computeOut()
{
Vec2D::add(m_OutPoint,
Vec2D(x(), y()),
Vec2D(cos(rotation()) * outDistance(),
sin(rotation()) * outDistance()));
}
void CubicAsymmetricVertex::rotationChanged()
{
m_InValid = false;
m_OutValid = false;
markPathDirty();
}
void CubicAsymmetricVertex::inDistanceChanged()
{
m_InValid = false;
markPathDirty();
}
void CubicAsymmetricVertex::outDistanceChanged()
{
m_OutValid = false;
markPathDirty();
}
| 21.5
| 52
| 0.651163
|
kariem2k
|
51c93424fa96d9fa33a4d095bd18aed41d89f8fc
| 1,295
|
cpp
|
C++
|
src/paint/insets.cpp
|
tralf-strues/simple-gui-library
|
cf72b11d0d245d1a1fefbae10e4aa7fb9e763bff
|
[
"MIT"
] | null | null | null |
src/paint/insets.cpp
|
tralf-strues/simple-gui-library
|
cf72b11d0d245d1a1fefbae10e4aa7fb9e763bff
|
[
"MIT"
] | null | null | null |
src/paint/insets.cpp
|
tralf-strues/simple-gui-library
|
cf72b11d0d245d1a1fefbae10e4aa7fb9e763bff
|
[
"MIT"
] | null | null | null |
/**
* @author Nikita Mochalov (github.com/tralf-strues)
* @file insets.cpp
* @date 2021-11-06
*
* @copyright Copyright (c) 2021
*/
#include "paint/insets.h"
namespace Sgl
{
const Insets Insets::EMPTY = Insets{0, 0, 0, 0};
Insets::Insets(int32_t top, int32_t right, int32_t bottom, int32_t left)
: top(top), right(right), bottom(bottom), left(left) {}
Insets::Insets(int32_t topBottom, int32_t rightLeft)
: Insets(topBottom, rightLeft, topBottom, rightLeft) {}
Insets::Insets(int32_t inset)
: Insets(inset, inset) {}
Insets& Insets::operator+=(const Insets& second)
{
top += second.top;
right += second.right;
bottom += second.bottom;
left += second.left;
return *this;
}
Insets& Insets::operator-=(const Insets& second)
{
top -= second.top;
right -= second.right;
bottom -= second.bottom;
left -= second.left;
return *this;
}
Insets operator+(const Insets& first, const Insets& second)
{
Insets sum{first};
sum += second;
return sum;
}
Insets operator-(const Insets& first, const Insets& second)
{
Insets dif{first};
dif -= second;
return dif;
}
}
| 21.949153
| 76
| 0.573745
|
tralf-strues
|
51c938dfefd58fca698bbb36b0f5270cf09aa717
| 383
|
cpp
|
C++
|
common/os/file.cpp
|
JustSlavic/gl2
|
1b4752d3273a1e401c970e18ae7151bba004a4ec
|
[
"MIT"
] | null | null | null |
common/os/file.cpp
|
JustSlavic/gl2
|
1b4752d3273a1e401c970e18ae7151bba004a4ec
|
[
"MIT"
] | 2
|
2021-05-29T20:34:50.000Z
|
2021-05-29T20:39:25.000Z
|
common/os/file.cpp
|
JustSlavic/gl2
|
1b4752d3273a1e401c970e18ae7151bba004a4ec
|
[
"MIT"
] | null | null | null |
#include "file.hpp"
namespace os {
#ifdef PLATFORM_LINUX
#include "linux/file.cpp"
#endif
#ifdef PLATFORM_WINDOWS
#include "windows/file.cpp"
#endif
#ifdef PLATFORM_APPLE
#error "Path for APPLE is not implemented!"
// #include "apple/path.cpp"
#endif
template <>
i32 file::writer::write (i32 value) {
ASSERT(descriptor);
return fprintf(descriptor, "%d", value);
}
} // os
| 13.678571
| 43
| 0.710183
|
JustSlavic
|
51ce6e0d46e3a89ff529abb7b3055475b78c418e
| 481
|
cpp
|
C++
|
src/false_object.cpp
|
scwfri/natalie
|
11e874607a8ac7b934e57c4c7e5790623afaee7a
|
[
"MIT"
] | 7
|
2022-03-08T08:47:54.000Z
|
2022-03-29T15:08:36.000Z
|
src/false_object.cpp
|
scwfri/natalie
|
11e874607a8ac7b934e57c4c7e5790623afaee7a
|
[
"MIT"
] | 12
|
2022-03-10T13:04:42.000Z
|
2022-03-24T01:40:23.000Z
|
src/false_object.cpp
|
scwfri/natalie
|
11e874607a8ac7b934e57c4c7e5790623afaee7a
|
[
"MIT"
] | 5
|
2022-03-13T17:46:16.000Z
|
2022-03-31T07:28:26.000Z
|
#include "natalie.hpp"
namespace Natalie {
bool FalseObject::and_method(Env *env, Value other) {
return false;
}
bool FalseObject::or_method(Env *env, Value other) {
return other->is_truthy();
}
Value FalseObject::to_s(Env *env) {
if (!s_string)
s_string = new StringObject { "false" };
return s_string;
}
void FalseObject::visit_children(Visitor &visitor) {
Object::visit_children(visitor);
if (s_string)
visitor.visit(s_string);
}
}
| 18.5
| 53
| 0.671518
|
scwfri
|
51d599938510d83224a340bd109409d3271930ce
| 12,216
|
cpp
|
C++
|
src/dicom/DICOMBrowser.cpp
|
RWTHmediTEC/CarnaDICOM
|
b767cc5f7484b85d24b7557d5d86efebad57b2ef
|
[
"BSD-3-Clause"
] | null | null | null |
src/dicom/DICOMBrowser.cpp
|
RWTHmediTEC/CarnaDICOM
|
b767cc5f7484b85d24b7557d5d86efebad57b2ef
|
[
"BSD-3-Clause"
] | 1
|
2015-07-25T13:26:42.000Z
|
2015-07-25T13:26:42.000Z
|
src/dicom/DICOMBrowser.cpp
|
RWTHmediTEC/CarnaDICOM
|
b767cc5f7484b85d24b7557d5d86efebad57b2ef
|
[
"BSD-3-Clause"
] | null | null | null |
/*
* Copyright (C) 2010 - 2015 Leonid Kostrykin
*
* Chair of Medical Engineering (mediTEC)
* RWTH Aachen University
* Pauwelsstr. 20
* 52074 Aachen
* Germany
*
*/
#include <Carna/dicom/CarnaDICOM.h>
#if !CARNAQT_DISABLED
#include <Carna/dicom/DICOMBrowser.h>
#include <Carna/dicom/DICOMBrowserDetails.h>
#include <Carna/dicom/SeriesView.h>
#include <Carna/dicom/DicomManager.h>
#include <Carna/dicom/Series.h>
#include <QProgressDialog>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QPushButton>
#include <QFileDialog>
#include <QDoubleSpinBox>
#include <QLabel>
#include <QThread>
#include <QMessageBox>
#include <QCheckBox>
#include <climits>
#include <sstream>
namespace Carna
{
namespace dicom
{
// ----------------------------------------------------------------------------------
// DICOMBrowser :: Details
// ----------------------------------------------------------------------------------
DICOMBrowser::Details::Details( DICOMBrowser& self )
: self( self )
, seriesView( new SeriesView() )
, laSpacingZ( new QLabel( "Z-Spacing:" ) )
, sbSpacingZ( new QDoubleSpinBox() )
, buSaveIndex( new QPushButton( "Save Index..." ) )
, buExtract( new QPushButton( "Extract Series..." ) )
, cbNormals( new QCheckBox( "Compute Normals" ) )
, buLoad( new QPushButton( "Load Series" ) )
, workThread( new QThread() )
, dir( new AsyncDirectory() )
, vgf( new AsyncVolumeGridFactory() )
, spacing( new base::math::Vector3f() )
, patients( nullptr )
{
connect( workThread, SIGNAL( finished() ), workThread, SLOT( deleteLater() ) );
connect( workThread, SIGNAL( finished() ), dir, SLOT( deleteLater() ) );
connect( workThread, SIGNAL( finished() ), vgf, SLOT( deleteLater() ) );
dir->moveToThread( workThread );
vgf->moveToThread( workThread );
workThread->start();
connect( this, SIGNAL( openDirectory( const QString& ) ), dir, SLOT( open( const QString& ) ) );
connect( this, SIGNAL( loadVolumeGrid() ), vgf, SLOT( load() ) );
}
DICOMBrowser::Details::~Details()
{
workThread->quit();
}
void DICOMBrowser::Details::setPatients( const std::vector< Patient* >& patients )
{
this->patients = &patients;
seriesView->clear();
for( auto patientItr = patients.begin(); patientItr != patients.end(); ++patientItr )
{
seriesView->addPatient( **patientItr );
}
buSaveIndex->setEnabled( true );
}
void DICOMBrowser::Details::loadSeries( const Series& series )
{
QProgressDialog progress( "Loading data...", "", 0, 0, &self );
progress.setCancelButton( nullptr );
progress.setAutoReset( false );
connect( vgf, SIGNAL( workAmountChanged( int ) ), &progress, SLOT( setMaximum( int ) ) );
connect( vgf, SIGNAL( workAmountDone( int ) ), &progress, SLOT( setValue( int ) ) );
connect( vgf, SIGNAL( workHintChanged( const QString& ) ), &progress, SLOT( setLabelText( const QString& ) ) );
connect( vgf, SIGNAL( finished() ), &progress, SLOT( reset() ) );
vgf->setSeries( series );
vgf->setNormals( cbNormals->isChecked() );
emit loadVolumeGrid();
progress.exec();
}
// ----------------------------------------------------------------------------------
// DICOMBrowser
// ----------------------------------------------------------------------------------
DICOMBrowser::DICOMBrowser()
: pimpl( new Details( *this ) )
{
//qRegisterMetaType< Carna::dicom::DicomExtractionSettings >( "Carna::dicom::DicomExtractionSettings" );
// ---------------------------------------------------------------------------------
QVBoxLayout* const master = new QVBoxLayout();
QHBoxLayout* const controls = new QHBoxLayout();
// ---------------------------------------------------------------------------------
QPushButton* const buOpenDirectory = new QPushButton( "Scan Directory..." );
QPushButton* const buOpenIndex = new QPushButton( "Open Index..." );
pimpl->sbSpacingZ->setRange( 0.01, std::numeric_limits< double >::max() );
pimpl->sbSpacingZ->setSingleStep( 0.1 );
pimpl->sbSpacingZ->setDecimals( 3 );
pimpl->sbSpacingZ->setSuffix( " mm" );
pimpl->laSpacingZ->setBuddy( pimpl->sbSpacingZ );
pimpl->laSpacingZ->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
controls->addWidget( buOpenDirectory );
controls->addWidget( buOpenIndex );
controls->addWidget( pimpl->buSaveIndex );
//controls->addWidget( pimpl->buExtract );
controls->addWidget( pimpl->cbNormals );
controls->addWidget( pimpl->laSpacingZ );
controls->addWidget( pimpl->sbSpacingZ );
controls->addWidget( pimpl->buLoad );
master->addLayout( controls );
master->addWidget( pimpl->seriesView );
connect( buOpenDirectory, SIGNAL( clicked() ), this, SLOT( openDirectory() ) );
connect( buOpenIndex, SIGNAL( clicked() ), this, SLOT( openIndex() ) );
connect( pimpl->buSaveIndex, SIGNAL( clicked() ), this, SLOT( saveIndex() ) );
connect( pimpl->seriesView, SIGNAL( selectionChanged() ), this, SLOT( updateSelectionState() ) );
connect( pimpl->buExtract, SIGNAL( clicked() ), this, SLOT( extractSeries() ) );
connect( pimpl->buLoad, SIGNAL( clicked() ), this, SLOT( loadSeries() ) );
connect
( pimpl->seriesView, SIGNAL( seriesSelected( const Carna::dicom::Series& ) )
, this, SLOT( setSelectedSeries( const Carna::dicom::Series& ) ) );
connect
( pimpl->seriesView, SIGNAL( seriesDoubleClicked( const Carna::dicom::Series& ) )
, this, SLOT( loadSeries( const Carna::dicom::Series& ) ) );
pimpl->buSaveIndex->setEnabled( false );
pimpl->buExtract->setEnabled( false );
updateSelectionState();
// ---------------------------------------------------------------------------------
this->setLayout( master );
}
DICOMBrowser::~DICOMBrowser()
{
}
void DICOMBrowser::openDirectory()
{
closePatients();
// ---------------------------------------------------------------------------------
const QString dirName = QFileDialog::getExistingDirectory
( this
, "Open Directory", ""
, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks | QFileDialog::HideNameFilterDetails );
if( !dirName.isEmpty() )
{
QProgressDialog progress( dirName, "Cancel", 0, 100, this );
connect( pimpl->dir, SIGNAL( fileCountDetermined( int ) ), &progress, SLOT( setMaximum( int ) ) );
connect( pimpl->dir, SIGNAL( fileProcessed( int ) ), &progress, SLOT( setValue( int ) ) );
connect( &progress, SIGNAL( canceled() ), pimpl->dir, SLOT( cancel() ) );
emit pimpl->openDirectory( dirName );
progress.exec();
/* Report files that failed to be read.
*/
if( !pimpl->dir->failedFiles().empty() )
{
std::stringstream failedFiles;
for( auto it = pimpl->dir->failedFiles().begin(); it != pimpl->dir->failedFiles().end(); ++it )
{
failedFiles << ( *it ) << std::endl;
}
QMessageBox msgBox;
msgBox.setIcon( QMessageBox::Warning );
msgBox.setText
( "Failed to read "
+ QString::number( pimpl->dir->failedFiles().size() )
+ " file(s). Refer to the details section for a full list." );
msgBox.setDetailedText( QString::fromStdString( failedFiles.str() ) );
msgBox.setStandardButtons( QMessageBox::Ok );
msgBox.setDefaultButton( QMessageBox::Ok );
msgBox.setEscapeButton( QMessageBox::Ok );
msgBox.exec();
}
/* Update UI.
*/
pimpl->setPatients( pimpl->dir->patients() );
}
}
void DICOMBrowser::openIndex()
{
closePatients();
// ----------------------------------------------------------------------------------
const QString fileName = QFileDialog::getOpenFileName
( this
, "Open Index", "", "Index Files (*.idx);;XML Files (*.xml);;All files (*.*)"
, 0, QFileDialog::ReadOnly | QFileDialog::HideNameFilterDetails );
if( !fileName.isEmpty() )
{
pimpl->ifr.open( fileName );
pimpl->setPatients( pimpl->ifr.patients() );
}
}
void DICOMBrowser::saveIndex()
{
CARNA_ASSERT( pimpl->patients != nullptr );
const QString fileName = QFileDialog::getSaveFileName
( this
, "Save Index", "", "Index Files (*.idx);;XML Files (*.xml);;All files (*.*)"
, 0, QFileDialog::DontResolveSymlinks| QFileDialog::HideNameFilterDetails );
if( !fileName.isEmpty() )
{
pimpl->ifw.write( fileName, *pimpl->patients );
}
}
void DICOMBrowser::closePatients()
{
pimpl->patients = nullptr;
pimpl->seriesView->clear();
pimpl->buSaveIndex->setEnabled( false );
}
void DICOMBrowser::updateSelectionState()
{
const unsigned int selected_series_count = pimpl->seriesView->getSelectedSeries().size();
pimpl->laSpacingZ->setEnabled( selected_series_count == 1 );
pimpl->sbSpacingZ->setEnabled( selected_series_count == 1 );
pimpl->buLoad->setEnabled( selected_series_count == 1 );
pimpl->buExtract->setEnabled( selected_series_count > 0 );
}
void DICOMBrowser::setSelectedSeries( const Series& series )
{
pimpl->sbSpacingZ->setValue( series.spacingZ() );
}
void DICOMBrowser::extractSeries()
{
/*
const auto& selected_series = seriesView->getSelectedSeries();
if( selected_series.empty() )
{
return;
}
QString dirName = QFileDialog::getExistingDirectory( this
, "Extract Series"
, ""
, QFileDialog::ShowDirsOnly
| QFileDialog::DontResolveSymlinks );
if( dirName.isEmpty() )
{
return;
}
QPushButton* const cancelButton = new QPushButton( "Cancel" );
cancelButton->setEnabled( false );
base::qt::CarnaProgressDialog extractingController( dirName, "Cancel", 0, 0, this );
extractingController.setCancelButton( cancelButton );
extractingController.setWindowTitle( "Extract Series" );
extractingController.setWindowModality( Qt::WindowModal );
extractingController.setModal( true );
connect( manager, SIGNAL( finished() ), &extractingController, SLOT( accept() ) );
connect( manager, SIGNAL( failed() ), &extractingController, SLOT( reject() ) );
connect( manager, SIGNAL( failed( const QString& ) ), this, SLOT( extractionFailed( const QString& ) ) );
connect( manager, SIGNAL( totalFilesCountChanged( unsigned int ) ), &extractingController, SLOT( setMaximum( unsigned int ) ) );
connect( manager, SIGNAL( processedFilesCountChanged( unsigned int ) ), &extractingController, SLOT( setValue( unsigned int ) ) );
DicomExtractionSettings settings( dirName, selected_series );
emit extractSeries( settings );
extractingController.exec();
disconnect( manager, SIGNAL( failed( const QString& ) ), this, SLOT( extractionFailed( const QString& ) ) );
*/
}
void DICOMBrowser::loadSeries()
{
const auto& selectedSeries = pimpl->seriesView->getSelectedSeries();
if( selectedSeries.size() == 1 )
{
pimpl->loadSeries( **selectedSeries.begin() );
const double zSpacing = pimpl->sbSpacingZ->value();
base::math::Vector3f& spacing = *pimpl->spacing;
spacing = pimpl->vgf->spacing();
spacing.z() = zSpacing;
emit volumeGridLoaded();
}
}
void DICOMBrowser::loadSeries( const Series& series )
{
pimpl->loadSeries( series );
base::math::Vector3f& spacing = *pimpl->spacing;
spacing = pimpl->vgf->spacing();
emit volumeGridLoaded();
}
Carna::helpers::VolumeGridHelperBase* DICOMBrowser::takeLoadedVolumeGrid()
{
return pimpl->vgf->takeLoadedVolumeGrid();
}
Carna::helpers::VolumeGridHelperBase::Spacing DICOMBrowser::loadedVolumeGridSpacing() const
{
return Carna::helpers::VolumeGridHelperBase::Spacing( *pimpl->spacing );
}
} // namespace Carna :: dicom
} // namespace Carna
#endif // CARNAQT_DISABLED
| 32.75067
| 134
| 0.597168
|
RWTHmediTEC
|
51e44bc7aadacc1bf880a5918a0445670103cc49
| 64,352
|
cpp
|
C++
|
deployed/Il2CppOutputProject/Source/il2cppOutput/Bulk_UnityEngine.StandardEvents_0.cpp
|
PaulDixon/HelloWorld
|
f73f1eb2f972b3bc03420727e3c383ff63041af9
|
[
"MIT"
] | null | null | null |
deployed/Il2CppOutputProject/Source/il2cppOutput/Bulk_UnityEngine.StandardEvents_0.cpp
|
PaulDixon/HelloWorld
|
f73f1eb2f972b3bc03420727e3c383ff63041af9
|
[
"MIT"
] | null | null | null |
deployed/Il2CppOutputProject/Source/il2cppOutput/Bulk_UnityEngine.StandardEvents_0.cpp
|
PaulDixon/HelloWorld
|
f73f1eb2f972b3bc03420727e3c383ff63041af9
|
[
"MIT"
] | null | null | null |
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <cstring>
#include <string.h>
#include <stdio.h>
#include <cmath>
#include <limits>
#include <assert.h>
#include <stdint.h>
#include "il2cpp-class-internals.h"
#include "codegen/il2cpp-codegen.h"
#include "il2cpp-object-internals.h"
template <typename R>
struct InterfaceFuncInvoker0
{
typedef R (*Func)(void*, const RuntimeMethod*);
static inline R Invoke (Il2CppMethodSlot slot, RuntimeClass* declaringInterface, RuntimeObject* obj)
{
const VirtualInvokeData& invokeData = il2cpp_codegen_get_interface_invoke_data(slot, obj, declaringInterface);
return ((Func)invokeData.methodPtr)(obj, invokeData.method);
}
};
struct InterfaceActionInvoker0
{
typedef void (*Action)(void*, const RuntimeMethod*);
static inline void Invoke (Il2CppMethodSlot slot, RuntimeClass* declaringInterface, RuntimeObject* obj)
{
const VirtualInvokeData& invokeData = il2cpp_codegen_get_interface_invoke_data(slot, obj, declaringInterface);
((Action)invokeData.methodPtr)(obj, invokeData.method);
}
};
// System.String
struct String_t;
// System.ArgumentException
struct ArgumentException_t132251570;
// System.Collections.Generic.IDictionary`2<System.String,System.Object>
struct IDictionary_2_t1329213854;
// System.Object[]
struct ObjectU5BU5D_t2843939325;
// System.Collections.Generic.Dictionary`2<System.String,System.Object>
struct Dictionary_2_t2865362463;
// System.Collections.Generic.Dictionary`2<System.Object,System.Object>
struct Dictionary_2_t132545152;
// System.Collections.Generic.Dictionary`2<System.String,System.String>
struct Dictionary_2_t1632706988;
// System.Int32[]
struct Int32U5BU5D_t385246372;
// System.Collections.Generic.Dictionary`2/Entry<System.String,System.String>[]
struct EntryU5BU5D_t885026589;
// System.Collections.Generic.IEqualityComparer`1<System.String>
struct IEqualityComparer_1_t3954782707;
// System.Collections.Generic.Dictionary`2/KeyCollection<System.String,System.String>
struct KeyCollection_t1822382459;
// System.Collections.Generic.Dictionary`2/ValueCollection<System.String,System.String>
struct ValueCollection_t3348751306;
// System.Collections.Generic.Dictionary`2/Entry<System.String,System.Object>[]
struct EntryU5BU5D_t2447176574;
// System.Collections.Generic.Dictionary`2/KeyCollection<System.String,System.Object>
struct KeyCollection_t3055037934;
// System.Collections.Generic.Dictionary`2/ValueCollection<System.String,System.Object>
struct ValueCollection_t286439485;
// System.Collections.IDictionary
struct IDictionary_t1363984059;
// System.Runtime.Serialization.SafeSerializationManager
struct SafeSerializationManager_t2481557153;
// System.Diagnostics.StackTrace[]
struct StackTraceU5BU5D_t1169129676;
// System.IntPtr[]
struct IntPtrU5BU5D_t4013366056;
// System.Char[]
struct CharU5BU5D_t3528271667;
extern RuntimeClass* AnalyticsEvent_t4058973021_il2cpp_TypeInfo_var;
extern const uint32_t AnalyticsEvent_get_debugMode_m2240954048_MetadataUsageId;
extern RuntimeClass* ArgumentException_t132251570_il2cpp_TypeInfo_var;
extern const RuntimeMethod* AnalyticsEvent_OnValidationFailed_m2609604624_RuntimeMethod_var;
extern const uint32_t AnalyticsEvent_OnValidationFailed_m2609604624_MetadataUsageId;
extern RuntimeClass* String_t_il2cpp_TypeInfo_var;
extern RuntimeClass* ICollection_1_t3796219568_il2cpp_TypeInfo_var;
extern RuntimeClass* Int32_t2950945753_il2cpp_TypeInfo_var;
extern RuntimeClass* IEnumerable_1_t4242887519_il2cpp_TypeInfo_var;
extern RuntimeClass* IEnumerator_1_t1400637802_il2cpp_TypeInfo_var;
extern RuntimeClass* IEnumerator_t1853284238_il2cpp_TypeInfo_var;
extern RuntimeClass* IDisposable_t3640265483_il2cpp_TypeInfo_var;
extern RuntimeClass* ObjectU5BU5D_t2843939325_il2cpp_TypeInfo_var;
extern RuntimeClass* AnalyticsResult_t2273004240_il2cpp_TypeInfo_var;
extern RuntimeClass* Debug_t3317548046_il2cpp_TypeInfo_var;
extern const RuntimeMethod* KeyValuePair_2_get_Key_m256823211_RuntimeMethod_var;
extern const RuntimeMethod* KeyValuePair_2_get_Value_m4108279609_RuntimeMethod_var;
extern String_t* _stringLiteral3082188891;
extern String_t* _stringLiteral3848816014;
extern String_t* _stringLiteral3610066572;
extern String_t* _stringLiteral3713525075;
extern String_t* _stringLiteral1348467685;
extern String_t* _stringLiteral69560130;
extern String_t* _stringLiteral2157825051;
extern const uint32_t AnalyticsEvent_Custom_m227997836_MetadataUsageId;
extern RuntimeClass* Dictionary_2_t2865362463_il2cpp_TypeInfo_var;
extern RuntimeClass* Dictionary_2_t1632706988_il2cpp_TypeInfo_var;
extern const RuntimeMethod* Dictionary_2__ctor_m15304876_RuntimeMethod_var;
extern const RuntimeMethod* Dictionary_2__ctor_m444307833_RuntimeMethod_var;
extern const RuntimeMethod* Dictionary_2_Add_m3045345476_RuntimeMethod_var;
extern String_t* _stringLiteral314968592;
extern String_t* _stringLiteral223781046;
extern String_t* _stringLiteral591401181;
extern String_t* _stringLiteral2670495305;
extern String_t* _stringLiteral3038431854;
extern String_t* _stringLiteral1860111314;
extern String_t* _stringLiteral3191806752;
extern String_t* _stringLiteral2793515199;
extern String_t* _stringLiteral1822927358;
extern String_t* _stringLiteral3946338038;
extern String_t* _stringLiteral1285374328;
extern String_t* _stringLiteral1477325238;
extern String_t* _stringLiteral359657463;
extern String_t* _stringLiteral2913916239;
extern String_t* _stringLiteral4063851185;
extern String_t* _stringLiteral2569810339;
extern String_t* _stringLiteral243880865;
extern const uint32_t AnalyticsEvent__cctor_m3994162614_MetadataUsageId;
struct Exception_t_marshaled_pinvoke;
struct Exception_t_marshaled_com;
struct ObjectU5BU5D_t2843939325;
#ifndef U3CMODULEU3E_T692745553_H
#define U3CMODULEU3E_T692745553_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// <Module>
struct U3CModuleU3E_t692745553
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // U3CMODULEU3E_T692745553_H
#ifndef RUNTIMEOBJECT_H
#define RUNTIMEOBJECT_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Object
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RUNTIMEOBJECT_H
#ifndef DICTIONARY_2_T1632706988_H
#define DICTIONARY_2_T1632706988_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Collections.Generic.Dictionary`2<System.String,System.String>
struct Dictionary_2_t1632706988 : public RuntimeObject
{
public:
// System.Int32[] System.Collections.Generic.Dictionary`2::buckets
Int32U5BU5D_t385246372* ___buckets_0;
// System.Collections.Generic.Dictionary`2/Entry<TKey,TValue>[] System.Collections.Generic.Dictionary`2::entries
EntryU5BU5D_t885026589* ___entries_1;
// System.Int32 System.Collections.Generic.Dictionary`2::count
int32_t ___count_2;
// System.Int32 System.Collections.Generic.Dictionary`2::version
int32_t ___version_3;
// System.Int32 System.Collections.Generic.Dictionary`2::freeList
int32_t ___freeList_4;
// System.Int32 System.Collections.Generic.Dictionary`2::freeCount
int32_t ___freeCount_5;
// System.Collections.Generic.IEqualityComparer`1<TKey> System.Collections.Generic.Dictionary`2::comparer
RuntimeObject* ___comparer_6;
// System.Collections.Generic.Dictionary`2/KeyCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::keys
KeyCollection_t1822382459 * ___keys_7;
// System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values
ValueCollection_t3348751306 * ___values_8;
// System.Object System.Collections.Generic.Dictionary`2::_syncRoot
RuntimeObject * ____syncRoot_9;
public:
inline static int32_t get_offset_of_buckets_0() { return static_cast<int32_t>(offsetof(Dictionary_2_t1632706988, ___buckets_0)); }
inline Int32U5BU5D_t385246372* get_buckets_0() const { return ___buckets_0; }
inline Int32U5BU5D_t385246372** get_address_of_buckets_0() { return &___buckets_0; }
inline void set_buckets_0(Int32U5BU5D_t385246372* value)
{
___buckets_0 = value;
Il2CppCodeGenWriteBarrier((&___buckets_0), value);
}
inline static int32_t get_offset_of_entries_1() { return static_cast<int32_t>(offsetof(Dictionary_2_t1632706988, ___entries_1)); }
inline EntryU5BU5D_t885026589* get_entries_1() const { return ___entries_1; }
inline EntryU5BU5D_t885026589** get_address_of_entries_1() { return &___entries_1; }
inline void set_entries_1(EntryU5BU5D_t885026589* value)
{
___entries_1 = value;
Il2CppCodeGenWriteBarrier((&___entries_1), value);
}
inline static int32_t get_offset_of_count_2() { return static_cast<int32_t>(offsetof(Dictionary_2_t1632706988, ___count_2)); }
inline int32_t get_count_2() const { return ___count_2; }
inline int32_t* get_address_of_count_2() { return &___count_2; }
inline void set_count_2(int32_t value)
{
___count_2 = value;
}
inline static int32_t get_offset_of_version_3() { return static_cast<int32_t>(offsetof(Dictionary_2_t1632706988, ___version_3)); }
inline int32_t get_version_3() const { return ___version_3; }
inline int32_t* get_address_of_version_3() { return &___version_3; }
inline void set_version_3(int32_t value)
{
___version_3 = value;
}
inline static int32_t get_offset_of_freeList_4() { return static_cast<int32_t>(offsetof(Dictionary_2_t1632706988, ___freeList_4)); }
inline int32_t get_freeList_4() const { return ___freeList_4; }
inline int32_t* get_address_of_freeList_4() { return &___freeList_4; }
inline void set_freeList_4(int32_t value)
{
___freeList_4 = value;
}
inline static int32_t get_offset_of_freeCount_5() { return static_cast<int32_t>(offsetof(Dictionary_2_t1632706988, ___freeCount_5)); }
inline int32_t get_freeCount_5() const { return ___freeCount_5; }
inline int32_t* get_address_of_freeCount_5() { return &___freeCount_5; }
inline void set_freeCount_5(int32_t value)
{
___freeCount_5 = value;
}
inline static int32_t get_offset_of_comparer_6() { return static_cast<int32_t>(offsetof(Dictionary_2_t1632706988, ___comparer_6)); }
inline RuntimeObject* get_comparer_6() const { return ___comparer_6; }
inline RuntimeObject** get_address_of_comparer_6() { return &___comparer_6; }
inline void set_comparer_6(RuntimeObject* value)
{
___comparer_6 = value;
Il2CppCodeGenWriteBarrier((&___comparer_6), value);
}
inline static int32_t get_offset_of_keys_7() { return static_cast<int32_t>(offsetof(Dictionary_2_t1632706988, ___keys_7)); }
inline KeyCollection_t1822382459 * get_keys_7() const { return ___keys_7; }
inline KeyCollection_t1822382459 ** get_address_of_keys_7() { return &___keys_7; }
inline void set_keys_7(KeyCollection_t1822382459 * value)
{
___keys_7 = value;
Il2CppCodeGenWriteBarrier((&___keys_7), value);
}
inline static int32_t get_offset_of_values_8() { return static_cast<int32_t>(offsetof(Dictionary_2_t1632706988, ___values_8)); }
inline ValueCollection_t3348751306 * get_values_8() const { return ___values_8; }
inline ValueCollection_t3348751306 ** get_address_of_values_8() { return &___values_8; }
inline void set_values_8(ValueCollection_t3348751306 * value)
{
___values_8 = value;
Il2CppCodeGenWriteBarrier((&___values_8), value);
}
inline static int32_t get_offset_of__syncRoot_9() { return static_cast<int32_t>(offsetof(Dictionary_2_t1632706988, ____syncRoot_9)); }
inline RuntimeObject * get__syncRoot_9() const { return ____syncRoot_9; }
inline RuntimeObject ** get_address_of__syncRoot_9() { return &____syncRoot_9; }
inline void set__syncRoot_9(RuntimeObject * value)
{
____syncRoot_9 = value;
Il2CppCodeGenWriteBarrier((&____syncRoot_9), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // DICTIONARY_2_T1632706988_H
struct Il2CppArrayBounds;
#ifndef RUNTIMEARRAY_H
#define RUNTIMEARRAY_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Array
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RUNTIMEARRAY_H
#ifndef DICTIONARY_2_T2865362463_H
#define DICTIONARY_2_T2865362463_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Collections.Generic.Dictionary`2<System.String,System.Object>
struct Dictionary_2_t2865362463 : public RuntimeObject
{
public:
// System.Int32[] System.Collections.Generic.Dictionary`2::buckets
Int32U5BU5D_t385246372* ___buckets_0;
// System.Collections.Generic.Dictionary`2/Entry<TKey,TValue>[] System.Collections.Generic.Dictionary`2::entries
EntryU5BU5D_t2447176574* ___entries_1;
// System.Int32 System.Collections.Generic.Dictionary`2::count
int32_t ___count_2;
// System.Int32 System.Collections.Generic.Dictionary`2::version
int32_t ___version_3;
// System.Int32 System.Collections.Generic.Dictionary`2::freeList
int32_t ___freeList_4;
// System.Int32 System.Collections.Generic.Dictionary`2::freeCount
int32_t ___freeCount_5;
// System.Collections.Generic.IEqualityComparer`1<TKey> System.Collections.Generic.Dictionary`2::comparer
RuntimeObject* ___comparer_6;
// System.Collections.Generic.Dictionary`2/KeyCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::keys
KeyCollection_t3055037934 * ___keys_7;
// System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values
ValueCollection_t286439485 * ___values_8;
// System.Object System.Collections.Generic.Dictionary`2::_syncRoot
RuntimeObject * ____syncRoot_9;
public:
inline static int32_t get_offset_of_buckets_0() { return static_cast<int32_t>(offsetof(Dictionary_2_t2865362463, ___buckets_0)); }
inline Int32U5BU5D_t385246372* get_buckets_0() const { return ___buckets_0; }
inline Int32U5BU5D_t385246372** get_address_of_buckets_0() { return &___buckets_0; }
inline void set_buckets_0(Int32U5BU5D_t385246372* value)
{
___buckets_0 = value;
Il2CppCodeGenWriteBarrier((&___buckets_0), value);
}
inline static int32_t get_offset_of_entries_1() { return static_cast<int32_t>(offsetof(Dictionary_2_t2865362463, ___entries_1)); }
inline EntryU5BU5D_t2447176574* get_entries_1() const { return ___entries_1; }
inline EntryU5BU5D_t2447176574** get_address_of_entries_1() { return &___entries_1; }
inline void set_entries_1(EntryU5BU5D_t2447176574* value)
{
___entries_1 = value;
Il2CppCodeGenWriteBarrier((&___entries_1), value);
}
inline static int32_t get_offset_of_count_2() { return static_cast<int32_t>(offsetof(Dictionary_2_t2865362463, ___count_2)); }
inline int32_t get_count_2() const { return ___count_2; }
inline int32_t* get_address_of_count_2() { return &___count_2; }
inline void set_count_2(int32_t value)
{
___count_2 = value;
}
inline static int32_t get_offset_of_version_3() { return static_cast<int32_t>(offsetof(Dictionary_2_t2865362463, ___version_3)); }
inline int32_t get_version_3() const { return ___version_3; }
inline int32_t* get_address_of_version_3() { return &___version_3; }
inline void set_version_3(int32_t value)
{
___version_3 = value;
}
inline static int32_t get_offset_of_freeList_4() { return static_cast<int32_t>(offsetof(Dictionary_2_t2865362463, ___freeList_4)); }
inline int32_t get_freeList_4() const { return ___freeList_4; }
inline int32_t* get_address_of_freeList_4() { return &___freeList_4; }
inline void set_freeList_4(int32_t value)
{
___freeList_4 = value;
}
inline static int32_t get_offset_of_freeCount_5() { return static_cast<int32_t>(offsetof(Dictionary_2_t2865362463, ___freeCount_5)); }
inline int32_t get_freeCount_5() const { return ___freeCount_5; }
inline int32_t* get_address_of_freeCount_5() { return &___freeCount_5; }
inline void set_freeCount_5(int32_t value)
{
___freeCount_5 = value;
}
inline static int32_t get_offset_of_comparer_6() { return static_cast<int32_t>(offsetof(Dictionary_2_t2865362463, ___comparer_6)); }
inline RuntimeObject* get_comparer_6() const { return ___comparer_6; }
inline RuntimeObject** get_address_of_comparer_6() { return &___comparer_6; }
inline void set_comparer_6(RuntimeObject* value)
{
___comparer_6 = value;
Il2CppCodeGenWriteBarrier((&___comparer_6), value);
}
inline static int32_t get_offset_of_keys_7() { return static_cast<int32_t>(offsetof(Dictionary_2_t2865362463, ___keys_7)); }
inline KeyCollection_t3055037934 * get_keys_7() const { return ___keys_7; }
inline KeyCollection_t3055037934 ** get_address_of_keys_7() { return &___keys_7; }
inline void set_keys_7(KeyCollection_t3055037934 * value)
{
___keys_7 = value;
Il2CppCodeGenWriteBarrier((&___keys_7), value);
}
inline static int32_t get_offset_of_values_8() { return static_cast<int32_t>(offsetof(Dictionary_2_t2865362463, ___values_8)); }
inline ValueCollection_t286439485 * get_values_8() const { return ___values_8; }
inline ValueCollection_t286439485 ** get_address_of_values_8() { return &___values_8; }
inline void set_values_8(ValueCollection_t286439485 * value)
{
___values_8 = value;
Il2CppCodeGenWriteBarrier((&___values_8), value);
}
inline static int32_t get_offset_of__syncRoot_9() { return static_cast<int32_t>(offsetof(Dictionary_2_t2865362463, ____syncRoot_9)); }
inline RuntimeObject * get__syncRoot_9() const { return ____syncRoot_9; }
inline RuntimeObject ** get_address_of__syncRoot_9() { return &____syncRoot_9; }
inline void set__syncRoot_9(RuntimeObject * value)
{
____syncRoot_9 = value;
Il2CppCodeGenWriteBarrier((&____syncRoot_9), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // DICTIONARY_2_T2865362463_H
#ifndef EXCEPTION_T_H
#define EXCEPTION_T_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Exception
struct Exception_t : public RuntimeObject
{
public:
// System.String System.Exception::_className
String_t* ____className_1;
// System.String System.Exception::_message
String_t* ____message_2;
// System.Collections.IDictionary System.Exception::_data
RuntimeObject* ____data_3;
// System.Exception System.Exception::_innerException
Exception_t * ____innerException_4;
// System.String System.Exception::_helpURL
String_t* ____helpURL_5;
// System.Object System.Exception::_stackTrace
RuntimeObject * ____stackTrace_6;
// System.String System.Exception::_stackTraceString
String_t* ____stackTraceString_7;
// System.String System.Exception::_remoteStackTraceString
String_t* ____remoteStackTraceString_8;
// System.Int32 System.Exception::_remoteStackIndex
int32_t ____remoteStackIndex_9;
// System.Object System.Exception::_dynamicMethods
RuntimeObject * ____dynamicMethods_10;
// System.Int32 System.Exception::_HResult
int32_t ____HResult_11;
// System.String System.Exception::_source
String_t* ____source_12;
// System.Runtime.Serialization.SafeSerializationManager System.Exception::_safeSerializationManager
SafeSerializationManager_t2481557153 * ____safeSerializationManager_13;
// System.Diagnostics.StackTrace[] System.Exception::captured_traces
StackTraceU5BU5D_t1169129676* ___captured_traces_14;
// System.IntPtr[] System.Exception::native_trace_ips
IntPtrU5BU5D_t4013366056* ___native_trace_ips_15;
public:
inline static int32_t get_offset_of__className_1() { return static_cast<int32_t>(offsetof(Exception_t, ____className_1)); }
inline String_t* get__className_1() const { return ____className_1; }
inline String_t** get_address_of__className_1() { return &____className_1; }
inline void set__className_1(String_t* value)
{
____className_1 = value;
Il2CppCodeGenWriteBarrier((&____className_1), value);
}
inline static int32_t get_offset_of__message_2() { return static_cast<int32_t>(offsetof(Exception_t, ____message_2)); }
inline String_t* get__message_2() const { return ____message_2; }
inline String_t** get_address_of__message_2() { return &____message_2; }
inline void set__message_2(String_t* value)
{
____message_2 = value;
Il2CppCodeGenWriteBarrier((&____message_2), value);
}
inline static int32_t get_offset_of__data_3() { return static_cast<int32_t>(offsetof(Exception_t, ____data_3)); }
inline RuntimeObject* get__data_3() const { return ____data_3; }
inline RuntimeObject** get_address_of__data_3() { return &____data_3; }
inline void set__data_3(RuntimeObject* value)
{
____data_3 = value;
Il2CppCodeGenWriteBarrier((&____data_3), value);
}
inline static int32_t get_offset_of__innerException_4() { return static_cast<int32_t>(offsetof(Exception_t, ____innerException_4)); }
inline Exception_t * get__innerException_4() const { return ____innerException_4; }
inline Exception_t ** get_address_of__innerException_4() { return &____innerException_4; }
inline void set__innerException_4(Exception_t * value)
{
____innerException_4 = value;
Il2CppCodeGenWriteBarrier((&____innerException_4), value);
}
inline static int32_t get_offset_of__helpURL_5() { return static_cast<int32_t>(offsetof(Exception_t, ____helpURL_5)); }
inline String_t* get__helpURL_5() const { return ____helpURL_5; }
inline String_t** get_address_of__helpURL_5() { return &____helpURL_5; }
inline void set__helpURL_5(String_t* value)
{
____helpURL_5 = value;
Il2CppCodeGenWriteBarrier((&____helpURL_5), value);
}
inline static int32_t get_offset_of__stackTrace_6() { return static_cast<int32_t>(offsetof(Exception_t, ____stackTrace_6)); }
inline RuntimeObject * get__stackTrace_6() const { return ____stackTrace_6; }
inline RuntimeObject ** get_address_of__stackTrace_6() { return &____stackTrace_6; }
inline void set__stackTrace_6(RuntimeObject * value)
{
____stackTrace_6 = value;
Il2CppCodeGenWriteBarrier((&____stackTrace_6), value);
}
inline static int32_t get_offset_of__stackTraceString_7() { return static_cast<int32_t>(offsetof(Exception_t, ____stackTraceString_7)); }
inline String_t* get__stackTraceString_7() const { return ____stackTraceString_7; }
inline String_t** get_address_of__stackTraceString_7() { return &____stackTraceString_7; }
inline void set__stackTraceString_7(String_t* value)
{
____stackTraceString_7 = value;
Il2CppCodeGenWriteBarrier((&____stackTraceString_7), value);
}
inline static int32_t get_offset_of__remoteStackTraceString_8() { return static_cast<int32_t>(offsetof(Exception_t, ____remoteStackTraceString_8)); }
inline String_t* get__remoteStackTraceString_8() const { return ____remoteStackTraceString_8; }
inline String_t** get_address_of__remoteStackTraceString_8() { return &____remoteStackTraceString_8; }
inline void set__remoteStackTraceString_8(String_t* value)
{
____remoteStackTraceString_8 = value;
Il2CppCodeGenWriteBarrier((&____remoteStackTraceString_8), value);
}
inline static int32_t get_offset_of__remoteStackIndex_9() { return static_cast<int32_t>(offsetof(Exception_t, ____remoteStackIndex_9)); }
inline int32_t get__remoteStackIndex_9() const { return ____remoteStackIndex_9; }
inline int32_t* get_address_of__remoteStackIndex_9() { return &____remoteStackIndex_9; }
inline void set__remoteStackIndex_9(int32_t value)
{
____remoteStackIndex_9 = value;
}
inline static int32_t get_offset_of__dynamicMethods_10() { return static_cast<int32_t>(offsetof(Exception_t, ____dynamicMethods_10)); }
inline RuntimeObject * get__dynamicMethods_10() const { return ____dynamicMethods_10; }
inline RuntimeObject ** get_address_of__dynamicMethods_10() { return &____dynamicMethods_10; }
inline void set__dynamicMethods_10(RuntimeObject * value)
{
____dynamicMethods_10 = value;
Il2CppCodeGenWriteBarrier((&____dynamicMethods_10), value);
}
inline static int32_t get_offset_of__HResult_11() { return static_cast<int32_t>(offsetof(Exception_t, ____HResult_11)); }
inline int32_t get__HResult_11() const { return ____HResult_11; }
inline int32_t* get_address_of__HResult_11() { return &____HResult_11; }
inline void set__HResult_11(int32_t value)
{
____HResult_11 = value;
}
inline static int32_t get_offset_of__source_12() { return static_cast<int32_t>(offsetof(Exception_t, ____source_12)); }
inline String_t* get__source_12() const { return ____source_12; }
inline String_t** get_address_of__source_12() { return &____source_12; }
inline void set__source_12(String_t* value)
{
____source_12 = value;
Il2CppCodeGenWriteBarrier((&____source_12), value);
}
inline static int32_t get_offset_of__safeSerializationManager_13() { return static_cast<int32_t>(offsetof(Exception_t, ____safeSerializationManager_13)); }
inline SafeSerializationManager_t2481557153 * get__safeSerializationManager_13() const { return ____safeSerializationManager_13; }
inline SafeSerializationManager_t2481557153 ** get_address_of__safeSerializationManager_13() { return &____safeSerializationManager_13; }
inline void set__safeSerializationManager_13(SafeSerializationManager_t2481557153 * value)
{
____safeSerializationManager_13 = value;
Il2CppCodeGenWriteBarrier((&____safeSerializationManager_13), value);
}
inline static int32_t get_offset_of_captured_traces_14() { return static_cast<int32_t>(offsetof(Exception_t, ___captured_traces_14)); }
inline StackTraceU5BU5D_t1169129676* get_captured_traces_14() const { return ___captured_traces_14; }
inline StackTraceU5BU5D_t1169129676** get_address_of_captured_traces_14() { return &___captured_traces_14; }
inline void set_captured_traces_14(StackTraceU5BU5D_t1169129676* value)
{
___captured_traces_14 = value;
Il2CppCodeGenWriteBarrier((&___captured_traces_14), value);
}
inline static int32_t get_offset_of_native_trace_ips_15() { return static_cast<int32_t>(offsetof(Exception_t, ___native_trace_ips_15)); }
inline IntPtrU5BU5D_t4013366056* get_native_trace_ips_15() const { return ___native_trace_ips_15; }
inline IntPtrU5BU5D_t4013366056** get_address_of_native_trace_ips_15() { return &___native_trace_ips_15; }
inline void set_native_trace_ips_15(IntPtrU5BU5D_t4013366056* value)
{
___native_trace_ips_15 = value;
Il2CppCodeGenWriteBarrier((&___native_trace_ips_15), value);
}
};
struct Exception_t_StaticFields
{
public:
// System.Object System.Exception::s_EDILock
RuntimeObject * ___s_EDILock_0;
public:
inline static int32_t get_offset_of_s_EDILock_0() { return static_cast<int32_t>(offsetof(Exception_t_StaticFields, ___s_EDILock_0)); }
inline RuntimeObject * get_s_EDILock_0() const { return ___s_EDILock_0; }
inline RuntimeObject ** get_address_of_s_EDILock_0() { return &___s_EDILock_0; }
inline void set_s_EDILock_0(RuntimeObject * value)
{
___s_EDILock_0 = value;
Il2CppCodeGenWriteBarrier((&___s_EDILock_0), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of System.Exception
struct Exception_t_marshaled_pinvoke
{
char* ____className_1;
char* ____message_2;
RuntimeObject* ____data_3;
Exception_t_marshaled_pinvoke* ____innerException_4;
char* ____helpURL_5;
Il2CppIUnknown* ____stackTrace_6;
char* ____stackTraceString_7;
char* ____remoteStackTraceString_8;
int32_t ____remoteStackIndex_9;
Il2CppIUnknown* ____dynamicMethods_10;
int32_t ____HResult_11;
char* ____source_12;
SafeSerializationManager_t2481557153 * ____safeSerializationManager_13;
StackTraceU5BU5D_t1169129676* ___captured_traces_14;
intptr_t* ___native_trace_ips_15;
};
// Native definition for COM marshalling of System.Exception
struct Exception_t_marshaled_com
{
Il2CppChar* ____className_1;
Il2CppChar* ____message_2;
RuntimeObject* ____data_3;
Exception_t_marshaled_com* ____innerException_4;
Il2CppChar* ____helpURL_5;
Il2CppIUnknown* ____stackTrace_6;
Il2CppChar* ____stackTraceString_7;
Il2CppChar* ____remoteStackTraceString_8;
int32_t ____remoteStackIndex_9;
Il2CppIUnknown* ____dynamicMethods_10;
int32_t ____HResult_11;
Il2CppChar* ____source_12;
SafeSerializationManager_t2481557153 * ____safeSerializationManager_13;
StackTraceU5BU5D_t1169129676* ___captured_traces_14;
intptr_t* ___native_trace_ips_15;
};
#endif // EXCEPTION_T_H
#ifndef VALUETYPE_T3640485471_H
#define VALUETYPE_T3640485471_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.ValueType
struct ValueType_t3640485471 : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of System.ValueType
struct ValueType_t3640485471_marshaled_pinvoke
{
};
// Native definition for COM marshalling of System.ValueType
struct ValueType_t3640485471_marshaled_com
{
};
#endif // VALUETYPE_T3640485471_H
#ifndef STRING_T_H
#define STRING_T_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.String
struct String_t : public RuntimeObject
{
public:
// System.Int32 System.String::m_stringLength
int32_t ___m_stringLength_0;
// System.Char System.String::m_firstChar
Il2CppChar ___m_firstChar_1;
public:
inline static int32_t get_offset_of_m_stringLength_0() { return static_cast<int32_t>(offsetof(String_t, ___m_stringLength_0)); }
inline int32_t get_m_stringLength_0() const { return ___m_stringLength_0; }
inline int32_t* get_address_of_m_stringLength_0() { return &___m_stringLength_0; }
inline void set_m_stringLength_0(int32_t value)
{
___m_stringLength_0 = value;
}
inline static int32_t get_offset_of_m_firstChar_1() { return static_cast<int32_t>(offsetof(String_t, ___m_firstChar_1)); }
inline Il2CppChar get_m_firstChar_1() const { return ___m_firstChar_1; }
inline Il2CppChar* get_address_of_m_firstChar_1() { return &___m_firstChar_1; }
inline void set_m_firstChar_1(Il2CppChar value)
{
___m_firstChar_1 = value;
}
};
struct String_t_StaticFields
{
public:
// System.String System.String::Empty
String_t* ___Empty_5;
public:
inline static int32_t get_offset_of_Empty_5() { return static_cast<int32_t>(offsetof(String_t_StaticFields, ___Empty_5)); }
inline String_t* get_Empty_5() const { return ___Empty_5; }
inline String_t** get_address_of_Empty_5() { return &___Empty_5; }
inline void set_Empty_5(String_t* value)
{
___Empty_5 = value;
Il2CppCodeGenWriteBarrier((&___Empty_5), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // STRING_T_H
#ifndef ANALYTICSEVENT_T4058973021_H
#define ANALYTICSEVENT_T4058973021_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Analytics.AnalyticsEvent
struct AnalyticsEvent_t4058973021 : public RuntimeObject
{
public:
public:
};
struct AnalyticsEvent_t4058973021_StaticFields
{
public:
// System.String UnityEngine.Analytics.AnalyticsEvent::k_SdkVersion
String_t* ___k_SdkVersion_0;
// System.Collections.Generic.Dictionary`2<System.String,System.Object> UnityEngine.Analytics.AnalyticsEvent::m_EventData
Dictionary_2_t2865362463 * ___m_EventData_1;
// System.Boolean UnityEngine.Analytics.AnalyticsEvent::_debugMode
bool ____debugMode_2;
// System.Collections.Generic.Dictionary`2<System.String,System.String> UnityEngine.Analytics.AnalyticsEvent::enumRenameTable
Dictionary_2_t1632706988 * ___enumRenameTable_3;
public:
inline static int32_t get_offset_of_k_SdkVersion_0() { return static_cast<int32_t>(offsetof(AnalyticsEvent_t4058973021_StaticFields, ___k_SdkVersion_0)); }
inline String_t* get_k_SdkVersion_0() const { return ___k_SdkVersion_0; }
inline String_t** get_address_of_k_SdkVersion_0() { return &___k_SdkVersion_0; }
inline void set_k_SdkVersion_0(String_t* value)
{
___k_SdkVersion_0 = value;
Il2CppCodeGenWriteBarrier((&___k_SdkVersion_0), value);
}
inline static int32_t get_offset_of_m_EventData_1() { return static_cast<int32_t>(offsetof(AnalyticsEvent_t4058973021_StaticFields, ___m_EventData_1)); }
inline Dictionary_2_t2865362463 * get_m_EventData_1() const { return ___m_EventData_1; }
inline Dictionary_2_t2865362463 ** get_address_of_m_EventData_1() { return &___m_EventData_1; }
inline void set_m_EventData_1(Dictionary_2_t2865362463 * value)
{
___m_EventData_1 = value;
Il2CppCodeGenWriteBarrier((&___m_EventData_1), value);
}
inline static int32_t get_offset_of__debugMode_2() { return static_cast<int32_t>(offsetof(AnalyticsEvent_t4058973021_StaticFields, ____debugMode_2)); }
inline bool get__debugMode_2() const { return ____debugMode_2; }
inline bool* get_address_of__debugMode_2() { return &____debugMode_2; }
inline void set__debugMode_2(bool value)
{
____debugMode_2 = value;
}
inline static int32_t get_offset_of_enumRenameTable_3() { return static_cast<int32_t>(offsetof(AnalyticsEvent_t4058973021_StaticFields, ___enumRenameTable_3)); }
inline Dictionary_2_t1632706988 * get_enumRenameTable_3() const { return ___enumRenameTable_3; }
inline Dictionary_2_t1632706988 ** get_address_of_enumRenameTable_3() { return &___enumRenameTable_3; }
inline void set_enumRenameTable_3(Dictionary_2_t1632706988 * value)
{
___enumRenameTable_3 = value;
Il2CppCodeGenWriteBarrier((&___enumRenameTable_3), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // ANALYTICSEVENT_T4058973021_H
#ifndef SYSTEMEXCEPTION_T176217640_H
#define SYSTEMEXCEPTION_T176217640_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.SystemException
struct SystemException_t176217640 : public Exception_t
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SYSTEMEXCEPTION_T176217640_H
#ifndef BOOLEAN_T97287965_H
#define BOOLEAN_T97287965_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Boolean
struct Boolean_t97287965
{
public:
// System.Boolean System.Boolean::m_value
bool ___m_value_0;
public:
inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(Boolean_t97287965, ___m_value_0)); }
inline bool get_m_value_0() const { return ___m_value_0; }
inline bool* get_address_of_m_value_0() { return &___m_value_0; }
inline void set_m_value_0(bool value)
{
___m_value_0 = value;
}
};
struct Boolean_t97287965_StaticFields
{
public:
// System.String System.Boolean::TrueString
String_t* ___TrueString_5;
// System.String System.Boolean::FalseString
String_t* ___FalseString_6;
public:
inline static int32_t get_offset_of_TrueString_5() { return static_cast<int32_t>(offsetof(Boolean_t97287965_StaticFields, ___TrueString_5)); }
inline String_t* get_TrueString_5() const { return ___TrueString_5; }
inline String_t** get_address_of_TrueString_5() { return &___TrueString_5; }
inline void set_TrueString_5(String_t* value)
{
___TrueString_5 = value;
Il2CppCodeGenWriteBarrier((&___TrueString_5), value);
}
inline static int32_t get_offset_of_FalseString_6() { return static_cast<int32_t>(offsetof(Boolean_t97287965_StaticFields, ___FalseString_6)); }
inline String_t* get_FalseString_6() const { return ___FalseString_6; }
inline String_t** get_address_of_FalseString_6() { return &___FalseString_6; }
inline void set_FalseString_6(String_t* value)
{
___FalseString_6 = value;
Il2CppCodeGenWriteBarrier((&___FalseString_6), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // BOOLEAN_T97287965_H
#ifndef ENUM_T4135868527_H
#define ENUM_T4135868527_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Enum
struct Enum_t4135868527 : public ValueType_t3640485471
{
public:
public:
};
struct Enum_t4135868527_StaticFields
{
public:
// System.Char[] System.Enum::enumSeperatorCharArray
CharU5BU5D_t3528271667* ___enumSeperatorCharArray_0;
public:
inline static int32_t get_offset_of_enumSeperatorCharArray_0() { return static_cast<int32_t>(offsetof(Enum_t4135868527_StaticFields, ___enumSeperatorCharArray_0)); }
inline CharU5BU5D_t3528271667* get_enumSeperatorCharArray_0() const { return ___enumSeperatorCharArray_0; }
inline CharU5BU5D_t3528271667** get_address_of_enumSeperatorCharArray_0() { return &___enumSeperatorCharArray_0; }
inline void set_enumSeperatorCharArray_0(CharU5BU5D_t3528271667* value)
{
___enumSeperatorCharArray_0 = value;
Il2CppCodeGenWriteBarrier((&___enumSeperatorCharArray_0), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of System.Enum
struct Enum_t4135868527_marshaled_pinvoke
{
};
// Native definition for COM marshalling of System.Enum
struct Enum_t4135868527_marshaled_com
{
};
#endif // ENUM_T4135868527_H
#ifndef VOID_T1185182177_H
#define VOID_T1185182177_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Void
struct Void_t1185182177
{
public:
union
{
struct
{
};
uint8_t Void_t1185182177__padding[1];
};
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // VOID_T1185182177_H
#ifndef KEYVALUEPAIR_2_T968067334_H
#define KEYVALUEPAIR_2_T968067334_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Collections.Generic.KeyValuePair`2<System.String,System.Object>
struct KeyValuePair_2_t968067334
{
public:
// TKey System.Collections.Generic.KeyValuePair`2::key
String_t* ___key_0;
// TValue System.Collections.Generic.KeyValuePair`2::value
RuntimeObject * ___value_1;
public:
inline static int32_t get_offset_of_key_0() { return static_cast<int32_t>(offsetof(KeyValuePair_2_t968067334, ___key_0)); }
inline String_t* get_key_0() const { return ___key_0; }
inline String_t** get_address_of_key_0() { return &___key_0; }
inline void set_key_0(String_t* value)
{
___key_0 = value;
Il2CppCodeGenWriteBarrier((&___key_0), value);
}
inline static int32_t get_offset_of_value_1() { return static_cast<int32_t>(offsetof(KeyValuePair_2_t968067334, ___value_1)); }
inline RuntimeObject * get_value_1() const { return ___value_1; }
inline RuntimeObject ** get_address_of_value_1() { return &___value_1; }
inline void set_value_1(RuntimeObject * value)
{
___value_1 = value;
Il2CppCodeGenWriteBarrier((&___value_1), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // KEYVALUEPAIR_2_T968067334_H
#ifndef KEYVALUEPAIR_2_T2530217319_H
#define KEYVALUEPAIR_2_T2530217319_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Collections.Generic.KeyValuePair`2<System.Object,System.Object>
struct KeyValuePair_2_t2530217319
{
public:
// TKey System.Collections.Generic.KeyValuePair`2::key
RuntimeObject * ___key_0;
// TValue System.Collections.Generic.KeyValuePair`2::value
RuntimeObject * ___value_1;
public:
inline static int32_t get_offset_of_key_0() { return static_cast<int32_t>(offsetof(KeyValuePair_2_t2530217319, ___key_0)); }
inline RuntimeObject * get_key_0() const { return ___key_0; }
inline RuntimeObject ** get_address_of_key_0() { return &___key_0; }
inline void set_key_0(RuntimeObject * value)
{
___key_0 = value;
Il2CppCodeGenWriteBarrier((&___key_0), value);
}
inline static int32_t get_offset_of_value_1() { return static_cast<int32_t>(offsetof(KeyValuePair_2_t2530217319, ___value_1)); }
inline RuntimeObject * get_value_1() const { return ___value_1; }
inline RuntimeObject ** get_address_of_value_1() { return &___value_1; }
inline void set_value_1(RuntimeObject * value)
{
___value_1 = value;
Il2CppCodeGenWriteBarrier((&___value_1), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // KEYVALUEPAIR_2_T2530217319_H
#ifndef INT32_T2950945753_H
#define INT32_T2950945753_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Int32
struct Int32_t2950945753
{
public:
// System.Int32 System.Int32::m_value
int32_t ___m_value_0;
public:
inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(Int32_t2950945753, ___m_value_0)); }
inline int32_t get_m_value_0() const { return ___m_value_0; }
inline int32_t* get_address_of_m_value_0() { return &___m_value_0; }
inline void set_m_value_0(int32_t value)
{
___m_value_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // INT32_T2950945753_H
#ifndef ANALYTICSRESULT_T2273004240_H
#define ANALYTICSRESULT_T2273004240_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Analytics.AnalyticsResult
struct AnalyticsResult_t2273004240
{
public:
// System.Int32 UnityEngine.Analytics.AnalyticsResult::value__
int32_t ___value___2;
public:
inline static int32_t get_offset_of_value___2() { return static_cast<int32_t>(offsetof(AnalyticsResult_t2273004240, ___value___2)); }
inline int32_t get_value___2() const { return ___value___2; }
inline int32_t* get_address_of_value___2() { return &___value___2; }
inline void set_value___2(int32_t value)
{
___value___2 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // ANALYTICSRESULT_T2273004240_H
#ifndef ARGUMENTEXCEPTION_T132251570_H
#define ARGUMENTEXCEPTION_T132251570_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.ArgumentException
struct ArgumentException_t132251570 : public SystemException_t176217640
{
public:
// System.String System.ArgumentException::m_paramName
String_t* ___m_paramName_16;
public:
inline static int32_t get_offset_of_m_paramName_16() { return static_cast<int32_t>(offsetof(ArgumentException_t132251570, ___m_paramName_16)); }
inline String_t* get_m_paramName_16() const { return ___m_paramName_16; }
inline String_t** get_address_of_m_paramName_16() { return &___m_paramName_16; }
inline void set_m_paramName_16(String_t* value)
{
___m_paramName_16 = value;
Il2CppCodeGenWriteBarrier((&___m_paramName_16), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // ARGUMENTEXCEPTION_T132251570_H
// System.Object[]
struct ObjectU5BU5D_t2843939325 : public RuntimeArray
{
public:
ALIGN_FIELD (8) RuntimeObject * m_Items[1];
public:
inline RuntimeObject * GetAt(il2cpp_array_size_t index) const
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
return m_Items[index];
}
inline RuntimeObject ** GetAddressAt(il2cpp_array_size_t index)
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
return m_Items + index;
}
inline void SetAt(il2cpp_array_size_t index, RuntimeObject * value)
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
m_Items[index] = value;
Il2CppCodeGenWriteBarrier(m_Items + index, value);
}
inline RuntimeObject * GetAtUnchecked(il2cpp_array_size_t index) const
{
return m_Items[index];
}
inline RuntimeObject ** GetAddressAtUnchecked(il2cpp_array_size_t index)
{
return m_Items + index;
}
inline void SetAtUnchecked(il2cpp_array_size_t index, RuntimeObject * value)
{
m_Items[index] = value;
Il2CppCodeGenWriteBarrier(m_Items + index, value);
}
};
// !0 System.Collections.Generic.KeyValuePair`2<System.Object,System.Object>::get_Key()
extern "C" RuntimeObject * KeyValuePair_2_get_Key_m4184817181_gshared (KeyValuePair_2_t2530217319 * __this, const RuntimeMethod* method);
// !1 System.Collections.Generic.KeyValuePair`2<System.Object,System.Object>::get_Value()
extern "C" RuntimeObject * KeyValuePair_2_get_Value_m1132502692_gshared (KeyValuePair_2_t2530217319 * __this, const RuntimeMethod* method);
// System.Void System.Collections.Generic.Dictionary`2<System.Object,System.Object>::.ctor()
extern "C" void Dictionary_2__ctor_m518943619_gshared (Dictionary_2_t132545152 * __this, const RuntimeMethod* method);
// System.Void System.Collections.Generic.Dictionary`2<System.Object,System.Object>::Add(!0,!1)
extern "C" void Dictionary_2_Add_m3105409630_gshared (Dictionary_2_t132545152 * __this, RuntimeObject * p0, RuntimeObject * p1, const RuntimeMethod* method);
// System.Void System.ArgumentException::.ctor(System.String)
extern "C" void ArgumentException__ctor_m1312628991 (ArgumentException_t132251570 * __this, String_t* p0, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Boolean System.String::IsNullOrEmpty(System.String)
extern "C" bool String_IsNullOrEmpty_m2969720369 (RuntimeObject * __this /* static, unused */, String_t* p0, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.Analytics.AnalyticsEvent::OnValidationFailed(System.String)
extern "C" void AnalyticsEvent_OnValidationFailed_m2609604624 (RuntimeObject * __this /* static, unused */, String_t* ___message0, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// UnityEngine.Analytics.AnalyticsResult UnityEngine.Analytics.Analytics::CustomEvent(System.String)
extern "C" int32_t Analytics_CustomEvent_m692224174 (RuntimeObject * __this /* static, unused */, String_t* p0, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// UnityEngine.Analytics.AnalyticsResult UnityEngine.Analytics.Analytics::CustomEvent(System.String,System.Collections.Generic.IDictionary`2<System.String,System.Object>)
extern "C" int32_t Analytics_CustomEvent_m3835919949 (RuntimeObject * __this /* static, unused */, String_t* p0, RuntimeObject* p1, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Boolean UnityEngine.Analytics.AnalyticsEvent::get_debugMode()
extern "C" bool AnalyticsEvent_get_debugMode_m2240954048 (RuntimeObject * __this /* static, unused */, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.String System.String::Concat(System.String,System.String)
extern "C" String_t* String_Concat_m3937257545 (RuntimeObject * __this /* static, unused */, String_t* p0, String_t* p1, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.String System.String::Format(System.String,System.Object)
extern "C" String_t* String_Format_m2844511972 (RuntimeObject * __this /* static, unused */, String_t* p0, RuntimeObject * p1, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// !0 System.Collections.Generic.KeyValuePair`2<System.String,System.Object>::get_Key()
#define KeyValuePair_2_get_Key_m256823211(__this, method) (( String_t* (*) (KeyValuePair_2_t968067334 *, const RuntimeMethod*))KeyValuePair_2_get_Key_m4184817181_gshared)(__this, method)
// !1 System.Collections.Generic.KeyValuePair`2<System.String,System.Object>::get_Value()
#define KeyValuePair_2_get_Value_m4108279609(__this, method) (( RuntimeObject * (*) (KeyValuePair_2_t968067334 *, const RuntimeMethod*))KeyValuePair_2_get_Value_m1132502692_gshared)(__this, method)
// System.String System.String::Format(System.String,System.Object,System.Object)
extern "C" String_t* String_Format_m2556382932 (RuntimeObject * __this /* static, unused */, String_t* p0, RuntimeObject * p1, RuntimeObject * p2, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.Debug::LogFormat(System.String,System.Object[])
extern "C" void Debug_LogFormat_m309087137 (RuntimeObject * __this /* static, unused */, String_t* p0, ObjectU5BU5D_t2843939325* p1, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.Debug::LogErrorFormat(System.String,System.Object[])
extern "C" void Debug_LogErrorFormat_m575266265 (RuntimeObject * __this /* static, unused */, String_t* p0, ObjectU5BU5D_t2843939325* p1, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.Debug::LogWarningFormat(System.String,System.Object[])
extern "C" void Debug_LogWarningFormat_m2535776735 (RuntimeObject * __this /* static, unused */, String_t* p0, ObjectU5BU5D_t2843939325* p1, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void System.Collections.Generic.Dictionary`2<System.String,System.Object>::.ctor()
#define Dictionary_2__ctor_m15304876(__this, method) (( void (*) (Dictionary_2_t2865362463 *, const RuntimeMethod*))Dictionary_2__ctor_m518943619_gshared)(__this, method)
// System.Void System.Collections.Generic.Dictionary`2<System.String,System.String>::.ctor()
#define Dictionary_2__ctor_m444307833(__this, method) (( void (*) (Dictionary_2_t1632706988 *, const RuntimeMethod*))Dictionary_2__ctor_m518943619_gshared)(__this, method)
// System.Void System.Collections.Generic.Dictionary`2<System.String,System.String>::Add(!0,!1)
#define Dictionary_2_Add_m3045345476(__this, p0, p1, method) (( void (*) (Dictionary_2_t1632706988 *, String_t*, String_t*, const RuntimeMethod*))Dictionary_2_Add_m3105409630_gshared)(__this, p0, p1, method)
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Boolean UnityEngine.Analytics.AnalyticsEvent::get_debugMode()
extern "C" bool AnalyticsEvent_get_debugMode_m2240954048 (RuntimeObject * __this /* static, unused */, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (AnalyticsEvent_get_debugMode_m2240954048_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
bool V_0 = false;
{
IL2CPP_RUNTIME_CLASS_INIT(AnalyticsEvent_t4058973021_il2cpp_TypeInfo_var);
bool L_0 = ((AnalyticsEvent_t4058973021_StaticFields*)il2cpp_codegen_static_fields_for(AnalyticsEvent_t4058973021_il2cpp_TypeInfo_var))->get__debugMode_2();
V_0 = L_0;
goto IL_000c;
}
IL_000c:
{
bool L_1 = V_0;
return L_1;
}
}
// System.Void UnityEngine.Analytics.AnalyticsEvent::OnValidationFailed(System.String)
extern "C" void AnalyticsEvent_OnValidationFailed_m2609604624 (RuntimeObject * __this /* static, unused */, String_t* ___message0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (AnalyticsEvent_OnValidationFailed_m2609604624_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
String_t* L_0 = ___message0;
ArgumentException_t132251570 * L_1 = (ArgumentException_t132251570 *)il2cpp_codegen_object_new(ArgumentException_t132251570_il2cpp_TypeInfo_var);
ArgumentException__ctor_m1312628991(L_1, L_0, /*hidden argument*/NULL);
IL2CPP_RAISE_MANAGED_EXCEPTION(L_1,AnalyticsEvent_OnValidationFailed_m2609604624_RuntimeMethod_var);
}
}
// UnityEngine.Analytics.AnalyticsResult UnityEngine.Analytics.AnalyticsEvent::Custom(System.String,System.Collections.Generic.IDictionary`2<System.String,System.Object>)
extern "C" int32_t AnalyticsEvent_Custom_m227997836 (RuntimeObject * __this /* static, unused */, String_t* ___eventName0, RuntimeObject* ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (AnalyticsEvent_Custom_m227997836_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
int32_t V_0 = 0;
String_t* V_1 = NULL;
KeyValuePair_2_t968067334 V_2;
memset(&V_2, 0, sizeof(V_2));
RuntimeObject* V_3 = NULL;
int32_t V_4 = 0;
Exception_t * __last_unhandled_exception = 0;
NO_UNUSED_WARNING (__last_unhandled_exception);
Exception_t * __exception_local = 0;
NO_UNUSED_WARNING (__exception_local);
int32_t __leave_target = 0;
NO_UNUSED_WARNING (__leave_target);
{
V_0 = 7;
String_t* L_0 = ((String_t_StaticFields*)il2cpp_codegen_static_fields_for(String_t_il2cpp_TypeInfo_var))->get_Empty_5();
V_1 = L_0;
String_t* L_1 = ___eventName0;
bool L_2 = String_IsNullOrEmpty_m2969720369(NULL /*static, unused*/, L_1, /*hidden argument*/NULL);
if (!L_2)
{
goto IL_0020;
}
}
{
IL2CPP_RUNTIME_CLASS_INIT(AnalyticsEvent_t4058973021_il2cpp_TypeInfo_var);
AnalyticsEvent_OnValidationFailed_m2609604624(NULL /*static, unused*/, _stringLiteral3082188891, /*hidden argument*/NULL);
}
IL_0020:
{
RuntimeObject* L_3 = ___eventData1;
if (L_3)
{
goto IL_0034;
}
}
{
String_t* L_4 = ___eventName0;
int32_t L_5 = Analytics_CustomEvent_m692224174(NULL /*static, unused*/, L_4, /*hidden argument*/NULL);
V_0 = L_5;
goto IL_003e;
}
IL_0034:
{
String_t* L_6 = ___eventName0;
RuntimeObject* L_7 = ___eventData1;
int32_t L_8 = Analytics_CustomEvent_m3835919949(NULL /*static, unused*/, L_6, L_7, /*hidden argument*/NULL);
V_0 = L_8;
}
IL_003e:
{
IL2CPP_RUNTIME_CLASS_INIT(AnalyticsEvent_t4058973021_il2cpp_TypeInfo_var);
bool L_9 = AnalyticsEvent_get_debugMode_m2240954048(NULL /*static, unused*/, /*hidden argument*/NULL);
if (!L_9)
{
goto IL_00d3;
}
}
{
RuntimeObject* L_10 = ___eventData1;
if (L_10)
{
goto IL_0062;
}
}
{
String_t* L_11 = V_1;
String_t* L_12 = String_Concat_m3937257545(NULL /*static, unused*/, L_11, _stringLiteral3848816014, /*hidden argument*/NULL);
V_1 = L_12;
goto IL_00d2;
}
IL_0062:
{
String_t* L_13 = V_1;
RuntimeObject* L_14 = ___eventData1;
NullCheck(L_14);
int32_t L_15 = InterfaceFuncInvoker0< int32_t >::Invoke(0 /* System.Int32 System.Collections.Generic.ICollection`1<System.Collections.Generic.KeyValuePair`2<System.String,System.Object>>::get_Count() */, ICollection_1_t3796219568_il2cpp_TypeInfo_var, L_14);
int32_t L_16 = L_15;
RuntimeObject * L_17 = Box(Int32_t2950945753_il2cpp_TypeInfo_var, &L_16);
String_t* L_18 = String_Format_m2844511972(NULL /*static, unused*/, _stringLiteral3610066572, L_17, /*hidden argument*/NULL);
String_t* L_19 = String_Concat_m3937257545(NULL /*static, unused*/, L_13, L_18, /*hidden argument*/NULL);
V_1 = L_19;
RuntimeObject* L_20 = ___eventData1;
NullCheck(L_20);
RuntimeObject* L_21 = InterfaceFuncInvoker0< RuntimeObject* >::Invoke(0 /* System.Collections.Generic.IEnumerator`1<!0> System.Collections.Generic.IEnumerable`1<System.Collections.Generic.KeyValuePair`2<System.String,System.Object>>::GetEnumerator() */, IEnumerable_1_t4242887519_il2cpp_TypeInfo_var, L_20);
V_3 = L_21;
}
IL_0087:
try
{ // begin try (depth: 1)
{
goto IL_00b4;
}
IL_008c:
{
RuntimeObject* L_22 = V_3;
NullCheck(L_22);
KeyValuePair_2_t968067334 L_23 = InterfaceFuncInvoker0< KeyValuePair_2_t968067334 >::Invoke(0 /* !0 System.Collections.Generic.IEnumerator`1<System.Collections.Generic.KeyValuePair`2<System.String,System.Object>>::get_Current() */, IEnumerator_1_t1400637802_il2cpp_TypeInfo_var, L_22);
V_2 = L_23;
String_t* L_24 = V_1;
String_t* L_25 = KeyValuePair_2_get_Key_m256823211((&V_2), /*hidden argument*/KeyValuePair_2_get_Key_m256823211_RuntimeMethod_var);
RuntimeObject * L_26 = KeyValuePair_2_get_Value_m4108279609((&V_2), /*hidden argument*/KeyValuePair_2_get_Value_m4108279609_RuntimeMethod_var);
String_t* L_27 = String_Format_m2556382932(NULL /*static, unused*/, _stringLiteral3713525075, L_25, L_26, /*hidden argument*/NULL);
String_t* L_28 = String_Concat_m3937257545(NULL /*static, unused*/, L_24, L_27, /*hidden argument*/NULL);
V_1 = L_28;
}
IL_00b4:
{
RuntimeObject* L_29 = V_3;
NullCheck(L_29);
bool L_30 = InterfaceFuncInvoker0< bool >::Invoke(0 /* System.Boolean System.Collections.IEnumerator::MoveNext() */, IEnumerator_t1853284238_il2cpp_TypeInfo_var, L_29);
if (L_30)
{
goto IL_008c;
}
}
IL_00bf:
{
IL2CPP_LEAVE(0xD1, FINALLY_00c4);
}
} // end try (depth: 1)
catch(Il2CppExceptionWrapper& e)
{
__last_unhandled_exception = (Exception_t *)e.ex;
goto FINALLY_00c4;
}
FINALLY_00c4:
{ // begin finally (depth: 1)
{
RuntimeObject* L_31 = V_3;
if (!L_31)
{
goto IL_00d0;
}
}
IL_00ca:
{
RuntimeObject* L_32 = V_3;
NullCheck(L_32);
InterfaceActionInvoker0::Invoke(0 /* System.Void System.IDisposable::Dispose() */, IDisposable_t3640265483_il2cpp_TypeInfo_var, L_32);
}
IL_00d0:
{
IL2CPP_END_FINALLY(196)
}
} // end finally (depth: 1)
IL2CPP_CLEANUP(196)
{
IL2CPP_JUMP_TBL(0xD1, IL_00d1)
IL2CPP_RETHROW_IF_UNHANDLED(Exception_t *)
}
IL_00d1:
{
}
IL_00d2:
{
}
IL_00d3:
{
int32_t L_33 = V_0;
switch (L_33)
{
case 0:
{
goto IL_00f5;
}
case 1:
{
goto IL_00e9;
}
case 2:
{
goto IL_00e9;
}
case 3:
{
goto IL_0127;
}
}
}
IL_00e9:
{
int32_t L_34 = V_0;
if ((((int32_t)L_34) == ((int32_t)6)))
{
goto IL_0127;
}
}
{
goto IL_014d;
}
IL_00f5:
{
IL2CPP_RUNTIME_CLASS_INIT(AnalyticsEvent_t4058973021_il2cpp_TypeInfo_var);
bool L_35 = AnalyticsEvent_get_debugMode_m2240954048(NULL /*static, unused*/, /*hidden argument*/NULL);
if (!L_35)
{
goto IL_0122;
}
}
{
ObjectU5BU5D_t2843939325* L_36 = ((ObjectU5BU5D_t2843939325*)SZArrayNew(ObjectU5BU5D_t2843939325_il2cpp_TypeInfo_var, (uint32_t)3));
String_t* L_37 = ___eventName0;
NullCheck(L_36);
ArrayElementTypeCheck (L_36, L_37);
(L_36)->SetAt(static_cast<il2cpp_array_size_t>(0), (RuntimeObject *)L_37);
ObjectU5BU5D_t2843939325* L_38 = L_36;
int32_t L_39 = V_0;
int32_t L_40 = L_39;
RuntimeObject * L_41 = Box(AnalyticsResult_t2273004240_il2cpp_TypeInfo_var, &L_40);
NullCheck(L_38);
ArrayElementTypeCheck (L_38, L_41);
(L_38)->SetAt(static_cast<il2cpp_array_size_t>(1), (RuntimeObject *)L_41);
ObjectU5BU5D_t2843939325* L_42 = L_38;
String_t* L_43 = V_1;
NullCheck(L_42);
ArrayElementTypeCheck (L_42, L_43);
(L_42)->SetAt(static_cast<il2cpp_array_size_t>(2), (RuntimeObject *)L_43);
IL2CPP_RUNTIME_CLASS_INIT(Debug_t3317548046_il2cpp_TypeInfo_var);
Debug_LogFormat_m309087137(NULL /*static, unused*/, _stringLiteral1348467685, L_42, /*hidden argument*/NULL);
}
IL_0122:
{
goto IL_0173;
}
IL_0127:
{
ObjectU5BU5D_t2843939325* L_44 = ((ObjectU5BU5D_t2843939325*)SZArrayNew(ObjectU5BU5D_t2843939325_il2cpp_TypeInfo_var, (uint32_t)3));
String_t* L_45 = ___eventName0;
NullCheck(L_44);
ArrayElementTypeCheck (L_44, L_45);
(L_44)->SetAt(static_cast<il2cpp_array_size_t>(0), (RuntimeObject *)L_45);
ObjectU5BU5D_t2843939325* L_46 = L_44;
int32_t L_47 = V_0;
int32_t L_48 = L_47;
RuntimeObject * L_49 = Box(AnalyticsResult_t2273004240_il2cpp_TypeInfo_var, &L_48);
NullCheck(L_46);
ArrayElementTypeCheck (L_46, L_49);
(L_46)->SetAt(static_cast<il2cpp_array_size_t>(1), (RuntimeObject *)L_49);
ObjectU5BU5D_t2843939325* L_50 = L_46;
String_t* L_51 = V_1;
NullCheck(L_50);
ArrayElementTypeCheck (L_50, L_51);
(L_50)->SetAt(static_cast<il2cpp_array_size_t>(2), (RuntimeObject *)L_51);
IL2CPP_RUNTIME_CLASS_INIT(Debug_t3317548046_il2cpp_TypeInfo_var);
Debug_LogErrorFormat_m575266265(NULL /*static, unused*/, _stringLiteral69560130, L_50, /*hidden argument*/NULL);
goto IL_0173;
}
IL_014d:
{
ObjectU5BU5D_t2843939325* L_52 = ((ObjectU5BU5D_t2843939325*)SZArrayNew(ObjectU5BU5D_t2843939325_il2cpp_TypeInfo_var, (uint32_t)3));
String_t* L_53 = ___eventName0;
NullCheck(L_52);
ArrayElementTypeCheck (L_52, L_53);
(L_52)->SetAt(static_cast<il2cpp_array_size_t>(0), (RuntimeObject *)L_53);
ObjectU5BU5D_t2843939325* L_54 = L_52;
int32_t L_55 = V_0;
int32_t L_56 = L_55;
RuntimeObject * L_57 = Box(AnalyticsResult_t2273004240_il2cpp_TypeInfo_var, &L_56);
NullCheck(L_54);
ArrayElementTypeCheck (L_54, L_57);
(L_54)->SetAt(static_cast<il2cpp_array_size_t>(1), (RuntimeObject *)L_57);
ObjectU5BU5D_t2843939325* L_58 = L_54;
String_t* L_59 = V_1;
NullCheck(L_58);
ArrayElementTypeCheck (L_58, L_59);
(L_58)->SetAt(static_cast<il2cpp_array_size_t>(2), (RuntimeObject *)L_59);
IL2CPP_RUNTIME_CLASS_INIT(Debug_t3317548046_il2cpp_TypeInfo_var);
Debug_LogWarningFormat_m2535776735(NULL /*static, unused*/, _stringLiteral2157825051, L_58, /*hidden argument*/NULL);
goto IL_0173;
}
IL_0173:
{
int32_t L_60 = V_0;
V_4 = L_60;
goto IL_017b;
}
IL_017b:
{
int32_t L_61 = V_4;
return L_61;
}
}
// System.Void UnityEngine.Analytics.AnalyticsEvent::.cctor()
extern "C" void AnalyticsEvent__cctor_m3994162614 (RuntimeObject * __this /* static, unused */, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (AnalyticsEvent__cctor_m3994162614_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
Dictionary_2_t1632706988 * V_0 = NULL;
{
((AnalyticsEvent_t4058973021_StaticFields*)il2cpp_codegen_static_fields_for(AnalyticsEvent_t4058973021_il2cpp_TypeInfo_var))->set_k_SdkVersion_0(_stringLiteral314968592);
Dictionary_2_t2865362463 * L_0 = (Dictionary_2_t2865362463 *)il2cpp_codegen_object_new(Dictionary_2_t2865362463_il2cpp_TypeInfo_var);
Dictionary_2__ctor_m15304876(L_0, /*hidden argument*/Dictionary_2__ctor_m15304876_RuntimeMethod_var);
((AnalyticsEvent_t4058973021_StaticFields*)il2cpp_codegen_static_fields_for(AnalyticsEvent_t4058973021_il2cpp_TypeInfo_var))->set_m_EventData_1(L_0);
((AnalyticsEvent_t4058973021_StaticFields*)il2cpp_codegen_static_fields_for(AnalyticsEvent_t4058973021_il2cpp_TypeInfo_var))->set__debugMode_2((bool)0);
Dictionary_2_t1632706988 * L_1 = (Dictionary_2_t1632706988 *)il2cpp_codegen_object_new(Dictionary_2_t1632706988_il2cpp_TypeInfo_var);
Dictionary_2__ctor_m444307833(L_1, /*hidden argument*/Dictionary_2__ctor_m444307833_RuntimeMethod_var);
V_0 = L_1;
Dictionary_2_t1632706988 * L_2 = V_0;
NullCheck(L_2);
Dictionary_2_Add_m3045345476(L_2, _stringLiteral223781046, _stringLiteral591401181, /*hidden argument*/Dictionary_2_Add_m3045345476_RuntimeMethod_var);
Dictionary_2_t1632706988 * L_3 = V_0;
NullCheck(L_3);
Dictionary_2_Add_m3045345476(L_3, _stringLiteral2670495305, _stringLiteral3038431854, /*hidden argument*/Dictionary_2_Add_m3045345476_RuntimeMethod_var);
Dictionary_2_t1632706988 * L_4 = V_0;
NullCheck(L_4);
Dictionary_2_Add_m3045345476(L_4, _stringLiteral1860111314, _stringLiteral3191806752, /*hidden argument*/Dictionary_2_Add_m3045345476_RuntimeMethod_var);
Dictionary_2_t1632706988 * L_5 = V_0;
NullCheck(L_5);
Dictionary_2_Add_m3045345476(L_5, _stringLiteral2793515199, _stringLiteral1822927358, /*hidden argument*/Dictionary_2_Add_m3045345476_RuntimeMethod_var);
Dictionary_2_t1632706988 * L_6 = V_0;
NullCheck(L_6);
Dictionary_2_Add_m3045345476(L_6, _stringLiteral3946338038, _stringLiteral1285374328, /*hidden argument*/Dictionary_2_Add_m3045345476_RuntimeMethod_var);
Dictionary_2_t1632706988 * L_7 = V_0;
NullCheck(L_7);
Dictionary_2_Add_m3045345476(L_7, _stringLiteral1477325238, _stringLiteral359657463, /*hidden argument*/Dictionary_2_Add_m3045345476_RuntimeMethod_var);
Dictionary_2_t1632706988 * L_8 = V_0;
NullCheck(L_8);
Dictionary_2_Add_m3045345476(L_8, _stringLiteral2913916239, _stringLiteral4063851185, /*hidden argument*/Dictionary_2_Add_m3045345476_RuntimeMethod_var);
Dictionary_2_t1632706988 * L_9 = V_0;
NullCheck(L_9);
Dictionary_2_Add_m3045345476(L_9, _stringLiteral2569810339, _stringLiteral243880865, /*hidden argument*/Dictionary_2_Add_m3045345476_RuntimeMethod_var);
Dictionary_2_t1632706988 * L_10 = V_0;
((AnalyticsEvent_t4058973021_StaticFields*)il2cpp_codegen_static_fields_for(AnalyticsEvent_t4058973021_il2cpp_TypeInfo_var))->set_enumRenameTable_3(L_10);
return;
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
| 39.167377
| 309
| 0.805445
|
PaulDixon
|
51e61c57b7bfbcdfaea86939ab4f66a62ac79872
| 714
|
hpp
|
C++
|
source/quantum-script-extension-xml--export.hpp
|
g-stefan/quantum-script-extension-xml
|
b8184dcdeeb820447578fc7cc5e2efc3301148a2
|
[
"MIT",
"Unlicense"
] | null | null | null |
source/quantum-script-extension-xml--export.hpp
|
g-stefan/quantum-script-extension-xml
|
b8184dcdeeb820447578fc7cc5e2efc3301148a2
|
[
"MIT",
"Unlicense"
] | null | null | null |
source/quantum-script-extension-xml--export.hpp
|
g-stefan/quantum-script-extension-xml
|
b8184dcdeeb820447578fc7cc5e2efc3301148a2
|
[
"MIT",
"Unlicense"
] | null | null | null |
//
// Quantum Script Extension XML
//
// Copyright (c) 2020-2021 Grigore Stefan <g_stefan@yahoo.com>
// Created by Grigore Stefan <g_stefan@yahoo.com>
//
// MIT License (MIT) <http://opensource.org/licenses/MIT>
//
#ifndef QUANTUM_SCRIPT_EXTENSION_XML__EXPORT_HPP
#define QUANTUM_SCRIPT_EXTENSION_XML__EXPORT_HPP
#ifndef XYO__EXPORT_HPP
#include "xyo--export.hpp"
#endif
#ifdef XYO_COMPILE_DYNAMIC_LIBRARY
# ifdef QUANTUM_SCRIPT_EXTENSION_XML_INTERNAL
# define QUANTUM_SCRIPT_EXTENSION_XML_EXPORT XYO_LIBRARY_EXPORT
# else
# define QUANTUM_SCRIPT_EXTENSION_XML_EXPORT XYO_LIBRARY_IMPORT
# endif
#else
# define QUANTUM_SCRIPT_EXTENSION_XML_EXPORT
#endif
#endif
| 24.62069
| 70
| 0.761905
|
g-stefan
|
51e6260b89be41930cab597106f0898fbed3c605
| 13,422
|
cpp
|
C++
|
MOS_6502_Emulator/Processor.cpp
|
yu830425/MOS-6502-Simulator
|
b08495e1225b65df51ba2ad561f27b048a506c31
|
[
"MIT"
] | null | null | null |
MOS_6502_Emulator/Processor.cpp
|
yu830425/MOS-6502-Simulator
|
b08495e1225b65df51ba2ad561f27b048a506c31
|
[
"MIT"
] | null | null | null |
MOS_6502_Emulator/Processor.cpp
|
yu830425/MOS-6502-Simulator
|
b08495e1225b65df51ba2ad561f27b048a506c31
|
[
"MIT"
] | null | null | null |
#include "Processor.h"
#include <iostream>
Processor::Processor()
{
m_stack = make_shared<Stack>();
m_processingUnit = make_shared<ProcessingUnit>();
m_processingUnit->setStackController(m_stack);
m_commandTable = createCommandMap();
m_commandMap = std::unordered_map<string, any>{
{"LDA", std::function<void(BYTE)>([&](BYTE _1){m_processingUnit->LDA(_1);})},
{"LDX", std::function<void(BYTE)>([&](BYTE _1){m_processingUnit->LDX(_1);})},
{"LDY", std::function<void(BYTE)>([&](BYTE _1){m_processingUnit->LDY(_1);})},
{"STA", std::function<BYTE(void)>([&](){return m_processingUnit->STA();})},
{"STX", std::function<BYTE(void)>([&](){return m_processingUnit->STX();})},
{"STY", std::function<BYTE(void)>([&](){return m_processingUnit->STY();})},
{"SEC", std::function<void(void)>([&](){m_processingUnit->SEC();})},
{"CLC", std::function<void(void)>([&](){m_processingUnit->CLC();})},
{"CLD", std::function<void(void)>([&](){m_processingUnit->CLD();})},
{"SED", std::function<void(void)>([&](){m_processingUnit->SED();})},
{"SEI", std::function<void(void)>([&](){m_processingUnit->SEI();})},
{"CLI", std::function<void(void)>([&](){m_processingUnit->CLI();})},
{"CLV", std::function<void(void)>([&](){m_processingUnit->CLV();})},
{"ADC", std::function<void(BYTE)>([&](BYTE _1){m_processingUnit->ADC(_1);})},
{"SBC", std::function<void(BYTE)>([&](BYTE _1){m_processingUnit->SBC(_1);})},
{"INC", std::function<BYTE(BYTE)>([&](BYTE _1){ return m_processingUnit->INC(_1);})},
{"INX", std::function<void(void)>([&](){m_processingUnit->INX();})},
{"INY", std::function<void(void)>([&](){m_processingUnit->INY();})},
{"DEC", std::function<BYTE(BYTE)>([&](BYTE _1){ return m_processingUnit->DEC(_1);})},
{"DEX", std::function<void(void)>([&](){m_processingUnit->DEX();})},
{"DEY", std::function<void(void)>([&](){m_processingUnit->DEY();})},
{"ASL", std::function<BYTE(BYTE)>([&](BYTE _1){ return m_processingUnit->ASL(_1);})},
{"LSR", std::function<BYTE(BYTE)>([&](BYTE _1){ return m_processingUnit->LSR(_1);})},
{"ROL", std::function<BYTE(BYTE)>([&](BYTE _1){ return m_processingUnit->ROL(_1);})},
{"ROR", std::function<BYTE(BYTE)>([&](BYTE _1){ return m_processingUnit->ROR(_1);})},
{"AND", std::function<void(BYTE)>([&](BYTE _1){m_processingUnit->AND(_1);})},
{"ORA", std::function<void(BYTE)>([&](BYTE _1){m_processingUnit->ORA(_1);})},
{"EOR", std::function<void(BYTE)>([&](BYTE _1){m_processingUnit->EOR(_1);})},
{"PHA", std::function<void(void)>([&](){m_processingUnit->PHA();})},
{"PLA", std::function<void(void)>([&](){m_processingUnit->PLA();})},
{"PHP", std::function<void(void)>([&](){m_processingUnit->PHP();})},
{"PLP", std::function<void(void)>([&](){m_processingUnit->PLP();})},
{"TAX", std::function<void(void)>([&](){m_processingUnit->TAX();})},
{"TAY", std::function<void(void)>([&](){m_processingUnit->TAY();})},
{"TXA", std::function<void(void)>([&](){m_processingUnit->TXA();})},
{"TYA", std::function<void(void)>([&](){m_processingUnit->TYA();})},
{"TSX", std::function<void(void)>([&](){m_processingUnit->TSX();})},
{"TXS", std::function<void(void)>([&](){m_processingUnit->TXS();})},
{"CMP", std::function<void(BYTE)>([&](BYTE _1){m_processingUnit->CMP(_1);})},
{"CPX", std::function<void(BYTE)>([&](BYTE _1){m_processingUnit->CPX(_1);})},
{"CPY", std::function<void(BYTE)>([&](BYTE _1){m_processingUnit->CPY(_1);})},
{"BIT", std::function<void(BYTE)>([&](BYTE _1){m_processingUnit->BIT(_1);})},
{"BCC", std::function<void(BYTE)>([&](BYTE _1){m_processingUnit->BCC(_1);})},
{"BCS", std::function<void(BYTE)>([&](BYTE _1){m_processingUnit->BCS(_1);})},
{"BNE", std::function<void(BYTE)>([&](BYTE _1){m_processingUnit->BNE(_1);})},
{"BEQ", std::function<void(BYTE)>([&](BYTE _1){m_processingUnit->BEQ(_1);})},
{"BPL", std::function<void(BYTE)>([&](BYTE _1){m_processingUnit->BPL(_1);})},
{"BMI", std::function<void(BYTE)>([&](BYTE _1){m_processingUnit->BMI(_1);})},
{"BVC", std::function<void(BYTE)>([&](BYTE _1){m_processingUnit->BVC(_1);})},
{"BVS", std::function<void(BYTE)>([&](BYTE _1){m_processingUnit->BVS(_1);})},
{"JMP", std::function<void(WORD)>([&](WORD _1){m_processingUnit->JMP(_1);})},
{"JSR", std::function<void(WORD)>([&](WORD _1){m_processingUnit->JSR(_1);})},
{"RTS", std::function<void(void)>([&](){m_processingUnit->RTS();})}
};
}
void Processor::setProcessingUnit(std::shared_ptr<ProcessingUnit> processingUnit)
{
m_processingUnit = processingUnit;
}
void Processor::setBus(std::shared_ptr<Bus> bus)
{
m_bus = bus;
m_stack->setBus(m_bus);
}
void Processor::setProgramCounter(WORD address)
{
m_processingUnit->setProgramCounter(address);
}
void Processor::run()
{
while (true)
{
bool increaseProgramCounter = true;
//Fetch
auto programCounter = m_processingUnit->getProgramCounter();
auto x = m_processingUnit->getRegisterX();
auto acc = m_processingUnit->getAccumulator();
auto y = m_processingUnit->getRegisterY();
auto opCode = m_bus->read(programCounter, 1)[0];
if (programCounter == 0xFFF9)
{
cout << endl;
cout << "Emulator is terminated. return code = " << (int)m_processingUnit->getAccumulator() << endl;
break;
}
//Decode
auto command = m_commandTable[opCode];
//cout << command.commandName << endl;
//Read
WORD value = 0;
bool writeback = false;
if (command.mode == AddressMode::Accumulator)
{
value = m_processingUnit->getAccumulator();
}
else if (command.mode == AddressMode::Immediate)
{
value = m_bus->read(programCounter + 1, 1)[0];
}
else if (command.mode == AddressMode::Absolute)
{
auto parameter = m_bus->read(programCounter + 1, 2);
auto address = ((WORD)parameter[1] << 8) + parameter[0];
value = m_bus->read(address, 1)[0];
}
else if (command.mode == AddressMode::ZeroPage)
{
auto address = m_bus->read(programCounter + 1, 1)[0];
value = m_bus->read(address, 1)[0];
}
else if (command.mode == AddressMode::AbsoluteIndirect)
{
auto parameter = m_bus->read(programCounter + 1, 2);
auto address = ((WORD)parameter[1] << 8) + parameter[0];
auto temp = m_bus->read(address, 2);
value = ((WORD)temp[1] << 8) + temp[0];
}
else if (command.mode == AddressMode::AbsoluteIndexedX)
{
auto parameter = m_bus->read(programCounter + 1, 2);
auto address = ((WORD)parameter[1] << 8) + parameter[0];
value = m_bus->read(address + m_processingUnit->getRegisterX(), 1)[0];
}
else if (command.mode == AddressMode::AbsoulteIndexedY)
{
auto parameter = m_bus->read(programCounter + 1, 2);
auto address = ((WORD)parameter[1] << 8) + parameter[0];
value = m_bus->read(address + m_processingUnit->getRegisterY(), 1)[0];
}
else if (command.mode == AddressMode::ZeroPageIndexedX)
{
auto zeroPageAddress = m_bus->read(programCounter + 1, 1)[0];
auto indexX = m_processingUnit->getRegisterX();
value = m_bus->read(zeroPageAddress + indexX, 1)[0];
}
else if (command.mode == AddressMode::ZeroPageIndexedY)
{
auto zeroPageAddress = m_bus->read(programCounter + 1, 1)[0];
auto indexY = m_processingUnit->getRegisterY();
value = m_bus->read(zeroPageAddress + indexY, 1)[0];
}
else if (command.mode == AddressMode::ZeroPageIndexedIndirect)
{
auto zeroPageAddress = m_bus->read(programCounter + 1, 1)[0];
auto indexX = m_processingUnit->getRegisterX();
auto indirectAddress = m_bus->read(zeroPageAddress + indexX, 2);
auto address = ((WORD)indirectAddress[1] << 8) + indirectAddress[0];
value = m_bus->read(address, 1)[0];
}
else if (command.mode == AddressMode::ZeroPageIndirectIndexedY)
{
auto zeroPageAddress = m_bus->read(programCounter + 1, 1)[0];
auto indexY = m_processingUnit->getRegisterY();
auto indirectAddress = m_bus->read(zeroPageAddress, 2);
auto address = ((WORD)indirectAddress[1] << 8) + indirectAddress[0];
value = m_bus->read(address + indexY, 1)[0];
}
//Jump and Branch
if (command.mode == AddressMode::Relative)
{
auto offset = m_bus->read(programCounter + 1, 1)[0];
auto commandAction = std::any_cast<std::function<void(BYTE)>>(m_commandMap[command.commandName]);
commandAction(offset);
continue;
}
if (command.commandName == "JMP" || command.commandName == "JSR")
{
auto commandAction = std::any_cast<std::function<void(WORD)>>(m_commandMap[command.commandName]);
if (command.mode == AddressMode::Absolute)
{
auto parameter = m_bus->read(programCounter + 1, 2);
auto address = ((WORD)parameter[1] << 8) + parameter[0];
commandAction(address);
}
else if (command.mode == AddressMode::AbsoluteIndirect)
{
commandAction(value);
}
continue;
}
if (command.commandName == "RTS")
{
auto commandAction = std::any_cast<std::function<void()>>(m_commandMap[command.commandName]);
commandAction();
continue;
}
//Execute
if (m_commandMap[command.commandName].type() == typeid(std::function<void()>))
{
auto commandAction = std::any_cast<std::function<void()>>(m_commandMap[command.commandName]);
commandAction();
}
else if (m_commandMap[command.commandName].type() == typeid(std::function<void(BYTE)>))
{
auto commandAction = std::any_cast<std::function<void(BYTE)>>(m_commandMap[command.commandName]);
commandAction(value);
}
else if (m_commandMap[command.commandName].type() == typeid(std::function<BYTE()>))
{
auto commandAction = std::any_cast<std::function<BYTE()>>(m_commandMap[command.commandName]);
writeback = true;
value = commandAction();
}
else if (m_commandMap[command.commandName].type() == typeid(std::function<BYTE(BYTE)>))
{
auto commandAction = std::any_cast<std::function<BYTE(BYTE)>>(m_commandMap[command.commandName]);
value = commandAction(value);
}
else
{
std::cout << "Unsupported command" << std::endl;
break;
}
//Write back
if (writeback)
{
if (command.mode == AddressMode::Accumulator)
{
m_processingUnit->setAccumulator(value);
}
else if (command.mode == AddressMode::Absolute)
{
auto parameter = m_bus->read(programCounter + 1, 2);
auto address = ((WORD)parameter[1] << 8) + parameter[0];
m_bus->write(address, std::vector<BYTE>{ (BYTE)value});
}
else if (command.mode == AddressMode::ZeroPage)
{
auto address = m_bus->read(programCounter + 1, 1)[0];
m_bus->write(address, std::vector<BYTE>{ (BYTE)value});
}
else if (command.mode == AddressMode::AbsoluteIndexedX)
{
auto parameter = m_bus->read(programCounter + 1, 2);
auto address = ((WORD)parameter[1] << 8) + parameter[0];
m_bus->write(address + m_processingUnit->getRegisterX(), std::vector<BYTE>{ (BYTE)value});
}
else if (command.mode == AddressMode::AbsoulteIndexedY)
{
auto parameter = m_bus->read(programCounter + 1, 2);
auto address = ((WORD)parameter[1] << 8) + parameter[0];
m_bus->write(address + m_processingUnit->getRegisterY(), std::vector<BYTE>{ (BYTE)value});
}
else if (command.mode == AddressMode::ZeroPageIndexedX)
{
auto zeroPageAddress = m_bus->read(programCounter + 1, 1)[0];
auto indexX = m_processingUnit->getRegisterX();
m_bus->write(zeroPageAddress + indexX, std::vector<BYTE>{ (BYTE)value});
}
else if (command.mode == AddressMode::ZeroPageIndexedY)
{
auto zeroPageAddress = m_bus->read(programCounter + 1, 1)[0];
auto indexY = m_processingUnit->getRegisterY();
m_bus->write(zeroPageAddress + indexY, std::vector<BYTE>{ (BYTE)value});
}
else if (command.mode == AddressMode::ZeroPageIndexedIndirect)
{
auto zeroPageAddress = m_bus->read(programCounter + 1, 1)[0];
auto indexX = m_processingUnit->getRegisterX();
auto indirectAddress = m_bus->read(zeroPageAddress + indexX, 2);
auto address = ((WORD)indirectAddress[1] << 8) + indirectAddress[0];
m_bus->write(address, std::vector<BYTE>{ (BYTE)value});
}
else if (command.mode == AddressMode::ZeroPageIndirectIndexedY)
{
auto zeroPageAddress = m_bus->read(programCounter + 1, 1)[0];
auto indexY = m_processingUnit->getRegisterY();
auto indirectAddress = m_bus->read(zeroPageAddress, 2);
auto address = ((WORD)indirectAddress[1] << 8) + indirectAddress[0];
m_bus->write(address + indexY, std::vector<BYTE>{ (BYTE)value});
//cout << (char)value << endl;
}
}
// Increase Program Counter
if (command.mode == AddressMode::Accumulator)
{
programCounter += 1;
}
else if (command.mode == AddressMode::Implied)
{
programCounter += 1;
}
else if (command.mode == AddressMode::Immediate)
{
programCounter += 2;
}
else if (command.mode == AddressMode::Absolute)
{
programCounter += 3;
}
else if (command.mode == AddressMode::ZeroPage)
{
programCounter += 2;
}
else if (command.mode == AddressMode::AbsoluteIndexedX)
{
programCounter += 3;
}
else if (command.mode == AddressMode::AbsoulteIndexedY)
{
programCounter += 3;
}
else if (command.mode == AddressMode::ZeroPageIndexedX)
{
programCounter += 2;
}
else if (command.mode == AddressMode::ZeroPageIndexedY)
{
programCounter += 2;
}
else if (command.mode == AddressMode::ZeroPageIndexedIndirect)
{
programCounter += 2;
}
else if (command.mode == AddressMode::ZeroPageIndirectIndexedY)
{
programCounter += 2;
}
m_processingUnit->setProgramCounter(programCounter);
}
}
| 35.321053
| 103
| 0.64886
|
yu830425
|
51e72748504e4c3436128bf341d152c17a7ea10e
| 2,755
|
cpp
|
C++
|
paradigms/greedy/134_gas-station.cpp
|
b1tank/leetcode
|
0b71eb7a4f52291ff072b1280d6b76e68f7adfee
|
[
"MIT"
] | null | null | null |
paradigms/greedy/134_gas-station.cpp
|
b1tank/leetcode
|
0b71eb7a4f52291ff072b1280d6b76e68f7adfee
|
[
"MIT"
] | null | null | null |
paradigms/greedy/134_gas-station.cpp
|
b1tank/leetcode
|
0b71eb7a4f52291ff072b1280d6b76e68f7adfee
|
[
"MIT"
] | null | null | null |
// Author: b1tank
// Email: b1tank@outlook.com
//=================================
/*
134_gas-station LeetCode
Solution:
- one pass: return the index after the index where the lowest possible tank is reached (total gas >= total cost)
- better draw graph to show the trend to understand the algorithm
*/
#include <iostream>
#include <sstream> // stringstream, istringstream, ostringstream
#include <string> // to_string(), stoi()
#include <cctype> // isalnum, isalpha, isdigit, islower, isupper, isspace; toupper, tolower
#include <climits> // INT_MAX 2147483647
#include <cmath> // pow(3.0, 4.0)
#include <cstdlib> // rand() % 100 + 1
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <unordered_set> // unordered_set, unordered_multiset
#include <set> // set, multiset
#include <unordered_map> // unordered_map, unordered_multimap
#include <map> // map, multimap
#include <utility> // pair<>
#include <tuple> // tuple<>
#include <algorithm> // reverse, sort, transform, find, remove, count, count_if
#include <memory> // shared_ptr<>, make_shared<>
#include <stdexcept> // invalid_argument
using namespace std;
class Solution {
// bool can_circle(int i, vector<int>& gas, vector<int>& cost) {
// int num = 0;
// int n = gas.size();
// int tank = 0;
// while (num < n) {
// if (tank + gas[i] >= cost[i]) {
// tank = tank + gas[i] - cost[i];
// i = (i+1) % n;
// num++;
// } else {
// break;
// }
// }
// return num == n;
// }
public:
int canCompleteCircuit(vector<int>& gas, vector<int>& cost) {
// 4 1 2 3
// 2 4 3 1
//0 2 -1 -2 0
//
// 3 1 1
// 1 2 2
//0 2 1 0
// int n = gas.size();
// for (int i = 0; i < n; i++) {
// if (can_circle(i, gas, cost)) {
// return i;
// }
// }
// return -1;
int n = gas.size();
int total_g = 0;
int total_c = 0;
int cur_tank = 0;
int min_tank = INT_MAX;
int min_tank_i = 0;
for (int i = 0; i < n; i++) {
total_g += gas[i];
total_c += cost[i];
cur_tank = cur_tank + gas[i] - cost[i];
if (cur_tank <= min_tank) {
min_tank = cur_tank;
min_tank_i = i;
}
}
if (total_g < total_c) {
return -1;
} else {
return (min_tank_i + 1) % n;
}
}
};
| 29.308511
| 117
| 0.476225
|
b1tank
|
51ea15502305cb5ec3b07b5b3cd9e3353652fc0f
| 2,406
|
hpp
|
C++
|
legion/engine/core/ecs/filters/filter_info.hpp
|
Legion-Engine/Legion-Engine
|
a2b898e1cc763b82953c6990dde0b379491a30d0
|
[
"MIT"
] | 258
|
2020-10-22T07:09:57.000Z
|
2021-09-09T05:47:09.000Z
|
legion/engine/core/ecs/filters/filter_info.hpp
|
LeonBrands/Legion-Engine
|
40aa1f4a8c59eb0824de1cdda8e17d8dba7bed7c
|
[
"MIT"
] | 51
|
2020-11-17T13:02:10.000Z
|
2021-09-07T18:19:39.000Z
|
legion/engine/core/ecs/filters/filter_info.hpp
|
Rythe-Interactive/Rythe-Engine.rythe-legacy
|
c119c494524b069a73100b12dc3d8b898347830d
|
[
"MIT"
] | 13
|
2020-12-08T08:06:48.000Z
|
2021-09-09T05:47:19.000Z
|
#pragma once
#include <array>
#include <unordered_set>
#include <functional>
#include <core/common/hash.hpp>
/**
* @file filter_info.hpp
*/
namespace legion::core::ecs
{
/**@struct filter_info_base
* @brief Common base class of all filter_info variants.
*/
struct filter_info_base
{
/**@brief Get variant id through polymorphism.
*/
virtual id_type id() LEGION_PURE;
/**@brief Check if the filter variant contains a component type.
* @tparam component_type Type of the component.
*/
template<typename component_type>
bool contains() { return contains(make_hash<component_type>()); }
/**@brief Polymorphically check whether the filter variant contains a certain component type.
* @param id Local id of the component type.
*/
virtual bool contains(id_type id) LEGION_PURE;
/**@brief Polymorphically check whether the filter variant overlaps a certain combination of component types.
* @param components Unordered set of component type ids.
*/
virtual bool contains(const std::unordered_set<id_type>& components) LEGION_PURE;
virtual ~filter_info_base() = default;
};
template<typename... component_types>
struct filter_info : public filter_info_base
{
private:
template<typename component_type>
constexpr static id_type generateId() noexcept
{
return make_hash<component_type>();
}
template<typename component_type0, typename component_type1, typename... component_typeN>
constexpr static id_type generateId() noexcept
{
return combine_hash(make_hash<component_type0>(), generateId<component_type1, component_typeN...>());
}
public:
/**@brief The actual id of the filter variant.
*/
static constexpr id_type filter_id = generateId<component_types...>();
/**@brief Array of the individual component type ids.
*/
static constexpr std::array<id_type, sizeof...(component_types)> composition = { make_hash<component_types>()... };
virtual id_type id();
virtual bool contains(id_type id) noexcept;
virtual bool contains(const std::unordered_set<id_type>& components);
constexpr static bool contains_direct(id_type id) noexcept;
};
}
| 31.657895
| 123
| 0.657107
|
Legion-Engine
|
51edc2f253669ad6caa3ee9c29458c91e32d7b16
| 7,889
|
cpp
|
C++
|
src/lib/utilities.cpp
|
bloomen/libunittest
|
b168539c70e5ac8a3c67d295e368d07f3c1854fb
|
[
"MIT"
] | 2
|
2020-11-05T12:38:35.000Z
|
2021-03-19T06:02:03.000Z
|
src/lib/utilities.cpp
|
bloomen/libunittest
|
b168539c70e5ac8a3c67d295e368d07f3c1854fb
|
[
"MIT"
] | null | null | null |
src/lib/utilities.cpp
|
bloomen/libunittest
|
b168539c70e5ac8a3c67d295e368d07f3c1854fb
|
[
"MIT"
] | null | null | null |
#include "libunittest/utilities.hpp"
#include <thread>
#include <iostream>
#include <mutex>
#include <cstdlib>
#ifdef _MSC_VER
#include <windows.h>
#include <iomanip>
#else
#include "config.hpp"
#endif
#if HAVE_GCC_ABI_DEMANGLE==1
#include <cxxabi.h>
#endif
namespace unittest {
namespace core {
#if defined(_MSC_VER) && _MSC_VER < 1900
namespace {
const long long g_frequency = []() -> long long
{
LARGE_INTEGER frequency;
QueryPerformanceFrequency(&frequency);
return frequency.QuadPart;
}();
struct windows_high_res_clock {
typedef long long rep;
typedef std::nano period;
typedef std::chrono::duration<rep, period> duration;
typedef std::chrono::time_point<windows_high_res_clock> tp;
static const bool is_steady = true;
static tp now()
{
LARGE_INTEGER count;
QueryPerformanceCounter(&count);
return tp(duration(count.QuadPart * static_cast<rep>(period::den) / g_frequency));
}
};
}
#endif
std::chrono::microseconds
now()
{
#if defined(_MSC_VER) && _MSC_VER < 1900
const auto now = windows_high_res_clock::now();
#else
const auto now = std::chrono::high_resolution_clock::now();
#endif
return std::chrono::duration_cast<std::chrono::microseconds>(now.time_since_epoch());
}
std::string
xml_escape(const std::string& data)
{
std::string escaped;
escaped.reserve(data.size());
for (auto& character : data) {
switch (character) {
case '&': escaped.append("&"); break;
case '\"': escaped.append("""); break;
case '\'': escaped.append("'"); break;
case '<': escaped.append("<"); break;
case '>': escaped.append(">"); break;
default: escaped.append(1, character); break;
}
}
return escaped;
}
std::string
make_iso_timestamp(const std::chrono::system_clock::time_point& time_point,
bool local_time)
{
const auto rawtime = std::chrono::system_clock::to_time_t(time_point);
const auto iso_format = "%Y-%m-%dT%H:%M:%S";
struct std::tm timeinfo;
#ifdef _MSC_VER
if (local_time)
localtime_s(&timeinfo, &rawtime);
else
gmtime_s(&timeinfo, &rawtime);
std::stringstream buffer;
buffer << std::put_time(&timeinfo, iso_format);
return buffer.str();
#else
if (local_time)
timeinfo = *std::localtime(&rawtime);
else
timeinfo = *std::gmtime(&rawtime);
char buffer[20];
std::strftime(buffer, sizeof(buffer), iso_format, &timeinfo);
return buffer;
#endif
}
void
write_to_stream(std::ostream&)
{}
void
write_horizontal_bar(std::ostream& stream,
char character,
int length)
{
const std::string bar(length, character);
stream << bar << std::flush;
}
double
duration_in_seconds(const std::chrono::duration<double>& duration)
{
return std::chrono::duration_cast<std::chrono::duration<double>>(duration).count();
}
bool
is_regex_matched(const std::string& value,
const std::string& regex)
{
return std::regex_match(value, std::regex(regex));
}
bool
is_regex_matched(const std::string& value,
const std::regex& regex)
{
return std::regex_match(value, regex);
}
int
call_functions(const std::vector<std::function<void()>>& functions,
int n_threads)
{
const int n_runs = functions.size();
if (n_threads > n_runs)
n_threads = n_runs;
int counter = 0;
if (n_threads > 1 && n_runs > 1) {
while (counter < n_runs) {
if (n_threads > n_runs - counter)
n_threads = n_runs - counter;
std::vector<std::thread> threads(n_threads);
for (auto& thread : threads)
thread = std::thread(functions[counter++]);
for (auto& thread : threads)
thread.join();
}
} else {
for (auto& function : functions) {
function();
++counter;
}
}
return counter;
}
std::string
limit_string_length(const std::string& value,
int max_length)
{
if (int(value.size()) > max_length) {
return value.substr(0, max_length);
} else {
return value;
}
}
std::string
string_of_file_and_line(const std::string& filename,
int linenumber)
{
return string_of_tagged_text(join(filename, ":", linenumber), "SPOT");
}
std::string
string_of_tagged_text(const std::string& text, const std::string& tag)
{
const std::string id = "@" + tag + "@";
return id + text + id;
}
void
make_threads_happy(std::ostream& stream,
std::vector<std::pair<std::thread, std::shared_ptr<std::atomic_bool>>>& threads,
bool verbose)
{
int n_unfinished = 0;
for (auto& thread : threads)
if (!thread.second->load())
++n_unfinished;
if (n_unfinished && verbose)
stream << "\nWaiting for " << n_unfinished << " tests to finish ... " << std::endl;
for (auto& thread : threads)
thread.first.join();
}
bool
is_numeric(const std::string& value)
{
bool result;
try {
to_number<double>(value);
result = true;
} catch (const std::invalid_argument&) {
result = false;
}
return result;
}
template<>
bool
to_number<bool>(const std::string& value)
{
std::istringstream stream(value);
bool number;
if (stream >> number) {
return number;
} else {
throw std::invalid_argument("Not a boolean: " + value);
}
}
std::string
trim(std::string value)
{
const std::string chars = " \t\n";
std::string check;
while (check!=value) {
check = value;
for (auto& ch : chars) {
value.erase(0, value.find_first_not_of(ch));
value.erase(value.find_last_not_of(ch) + 1);
}
}
return value;
}
std::string
remove_white_spaces(std::string value)
{
value.erase(std::remove(value.begin(), value.end(), ' '), value.end());
return value;
}
std::string
extract_tagged_text(const std::string& message, const std::string& tag)
{
std::string text = "";
const std::string id = "@" + tag + "@";
auto index_start = message.find(id);
if (index_start!=std::string::npos) {
index_start += id.length();
const auto substr = message.substr(index_start);
const auto index_end = substr.find(id);
if (index_end!=std::string::npos) {
text = substr.substr(0, index_end);
}
}
return text;
}
std::string
remove_tagged_text(std::string message, const std::string& tag)
{
auto text = extract_tagged_text(message, tag);
while (!text.empty()) {
const auto token = string_of_tagged_text(text, tag);
const auto index = message.find(token);
message = message.substr(0, index) + message.substr(index+token.length());
text = extract_tagged_text(message, tag);
}
return std::move(message);
}
std::pair<std::string, int>
extract_file_and_line(const std::string& message)
{
std::string filename = "";
int linenumber = -1;
const std::string spot = extract_tagged_text(message, "SPOT");
if (!spot.empty()) {
const auto separator = spot.find_last_of(":");
if (separator!=std::string::npos) {
filename = spot.substr(0, separator);
linenumber = to_number<int>(spot.substr(separator+1));
}
}
return std::make_pair(filename, linenumber);
}
std::string
demangle_type(const std::string& type_name)
{
#if HAVE_GCC_ABI_DEMANGLE==1
int status = -1;
std::unique_ptr<char, void(*)(void*)> result{abi::__cxa_demangle(type_name.c_str(), NULL, NULL, &status), std::free};
return status==0 ? result.get() : type_name;
#else
return type_name;
#endif
}
} // core
} // unittest
| 25.285256
| 121
| 0.610724
|
bloomen
|
51ef02ea8aecd9d9cd738cd6892119e1c6ed9b6a
| 17,497
|
hpp
|
C++
|
src/random/dice.hpp
|
dubkois/Tools
|
9f0efdbd37597b9a78b36e9324d236cf2b006526
|
[
"MIT"
] | null | null | null |
src/random/dice.hpp
|
dubkois/Tools
|
9f0efdbd37597b9a78b36e9324d236cf2b006526
|
[
"MIT"
] | null | null | null |
src/random/dice.hpp
|
dubkois/Tools
|
9f0efdbd37597b9a78b36e9324d236cf2b006526
|
[
"MIT"
] | null | null | null |
#ifndef KGD_UTILS_DICE_HPP
#define KGD_UTILS_DICE_HPP
/******************************************************************************//**
* \file
* \brief Contains the logic for random number generation.
*
* Provides aliases for commonly used types as well as the main class Dice.
*/
#include <random>
#include <chrono>
#include <stdexcept>
#include <iostream>
#include <vector>
#include <map>
#include <mutex>
#ifndef NDEBUG
#include <sstream>
#include <exception>
#include <assert.h>
#endif
namespace rng {
/******************************************************************************//**
* \brief Naive truncated normal distribution.
*
* Converges towards a 0.5 efficiency given reasonably bad parameters
* (e.g. mean=max and min << max-stddev, tested with 10e7 evaluations)
*/
template<typename FLOAT>
class truncated_normal_distribution : public std::normal_distribution<FLOAT> {
#ifndef NDEBUG
/// The number of attempts made to generate a number before failing (Debug only)
static constexpr size_t MAX_TRIES = 100;
#endif
public:
/// Creates a normal distribution with the usual parameters mu and sigma constrained to the interval [min, max]
truncated_normal_distribution(FLOAT mu, FLOAT stddev, FLOAT min, FLOAT max, bool nonZero=true)
: std::normal_distribution<FLOAT>(mu,stddev), _min(min), _max(max), _nonZero(nonZero) {
#ifndef NDEBUG
assert(min < max); // No inverted bounds
assert(fabs(mu - min) > 2. * stddev || fabs(mu - max) > 2. * stddev); // At least 47.5% of values are valid
// e-g: min = 0; mu = max = 1; if std < 1/6 then for x a rnd number P(x in [min,max]) > 0.4985
#endif
}
/// Requests production of a new random value
template<typename RNG>
FLOAT operator() (RNG &rng) {
FLOAT res;
#ifndef NDEBUG
size_t tries = 0;
#endif
do {
#ifndef NDEBUG
if (tries++ > MAX_TRIES) {
std::ostringstream oss;
oss << "truncated_normal_distribution("
<< std::normal_distribution<FLOAT>::mean() << ", "
<< std::normal_distribution<FLOAT>::stddev() << ", "
<< _min << ", " << _max << ", " << std::boolalpha << _nonZero
<< ") failed to produce a valid in value in less than "
<< tries << " attempts";
throw std::domain_error(oss.str());
}
#endif
res = std::normal_distribution<FLOAT>::operator()(rng);
} while (res < _min || _max < res || (_nonZero && res == 0));
return res;
}
/// Prints this distribution to the provided stream
friend std::ostream& operator<< (std::ostream &os, const truncated_normal_distribution &d) {
return os << d.mean() << " " << d.stddev() << " " << d._min << " " << d._max;
}
private:
FLOAT _min; ///< The lowest value that can be produced
FLOAT _max; ///< The largest value that can be produced
bool _nonZero; ///< Is zero a forbidden value ?
};
// ===================================================================================
typedef std::uniform_real_distribution<double> uddist; ///< Alias for a decimal uniform distribution
typedef std::uniform_real_distribution<float> ufdist; ///< Alias for a small decimal uniform distribution
typedef std::uniform_int_distribution<uint> uudist; ///< Alias for an unsigned uniform integer distribution
typedef std::uniform_int_distribution<int> usdist; ///< Alias for a signed uniform integer distribution
typedef std::normal_distribution<double> ndist; ///< Alias for a decimal normal distribution
typedef truncated_normal_distribution<double> tndist; ///< Alias for a decimal truncated normal distribution
typedef std::bernoulli_distribution bdist; ///< Alias for a coin flip distribution
/// Non-empty roulette distribution
struct rdist : public std::discrete_distribution<uint> {
/// \cond internal
/// Builds a roulette distribution and asserts that the input data was not empty
template <typename InputIt>
rdist(InputIt first, InputIt last)
: std::discrete_distribution<uint>(first, last) {
if (!(std::distance(first, last) > 0))
throw std::out_of_range("Cannot create roulette distribution with empty range");
}
/// \endcond
};
// ===================================================================================
// =================================================================================================
/// \brief Random number generation for a wide range of use-cases/distributions.
class AbstractDice {
public:
/// The type used as a seed
using Seed_t = unsigned int;
/// The underlying random number generator
using BaseRNG_t = std::mt19937;
/// \return The current time, as viewed by the system, in milli seconds.
/// Used internally as the default seed for dices
static auto currentMilliTime (void) {
return std::chrono::duration_cast<std::chrono::milliseconds >(
std::chrono::high_resolution_clock::now().time_since_epoch()
).count();
}
protected:
/// Random number generator enriched with its seed
struct RNG_t : public BaseRNG_t {
/// Create a rng using the current time as a seed
RNG_t (void) : RNG_t(currentMilliTime()) {}
/// Create a rng using the providing \p seed
RNG_t (Seed_t seed) : BaseRNG_t(seed), _seed(seed) {}
/// Create a copy of the provided RNG_t
RNG_t (const RNG_t & that) = default;
/// Default destructor
virtual ~RNG_t (void) = default;
/// \return a new number from the underlying random number generator
virtual result_type operator() (void) {
return BaseRNG_t::operator ()();
}
/// Assign the provided RNG_t to this
RNG_t& operator= (RNG_t that) {
swap(*this, that);
return *this;
}
/// \return the seed used for this rng
Seed_t getSeed (void) const {
return _seed;
}
/// Compare values based on their underlying operator== and their seed value
friend bool operator== (const RNG_t &lhs, const RNG_t &rhs) {
return static_cast<const BaseRNG_t&>(lhs) == static_cast<const BaseRNG_t&>(rhs)
&& lhs._seed == rhs._seed;
}
/// Delegates serialization of the internal state of the base rng
friend std::ostream& operator<< (std::ostream &os, const RNG_t &rng) {
auto baseFlags = os.flags();
os.setf(std::ios::dec, std::ios::basefield);
os.setf(std::ios::left, std::ios::adjustfield);
auto loc = os.getloc();
os.imbue(std::locale("C"));
os << rng._seed << " " << static_cast<const BaseRNG_t&>(rng);
os.imbue(loc);
os.setf(baseFlags);
return os;
}
/// Delegates deserialization of the internal state of the base rng
friend std::istream& operator>> (std::istream &is, RNG_t &rng) {
auto baseFlags = is.flags();
is.setf(std::ios::dec, std::ios::basefield);
is.setf(std::ios::left, std::ios::adjustfield);
auto loc = is.getloc();
is.imbue(std::locale("C"));
is >> rng._seed >> static_cast<BaseRNG_t&>(rng);
is.imbue(loc);
is.setf(baseFlags);
return is;
}
/// Swaps the contents of two RNG_t objects
friend void swap (RNG_t &lhs, RNG_t &rhs) {
using std::swap;
swap(static_cast<BaseRNG_t&>(lhs), static_cast<BaseRNG_t&>(rhs));
swap(lhs._seed, rhs._seed);
}
private:
Seed_t _seed; ///< The seed used by this rng
};
private:
/// \return the random number generator used by this dice
virtual RNG_t& getRNG (void) = 0;
/// \return a const reference to the random number generator used by this dice
virtual const RNG_t& getRNG (void) const = 0;
public:
virtual ~AbstractDice (void) {}
/// Resets this dice the a blank state starting with \p newSeed
virtual void reset (Seed_t newSeed) = 0;
/// \return The value used to seed this object
Seed_t getSeed(void) const {
return getRNG().getSeed();
}
/// \return A random number following the provided distribution
/// \tparam A valid distribution \see https://en.cppreference.com/w/cpp/numeric/random
template<typename DIST>
auto operator() (DIST d, typename std::enable_if_t<std::is_invocable<DIST, RNG_t&>::value, int> = 0) {
return d(getRNG());
}
/// \return A random integer in the provided range [lower, upper]
/// \tparam I An integer type (int, uint, long, ...)
/// \throws std::invalid_argument if lower > upper
template <typename I>
typename std::enable_if<std::is_integral<I>::value, I>::type
operator() (I lower, I upper) {
if (lower > upper)
throw std::invalid_argument("Cannot operator() a dice with lower > upper");
return operator()(std::uniform_int_distribution<I>(lower, upper));
}
/// \return A random decimal in the provided range [lower, upper[ if lower < upper.
/// \tparam F A decimal type (float, double, ...)
/// \throws std::invalid_argument if lower > upper
template <typename F>
typename std::enable_if<std::is_floating_point<F>::value, F>::type
operator() (F lower, F upper) {
if (lower > upper)
throw std::invalid_argument("Cannot operator() a dice with lower >= upper");
if (lower == upper) return lower;
return operator()(std::uniform_real_distribution<F>(lower, upper));
}
/// \return A random boolean following the provided coin toss probability
bool operator() (double heads) {
return operator()(bdist(heads));
}
/// \return An iterator to a (uniformly) random position in the container
/// \tparam CONTAINER A container with accessible member functions begin() and size()
/// \attention The container MUST NOT be empty
template <typename CONTAINER>
auto operator() (CONTAINER &c) -> decltype(c.begin()) {
typedef typename std::iterator_traits<decltype(c.begin())>::iterator_category category;
if (c.empty())
throw std::invalid_argument("Cannot pick a random value from an empty container");
return operator()(c.begin(), c.size(), category());
}
/// \return An iterator to a (uniformly) random position between 'begin' and 'end'
/// \tparam IT An iterator with at least ForwardIterator capabilities
/// \see https://en.cppreference.com/w/cpp/named_req/ForwardIterator
/// \attention The distance between these iterators must be STRICTLY positive
template <typename IT, typename CAT = typename std::iterator_traits<IT>::iterator_category>
IT operator() (IT begin, IT end) {
auto dist = std::distance(begin, end);
if (dist == 0)
throw std::invalid_argument("Cannot pick a random value from an empty iterator range");
return operator()(begin, dist, CAT());
}
/// \return Either \p v1 or \p v2 depending on the result of an uniform coin toss
/// \tparam A copyable value
template <typename T>
T toss (const T &v1, const T &v2) {
return operator()(.5) ? v1 : v2;
}
/// Assigns either value from \p lhs or \p rhs 's \p field to \p res 's
template <typename T, typename O>
void toss (const O &lhs, const O &rhs, O &res, T O::*field) {
res.*field = toss(lhs.*field, rhs.*field);
}
/// Suffles the contents of \p c via an in-place implementation of the fisher-yattes algorithm
/// \see https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle
/// \tparam CONTAINER type with random access capabilities (e.g. vector)
template <typename CONTAINER>
void shuffle(CONTAINER &c) {
using std::swap;
for (size_t i=0; i<c.size(); i++) {
size_t j = operator()(size_t(0), i);
swap(c[i], c[j]);
}
}
/// \return A value T taken at a random position in the map according to discrete distribution
/// described in its values
/// \tparam T a copyable type
/// \attention The map shall NOT be empty
template <typename T, typename ...Ts>
T pickOne (const std::map<T, float, Ts...> &map) {
std::vector<T> keys;
std::vector<float> values;
if (map.empty())
throw std::invalid_argument("Cannot pick a random value from an empty map");
keys.reserve(map.size());
values.reserve(map.size());
for (auto &p: map) {
keys.push_back(p.first);
values.push_back(p.second);
}
return keys.at(operator()(rdist(values.begin(), values.end())));
}
/// \return A random unit vector
/// \tparam T a double compatible type (e.g. float loses some precision, int loses at lot)
template <typename T>
void randomUnitVector (T *t) {
double cosphi = operator()(-1., 1.);
double sinphi = sqrt(1 - cosphi*cosphi);
double theta = operator()(0., 2.*M_PI);
t[0] = sinphi * cos(theta);
t[1] = sinphi * sin(theta);
t[2] = cosphi;
}
/// Write current seed
friend std::ostream& operator<< (std::ostream &os, const AbstractDice &dice) {
return os << "D" << dice.getSeed();
}
/// Retrieve current seed
friend std::istream& operator>> (std::istream &is, AbstractDice &dice) {
char D;
Seed_t seed;
is >> D >> seed;
if (is) dice.reset(seed);
return is;
}
private:
/// \return An iterator it so that \p begin <= it < \p begin + \p dist
/// \tparam IT A random access iterator
template <typename IT, typename D = typename std::iterator_traits<IT>::difference_type>
IT operator() (IT begin, D dist, std::random_access_iterator_tag) {
return begin + operator()(D(0), dist-1);
}
/// \return An iterator it so that \p begin <= it < \p begin + \p dist
/// \tparam IT An iterator with at least forward capabilities
template <typename IT, typename D = typename std::iterator_traits<IT>::difference_type>
IT operator() (IT begin, D dist, std::forward_iterator_tag) {
auto it = begin;
std::advance(it, operator()(D(0), dist-1));
return it;
}
};
/// A dice with focus on fast evaluation time.
/// \attention THREAD-UNSAFE
class FastDice : public AbstractDice {
/// The underlying random number generator
RNG_t _rng;
RNG_t& getRNG (void) override { return _rng; }
public:
/// Builds a default dice with a default seed \see rng::AbstractDice::RNG_t()
FastDice (void) {}
/// Builds a dice starting at \p seed
FastDice (Seed_t seed) : _rng(seed) {}
/// Copy-build this dice based on \p other
FastDice (const FastDice &other) : _rng(other._rng) {}
/// Copy contents of \p other into this dice
FastDice& operator= (FastDice that) {
if (this != &that) swap(_rng, that._rng);
return *this;
}
void reset (Seed_t newSeed) override {
_rng = RNG_t(newSeed);
}
const RNG_t& getRNG (void) const override { return _rng; }
/// Compare the underlying random number generator of both arguments
friend bool operator== (const FastDice &lhs, const FastDice &rhs) {
return lhs._rng == rhs._rng;
}
/// Serialize this dice, saving its complete state
friend void serialize (std::ostream &os, const FastDice &d) {
os << d._rng;
}
/// Deserialize this dice, restoring its complete state
friend void deserialize (std::istream &is, FastDice &d) {
is >> d._rng;
}
/// Asserts that two dices are equal (i-e will produce the same sequence)
friend void assertEqual (const FastDice &lhs, const FastDice &rhs,
bool deepcopy) {
if (!(lhs == rhs)) throw std::logic_error("Dice have different states");
if (deepcopy && &lhs == &rhs) throw std::logic_error("Dice have same address");
}
};
/// A dice with focus on safety over speed
/// \attention THREAD-SAFE
class AtomicDice : public AbstractDice {
/// Specialisation of the random number generator with mutex locking on access
struct AtomicRNG_t : public AbstractDice::RNG_t {
/// The base type
using Base = AbstractDice::RNG_t;
/// The lock type used
using lock = std::unique_lock<std::mutex>;
/// The mutex used for locking
mutable std::mutex mtx;
/// Use default seed \see rng::AbstractDice::RNG_t()
AtomicRNG_t(void) {}
/// Use \p seed
AtomicRNG_t(AbstractDice::Seed_t seed) : Base(seed) {}
/// Move contructible
AtomicRNG_t (AtomicRNG_t &&that) {
lock l (that.mtx);
swap(*this, that);
}
/// Assignable
AtomicRNG_t& operator= (AtomicRNG_t that) {
if (this != &that) { // prevent self lock
lock lthis (mtx, std::defer_lock), lthat(that.mtx, std::defer_lock);
std::lock(lthis, lthat);
swap(*this, that);
}
return *this;
}
/// Copy constructible
AtomicRNG_t (const AtomicRNG_t &that) : Base() {
lock l (that.mtx);
Base::operator=(that);
}
/// Request an number from the underlying generator.
/// Uses a mutex lock to ensure thread safety
AbstractDice::RNG_t::result_type operator() (void) {
lock l(mtx);
return AbstractDice::RNG_t::operator ()();
}
private:
/// Swap the contents of both arguments
void swap (AtomicRNG_t &first, AtomicRNG_t &second) {
using std::swap;
swap(static_cast<Base&>(first), static_cast<Base&>(second));
}
};
/// The underlying random number generator
AtomicRNG_t _rng;
RNG_t& getRNG (void) override { return _rng; }
const RNG_t& getRNG (void) const override { return _rng; }
public:
/// Default dice using default seed \see rng::AbstractDice::RNG_t()
AtomicDice (void) {}
/// Dice starting with \p seed
AtomicDice (Seed_t seed) : _rng(seed) {}
void reset (Seed_t newSeed) override {
_rng = AtomicRNG_t(newSeed);
}
/// AtomicDice cannot be duplicated: equality is not possible thus always returns false
friend constexpr bool operator== (const AtomicDice &, const AtomicDice &) {
return false;
}
};
} // end of namespace rng
#endif // KGD_UTILS_DICE_HPP
| 33.138258
| 113
| 0.643482
|
dubkois
|
51ef7de9fa709713a2d3867f94be08202fd61df3
| 5,948
|
cpp
|
C++
|
Plugins/CaptionMod/SourceSDK/vstdlib/KeyValuesSystem.cpp
|
anchurcn/MetaHookSv
|
8408f57d5abb2109285ed9f7897e3a0776e51c87
|
[
"MIT"
] | 31
|
2021-01-20T08:12:48.000Z
|
2022-03-29T16:47:50.000Z
|
Plugins/CaptionMod/SourceSDK/vstdlib/KeyValuesSystem.cpp
|
anchurcn/MetaHookSv
|
8408f57d5abb2109285ed9f7897e3a0776e51c87
|
[
"MIT"
] | 118
|
2021-02-04T17:57:48.000Z
|
2022-03-31T13:03:21.000Z
|
Plugins/CaptionMod/SourceSDK/vstdlib/KeyValuesSystem.cpp
|
anchurcn/MetaHookSv
|
8408f57d5abb2109285ed9f7897e3a0776e51c87
|
[
"MIT"
] | 13
|
2021-01-21T01:43:19.000Z
|
2022-03-15T04:51:19.000Z
|
#include <interface.h>
#include <vstdlib/IKeyValuesSystem.h>
#include <tier1/KeyValues.h>
#include <tier1/mempool.h>
#include <tier1/utlsymbol.h>
#include <tier0/threadtools.h>
#include <tier1/memstack.h>
#include <vgui/ILocalize.h>
#include <tier0/memdbgon.h>
using namespace vgui;
#if 0
#ifdef NO_SBH
#define KEYVALUES_USE_POOL 1
#endif
class CKeyValuesSystem : public IKeyValuesSystem
{
public:
CKeyValuesSystem(void);
~CKeyValuesSystem(void);
public:
void RegisterSizeofKeyValues(int size);
void *AllocKeyValuesMemory(int size);
void FreeKeyValuesMemory(void *pMem);
HKeySymbol GetSymbolForString(const char *name);
const char *GetStringForSymbol(HKeySymbol symbol);
void GetLocalizedFromANSI(const char *ansi, wchar_t *outBuf, int unicodeBufferSizeInBytes);
void GetANSIFromLocalized(const wchar_t *wchar, char *outBuf, int ansiBufferSizeInBytes);
void AddKeyValuesToMemoryLeakList(void *pMem, HKeySymbol name);
void RemoveKeyValuesFromMemoryLeakList(void *pMem);
private:
#ifdef KEYVALUES_USE_POOL
CMemoryPool *m_pMemPool;
#endif
int m_iMaxKeyValuesSize;
CMemoryStack m_Strings;
struct hash_item_t
{
int stringIndex;
hash_item_t *next;
};
CMemoryPool m_HashItemMemPool;
CUtlVector<hash_item_t> m_HashTable;
int CaseInsensitiveHash(const char *string, int iBounds);
struct MemoryLeakTracker_t
{
int nameIndex;
void *pMem;
};
static bool MemoryLeakTrackerLessFunc(const MemoryLeakTracker_t &lhs, const MemoryLeakTracker_t &rhs)
{
return lhs.pMem < rhs.pMem;
}
CUtlRBTree<MemoryLeakTracker_t, int> m_KeyValuesTrackingList;
CThreadFastMutex m_mutex;
};
//EXPOSE_SINGLE_INTERFACE(CKeyValuesSystem, IKeyValuesSystem, KEYVALUES_INTERFACE_VERSION);
static CKeyValuesSystem g_KeyValuesSystem;
IKeyValuesSystem *KeyValuesSystem(void)
{
return &g_KeyValuesSystem;
}
CKeyValuesSystem::CKeyValuesSystem(void) : m_HashItemMemPool(sizeof(hash_item_t), 64, CMemoryPool::GROW_FAST, "CKeyValuesSystem::m_HashItemMemPool"), m_KeyValuesTrackingList(0, 0, MemoryLeakTrackerLessFunc)
{
m_HashTable.AddMultipleToTail(2047);
for (int i = 0; i < m_HashTable.Count(); i++)
{
m_HashTable[i].stringIndex = 0;
m_HashTable[i].next = NULL;
}
m_Strings.Init(4 * 1024 * 1024, 64 * 1024, 0, 4);
char *pszEmpty = ((char *)m_Strings.Alloc(1));
*pszEmpty = 0;
#ifdef KEYVALUES_USE_POOL
m_pMemPool = NULL;
#endif
m_iMaxKeyValuesSize = sizeof(KeyValues);
}
CKeyValuesSystem::~CKeyValuesSystem(void)
{
#ifdef KEYVALUES_USE_POOL
#ifdef _DEBUG
if (m_pMemPool && m_pMemPool->Count() > 0)
{
DevMsg("Leaked KeyValues blocks: %d\n", m_pMemPool->Count());
}
for (int i = 0; i < m_KeyValuesTrackingList.MaxElement(); i++)
{
if (m_KeyValuesTrackingList.IsValidIndex(i))
{
DevMsg("\tleaked KeyValues(%s)\n", &m_Strings[m_KeyValuesTrackingList[i].nameIndex]);
}
}
#endif
delete m_pMemPool;
#endif
}
void CKeyValuesSystem::RegisterSizeofKeyValues(int size)
{
if (size > m_iMaxKeyValuesSize)
{
m_iMaxKeyValuesSize = size;
}
}
static void KVLeak(char const *fmt, ...)
{
va_list argptr;
char data[1024];
va_start(argptr, fmt);
Q_vsnprintf(data, sizeof(data), fmt, argptr);
va_end(argptr);
Msg(data);
}
void *CKeyValuesSystem::AllocKeyValuesMemory(int size)
{
#ifdef KEYVALUES_USE_POOL
if (!m_pMemPool)
{
m_pMemPool = new CMemoryPool(m_iMaxKeyValuesSize, 1024, CMemoryPool::GROW_FAST, "CKeyValuesSystem::m_pMemPool");
m_pMemPool->SetErrorReportFunc(KVLeak);
}
return m_pMemPool->Alloc(size);
#else
return malloc(size);
#endif
}
void CKeyValuesSystem::FreeKeyValuesMemory(void *pMem)
{
#ifdef KEYVALUES_USE_POOL
m_pMemPool->Free(pMem);
#else
free(pMem);
#endif
}
HKeySymbol CKeyValuesSystem::GetSymbolForString(const char *name)
{
if (!name)
{
return (-1);
}
AUTO_LOCK(m_mutex);
int hash = CaseInsensitiveHash(name, m_HashTable.Count());
int i = 0;
hash_item_t *item = &m_HashTable[hash];
while (1)
{
if (!stricmp(name, (char *)m_Strings.GetBase() + item->stringIndex))
return (HKeySymbol)item->stringIndex;
i++;
if (item->next == NULL)
{
if (item->stringIndex != 0)
{
item->next = (hash_item_t *)m_HashItemMemPool.Alloc(sizeof(hash_item_t));
item = item->next;
}
item->next = NULL;
char *pString = (char *)m_Strings.Alloc(strlen(name) + 1);
if (!pString)
{
Error("Out of keyvalue string space");
return -1;
}
item->stringIndex = pString - (char *)m_Strings.GetBase();
strcpy(pString, name);
return (HKeySymbol)item->stringIndex;
}
item = item->next;
}
Assert(0);
return (-1);
}
const char *CKeyValuesSystem::GetStringForSymbol(HKeySymbol symbol)
{
if (symbol == -1)
return "";
return ((char *)m_Strings.GetBase() + (size_t)symbol);
}
void CKeyValuesSystem::GetLocalizedFromANSI(const char *ansi, wchar_t *outBuf, int unicodeBufferSizeInBytes)
{
// g_pLocalize->ConvertANSIToUnicode(ansi, outBuf, unicodeBufferSizeInBytes);
}
void CKeyValuesSystem::GetANSIFromLocalized(const wchar_t *wchar, char *outBuf, int ansiBufferSizeInBytes)
{
// g_pLocalize->ConvertUnicodeToANSI(wchar, outBuf, ansiBufferSizeInBytes);
}
void CKeyValuesSystem::AddKeyValuesToMemoryLeakList(void *pMem, HKeySymbol name)
{
#ifdef _DEBUG
MemoryLeakTracker_t item = { name, pMem };
m_KeyValuesTrackingList.Insert(item);
#endif
}
void CKeyValuesSystem::RemoveKeyValuesFromMemoryLeakList(void *pMem)
{
#ifdef _DEBUG
MemoryLeakTracker_t item = { 0, pMem };
int index = m_KeyValuesTrackingList.Find(item);
m_KeyValuesTrackingList.RemoveAt(index);
#endif
}
int CKeyValuesSystem::CaseInsensitiveHash(const char *string, int iBounds)
{
unsigned int hash = 0;
for ( ; *string != 0; string++)
{
if (*string >= 'A' && *string <= 'Z')
{
hash = (hash << 1) + (*string - 'A' + 'a');
}
else
{
hash = (hash << 1) + *string;
}
}
return hash % iBounds;
}
#endif
extern IKeyValuesSystem *g_pKeyValuesSystem;
IKeyValuesSystem *KeyValuesSystem(void)
{
return g_pKeyValuesSystem;
}
| 20.797203
| 206
| 0.733524
|
anchurcn
|
51efbb8c8b48f317d727dad4a7ab1065b7afad6c
| 1,638
|
cpp
|
C++
|
SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialNetBitWriter.cpp
|
cyberbibby/UnrealGDK
|
9502a1ba11d21b3cb64978ba7ea178c63371cdd0
|
[
"MIT"
] | 1
|
2020-07-15T12:43:02.000Z
|
2020-07-15T12:43:02.000Z
|
SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialNetBitWriter.cpp
|
cyberbibby/UnrealGDK
|
9502a1ba11d21b3cb64978ba7ea178c63371cdd0
|
[
"MIT"
] | null | null | null |
SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialNetBitWriter.cpp
|
cyberbibby/UnrealGDK
|
9502a1ba11d21b3cb64978ba7ea178c63371cdd0
|
[
"MIT"
] | null | null | null |
// Copyright (c) Improbable Worlds Ltd, All Rights Reserved
#include "EngineClasses/SpatialNetBitWriter.h"
#include "UObject/WeakObjectPtr.h"
#include "EngineClasses/SpatialNetDriver.h"
#include "EngineClasses/SpatialPackageMapClient.h"
#include "Schema/UnrealObjectRef.h"
#include "SpatialConstants.h"
#include "Utils/EntityPool.h"
DEFINE_LOG_CATEGORY(LogSpatialNetSerialize);
FSpatialNetBitWriter::FSpatialNetBitWriter(USpatialPackageMapClient* InPackageMap)
: FNetBitWriter(InPackageMap, 0)
{
}
void FSpatialNetBitWriter::SerializeObjectRef(FArchive& Archive, FUnrealObjectRef& ObjectRef)
{
int64 EntityId = ObjectRef.Entity;
Archive << EntityId;
Archive << ObjectRef.Offset;
uint8 HasPath = ObjectRef.Path.IsSet();
Archive.SerializeBits(&HasPath, 1);
if (HasPath)
{
Archive << ObjectRef.Path.GetValue();
}
uint8 HasOuter = ObjectRef.Outer.IsSet();
Archive.SerializeBits(&HasOuter, 1);
if (HasOuter)
{
SerializeObjectRef(Archive, *ObjectRef.Outer);
}
Archive.SerializeBits(&ObjectRef.bNoLoadOnClient, 1);
Archive.SerializeBits(&ObjectRef.bUseClassPathToLoadObject, 1);
}
void FSpatialNetBitWriter::WriteObject(FArchive& Archive, USpatialPackageMapClient* PackageMap, UObject* Object)
{
FUnrealObjectRef ObjectRef = FUnrealObjectRef::FromObjectPtr(Object, PackageMap);
SerializeObjectRef(Archive, ObjectRef);
}
FArchive& FSpatialNetBitWriter::operator<<(UObject*& Value)
{
WriteObject(*this, Cast<USpatialPackageMapClient>(PackageMap), Value);
return *this;
}
FArchive& FSpatialNetBitWriter::operator<<(FWeakObjectPtr& Value)
{
UObject* Object = Value.Get(true);
*this << Object;
return *this;
}
| 26
| 112
| 0.783272
|
cyberbibby
|
51f60f4d28b37309b7d4d0eb515edb9dea2e292a
| 7,504
|
hpp
|
C++
|
include/Zenject/ZenjectStateMachineBehaviourAutoInjecter.hpp
|
RedBrumbler/BeatSaber-Quest-Codegen
|
73dda50b5a3e51f10d86b766dcaa24b0c6226e25
|
[
"Unlicense"
] | null | null | null |
include/Zenject/ZenjectStateMachineBehaviourAutoInjecter.hpp
|
RedBrumbler/BeatSaber-Quest-Codegen
|
73dda50b5a3e51f10d86b766dcaa24b0c6226e25
|
[
"Unlicense"
] | null | null | null |
include/Zenject/ZenjectStateMachineBehaviourAutoInjecter.hpp
|
RedBrumbler/BeatSaber-Quest-Codegen
|
73dda50b5a3e51f10d86b766dcaa24b0c6226e25
|
[
"Unlicense"
] | null | null | null |
// Autogenerated from CppHeaderCreator
// Created by Sc2ad
// =========================================================================
#pragma once
// Begin includes
#include "beatsaber-hook/shared/utils/typedefs.h"
#include "beatsaber-hook/shared/utils/byref.hpp"
// Including type: UnityEngine.MonoBehaviour
#include "UnityEngine/MonoBehaviour.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils-properties.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils-fields.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
#include "beatsaber-hook/shared/utils/typedefs-array.hpp"
// Completed includes
// Begin forward declares
// Forward declaring namespace: Zenject
namespace Zenject {
// Forward declaring type: DiContainer
class DiContainer;
// Forward declaring type: InjectTypeInfo
class InjectTypeInfo;
}
// Forward declaring namespace: UnityEngine
namespace UnityEngine {
// Forward declaring type: Animator
class Animator;
}
// Completed forward declares
// Type namespace: Zenject
namespace Zenject {
// Forward declaring type: ZenjectStateMachineBehaviourAutoInjecter
class ZenjectStateMachineBehaviourAutoInjecter;
}
#include "beatsaber-hook/shared/utils/il2cpp-type-check.hpp"
NEED_NO_BOX(::Zenject::ZenjectStateMachineBehaviourAutoInjecter);
DEFINE_IL2CPP_ARG_TYPE(::Zenject::ZenjectStateMachineBehaviourAutoInjecter*, "Zenject", "ZenjectStateMachineBehaviourAutoInjecter");
// Type namespace: Zenject
namespace Zenject {
// Size: 0x28
#pragma pack(push, 1)
// Autogenerated type: Zenject.ZenjectStateMachineBehaviourAutoInjecter
// [TokenAttribute] Offset: FFFFFFFF
class ZenjectStateMachineBehaviourAutoInjecter : public ::UnityEngine::MonoBehaviour {
public:
#ifdef USE_CODEGEN_FIELDS
public:
#else
#ifdef CODEGEN_FIELD_ACCESSIBILITY
CODEGEN_FIELD_ACCESSIBILITY:
#else
protected:
#endif
#endif
// private Zenject.DiContainer _container
// Size: 0x8
// Offset: 0x18
::Zenject::DiContainer* container;
// Field size check
static_assert(sizeof(::Zenject::DiContainer*) == 0x8);
// private UnityEngine.Animator _animator
// Size: 0x8
// Offset: 0x20
::UnityEngine::Animator* animator;
// Field size check
static_assert(sizeof(::UnityEngine::Animator*) == 0x8);
public:
// Deleting conversion operator: operator ::System::IntPtr
constexpr operator ::System::IntPtr() const noexcept = delete;
// Get instance field reference: private Zenject.DiContainer _container
::Zenject::DiContainer*& dyn__container();
// Get instance field reference: private UnityEngine.Animator _animator
::UnityEngine::Animator*& dyn__animator();
// public System.Void Construct(Zenject.DiContainer container)
// Offset: 0x1CF073C
void Construct(::Zenject::DiContainer* container);
// public System.Void Start()
// Offset: 0x1CF07A8
void Start();
// static private System.Void __zenInjectMethod0(System.Object P_0, System.Object[] P_1)
// Offset: 0x1CF08A4
static void __zenInjectMethod0(::Il2CppObject* P_0, ::ArrayW<::Il2CppObject*> P_1);
// static private Zenject.InjectTypeInfo __zenCreateInjectTypeInfo()
// Offset: 0x1CF0998
static ::Zenject::InjectTypeInfo* __zenCreateInjectTypeInfo();
// public System.Void .ctor()
// Offset: 0x1CF089C
// Implemented from: UnityEngine.MonoBehaviour
// Base method: System.Void MonoBehaviour::.ctor()
// Base method: System.Void Behaviour::.ctor()
// Base method: System.Void Component::.ctor()
// Base method: System.Void Object::.ctor()
// Base method: System.Void Object::.ctor()
template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary>
static ZenjectStateMachineBehaviourAutoInjecter* New_ctor() {
static auto ___internal__logger = ::Logger::get().WithContext("::Zenject::ZenjectStateMachineBehaviourAutoInjecter::.ctor");
return THROW_UNLESS((::il2cpp_utils::New<ZenjectStateMachineBehaviourAutoInjecter*, creationType>()));
}
}; // Zenject.ZenjectStateMachineBehaviourAutoInjecter
#pragma pack(pop)
static check_size<sizeof(ZenjectStateMachineBehaviourAutoInjecter), 32 + sizeof(::UnityEngine::Animator*)> __Zenject_ZenjectStateMachineBehaviourAutoInjecterSizeCheck;
static_assert(sizeof(ZenjectStateMachineBehaviourAutoInjecter) == 0x28);
}
#include "beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp"
// Writing MetadataGetter for method: Zenject::ZenjectStateMachineBehaviourAutoInjecter::Construct
// Il2CppName: Construct
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (Zenject::ZenjectStateMachineBehaviourAutoInjecter::*)(::Zenject::DiContainer*)>(&Zenject::ZenjectStateMachineBehaviourAutoInjecter::Construct)> {
static const MethodInfo* get() {
static auto* container = &::il2cpp_utils::GetClassFromName("Zenject", "DiContainer")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(Zenject::ZenjectStateMachineBehaviourAutoInjecter*), "Construct", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{container});
}
};
// Writing MetadataGetter for method: Zenject::ZenjectStateMachineBehaviourAutoInjecter::Start
// Il2CppName: Start
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (Zenject::ZenjectStateMachineBehaviourAutoInjecter::*)()>(&Zenject::ZenjectStateMachineBehaviourAutoInjecter::Start)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(Zenject::ZenjectStateMachineBehaviourAutoInjecter*), "Start", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: Zenject::ZenjectStateMachineBehaviourAutoInjecter::__zenInjectMethod0
// Il2CppName: __zenInjectMethod0
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (*)(::Il2CppObject*, ::ArrayW<::Il2CppObject*>)>(&Zenject::ZenjectStateMachineBehaviourAutoInjecter::__zenInjectMethod0)> {
static const MethodInfo* get() {
static auto* P_0 = &::il2cpp_utils::GetClassFromName("System", "Object")->byval_arg;
static auto* P_1 = &il2cpp_functions::array_class_get(::il2cpp_utils::GetClassFromName("System", "Object"), 1)->byval_arg;
return ::il2cpp_utils::FindMethod(classof(Zenject::ZenjectStateMachineBehaviourAutoInjecter*), "__zenInjectMethod0", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{P_0, P_1});
}
};
// Writing MetadataGetter for method: Zenject::ZenjectStateMachineBehaviourAutoInjecter::__zenCreateInjectTypeInfo
// Il2CppName: __zenCreateInjectTypeInfo
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<::Zenject::InjectTypeInfo* (*)()>(&Zenject::ZenjectStateMachineBehaviourAutoInjecter::__zenCreateInjectTypeInfo)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(Zenject::ZenjectStateMachineBehaviourAutoInjecter*), "__zenCreateInjectTypeInfo", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: Zenject::ZenjectStateMachineBehaviourAutoInjecter::New_ctor
// Il2CppName: .ctor
// Cannot get method pointer of value based method overload from template for constructor!
// Try using FindMethod instead!
| 52.111111
| 221
| 0.74467
|
RedBrumbler
|
51fa446c6ceb10537b11092cd9baae2c077487ab
| 25,583
|
cpp
|
C++
|
Crypto/C-Code/ECC/eccl.cpp
|
dbmcclain/Lisp-Actors
|
f293326c52bf658fc613237cbb4f740f1ae3b0c1
|
[
"Unlicense"
] | 43
|
2020-10-29T18:05:40.000Z
|
2022-03-29T03:47:01.000Z
|
Crypto/C-Code/ECC/eccl.cpp
|
dbmcclain/Lisp-Actors
|
f293326c52bf658fc613237cbb4f740f1ae3b0c1
|
[
"Unlicense"
] | 1
|
2021-12-31T01:36:49.000Z
|
2021-12-31T15:21:54.000Z
|
Crypto/C-Code/ECC/eccl.cpp
|
dbmcclain/Lisp-Actors
|
f293326c52bf658fc613237cbb4f740f1ae3b0c1
|
[
"Unlicense"
] | 6
|
2020-11-07T07:31:27.000Z
|
2022-01-09T18:48:19.000Z
|
// ecc.cpp -- NIST B571 ECC over F_2^571
// DMcClain/Acudora 11/11
// ---------------------------------------------
#include "ecc.h"
// ------------------------------------------------------------
static const int lmask = sizeof(ulong)-1;
// ------------------------------------------------------------
static_gf128_opnd::static_gf128_opnd()
{
opnd = bytes;
}
static_gf128_opnd::static_gf128_opnd(const gf128_opnd &op)
{
opnd = bytes;
gf128_copy(op);
}
static_gf128_opnd::static_gf128_opnd(const ubyte *pnum, uint nb)
{
opnd = bytes;
if(nb < sizeof(gf128_opnd_bytes))
{
uint nrem = sizeof(gf128_opnd_bytes) - nb;
int ix;
for(ix = 0; ix < nrem; ++ix)
opnd[ix ^ lmask] = 0;
for(int jx = 0; ix < sizeof(gf128_opnd_bytes); ++ix, ++jx)
opnd[ix ^ lmask] = pnum[jx ^ lmask];
}
else
{
uint nrem = nb - sizeof(gf128_opnd_bytes);
memmove(opnd, pnum + nrem, sizeof(gf128_opnd_bytes));
}
}
static_gf128_opnd::static_gf128_opnd(const char *str)
{
opnd = bytes;
init_from_string(str);
}
gf128_opnd& gf128_opnd::init_from_string(const char *str)
{
int ix, jx;
zero();
for(jx = sizeof(gf128_opnd_bytes), ix = strlen(str);
(--jx, ix -= 2, (jx >= 0) && (ix >= 0));
)
{
int x;
sscanf(&str[ix], "%02x", &x);
opnd[jx ^ lmask] = x;
}
if((jx >= 0) && (-1 == ix))
{
int x;
sscanf(str, "%01x", &x);
opnd[jx ^ lmask] = x;
}
}
// -----------------------------------------------------------
gf128_opnd& gf128_add(const gf128_opnd &op1, const gf128_opnd &op2, gf128_opnd &opdst)
{
ulong* pdst = (ulong*)opdst.opnd;
ulong* p1 = (ulong*)op1.opnd;
ulong* p2 = (ulong*)op2.opnd;
pdst[0] = p1[0] ^ p2[0];
pdst[1] = p1[1] ^ p2[1];
return opdst;
}
void gf128_opnd::zero()
{
memset(opnd, 0, sizeof(gf128_opnd_bytes));
}
void gf128_opnd::one()
{
zero();
opnd[(sizeof(gf128_opnd_bytes)-1)^lmask] = 1;
}
void gf128_opnd::two()
{
zero();
opnd[(sizeof(gf128_opnd_bytes)-1)^lmask] = 2;
}
void gf128_opnd::prim()
{
zero();
opnd[(sizeof(gf128_opnd_bytes)-1) ^ lmask] = 0x87;
}
bool gf128_opnd::is_one() const
{
ulong *p = (ulong*)opnd;
if(p[0])
return false;
return (1 == p[1]);
}
void gf128_opnd::step()
{
ulong *p = (ulong*)opnd;
int hibit = (opnd[0 ^ lmask] & 0x080);
static const int nrsh = 8*sizeof(ulong)-1;
p[0] = (p[0] << 1) | (p[1] >> nrsh);
p[1] <<= 1;
if(hibit)
opnd[(sizeof(gf128_opnd_bytes)-1) ^ lmask] ^= 0x087;
}
void gf128_opnd::first_bit(int &ix, ubyte &mask) const
{
ulong *p = (ulong*)opnd;
if(p[0])
ix = 0;
else if(p[1])
ix = sizeof(ulong);
else
{
ix = -1;
return;
}
ubyte b;
for(; ix < sizeof(gf128_opnd_bytes); ++ix)
if((b = opnd[ix ^ lmask])) // assignment intended
break;
for(mask = 0x080; 0 == (mask & b); mask >>= 1)
;
}
int gf128_opnd::integer_length() const
{
int ix;
ubyte mask;
first_bit(ix, mask);
if(ix < 0)
return 0;
ix = 8*(sizeof(gf128_opnd_bytes) - ix);
for(mask <<= 1; mask; mask <<= 1)
--ix;
return ix;
}
gf128_opnd& gf128_opnd::gf128_copy(const gf128_opnd &op)
{
if(opnd != op.opnd)
memmove(opnd, op.opnd, sizeof(gf128_opnd_bytes));
return *this;
}
gf128_opnd& gf128_mul(const gf128_opnd &op1, const gf128_opnd &op2, gf128_opnd &opdst)
{
int ix;
ubyte mask;
op2.first_bit(ix, mask);
if(ix < 0)
{
opdst.zero();
return opdst;
}
static_gf128_opnd ans(op1);
mask >>= 1;
if(0 == mask)
{
mask = 0x080;
++ix;
}
for(; ix < sizeof(gf128_opnd_bytes); ++ix, mask = 0x080)
{
for(; mask; mask >>= 1)
{
ans.step();
if(mask & op2.opnd[ix^lmask])
gf128_add(ans, op1, ans);
}
}
opdst.gf128_copy(ans);
return opdst;
}
#if 0
gf128_opnd& gf128_inv(const gf128_opnd &op, gf128_opnd &opdst)
{
static_gf128_opnd p(op);
opdst.one();
for(int ix = 1; ix < 128; ++ix)
{
gf128_mul(p, p, p);
gf128_mul(p, opdst, opdst);
}
return opdst;
}
#else
gf128_opnd& gf128_inv(const gf128_opnd &op, gf128_opnd &opdst)
{
if(op.is_one())
{
opdst.one();
return opdst;
}
// using extended Euclidean algorithm
static_gf128_opnd u;
static_gf128_opnd v(op);
static_gf128_opnd g1;
static_gf128_opnd g2;
static_gf128_opnd tmp;
g2.one();
{
int j = 129 - v.integer_length();
gf128_shiftl(v, j, u);
u.opnd[(sizeof(gf128_opnd_bytes)-1) ^ lmask] ^= 0x087;
gf128_shiftl(g2, j, g1);
}
while(!(u.is_one()))
{
// if(!u)
// throw("gf128_inv: zero divisor");
int j = u.integer_length() - v.integer_length();
if(j < 0)
{
ubyte *pb = u.opnd;
u.opnd = v.opnd;
v.opnd = pb;
pb = g1.opnd;
g1.opnd = g2.opnd;
g2.opnd = pb;
j = -j;
}
gf128_shiftl(v, j, tmp);
gf128_add(u, tmp, u);
gf128_shiftl(g2, j, tmp);
gf128_add(g1, tmp, g1);
}
opdst.gf128_copy(g1);
return opdst;
}
#endif
gf128_opnd& gf128_div(const gf128_opnd& op1, const gf128_opnd& op2, gf128_opnd& opdst)
{
static_gf128_opnd tmp;
gf128_inv(op2, tmp);
return gf128_mul(op1, tmp, opdst);
}
bool gf128_opnd::operator!() const
{
ulong *p = (ulong*)opnd;
return ((p[0] == 0) && (p[1] == 0));
}
gf128_opnd& gf128_oneplus(const gf128_opnd &op, gf128_opnd &opdst)
{
opdst.gf128_copy(op);
opdst.opnd[(sizeof(gf128_opnd_bytes)-1)^lmask] ^= 1;
return opdst;
}
bool gf128_opnd::operator==(const gf128_opnd &op) const
{
if(opnd == op.opnd)
return true;
ulong *p1 = (ulong*)opnd;
ulong *p2 = (ulong*)op.opnd;
return ((p1[0] == p2[0]) && (p1[1] == p2[1]));
}
gf128_opnd& gf128_shiftl(const gf128_opnd &op, int nsh, gf128_opnd &opdst)
{
int nw = nsh / (8*sizeof(ulong));
if(nw > 0)
{
int nb = nw*sizeof(ulong);
nsh -= 8 * nb;
int nrem = sizeof(gf128_opnd_bytes) - nb;
memmove(opdst.opnd, op.opnd + nb, nrem);
memset(opdst.opnd+nrem, 0, nb);
}
else
opdst.gf128_copy(op);
int nb = nsh / 8;
if(nb > 0)
{
nsh -= 8 * nb;
int ix, jx;
for(ix = 0, jx = nb; jx < sizeof(gf128_opnd_bytes); ++ix, ++jx)
opdst.opnd[ix ^ lmask] = opdst.opnd[jx ^ lmask];
for(; ix < sizeof(gf128_opnd_bytes); ++ix)
opdst.opnd[ix ^ lmask] = 0;
}
if(nsh > 0)
{
int ix;
int rsh = 8*sizeof(ulong) - nsh;
ulong *p = (ulong*)opdst.opnd;
for(ix = 0; ix < sizeof(gf128_opnd_bytes)/sizeof(ulong)-1; ++ix)
p[ix] = ((p[ix] << nsh) |
(p[ix+1] >> rsh));
p[ix] <<= nsh;
}
return opdst;
}
void gf128_opnd::show()
{
for(int ix = 0; ix < sizeof(gf128_opnd_bytes); ++ix)
printf("%02X", opnd[ix ^ lmask]);
}
// ------------------------------------------------------------
// ------------------------------------------------------------
static_gf571_opnd::static_gf571_opnd()
{
opnd = bytes;
}
static_gf571_opnd::static_gf571_opnd(const gf571_opnd &op)
{
opnd = bytes;
gf571_copy(op);
}
static_gf571_opnd::static_gf571_opnd(const ubyte *pnum, uint nb)
{
opnd = bytes;
if(nb < sizeof(gf571_opnd_bytes))
{
uint nrem = sizeof(gf571_opnd_bytes) - nb;
int ix;
for(ix = 0; ix < nrem; ++ix)
opnd[ix ^ lmask] = 0;
for(int jx = 0; ix < sizeof(gf571_opnd_bytes); ++ix, ++jx)
opnd[ix ^ lmask] = pnum[jx ^ lmask];
}
else
{
uint nrem = nb - sizeof(gf571_opnd_bytes);
memmove(opnd, pnum + nrem, sizeof(gf571_opnd_bytes));
opnd[0 ^ lmask] &= 0x07;
}
}
static_gf571_opnd::static_gf571_opnd(const char *str)
{
opnd = bytes;
init_from_string(str);
}
gf571_opnd& gf571_opnd::init_from_string(const char *str)
{
int ix, jx;
zero();
for(jx = sizeof(gf571_opnd_bytes), ix = strlen(str);
(--jx, ix -= 2, (jx >= 0) && (ix >= 0));
)
{
int x;
sscanf(&str[ix], "%02x", &x);
opnd[jx ^ lmask] = x;
}
if((jx >= 0) && (-1 == ix))
{
int x;
sscanf(str, "%01x", &x);
opnd[jx ^ lmask] = x;
}
}
// -----------------------------------------------------------
gf571_opnd& gf571_add(const gf571_opnd &op1, const gf571_opnd &op2, gf571_opnd &opdst)
{
ulong* pdst = (ulong*)opdst.opnd;
ulong* p1 = (ulong*)op1.opnd;
ulong* p2 = (ulong*)op2.opnd;
for(int ix = sizeof(gf571_opnd_bytes)/sizeof(ulong); --ix >= 0;)
*pdst++ = *p1++ ^ *p2++;
return opdst;
}
void gf571_opnd::zero()
{
memset(opnd, 0, sizeof(gf571_opnd_bytes));
}
void gf571_opnd::one()
{
zero();
opnd[(sizeof(gf571_opnd_bytes)-1)^lmask] = 1;
}
void gf571_opnd::two()
{
zero();
opnd[(sizeof(gf571_opnd_bytes)-1)^lmask] = 2;
}
void gf571_opnd::prim()
{
zero();
opnd[ 0 ^ lmask] = 0x08;
opnd[(sizeof(gf571_opnd_bytes)-2) ^ lmask] = 0x04;
opnd[(sizeof(gf571_opnd_bytes)-1) ^ lmask] = 0x25;
}
bool gf571_opnd::is_one() const
{
int ix;
ulong *p = (ulong*)opnd;
for(ix = 0; ix < sizeof(gf571_opnd_bytes)/sizeof(ulong)-1; ++ix)
if(p[ix])
return false;
return (1 == p[ix]);
}
void gf571_opnd::step()
{
int ix;
ulong *p = (ulong*)opnd;
static const int nrsh = 8*sizeof(ulong)-1;
for(ix = 0; ix < sizeof(gf571_opnd_bytes)/sizeof(ulong)-1; ++ix)
p[ix] = ((p[ix] << 1) |
(p[ix+1] >> nrsh));
p[ix] <<= 1;
if(opnd[0 ^ lmask] & 0x08)
{
opnd[ 0 ^ lmask] ^= 0x08;
opnd[(sizeof(gf571_opnd_bytes)-2) ^ lmask] ^= 0x04;
opnd[(sizeof(gf571_opnd_bytes)-1) ^ lmask] ^= 0x25;
}
}
void gf571_opnd::first_bit(int &ix, ubyte &mask) const
{
ulong *p = (ulong*)opnd;
for(ix = 0; ix < sizeof(gf571_opnd_bytes)/sizeof(ulong); ++ix)
if(p[ix])
break;
if(ix >= sizeof(gf571_opnd_bytes)/sizeof(ulong))
{
ix = -1;
return;
}
ix *= sizeof(ulong);
ubyte b;
for(; ix < sizeof(gf571_opnd_bytes); ++ix)
if(b = opnd[ix ^ lmask]) // assignment intended
break;
for(mask = 0x080; 0 == (mask & b); mask >>= 1)
;
}
int gf571_opnd::integer_length() const
{
int ix;
ubyte mask;
first_bit(ix, mask);
if(ix < 0)
return 0;
ix = 8*(sizeof(gf571_opnd_bytes) - ix);
for(mask <<= 1; mask; mask <<= 1)
--ix;
return ix;
}
gf571_opnd& gf571_opnd::gf571_copy(const gf571_opnd &op)
{
if(opnd != op.opnd)
memmove(opnd, op.opnd, sizeof(gf571_opnd_bytes));
return *this;
}
gf571_opnd& gf571_mul(const gf571_opnd &op1, const gf571_opnd &op2, gf571_opnd &opdst)
{
int ix;
ubyte mask;
op2.first_bit(ix, mask);
if(ix < 0)
{
opdst.zero();
return opdst;
}
static_gf571_opnd ans(op1);
mask >>= 1;
if(0 == mask)
{
mask = 0x080;
++ix;
}
for(; ix < sizeof(gf571_opnd_bytes); ++ix, mask = 0x080)
{
for(; mask; mask >>= 1)
{
ans.step();
if(mask & op2.opnd[ix^lmask])
gf571_add(ans, op1, ans);
}
}
opdst.gf571_copy(ans);
return opdst;
}
#if 0
gf571_opnd& gf571_inv(const gf571_opnd &op, gf571_opnd &opdst)
{
static_gf571_opnd p(op);
opdst.one();
for(int ix = 1; ix < 571; ++ix)
{
gf571_mul(p, p, p);
gf571_mul(p, opdst, opdst);
}
return opdst;
}
#else
gf571_opnd& gf571_inv(const gf571_opnd &op, gf571_opnd &opdst)
{
// using extended Euclidean algorithm
static_gf571_opnd u(op);
static_gf571_opnd v;
static_gf571_opnd g1;
static_gf571_opnd g2;
static_gf571_opnd tmp;
v.prim();
g1.one();
g2.zero();
while(!(u.is_one()))
{
// if(!u)
// throw("gf571_inv: zero divisor");
int j = u.integer_length() - v.integer_length();
if(j < 0)
{
ubyte *pb = u.opnd;
u.opnd = v.opnd;
v.opnd = pb;
pb = g1.opnd;
g1.opnd = g2.opnd;
g2.opnd = pb;
j = -j;
}
gf571_shiftl(v, j, tmp);
gf571_add(u, tmp, u);
gf571_shiftl(g2, j, tmp);
gf571_add(g1, tmp, g1);
}
opdst.gf571_copy(g1);
return opdst;
}
#endif
gf571_opnd& gf571_div(const gf571_opnd& op1, const gf571_opnd& op2, gf571_opnd& opdst)
{
static_gf571_opnd tmp;
gf571_inv(op2, tmp);
return gf571_mul(op1, tmp, opdst);
}
bool gf571_opnd::operator!() const
{
ulong *p = (ulong*)opnd;
for(int ix = sizeof(gf571_opnd_bytes)/sizeof(ulong); --ix >= 0; ++p)
if(*p)
return false;
return true;
}
gf571_opnd& gf571_oneplus(const gf571_opnd &op, gf571_opnd &opdst)
{
opdst.gf571_copy(op);
opdst.opnd[(sizeof(gf571_opnd_bytes)-1)^lmask] ^= 1;
return opdst;
}
bool gf571_opnd::operator==(const gf571_opnd &op) const
{
if(opnd == op.opnd)
return true;
ulong *p1 = (ulong*)opnd;
ulong *p2 = (ulong*)op.opnd;
for(int ix = sizeof(gf571_opnd_bytes)/sizeof(ulong); --ix >= 0; ++p1, ++p2)
if(*p1 != *p2)
return false;
return true;
}
gf571_opnd& gf571_shiftl(const gf571_opnd &op, int nsh, gf571_opnd &opdst)
{
int nw = nsh / (8*sizeof(ulong));
if(nw > 0)
{
int nb = nw*sizeof(ulong);
nsh -= 8 * nb;
int nrem = sizeof(gf571_opnd_bytes) - nb;
memmove(opdst.opnd, op.opnd + nb, nrem);
memset(opdst.opnd+nrem, 0, nb);
}
else
opdst.gf571_copy(op);
int nb = nsh / 8;
if(nb > 0)
{
nsh -= 8 * nb;
int ix, jx;
for(ix = 0, jx = nb; jx < sizeof(gf571_opnd_bytes); ++ix, ++jx)
opdst.opnd[ix ^ lmask] = opdst.opnd[jx ^ lmask];
for(; ix < sizeof(gf571_opnd_bytes); ++ix)
opdst.opnd[ix ^ lmask] = 0;
}
if(nsh > 0)
{
int ix;
int rsh = 8*sizeof(ulong) - nsh;
ulong *p = (ulong*)opdst.opnd;
for(ix = 0; ix < sizeof(gf571_opnd_bytes)/sizeof(ulong)-1; ++ix)
p[ix] = ((p[ix] << nsh) |
(p[ix+1] >> rsh));
p[ix] <<= nsh;
}
return opdst;
}
void gf571_opnd::show()
{
for(int ix = 0; ix < sizeof(gf571_opnd_bytes); ++ix)
printf("%02X", opnd[ix ^ lmask]);
}
// ------------------------------------------------------------------
static_ecc571_affine_pt::static_ecc571_affine_pt()
{
x.opnd = xbytes;
y.opnd = ybytes;
}
static_ecc571_affine_pt::static_ecc571_affine_pt(const ecc571_affine_pt &pt)
{
x.opnd = xbytes;
y.opnd = ybytes;
ecc571_copy(pt);
}
static_ecc571_affine_pt::static_ecc571_affine_pt(const char* str[2])
{
x.opnd = xbytes;
y.opnd = ybytes;
x.init_from_string(str[0]);
y.init_from_string(str[1]);
}
// ------------------------------------------------------------
ecc571_affine_pt::ecc571_affine_pt(ubyte* px, ubyte* py)
{
x.opnd = px;
y.opnd = py;
}
ecc571_affine_pt &ecc571_affine_pt::infinite()
{
x.zero();
y.zero();
return *this;
}
bool ecc571_affine_pt::infinite_p() const
{
return !x;
}
ecc571_affine_pt& ecc571_affine_pt::ecc571_copy(const ecc571_affine_pt &pt)
{
x.gf571_copy(pt.x);
y.gf571_copy(pt.y);
return *this;
}
ecc571_affine_pt& ecc571_neg(const ecc571_affine_pt &pt, ecc571_affine_pt &ptdst)
{
ptdst.x.gf571_copy(pt.x);
gf571_add(pt.x, pt.y, ptdst.y);
return ptdst;
}
ecc571_affine_pt& ecc571_sub(const ecc571_affine_pt &pt1, const ecc571_affine_pt &pt2, ecc571_affine_pt &ptdst)
{
static_ecc571_affine_pt tmp;
ecc571_neg(pt2, tmp);
return ecc571_add(pt1, tmp, ptdst);
}
ecc571_affine_pt& ecc571_double(const ecc571_affine_pt &pt, ecc571_affine_pt &ptdst)
{
if(pt.infinite_p())
{
ptdst.infinite();
return ptdst;
}
static_gf571_opnd s;
static_gf571_opnd tmp1, tmp2;
static_ecc571_affine_pt ans;
gf571_div(pt.y, pt.x, s);
gf571_add(pt.x, s, s);
gf571_mul(s, s, tmp1);
gf571_oneplus(s, tmp2);
gf571_add(tmp1, tmp2, ans.x);
gf571_mul(tmp2, ans.x, tmp1);
gf571_mul(pt.x, pt.x, tmp2);
gf571_add(tmp1, tmp2, ans.y);
ptdst.ecc571_copy(ans);
return ptdst;
}
ecc571_affine_pt &ecc571_add(const ecc571_affine_pt &pt1, const ecc571_affine_pt &pt2, ecc571_affine_pt &ptdst)
{
if(pt1.infinite_p())
{
ptdst.ecc571_copy(pt2);
return ptdst;
}
if(pt2.infinite_p())
{
ptdst.ecc571_copy(pt1);
return ptdst;
}
if(pt1.x == pt2.x)
{
if(pt1.y == pt2.y)
return ecc571_double(pt1, ptdst);
static_gf571_opnd tmp1;
gf571_add(pt1.x, pt1.y, tmp1);
if(pt2.y == tmp1)
return ptdst.infinite();
gf571_add(pt2.x, pt2.y, tmp1);
if(pt1.y == tmp1)
return ptdst.infinite();
}
static_gf571_opnd s, tmp1, tmp2;
static_ecc571_affine_pt ans;
gf571_add(pt1.y, pt2.y, tmp1);
gf571_add(pt1.x, pt2.x, tmp2);
gf571_div(tmp1, tmp2, s);
gf571_add(tmp2, s, tmp1);
gf571_mul(s, s, tmp2);
gf571_add(tmp2, tmp1, tmp1);
gf571_oneplus(tmp1, ans.x);
gf571_add(pt1.x, ans.x, tmp1);
gf571_mul(s, tmp1, tmp2);
gf571_add(tmp2, ans.x, tmp1);
gf571_add(tmp1, pt1.y, ans.y);
ptdst.ecc571_copy(ans);
return ptdst;
}
void ecc571_affine_pt::show()
{
printf("{affine\n x:");
x.show();
printf("\n y:");
y.show();
printf(" }\n");
}
// -------------------------------------------------------
static_ecc571_projective_pt::static_ecc571_projective_pt()
{
x.opnd = xbytes;
y.opnd = ybytes;
z.opnd = zbytes;
}
static_ecc571_projective_pt::static_ecc571_projective_pt(const ecc571_projective_pt &pt)
{
x.opnd = xbytes;
y.opnd = ybytes;
z.opnd = zbytes;
ecc571_copy(pt);
}
static_ecc571_projective_pt::static_ecc571_projective_pt(const ecc571_affine_pt &pt)
{
x.opnd = xbytes;
y.opnd = ybytes;
z.opnd = zbytes;
x.gf571_copy(pt.x);
y.gf571_copy(pt.y);
z.one();
}
// -------------------------------------------------------
ecc571_affine_pt& ecc571_projective_pt::convert_to_affine(ecc571_affine_pt &ptdst)
{
if(infinite_p())
ptdst.infinite();
else
{
static_gf571_opnd tmp1;
gf571_inv(z, tmp1);
gf571_mul(x, tmp1, ptdst.x);
gf571_mul(tmp1, tmp1, tmp1);
gf571_mul(y, tmp1, ptdst.y);
}
return ptdst;
}
ecc571_projective_pt &ecc571_projective_pt::ecc571_copy(const ecc571_projective_pt &pt)
{
x.gf571_copy(pt.x);
y.gf571_copy(pt.y);
z.gf571_copy(pt.z);
return *this;
}
ecc571_projective_pt &ecc571_projective_pt::infinite()
{
x.one();
y.zero();
z.zero();
return *this;
}
bool ecc571_projective_pt::infinite_p() const
{
return !z;
}
static_gf571_opnd gEcc571_b("2f40e7e2221f295de297117b7f3d62f5c6a97ffcb8ceff1cd6ba8ce4a9a18ad84ffabbd8efa59332be7ad6756a66e294afd185a78ff12aa520e4de739baca0c7ffeff7f2955727a");
ecc571_projective_pt& ecc571_double(const ecc571_projective_pt &pt, ecc571_projective_pt &ptdst)
{
if(pt.infinite_p())
{
ptdst = pt;
return ptdst;
}
static_gf571_opnd x1sq;
static_gf571_opnd z1sq;
static_gf571_opnd bz1sqsq;
static_gf571_opnd tmp1, tmp2;
static_ecc571_projective_pt ans;
gf571_mul(pt.x, pt.x, x1sq);
gf571_mul(pt.z, pt.z, z1sq);
gf571_mul(z1sq, z1sq, bz1sqsq);
gf571_mul(bz1sqsq, gEcc571_b, bz1sqsq);
gf571_mul(x1sq, z1sq, ans.z);
gf571_mul(x1sq, x1sq, tmp1);
gf571_add(tmp1, bz1sqsq, ans.x);
gf571_mul(pt.y, pt.y, tmp1);
gf571_add(tmp1, bz1sqsq, tmp1);
gf571_add(tmp1, ans.z, tmp1);
gf571_mul(ans.x, tmp1, tmp1);
gf571_mul(bz1sqsq, ans.z, tmp2);
gf571_add(tmp1, tmp2, ans.y);
ptdst.ecc571_copy(ans);
return ptdst;
}
ecc571_projective_pt& ecc571_add(const ecc571_projective_pt &pt1, const ecc571_projective_pt &pt2, ecc571_projective_pt &ptdst)
{
if(pt1.infinite_p())
{
ptdst.ecc571_copy(pt2);
return ptdst;
}
static_gf571_opnd t1;
static_gf571_opnd t2;
static_gf571_opnd t3;
static_ecc571_projective_pt ans;
gf571_mul(pt1.z, pt2.x, t1);
gf571_mul(pt1.z, pt1.z, t2);
gf571_add(pt1.x, t1, ans.x);
gf571_mul(pt1.z, ans.x, t1);
gf571_mul(t2, pt2.y, t3);
gf571_add(pt1.y, t3, ans.y);
if(!ans.x)
{
if(!ans.y)
return ecc571_double(pt2, ptdst);
else
{
ptdst.infinite();
return ptdst;
}
}
else
{
gf571_mul(t1, t1, ans.z);
gf571_mul(t1, ans.y, t3);
gf571_add(t1, t2, t1);
gf571_mul(ans.x, ans.x, t2);
gf571_mul(t2, t1, ans.x);
gf571_mul(ans.y, ans.y, t2);
gf571_add(ans.x, t2, ans.x);
gf571_add(ans.x, t3, ans.x);
gf571_mul(pt2.x, ans.z, t2);
gf571_add(t2, ans.x, t2);
gf571_mul(ans.z, ans.z, t1);
gf571_add(t3, ans.z, t3);
gf571_mul(t3, t2, ans.y);
gf571_add(pt2.x, pt2.y, t2);
gf571_mul(t1, t2, t3);
gf571_add(ans.y, t3, ans.y);
ptdst.ecc571_copy(ans);
return ptdst;
}
}
ecc571_projective_pt& ecc571_mul(const ecc571_projective_pt &pt, const gf571_opnd &n, ecc571_projective_pt &ptdst)
{
if(!n)
{
ptdst.infinite();
return ptdst;
}
if(pt.infinite_p())
{
ptdst.infinite();
return ptdst;
}
static_ecc571_projective_pt ans(pt);
int ix;
ubyte mask;
n.first_bit(ix, mask);
mask >>= 1;
if(0 == mask)
{
mask = 0x080;
++ix;
}
for(; ix < sizeof(gf571_opnd_bytes); ++ix, mask = 0x080)
{
for(; mask; mask >>= 1)
{
ecc571_double(ans, ans);
if(mask & n.opnd[ix ^ lmask])
ecc571_add(ans, pt, ans);
}
}
ptdst.ecc571_copy(ans);
return ptdst;
}
ecc571_affine_pt& ecc571_mul(const ecc571_affine_pt &pt, const gf571_opnd &n, ecc571_affine_pt &ptdst)
{
static_ecc571_projective_pt p(pt);
static_ecc571_projective_pt ans;
ecc571_mul(p, n, ans);
ans.convert_to_affine(ptdst);
return ptdst;
}
static const char* genStr[2] = {
"303001d34b856296c16c0d40d3cd7750a93d1d2955fa80aa5f40fc8db7b2abdbde53950f4c0d293cdd711a35b67fb1499ae60038614f1394abfa3b4c850d927e1e7769c8eec2d19",
"37bf27342da639b6dccfffeb73d69d78c6c27a6009cbbca1980f8533921e8a684423e43bab08a576291af8f461bb2a8b3531d2f0485c19b16e2f1516e23dd3c1a4827af1b8ac15b"
};
const static_ecc571_affine_pt gGen(genStr);
ecc571_affine_pt& ecc571_mulGen(const gf571_opnd &n, ecc571_affine_pt &ptdst)
{
return ecc571_mul(gGen, n, ptdst);
}
extern "C" {
void gf128_add(ubyte *op1, ubyte *op2, ubyte *opdst)
{
gf128_opnd p1(op1);
gf128_opnd p2(op2);
gf128_opnd pdst(opdst);
gf128_add(p1, p2, pdst);
}
void gf128_mul(ubyte *op1, ubyte *op2, ubyte *opdst)
{
gf128_opnd p1(op1);
gf128_opnd p2(op2);
gf128_opnd pdst(opdst);
gf128_mul(p1, p2, pdst);
}
void gf128_inv(ubyte *op, ubyte *opdst)
{
gf128_opnd p(op);
gf128_opnd pdst(opdst);
gf128_inv(p, pdst);
}
void gf128_div(ubyte *op1, ubyte *op2, ubyte *opdst)
{
gf128_opnd p1(op1);
gf128_opnd p2(op2);
gf128_opnd pdst(opdst);
gf128_div(p1, p2, pdst);
}
// -------------------------------------------------------
void gf571_add(ubyte *op1, ubyte *op2, ubyte *opdst)
{
gf571_opnd p1(op1);
gf571_opnd p2(op2);
gf571_opnd pdst(opdst);
gf571_add(p1, p2, pdst);
}
void gf571_mul(ubyte *op1, ubyte *op2, ubyte *opdst)
{
gf571_opnd p1(op1);
gf571_opnd p2(op2);
gf571_opnd pdst(opdst);
gf571_mul(p1, p2, pdst);
}
void gf571_inv(ubyte *op, ubyte *opdst)
{
gf571_opnd p(op);
gf571_opnd pdst(opdst);
gf571_inv(p, pdst);
}
void gf571_div(ubyte *op1, ubyte *op2, ubyte *opdst)
{
gf571_opnd p1(op1);
gf571_opnd p2(op2);
gf571_opnd pdst(opdst);
gf571_div(p1, p2, pdst);
}
// -------------------------------------------------------
#if 0
void gf571_shiftl(ubyte *op, int nsh, ubyte *opdst)
{
gf571_opnd p(op);
gf571_opnd pdst(opdst);
gf571_shiftl(p, nsh, pdst);
}
void gf571_prim(ubyte *opdst)
{
gf571_opnd pdst(opdst);
pdst.prim();
}
int gf571_is_one(ubyte *opnd)
{
gf571_opnd p(opnd);
return p.is_one();
}
int gf571_sizeof_opnd()
{
return sizeof(ulong);
}
#endif
// -------------------------------------------------------
void c_ecc571_add(ubyte *op1x, ubyte *op1y,
ubyte *op2x, ubyte *op2y,
ubyte *ansx, ubyte *ansy)
{
ecc571_affine_pt p1(op1x, op1y);
ecc571_affine_pt p2(op2x, op2y);
ecc571_affine_pt ans(ansx, ansy);
ecc571_add(p1,p2,ans);
}
void c_ecc571_sub(ubyte *op1x, ubyte *op1y,
ubyte *op2x, ubyte *op2y,
ubyte *ansx, ubyte *ansy)
{
ecc571_affine_pt p1(op1x, op1y);
ecc571_affine_pt p2(op2x, op2y);
ecc571_affine_pt ans(ansx, ansy);
ecc571_sub(p1,p2,ans);
}
void c_ecc571_mul(ubyte *op1x, ubyte *op1y,
ubyte *op2,
ubyte *ansx, ubyte *ansy)
{
ecc571_affine_pt p1(op1x, op1y);
ecc571_affine_pt ans(ansx, ansy);
gf571_opnd p2(op2);
ecc571_mul(p1,p2,ans);
}
};
| 21.643824
| 176
| 0.562092
|
dbmcclain
|
a4036081cd6c02d2ad4c99f6385f457cef1a1cac
| 3,274
|
hpp
|
C++
|
samples/deeplearning/gxm/include/ConvImpl.hpp
|
abhisek-kundu/libxsmm
|
6c8ca987e77e32253ad347a1357ce2687c448ada
|
[
"BSD-3-Clause"
] | 651
|
2015-03-14T23:18:44.000Z
|
2022-01-19T14:08:28.000Z
|
samples/deeplearning/gxm/include/ConvImpl.hpp
|
abhisek-kundu/libxsmm
|
6c8ca987e77e32253ad347a1357ce2687c448ada
|
[
"BSD-3-Clause"
] | 362
|
2015-01-26T16:20:28.000Z
|
2022-01-26T06:19:23.000Z
|
samples/deeplearning/gxm/include/ConvImpl.hpp
|
abhisek-kundu/libxsmm
|
6c8ca987e77e32253ad347a1357ce2687c448ada
|
[
"BSD-3-Clause"
] | 169
|
2015-09-28T17:06:28.000Z
|
2021-12-18T16:02:49.000Z
|
/******************************************************************************
* Copyright (c) Intel Corporation - All rights reserved. *
* This file is part of the LIBXSMM library. *
* *
* For information on the license, see the LICENSE file. *
* Further information: https://github.com/hfp/libxsmm/ *
* SPDX-License-Identifier: BSD-3-Clause *
******************************************************************************/
/* Sasikanth Avancha, Dhiraj Kalamkar (Intel Corp.)
******************************************************************************/
#pragma once
#include <omp.h>
#include <assert.h>
#include <sys/time.h>
#include <string.h>
#include "common.hpp"
#include "check.hpp"
#include "Tensor.hpp"
typedef struct {
string node_name;
int nInput, nOutput;
int batch_size;
int iHeight, iWidth, iDepth;
int oHeight, oWidth, oDepth;
int ipad_h, ipad_w, ipad_d;
int opad_h, opad_w, opad_d;
int pad_h, pad_w, pad_d;
int stride_h, stride_w, stride_d;
int kh, kw, kd;
int group;
bool bias_term, compute_stats;
bool relu, bwd_relu, physical_padding;
int algType;
int bdims, tdims, wdims, bidims;
int in_data_type, out_data_type;
int num_threads;
int num_numa_nodes;
} ConvImplParams;
class ConvImpl
{
protected:
ConvImplParams *gp;
int engine;
TensorLayoutType top_layout_type, gbot_layout_type;
void *top_layout, *gbot_layout;
int top_compute_engine=-1;
int bot_compute_engine=-1;
string nname;
TensorBuf* scratchp;
public:
ConvImpl(ConvImplParams* gp_, int engine_): gp(gp_), engine(engine_) {}
void set_top_compute_engine(int e) { top_compute_engine = e;}
void set_bot_compute_engine(int e) { bot_compute_engine = e;}
void set_node_name(string s) { nname = s; }
void set_scratch_buffer(TensorBuf* sb) { scratchp = sb; }
virtual void forwardPropagate(TensorBuf *inp, TensorBuf *weightp, TensorBuf* hweightp, TensorBuf *biasp, TensorBuf *outp, int tid) = 0;
virtual void backPropagate(TensorBuf* inp, TensorBuf *deloutp, TensorBuf* weightp, TensorBuf *delinp, int tid) = 0;
virtual void weightUpdate(TensorBuf *inp, TensorBuf *deloutp, TensorBuf *delweightp, TensorBuf *delbiasp, int tid) = 0;
virtual void dumpBuffer(TensorBuf*, void*) {}
virtual void forwardPropagate(TensorBuf *inp, TensorBuf* weightp, TensorBuf* hweightp, TensorBuf* biasp, TensorBuf *outp)
{
switch(engine)
{
case XSMM:
forwardPropagate(inp, weightp, hweightp, biasp, outp, 0);
break;
}
}
virtual void backPropagate(TensorBuf* inp, TensorBuf* weightp, TensorBuf *deloutp, TensorBuf *delinp)
{
switch(engine)
{
case XSMM:
backPropagate(inp, weightp, deloutp, delinp, 0);
break;
}
}
virtual void weightUpdate(TensorBuf *inp, TensorBuf *deloutp, TensorBuf *delweightp, TensorBuf *delbiasp)
{
switch(engine)
{
case XSMM:
weightUpdate(inp, deloutp, delweightp, delbiasp, 0);
break;
}
}
};
| 32.098039
| 139
| 0.587355
|
abhisek-kundu
|
a4112ccdd7b540b87efcad658abfece69fc896ef
| 8,746
|
cpp
|
C++
|
avs/vis_avs/r_multiplier.cpp
|
semiessessi/vis_avs
|
e99a3803e9de9032e0e6759963b2c2798f3443ef
|
[
"BSD-3-Clause"
] | 18
|
2020-07-30T11:55:23.000Z
|
2022-02-25T02:39:15.000Z
|
avs/vis_avs/r_multiplier.cpp
|
semiessessi/vis_avs
|
e99a3803e9de9032e0e6759963b2c2798f3443ef
|
[
"BSD-3-Clause"
] | 34
|
2021-01-13T02:02:12.000Z
|
2022-03-23T12:09:55.000Z
|
avs/vis_avs/r_multiplier.cpp
|
semiessessi/vis_avs
|
e99a3803e9de9032e0e6759963b2c2798f3443ef
|
[
"BSD-3-Clause"
] | 3
|
2021-03-18T12:53:58.000Z
|
2021-10-02T20:24:41.000Z
|
/*
LICENSE
-------
Copyright 2005 Nullsoft, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Nullsoft nor the names of its contributors may be used to
endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "c_multiplier.h"
#include "r_defs.h"
#ifndef LASER
// set up default configuration
C_THISCLASS::C_THISCLASS()
{
memset(&config, 0, sizeof(apeconfig));
config.ml = MD_X2;
}
// virtual destructor
C_THISCLASS::~C_THISCLASS()
{
}
int C_THISCLASS::render(char[2][2][576], int isBeat, int *framebuffer, int*, int w, int h)
{
if (isBeat&0x80000000) return 0;
int /*b,*/c; // TODO [cleanup]: see below
__int64 mask;
c = w*h;
switch (config.ml) {
case MD_XI:
#ifdef _MSC_VER
__asm {
mov ebx, framebuffer;
mov ecx, c;
// mov edx, b; // doesn't do anything. a leftover?
lp0:
xor eax, eax;
dec ecx;
test ecx, ecx;
jz end;
mov eax, dword ptr [ebx+ecx*4];
test eax, eax;
jz sk0;
mov eax, 0xFFFFFF;
sk0:
mov [ebx+ecx*4], eax;
jmp lp0;
}
#else // _MSC_VER
__asm__ goto (
"mov %%ebx, %0\n\t"
"mov %%ecx, %1\n"
"lp0:\n\t"
"xor %%eax, %%eax\n\t"
"dec %%ecx\n\t"
"test %%ecx, %%ecx\n\t"
"jz %l[end]\n\t"
"mov %%eax, dword ptr [%%ebx + %%ecx * 4]\n\t"
"test %%eax, %%eax\n\t"
"jz sk0\n\t"
"mov %%eax, 0xFFFFFF\n"
"sk0:\n\t"
"mov [%%ebx + %%ecx * 4], %%eax\n\t"
"jmp lp0\n\t"
:/* no outputs */
:"m"(framebuffer), "m"(c)
:"eax", "ebx", "ecx"
:end
);
#endif
break;
case MD_XS:
#ifdef _MSC_VER
__asm {
mov ebx, framebuffer;
mov ecx, c;
// mov edx, b; // doesn't do anything. a leftover?
lp9:
xor eax, eax;
dec ecx;
test ecx, ecx;
jz end;
mov eax, dword ptr [ebx+ecx*4];
cmp eax, 0xFFFFFF;
je sk9; // TODO [bugfix]: this could be jae, to account for garbage in MSByte
// TODO [performance]: the next _3_ lines could be compressed into just
// mov [ebx+ecx*4], 0x000000
// sk9:
// since the white pixel (= 0xFFFFFF) doesn't need to be rewritten
mov eax, 0x000000;
sk9:
mov [ebx+ecx*4], eax;
jmp lp9;
}
#else // _MSC_VER
__asm__ goto (
"mov %%ebx, %0\n\t"
"mov %%ecx, %1\n"
"lp9:\n\t"
"xor %%eax, %%eax\n\t"
"dec %%ecx\n\t"
"test %%ecx, %%ecx\n\t"
"jz %l[end]\n\t"
"mov %%eax, dword ptr [%%ebx + %%ecx * 4]\n\t"
"cmp %%eax, 0xFFFFFF\n\t"
"je sk9\n\t"
"mov %%eax, 0x000000\n"
"sk9:\n\t"
"mov [%%ebx + %%ecx * 4], %%eax\n\t"
"jmp lp9\n\t"
:/* no outputs */
:"m"(framebuffer), "m"(c)
:"eax", "ebx", "ecx"
:end
);
#endif
break;
case MD_X8:
c = w*h/2;
#ifdef _MSC_VER
__asm {
mov ebx, framebuffer;
mov ecx, c;
lp1:
movq mm0, [ebx];
paddusb mm0, mm0;
paddusb mm0, mm0;
paddusb mm0, mm0;
movq [ebx], mm0;
add ebx, 8;
dec ecx;
test ecx, ecx;
jz end;
jmp lp1;
}
#else // _MSC_VER
__asm__ goto (
"mov %%ebx, %0\n\t"
"mov %%ecx, %1\n"
"lp1:\n\t"
"movq %%mm0, [%%ebx]\n\t"
"paddusb %%mm0, %%mm0\n\t"
"paddusb %%mm0, %%mm0\n\t"
"paddusb %%mm0, %%mm0\n\t"
"movq [%%ebx], %%mm0\n\t"
"add %%ebx, 8\n\t"
"dec %%ecx\n\t"
"test %%ecx, %%ecx\n\t"
"jz %l[end]\n\t"
"jmp lp1\n\t"
:/* no outputs */
:"m"(framebuffer), "m"(c)
:"ebx", "ecx"
:end
);
#endif
break;
case MD_X4:
c = w*h/2;
#ifdef _MSC_VER
__asm {
mov ebx, framebuffer;
mov ecx, c;
lp2:
movq mm0, [ebx];
paddusb mm0, mm0;
paddusb mm0, mm0;
movq [ebx], mm0;
add ebx, 8;
dec ecx;
test ecx, ecx;
jz end;
jmp lp2;
}
#else // _MSC_VER
__asm__ goto (
"mov %%ebx, %0\n\t"
"mov %%ecx, %1\n"
"lp2:\n\t"
"movq %%mm0, [%%ebx]\n\t"
"paddusb %%mm0, %%mm0\n\t"
"paddusb %%mm0, %%mm0\n\t"
"movq [%%ebx], %%mm0\n\t"
"add %%ebx, 8\n\t"
"dec %%ecx\n\t"
"test %%ecx, %%ecx\n\t"
"jz %l[end]\n\t"
"jmp lp2\n\t"
:/* no outputs */
:"m"(framebuffer), "m"(c)
:"ebx", "ecx"
:end
);
#endif
break;
case MD_X2:
c = w*h/2;
#ifdef _MSC_VER
__asm {
mov ebx, framebuffer;
mov ecx, c;
lp3:
movq mm0, [ebx];
paddusb mm0, mm0;
movq [ebx], mm0;
add ebx, 8;
dec ecx;
test ecx, ecx;
jz end;
jmp lp3;
}
#else // _MSC_VER
__asm__ goto (
"mov %%ebx, %0\n\t"
"mov %%ecx, %1\n"
"lp3:\n\t"
"movq %%mm0, [%%ebx]\n\t"
"paddusb %%mm0, %%mm0\n\t"
"movq [%%ebx], %%mm0\n\t"
"add %%ebx, 8\n\t"
"dec %%ecx\n\t"
"test %%ecx, %%ecx\n\t"
"jz %l[end]\n\t"
"jmp lp3\n\t"
:/* no outputs */
:"m"(framebuffer), "m"(c)
:"ebx", "ecx"
:end
);
#endif
break;
case MD_X05:
c = w*h/2;
mask = 0x7F7F7F7F7F7F7F7F;
#ifdef _MSC_VER
__asm {
mov ebx, framebuffer;
mov ecx, c;
movq mm1, mask;
lp4:
movq mm0, [ebx];
psrlq mm0, 1;
pand mm0, mm1;
movq [ebx], mm0;
add ebx, 8;
dec ecx;
test ecx, ecx;
jz end;
jmp lp4;
}
#else // _MSC_VER
__asm__ goto (
"mov %%ebx, %0\n\t"
"mov %%ecx, %1\n\t"
"movq %%mm1, %2\n"
"lp4:\n\t"
"movq %%mm0, [%%ebx]\n\t"
"psrlq %%mm0, 1\n\t"
"pand %%mm0, %%mm1\n\t"
"movq [%%ebx], %%mm0\n\t"
"add %%ebx, 8\n\t"
"dec %%ecx\n\t"
"test %%ecx, %%ecx\n\t"
"jz %l[end]\n\t"
"jmp lp4\n\t"
:/* no outputs */
:"m"(framebuffer), "m"(c), "m"(mask)
:"ebx", "ecx"
:end
);
#endif
break;
case MD_X025:
c = w*h/2;
mask = 0x3F3F3F3F3F3F3F3F;
#ifdef _MSC_VER
__asm {
mov ebx, framebuffer;
mov ecx, c;
movq mm1, mask;
lp5:
movq mm0, [ebx];
psrlq mm0, 2;
pand mm0, mm1;
movq [ebx], mm0;
add ebx, 8;
dec ecx;
test ecx, ecx;
jz end;
jmp lp5;
}
#else // _MSC_VER
__asm__ goto (
"mov %%ebx, %0\n\t"
"mov %%ecx, %1\n\t"
"movq %%mm1, %2\n"
"lp5:\n\t"
"movq %%mm0, [%%ebx]\n\t"
"psrlq %%mm0, 2\n\t"
"pand %%mm0, %%mm1\n\t"
"movq [%%ebx], %%mm0\n\t"
"add %%ebx, 8\n\t"
"dec %%ecx\n\t"
"test %%ecx, %%ecx\n\t"
"jz %l[end]\n\t"
"jmp lp5\n\t"
:/* no outputs */
:"m"(framebuffer), "m"(c), "m"(mask)
:"ebx", "ecx"
:end
);
#endif
break;
case MD_X0125:
c = w*h/2;
mask = 0x1F1F1F1F1F1F1F1F;
#ifdef _MSC_VER
__asm {
mov ebx, framebuffer;
mov ecx, c;
movq mm1, mask;
lp6:
movq mm0, [ebx];
psrlq mm0, 3;
pand mm0, mm1;
movq [ebx], mm0;
add ebx, 8;
dec ecx;
test ecx, ecx;
jz end;
jmp lp6;
}
#else // _MSC_VER
__asm__ goto (
"mov %%ebx, %0\n\t"
"mov %%ecx, %1\n\t"
"movq %%mm1, %2\n"
"lp6:\n\t"
"movq %%mm0, [%%ebx]\n\t"
"psrlq %%mm0, 3\n\t"
"pand %%mm0, %%mm1\n\t"
"movq [%%ebx], %%mm0\n\t"
"add %%ebx, 8\n\t"
"dec %%ecx\n\t"
"test %%ecx, %%ecx\n\t"
"jz %l[end]\n\t"
"jmp lp6\n\t"
:/* no outputs */
:"m"(framebuffer), "m"(c), "m"(mask)
:"ebx", "ecx"
:end
);
#endif
break;
}
end:
#ifdef _MSC_VER
__asm emms;
#else // _MSC_VER
__asm__ __volatile__ ("emms");
#endif
return 0;
}
char *C_THISCLASS::get_desc(void)
{
return MOD_NAME;
}
void C_THISCLASS::load_config(unsigned char *data, int len)
{
if (len == sizeof(apeconfig))
memcpy(&this->config, data, len);
else
memset(&this->config, 0, sizeof(apeconfig));
}
int C_THISCLASS::save_config(unsigned char *data)
{
memcpy(data, &this->config, sizeof(apeconfig));
return sizeof(apeconfig);
}
C_RBASE *R_Multiplier(char *desc)
{
if (desc) {
strcpy(desc,MOD_NAME);
return NULL;
}
return (C_RBASE *) new C_THISCLASS();
}
#endif
| 20.627358
| 102
| 0.570089
|
semiessessi
|
a4119f4812509d12b78f711dcc2f5ad1c2e82575
| 10,107
|
hh
|
C++
|
trex/utils/SharedVar.hh
|
miatauro/trex2-agent
|
d896f8335f3194237a8bba49949e86f5488feddb
|
[
"BSD-3-Clause"
] | null | null | null |
trex/utils/SharedVar.hh
|
miatauro/trex2-agent
|
d896f8335f3194237a8bba49949e86f5488feddb
|
[
"BSD-3-Clause"
] | null | null | null |
trex/utils/SharedVar.hh
|
miatauro/trex2-agent
|
d896f8335f3194237a8bba49949e86f5488feddb
|
[
"BSD-3-Clause"
] | null | null | null |
/* -*- C++ -*- */
/** @file "SharedVar.hh"
* @brief utilities for multi-thread shared variable
*
* This header declare classes and utilities to easily
* share a variable between multiple threads.
*
* @author Frederic Py <fpy@mbari.org>
* @ingroup utils
*/
/*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2011, MBARI.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of the TREX Project nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef H_SharedVar
# define H_SharedVar
# include <boost/call_traits.hpp>
# include <boost/utility.hpp>
# include <boost/thread/recursive_mutex.hpp>
# include "Exception.hh"
namespace TREX {
namespace utils {
/** @brief Bad access exception
* @relates SharedVar
*
* This exception is thrown by SharedVar when one tries
* to access a SharedVar it has not locked.
*
* @author Frederic Py <fpy@mbari.org>
*
* @note The management of this error is more a coding issue.
* It may be fine to be able to disable it when we are sure
* that this condition is respected. (?)
* @ingroup utils
*/
class AccessExcept
:public Exception {
public:
/** @brief Constructor.
*
* @param[in] message Error message.
*
* Create a new instance with associated message @p message
*/
AccessExcept(std::string const &message) throw()
:Exception(message) {}
/** @brief Destructor. */
~AccessExcept() throw() {}
}; // TREX::utils::AccessExcept
/** @brief multi-thread shared variable
*
* This class implements a simple utility to manage a variable
* which is manipulated by multiple threads. It ensures that this
* variable is accessed only by the thread which have
* reserved (locked) it.
*
* @tparam Ty Type of the variable to be shared
*
* @pre @p Ty must provides a copy constructor
* @pre @p Ty must be default constructible
*
* @author Frederic Py <fpy@mbari.org>
* @ingroup utils
*/
template<class Ty>
class SharedVar :boost::noncopyable {
private:
typedef boost::recursive_timed_mutex mutex_type;
public:
/** @brief Scoped variable locking type
*
* This type can be used to locally lock one SharedVar based
* in a C++ scope.
* A new instance of this class will lock the mutex associated
* to the SharedVar during its whiole lifetime and release the
* mutex on its destruction.
*
* This provide a simple, exception safe, way to lock a
* SharedVar during a critical section while avoiding to
* have it remains locked in the eventuality of an exception.
*
* For example on can implement the function @c getval(SharedVar const &)
* that returns the value of a SharedVar like this:
* @code
* template<class Ty>
* Ty getval(SharedVar<Ty> const &var) {
* SharedVar<Ty>::scoped_lock slock(var);
* return *var;
* }
* @endcode
* At the begining of this function the creation of @c slock locks
* the mutex associated to @c var. This alows to access to @c var
* on the next line. Finally, as we leave the function context @c slock
* will be destroyed and by doing so will release the mutex it locked during
* its creation.
*/
typedef boost::unique_lock< SharedVar<Ty> > scoped_lock;
/** @brief Constructor.
*
* @param[in] val An init value
*
* Create a new instance and set its value to @p val
*
* @post the newly created instance is not locked
*/
SharedVar(typename boost::call_traits<Ty>::param_type val=Ty())
:m_lockCount(0ul), m_var(val) {}
/** @brief Destructor */
~SharedVar() {}
/** @brief Locking method.
*
* This method locks the current variable.
*
* @note This call is blocking; If this inatnce is locked by
* another thread. The caller will be suspended until we can
* sucedsfully lock the varaible for this thread.
*
* @post The variable is locked by the current thread.
*
* @throw ErrnoExcept System error
*
* @sa unlock() const
*/
void lock() const {
m_mtx.lock();
++m_lockCount;
}
/** @brief Unlocking method.
*
* Unlock the mutex attached to this variable.
*
* @pre The variable is locked by current thread.
* @post The variable is not locked by this thread anymore.
*
* @throw AccessExcept Variable not locked by this thread.
* @throw ErrnoExcept System error.
*
* @sa lock() const
* @sa ownIt() const
*/
void unlock() const {
if( ownIt() ) {
--m_lockCount;
m_mtx.unlock();
}
}
/** @brief Assignment operator.
*
* @param[in] value A value
*
* This methods set current instance to @p value.
*
* @return @p value
*
* @note This call is thread safe and atomic. If current instance
* is not already locked by the calling thread, it will do so and
* unlock it on completion.
*
* @throw ErrnoExcept System error.
*/
typename boost::call_traits<Ty>::param_type
operator=(typename boost::call_traits<Ty>::param_type value) {
scoped_lock lock(*this);
m_var = value;
return value;
}
void swap(Ty &other) {
scoped_lock lock(*this);
std::swap(m_var, other);
}
/** @brief Check for thread ownership
*
* This methods indicates if current instance is locked by
* current thread.
* A thread can manipulate a SharedVariable if and only if
* this variable is locked by the thread. This method allows
* user to check such information.
*
* @retval true If this instance is locked by the calliung thread.
* @retval false otherwise
*
* @sa lock() const
* @sa unlock() const
*/
bool ownIt() const {
mutex_type::scoped_try_lock lock(m_mtx);
return lock.owns_lock() && m_lockCount>0;
}
/** @brief Dereferencing operator
*
* Give access to the shared variable
*
* @pre This instance is locked by current thread
*
* @return A reference to the variable
*
* @throw AccessExcept Variable is not locked by current thread.
* @throw ErrnoExcept System error
*
* @sa lock() const
* @sa ownIt() const
* @sa operator->()
* @{
*/
Ty &operator* () {
if( !ownIt() )
throw AccessExcept("Cannot access a shared var which I don't own.");
return m_var;
}
Ty const &operator* () const {
if( !ownIt() )
throw AccessExcept("Cannot access a shared var which I don't own.");
return m_var;
}
/** @} */
/** @brief Access operator.
*
* Give access to variable and more specifically to its attributes.
*
* @pre This instance is locked by current thread
*
* @return A pointer to the variable allowing access to its attributes
*
* @throw AccessExcept Variable is not owned by current thread.
* @throw ErrnoExcept System error.
*
* @sa lock() const
* @sa ownIt() const
* @sa operator* ()
* @{
*/
Ty *operator->() {
return &operator* ();
}
Ty const *operator->() const {
return &operator* ();
}
/** @} */
private:
/** @brief Mutex to lock/unlock variable */
mutable mutex_type m_mtx; //!< @brief System mutex for this variable
/** @brief mutex lock counter
*
* This attribute count the number of locks currently active on
* this instance. By design the counter will be modified only by
* the thread which is currently locking the variable.
*
* The variable is not locked by any thread as soon as this counter reaches 0.
*
* @sa lock() const
* @sa unlock() const
*/
mutable size_t m_lockCount;
/** @brief Variable value */
Ty m_var;
}; // TREX::utils::SharedVar<>
} // TREX::utils
} // TREX
#endif // H_SharedVar
| 32.498392
| 84
| 0.598793
|
miatauro
|
a414043fb3a5a0513723c8bb5f357577414d4000
| 1,279
|
cpp
|
C++
|
easy/nimble/main.cpp
|
exbibyte/hr
|
100514dfc2a1c9b5366c12ec0a75e889132a620e
|
[
"MIT"
] | null | null | null |
easy/nimble/main.cpp
|
exbibyte/hr
|
100514dfc2a1c9b5366c12ec0a75e889132a620e
|
[
"MIT"
] | null | null | null |
easy/nimble/main.cpp
|
exbibyte/hr
|
100514dfc2a1c9b5366c12ec0a75e889132a620e
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include <algorithm>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <map>
std::vector<std::pair<int,int>> moves(int x, int y ){
std::vector<std::pair<int,int>> v = { {x-2,y+1},{x-2,y-1},{x+1,y-2},{x-1,y-2} };
auto it_end = std::remove_if( v.begin(), v.end(),
[](auto a){ return a.first < 1 || a.first > 15 ||
a.second < 1 || a.second > 15; });
v.resize( std::distance(v.begin(),it_end) );
return v;
}
bool simulate(int x, int y, std::map<std::pair<int,int>,bool> & cache ){
auto m = moves(x,y);
if (m.empty()){
return false; //no moves left, current player loses
}
auto mem = cache.find({x,y});
if(mem!=cache.end()){
return mem->second;
}
bool current_player_win = false;
for(auto i: m){
bool result = !simulate(i.first,i.second, cache );
current_player_win |= result;
}
cache[{x,y}] = current_player_win;
return current_player_win;
}
int main(){
int q;
std::cin >> q;
std::map<std::pair<int,int>,bool> cache;
for(int i=0;i<q;++i){
int x,y;
std::cin >> x >> y;
bool ret = simulate(x,y,cache);
if(ret){ std::cout << "First" << std::endl; }
else{ std::cout << "Second" << std::endl; }
}
return 0;
}
| 21.677966
| 82
| 0.577795
|
exbibyte
|
a415d87375ae54df280b10cc84c3a54e0627b4db
| 64
|
hpp
|
C++
|
src/boost_mpl_aux__preprocessed_msvc60_greater_equal.hpp
|
miathedev/BoostForArduino
|
919621dcd0c157094bed4df752b583ba6ea6409e
|
[
"BSL-1.0"
] | 10
|
2018-03-17T00:58:42.000Z
|
2021-07-06T02:48:49.000Z
|
src/boost_mpl_aux__preprocessed_msvc60_greater_equal.hpp
|
miathedev/BoostForArduino
|
919621dcd0c157094bed4df752b583ba6ea6409e
|
[
"BSL-1.0"
] | 2
|
2021-03-26T15:17:35.000Z
|
2021-05-20T23:55:08.000Z
|
src/boost_mpl_aux__preprocessed_msvc60_greater_equal.hpp
|
miathedev/BoostForArduino
|
919621dcd0c157094bed4df752b583ba6ea6409e
|
[
"BSL-1.0"
] | 4
|
2019-05-28T21:06:37.000Z
|
2021-07-06T03:06:52.000Z
|
#include <boost/mpl/aux_/preprocessed/msvc60/greater_equal.hpp>
| 32
| 63
| 0.828125
|
miathedev
|
a417330acf645dc86bbc4a6be5d8b97a9a2b8612
| 2,132
|
cpp
|
C++
|
JsonParsing/Source/JsonParsing/JsonParser.cpp
|
devilmhzx/UE4-Cpp-Tutorials
|
2cbf9d44dd4fa1c4eb68530f692065fc2c36b55d
|
[
"MIT"
] | 531
|
2016-10-19T14:04:55.000Z
|
2022-03-28T06:34:25.000Z
|
JsonParsing/Source/JsonParsing/JsonParser.cpp
|
devilmhzx/UE4-Cpp-Tutorials
|
2cbf9d44dd4fa1c4eb68530f692065fc2c36b55d
|
[
"MIT"
] | null | null | null |
JsonParsing/Source/JsonParsing/JsonParser.cpp
|
devilmhzx/UE4-Cpp-Tutorials
|
2cbf9d44dd4fa1c4eb68530f692065fc2c36b55d
|
[
"MIT"
] | 172
|
2016-10-18T14:53:11.000Z
|
2022-03-22T10:39:44.000Z
|
// Fill out your copyright notice in the Description page of Project Settings.
#include "JsonParser.h"
#include "JsonUtilities.h"
// Sets default values
AJsonParser::AJsonParser()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
}
// Called when the game starts or when spawned
void AJsonParser::BeginPlay()
{
Super::BeginPlay();
const FString JsonFilePath = FPaths::ProjectContentDir() + "/JsonFiles/randomgenerated.json";
FString JsonString; //Json converted to FString
FFileHelper::LoadFileToString(JsonString,*JsonFilePath);
//Displaying the json in a string format inside the output log
GLog->Log("Json String:");
GLog->Log(JsonString);
//Create a json object to store the information from the json string
//The json reader is used to deserialize the json object later on
TSharedPtr<FJsonObject> JsonObject = MakeShareable(new FJsonObject());
TSharedRef<TJsonReader<>> JsonReader = TJsonReaderFactory<>::Create(JsonString);
if (FJsonSerializer::Deserialize(JsonReader, JsonObject) && JsonObject.IsValid())
{
//The person "object" that is retrieved from the given json file
TSharedPtr<FJsonObject> PersonObject = JsonObject->GetObjectField("Person");
//Getting various properties
GLog->Log("Balance:" + PersonObject->GetStringField("balance"));
GLog->Log("Age:" + FString::FromInt(PersonObject->GetIntegerField("age")));
FString IsActiveStr = (PersonObject->GetBoolField("isActive")) ? "Active" : "Inactive";
GLog->Log("IsActive:" + IsActiveStr);
GLog->Log("Latitude:" + FString::SanitizeFloat(PersonObject->GetNumberField("latitude")));
//Retrieving an array property and printing each field
TArray<TSharedPtr<FJsonValue>> objArray=PersonObject->GetArrayField("family");
GLog->Log("printing family names...");
for(int32 index=0;index<objArray.Num();index++)
{
GLog->Log("name:"+objArray[index]->AsString());
}
}
else
{
GLog->Log("couldn't deserialize");
}
}
// Called every frame
void AJsonParser::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
| 31.352941
| 115
| 0.735929
|
devilmhzx
|
a417cc08b00e9e4d6b81a70df83aba4b4b8c5b1d
| 306
|
hpp
|
C++
|
tests/bitset/bitset_mini.hpp
|
olegpublicprofile/stdfwd
|
19671bcc8e53bd4c008f07656eaf25a22495e093
|
[
"MIT"
] | 11
|
2021-03-15T07:06:21.000Z
|
2021-09-27T13:54:25.000Z
|
tests/bitset/bitset_mini.hpp
|
olegpublicprofile/stdfwd
|
19671bcc8e53bd4c008f07656eaf25a22495e093
|
[
"MIT"
] | null | null | null |
tests/bitset/bitset_mini.hpp
|
olegpublicprofile/stdfwd
|
19671bcc8e53bd4c008f07656eaf25a22495e093
|
[
"MIT"
] | 1
|
2021-06-24T10:46:46.000Z
|
2021-06-24T10:46:46.000Z
|
#pragma once
//------------------------------------------------------------------------------
namespace bitset_tests {
//------------------------------------------------------------------------------
void run_mini();
//------------------------------------------------------------------------------
}
| 21.857143
| 80
| 0.140523
|
olegpublicprofile
|
a429b28c9c8bcd72bcf2f4fe31d909beb30482f5
| 2,517
|
cpp
|
C++
|
libnd4j/include/ops/declarable/helpers/impl/where.cpp
|
phong-phuong/deeplearning4j
|
d21e8839578d328f46f4b5ca38307a78528c34f5
|
[
"Apache-2.0"
] | null | null | null |
libnd4j/include/ops/declarable/helpers/impl/where.cpp
|
phong-phuong/deeplearning4j
|
d21e8839578d328f46f4b5ca38307a78528c34f5
|
[
"Apache-2.0"
] | null | null | null |
libnd4j/include/ops/declarable/helpers/impl/where.cpp
|
phong-phuong/deeplearning4j
|
d21e8839578d328f46f4b5ca38307a78528c34f5
|
[
"Apache-2.0"
] | null | null | null |
/* ******************************************************************************
*
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
//
// Created by raver119 on 24/09/18.
//
#include <ops/declarable/helpers/where.h>
#include <array/NDArrayList.h>
namespace sd {
namespace ops {
namespace helpers {
template <typename T>
static void __where(NDArray &condition, NDArray& output, memory::Workspace *workspace) {
NDArrayList list(0, true);
int cnt = 0;
int idx[MAX_RANK];
for (Nd4jLong e = 0; e < condition.lengthOf(); e++) {
shape::index2coordsCPU(0, e, condition.shapeInfo(), idx);
auto offset = shape::getOffset(condition.shapeInfo(), idx);
if (condition.e<bool>(offset)) {
auto array = NDArrayFactory::create_('c', {1, condition.rankOf()}, output.dataType(), output.getContext());
for (int f = 0; f < condition.rankOf(); f++)
array->p(f, (T) idx[f]);
list.write(cnt++, array);
}
}
auto s = list.stack();
output.assign(s);
delete s;
}
BUILD_SINGLE_TEMPLATE(template ND4J_LOCAL void __where,(NDArray &condition, NDArray& output, memory::Workspace *workspace), LIBND4J_TYPES);
ND4J_LOCAL void _where(sd::LaunchContext * context, NDArray &condition, NDArray& output, memory::Workspace *workspace) {
condition.syncToHost();
BUILD_SINGLE_SELECTOR(output.dataType(), __where, (condition, output, workspace), LIBND4J_TYPES);
output.syncToDevice();
}
}
}
}
| 38.723077
| 151
| 0.556218
|
phong-phuong
|
a431cf3bc2de93a61f30ca7162436681d69c84f8
| 416
|
cpp
|
C++
|
src/pieces/Piece.cpp
|
patryk-kacperski/chess-engine
|
d636bf3cab9f5d8b72523ce8f2be493b6666c660
|
[
"MIT"
] | null | null | null |
src/pieces/Piece.cpp
|
patryk-kacperski/chess-engine
|
d636bf3cab9f5d8b72523ce8f2be493b6666c660
|
[
"MIT"
] | null | null | null |
src/pieces/Piece.cpp
|
patryk-kacperski/chess-engine
|
d636bf3cab9f5d8b72523ce8f2be493b6666c660
|
[
"MIT"
] | 1
|
2019-04-05T20:26:27.000Z
|
2019-04-05T20:26:27.000Z
|
//
// Created by Patryk Kacperski on 09/07/2018.
//
#include "Piece.h"
namespace pkchessengine {
MoveResult Piece::validate(Move move) {
return MoveResult::kValid;
}
Piece::Piece(Side side, PieceType type)
{ }
Side Piece::getSide() {
return info.side;
}
PieceType Piece::getType() {
return info.type;
}
void Piece::promote(PieceType type) {
}
}
| 15.407407
| 45
| 0.59375
|
patryk-kacperski
|
bf9a838e65ef8b5bb31cf4d8b4342cc210a88ab3
| 914
|
cc
|
C++
|
plugins/meta-protobuf-v4/test/io.cc
|
TeravoxelTwoPhotonTomography/tilebase
|
61f2e6b979d214afab8dd60d6f55afc3e4697e24
|
[
"BSD-3-Clause"
] | null | null | null |
plugins/meta-protobuf-v4/test/io.cc
|
TeravoxelTwoPhotonTomography/tilebase
|
61f2e6b979d214afab8dd60d6f55afc3e4697e24
|
[
"BSD-3-Clause"
] | null | null | null |
plugins/meta-protobuf-v4/test/io.cc
|
TeravoxelTwoPhotonTomography/tilebase
|
61f2e6b979d214afab8dd60d6f55afc3e4697e24
|
[
"BSD-3-Clause"
] | null | null | null |
// solves a std::tuple problem in vs2012
#define GTEST_HAS_TR1_TUPLE 0
#define GTEST_USE_OWN_TR1_TUPLE 1
#include <gtest/gtest.h>
#include "tilebase.h"
#include "plugins/meta-protobuf-v4/config.h"
struct FetchProtobufV4: public testing::Test
{
void SetUp()
{ ndioAddPluginPath(ND_ROOT_DIR"/bin/plugins");
}
};
TEST_F(FetchProtobufV4,NonExistent)
{ tiles_t tiles;
EXPECT_EQ((void*)NULL,tiles=TileBaseOpen("totally.not.here",NULL));
EXPECT_EQ(0,TileBaseCount(tiles));
TileBaseClose(tiles);
}
TEST_F(FetchProtobufV4,AutoDetect)
{ tiles_t tiles;
EXPECT_NE((void*)NULL,tiles=TileBaseOpen(PBUFV4_TEST_DATA_PATH "/02020",""));
EXPECT_EQ(1,TileBaseCount(tiles));
TileBaseClose(tiles);
}
TEST_F(FetchProtobufV4,ByName)
{ tiles_t tiles;
EXPECT_NE((void*)NULL,tiles=TileBaseOpen(PBUFV4_TEST_DATA_PATH "/02020","fetch.protobuf.v4"));
EXPECT_EQ(1,TileBaseCount(tiles));
TileBaseClose(tiles);
}
| 25.388889
| 96
| 0.756018
|
TeravoxelTwoPhotonTomography
|
bf9aca021d9566d860a6dbad176073dd0ae0a500
| 8,213
|
hpp
|
C++
|
__drivers/gv_renderer_d3d9/gv_render_target_mgr_d3d.hpp
|
dragonsn/gv_game_engine
|
dca6c1fb1f8d96e9a244f157a63f8a69da084b0f
|
[
"MIT"
] | 2
|
2018-12-03T13:17:31.000Z
|
2020-04-08T07:00:02.000Z
|
__drivers/gv_renderer_d3d9/gv_render_target_mgr_d3d.hpp
|
dragonsn/gv_game_engine
|
dca6c1fb1f8d96e9a244f157a63f8a69da084b0f
|
[
"MIT"
] | null | null | null |
__drivers/gv_renderer_d3d9/gv_render_target_mgr_d3d.hpp
|
dragonsn/gv_game_engine
|
dca6c1fb1f8d96e9a244f157a63f8a69da084b0f
|
[
"MIT"
] | null | null | null |
namespace gv
{
struct gv_renderable_tex_d3d_info
{
gv_renderable_tex_d3d_info()
{
}
gv_renderable_tex_d3d_info(const gv_renderable_tex_d3d_info& info)
{
(*this) = info;
}
~gv_renderable_tex_d3d_info()
{
}
gv_renderable_tex_d3d_info&
operator=(const gv_renderable_tex_d3d_info& info)
{
texture = info.texture;
format = info.format;
clear = info.clear;
clear_color = info.clear_color;
size = info.size;
id = info.id;
return *this;
}
bool operator==(const gv_renderable_tex_d3d_info& info)
{
if (clear && info.clear)
{
return /*size==info.size && format==info.format &&*/ id == info.id;
}
return false;
}
gvt_ref_ptr< gv_texture > texture;
D3DFORMAT format;
gv_bool clear;
gv_color clear_color;
gv_vector2i size;
gv_id id;
};
class gv_render_target_mgr_d3d_imp : public gv_refable
{
public:
gv_render_target_mgr_d3d_imp()
{
m_is_locked = false;
};
~gv_render_target_mgr_d3d_imp()
{
}
void set_viewport(IDirect3DSurface9* surf)
{
D3DSURFACE_DESC desc;
surf->GetDesc(&desc);
D3DVIEWPORT9 port;
port.X = 0;
port.Y = 0;
port.Width = (DWORD)desc.Width;
port.Height = (DWORD)desc.Height;
port.MinZ = 0;
port.MaxZ = 1;
get_device_d3d9()->SetViewport(&port);
}
gv_texture* create_texture(const gv_id& id, gv_uint usage, gv_vector2i size,
gv_uint format, gv_bool clear)
{
gv_renderable_tex_d3d_info info;
info.clear = clear;
info.format = (D3DFORMAT)format;
info.size = size;
info.id = id;
gv_int idx = 0;
if (m_render_targets.find(info, idx))
{
return m_render_targets[idx].texture;
}
gv_texture_d3d* ptex = get_renderer_d3d9()
->get_sandbox()
->create_nameless_object< gv_texture_d3d >();
IDirect3DTexture9* ptex9;
GVM_VERIFY_D3D(get_device_d3d9()->CreateTexture(
size.get_x(), size.get_y(), 1, usage, (D3DFORMAT)format,
D3DPOOL_DEFAULT, &ptex9, 0));
ptex->set_texture_d3d(ptex9);
gv_texture* pt = get_renderer_d3d9()
->get_sandbox()
->create_nameless_object< gv_texture >();
pt->set_hardware_cache(ptex);
info.texture = pt;
m_render_targets.push_back(info);
GVM_DEBUG_LOG(render, "create render target: " << id << " size :" << size
<< " format " << format
<< gv_endl);
return pt;
}
gvt_array< gv_renderable_tex_d3d_info > m_render_targets;
IDirect3DSurface9* m_default_color_buffer;
IDirect3DSurface9* m_default_depth_buffer;
IDirect3DSurface9* m_current_color_buffer;
IDirect3DSurface9* m_current_depth_buffer;
gv_vector2i m_default_color_buffer_size;
gv_vector2i m_default_depth_buffer_size;
gv_bool m_is_locked;
};
//============================================================================================
// :
//============================================================================================
gv_render_target_mgr_d3d::gv_render_target_mgr_d3d()
{
m_impl = new gv_render_target_mgr_d3d_imp;
};
gv_render_target_mgr_d3d::~gv_render_target_mgr_d3d(){
};
void gv_render_target_mgr_d3d::on_init()
{
on_device_reset();
};
void gv_render_target_mgr_d3d::on_destroy(){
};
void gv_render_target_mgr_d3d::on_device_lost(){
};
void gv_render_target_mgr_d3d::on_device_reset()
{
get_device_d3d9()->GetRenderTarget(0, &m_impl->m_default_color_buffer);
get_device_d3d9()->GetDepthStencilSurface(&m_impl->m_default_depth_buffer);
m_impl->m_current_color_buffer = m_impl->m_default_color_buffer;
m_impl->m_current_depth_buffer = m_impl->m_default_depth_buffer;
D3DSURFACE_DESC desc;
m_impl->m_default_color_buffer->GetDesc(&desc);
m_impl->m_default_color_buffer_size.set(desc.Width, desc.Height);
m_impl->m_default_depth_buffer->GetDesc(&desc);
m_impl->m_default_depth_buffer_size.set(desc.Width, desc.Height);
};
gv_vector2i gv_render_target_mgr_d3d::get_default_color_buffer_size()
{
return m_impl->m_default_color_buffer_size;
};
gv_vector2i gv_render_target_mgr_d3d::get_default_depth_buffer_size()
{
return m_impl->m_default_depth_buffer_size;
};
gv_texture* gv_render_target_mgr_d3d::create_color_texture(
const gv_id& id, gv_vector2i size, gve_pixel_format format, gv_bool clear)
{
return m_impl->create_texture(id, D3DUSAGE_RENDERTARGET, size,
gv_to_d3d_format(format), clear);
};
gv_texture* gv_render_target_mgr_d3d::create_depth_texture(
const gv_id& id, gv_vector2i size, gve_pixel_format format, gv_bool clear)
{
return m_impl->create_texture(id, D3DUSAGE_DEPTHSTENCIL, size,
gv_to_d3d_format(format), clear);
};
void gv_render_target_mgr_d3d::begin_render_target(gv_texture* color_texture,
gv_texture* depth_texture,
bool clear,
gv_color clear_color)
{
if (m_impl->m_is_locked)
return;
// [9/1/2011 Administrator]
#pragma GV_REMINDER( \
"when use PIX must return in this function , ... must be PIX bug!!!")
// return;
GV_PROFILE_EVENT_PIX(set_render_target, 0)
IDirect3DSurface9* color_surface = m_impl->m_default_color_buffer;
IDirect3DSurface9* depth_surface = NULL;
m_impl->m_current_depth_buffer;
;
for (int stage = 0; stage < DX9_MAX_TEXTURE; ++stage)
{
get_device_d3d9()->SetTexture(stage, NULL);
}
if (color_texture)
color_surface =
color_texture->get_hardware_cache< gv_texture_d3d >()->get_surface_d3d();
if (depth_texture)
depth_surface =
depth_texture->get_hardware_cache< gv_texture_d3d >()->get_surface_d3d();
if (color_surface == m_impl->m_current_color_buffer &&
depth_surface == m_impl->m_current_depth_buffer)
{
return;
}
get_device_d3d9()->SetRenderTarget(0, color_surface);
if (depth_surface)
{
get_device_d3d9()->SetDepthStencilSurface(depth_surface);
}
else
{
get_device_d3d9()->SetDepthStencilSurface(NULL);
}
if (clear)
{
gv_uint clear_flag = D3DCLEAR_TARGET;
if (depth_texture)
clear_flag |= D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL;
get_device_d3d9()->Clear(0, NULL, clear_flag, clear_color.BGRA().fixed32,
1.0f, 0);
}
m_impl->set_viewport(color_surface);
m_impl->m_current_color_buffer = color_surface;
m_impl->m_current_depth_buffer = depth_surface;
};
void gv_render_target_mgr_d3d::set_default_render_target()
{
if (m_impl->m_is_locked)
return;
if (m_impl->m_current_color_buffer == m_impl->m_default_color_buffer &&
m_impl->m_current_depth_buffer == m_impl->m_default_depth_buffer)
{
return;
}
{
GV_PROFILE_EVENT_PIX(set_default_render_target, 0)
get_device_d3d9()->SetRenderTarget(0, m_impl->m_default_color_buffer);
get_device_d3d9()->SetDepthStencilSurface(m_impl->m_default_depth_buffer);
m_impl->set_viewport(m_impl->m_default_color_buffer);
m_impl->m_current_color_buffer = m_impl->m_default_color_buffer;
m_impl->m_current_depth_buffer = m_impl->m_default_depth_buffer;
}
};
void gv_render_target_mgr_d3d::end_render_target(){
};
void gv_render_target_mgr_d3d::resolve_backbuffer(gv_texture* tex)
{
IDirect3DSurface9 *pBackBuffer, *pDestBuffer;
get_device_d3d9()->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer);
pDestBuffer = tex->get_hardware_cache< gv_texture_d3d >()->get_surface_d3d();
RECT rect;
D3DSURFACE_DESC desc;
pDestBuffer->GetDesc(&desc);
rect.left = rect.top = 0;
rect.right = desc.Width;
rect.bottom = desc.Height;
GVM_VERIFY_D3D(get_device_d3d9()->StretchRect(pBackBuffer, &rect, pDestBuffer,
NULL, D3DTEXF_NONE));
// pBackBuffer->Release();
// pDestBuffer->Release();
};
void gv_render_target_mgr_d3d::precache(gv_effect_renderable_texture* texture)
{
if (texture->m_texture)
return;
// if (texture->m_name =="g_color_buffer" ) return;
// if (texture->m_name =="g_depth_buffer" ) return;
// if (texture->m_name =="g_shadow_map" ) return;
gv_vector2i size = texture->m_size;
if (texture->m_use_window_size)
{
size = get_renderer_d3d9()->get_screen_size();
size.x = (int)(size.x * texture->m_width_ratio);
size.y = (int)(size.y * texture->m_height_ratio);
if (size.get_x() * size.get_y() < 1)
{
size = get_renderer_d3d9()->get_screen_size();
}
}
texture->m_texture = m_impl->create_texture(
texture->m_name, D3DUSAGE_RENDERTARGET, size, texture->m_format, true);
};
void gv_render_target_mgr_d3d::lock_render_target(gv_bool lock)
{
m_impl->m_is_locked = lock;
}
}
| 28.32069
| 94
| 0.725435
|
dragonsn
|
bf9bed6c3562413a9f578e2ce8d0efd59540ca5b
| 1,132
|
cpp
|
C++
|
CHEFPRMS.cpp
|
Khush-Ramdev/codechef-solution
|
ecf57442efde8fbb03b55efdf761d7b1e0d04e80
|
[
"MIT"
] | 5
|
2018-10-04T09:49:19.000Z
|
2019-06-12T05:32:24.000Z
|
CHEFPRMS.cpp
|
Khush-Ramdev/codechef-solution
|
ecf57442efde8fbb03b55efdf761d7b1e0d04e80
|
[
"MIT"
] | 5
|
2018-10-04T09:54:55.000Z
|
2020-10-15T20:31:46.000Z
|
CHEFPRMS.cpp
|
Khush-Ramdev/codechef-solution
|
ecf57442efde8fbb03b55efdf761d7b1e0d04e80
|
[
"MIT"
] | 38
|
2018-10-04T09:48:17.000Z
|
2020-12-10T08:52:47.000Z
|
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool prime[202];
void isprime(ll n)
{ memset(prime,true,sizeof(prime));
prime[0]=false;
prime[1]=false;
for(ll i=2;i*i<=n;i++)
{
if(prime[i]==true)
{
for(ll p=i*2;p<=n;p+=i)
prime[p]=false;
}
}
}
bool primefactor(ll j)
{ll flag1=0,i;
for( i=1;i*i<=j;i++)
{
if((j%i==0)&&((j/i)!=i))
{
if(prime[i]&&prime[(j/i)])
{
flag1=1;
break;
}
}
}
if(flag1==1)
{
return true;
}
else
return false;
}
int main()
{ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll t;
cin>>t;
isprime(201);
while(t--)
{
ll n,j;
cin>>n;
ll flag=0;
for(j=2;j<=n/2;j++)
{
if(primefactor(j)&&primefactor(n-j))
{
flag=1;
}
}
if(flag==1)
cout<<"YES\n";
else
cout<<"NO"<<endl;
}
return 0;
}
| 14.512821
| 48
| 0.382509
|
Khush-Ramdev
|
bf9f980348503b6b26163a33c586bcbcd399f62e
| 652
|
hpp
|
C++
|
irohad/main/iroha_status.hpp
|
Insafin/iroha
|
5e3c3252b2a62fa887274bdf25547dc264c10c26
|
[
"Apache-2.0"
] | null | null | null |
irohad/main/iroha_status.hpp
|
Insafin/iroha
|
5e3c3252b2a62fa887274bdf25547dc264c10c26
|
[
"Apache-2.0"
] | null | null | null |
irohad/main/iroha_status.hpp
|
Insafin/iroha
|
5e3c3252b2a62fa887274bdf25547dc264c10c26
|
[
"Apache-2.0"
] | 1
|
2022-03-11T10:28:21.000Z
|
2022-03-11T10:28:21.000Z
|
/**
* Copyright Soramitsu Co., Ltd. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef IROHA_STATUS_HPP
#define IROHA_STATUS_HPP
#include <rapidjson/stringbuffer.h>
#include <cstdint>
#include <optional>
#include <string>
#include "consensus/round.hpp"
namespace iroha {
struct IrohaStatus {
std::optional<uint64_t> memory_consumption;
std::optional<consensus::Round> last_round;
std::optional<bool> is_syncing;
std::optional<bool> is_healthy;
};
struct IrohaStoredStatus {
IrohaStatus status;
rapidjson::StringBuffer serialized_status;
};
} // namespace iroha
#endif // IROHA_STATUS_HPP
| 19.757576
| 53
| 0.726994
|
Insafin
|
bfa04fb4013ddfe07f30f237c48d1cdd8a59cea7
| 1,508
|
hpp
|
C++
|
src/LibCraft/coreEngine/include/HP.hpp
|
leodlplq/IMACraft
|
5fec1729238e7e428bd39543dfd1fad521e16047
|
[
"MIT"
] | 1
|
2021-11-24T16:49:48.000Z
|
2021-11-24T16:49:48.000Z
|
src/LibCraft/coreEngine/include/HP.hpp
|
leodlplq/IMACraft
|
5fec1729238e7e428bd39543dfd1fad521e16047
|
[
"MIT"
] | null | null | null |
src/LibCraft/coreEngine/include/HP.hpp
|
leodlplq/IMACraft
|
5fec1729238e7e428bd39543dfd1fad521e16047
|
[
"MIT"
] | null | null | null |
//
// Created by Adam on 13/12/2021.
//
#pragma once
#include <iostream>
#include "vector"
#include "LibCraft/renderEngine/include/Vertex.hpp"
#include "LibCraft/renderEngine/include/Cube.hpp"
#include "LibCraft/renderEngine/include/vbo.hpp"
#include "LibCraft/renderEngine/include/vao.hpp"
#include "LibCraft/renderEngine/include/ibo.hpp"
#include "LibCraft/renderEngine/include/Shader.hpp"
#include <glm/gtc/type_ptr.hpp>
#include "stb/stb_image.h"
#include "LibCraft/tools/include/filePath.hpp"
class HP {
public:
//CONSTRUCTORS & DESTRUCTORS;
HP();
~HP();
void drawHP(Shader& shader, int nbHp);
void genTexHP(std::string filePathHP);
inline int getVertexCountHP(){
return _vertices.size();
}
inline int getIndicesCountHP(){
return _indices.size();
}
inline GLuint* getIndicesHP() {
return &_indices[0];
}
inline Vertex* getDataPointerHP() {
return &_vertices[0];
}
private:
std::vector<Vertex> _vertices = {
Vertex(glm::vec3(-0.5, -0.5, 0.0), glm::vec3(1.0, 0.0, 0.0), glm::vec2(0.0, 0.0)),
Vertex(glm::vec3(0.5, -0.5, 0.0), glm::vec3(0.0, 1.0, 0.0), glm::vec2(1.0, 0.0)),
Vertex(glm::vec3(0.5, 0.5, 0.0), glm::vec3(0.0, 0.0, 1.0), glm::vec2(1.0, 1.0)),
Vertex(glm::vec3(-0.5, 0.5, 0.0), glm::vec3(1.0, 1.0, 1.0), glm::vec2(0.0, 1.0))
};
std::vector<GLuint> _indices = {0, 1, 2, 0, 2, 3};
vao _vao;
vbo _vbo;
ibo _ibo;
GLuint _texture;
};
| 28.45283
| 94
| 0.615385
|
leodlplq
|
bfa225823a119b760369311b30ffbc2824170b88
| 4,957
|
cpp
|
C++
|
GameRulesModules/GameRulesObjectiveVictoryConditionsIndividualScore.cpp
|
IvarJonsson/Project-Unknown
|
4675b41bbb5e90135c7bf3aded2c2e262b50f351
|
[
"BSL-1.0"
] | null | null | null |
GameRulesModules/GameRulesObjectiveVictoryConditionsIndividualScore.cpp
|
IvarJonsson/Project-Unknown
|
4675b41bbb5e90135c7bf3aded2c2e262b50f351
|
[
"BSL-1.0"
] | null | null | null |
GameRulesModules/GameRulesObjectiveVictoryConditionsIndividualScore.cpp
|
IvarJonsson/Project-Unknown
|
4675b41bbb5e90135c7bf3aded2c2e262b50f351
|
[
"BSL-1.0"
] | null | null | null |
// Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
#include "StdAfx.h"
#include "Game.h"
#include "IGameRulesPlayerStatsModule.h"
#include "GameRulesObjectiveVictoryConditionsIndividualScore.h"
#include "GameRules.h"
#include "IGameRulesStateModule.h"
#include "IGameRulesObjectivesModule.h"
#include "GameRulesModules/IGameRulesRoundsModule.h"
#include "PersistantStats.h"
#include "UI/HUD/HUDEventWrapper.h"
#include "Audio/Announcer.h"
#include "Network/Lobby/GameLobby.h"
void CGameRulesObjectiveVictoryConditionsIndividualScore::OnEndGame(int teamId, EGameOverReason reason, ESVC_DrawResolution winningResolution, EntityId killedEntity, EntityId shooterEntity)
{
EGameOverType gameOverType = EGOT_Unknown;
if (gEnv->bServer)
{
IGameRulesRoundsModule *pRoundsModule = m_pGameRules->GetRoundsModule();
if (pRoundsModule)
{
pRoundsModule->OnEndGame(teamId, 0, reason);
if (!pRoundsModule->IsGameOver())
{
return;
}
}
EntityId localClient = gEnv->pGameFramework->GetClientActorId();
if ( shooterEntity == localClient && localClient != 0)
{
g_pGame->GetPersistantStats()->IncrementClientStats(EIPS_WinningKill);
}
if ( killedEntity == localClient && localClient != 0)
{
g_pGame->GetPersistantStats()->IncrementClientStats(EIPS_VictimOnFinalKillcam);
}
IGameRulesStateModule *pStateModule = m_pGameRules->GetStateModule();
if (pStateModule)
pStateModule->OnGameEnd();
IGameRulesPlayerStatsModule *pStatsModule = m_pGameRules->GetPlayerStatsModule();
if (pStatsModule)
{
pStatsModule->CalculateSkillRanking();
}
int team1Score = m_pGameRules->GetTeamsScore(1);
int team2Score = m_pGameRules->GetTeamsScore(2);
m_victoryParams = CGameRules::VictoryTeamParams(teamId, reason, team1Score, team2Score, winningResolution, m_drawResolutionData[ESVC_DrawResolution_level_1], m_drawResolutionData[ESVC_DrawResolution_level_2], m_winningVictim, m_winningAttacker);
m_winningVictim = 0;
m_winningAttacker = 0;
m_pGameRules->GetGameObject()->InvokeRMI(CGameRules::ClVictoryTeam(), m_victoryParams, eRMI_ToRemoteClients);
// have finished processing these winning stats now
m_winningAttacker=0;
m_winningVictim=0;
}
m_pGameRules->OnEndGame();
int highestPlayerScore = -1;
EntityId playerId = 0;
bool bDraw = true;
IGameRulesPlayerStatsModule* pPlayStatsMo = m_pGameRules->GetPlayerStatsModule();
if (pPlayStatsMo)
{
const int numStats = pPlayStatsMo->GetNumPlayerStats();
for (int i=0; i<numStats; i++)
{
const SGameRulesPlayerStat* s = pPlayStatsMo->GetNthPlayerStats(i);
if (s->flags & SGameRulesPlayerStat::PLYSTATFL_HASSPAWNEDTHISROUND)
{
if (s->points == highestPlayerScore)
{
bDraw = true;
playerId = 0;
}
else if (s->points > highestPlayerScore)
{
bDraw = false;
highestPlayerScore = s->points;
playerId = s->playerId;
}
}
}
}
if (gEnv->IsClient())
{
int clientScore = 0;
bool clientScoreIsTop = false;
const EntityId clientId = g_pGame->GetIGameFramework()->GetClientActorId();
if (pPlayStatsMo)
{
if (const SGameRulesPlayerStat* s = pPlayStatsMo->GetPlayerStats(clientId))
{
clientScore = s->points;
}
if (clientScore == highestPlayerScore)
{
clientScoreIsTop = true;
}
}
const bool localPlayerWon = (playerId == clientId);
if (!bDraw)
{
if (localPlayerWon)
{
CAudioSignalPlayer::JustPlay("MatchWon");
}
else
{
CAudioSignalPlayer::JustPlay("MatchLost");
}
}
else
{
CAudioSignalPlayer::JustPlay("MatchDraw");
}
// the server has already increased these stats in the server block above
if (!gEnv->bServer)
{
EntityId localClient = gEnv->pGameFramework->GetClientActorId();
if ( shooterEntity == localClient && localClient != 0)
{
g_pGame->GetPersistantStats()->IncrementClientStats(EIPS_WinningKill);
}
if ( killedEntity == localClient && localClient != 0)
{
g_pGame->GetPersistantStats()->IncrementClientStats(EIPS_VictimOnFinalKillcam);
}
}
if(playerId == 0) // overall the game was a Draw (at the top of the scoreboard)...
{
gameOverType = (clientScoreIsTop ? EGOT_Draw : EGOT_Lose); // ...but whether or not the local client considers the game a Draw or a Loss depends on whether they are one of the players who are drawn at the top
}
else
{
gameOverType = (localPlayerWon ? EGOT_Win : EGOT_Lose);
}
CRY_ASSERT(gameOverType != EGOT_Unknown);
EAnnouncementID announcementId = INVALID_ANNOUNCEMENT_ID;
GetGameOverAnnouncement(gameOverType, clientScore, highestPlayerScore, announcementId);
if (!m_pGameRules->GetRoundsModule())
{
// rounds will play the one shot themselves
CAudioSignalPlayer::JustPlay("RoundEndOneShot");
}
SHUDEventWrapper::OnGameEnd((int) playerId, clientScoreIsTop, reason, NULL, ESVC_DrawResolution_invalid, announcementId);
}
m_pGameRules->GameOver( gameOverType );
}
| 28.819767
| 247
| 0.731693
|
IvarJonsson
|
bfb4e21289f3158c867588c70d0e27e5810d8e6a
| 302
|
cpp
|
C++
|
src/main.cpp
|
MoeidHeidari/PANN
|
62bd308c08185107e8803be5ab8f09ab0f7225bb
|
[
"Apache-2.0"
] | 2
|
2021-01-31T23:44:54.000Z
|
2021-03-15T07:27:30.000Z
|
src/main.cpp
|
MoeidHeidari/PANN
|
62bd308c08185107e8803be5ab8f09ab0f7225bb
|
[
"Apache-2.0"
] | null | null | null |
src/main.cpp
|
MoeidHeidari/PANN
|
62bd308c08185107e8803be5ab8f09ab0f7225bb
|
[
"Apache-2.0"
] | null | null | null |
#include <iostream>
#include <Foundation/Types/Types.hpp>
#include <Foundation/Strings/String.hpp>
using namespace PANN::TYPES;
int main(int, char**)
{
PANN_UInt8 x='B';
PANNString str;
str.print_a_string();
std::cout << "\nHello, world!"<<x<<std::endl;
return 0;
}
| 15.1
| 49
| 0.629139
|
MoeidHeidari
|
bfb7d54b086a538137da0bc456e2c65a249a0bac
| 385
|
hpp
|
C++
|
cpu.hpp
|
AVasK/core
|
e8f73f2b92be1ac0a98bda2824682181c5575748
|
[
"MIT"
] | null | null | null |
cpu.hpp
|
AVasK/core
|
e8f73f2b92be1ac0a98bda2824682181c5575748
|
[
"MIT"
] | null | null | null |
cpu.hpp
|
AVasK/core
|
e8f73f2b92be1ac0a98bda2824682181c5575748
|
[
"MIT"
] | null | null | null |
#pragma once
#if __APPLE__
#include "device_info/apple_platform.hpp"
#elif defined __has_include && __has_include(<sys/param.h>) && __has_include(<sys/sysctl.h>)
#include "device_info/sysctl_info.hpp"
// #elif __WIN32__
//! TODO: Add support for windows
// #elif (__x86_64__ || __amd64__)
//! TODO: Use x86 cpuid to query info
#else
#include "device_info/unknown_platform.hpp"
#endif
| 27.5
| 92
| 0.750649
|
AVasK
|
bfbedea09206a5cbc8ace6bc31ac9907bc5fd537
| 10,067
|
hpp
|
C++
|
include/gp/problem/problem.hpp
|
ho-ri1991/genetic-programming
|
06d0c1f0719f4d2ddcf9c066d9de1d0bb67772b0
|
[
"MIT"
] | null | null | null |
include/gp/problem/problem.hpp
|
ho-ri1991/genetic-programming
|
06d0c1f0719f4d2ddcf9c066d9de1d0bb67772b0
|
[
"MIT"
] | null | null | null |
include/gp/problem/problem.hpp
|
ho-ri1991/genetic-programming
|
06d0c1f0719f4d2ddcf9c066d9de1d0bb67772b0
|
[
"MIT"
] | null | null | null |
#ifndef GP_PROBLEM_PROBLEM
#define GP_PROBLEM_PROBLEM
#include <any>
#include <algorithm>
#include <gp/utility/type.hpp>
#include <gp/utility/variable.hpp>
#include <gp/utility/result.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
#include <limits>
namespace gp::problem {
namespace detail {
template <std::size_t offset, typename ...Ts>
utility::Result<utility::Variable> stringToVariableHelper(const std::string& str,
const utility::TypeInfo& type,
const std::tuple<std::function<Ts(const std::string&)>...>& stringToValues){
if(type == utility::typeInfo<
typename std::tuple_element_t<offset, std::decay_t<decltype(stringToValues)>>::result_type
>()) return utility::result::ok(utility::Variable(std::get<offset>(stringToValues)(str)));
if constexpr (offset + 1 < std::tuple_size_v<std::decay_t<decltype(stringToValues)>>) {
return stringToVariableHelper<offset + 1>(str, type, stringToValues);
} else {
return utility::result::err<utility::Variable>("failed to load problem, string to value conversion function of " + type.name() + "not registerd");
}
};
template <typename ...Ts>
utility::Result<utility::Variable> stringToVariable(const std::string& str,
const utility::TypeInfo& type,
const std::tuple<std::function<Ts(const std::string&)>...>& stringToValues) {
return stringToVariableHelper<0>(str, type, stringToValues);
}
}
namespace io {
constexpr const char* ROOT_FIELD = "problem";
constexpr const char* NAME_FIELD = "name";
constexpr const char* RETURN_TYPE_FIELD = "return_type";
constexpr const char* ARGUMENTS_FIELD = "arguments";
constexpr const char* VARIABLE_TYPE_FIELD = "type";
constexpr const char* TEACHER_DATA_SET_FIELD = "teacher_data_set";
constexpr const char* TEACHER_DATA_FIELD = "data";
constexpr const char* TEACHER_DATA_ARGUMENT_FIELD = "argument";
constexpr const char* TEACHER_DATA_ARGUMENT_INDEX_ATTRIBUTE = "idx";
constexpr const char* TEACHER_DATA_ANSWER_FIELD = "answer";
}
struct Problem {
using AnsArgPair = std::tuple<utility::Variable, std::vector<utility::Variable>>; //first: ans, second: args
std::string name;
const utility::TypeInfo* returnType;
std::vector<const utility::TypeInfo*> argumentTypes;
std::vector<AnsArgPair> ansArgList;
};
template <typename ...SupportTypes>
utility::Result<Problem> load(std::istream& in,
const utility::StringToType& stringToType,
const std::tuple<std::function<SupportTypes(const std::string&)>...>& stringToValues){
using namespace boost::property_tree;
using namespace utility;
ptree tree;
try {
xml_parser::read_xml(in, tree);
} catch (const std::exception& ex) {
return result::err<Problem>(std::string("failed to load problem\n") + ex.what());
}
Problem problem1;
//get problem name
auto nameResult = result::fromOptional(tree.template get_optional<std::string>(std::string(io::ROOT_FIELD) + "." + io::NAME_FIELD),
"failed to load problem, name field not found.");
if(!nameResult) return result::err<Problem>(std::move(nameResult).errMessage());
problem1.name = std::move(nameResult).unwrap();
//get return type
auto returnTypeResult = result::fromOptional(tree.template get_optional<std::string>(std::string(io::ROOT_FIELD) + "." + io::RETURN_TYPE_FIELD),
"failed to load problem, return_type field not found.")
.flatMap([&stringToType](const std::string& typeName){
using ResultType = const TypeInfo*;
if(!stringToType.hasType(typeName)) return result::err<ResultType>("failed to load problem, unknown type name \"" + typeName + "\"");
else return result::ok(&stringToType(typeName));
});
if(!returnTypeResult) return result::err<Problem>(std::move(returnTypeResult).errMessage());
problem1.returnType = std::move(returnTypeResult).unwrap();
//get argument types
auto argsResult = result::fromOptional(tree.get_child_optional(std::string(io::ROOT_FIELD) + "." + io::ARGUMENTS_FIELD),
"failed to load problem, arguments field not found")
.flatMap([&stringToType](ptree& child){
using ResultType = decltype(Problem{}.argumentTypes);
ResultType argumentTypes;
for(const auto& [key, val]: child) {
if(key != io::VARIABLE_TYPE_FIELD) continue;
const auto& typeStr = val.data();
if(!stringToType.hasType(typeStr)) return result::err<ResultType>(std::string("failed to load problem, unknown argument type name \"") + typeStr + "\"");
argumentTypes.push_back(&stringToType(typeStr));
}
return result::ok(std::move(argumentTypes));
});
if(!argsResult) return result::err<Problem>(std::move(argsResult).errMessage());
problem1.argumentTypes = std::move(argsResult).unwrap();
//get teacher data set
auto teacherDataResult = result::fromOptional(tree.get_child_optional(std::string(io::ROOT_FIELD) + "." + io::TEACHER_DATA_SET_FIELD),
"failed to load problem, teacher_data_set field not found")
.flatMap([&problem1, &stringToValues, argNum = std::size(problem1.argumentTypes)](ptree& child){
using ResultType = decltype(Problem{}.ansArgList);
ResultType ansArgList;
for(const auto& [key, value]: child) {
if(key != io::TEACHER_DATA_FIELD)continue;
auto dataResult = result::fromOptional(value.template get_optional<std::string>(io::TEACHER_DATA_ANSWER_FIELD),
"failed to load problem, answer field not found in the data field.")
.flatMap([&stringToValues, &problem1](auto&& answerStr){
return detail::stringToVariable(answerStr, *problem1.returnType, stringToValues);
});
if(!dataResult) return result::err<ResultType>(std::move(dataResult).errMessage());
auto ans = std::move(dataResult).unwrap();
std::vector<Variable> args(argNum);
for(const auto& [dataKey, dataValue]: value) {
if(dataKey != io::TEACHER_DATA_ARGUMENT_FIELD) continue;
auto idxResult = result::fromOptional(dataValue.template get_optional<std::string>(std::string("<xmlattr>.") + io::TEACHER_DATA_ARGUMENT_INDEX_ATTRIBUTE),
"failed to load problem, idx attribute not found int the argument field")
.flatMap([](auto&& idxStr){
if(idxStr.empty()
|| !std::all_of(std::begin(idxStr), std::end(idxStr), [](auto c){return '0' <= c && c <= '9';})
|| (1 < std::size(idxStr) && idxStr[0] == '0')
|| std::numeric_limits<int>::digits10 < std::size(idxStr)) return result::err<int>("failed to load problem, invalid idx \"" + idxStr + "\"");
auto idx = std::stoll(idxStr);
if (static_cast<long long>(INT_MAX) < idx) return result::err<int>("failed to load problem, invalid idx \"" + idxStr + "\"");
return result::ok(static_cast<int>(idx));
}).flatMap([argNum = std::size(problem1.argumentTypes)](int idx){
if(idx < 0 || argNum <= idx) return result::err<int>("failed to load problem, invalid idx \"" + std::to_string(idx) + "\"");
else return result::ok(idx);
});
if(!idxResult) return result::err<ResultType>(std::move(idxResult).errMessage());
auto idx = idxResult.unwrap();
auto argResult = detail::stringToVariable(dataValue.data(), *problem1.argumentTypes[idx], stringToValues);
if(!argResult) return result::err<ResultType>(std::move(argResult).errMessage());
args[idx] = std::move(argResult).unwrap();
}
if(!std::all_of(std::begin(args), std::end(args), [](auto x)->bool{return static_cast<bool>(x);})) return result::err<ResultType>("failed to load problem, some argument is lacking");
ansArgList.push_back(std::make_tuple(std::move(ans), std::move(args)));
}
return result::ok(std::move(ansArgList));
});
if(!teacherDataResult) return result::err<Problem>(std::move(teacherDataResult).errMessage());
problem1.ansArgList = std::move(teacherDataResult).unwrap();
return result::ok(std::move(problem1));
}
}
#endif
| 61.012121
| 206
| 0.548525
|
ho-ri1991
|
bfbf097838dfd1611e2eba0f63106220413f9729
| 26,642
|
cpp
|
C++
|
App/EZDefaultAction.cpp
|
ouxianghui/ezcam
|
195fb402202442b6d035bd70853f2d8c3f615de1
|
[
"MIT"
] | 12
|
2021-03-26T03:23:30.000Z
|
2021-12-31T10:05:44.000Z
|
App/EZDefaultAction.cpp
|
15831944/ezcam
|
195fb402202442b6d035bd70853f2d8c3f615de1
|
[
"MIT"
] | null | null | null |
App/EZDefaultAction.cpp
|
15831944/ezcam
|
195fb402202442b6d035bd70853f2d8c3f615de1
|
[
"MIT"
] | 9
|
2021-06-23T08:26:40.000Z
|
2022-01-20T07:18:10.000Z
|
#include "EZDefaultAction.h"
#include "RMouseEvent.h"
#include "RSettings.h"
#include "RMath.h"
#include "RGraphicsViewQt.h"
#include <QSharedPointer>
#include "REntity.h"
#include "REntityData.h"
#include "RBlock.h"
#include "RBlockReferenceEntity.h"
#include "RBlockReferenceData.h"
#include "RSnapFree.h"
#include "RSnapAuto.h"
#include <QString>
#include <QObject>
#include "RMoveReferencePointOperation.h"
#include "RMoveSelectionOperation.h"
#include "RAddObjectOperation.h"
#include "RAddObjectsOperation.h"
EZDefaultAction::EZDefaultAction(RGuiAction* pGuiAction)
:RActionAdapter(pGuiAction)
{
}
EZDefaultAction::~EZDefaultAction()
{
}
void EZDefaultAction::beginEvent()
{
m_nPickRangePixels = RSettings::getPickRange();
m_nMinPickRangePixels = std::min(m_nPickRangePixels / 2, 10);
m_d1Model = RVector::invalid;
m_d1Screen = RVector::invalid;
m_d2Model = RVector::invalid;
m_d2Screen = RVector::invalid;
m_pDocument = this->getDocument();
setState(Neutral);
m_blockRefId = RObject::INVALID_ID;
m_entityInBlockId = RObject::INVALID_ID;
}
void EZDefaultAction::setState(State state)
{
// oxh
//EAction.prototype.setState.call(this, state);
//var appWin = EAction.getMainWindow();
// oxh add
this->m_state = state;
if (this->m_state == MovingReference
|| this->m_state == SettingReference
|| this->m_state == MovingEntity
|| this->m_state == MovingEntityInBlock
|| this->m_state == SettingEntity)
{
documentInterface->setClickMode(RAction::PickCoordinate);
// oxh
//this->setCrosshairCursor();
//EAction.showSnapTools();
}
else
{
documentInterface->setClickMode(RAction::PickingDisabled);
// oxh
//this->setArrowCursor();
}
QString ltip = "Select entity or region";
switch (m_state)
{
case Neutral:
m_d1Model = RVector::invalid;
m_d1Screen = RVector::invalid;
m_d2Model = RVector::invalid;
m_d2Screen = RVector::invalid;
if (documentInterface->hasSelection())
{
ltip += "\n";
ltip += "Move entity or reference";
}
// oxh
//this->setLeftMouseTip(ltip);
//this->setRightMouseTip("");
//this->setCommandPrompt();
break;
case Dragging:
m_d2Model = RVector::invalid;
m_d2Screen = RVector::invalid;
break;
case SettingCorner2:
//this->setLeftMouseTip("Set second corner");
//this->setRightMouseTip("");
break;
case MovingReference:
case SettingReference:
//this->setLeftMouseTip("Specify target point of reference point");
//this->setRightMouseTip("");
break;
case MovingEntity:
case SettingEntity:
//this->setLeftMouseTip("Specify target point of selection");
//this->setRightMouseTip("");
break;
case MovingEntityInBlock:
//this->setLeftMouseTip("Move entity to desired location");
break;
default:
break;
}
}
void EZDefaultAction::suspendEvent()
{
if (this->guiAction)
{
this->guiAction->setChecked(false);
}
}
void EZDefaultAction::resumeEvent()
{
}
void EZDefaultAction::mouseMoveEvent(RMouseEvent& event)
{
// we're in the middle of panning: don't do anything:
if (event.buttons() == Qt::MidButton ||
(event.buttons() == Qt::LeftButton && event.modifiers() == Qt::ControlModifier))
{
return;
}
// if (isNull(m_nPickRangePixels))
// {
// return;
// }
RGraphicsView& view = event.getGraphicsView();
RVector screenPosition;
RVector referencePoint;
REntity::Id entityId = REntity::INVALID_ID;
double range = 0.0f;
switch (m_state)
{
case Neutral:
screenPosition = event.getScreenPosition();
referencePoint = view.getClosestReferencePoint(screenPosition, m_nMinPickRangePixels);
if (referencePoint.isValid())
{
this->highlightReferencePoint(referencePoint);
}
else
{
range = view.mapDistanceFromView(m_nPickRangePixels);
double strictRange = view.mapDistanceFromView(10);
RMouseEvent::setOriginalMousePos(event.globalPos());
entityId = documentInterface->getClosestEntity(event.getModelPosition(), range, strictRange, false);
RMouseEvent::resetOriginalMousePos();
if (entityId != RObject::INVALID_ID && m_pDocument->isEntityEditable(entityId))
{
this->highlightEntity(entityId);
}
}
break;
case Dragging:
m_d2Model = event.getModelPosition();
m_d2Screen = event.getScreenPosition();
//view = event.getGraphicsView();
if (!m_d1Screen.equalsFuzzy(m_d2Screen, 10 /*this.minPickRangePixels*/))
{
// if the dragging started on top of a reference point,
// start moving the reference point:
referencePoint = view.getClosestReferencePoint(m_d1Screen, m_nMinPickRangePixels);
if (referencePoint.isValid())
{
m_d1Model = referencePoint;
documentInterface->setRelativeZero(m_d1Model);
setState(MovingReference);
}
else
{
// if the dragging started on top of an entity,
// start moving the entity:
entityId = view.getClosestEntity(m_d1Screen, m_nMinPickRangePixels, 10, false);
// in block easy drag and drop:
if (entityId != RObject::INVALID_ID)
{
RDocument* doc = this->getDocument();
if (doc)
{
// oxh todo
QSharedPointer<REntity> entity = doc->queryEntityDirect(entityId);
if (!entity.isNull())
{
QSharedPointer<RBlockReferenceEntity> blockRefEntity = entity.dynamicCast<RBlockReferenceEntity>();
if (!blockRefEntity.isNull())
{
RBlock::Id blockId = blockRefEntity->getReferencedBlockId();
// oxh todo
QSharedPointer<RBlock> block = doc->queryBlock(blockId);
if (!block.isNull())
{
range = view.mapDistanceFromView(m_nPickRangePixels);
// cursor, mapped to block coordinates:
RVector pBlock = blockRefEntity->mapToBlock(m_d1Model);
RBox box = RBox(pBlock - RVector(range, range), pBlock + RVector(range, range));
QSet<REntity::Id> res = doc->queryIntersectedEntitiesXY(box, true, false, blockId);
REntity::Id entityInBlockId;
if (res.size() == 1)
{
entityInBlockId = *(res.begin());
}
else
{
entityInBlockId = doc->queryClosestXY(res, pBlock, range*2, false);
}
QSharedPointer<REntity> entityInBlock = doc->queryEntityDirect(entityInBlockId);
bool ok = entityInBlock->getCustomProperty("QCAD", "InBlockEasyDragAndDrop", "0") == "1";
if (entityInBlock && ok)
{
//QList<RVector> refP = entityInBlock->getReferencePoints();
QList<RRefPoint> refP = entityInBlock->getReferencePoints();
if (refP.length() > 0)
{
m_d1Model = refP[0]; //entity.mapToBlock(refP[0]);
}
else
{
m_d1Model = pBlock;
}
m_entityInBlockId = entityInBlockId;
m_blockRefId = entityId;
setState(MovingEntityInBlock);
RGuiAction* guiAction = RGuiAction::getByScriptFile("scripts/Snap/SnapFree/SnapFree.js");
if (guiAction)
{
guiAction->slotTrigger();
}
documentInterface->setSnap(new RSnapFree());
break;
}
}
}
}
}
}
if (entityId != RObject::INVALID_ID && m_pDocument->hasSelection())
{
// move start point of dragging operation to closest
// reference point:
// TODO: use auto snap instead here (optional?):
m_d1Model = view.getClosestReferencePoint(entityId, m_d1Screen);
documentInterface->setRelativeZero(m_d1Model);
setState(MovingEntity);
}
else
{
// if the dragging started in an empty space,
// start box selection:
setState(SettingCorner2);
// make sure one mouse move is enough to get a visible preview
// (for testing, one mouse move event has to be enough):
this->mouseMoveEvent(event);
}
}
}
break;
case SettingCorner2:
m_d2Model = event.getModelPosition();
previewSelectionBox(this->getDocumentInterface(),
RBox(m_d1Model, m_d2Model),
m_d1Model.x > m_d2Model.x);
break;
// easy in block entity drag and drop (point mark labels):
// case DefaultAction.State.MovingEntityInBlock:
// this.moveEntityInBlock(event.getModelPosition(), true);
// break;
default:
break;
}
}
void EZDefaultAction::previewSelectionBox(RDocumentInterface* di, RBox box, bool crossSelection) {
QList<RVector> points;
points.push_back(box.c1);
points.push_back(RVector(box.c1.x, box.c2.y));
points.push_back(box.c2);
points.push_back(RVector(box.c2.x, box.c1.y));
points.push_back(box.c1);
previewSelectionPolygon(di, points, crossSelection);
}
/**
* Adds a selection polygon with the given points to the preview.
* \param points Array of RVector objects
*/
void EZDefaultAction::previewSelectionPolygon(RDocumentInterface* di, const QList<RVector>& points, bool crossSelection)
{
RPolyline polygon = RPolyline(points, true);
RColor color = RSettings::getColor("GraphicsViewColors/SelectionBoxColor", RColor(128,0,0,255));
RLineweight::Lineweight lw = RLineweight::Weight000;
RColor c;
if (crossSelection)
{
c = RSettings::getColor("GraphicsViewColors/SelectionBoxBackgroundCrossColor", RColor(0,0,255,30));
}
else
{
c = RSettings::getColor("GraphicsViewColors/SelectionBoxBackgroundColor", RColor(0,255,0,30));
}
// TODO c.getQColor() doesn't work
QColor bgColor = QColor(c.red(), c.green(), c.blue(), c.alpha());
QBrush brush = QBrush(bgColor, Qt::SolidPattern);
if (crossSelection)
{
QList<qreal> dashes;
dashes.append(10.0f);
dashes.append(5.0f);
di->addShapeToPreview(polygon, color, brush, lw, Qt::CustomDashLine, dashes);
}
else
{
// TODO "Qt.SolidLine" doesn't convert to number
di->addShapeToPreview(polygon, color, brush, lw, Qt::SolidLine);
}
}
void EZDefaultAction::mouseReleaseEvent(RMouseEvent& event)
{
bool persistentSelection = RSettings::getBoolValue("GraphicsView/PersistentSelection", false);
bool add = false;
if ((event.modifiers() == Qt::ShiftModifier) || (event.modifiers() == Qt::ControlModifier) || persistentSelection == true)
{
add = true;
}
RGraphicsView& view = event.getGraphicsView();
double range = 0.0f;
double strictRange = 0.0f;
REntity::Id entityId = REntity::INVALID_ID;
if (event.button() == Qt::LeftButton)
{
switch (m_state)
{
case Dragging:
range = view.mapDistanceFromView(m_nPickRangePixels);
//range = view.mapDistanceFromView(10);
strictRange = view.mapDistanceFromView(10);
entityId = documentInterface->getClosestEntity(event.getModelPosition(), range, strictRange, false);
//qDebug("entity id: ", entityId);
if (entityId != -1)
{
if (add && m_pDocument->isSelected(entityId))
{
this->deselectEntity(entityId);
}
else
{
this->selectEntity(entityId, add);
}
}
else
{
if (!add)
{
if (persistentSelection == false)
{
documentInterface->clearSelection();
}
}
}
documentInterface->clearPreview();
documentInterface->repaintViews();
this->setState(Neutral);
break;
case SettingCorner2:
documentInterface->clearPreview();
m_d2Model = event.getModelPosition();
if ((event.modifiers() == Qt::ShiftModifier) || (event.modifiers() == Qt::ControlModifier) || persistentSelection == true)
{
// add all entities in window to the selection:
documentInterface->selectBoxXY(RBox(m_d1Model, m_d2Model), true);
}
else
{
// select entities in window only:
documentInterface->selectBoxXY(RBox(m_d1Model, m_d2Model), false);
}
// event.setConsumed(true);
this->setState(Neutral);
break;
// easy in block entity drag and drop (point mark labels):
// case DefaultAction.State.MovingEntityInBlock:
// this.moveEntityInBlock(event.getModelPosition(), false);
// break;
default:
break;
}
}
else if (event.button() == Qt::RightButton)
{
if (this->m_state != Neutral && m_state != MovingEntityInBlock)
{
documentInterface->clearPreview();
documentInterface->repaintViews();
this->setState(Neutral);
}
// use right-click into empty area to deselect everything:
else if (m_state == Neutral && RSettings::getBoolValue("GraphicsView/RightClickToDeselect", false))
{
int rightClickRange = RSettings::getIntValue("GraphicsView/RightClickRange", 10);
//view = event.getGraphicsView();
range = view.mapDistanceFromView(rightClickRange);
strictRange = view.mapDistanceFromView(10);
entityId = documentInterface->getClosestEntity(event.getModelPosition(), range, strictRange, false);
if (entityId != -1)
{
this->selectEntity(entityId, add);
// TODO: show entity context menu?
//CadToolBar.back();
}
else
{
if (documentInterface->hasSelection())
{
documentInterface->clearSelection();
documentInterface->clearPreview();
documentInterface->repaintViews();
}
else
{
// todo
//CadToolBar.back();
}
}
}
else
{
// todo
//CadToolBar.back();
}
}
}
void EZDefaultAction::mousePressEvent(RMouseEvent& event)
{
if (event.button() == Qt::LeftButton && event.modifiers() != Qt::ControlModifier)
{
if (m_state == Neutral)
{
m_d1Model = event.getModelPosition();
m_d1Screen = event.getScreenPosition();
this->setState(Dragging);
documentInterface->clearPreview();
}
}
}
void EZDefaultAction::mouseDoubleClickEvent(RMouseEvent& event)
{
if (event.button() == Qt::LeftButton && m_state == Neutral)
{
RGraphicsView& view = event.getGraphicsView();
double range = view.mapDistanceFromView(m_nPickRangePixels);
double strictRange = view.mapDistanceFromView(10);
REntity::Id entityId = documentInterface->getClosestEntity(event.getModelPosition(), range, strictRange, false);
if (entityId == RObject::INVALID_ID)
{
return;
}
this->entityDoubleClicked(entityId, event);
}
}
void EZDefaultAction::escapeEvent()
{
documentInterface->clearPreview();
documentInterface->repaintViews();
// todo
//CadToolBar.back();
this->setState(Neutral);
}
void EZDefaultAction::coordinateEvent(RCoordinateEvent& event)
{
pickCoordinate(event, false);
}
void EZDefaultAction::coordinateEventPreview(RCoordinateEvent& event)
{
pickCoordinate(event, true);
}
void EZDefaultAction::pickCoordinate(RCoordinateEvent& event, bool preview)
{
ROperation* op = NULL;
switch (m_state)
{
case MovingReference:
case SettingReference:
if (preview)
{
m_d2Model = event.getModelPosition();
op = new RMoveReferencePointOperation(m_d1Model, m_d2Model);
documentInterface->previewOperation(op);
}
else
{
if (m_state == MovingReference)
{
this->setState(SettingReference);
}
else
{
m_d2Model = event.getModelPosition();
op = new RMoveReferencePointOperation(m_d1Model, m_d2Model);
op->setText("Move Reference Point");
documentInterface->applyOperation(op);
documentInterface->clearPreview();
documentInterface->repaintViews();
// todo
//CadToolBar.back();
this->setState(Neutral);
}
}
break;
case MovingEntity:
case SettingEntity:
if (preview)
{
m_d2Model = event.getModelPosition();
op = new RMoveSelectionOperation(m_d1Model, m_d2Model);
documentInterface->previewOperation(op);
}
else
{
if (m_state == MovingEntity)
{
this->setState(SettingEntity);
}
else
{
m_d2Model = event.getModelPosition();
op = new RMoveSelectionOperation(m_d1Model, m_d2Model);
op->setText("Move Selection");
documentInterface->applyOperation(op);
documentInterface->clearPreview();
documentInterface->repaintViews();
// todo
//CadToolBar.back();
this->setState(Neutral);
}
}
break;
// easy in block entity drag and drop (point mark labels):
case MovingEntityInBlock:
{
RDocument* doc = this->getDocument();
if (!doc)
{
break;
}
QSharedPointer<REntity> block = doc->queryEntity(m_blockRefId);
if (block.isNull())
{
break;
}
QSharedPointer<RBlockReferenceEntity> blockRef = block.dynamicCast<RBlockReferenceEntity>();
if (blockRef.isNull())
{
break;
}
m_d2Model = blockRef->mapToBlock(event.getModelPosition());
QSharedPointer<REntity> entityInBlock = doc->queryEntity(m_entityInBlockId);
entityInBlock->move(m_d2Model - m_d1Model);
RAddObjectsOperation* op = new RAddObjectsOperation();
op->setText("Move Entity");
op->addObject(entityInBlock, false);
if (preview)
{
documentInterface->previewOperation(op);
}
else
{
doc->removeFromSpatialIndex(blockRef);
documentInterface->applyOperation(op);
blockRef->update();
doc->addToSpatialIndex(blockRef);
this->setState(Neutral);
RGuiAction* guiAction = RGuiAction::getByScriptFile("scripts/Snap/SnapAuto/SnapAuto.js");
if (guiAction)
{
guiAction->slotTrigger();
}
documentInterface->setSnap(new RSnapAuto());
}
break;
}
default:
break;
}
}
/**
* Called when the mouse cursor hovers over an entity.
*/
void EZDefaultAction::highlightEntity(REntity::Id& entityId)
{
if (!documentInterface)
{
return;
}
documentInterface->highlightEntity(entityId);
}
/**
* Called when the mouse cursor hovers over a reference point.
*/
void EZDefaultAction::highlightReferencePoint(const RVector& referencePoint)
{
if (!documentInterface)
{
return;
}
documentInterface->highlightReferencePoint(referencePoint);
}
/**
* Called when the user deselects a single entity.
*/
void EZDefaultAction::deselectEntity(REntity::Id& entityId)
{
if (!documentInterface)
{
return;
}
documentInterface->deselectEntity(entityId);
}
/**
* Called when the user selects a single entity.
*/
void EZDefaultAction::selectEntity(REntity::Id& entityId, bool add)
{
if (!documentInterface)
{
return;
}
documentInterface->selectEntity(entityId, add);
}
/**
* Called when the user selects a single entity.
*/
void EZDefaultAction::entityDoubleClicked(REntity::Id& entityId, RMouseEvent& event)
{
if (!documentInterface || !m_pDocument)
{
return;
}
QSharedPointer<REntity> entity = m_pDocument->queryEntity(entityId);
if (entity->getType() == RS::EntityText
|| entity->getType() == RS::EntityAttribute
|| entity->getType() == RS::EntityAttributeDefinition)
{
if (RSettings::getBoolValue("GraphicsView/DoubleClickEditText", true) == true)
{
// oxh todo
//include("scripts/Modify/EditText/EditText.js");
//EditText.editText(entity);
}
}
else if (entity->getType() == RS::EntityBlockRef)
{
QSharedPointer<RBlockReferenceEntity> blockEntity = entity.dynamicCast<RBlockReferenceEntity>();
if (!blockEntity.isNull())
{
// in block text editing with double-click:
RBlock::Id blockId = blockEntity->getReferencedBlockId();
QSharedPointer<RBlock> block = m_pDocument->queryBlock(blockId);
if (block)
{
RGraphicsView& view = event.getGraphicsView();
double range = view.mapDistanceFromView(m_nPickRangePixels);
// cursor, mapped to block coordinates:
RVector pBlock = blockEntity->mapToBlock(event.getModelPosition());
RBox box = RBox(pBlock - RVector(range,range), pBlock - RVector(range,range));
QSet<REntity::Id> res = m_pDocument->queryIntersectedEntitiesXY(box, true, false, blockId);
REntity::Id entityInBlockId;
if (res.size() == 1)
{
entityInBlockId = *(res.begin());
}
else
{
entityInBlockId = m_pDocument->queryClosestXY(res, pBlock, range*2, false);
}
QSharedPointer<REntity> entityInBlock = m_pDocument->queryEntity(entityInBlockId);
if (entityInBlock
&& entityInBlock->getType() == RS::EntityTextBased
&& entityInBlock->getCustomProperty("QCAD", "InBlockTextEdit", "0") == "1")
{
// todo
//include("scripts/Modify/EditText/EditText.js");
//EditText.editText(entityInBlock);
return;
}
}
if (RSettings::getBoolValue("GraphicsView/DoubleClickEditBlock", false) == true)
{
// todo oxh
//include("scripts/Block/Block.js");
//Block.editBlock(documentInterface, blockEntity->getReferencedBlockName());
}
}
}
}
void EZDefaultAction::keyPressEvent(QKeyEvent& event)
{
if (event.key() == Qt::Key_Z && event.modifiers() == Qt::ControlModifier)
{
documentInterface->undo();
}
else if (event.key() == Qt::Key_Z && event.modifiers() == (Qt::ControlModifier + Qt::ShiftModifier))
{
documentInterface->redo();
}
}
void EZDefaultAction::keyReleaseEvent(QKeyEvent& /*event*/)
{
}
| 34.15641
| 135
| 0.525073
|
ouxianghui
|
bfbf430d78da0096edb13b212a1b93be77a3ec01
| 2,044
|
hpp
|
C++
|
RUNETag/include/markerpose.hpp
|
GeReV/RUNEtag
|
e8319a132e325d73cdd7759a0d8a5f45f26dd129
|
[
"MIT"
] | 31
|
2017-12-29T16:39:07.000Z
|
2022-03-25T03:26:29.000Z
|
RUNETag/include/markerpose.hpp
|
GeReV/RUNEtag
|
e8319a132e325d73cdd7759a0d8a5f45f26dd129
|
[
"MIT"
] | 7
|
2018-06-29T07:30:14.000Z
|
2021-02-16T23:19:20.000Z
|
RUNETag/include/markerpose.hpp
|
GeReV/RUNEtag
|
e8319a132e325d73cdd7759a0d8a5f45f26dd129
|
[
"MIT"
] | 13
|
2018-09-27T13:19:12.000Z
|
2022-03-02T08:48:42.000Z
|
/**
* RUNETag fiducial markers library
*
* -----------------------------------------------------------------------------
* The MIT License (MIT)
*
* Copyright (c) 2015 Filippo Bergamasco
*
* 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 _MARKER_POSE_H
#define _MARKER_POSE_H
//#include "precomp.hpp"
#include <opencv2/opencv.hpp>
#include "markerdetected.hpp"
namespace cv
{
namespace runetag
{
const unsigned int FLAG_REPROJ_ERROR = 1;
const unsigned int FLAG_REFINE = 2;
/// <summary> Camera pose as a transformation from camera coordinates to world coordinates </summary>
struct Pose
{
/// <value> Rotation matrix </value>
cv::Mat R;
/// <value> Translation vector </value>
cv::Mat t;
};
extern Pose findPose( const MarkerDetected& detected, const cv::Mat& intrinsics, const cv::Mat& distortion, bool* pose_ok = 0, unsigned int method=CV_ITERATIVE, unsigned int flag = 0 );
} // namespace runetag
} // namespace cv
#endif
| 34.644068
| 189
| 0.695695
|
GeReV
|
bfc1fab970eb48f9eda9f80945f7bbee62921438
| 2,787
|
hpp
|
C++
|
libraries/chain/include/infrablockchain/chain/received_transaction_votes_object.hpp
|
YosemiteLabs/infrablockchain
|
da05af17a9bfb1c02dafca9d8033c9e1b00e92b3
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
libraries/chain/include/infrablockchain/chain/received_transaction_votes_object.hpp
|
YosemiteLabs/infrablockchain
|
da05af17a9bfb1c02dafca9d8033c9e1b00e92b3
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
libraries/chain/include/infrablockchain/chain/received_transaction_votes_object.hpp
|
YosemiteLabs/infrablockchain
|
da05af17a9bfb1c02dafca9d8033c9e1b00e92b3
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
/**
* @file infrablockchain/chain/received_transaction_votes_object.hpp
* @author bezalel@infrablockchain.com
* @copyright defined in infrablockchain/LICENSE.txt
*/
#pragma once
#include <eosio/chain/database_utils.hpp>
#include <eosio/chain/multi_index_includes.hpp>
namespace infrablockchain { namespace chain {
using namespace eosio::chain;
using tx_votes_sum_type = uint64_t;
using tx_votes_sum_weighted_type = double;
/**
* @brief received transaction votes statistics for an account
*/
class received_transaction_votes_object : public chainbase::object<infrablockchain_received_transaction_votes_object_type, received_transaction_votes_object> {
OBJECT_CTOR(received_transaction_votes_object)
id_type id;
account_name account; // transaction vote target account
tx_votes_sum_type tx_votes = 0; // sum of received transaction votes
tx_votes_sum_weighted_type tx_votes_weighted = 0.0; // weighted (time-decaying) sum of received transaction votes
uint16_t tx_votes_weighted_unique_idx = 0; // shared_multi_index_container does not allow ordered_non_unique index, making tx_votes_weighted value to be uniquely indexed
};
struct by_tx_votes_account;
struct by_tx_votes_weighted;
using received_transaction_votes_multi_index = chainbase::shared_multi_index_container<
received_transaction_votes_object,
indexed_by<
ordered_unique< tag<by_id>, member<received_transaction_votes_object, received_transaction_votes_object::id_type, &received_transaction_votes_object::id> >,
ordered_unique< tag<by_tx_votes_account>, member<received_transaction_votes_object, account_name, &received_transaction_votes_object::account>>,
// ordered_non_unique< tag<by_tx_votes_weighted>, member<received_transaction_votes_object, tx_votes_sum_weighted_type, &received_transaction_votes_object::tx_votes_weighted>>
ordered_unique< tag<by_tx_votes_weighted>,
composite_key< received_transaction_votes_object,
member<received_transaction_votes_object, tx_votes_sum_weighted_type, &received_transaction_votes_object::tx_votes_weighted>,
member<received_transaction_votes_object, uint16_t, &received_transaction_votes_object::tx_votes_weighted_unique_idx>
>
>
>
>;
} } /// infrablockchain::chain
CHAINBASE_SET_INDEX_TYPE(infrablockchain::chain::received_transaction_votes_object, infrablockchain::chain::received_transaction_votes_multi_index)
FC_REFLECT(infrablockchain::chain::received_transaction_votes_object, (account)(tx_votes_weighted)(tx_votes)(tx_votes_weighted_unique_idx))
| 50.672727
| 194
| 0.759598
|
YosemiteLabs
|
bfc2b5b536ec8501beae3f71d4f36065bb826ddf
| 2,017
|
hpp
|
C++
|
src/runtime/gpu/gpu_call_frame.hpp
|
pqLee/ngraph
|
ddfa95b26a052215baf9bf5aa1ca5d1f92aa00f7
|
[
"Apache-2.0"
] | null | null | null |
src/runtime/gpu/gpu_call_frame.hpp
|
pqLee/ngraph
|
ddfa95b26a052215baf9bf5aa1ca5d1f92aa00f7
|
[
"Apache-2.0"
] | null | null | null |
src/runtime/gpu/gpu_call_frame.hpp
|
pqLee/ngraph
|
ddfa95b26a052215baf9bf5aa1ca5d1f92aa00f7
|
[
"Apache-2.0"
] | null | null | null |
//*****************************************************************************
// Copyright 2017-2020 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 <functional>
#include <memory>
#include <unordered_map>
#include "gpu_compiled_function.hpp"
#include "gpu_tensor_wrapper.hpp"
namespace ngraph
{
namespace runtime
{
namespace gpu
{
class GPUCallFrame
{
public:
GPUCallFrame(const size_t& num_inputs, const size_t& num_outputs);
void resolve_reservations(
const GPUCompiledFunction* compiled_function,
const std::unordered_map<std::string, size_t>& memory_reservations);
void resolve_inputs(void** inputs, size_t num_inputs = 0);
void resolve_outputs(void** outputs, size_t num_outputs = 0);
std::vector<void*> get_tensor_io(const std::vector<GPUTensorWrapper>& tensors);
private:
void* get_pointer(const TensorRole& type,
const size_t& offset,
const std::string& name = "");
std::unordered_map<std::string, unsigned char*> m_memory_reservations;
std::vector<unsigned char*> m_inputs;
std::vector<unsigned char*> m_outputs;
};
}
}
}
| 36.672727
| 95
| 0.57412
|
pqLee
|
bfc81a43b20d46752d4363393f543e00c1950721
| 576
|
cpp
|
C++
|
test/spring2d/test-spring2d.cpp
|
sathyamvellal/learnopengl
|
54e9fd6193c6dc970b0802bc31c5b558c46586d5
|
[
"MIT"
] | null | null | null |
test/spring2d/test-spring2d.cpp
|
sathyamvellal/learnopengl
|
54e9fd6193c6dc970b0802bc31c5b558c46586d5
|
[
"MIT"
] | null | null | null |
test/spring2d/test-spring2d.cpp
|
sathyamvellal/learnopengl
|
54e9fd6193c6dc970b0802bc31c5b558c46586d5
|
[
"MIT"
] | null | null | null |
//
// Created by Sathyam Vellal on 19/03/2018.
//
#include <cmath>
#include <glm/glm.hpp>
#include "utils/logger.h"
#include "spring2d/spring2d.h"
#include "spring2d/spring2dsim.h"
int main(int argc, char **argv)
{
Spring2DSim spring2DSim(Spring2DSim(5.0));
spring2DSim.init();
glm::vec2 a(2, 3);
glm::vec2 b(1, 7);
glm::vec2 ub = b / glm::length(b);
glm::vec2 proja_b = glm::dot(a, ub) * ub;
std::cout << proja_b.x << std::endl;
std::cout << proja_b.y << std::endl;
std::cout << glm::length(proja_b) << std::endl;
return 0;
}
| 18.580645
| 51
| 0.604167
|
sathyamvellal
|
bfccffb0592842178fb180a8dfabee277730d4dd
| 7,029
|
cpp
|
C++
|
src/AbstractComponent.cpp
|
benzap/Kampf
|
9cf4fb0d6ec22bc35ade9b476d29df34902c6689
|
[
"Zlib"
] | 2
|
2018-05-13T05:27:29.000Z
|
2018-05-29T06:35:57.000Z
|
src/AbstractComponent.cpp
|
benzap/Kampf
|
9cf4fb0d6ec22bc35ade9b476d29df34902c6689
|
[
"Zlib"
] | null | null | null |
src/AbstractComponent.cpp
|
benzap/Kampf
|
9cf4fb0d6ec22bc35ade9b476d29df34902c6689
|
[
"Zlib"
] | null | null | null |
#include "AbstractComponent.hpp"
#include <iostream>
#include <cassert>
AbstractComponent::AbstractComponent(stringType name, enumComponentFamily family, bool bIsParent) :
name(name),
family(family),
bIsParent(bIsParent) {
}
AbstractComponent::~AbstractComponent() {
}
const stringType& AbstractComponent::getName() {
return this->name;
}
void AbstractComponent::setName(stringType name) {
this->name = name;
}
enumComponentFamily AbstractComponent::getFamily() {
return this->family;
}
bool AbstractComponent::isParent() {
return this->bIsParent;
}
bool AbstractComponent::isActive() {
return this->bActive;
}
void AbstractComponent::setActive() {
this->bActive = true;
}
void AbstractComponent::setInactive() {
this->bActive = false;
}
//value types
boolType AbstractComponent::getCustomAttribute_bool(stringType keyname) {
assert(this->hasCustomAttribute(keyname));
return this->customAttributeMap[keyname].get_bool();
}
stringType AbstractComponent::setCustomAttribute(stringType keyname, boolType bValue) {
if (this->hasCustomAttribute(keyname)) {
customAttributeMap[keyname].set(bValue);
}
else {
auto customAttribute = CustomAttribute(bValue);
customAttributeMap[keyname] = customAttribute;
}
return keyname;
}
integerType AbstractComponent::getCustomAttribute_int(stringType keyname) {
assert(this->hasCustomAttribute(keyname));
//TODO: check type
return this->customAttributeMap[keyname].get_int();
}
stringType AbstractComponent::setCustomAttribute(stringType keyname, integerType iValue) {
if (this->hasCustomAttribute(keyname)) {
customAttributeMap[keyname].set(iValue);
}
else {
auto customAttribute = CustomAttribute(iValue);
customAttributeMap[keyname] = customAttribute;
}
return keyname;
}
floatType AbstractComponent::getCustomAttribute_float(stringType keyname) {
assert(this->hasCustomAttribute(keyname));
//TODO: check type
return customAttributeMap[keyname].get_float();
}
stringType AbstractComponent::setCustomAttribute(stringType keyname, floatType fValue) {
if (this->hasCustomAttribute(keyname)) {
customAttributeMap[keyname].set(fValue);
}
else {
auto customAttribute = CustomAttribute(fValue);
customAttributeMap[keyname] = customAttribute;
}
return keyname;
}
charType AbstractComponent::getCustomAttribute_char(stringType keyname) {
assert(this->hasCustomAttribute(keyname));
//TODO: check type
return customAttributeMap[keyname].get_char();
}
stringType AbstractComponent::setCustomAttribute(stringType keyname, charType cValue) {
if (this->hasCustomAttribute(keyname)) {
customAttributeMap[keyname].set(cValue);
}
else {
auto customAttribute = CustomAttribute(cValue);
customAttributeMap[keyname] = customAttribute;
}
return keyname;
}
//ptr types
const intArrayType& AbstractComponent::getCustomAttribute_intArray(stringType keyname) {
assert(this->hasCustomAttribute(keyname));
return customAttributeMap[keyname].get_intArray();
}
stringType AbstractComponent::setCustomAttribute(stringType keyname, intArrayType iaValue) {
if (this->hasCustomAttribute(keyname)) {
customAttributeMap[keyname].set(iaValue);
}
else {
auto customAttribute = CustomAttribute(iaValue);
customAttributeMap[keyname] = customAttribute;
}
return keyname;
}
const floatArrayType& AbstractComponent::getCustomAttribute_floatArray(stringType keyname) {
assert(this->hasCustomAttribute(keyname));
//TODO: check type
return customAttributeMap[keyname].get_floatArray();
}
stringType AbstractComponent::setCustomAttribute(stringType keyname, floatArrayType faValue) {
if (this->hasCustomAttribute(keyname)) {
customAttributeMap[keyname].set(faValue);
}
else {
auto customAttribute = CustomAttribute(faValue);
customAttributeMap[keyname] = customAttribute;
}
return keyname;
}
const stringType& AbstractComponent::getCustomAttribute_string(stringType keyname) {
assert(this->hasCustomAttribute(keyname));
//TODO: check type
return customAttributeMap[keyname].get_string();
}
stringType AbstractComponent::setCustomAttribute(stringType keyname, stringType sValue) {
auto sValuePtr = new stringType(sValue);
if (this->hasCustomAttribute(keyname)) {
customAttributeMap[keyname].set(sValuePtr);
}
else {
auto customAttribute = CustomAttribute(sValuePtr);
customAttributeMap[keyname] = customAttribute;
}
return keyname;
}
void* AbstractComponent::getCustomAttribute_void(stringType keyname) {
assert(this->hasCustomAttribute(keyname));
//TODO: check type
return customAttributeMap[keyname].get_void();
}
stringType AbstractComponent::setCustomAttribute(stringType keyname, void* vValue) {
if (this->hasCustomAttribute(keyname)) {
customAttributeMap[keyname].set(vValue);
}
else {
auto customAttribute = CustomAttribute(vValue);
customAttributeMap[keyname] = customAttribute;
}
return keyname;
}
const Vector3& AbstractComponent::getCustomAttribute_vector(stringType keyname) {
assert(this->hasCustomAttribute(keyname));
return customAttributeMap[keyname].get_vector();
}
stringType AbstractComponent::setCustomAttribute(stringType keyname, Vector3 vsValue) {
if (this->hasCustomAttribute(keyname)) {
customAttributeMap[keyname].set(vsValue);
}
else {
auto customAttribute = CustomAttribute(vsValue);
customAttributeMap[keyname] = customAttribute;
}
return keyname;
}
bool AbstractComponent::hasCustomAttribute(stringType keyname) {
if (this->customAttributeMap.find(keyname) == this->customAttributeMap.end()) {
return false;
}
return true;
}
enumAttribute AbstractComponent::getCustomAttributeType(stringType keyname) {
return customAttributeMap[keyname].getType();
}
void AbstractComponent::deleteCustomAttribute(stringType keyname) {
if(this->hasCustomAttribute(keyname)) {
auto iterAttribute = this->customAttributeMap.find(keyname);
this->customAttributeMap.erase(iterAttribute);
}
}
void AbstractComponent::addChild(AbstractComponent* component) {
this->children.push_back(component);
}
AbstractComponent*
AbstractComponent::createChild(stringType name) {
auto component = new AbstractComponent(name, enumComponentFamily::ABSTRACT, false);
this->children.push_back(component);
return component;
}
bool AbstractComponent::hasChildren() {
if (this->children.empty()) {
return false;
}
return true;
}
CustomAttribute* AbstractComponent::get(stringType keyname) {
return &(customAttributeMap[keyname]);
}
void AbstractComponent::set(stringType keyname, CustomAttribute attr) {
customAttributeMap[keyname] = attr;
}
const componentContainerType* AbstractComponent::getChildContainer() {
return &this->children;
}
AbstractComponent* createAbstractComponent(
stringType name,
boolType bIsParent) {
auto abstractComponent = new AbstractComponent(
name,
enumComponentFamily::ABSTRACT,
bIsParent);
return abstractComponent;
}
| 26.625
| 99
| 0.762982
|
benzap
|
bfd8545519f23831a646f62db06fe9cf80d3cc8a
| 4,438
|
cpp
|
C++
|
src/GamePanel.cpp
|
MCRewind/Ludum-Dare-40
|
cac9d17adbba69cf3b26eb36155d002a499bdf06
|
[
"MIT"
] | null | null | null |
src/GamePanel.cpp
|
MCRewind/Ludum-Dare-40
|
cac9d17adbba69cf3b26eb36155d002a499bdf06
|
[
"MIT"
] | null | null | null |
src/GamePanel.cpp
|
MCRewind/Ludum-Dare-40
|
cac9d17adbba69cf3b26eb36155d002a499bdf06
|
[
"MIT"
] | null | null | null |
#include "GamePanel.h"
#include <string>
int keyOneState = 0;
int keyTwoState = 0;
int keyThreeState = 0;
int buyOneTime = 20;
int buyTwoTime = 20;
int buyThreeTime = 20;
GamePanel::GamePanel(Window * window, Camera * camera) : Panel(window, camera) {
state = 0;
this->window = window;
this->camera = camera;
map = new Map(window, camera, camera->getWidth() / 16, camera->getHeight() / 16);
health = new ColRect(camera, 1, 0, 0, 1, camera->getWidth() / 2 - 75, camera->getHeight() - 10, 0, 50, 10);
selected = new TexRect(camera, "res/textures/selected.png", camera->getWidth() - 40, 0, 0, 40, 40);
death = new TexRect(camera, "res/textures/death.png", camera->getWidth() / 2 - 64, camera->getHeight() / 2 - 64, 0, 128, 128);
boneSign = new TexRect(camera, "res/textures/boneSign.png", 60, 2, 0, 15, 10.5);
waves = new TexRect(camera, "res/textures/waves.png", 110, 6, 0, 21.25, 3.75);
std::vector<const char*> digitPaths =
{
"res/textures/0.png",
"res/textures/1.png",
"res/textures/2.png",
"res/textures/3.png",
"res/textures/4.png",
"res/textures/5.png",
"res/textures/6.png",
"res/textures/7.png",
"res/textures/8.png",
"res/textures/9.png",
};
digitOne = new MultiRect(camera, digitPaths, 77, 4, 0, 6, 8);
digitTwo = new MultiRect(camera, digitPaths, 87, 4, 0, 6, 8);
digitThree = new MultiRect(camera, digitPaths, 97, 4, 0, 6, 8);
waveCount = new MultiRect(camera, digitPaths, 130, 4, 0, 6, 8);
std::vector<const char*> keyOnePaths =
{
"res/textures/keyOne.png",
"res/textures/keyOnePressed.png"
};
std::vector<const char*> keyTwoPaths =
{
"res/textures/keyTwo.png",
"res/textures/keyTwoPressed.png"
};
std::vector<const char*> keyThreePaths =
{
"res/textures/keyThree.png",
"res/textures/keyThreePressed.png"
};
keyOne = new MultiRect(camera, keyOnePaths, 0, 0, 0, 16, 16);
keyTwo = new MultiRect(camera, keyTwoPaths, 20, 0, 0, 16, 16);
keyThree = new MultiRect(camera, keyThreePaths, 40, 0, 0, 16, 16);
wave = 0;
map->spawnWave(wave);
}
void GamePanel::update() {
if (map->zombies.size() <= 0)
{
wave++;
map->spawnWave(wave);
}
map->update();
health->setWidth(map->getPlayer()->getHealth());
if (window->isKeyPressed(GLFW_KEY_1))
keyOnePress();
else
keyOneState = 0;
if (window->isKeyPressed(GLFW_KEY_2))
keyTwoPress();
else
keyTwoState = 0;
if (window->isKeyPressed(GLFW_KEY_3))
keyThreePress();
else
keyThreeState = 0;
if (map->getPlayer()->getHealth() < 0)
if (window->isKeyPressed(GLFW_KEY_X))
{
GamePanel(window, camera);
}
buyOneTime > 100 ? buyOneTime = 100 : buyOneTime++;
buyTwoTime > 100 ? buyTwoTime = 100 : buyTwoTime++;
buyThreeTime > 100 ? buyThreeTime = 100 : buyThreeTime++;
/*if (window->isKeyPressed(GLFW_KEY_LEFT))
camera->translate(glm::vec3(-3, 0, 0));
if (window->isKeyPressed(GLFW_KEY_RIGHT))
camera->translate(glm::vec3(3, 0, 0));
if (window->isKeyPressed(GLFW_KEY_UP))
camera->translate(glm::vec3(0, -3, 0));
if (window->isKeyPressed(GLFW_KEY_DOWN))
camera->translate(glm::vec3(0, 3, 0));
if (window->isKeyPressed(GLFW_KEY_N))
camera->zoomi();
if (window->isKeyPressed(GLFW_KEY_M))
camera->zoomo();*/
}
void GamePanel::keyOnePress()
{
keyOneState = 1;
if (buyOneTime > 20)
{
if (map->getPlayer()->bones >= 5)
{
map->spawnBlock(1);
map->getPlayer()->bones -= 5;
buyOneTime = 0;
}
}
}
void GamePanel::keyTwoPress()
{
keyTwoState = 1;
if (buyTwoTime > 20)
{
if (map->getPlayer()->bones >= 15)
{
map->spawnBlock(2);
map->getPlayer()->bones -= 15;
buyTwoTime = 0;
}
}
}
void GamePanel::keyThreePress()
{
keyThreeState = 1;
if (buyThreeTime > 20)
{
if (map->getPlayer()->bones >= 50)
{
map->spawnBlock(3);
map->getPlayer()->bones -= 50;
buyThreeTime = 0;
}
}
}
void GamePanel::render() {
waveCount->render(wave);
waves->render();
boneSign->render();
std::string s = std::to_string(map->getPlayer()->bones);
if (s.size() > 0)
digitOne->render(s.at(0) - '0');
if (s.size() > 1)
digitTwo->render(s.at(1) - '0');
if (s.size() > 2)
digitThree->render(s.at(2) - '0');
keyOne->render(keyOneState);
keyTwo->render(keyTwoState);
keyThree->render(keyThreeState);
if (map->getPlayer()->getHealth() < 0)
death->render();
selected->render();
if (map->getPlayer()->getHealth() > 0)
health->render();
map->render();
}
void GamePanel::setActive()
{
state = 0;
}
GamePanel::~GamePanel() {
delete map;
}
| 23.73262
| 127
| 0.646462
|
MCRewind
|
bfd8c471bf8e2b3d9249588c4719e70fa46d37ed
| 837
|
cpp
|
C++
|
code/shader_light_types.cpp
|
Ihaa21/ToonShading
|
f6f8e6037273b36d57e96ab7ee109957058e1992
|
[
"MIT"
] | null | null | null |
code/shader_light_types.cpp
|
Ihaa21/ToonShading
|
f6f8e6037273b36d57e96ab7ee109957058e1992
|
[
"MIT"
] | null | null | null |
code/shader_light_types.cpp
|
Ihaa21/ToonShading
|
f6f8e6037273b36d57e96ab7ee109957058e1992
|
[
"MIT"
] | null | null | null |
struct directional_light
{
vec3 Color;
vec3 Dir;
vec3 AmbientLight;
mat4 VPTransform;
};
struct point_light
{
vec3 Color;
vec3 Pos; // NOTE: Camera Space Position
float MaxDistance; // TODO: Rename to radius
};
vec3 PointLightAttenuate(vec3 SurfacePos, point_light Light)
{
vec3 Result = vec3(0);
/*
// NOTE: This is regular attenuation model
float Distance = length(Light.Pos - SurfacePos);
float Attenuation = 1.0 / (Distance * Distance);
Result = Light.Color * Attenuation;
*/
// NOTE: This is a sorta fake attenuation model but gives a more exact sphere size
float Distance = length(Light.Pos - SurfacePos);
float PercentDist = clamp((Light.MaxDistance - Distance) / Light.MaxDistance, 0, 1);
Result = Light.Color * PercentDist;
return Result;
}
| 23.25
| 88
| 0.671446
|
Ihaa21
|
bfde7de1ca20fb0c77ea0b9dc6d8de9cdf2afce1
| 2,137
|
hpp
|
C++
|
src/common/minhook.hpp
|
PragmaTwice/proxinject
|
3de394b110301c2d04eb4bc83c1f7bbabc214531
|
[
"Apache-2.0"
] | null | null | null |
src/common/minhook.hpp
|
PragmaTwice/proxinject
|
3de394b110301c2d04eb4bc83c1f7bbabc214531
|
[
"Apache-2.0"
] | null | null | null |
src/common/minhook.hpp
|
PragmaTwice/proxinject
|
3de394b110301c2d04eb4bc83c1f7bbabc214531
|
[
"Apache-2.0"
] | null | null | null |
// Copyright 2022 PragmaTwice
//
// Licensed under the Apache License,
// Version 2.0(the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef PROXINJECT_COMMON_MINHOOK
#define PROXINJECT_COMMON_MINHOOK
#include <minhook.h>
struct minhook {
struct status {
MH_STATUS v;
status(MH_STATUS v) : v(v) {}
operator MH_STATUS() const { return v; }
bool ok() const { return v == MH_OK; }
bool error() const { return v != MH_OK; }
};
static status init() { return MH_Initialize(); }
static status deinit() { return MH_Uninitialize(); }
template <typename F> static status enable(F *api) {
return MH_EnableHook(reinterpret_cast<LPVOID>(api));
}
template <typename F> static status disable(F *api) {
return MH_DisableHook(reinterpret_cast<LPVOID>(api));
}
static constexpr inline void *all_hooks = MH_ALL_HOOKS;
static status enable() { return enable(all_hooks); }
static status disable() { return disable(all_hooks); }
template <typename F>
static status create(F *target, F *detour, F *&original) {
return MH_CreateHook(reinterpret_cast<LPVOID>(target),
reinterpret_cast<LPVOID>(detour),
reinterpret_cast<LPVOID *>(&original));
}
template <typename F> static status remove(F *target) {
return MH_RemoveHook(reinterpret_cast<LPVOID>(target));
}
template <auto syscall, typename derived> struct api {
using F = decltype(syscall);
static inline F original = nullptr;
static status create() {
return minhook::create(syscall, derived::detour, original);
}
static status remove() { return minhook::remove(syscall); }
};
};
#endif
| 28.493333
| 75
| 0.689752
|
PragmaTwice
|
bfdfe590b733a58fd999394f876eaacce78bb14f
| 1,828
|
hpp
|
C++
|
MultiDimensionalArray.hpp
|
astrowar/SuperNovaeOpenCL
|
7fd322d289f642feb4e4b8d8a09e92086c76f5e7
|
[
"MIT"
] | null | null | null |
MultiDimensionalArray.hpp
|
astrowar/SuperNovaeOpenCL
|
7fd322d289f642feb4e4b8d8a09e92086c76f5e7
|
[
"MIT"
] | null | null | null |
MultiDimensionalArray.hpp
|
astrowar/SuperNovaeOpenCL
|
7fd322d289f642feb4e4b8d8a09e92086c76f5e7
|
[
"MIT"
] | null | null | null |
#ifndef MULTIDIMENSIONALARRAY_HPP
#define MULTIDIMENSIONALARRAY_HPP
#include <utility>
#include <vector>
template < typename N>
class Interval
{
const double start;
const double end;
const double delta;
const size_t num_divs;
Interval(double _start, double _end , double _delta): start(_start),end(_end), delta(_delta), num_divs(size_t(fabs(end - start) / delta))
{
}
int i(double x )
{
int ii = (x - start) / delta;
if (ii < 0) return 0;
if (ii > num_divs-1) return num_divs-1;
return ii;
}
};
template < int N>
class MultiDimensionalArray
{
public:
std::vector< MultiDimensionalArray< N - 1> > data;
std::vector< double> x;
MultiDimensionalArray(std::vector<double> _x ) : x(std::move(_x))
{
}
};
template< > class MultiDimensionalArray<1>
{
public:
std::vector<double> data;
std::vector< double> x;
MultiDimensionalArray(std::vector<double> _x) : x(std::move(_x))
{
data.resize(x.size(), 0.0);
}
};
template < int N ,typename... Rest>
MultiDimensionalArray<N> make_mdarray(std::vector< double> x, Rest... rest)
{
if constexpr (sizeof...(rest) > 0)
{
auto m = MultiDimensionalArray<N>(x);
//m.data.reserve(x.size());
for (auto _x : x)
{
m.data.push_back(make_mdarray<N - 1>(rest...));
}
return m;
}
else
{
return MultiDimensionalArray<1>(x);
}
}
template <typename F, int N, typename... Rest>
void iterator_function( F func, MultiDimensionalArray<N> &m , Rest... rest)
{
if constexpr (N > 1)
{
for(int i =0;i<m.x.size();++i)
{
double x = m.x[i];
iterator_function(func,m.data[i], rest..., x);
}
}
else
{
for (auto x : m.x)
{
func( rest... , x );
}
}
}
//MultiDimensionalArray<1> make_mdarray(std::vector< double> x )
//{
// return MultiDimensionalArray<1>(x);
//}
#endif // MULTIDIMENSIONALARRAY_HPP
| 17.245283
| 138
| 0.640044
|
astrowar
|
bfdffb4899ad724bc8b51b47528bd63999f9b2b5
| 2,500
|
cpp
|
C++
|
cpp/library/boost/program_options.cpp
|
KaiserLancelot/Cpp-Primer
|
a4791a6765f0b6c864e8881e6a5328e2a3d68974
|
[
"MIT"
] | 2
|
2019-12-21T00:53:47.000Z
|
2020-01-01T10:36:30.000Z
|
cpp/library/boost/program_options.cpp
|
KaiserLancelot/Cpp-Primer
|
a4791a6765f0b6c864e8881e6a5328e2a3d68974
|
[
"MIT"
] | null | null | null |
cpp/library/boost/program_options.cpp
|
KaiserLancelot/Cpp-Primer
|
a4791a6765f0b6c864e8881e6a5328e2a3d68974
|
[
"MIT"
] | null | null | null |
//
// Created by kaiser on 2020/4/27.
//
#include <cstdint>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/positional_options.hpp>
#include <boost/program_options/variables_map.hpp>
int main(int argc, char* argv[]) {
try {
std::int32_t opt;
boost::program_options::options_description generic("Generic options");
generic.add_options()("version,v", "print version string")(
"help,h", "produce help message");
boost::program_options::options_description config("Configuration");
config.add_options()(
"optimization,O",
boost::program_options::value<std::int32_t>(&opt)->default_value(0),
"optimization level")(
"include-path,I",
// composing() 告诉库将来自不同位置的值合并到一起
boost::program_options::value<std::vector<std::string>>()->composing(),
"include path");
boost::program_options::options_description hidden("Hidden options");
hidden.add_options()(
"input-file", boost::program_options::value<std::vector<std::string>>(),
"input file");
boost::program_options::options_description cmdline_options;
cmdline_options.add(generic).add(config).add(hidden);
boost::program_options::options_description visible("Allowed options");
visible.add(generic).add(config);
boost::program_options::positional_options_description p;
p.add("input-file", -1);
boost::program_options::variables_map vm;
store(boost::program_options::command_line_parser(argc, argv)
.options(cmdline_options)
.positional(p)
.run(),
vm);
notify(vm);
if (vm.contains("help")) {
std::cout << visible << "\n";
return EXIT_SUCCESS;
}
if (opt != 0) {
std::cout << "optimization: " << opt << '\n';
}
if (vm.contains("include-path")) {
std::cout << "include-path: " << '\n';
for (const auto& item :
vm["include-path"].as<std::vector<std::string>>()) {
std::cout << item << '\n';
}
}
if (vm.contains("input-file")) {
std::cout << "input-file: " << '\n';
for (const auto& item : vm["input-file"].as<std::vector<std::string>>()) {
std::cout << item << '\n';
}
}
} catch (const std::exception& err) {
std::cerr << err.what() << "\n";
return EXIT_FAILURE;
}
}
| 29.761905
| 80
| 0.6184
|
KaiserLancelot
|
bfe5d64bcf1ad3b32a9d06e5260bf4592f089e62
| 5,325
|
cpp
|
C++
|
src/coreclr/src/ToolBox/superpmi/superpmi-shared/hash.cpp
|
swaroop-sridhar/runtime
|
d0efddd932f6fb94c3e9436ab393fc390c7b2da9
|
[
"MIT"
] | 28
|
2021-02-08T01:22:52.000Z
|
2022-01-19T08:01:48.000Z
|
src/coreclr/src/ToolBox/superpmi/superpmi-shared/hash.cpp
|
swaroop-sridhar/runtime
|
d0efddd932f6fb94c3e9436ab393fc390c7b2da9
|
[
"MIT"
] | 2
|
2020-06-06T09:07:48.000Z
|
2020-06-06T09:13:07.000Z
|
src/coreclr/src/ToolBox/superpmi/superpmi-shared/hash.cpp
|
swaroop-sridhar/runtime
|
d0efddd932f6fb94c3e9436ab393fc390c7b2da9
|
[
"MIT"
] | 4
|
2021-05-27T08:39:33.000Z
|
2021-06-24T09:17:05.000Z
|
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
//----------------------------------------------------------
// hash.cpp - Class for hashing a text stream using MD5 hashing
//
// Note that on Windows, acquiring the Crypto hash provider is expensive, so
// only do that once and cache it.
//----------------------------------------------------------
#include "standardpch.h"
#include "runtimedetails.h"
#include "errorhandling.h"
#include "md5.h"
#include "hash.h"
Hash::Hash()
#ifndef TARGET_UNIX
: m_Initialized(false)
, m_hCryptProv(NULL)
#endif // !TARGET_UNIX
{
}
Hash::~Hash()
{
Destroy(); // Ignoring return code.
}
// static
bool Hash::Initialize()
{
#ifdef TARGET_UNIX
// No initialization necessary.
return true;
#else // !TARGET_UNIX
if (m_Initialized)
{
LogError("Hash class has already been initialized");
return false;
}
// Get handle to the crypto provider
if (!CryptAcquireContextA(&m_hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
goto OnError;
m_Initialized = true;
return true;
OnError:
LogError("Failed to create a hash using the Crypto API (Error 0x%X)", GetLastError());
if (m_hCryptProv != NULL)
CryptReleaseContext(m_hCryptProv, 0);
m_Initialized = false;
return false;
#endif // !TARGET_UNIX
}
// static
bool Hash::Destroy()
{
#ifdef TARGET_UNIX
// No destruction necessary.
return true;
#else // !TARGET_UNIX
// Should probably check Crypt() function return codes.
if (m_hCryptProv != NULL)
{
CryptReleaseContext(m_hCryptProv, 0);
m_hCryptProv = NULL;
}
m_Initialized = false;
return true;
#endif // !TARGET_UNIX
}
// Hash::WriteHashValueAsText - Take a binary hash value in the array of bytes pointed to by
// 'pHash' (size in bytes 'cbHash'), and write an ASCII hexadecimal representation of it in the buffer
// 'hashTextBuffer' (size in bytes 'hashTextBufferLen').
//
// Returns true on success, false on failure (only if the arguments are bad).
bool Hash::WriteHashValueAsText(const BYTE* pHash, size_t cbHash, char* hashTextBuffer, size_t hashTextBufferLen)
{
// This could be:
//
// for (DWORD i = 0; i < MD5_HASH_BYTE_SIZE; i++)
// {
// sprintf_s(hash + i * 2, hashLen - i * 2, "%02X", bHash[i]);
// }
//
// But this function is hot, and sprintf_s is too slow. This is a specialized function to speed it up.
if (hashTextBufferLen < 2 * cbHash + 1) // 2 characters for each byte, plus null terminator
{
LogError("WriteHashValueAsText doesn't have enough space to write the output");
return false;
}
static const char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
char* pCur = hashTextBuffer;
for (size_t i = 0; i < cbHash; i++)
{
unsigned digit = pHash[i];
unsigned lowNibble = digit & 0xF;
unsigned highNibble = digit >> 4;
*pCur++ = hexDigits[highNibble];
*pCur++ = hexDigits[lowNibble];
}
*pCur++ = '\0';
return true;
}
// Hash::HashBuffer - Compute an MD5 hash of the data pointed to by 'pBuffer', of 'bufLen' bytes,
// writing the hexadecimal ASCII text representation of the hash to the buffer pointed to by 'hash',
// of 'hashLen' bytes in size, which must be at least MD5_HASH_BUFFER_SIZE bytes.
//
// Returns the number of bytes written, or -1 on error.
int Hash::HashBuffer(BYTE* pBuffer, size_t bufLen, char* hash, size_t hashLen)
{
#ifdef TARGET_UNIX
MD5HASHDATA md5_hashdata;
MD5 md5_hasher;
if (hashLen < MD5_HASH_BUFFER_SIZE)
return -1;
md5_hasher.Hash(pBuffer, (ULONG)bufLen, &md5_hashdata);
DWORD md5_hashdata_size = sizeof(md5_hashdata.rgb) / sizeof(BYTE);
Assert(md5_hashdata_size == MD5_HASH_BYTE_SIZE);
if (!WriteHashValueAsText(md5_hashdata.rgb, md5_hashdata_size, hash, hashLen))
return -1;
return MD5_HASH_BUFFER_SIZE; // if we had success we wrote MD5_HASH_BUFFER_SIZE bytes to the buffer
#else // !TARGET_UNIX
if (!m_Initialized)
{
LogError("Hash class not initialized");
return -1;
}
HCRYPTHASH hCryptHash;
BYTE bHash[MD5_HASH_BYTE_SIZE];
DWORD cbHash = MD5_HASH_BYTE_SIZE;
if (hashLen < MD5_HASH_BUFFER_SIZE)
return -1;
if (!CryptCreateHash(m_hCryptProv, CALG_MD5, 0, 0, &hCryptHash))
goto OnError;
if (!CryptHashData(hCryptHash, pBuffer, (DWORD)bufLen, 0))
goto OnError;
if (!CryptGetHashParam(hCryptHash, HP_HASHVAL, bHash, &cbHash, 0))
goto OnError;
if (cbHash != MD5_HASH_BYTE_SIZE)
goto OnError;
if (!WriteHashValueAsText(bHash, cbHash, hash, hashLen))
return -1;
// Clean up.
CryptDestroyHash(hCryptHash);
hCryptHash = NULL;
return MD5_HASH_BUFFER_SIZE; // if we had success we wrote MD5_HASH_BUFFER_SIZE bytes to the buffer
OnError:
LogError("Failed to create a hash using the Crypto API (Error 0x%X)", GetLastError());
if (hCryptHash != NULL)
{
CryptDestroyHash(hCryptHash);
hCryptHash = NULL;
}
return -1;
#endif // !TARGET_UNIX
}
| 26.625
| 119
| 0.640376
|
swaroop-sridhar
|
bfed30eb3fcd79467864bbd129d8632444fe54bc
| 906
|
cpp
|
C++
|
1_gestion_proyectos/src/central.cpp
|
antcc/practicas-mp
|
20496b899bdb2af87aa3fbef2f972d3bd1989c1c
|
[
"MIT"
] | 2
|
2017-03-19T22:33:44.000Z
|
2018-01-30T20:25:12.000Z
|
1_gestion_proyectos/src/central.cpp
|
antcc/practicas-mp
|
20496b899bdb2af87aa3fbef2f972d3bd1989c1c
|
[
"MIT"
] | 6
|
2016-03-15T14:46:39.000Z
|
2016-04-13T17:50:17.000Z
|
1_gestion_proyectos/src/central.cpp
|
antcc/practicas-mp
|
20496b899bdb2af87aa3fbef2f972d3bd1989c1c
|
[
"MIT"
] | 3
|
2016-03-11T15:54:31.000Z
|
2019-11-06T01:56:30.000Z
|
/**
* @file central.cpp
* @brief Calcula círculo con centro en medio de dos círculos y radio la mitad de la distancia
* @author Agarrido
*
* Un ejemplo de ejecución es:
* Introduzca un circulo en formato radio-(x,y): 3-(0,0)
* Introduzca otro circulo: 4-(5,0)
* El círculo que pasa por los dos centros es: 2.5-(2.5,0)
*/
#include <iostream>
#include "circle.h"
using namespace std;
int main()
{
Circle c1,c2;
do
{
cout << "Introduzca un circulo en formato radio-(x,y): ";
c1 = ReadCircle();
cout << "Introduzca otro circulo: ";
c2 = ReadCircle();
} while ( Distance( GetCenter( c1 ), GetCenter( c2 ) ) == 0 );
Circle res;
InitCircle( res, MiddlePoint( GetCenter( c1 ), GetCenter( c2 ) ),
Distance( GetCenter( c1 ), GetCenter( c2 ) ) / 2 );
cout << "El círculo que pasa por los dos centros es: ";
WriteCircle( res );
cout << endl;
}
| 24.486486
| 95
| 0.618102
|
antcc
|
bfed9448d265f2b453f58869b659b3270cc6b1c1
| 44
|
cpp
|
C++
|
SRC/GekkoCore/JitcX86/JitcInteger.cpp
|
ogamespec/dolwin
|
7aaa864f9070ec14193f39f2e387087ccd5d0a93
|
[
"CC0-1.0"
] | 107
|
2015-09-07T21:28:32.000Z
|
2022-02-14T03:13:01.000Z
|
SRC/GekkoCore/JitcX86/JitcInteger.cpp
|
emu-russia/dolwin
|
7aaa864f9070ec14193f39f2e387087ccd5d0a93
|
[
"CC0-1.0"
] | 116
|
2020-03-11T16:42:02.000Z
|
2021-05-27T17:05:40.000Z
|
SRC/GekkoCore/JitcX86/JitcInteger.cpp
|
ogamespec/dolwin
|
7aaa864f9070ec14193f39f2e387087ccd5d0a93
|
[
"CC0-1.0"
] | 8
|
2017-05-18T21:01:19.000Z
|
2021-04-30T11:28:14.000Z
|
// Integer Instructions
#include "../pch.h"
| 14.666667
| 23
| 0.681818
|
ogamespec
|
bfef2e950f0dd234a9e947041efd41525a4daa62
| 1,945
|
cpp
|
C++
|
trainingregional2018/training1/H.cpp
|
Victoralin10/ACMSolutions
|
6d6e50da87b2bc455e953629737215b74b10269c
|
[
"MIT"
] | null | null | null |
trainingregional2018/training1/H.cpp
|
Victoralin10/ACMSolutions
|
6d6e50da87b2bc455e953629737215b74b10269c
|
[
"MIT"
] | null | null | null |
trainingregional2018/training1/H.cpp
|
Victoralin10/ACMSolutions
|
6d6e50da87b2bc455e953629737215b74b10269c
|
[
"MIT"
] | null | null | null |
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define CLR(t, value) memset(t, value, sizeof(t))
#define ALL(v) v.begin(), v.end()
#define SZ(v) ((int)(v).size())
#define TEST(x) cerr << "test " << #x << " " << x << endl;
#define sc(x) scanf("%d", &x)
using namespace std;
typedef long long Long;
typedef vector<int> vInt;
typedef pair<int,int> Pair;
const int N = 1e5 + 2;
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const double EPS = 1e-8;
void fast_io() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
}
/************************************/
void smod(int &a, int v) {
a += v;
if (a>= MOD) a -= MOD;
}
vector<Pair> G[N];
int A[N], C[N], S[N], SS[N];
void pre(int node, int parent, int w) {
C[node] = 1;
for (auto &p: G[node]) {
if (p.first == parent) continue;
pre(p.first, node, p.second);
C[node] += C[p.first];
}
S[node] = ((Long)w*C[node])%MOD;
SS[node] = S[node];
for (auto &p: G[node]) {
if (p.first == parent) continue;
smod(SS[node], SS[p.first]);
}
}
void solve(int node, int parent) {
A[node] = 0;
for (auto &p: G[node]) {
if (p.first == parent) continue;
solve(p.first, node);
smod(A[node], A[p.first]);
smod(A[node], ((Long)SS[p.first]*(C[node] - C[p.first])) % MOD);
}
}
int main() {
fast_io();
int t, n=0, u, v, w;
cin>>t;
REP(caso, t) {
REP(i,n+1) G[i].clear();
cin>>n;
FOR(i,1,n) {
cin>>u>>v>>w;
G[u].push_back({v, w});
G[v].push_back({u, w});
}
pre(1, -1, 0);
solve(1, -1);
int ans=0;
REP(i,n) {
smod(ans, A[i+1]);
//cerr<<A[i+1]<<" ";
}
//cerr<<endl;
cout << "Case "<<caso+1<<": "<<ans<<endl;
}
return 0 ;
}
| 20.913978
| 72
| 0.462725
|
Victoralin10
|
bffc22fa97a3105c5c606529d88d6839cbb1532b
| 9,339
|
cpp
|
C++
|
src/EquationSet.cpp
|
gjo11/causaloptim
|
81155ff1aeef5cd2618f2498ba6b779d5a944cff
|
[
"MIT"
] | 13
|
2019-11-28T16:33:10.000Z
|
2021-12-10T12:03:35.000Z
|
src/EquationSet.cpp
|
gjo11/causaloptim
|
81155ff1aeef5cd2618f2498ba6b779d5a944cff
|
[
"MIT"
] | 8
|
2020-05-04T14:32:49.000Z
|
2021-12-09T13:10:07.000Z
|
src/EquationSet.cpp
|
gjo11/causaloptim
|
81155ff1aeef5cd2618f2498ba6b779d5a944cff
|
[
"MIT"
] | 3
|
2020-04-22T23:18:06.000Z
|
2020-12-10T09:32:05.000Z
|
//#include <afx.h>
#include <windows.h>
#include <stdio.h>
#include <math.h>
#include "CustomFormat.h"
#include "SymbolSet.h"
#include "Equation.h"
#include "EquationSet.h"
#define VAR_NOT_ELIMINATED ((WORD) 0xFFFF)
#define VAR_ELIMINATED ((WORD) 0xFFFE)
CEquationSet_ :: CEquationSet_
(
CSymbolSet_ * p_pVariables,
CSymbolSet_ * p_pParameters,
WORD p_EqnCount
)
{
WORD nEqn;
m_Count = p_EqnCount;
m_pVariables = p_pVariables;
m_pParameters = p_pParameters;
m_pEquations = new CEquation_ [m_Count];
for (nEqn = 0; nEqn < m_Count; nEqn++)
m_pEquations [nEqn]. Initialize (m_pVariables, m_pParameters);
} /* CEquationSet_ :: CEquationSet_ () */
CEquationSet_ :: ~CEquationSet_ ()
{
if (m_pEquations)
{
delete [] m_pEquations;
m_pEquations = NULL;
}
} /* CEquationSet_ :: ~CEquationSet_ () */
CEquationSet_ * CEquationSet_ :: Duplicate ()
{
CEquationSet_ * pEquationSet;
WORD nEqn;
pEquationSet = new CEquationSet_ (m_pVariables,
m_pParameters,
m_Count);
for (nEqn = 0; nEqn < m_Count; nEqn++)
pEquationSet-> m_pEquations [nEqn]. Copy (& m_pEquations [nEqn]);
return pEquationSet;
} /* CEquationSet_ :: Duplicate () */
#ifdef JUNK
CSymbolSet_ * CEquationSet_ :: EliminateVariables ()
{
WORD nEqn;
// Index of the current equation set.
WORD EqualityCnt;
// Number of equations of type equality;
WORD nEquality;
// Index into the equality equation set.
WORD nInequality;
// Index into the inequality equation set.
WORD nRemainingVar;
// Index into the remaining-variable symbol set.
WORD nVar;
// Index into the variable symbol set.
WORD Rank;
// Rank of the set of equalities.
WORD * pElimVarToEquality;
// Array that maps eliminated variables to the
// equality used to substitute out that
// variable. Allocated.
// A value of VAR_NOT_ELIMINATED if a variable
// is not to be eliminated.
CSymbolSet_ * pRemainingVariables;
// Set of all variables not eliminated.
// Allocated.
CEquationSet_ * pEqualitySet;
// Equation set consisting of only equalities.
// Allocated.
CEquationSet_ * pInequalitySet;
// Final equation set that contains only
// inequalities. Allocated.
CEquation_ * pWorkEqn;
// Copy of original equation for performing
// linear operations. Allocated.
CEquation_ * pEquality;
// Reference to equation within the equality set.
CEquation_ * pInequality;
// Reference to equation within the inequality set.
CEquation_ * pEquation;
// Reference to equation within the original equation set.
/****************************************************
* Create a set of equations consisting only of those
* equations in the current set that are equalities.
***************************************************/
/*
* Determine how many equalities exist.
*/
EqualityCnt = 0;
for (nEqn = 0; nEqn < m_Count; nEqn++)
{
pEquation = & m_pEquations [nEqn];
if (pEquation-> m_RelationToZero == RTZ_Equal)
EqualityCnt++;
}
/*
* Create a new equation set consisting of the equality
* equations.
*/
pEqualitySet = new CEquationSet_ (m_pVariables,
m_pParameters,
EqualityCnt);
nEquality = 0;
for (nEqn = 0; nEqn < m_Count; nEqn++)
{
pEquation = & m_pEquations [nEqn];
if (pEquation-> m_RelationToZero == RTZ_Equal)
{
pEquality = & pEqualitySet-> m_pEquations [nEquality];
pEquality-> Copy (pEquation);
nEquality++;
}
}
if (! pEqualitySet-> GaussianElimination ())
return NULL;
/*
* Set up the relationship between variables to be eliminated
* and the equality used to substitute out those variables.
*/
pElimVarToEquality = new WORD [m_pVariables-> Count ()];
for (nVar = 0; nVar < m_pVariables-> Count (); nVar++)
pElimVarToEquality [nVar] = VAR_NOT_ELIMINATED;
nEquality = 0;
for (nVar = 0; nVar < m_pVariables-> Count (); nVar++)
{
if (nEquality >= pEqualitySet-> m_Count)
break;
pEquality = & pEqualitySet-> m_pEquations [nEquality];
if (Approx(pEquality-> m_pVarCoefs [nVar],
1.0, LEEWAY))
{
pElimVarToEquality [nVar] = nEquality;
nEquality++;
}
}
Rank = nEquality;
/*****************************************************************
* Build a new symbol set for all variables that were not
* eliminated.
****************************************************************/
pRemainingVariables = new CSymbolSet_ (
m_pVariables-> Count () - Rank);
nRemainingVar = 0;
for (nVar = 0; nVar < m_pVariables-> Count (); nVar++)
{
if (pElimVarToEquality [nVar] == VAR_NOT_ELIMINATED)
{
pRemainingVariables-> Assign (nRemainingVar,
m_pVariables-> GetName (nVar));
nRemainingVar++;
}
}
/*****************************************************************
* Build a new equation set by (1) eliminating all equalities from
* the original set, and (2) substituting out all eliminated
* variables (Because all variables are implicitly >= 0, add new
* inequalities for each removed variable corresponding to this
* constraint).
****************************************************************/
pInequalitySet = new CEquationSet_ (pRemainingVariables,
m_pParameters,
m_Count - EqualityCnt + Rank);
/*
* Copy the old inequalities, substituting out the eliminated variables.
*/
pWorkEqn = new CEquation_ (m_pVariables, m_pParameters);
nInequality = 0;
for (nEqn = 0; nEqn < m_Count; nEqn++)
{
pEquation = & m_pEquations [nEqn];
if (pEquation-> m_RelationToZero != RTZ_Equal)
{
pWorkEqn-> Copy (pEquation);
for (nVar = 0; nVar < m_pVariables-> Count (); nVar++)
{
if (pElimVarToEquality [nVar] != VAR_NOT_ELIMINATED)
{
nEquality = pElimVarToEquality [nVar];
pEquality = & pEqualitySet-> m_pEquations [nEquality];
pWorkEqn-> FactorAdd (pEquality,
- pWorkEqn-> m_pVarCoefs [nVar]);
}
}
/*
* Copy the reduced equation into the inequality set.
*/
pInequality = & pInequalitySet-> m_pEquations [nInequality];
if (pInequality-> Projection (pWorkEqn) == ProjectDataLoss)
Rprintf ("ERROR: non-zero coefficient for an eliminated variable.\n");
nInequality++;
}
}
/*
* Create inequalities corresponding to the implicit constraint that all
* eliminated variables must have been greater than or equal to zero.
*/
for (nVar = 0; nVar < m_pVariables-> Count (); nVar++)
{
nEquality = pElimVarToEquality [nVar];
if (nEquality != VAR_NOT_ELIMINATED)
{
pEquality = & pEqualitySet-> m_pEquations [nEquality];
pInequality = & pInequalitySet-> m_pEquations [nInequality];
/*
* Projection will drop the coefficient of the eliminated variable.
* Since that variable was >= 0, the rest of the equality must be
* <= 0;
*/
pInequality-> Projection (pEquality);
pInequality-> m_RelationToZero = RTZ_EqualOrLess;
nInequality++;
}
}
if (pWorkEqn)
{
delete pWorkEqn;
pWorkEqn = NULL;
}
if (pEqualitySet)
{
delete pEqualitySet;
pEqualitySet = NULL;
}
if (pElimVarToEquality)
{
delete [] pElimVarToEquality;
pElimVarToEquality = NULL;
}
/*
* The original array of equations for this set will be replaced
* by the generated set of inequalities.
*/
if (m_pEquations)
{
delete m_pEquations;
m_pEquations = NULL;
}
m_pEquations = pInequalitySet-> m_pEquations;
pInequalitySet-> m_pEquations = NULL;
if (pInequalitySet)
{
delete pInequalitySet;
pInequalitySet = NULL;
}
return pRemainingVariables;
} /* CEquationSet_ :: EliminateVariables () */
BOOL CEquationSet_ :: GaussianElimination ()
{
int nRow;
int nEqn;
int nVar;
int MaxRow;
double MaxAbs;
double FTemp;
/****************************************************
* All equations must be equalities.
***************************************************/
for (nEqn = 0; nEqn < m_Count; nEqn++)
if (m_pEquations [nEqn]. m_RelationToZero != RTZ_Equal)
return FALSE;
/****************************************************
* Diagonalize over all columns representing the
* variable symbol coefficients.
***************************************************/
nVar = 0;
for (nEqn = 0; nEqn < m_Count; nEqn++)
{
if (Approx (m_pEquations [nEqn]. m_pVarCoefs [nVar],
0.0, LEEWAY))
{
/*******************************************
* Make sure the pivot element is not zero.
******************************************/
MaxRow = -1;
while (MaxRow < 0)
{
MaxAbs = 0.0;
for (nRow = nEqn; nRow < m_Count; nRow++)
{
FTemp = m_pEquations [nRow]. m_pVarCoefs [nVar];
FTemp = fabs (FTemp);
if (FTemp > MaxAbs)
{
MaxRow = nRow;
MaxAbs = FTemp;
}
}
if (MaxRow < 0)
{
nVar++;
if (nVar >= m_pVariables-> Count ())
return TRUE;
continue;
}
}
m_pEquations [nEqn]. FactorAdd (& m_pEquations [MaxRow], 1.0);
}
m_pEquations [nEqn]. Divide (m_pEquations [nEqn]. m_pVarCoefs [nVar]);
for (nRow = 0; nRow < m_Count; nRow++)
{
if (nRow != nEqn)
m_pEquations [nRow]. FactorAdd (
& m_pEquations [nEqn],
- m_pEquations [nRow]. m_pVarCoefs [nVar]);
}
nVar++;
}
return TRUE;
} /* CEquationSet_ :: GaussianElimination () */
#endif // JUNK
| 24.641161
| 74
| 0.613663
|
gjo11
|
bffe4a9cb95f40aaf3031addca697e5da918be28
| 3,213
|
cpp
|
C++
|
semana1/E.cpp
|
AllanNozomu/MC521
|
92e44eaee36b6adf4c4655e3b32d3ca2948ee03a
|
[
"MIT"
] | null | null | null |
semana1/E.cpp
|
AllanNozomu/MC521
|
92e44eaee36b6adf4c4655e3b32d3ca2948ee03a
|
[
"MIT"
] | null | null | null |
semana1/E.cpp
|
AllanNozomu/MC521
|
92e44eaee36b6adf4c4655e3b32d3ca2948ee03a
|
[
"MIT"
] | null | null | null |
bool debug = false;
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<bitset>
#include<set>
#include<string>
#include<iostream>
#include<algorithm>
#include<map>
#include<unordered_map>
#include<stdlib.h>
#include<string.h>
#include<stdio.h>
#include<math.h>
#include<time.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vector<int>> vvi;
typedef unordered_map<int, int> umap_ii;
typedef unordered_map<int, pii> umap_ipii;
typedef unordered_map<int, string> umap_is;
#define mkp(a,b) make_pair(a,b)
#define spc " "
#define all(container) container.begin(), container.end()
void print_pair(const pii & par){
cout << "(" << par.first << spc << par.second << ")" << spc;
}
template <typename C>
void print_array(const C &data, int n){
if (!debug) return;
cout << "[DEBUG] " << endl;
for (int i = 0; i < n; ++i){
cout << data[i] << spc;
}
cout << endl;
}
template <typename C>
void print_container(const C &data){
if (!debug) return;
cout << "[DEBUG] " << endl;
for (const auto &v : data){
cout << v << spc;
}
cout << endl;
}
template <typename C>
void print_pairs(const C &data){
if (!debug) return;
cout << "[DEBUG] " << endl;
for (const auto &v : data){
print_pair(v);
}
cout << endl;
}
template <typename C>
void print_matrix(const C &data){
if (!debug) return;
cout << "[DEBUG] " << endl;
for (const auto &row : data){
for (const auto &v : row){
cout << v << spc;
} cout << endl;
}
cout << endl;
}
#define MAX 100000
#define LOGMAX 18
int query(const int matrix[MAX][LOGMAX], const ll data[MAX], int qs, int qe){
int k = (int)log2(qe - qs + 1);
if (data[matrix[qs][k]] < data[matrix[qe - (1 << k) + 1][k]])
return matrix[qs][k];
return matrix[qe - (1 << k) + 1][k];
}
void pre_process(int matrix[MAX][LOGMAX], const ll data[MAX], int n){
for (int i = 0 ; i < n; ++i){
matrix[i][0] = i;
}
for (int j = 1; (1 << j) <= n; ++j){
for (int i = 0; i + (1 << j) - 1 < n; ++i){
if (data[matrix[i][j-1]] < data[matrix[i + (1 << j - 1)][j-1]]){
matrix[i][j] = matrix[i][j-1];
} else {
matrix[i][j] = matrix[i + (1 << j - 1)][j-1];
}
}
}
}
ll process(int matrix[MAX][LOGMAX], const ll data[MAX], int qs, int qe){
if (qs > qe){
return 0;
}
if (qs == qe){
return data[qs];
}
int mid = query(matrix, data, qs, qe);
ll now = data[mid] * (qe - qs + 1);
ll esq = process(matrix, data, qs, mid - 1);
ll dir = process(matrix, data, mid + 1, qe);
return max({now, dir, esq});
}
int main()
{
std::ios::sync_with_stdio(false);
cin.tie(NULL);
ll data[MAX];
int matrix[MAX][LOGMAX];
int n;
cin >> n;
while(n > 0){
for (int i = 0 ; i < n; ++i){
cin >> data[i];
}
pre_process(matrix, data, n);
cout << process(matrix, data, 0, n - 1) << endl;
cin >> n;
}
}
| 22.3125
| 77
| 0.540305
|
AllanNozomu
|
8700a75d7725b91ba46ff1f6be19a7e88575bff5
| 704
|
cpp
|
C++
|
Code/Engine/Renderer/IndexBuffer.cpp
|
yixuan-wei/PersonalEngine
|
6f3b1df3ddeb662fbf65ca8b3ea7ddb446ef5a20
|
[
"MIT"
] | 1
|
2021-06-11T06:41:29.000Z
|
2021-06-11T06:41:29.000Z
|
Code/Engine/Renderer/IndexBuffer.cpp
|
yixuan-wei/PersonalEngine
|
6f3b1df3ddeb662fbf65ca8b3ea7ddb446ef5a20
|
[
"MIT"
] | 1
|
2022-02-25T07:46:54.000Z
|
2022-02-25T07:46:54.000Z
|
Code/Engine/Renderer/IndexBuffer.cpp
|
yixuan-wei/PersonalEngine
|
6f3b1df3ddeb662fbf65ca8b3ea7ddb446ef5a20
|
[
"MIT"
] | null | null | null |
#include "Engine/Renderer/IndexBuffer.hpp"
//////////////////////////////////////////////////////////////////////////
IndexBuffer::IndexBuffer(RenderContext* ctx, eRenderMemoryHint hint)
:RenderBuffer(ctx,INDEX_BUFFER_BIT,hint)
{
}
//////////////////////////////////////////////////////////////////////////
void IndexBuffer::Update(std::vector<unsigned int> const& indices)
{
Update((unsigned int)indices.size(), &indices[0]);
}
//////////////////////////////////////////////////////////////////////////
void IndexBuffer::Update(unsigned int iCount, unsigned int const* indices)
{
m_count = iCount;
RenderBuffer::Update(indices, iCount * sizeof(unsigned int), sizeof(unsigned int));
}
| 33.52381
| 87
| 0.507102
|
yixuan-wei
|
870fe268a7302179531faf63d726107929c090f0
| 7,843
|
hpp
|
C++
|
src/open_viii/graphics/Ppm.hpp
|
Sebanisu/VIIIcppTest
|
59565ae2d32ea302401402544a70d3b37fab7351
|
[
"MIT"
] | 2
|
2020-04-30T22:12:06.000Z
|
2020-05-01T07:06:26.000Z
|
src/open_viii/graphics/Ppm.hpp
|
Sebanisu/VIIIcppTest
|
59565ae2d32ea302401402544a70d3b37fab7351
|
[
"MIT"
] | 9
|
2020-04-26T01:52:21.000Z
|
2020-05-20T21:10:28.000Z
|
src/open_viii/graphics/Ppm.hpp
|
Sebanisu/VIIIcppTest
|
59565ae2d32ea302401402544a70d3b37fab7351
|
[
"MIT"
] | null | null | null |
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef VIIIARCHIVE_PPM_HPP
#define VIIIARCHIVE_PPM_HPP
#include "Color.hpp"
#include "open_viii/Concepts.hpp"
#include "open_viii/tools/Tools.hpp"
#include "Point.hpp"
#include <execution>
namespace open_viii::graphics {
struct Ppm
{
private:
std::filesystem::path m_path{};
Point<std::uint16_t> m_width_height{};
std::vector<Color24<ColorLayoutT::RGB>> m_colors{};
Point<std::uint16_t>
get_width_height(const std::string &buffer)
{
Point<std::uint16_t> point{};
// the support is mostly limited to the same type that is made by the save
// function. I can't use span because span_stream does not exist yet it
// missed cpp20... so this will need to be a string stream? I know not to
// use std::regex but i'm feeling like that's better than what I'm doing
// here. heh.
// sample header ss << "P6\n# THIS IS A COMMENT\n" << width << " " << height
// << "\n255\n"; sample header ss << "P6\n# THIS IS A COMMENT\n" << width <<
// " " << height << " 255\n";
auto ss = std::stringstream(buffer);
std::string line{};
std::string type{};
std::string comment{};
std::string w_h{};
std::string bytesize{};
while ((std::ranges::empty(bytesize) || std::ranges::empty(w_h))
&& std::getline(ss, line)) {
if (line == "P6") {
type = line;
continue;
}
if (line[0] == '#') {
comment += line;
continue;
}
if (line == "255") {
bytesize = line;
continue;
}
if ([&line, &point, &bytesize]() -> bool {
const auto count = std::ranges::count(line, ' ');
std::uint16_t width{};
std::uint16_t height{};
if (count == 1) {// 000 000\n000
auto lss = std::stringstream(line);
lss >> width;
lss >> height;
}
else if (count == 2) {// 000 000 000
auto lss = std::stringstream(line);
lss >> width;
lss >> height;
lss >> bytesize;
}
point.x(width);
point.y(height);
return width > 0 || height > 0;
}()) {
w_h = line;
continue;
}
}
const auto start = ss.tellg();
ss.seekg(0, std::ios::end);
const auto end = ss.tellg();
const auto sz = static_cast<std::size_t>(end - start)
/ sizeof(Color24<ColorLayoutT::RGB>);
if (sz != point.area()) {
std::cerr << m_path << "\n\t" << sz << " != area of " << point
<< std::endl;
// assert(sz == m_width_height.area());
return {};// instead of throwing reset the value and quit.
}
return point;
}
auto
get_colors(std::span<const char> buffer_span)
{
std::vector<Color24<ColorLayoutT::RGB>> colors{};
const auto area = m_width_height.area();
static constexpr auto color_size = sizeof(Color24<ColorLayoutT::RGB>);
const auto size_of_bytes = area * color_size;
if (area > 0 && std::ranges::size(buffer_span) > size_of_bytes) {
buffer_span = buffer_span.subspan(
std::ranges::size(buffer_span) - size_of_bytes,
size_of_bytes);
colors.resize(area);
std::memcpy(
std::ranges::data(colors),
std::ranges::data(buffer_span),
size_of_bytes);
}
return colors;
}
public:
Ppm() = default;
explicit Ppm(const std::filesystem::path &path)
: Ppm(tools::read_entire_file<std::string>(path), path)
{}
explicit Ppm(const std::string &buffer, std::filesystem::path path = {})
: m_path(std::move(path)), m_width_height(get_width_height(buffer)),
m_colors(get_colors(buffer))
{}
bool
empty() const noexcept
{
return std::ranges::empty(m_colors) || m_width_height.x() <= 0
|| m_width_height.y() <= 0;
}
template<std::ranges::contiguous_range cT>
static void
save(
const cT &data,
std::size_t width,
std::size_t height,
const std::string_view &input,
bool skip_check = false)
{// how do i make the concept reject ranges that aren't of Colors? I'm at
// least checking for Color down below.
if (!skip_check) {
bool are_colors_all_black = check_if_colors_are_black(data);
if (
width == 0 || height == 0 || std::ranges::empty(data)
|| are_colors_all_black) {
return;
}
}
const std::string filename = [&]() {
if (!open_viii::tools::i_ends_with(input, ".ppm")) {
auto tmp = std::filesystem::path(input);
std::string local_filename{ (tmp.parent_path() / tmp.stem()).string() };
if (tmp.has_extension()) {
local_filename += "_" + tmp.extension().string().substr(1);
}
local_filename += ".ppm";
return local_filename;
}
return std::string{ input };
}();
if (std::ranges::size(data) < width * height) {
std::cout << std::ranges::size(data) << ", " << width << '*' << height
<< '=' << width * height << '\n';
return;
}
tools::write_buffer(
[&data, &width, &height](std::ostream &ss) {
ss << "P6\n# THIS IS A COMMENT\n"
<< width << " " << height << "\n255\n";
for (const Color auto &color :
data) {// organize the data in ram first then write all at once.
ss << color.r();
ss << color.g();
ss << color.b();
}
},
filename);
}
static bool
check_if_colors_are_black(const auto &data)
{
return std::all_of(
std::execution::par_unseq,
data.begin(),
data.end(),
[](const Color auto &color) -> bool {
return color.a() == 0U
|| (color.b() == 0U && color.g() == 0U && color.r() == 0U);
});
}
[[nodiscard]] const std::vector<Color24<ColorLayoutT::RGB>> &
colors() const noexcept
{
return m_colors;
}
[[nodiscard]] constexpr auto
width() const noexcept
{
return m_width_height.x();
}
[[nodiscard]] constexpr auto
height() const noexcept
{
return m_width_height.y();
}
[[nodiscard]] const auto &
width_height() const noexcept
{
return m_width_height;
}
[[nodiscard]] const Color24<ColorLayoutT::RGB> &
color(const std::size_t &x, const std::size_t &y) const noexcept
{
return at(x + (y * static_cast<std::size_t>(m_width_height.x())));
}
[[nodiscard]] const Color24<ColorLayoutT::RGB> &
at(const size_t i) const noexcept
{
static constexpr Color24<ColorLayoutT::RGB> black{};
if (i < std::ranges::size(m_colors)) {
return m_colors[i];
}
return black;
}
[[nodiscard]] const std::filesystem::path &
path() const noexcept
{
return m_path;
}
};
inline std::ostream &
operator<<(std::ostream &os, const Ppm &ppm)
{
return os << "(Width, Height): " << ppm.width_height() << "\t" << ppm.path()
<< '\n';
}
}// namespace open_viii::graphics
#endif// VIIIARCHIVE_PPM_HPP
| 32.8159
| 80
| 0.563687
|
Sebanisu
|
8710f2c2d2d282fdd1ff8231c80279a8f57c0cd1
| 1,889
|
hpp
|
C++
|
Engine/Events/EventSource.hpp
|
ryanvanrooyen/GameFramework
|
56ec1fe66964b2963cbdb2ba04640be47de59cc7
|
[
"Apache-2.0"
] | null | null | null |
Engine/Events/EventSource.hpp
|
ryanvanrooyen/GameFramework
|
56ec1fe66964b2963cbdb2ba04640be47de59cc7
|
[
"Apache-2.0"
] | null | null | null |
Engine/Events/EventSource.hpp
|
ryanvanrooyen/GameFramework
|
56ec1fe66964b2963cbdb2ba04640be47de59cc7
|
[
"Apache-2.0"
] | null | null | null |
#pragma once
#include "EngineCommon.h"
#include "Listeners.hpp"
namespace Game
{
class Window;
class EventSource
{
public:
virtual ~EventSource() = default;
void PushListener(WindowListener* listener);
void PushListener(MouseListener* listener);
void PushListener(KeyboardListener* listener);
void PushListener(EventListener* listener)
{
PushListener((WindowListener*)listener);
PushListener((MouseListener*)listener);
PushListener((KeyboardListener*)listener);
}
void PopListener(WindowListener* listener);
void PopListener(MouseListener* listener);
void PopListener(KeyboardListener* listener);
void PopListener(EventListener* listener)
{
PopListener((WindowListener*)listener);
PopListener((MouseListener*)listener);
PopListener((KeyboardListener*)listener);
}
protected:
bool DispatchWindowClose(Window& window);
bool DispatchWindowResize(Window& window);
bool DispatchWindowScroll(Window& window, double xOffset, double yOffset);
bool DispatchWindowMonitor(Window& window, int monitorEventType);
bool DispatchMouseMove(Window& window, double xPos, double yPos);
bool DispatchMousePress(Window& window, MouseCode button);
bool DispatchMouseRelease(Window& window, MouseCode button);
bool DispatchKeyPress(Window& window, KeyCode key);
bool DispatchKeyRelease(Window& window, KeyCode key);
bool DispatchKeyRepeat(Window& window, KeyCode key);
bool DispatchCharTyped(Window& window, unsigned int character);
private:
std::vector<WindowListener*> windowListeners;
std::vector<MouseListener*> mouseListeners;
std::vector<KeyboardListener*> keyboardListeners;
};
}
| 33.732143
| 82
| 0.677078
|
ryanvanrooyen
|
8713fa7a6b4895b12f501e015478608f65f2734a
| 226
|
hpp
|
C++
|
PP/get_std.hpp
|
Petkr/PP
|
646cc156603a6a9461e74d8f54786c0d5a9c32d2
|
[
"MIT"
] | 3
|
2019-07-12T23:12:24.000Z
|
2019-09-05T07:57:45.000Z
|
PP/get_std.hpp
|
Petkr/PP
|
646cc156603a6a9461e74d8f54786c0d5a9c32d2
|
[
"MIT"
] | null | null | null |
PP/get_std.hpp
|
Petkr/PP
|
646cc156603a6a9461e74d8f54786c0d5a9c32d2
|
[
"MIT"
] | null | null | null |
#pragma once
#include <PP/size_t.hpp>
#include <PP/tuple/concept.hpp>
namespace PP
{
namespace tuple
{
template <size_t I>
constexpr decltype(auto) get(concepts::tuple auto&& t) noexcept
{
return PP_F(t)[value<I>];
}
}
}
| 14.125
| 63
| 0.70354
|
Petkr
|
87165bdd762ebcc49d346f43ddd68e4476e22fca
| 8,073
|
cpp
|
C++
|
Source/Player.cpp
|
nolancs/OrangeMUD
|
3db3ddf73855bb76110d7a6a8e67271c36652b04
|
[
"MIT"
] | 4
|
2020-01-25T04:20:07.000Z
|
2022-01-14T02:59:28.000Z
|
Source/Player.cpp
|
nolancs/OrangeMUD
|
3db3ddf73855bb76110d7a6a8e67271c36652b04
|
[
"MIT"
] | null | null | null |
Source/Player.cpp
|
nolancs/OrangeMUD
|
3db3ddf73855bb76110d7a6a8e67271c36652b04
|
[
"MIT"
] | 1
|
2020-04-01T04:36:48.000Z
|
2020-04-01T04:36:48.000Z
|
/******************************************************************************
Author: Matthew Nolan OrangeMUD Codebase
Date: January 2001 [Crossplatform]
License: MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
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.
Copyright 2000-2019 Matthew Nolan, All Rights Reserved
******************************************************************************/
#include "CommonTypes.h"
#include "Act.h"
#include "ANSI.h"
#include "Area.h"
#include "Channel.h"
#include "MUD.h"
#include "Player.h"
#include "RoomIndex.h"
#include "StringMagic.h"
#include "StringUtils.h"
#include "Tables.h"
#include "XMLFile.h"
Player::Player()
//Runtime Data
: isImm(NULL)
, mDamRoll(0)
, mHitRoll(0)
, mFlagsStatus(0)
//Persistant Data
, mUID(0)
, mLastLogin(0)
, mTimePlayed(0)
, mTrust(0)
, mScroll(20)
, mInvisLevel(0)
, mFlagsOptions(0)
, mFlagsInfo(0)
{
isPlayer = this;
isMobile = NULL;
for(LONG i = 0; i < kCondMax; ++i)
mCondition[i] = 0;
for(LONG i = 0; i < kColorPrefMax; ++i)
mColorPref[i] = 0;
}
Player::~Player()
{
}
#if 0
//***************************************************************************//
///////////////////////////////////////////////////////////////////////////////
//***************************************************************************//
#pragma mark -
#endif
void Player::PlaceInGame(PersonHolder* hTo, bool hLoggingIn)
{
ASSERT(hTo != NULL);
ASSERT(mSession != NULL);
ASSERT(mUID != 0);
mSession->mColorPrefStrs.clear();
for(LONG i = 0; i < kColorPrefMax; ++i)
mSession->mColorPrefStrs.AddBack(gANSIPrefTable.BuildANSICode(mColorPref[i]));
if(mKeywords.Empty())
mKeywords = mName;
MUD::Get()->PlaceInGame(this);
Person::PlaceInGame(hTo, hLoggingIn);
if(hLoggingIn)
{
Channel::Broadcast(-1, NULL,
kInfoConnect, "^]Info || ", "$n has connected.^x",
this, NULL, NULL, kActWorld|kActNoChar|kActOnlySeeChar);
}
}
void Player::RemoveFromGame(bool hLoggingOut)
{
Person::RemoveFromGame(hLoggingOut);
if(hLoggingOut)
{
//Show To World
Channel::Broadcast(-1, NULL,
kInfoQuit, "^]Info || ", "$n has left our reality.^x",
this, NULL, NULL, kActWorld|kActNoChar);
}
MUD::Get()->RemoveFromGame(this);
}
void Player::PlaceIn(PersonHolder* hTo)
{
Person::PlaceIn(hTo);
if(mInRoom)
{
++mInRoom->mNumPlayers;
++mInRoom->mInArea->mNumPlayers;
}
}
void Player::RemoveFrom()
{
if(mInRoom)
{
--mInRoom->mNumPlayers;
--mInRoom->mInArea->mNumPlayers;
}
Person::RemoveFrom();
}
bool Player::GetRoundAttacks(AttackArray& hAttacks)
{
return false;
}
void Player::StatTo(Person* hTo)
{
SHORT nBStr, nBDex, nBInt, nBWis, nBCon;
SHORT nStr, nDex, nInt, nWis, nCon;
LONG nHits, nHitsMax, nEnergy, nEnergyMax, nMoves, nMovesMax;
CHAR nResCold, nResFire, nResAcid, nResElec, nResPois, nResMind;
float nHR, nDR, nHitRegen, nEnergyRegen, nMoveRegen;
LONG nCopperBank, nCopperHere, nExpTNL;
STRINGCW nCondBuf;
nStr = GetStr();
nDex = GetDex();
nInt = GetInt();
nWis = GetWis();
nCon = GetCon();
nBStr = GetBaseStr();
nBDex = GetBaseDex();
nBInt = GetBaseInt();
nBWis = GetBaseWis();
nBCon = GetBaseCon();
nHits = GetHits();
nHitsMax = GetMaxHits();
nEnergy = GetEnergy();
nEnergyMax = GetMaxEnergy();
nMoves = GetMoves();
nMovesMax = GetMaxMoves();
nResCold = GetColdRes();
nResFire = GetFireRes();
nResAcid = GetAcidRes();
nResElec = GetElecRes();
nResPois = GetPoisRes();
nResMind = GetMindRes();
nHR = 0;
nDR = 0;
nHitRegen = 0;
nEnergyRegen = 0;
nMoveRegen = 0;
nCopperBank = 0;
nCopperHere = 0;
nExpTNL = 0;
//Conditions
if(mCondition[kCondThirst] >= kNowThirsty)
{
nCondBuf += ", thirsty";
if(hTo->IsImm()) nCondBuf += QBuf("(%d)", mCondition[kCondThirst]);
}
if(mCondition[kCondHunger] >= kNowHungry)
{
nCondBuf += ", hungry";
if(hTo->IsImm()) nCondBuf += QBuf("(%d)", mCondition[kCondHunger]);
}
if(mCondition[kCondDrunk] > 0)
{
nCondBuf += ", drunk";
if(hTo->IsImm()) nCondBuf += QBuf("(%d)", mCondition[kCondDrunk]);
}
if(mCondition[kCondHigh] > 0)
{
nCondBuf += ", high";
if(hTo->IsImm()) nCondBuf += QBuf("(%d)", mCondition[kCondHigh]);
}
//Setup Some Work Buffers
STRINGCW nTitleBuf, nHBuf, nEBuf, nMBuf;
nTitleBuf.SPrintF("%s the %s %s", *GetNameTo(hTo), *GetRaceNameTo(hTo), *GetClassNameTo(hTo));
nHBuf.SPrintF("%ld/%ld", nHits , nHitsMax);
nEBuf.SPrintF("%ld/%ld", nEnergy, nEnergyMax);
nMBuf.SPrintF("%ld/%ld", nMoves , nMovesMax);
STRINGCW nBuf;
nBuf.SPrintF(
////////////////////////////////// Score Template //////////////////////////////////////
"-==============================================================================-\n"
"^!%s^x\n"
"\n"
" Hits: %-11s Energy: %-11s Moves: %-11s\n"
"\n",
///////////////////////////////////////////////////////////////////////////////////////
CenterLine(nTitleBuf, 80),
*nHBuf, *nEBuf, *nMBuf);
hTo->Send(nBuf);
if(nCondBuf.Empty() == false)
{
hTo->Send("[ ");
hTo->Send(&nCondBuf[2]);
hTo->Send(" ]\n\n");
}
nBuf.SPrintF(
////////////////////////////////// Score Template //////////////////////////////////////
" Str:%2d(%2d) Dex:%2d(%2d) Int:%2d(%2d) Wis:%2d(%2d) Con:%2d(%2d)\n"
"\n"
" ^bCold^x:%4d%% ^cElec^x:%4d%% ^yPoison^x:%4d%%\n"
" ^rFire^x:%4d%% ^gAcid^x:%4d%% ^mMental^x:%4d%%\n"
"\n"
" Level: %-4d Focus: %-7s Sex: %s\n"
" Hit Regen: %+-7.1f Hitroll: %+-7.1f Align: %s\n"
" Energy Regen: %+-7.1f Damroll: %+-7.1f In Bank: %ldcp\n"
" Movement Regen: %+-7.1f Experience: %-12ld Carried: %ldcp\n"
"-==============================================================================-\n",
///////////////////////////////////////////////////////////////////////////////////////
nBStr, nStr, nBDex, nDex, nBInt, nInt, nBWis, nWis, nBCon, nCon,
nResCold , nResElec , nResPois ,
nResFire , nResAcid , nResMind ,
mLevel , "" , gSexTable[mSex].mName ,
nHitRegen , nHR , "gone" ,
nEnergyRegen , nDR , nCopperBank ,
nMoveRegen , nExpTNL , nCopperHere);
hTo->Send(nBuf);
}
| 30.123134
| 98
| 0.50799
|
nolancs
|
8716c7cb8cc02338de1bacf526833b346fb525d6
| 1,525
|
cpp
|
C++
|
src/programs/pthreads/pthreads.cpp
|
isaaclimdc/cachemulator
|
bcd0d330431df4dae9a7e1c61d2a61c4a0b3ffec
|
[
"MIT"
] | 1
|
2022-03-06T08:31:11.000Z
|
2022-03-06T08:31:11.000Z
|
src/programs/pthreads/pthreads.cpp
|
isaaclimdc/cachemulator
|
bcd0d330431df4dae9a7e1c61d2a61c4a0b3ffec
|
[
"MIT"
] | null | null | null |
src/programs/pthreads/pthreads.cpp
|
isaaclimdc/cachemulator
|
bcd0d330431df4dae9a7e1c61d2a61c4a0b3ffec
|
[
"MIT"
] | null | null | null |
#include <sched.h>
#include <sys/types.h>
#include <signal.h>
#include <unistd.h>
#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
#define MAXTHREADS 1000
void *threadFunc(void *arg) {
// for (int i=0; i<100; i++) {
int *p = (int *)arg;
// printf("p is %p\n", p);
*p = 20;
int x = *p;
(void)x;
// }
return NULL;
}
int fib(int n) {
if (n == 0 || n == 1) return 1;
return fib(n-1) + fib(n-2);
}
void fibMemStack(int n, int *f) {
if (n == 0 || n == 1) {
*f = 1;
}
else {
int f1, f2 = 0;
fibMemStack(n-1, &f1);
fibMemStack(n-2, &f2);
*f = f1 + f2;
}
}
void fibMemHeap(int n, int *f) {
if (n == 0 || n == 1) {
*f = 1;
}
else {
int *f1 = (int *)malloc(sizeof(int));
int *f2 = (int *)malloc(sizeof(int));
fibMemHeap(n-1, f1);
fibMemHeap(n-2, f2);
*f = *f1 + *f2;
free(f1); free(f2);
}
}
int main(int argc, char *argv[]) {
pthread_t threads[MAXTHREADS];
int numthreads = 20;
for (int i = 0; i< numthreads; i++) {
int *p = (int *)malloc(sizeof(int));
*p = 42;
pthread_create(&threads[i], 0, threadFunc, p);
}
for (int i = 0; i < numthreads; i++) {
pthread_join(threads[i], 0);
}
// Other stuff
int n1 = 20;
int f1 = fib(n1);
printf("Fib %d is: %d\n", n1, f1);
// int f2 = 0;
// fibMemStack(n1, &f2);
// printf("Fib %d is: %d\n", n1, f2);
int *f3 = (int *)malloc(sizeof(int));
*f3 = 0;
fibMemHeap(n1, f3);
printf("Fib %d is: %d\n", n1, *f3);
free(f3);
return 0;
}
| 18.154762
| 50
| 0.510164
|
isaaclimdc
|
871a64882c43829827e0c64911606a13cce4fc94
| 1,510
|
cpp
|
C++
|
ADT-SET-MULTIset/Sort-AlgoAcedemy-Oct2015-RTF2-byMAP.cpp
|
kilarionov/cppTopics
|
94461d25832b53e6c40c374fb2ff1695b3dfe3c7
|
[
"MIT"
] | null | null | null |
ADT-SET-MULTIset/Sort-AlgoAcedemy-Oct2015-RTF2-byMAP.cpp
|
kilarionov/cppTopics
|
94461d25832b53e6c40c374fb2ff1695b3dfe3c7
|
[
"MIT"
] | null | null | null |
ADT-SET-MULTIset/Sort-AlgoAcedemy-Oct2015-RTF2-byMAP.cpp
|
kilarionov/cppTopics
|
94461d25832b53e6c40c374fb2ff1695b3dfe3c7
|
[
"MIT"
] | 1
|
2019-05-24T03:44:06.000Z
|
2019-05-24T03:44:06.000Z
|
// http://bgcoder.com/Contests/268/Telerik-Algo-Academy-October-2015
// https://github.com/TelerikAcademy/AlgoAcademy/tree/master/2015-10-Algorithms-on-String/Problems
#include <iostream>
//#include <set>
#include <map>
const int D = (int)('a'-'A') ;
using namespace std ;
int main ()
{
long n, k;
int asciiCode;
char c;
//set<char> myGoodChars ;
//set<char>::iterator go;
//pair<set<char>::iterator, bool> retCode ;
map<char, int> myGoodChars ;
map<char,int>::iterator it;
myGoodChars.clear();
cin >>n;
for (k=0; k<n; k++)
{
cin >>asciiCode;
if (asciiCode>=32 && asciiCode<=126)
{
c=(char)asciiCode;
if (c!='x' &&
((c>='a' && c<='z') ||
(c>='A' && c<='Z') ||
(c>='0' && c<='9')))
{
it = myGoodChars.find(c);
if (it == myGoodChars.end())
myGoodChars.insert(make_pair(c, 1)) ;
else
myGoodChars[c]++ ; // to count that char here
}
}
} ;
// if (myGoodChars.find('x') != myGoodChars.end())
// myGoodChars.erase ('x') ;
for (char ch='A'; ch<='Z'; ch++)
{
if (myGoodChars.find(ch) != myGoodChars.end())
for ( ; myGoodChars[ch]-- ; )
cout <<ch;
if (myGoodChars.find((char)(ch+D)) != myGoodChars.end())
for ( ; myGoodChars[(char)(ch+D)]-- ; )
cout <<(char)(ch+D) ;
} ;
for (char ch='1'; ch<='9'; ch++)
{
if (myGoodChars.find(ch) != myGoodChars.end())
for ( ; myGoodChars[ch]-- ; )
cout <<ch;
} ;
if (myGoodChars.find('0') != myGoodChars.end())
for ( ; myGoodChars['0']-- ; )
cout <<'0';
cout <<endl;
return 0;
}
| 24.354839
| 98
| 0.56755
|
kilarionov
|
26b5a05d6e863f6b2dd1301fd01f508c7480d495
| 9,733
|
cc
|
C++
|
cc/chart/v3/grid-test.cc
|
skepner/ae
|
d53336a561df1a46a39debb143c9f9496b222a46
|
[
"MIT"
] | null | null | null |
cc/chart/v3/grid-test.cc
|
skepner/ae
|
d53336a561df1a46a39debb143c9f9496b222a46
|
[
"MIT"
] | null | null | null |
cc/chart/v3/grid-test.cc
|
skepner/ae
|
d53336a561df1a46a39debb143c9f9496b222a46
|
[
"MIT"
] | null | null | null |
#include "ext/omp.hh"
#include "chart/v3/grid-test.hh"
#include "chart/v3/chart.hh"
#include "chart/v3/stress.hh"
#include "chart/v3/area.hh"
// ----------------------------------------------------------------------
namespace ae::chart::v3::grid_test
{
static void test(result_t& result, const Projection& projection, const Stress& stress, const settings_t& settings);
static Area area_for(const Stress::TableDistancesForPoint& table_distances_for_point, const Layout& layout);
}
// ----------------------------------------------------------------------
ae::chart::v3::grid_test::results_t ae::chart::v3::grid_test::test(const Chart& chart, projection_index projection_no, const settings_t& settings)
{
const auto& projection = chart.projections()[projection_no];
results_t results(projection);
const auto stress = stress_factory(chart, projection, optimization_options{}.mult);
#ifdef _OPENMP
const int num_threads = settings.threads <= 0 ? omp_get_max_threads() : settings.threads;
const int slot_size = chart.antigens().size() < antigen_index{1000} ? 4 : 1;
#endif
#pragma omp parallel for default(shared) num_threads(num_threads) schedule(static, slot_size)
for (size_t entry_no = 0; entry_no < results.size(); ++entry_no)
test(results[entry_no], projection, stress, settings);
return results;
} // ae::chart::v3::grid_test::test
// ----------------------------------------------------------------------
void ae::chart::v3::grid_test::test(result_t& result, const Projection& projection, const Stress& stress, const settings_t& settings)
{
if (result.diagnosis == result_t::not_tested) {
const double hemisphering_distance_threshold = 1.0; // from acmacs-c2 hemi-local test: 1.0
const double hemisphering_stress_threshold = 0.25; // stress diff within threshold -> hemisphering, from acmacs-c2 hemi-local test: 0.25
const optimization_options options;
const auto table_distances_for_point = stress.table_distances_for(result.point_no);
if (table_distances_for_point.empty()) { // no table distances, cannot test
result.diagnosis = result_t::excluded;
return;
}
result.diagnosis = result_t::normal;
Layout layout{projection.layout()};
const auto target_contribution = stress.contribution(result.point_no, table_distances_for_point, layout);
const point_coordinates original_pos{layout[result.point_no]};
auto best_contribution = target_contribution;
point_coordinates best_coord, hemisphering_coord;
const auto hemisphering_stress_thresholdrough = hemisphering_stress_threshold * 2;
auto hemisphering_contribution = target_contribution + hemisphering_stress_thresholdrough;
const auto area = area_for(table_distances_for_point, layout);
for (auto it = area.begin(settings.step), last = area.end(); it != last; ++it) {
// AD_DEBUG("grid_test iter {}", *it);
layout.update(result.point_no, *it);
const auto contribution = stress.contribution(result.point_no, table_distances_for_point, layout);
if (contribution < best_contribution) {
best_contribution = contribution;
best_coord = *it;
}
else if (!best_coord.exists() && contribution < hemisphering_contribution && distance(original_pos, *it) > hemisphering_distance_threshold) {
hemisphering_contribution = contribution;
hemisphering_coord = *it;
}
}
if (best_coord.exists()) {
layout.update(result.point_no, best_coord);
const auto status = optimize(options.method, stress, layout.span(), optimization_precision::rough);
result.pos = layout[result.point_no];
result.distance = distance(original_pos, result.pos);
result.contribution_diff = status.final_stress - projection.stress();
result.diagnosis = std::abs(result.contribution_diff) > hemisphering_stress_threshold ? result_t::trapped : result_t::hemisphering;
}
else if (hemisphering_coord.exists()) {
// relax to find real contribution
layout.update(result.point_no, hemisphering_coord);
auto status = optimize(options.method, stress, layout.span(), optimization_precision::rough);
result.pos = layout[result.point_no];
result.distance = distance(original_pos, result.pos);
if (result.distance > hemisphering_distance_threshold && result.distance < (hemisphering_distance_threshold * 1.2)) {
status = optimize(options.method, stress, layout.span(), optimization_precision::fine);
result.pos = layout[result.point_no];
result.distance = distance(original_pos, result.pos);
}
result.contribution_diff = status.final_stress - projection.stress();
if (result.distance > hemisphering_distance_threshold) {
// if (const auto real_contribution_diff = stress.contribution(result.point_no, table_distances_for_point, layout.data()) - target_contribution;
// real_contribution_diff < hemisphering_stress_threshold) {
if (std::abs(result.contribution_diff) < hemisphering_stress_threshold) {
// result.contribution_diff = real_contribution_diff;
result.diagnosis = result_t::hemisphering;
}
}
}
// AD_DEBUG("GridTest {} area: {:8.1f} units^{} grid-step: {:5.3f}", result.report(chart_), area.area(), area.num_dim(), grid_step_);
}
} // ae::chart::v3::grid_test::test
// ----------------------------------------------------------------------
ae::chart::v3::Area ae::chart::v3::grid_test::area_for(const Stress::TableDistancesForPoint& table_distances_for_point, const Layout& layout)
{
point_index another_point;
if (!table_distances_for_point.regular.empty())
another_point = table_distances_for_point.regular.front().another_point;
else if (!table_distances_for_point.less_than.empty())
another_point = table_distances_for_point.less_than.front().another_point;
else
throw std::runtime_error("ae::chart::v3::grid_test::::area_for: table_distances_for_point has neither regulr nor less_than entries");
Area area(layout[another_point]);
auto extend = [&area, &layout](const auto& entry) {
const auto coord = layout[entry.another_point];
const auto radius = entry.distance; // + 1;
area.extend(coord - radius);
area.extend(coord + radius);
};
std::for_each(table_distances_for_point.regular.begin(), table_distances_for_point.regular.end(), extend);
std::for_each(table_distances_for_point.less_than.begin(), table_distances_for_point.less_than.end(), extend);
return area;
} // ae::chart::v3::grid_test::area_for
// ----------------------------------------------------------------------
ae::chart::v3::grid_test::results_t::results_t(const Projection& projection)
: data_(*projection.number_of_points(), result_t{point_index{0}, projection.number_of_dimensions()})
{
point_index point_no{0};
for (auto& res : data_)
res.point_no = point_no++;
exclude_disconnected(projection);
} // ae::chart::v3::grid_test::results_t::results_t
// ----------------------------------------------------------------------
void ae::chart::v3::grid_test::results_t::exclude_disconnected(const Projection& projection)
{
const auto exclude = [this](point_index point_no) {
if (auto* found = find(point_no); found)
found->diagnosis = result_t::excluded;
};
for (auto unmovable : projection.unmovable())
exclude(unmovable);
for (auto disconnected : projection.disconnected())
exclude(disconnected);
data_.erase(std::remove_if(data_.begin(), data_.end(), [](const auto& entry) { return entry.diagnosis == result_t::excluded; }), data_.end());
} // ae::chart::v3::grid_test::results_t::exclude_disconnected
// ----------------------------------------------------------------------
ae::chart::v3::grid_test::result_t* ae::chart::v3::grid_test::results_t::find(point_index point_no)
{
if (const auto found = std::find_if(data_.begin(), data_.end(), [point_no](const auto& en) { return en.point_no == point_no; }); found != data_.end())
return &*found;
else
return nullptr;
} // ae::chart::v3::grid_test::results_t::find
// ----------------------------------------------------------------------
std::vector<ae::chart::v3::grid_test::result_t> ae::chart::v3::grid_test::results_t::trapped_hemisphering() const
{
std::vector<result_t> th;
for (const auto& en : data_) {
if (en.diagnosis == result_t::trapped || en.diagnosis == result_t::hemisphering)
th.push_back(en);
}
return th;
} // ae::chart::v3::grid_test::trapped_hemisphering
// ----------------------------------------------------------------------
void ae::chart::v3::grid_test::results_t::apply(Layout& layout) const
{
for (const auto& result : data_) {
if (result.pos.exists() && result.contribution_diff < 0.0)
layout.update(result.point_no, result.pos);
}
} // ae::chart::v3::grid_test::results_t::apply
// ----------------------------------------------------------------------
void ae::chart::v3::grid_test::results_t::apply(Projection& projection) const // move points to their better locations
{
apply(projection.layout());
} // ae::chart::v3::grid_test::results_t::apply
// ----------------------------------------------------------------------
| 47.710784
| 160
| 0.624062
|
skepner
|
26bb2b988cc1c098f20659b0d69cc4e9be331446
| 2,454
|
cpp
|
C++
|
tech/Game/DebugMeshRenderStep.cpp
|
nbtdev/teardrop
|
fa9cc8faba03a901d1d14f655a04167e14cd08ee
|
[
"MIT"
] | null | null | null |
tech/Game/DebugMeshRenderStep.cpp
|
nbtdev/teardrop
|
fa9cc8faba03a901d1d14f655a04167e14cd08ee
|
[
"MIT"
] | null | null | null |
tech/Game/DebugMeshRenderStep.cpp
|
nbtdev/teardrop
|
fa9cc8faba03a901d1d14f655a04167e14cd08ee
|
[
"MIT"
] | null | null | null |
/******************************************************************************
Copyright (c) 2015 Teardrop Games
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 "DebugMeshRenderStep.h"
#include "Component_Physics.h"
#include "ZoneObject.h"
#include "Gfx/Renderer.h"
#include "Gfx/Viewport.h"
#include "Gfx/RenderTarget.h"
using namespace Teardrop;
//---------------------------------------------------------------------------
DebugMeshRenderStep::DebugMeshRenderStep()
{
m_bEnabled = false;
}
//---------------------------------------------------------------------------
DebugMeshRenderStep::~DebugMeshRenderStep()
{
}
//---------------------------------------------------------------------------
void DebugMeshRenderStep::render(
const VisibleObjects& objects, Gfx::Renderer* pRenderer, Scene* /*pScene*/)
{
if (!m_bEnabled)
return;
// since we are rendering into a scene that is already set up with the proper
// camera and viewport, we do not need beginScene() here; endScene() however
// is what actually renders so we want that
for (size_t i=0; i<objects.size(); ++i)
{
ZoneObject* pObject = objects[i];
PhysicsComponent* pComp;
if (!pObject->findComponents(PhysicsComponent::getClassDef(), (Component**)&pComp,1, true))
continue;
// allow dynamic updates to meshes
// pRenderer->queueForRendering(pComp->getDebugMesh());
}
pRenderer->endScene();
}
| 37.753846
| 93
| 0.645884
|
nbtdev
|
26bc26648f90f85257140905192ca7b2dbd91cb4
| 2,026
|
cpp
|
C++
|
example/miniping.cpp
|
oskarirauta/pingcpp
|
f521de4d024d644cefc88e115b5c8457ecc900bf
|
[
"MIT"
] | null | null | null |
example/miniping.cpp
|
oskarirauta/pingcpp
|
f521de4d024d644cefc88e115b5c8457ecc900bf
|
[
"MIT"
] | null | null | null |
example/miniping.cpp
|
oskarirauta/pingcpp
|
f521de4d024d644cefc88e115b5c8457ecc900bf
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include <string>
#include "example/report.hpp"
#include "network.hpp"
#include "ping.hpp"
#define PING_HOST "google.com"
#ifdef __IPV6__
# define TITLE "miniping(+IPV6), by Oskari Rauta\nMIT License\n"
#else
# define TITLE "miniping, by Oskari Rauta\nMIT License\n"
#endif
int main(int argc, char *argv[]) {
std::cout << TITLE << std::endl;
std::string arg = argc > 1 ? std::string(argv[1]) : "";
network::protocol proto =
arg == "-6" ? network::protocol::IPV6 :
( arg == "-4" ? network::protocol::IPV4 :
network::protocol::ANY );
std::string host = PING_HOST;
std::cout << TITLE << std::endl;
std::cout << "Attempting to ping host " << host << " using ";
std::cout << ( proto == network::protocol::IPV6 ? "IPv6" : (
proto == network::protocol::IPV4 ? "IPv4" : "ANY" ));
std::cout << " protocol" << std::endl;
network::ping_t ping(host, proto);
if ( ping.connection -> protocol == network::protocol::ANY ) {
std::cout << "error: IP address failure, or unsupported protocol for host " << host << std::endl;
return -1;
} else if ( ping.address_error()) {
std::cout << "error: address information for host " << host << " is not available" << std::endl;
return -1;
}
ping.packetsize = 56; // standard icmp packet size
ping.delay = std::chrono::milliseconds(500);
ping.timeout = std::chrono::seconds(15);
ping.count_min = 10;
ping.count_max = 99;
ping.report = report;
std::cout << "Host's ip address is " << ping.connection -> ipaddr << " on ";
std::cout << ( ping.connection -> protocol == network::protocol::IPV6 ? "IPv6" : "IPv4" );
std::cout << " network.\nICMP packet size: " << ping.packetsize << " bytes +";
std::cout << "\n\ticmp header size " << ICMP_HEADER_LENGTH << " bytes = ";
std::cout << ping.packetsize + ICMP_HEADER_LENGTH << " bytes\n";
std::cout << std::endl;
ping.execute();
std::cout << std::endl;
if ( ping.summary -> aborted ) std::cout << "Exited because of error" << std::endl;
return ping.summary -> aborted ? -1 : 0;
}
| 31.169231
| 99
| 0.631787
|
oskarirauta
|
26bc382621bcfec8958270649fd407da9b245e72
| 2,807
|
hpp
|
C++
|
Extensions/Gameplay/SplineParticles.hpp
|
RachelWilSingh/ZeroCore
|
e9a2f82d395e5c89fb98eceac44ce60d016dbff3
|
[
"MIT"
] | 52
|
2018-09-11T17:18:35.000Z
|
2022-03-13T15:28:21.000Z
|
Extensions/Gameplay/SplineParticles.hpp
|
RachelWilSingh/ZeroCore
|
e9a2f82d395e5c89fb98eceac44ce60d016dbff3
|
[
"MIT"
] | 1,409
|
2018-09-19T18:03:43.000Z
|
2021-06-09T08:33:33.000Z
|
Extensions/Gameplay/SplineParticles.hpp
|
RachelWilSingh/ZeroCore
|
e9a2f82d395e5c89fb98eceac44ce60d016dbff3
|
[
"MIT"
] | 26
|
2018-09-11T17:16:32.000Z
|
2021-11-22T06:21:19.000Z
|
///////////////////////////////////////////////////////////////////////////////
///
/// \file ParticleEmitters.hpp
/// Declaration of the Particle emitters.
///
/// Authors: Chris Peters
/// Copyright 2010-2012, DigiPen Institute of Technology
///
///////////////////////////////////////////////////////////////////////////////
#pragma once
namespace Zero
{
//------------------------------------------------------ Spline Particle Emitter
class SplineParticleEmitter : public ParticleEmitterShared
{
public:
/// Meta Initialization.
ZilchDeclareType(TypeCopyMode::ReferenceType);
/// Component Interface.
void Serialize(Serializer& stream) override;
void Initialize(CogInitializer& initializer) override;
void OnAllObjectsCreated(CogInitializer& initializer) override;
void OnTargetSplineCogPathChanged(Event* e);
void FindSpline();
/// ParticleEmitter Interface.
int EmitParticles(ParticleList* particleList, float dt,
Mat4Ref transform, Vec3Param velocity, float timeAlive) override;
/// The current spline being emitted along
Spline* GetSpline() const;
void SetSpline(Spline* spline);
/// Path to an object to query for a spline
CogPath mTargetSplineCog;
/// Particles will be created along this spline
HandleOf<Spline> mSpline;
float mEmitRadius;
float mSpawnT, mSpawnTVariance;
bool mClampT;
};
//----------------------------------------------------- Spline Particle Animator
DeclareEnum2(SplineAnimatorMode, Exact, Spring);
class SplineParticleAnimator : public ParticleAnimator
{
public:
/// Meta Initialization.
ZilchDeclareType(TypeCopyMode::ReferenceType);
~SplineParticleAnimator();
/// Component Interface.
void Serialize(Serializer& stream) override;
void Initialize(CogInitializer& initializer) override;
/// ParticleAnimator Interface.
void Animate(ParticleList* particleList, float dt, Mat4Ref transform) override;
/// Speed setter / getter.
void SetSpeed(float speed);
float GetSpeed();
///
SplineParticleEmitter* mEmitter;
/// The speed at which the particles move in meters / second.
float mSpeed;
/// If checked, the lifetime on the SplineParticleEmitter will be updated
/// to the time it would take to travel the entire path at the current speed.
bool mAutoCalculateLifetime;
bool mHelix;
/// The radius of the helix.
float mHelixRadius;
/// How fast the helix rotates in radians / second.
float mHelixWaveLength;
/// Offset in radians for where the helix starts.
float mHelixOffset;
/// The current animate mode.
SplineAnimatorMode::Enum mMode;
/// Spring properties.
float mSpringFrequencyHz;
float mSpringDampingRatio;
};
}//namespace Zero
| 28.353535
| 86
| 0.646242
|
RachelWilSingh
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.