blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 3 264 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 5 140 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 905
values | visit_date timestamp[us]date 2015-08-09 11:21:18 2023-09-06 10:45:07 | revision_date timestamp[us]date 1997-09-14 05:04:47 2023-09-17 19:19:19 | committer_date timestamp[us]date 1997-09-14 05:04:47 2023-09-06 06:22:19 | github_id int64 3.89k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us]date 2012-06-07 00:51:45 2023-09-14 21:58:39 ⌀ | gha_created_at timestamp[us]date 2008-03-27 23:40:48 2023-08-21 23:17:38 ⌀ | gha_language stringclasses 141
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 10.4M | extension stringclasses 115
values | content stringlengths 3 10.4M | authors listlengths 1 1 | author_id stringlengths 0 158 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
50c19586bedc0b44e6724470dadd10940f8a197e | dcb9bf4792647cac863f750df0c1c1ef905716a4 | /MeshRenderer_Lite_Framework/MeshRenderer_Lite_Framework/Src/Systems/Graphics/GraphicsSystem.h | 14a64e074e7f4ba36588da19b24f52ad07e7545c | [] | no_license | emaldonadogamedev/MeshRenderer_Lite | b0b459d6bf910d0d1a6d68ecf310672476048137 | 2a55b29470fd3a7cab6e20ffdf36a67ef7752572 | refs/heads/master | 2021-03-27T15:49:24.117994 | 2019-08-27T07:03:29 | 2019-08-27T07:03:29 | 107,186,023 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,954 | h | #pragma once
#include <Systems/ISystem.h>
#include <Systems/Core/Components/IComponent.h>
#include <Systems/Graphics/GraphicsUtilities/ObjectHandle.h>
#include <memory>
#include <unordered_map>
class Model;
class Camera;
class CameraManager;
class DX11Renderer;
class IRenderStage;
class ModelManager;
class TextureManager;
//typedefs
typedef std::unordered_map<string, ObjectHandle> HandleDictionary;
typedef std::vector<HandleDictionary> HandleDictionaryVec;
typedef std::vector<std::vector<IComponent*>> RenderCompVec;
typedef std::unordered_map<ComponentType, std::vector<IComponent*>> RenderCompUmap;
class GraphicsSystem : public ISystem
{
public:
GraphicsSystem(IApplication* const eng);
virtual ~GraphicsSystem();
virtual bool Initialize() override;
virtual void Update(const float dt) override;
virtual void Shutdown() override;
virtual void ReceiveMessage(const IMessage& msg) override;
virtual void AddComponent(IComponent* component) override;
void RunRenderPasses();
void Resize(const int w, const int h);
//Global IBL Settings
const std::string& GetIBLTexture() const;
void SetIBLTexture(const std::string& iblTexture);
bool GetIsUsingIBL()const;
void SetIsUsingIBL(const bool v);
void SetIBLsampleWeightCount(const int sampleCount);
//Global Ambient Occlussion settings
void SetAOsampleWeights(const int sampleHalfCount);
void SetIsAmbientOcclussion(const bool v);
//Getters
DX11Renderer* GetRenderer() const;
Model* GetModel(const std::string& modelName);
Camera* GetTestCamera() const;
protected:
//Initialize helpers
void InitializeImGui();
void AddRenderStages();
void AddRenderStageHelper(IRenderStage* const renderStage, const bool isActive = true);
Model* LoadModelHelper(const std::string& fileName);
void LoadBasicShaders();
void LoadBasicShaderHelper(ObjectHandle& shaderHandle, const ObjectType shaderType, const std::string& fileName,
const std::string& fileExtension = ".hlsl");
void LoadPrimitiveShapes();
//Update helpers
void TestUpdateCamera(const float dt);
void UpdateModelComponents(const float dt);
void UpdateLightComponents(const float dt);
void UpdateAnimation(Model& model, const float dt);
void UpdateCurvePathComponents(const float dt);
void UpdateSimpleCCDComponents(const float dt);
void UpdateSimpleClothComponents(const float dt);
void UpdateGlobalProperties();
//Misc.
void CreateGaussianWeightsStructuredBuff(ObjectHandle& weightsSample, const int halfWidth);
std::unique_ptr<DX11Renderer> m_dx11Renderer;
RenderCompUmap m_renderComponents;
std::vector<IRenderStage*> m_renderStages;
std::unique_ptr<ModelManager> m_modelManager;
std::unique_ptr<TextureManager> m_textureManager;
std::string m_iblTextureMap;
bool m_isUsingIBL;
bool m_isIBLloadingDirty;
//Resource Collection
HandleDictionaryVec m_resources;
friend IApplication;
}; | [
"esteban.maldonado@digipen.edu"
] | esteban.maldonado@digipen.edu |
7b61291878d0e4073a57856c9a12982af9cf3d40 | f8b838e3805a4dde783da142e6c46062be4ff606 | /ui/views/border_unittest.cc | 09d2b4ec1ef40250ba4b266edbe5736399b00936 | [
"BSD-3-Clause"
] | permissive | trusslab/sugar_chromium | 1cc0eec4dd52d8b2b7bc2d871090a518495539f8 | 5f1dd3da9f21c65c4f1388f22e10585941f0cbc9 | refs/heads/master | 2022-11-08T17:36:48.367045 | 2018-02-17T07:00:15 | 2018-02-17T07:00:15 | 121,314,619 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,302 | cc | // Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/views/border.h"
#include <algorithm>
#include <memory>
#include <set>
#include <utility>
#include <vector>
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkPaint.h"
#include "third_party/skia/include/core/SkRRect.h"
#include "third_party/skia/include/core/SkRect.h"
#include "third_party/skia/include/core/SkRefCnt.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/geometry/size.h"
#include "ui/views/painter.h"
#include "ui/views/test/views_test_base.h"
#include "ui/views/view.h"
using namespace testing;
namespace {
class MockCanvas : public SkCanvas {
public:
struct DrawRectCall {
DrawRectCall(const SkRect& rect, const SkPaint& paint)
: rect(rect), paint(paint) {}
bool operator<(const DrawRectCall& other) const {
return std::tie(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom) <
std::tie(other.rect.fLeft, other.rect.fTop, other.rect.fRight,
other.rect.fBottom);
}
SkRect rect;
SkPaint paint;
};
struct DrawRRectCall {
DrawRRectCall(const SkRRect& rrect, const SkPaint& paint)
: rrect(rrect), paint(paint) {}
bool operator<(const DrawRRectCall& other) const {
SkRect rect = rrect.rect();
SkRect other_rect = other.rrect.rect();
return std::tie(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom) <
std::tie(other_rect.fLeft, other_rect.fTop, other_rect.fRight,
other_rect.fBottom);
}
SkRRect rrect;
SkPaint paint;
};
MockCanvas(int width, int height) : SkCanvas(width, height) {}
// Return calls in sorted order.
std::vector<DrawRectCall> draw_rect_calls() {
return std::vector<DrawRectCall>(draw_rect_calls_.begin(),
draw_rect_calls_.end());
}
// Return calls in sorted order.
std::vector<DrawRRectCall> draw_rrect_calls() {
return std::vector<DrawRRectCall>(draw_rrect_calls_.begin(),
draw_rrect_calls_.end());
}
const std::vector<SkPaint>& draw_paint_calls() const {
return draw_paint_calls_;
}
const SkRect& last_clip_bounds() const { return last_clip_bounds_; }
// SkCanvas overrides:
void onDrawRect(const SkRect& rect, const SkPaint& paint) override {
draw_rect_calls_.insert(DrawRectCall(rect, paint));
}
void onDrawRRect(const SkRRect& rrect, const SkPaint& paint) override {
draw_rrect_calls_.insert(DrawRRectCall(rrect, paint));
}
void onDrawPaint(const SkPaint& paint) override {
draw_paint_calls_.push_back(paint);
}
void onClipRect(const SkRect& rect,
SkClipOp op,
ClipEdgeStyle edge_style) override {
last_clip_bounds_ = rect;
}
private:
// Stores all the calls for querying by the test, in sorted order.
std::set<DrawRectCall> draw_rect_calls_;
std::set<DrawRRectCall> draw_rrect_calls_;
// Stores the onDrawPaint calls in chronological order.
std::vector<SkPaint> draw_paint_calls_;
SkRect last_clip_bounds_;
DISALLOW_COPY_AND_ASSIGN(MockCanvas);
};
// Simple Painter that will be used to test BorderPainter.
class MockPainter : public views::Painter {
public:
MockPainter() {}
// Gets the canvas given to the last call to Paint().
gfx::Canvas* given_canvas() const { return given_canvas_; }
// Gets the size given to the last call to Paint().
const gfx::Size& given_size() const { return given_size_; }
// Painter overrides:
gfx::Size GetMinimumSize() const override {
// Just return some arbitrary size.
return gfx::Size(60, 40);
}
void Paint(gfx::Canvas* canvas, const gfx::Size& size) override {
// Just record the arguments.
given_canvas_ = canvas;
given_size_ = size;
}
private:
gfx::Canvas* given_canvas_ = nullptr;
gfx::Size given_size_;
DISALLOW_COPY_AND_ASSIGN(MockPainter);
};
} // namespace
namespace views {
class BorderTest : public ViewsTestBase {
public:
void SetUp() override {
ViewsTestBase::SetUp();
view_.reset(new views::View());
view_->SetSize(gfx::Size(100, 50));
// The canvas should be much bigger than the view.
sk_canvas_.reset(new MockCanvas(1000, 500));
canvas_.reset(new gfx::Canvas(sk_canvas_.get(), 1.0f));
}
void TearDown() override {
ViewsTestBase::TearDown();
canvas_.reset();
sk_canvas_.reset();
view_.reset();
}
protected:
std::unique_ptr<views::View> view_;
std::unique_ptr<MockCanvas> sk_canvas_;
std::unique_ptr<gfx::Canvas> canvas_;
};
TEST_F(BorderTest, NullBorder) {
std::unique_ptr<Border> border(NullBorder());
EXPECT_FALSE(border);
}
TEST_F(BorderTest, SolidBorder) {
const SkColor kBorderColor = SK_ColorMAGENTA;
std::unique_ptr<Border> border(CreateSolidBorder(3, kBorderColor));
EXPECT_EQ(gfx::Size(6, 6), border->GetMinimumSize());
EXPECT_EQ(gfx::Insets(3, 3, 3, 3), border->GetInsets());
border->Paint(*view_, canvas_.get());
gfx::Rect bounds = view_->GetLocalBounds();
bounds.Inset(border->GetInsets());
ASSERT_EQ(1u, sk_canvas_->draw_paint_calls().size());
EXPECT_EQ(kBorderColor, sk_canvas_->draw_paint_calls()[0].getColor());
EXPECT_EQ(gfx::RectF(bounds),
gfx::SkRectToRectF(sk_canvas_->last_clip_bounds()));
}
TEST_F(BorderTest, RoundedRectBorder) {
std::unique_ptr<Border> border(CreateRoundedRectBorder(3, 4, SK_ColorBLUE));
EXPECT_EQ(gfx::Size(6, 6), border->GetMinimumSize());
EXPECT_EQ(gfx::Insets(3, 3, 3, 3), border->GetInsets());
border->Paint(*view_, canvas_.get());
SkRRect expected_rrect;
expected_rrect.setRectXY(SkRect::MakeLTRB(1.5, 1.5, 98.5, 48.5), 4, 4);
EXPECT_TRUE(sk_canvas_->draw_rect_calls().empty());
std::vector<MockCanvas::DrawRRectCall> draw_rrect_calls =
sk_canvas_->draw_rrect_calls();
ASSERT_EQ(1u, draw_rrect_calls.size());
EXPECT_EQ(expected_rrect, draw_rrect_calls[0].rrect);
EXPECT_EQ(3, draw_rrect_calls[0].paint.getStrokeWidth());
EXPECT_EQ(SK_ColorBLUE, draw_rrect_calls[0].paint.getColor());
EXPECT_EQ(SkPaint::kStroke_Style, draw_rrect_calls[0].paint.getStyle());
EXPECT_TRUE(draw_rrect_calls[0].paint.isAntiAlias());
}
TEST_F(BorderTest, EmptyBorder) {
const gfx::Insets kInsets(1, 2, 3, 4);
std::unique_ptr<Border> border(CreateEmptyBorder(
kInsets.top(), kInsets.left(), kInsets.bottom(), kInsets.right()));
// The EmptyBorder has no minimum size despite nonzero insets.
EXPECT_EQ(gfx::Size(), border->GetMinimumSize());
EXPECT_EQ(kInsets, border->GetInsets());
// Should have no effect.
border->Paint(*view_, canvas_.get());
std::unique_ptr<Border> border2(CreateEmptyBorder(kInsets));
EXPECT_EQ(kInsets, border2->GetInsets());
}
TEST_F(BorderTest, SolidSidedBorder) {
const SkColor kBorderColor = SK_ColorMAGENTA;
const gfx::Insets kInsets(1, 2, 3, 4);
std::unique_ptr<Border> border(
CreateSolidSidedBorder(kInsets.top(), kInsets.left(), kInsets.bottom(),
kInsets.right(), kBorderColor));
EXPECT_EQ(gfx::Size(6, 4), border->GetMinimumSize());
EXPECT_EQ(kInsets, border->GetInsets());
border->Paint(*view_, canvas_.get());
gfx::Rect bounds = view_->GetLocalBounds();
bounds.Inset(border->GetInsets());
ASSERT_EQ(1u, sk_canvas_->draw_paint_calls().size());
EXPECT_EQ(kBorderColor, sk_canvas_->draw_paint_calls()[0].getColor());
EXPECT_EQ(gfx::RectF(bounds),
gfx::SkRectToRectF(sk_canvas_->last_clip_bounds()));
}
TEST_F(BorderTest, BorderPainter) {
const gfx::Insets kInsets(1, 2, 3, 4);
std::unique_ptr<MockPainter> painter(new MockPainter());
MockPainter* painter_ptr = painter.get();
std::unique_ptr<Border> border(
CreateBorderPainter(std::move(painter), kInsets));
EXPECT_EQ(gfx::Size(60, 40), border->GetMinimumSize());
EXPECT_EQ(kInsets, border->GetInsets());
border->Paint(*view_, canvas_.get());
// Expect that the Painter was called with our canvas and the view's size.
EXPECT_EQ(canvas_.get(), painter_ptr->given_canvas());
EXPECT_EQ(view_->size(), painter_ptr->given_size());
}
} // namespace views
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
2bd3f1197ac0d18d64f4ab4d17e018e4a464f92b | 719bcf0ec862bed0416c6a4d78ef03f1191f608b | /02.C_C++语言/02.C++11/并发编程/03.future/src/60.thread_packaged_task_valid.cpp | 5b804e8b14d9f73e115d23375d4f2577e3abeb86 | [] | no_license | cleveryuan777/C-background-development-interview-experience | d16e73efd08d020e3db2b7c3f718394b1806f2b3 | 48c1f22ea431a36288b73bc53e8573f828eed88c | refs/heads/main | 2023-06-14T05:04:55.013084 | 2021-04-04T14:19:56 | 2021-04-04T14:19:56 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 654 | cpp | #include <iostream> // std::cout
#include <utility> // std::move
#include <future> // std::packaged_task, std::future
#include <thread> // std::thread
// 在新线程中启动一个 int(int) packaged_task.
std::future<int> launcher(std::packaged_task<int(int)>& tsk, int arg)
{
if (tsk.valid()) {
std::future<int> ret = tsk.get_future();
std::thread(std::move(tsk), arg).detach();
return ret;
}
else return std::future<int>();
}
int main()
{
std::packaged_task<int(int)> tsk([](int x){return x * 2; });
std::future<int> fut = launcher(tsk, 25);
std::cout << "The double of 25 is " << fut.get() << ".\n";
return 0;
} | [
"jackster@163.com"
] | jackster@163.com |
c94e27bee9efd64c5cfb8a732f3c924868bfd63f | adeea5b9477e06c2747898084533ff90a85d3411 | /CC2 Good Times/CC2 Good Times/Source.cpp | 9eacf05d8bd8022c6dd90d6ce3d5931ebae57ede | [] | no_license | Lev1ty/computer-contest-level-2-2 | 2fbf1ee5df28c9add42251a25ad3616bd8526359 | 990233d13519710cb45e41270d8a9dbec46580aa | refs/heads/master | 2021-05-30T13:44:27.606842 | 2016-01-16T03:47:12 | 2016-01-16T03:47:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,404 | cpp | #include<iostream>
using namespace std;
struct Time {
int hours, minutes;
};
Time ottawa, victoria, edmonton, winnipeg, toronto, halifax, stjohn;
int input;
Time convert(Time start, int difference) {
Time temp;
temp.hours = difference / 100;
temp.minutes = difference % 100;
Time end;
end.hours = start.hours + temp.hours;
end.minutes = start.minutes + temp.minutes;
if (end.minutes >= 60 && ++end.hours > 0 && (end.minutes -= 60) > 0);
if (end.minutes < 0) {--end.hours;end.minutes += 60;}
if (end.hours >= 24 && (end.hours -= 24) > 0);
if (end.hours < 0) end.hours += 24;
return end;
}
void print(Time t) {
if (t.minutes == 0 && t.hours != 0)cout << t.hours * 100;
else if (t.hours == 0 && t.minutes != 0)cout << t.minutes;
else cout << t.hours << t.minutes;
}
int main() {
cin >> input;
ottawa.hours = input / 100;
ottawa.minutes = input % 100;
victoria = convert(ottawa, -300);
edmonton = convert(ottawa, -200);
winnipeg = convert(ottawa, -100);
toronto = convert(ottawa, 0);
halifax = convert(ottawa, 100);
stjohn = convert(ottawa, 130);
print(ottawa);cout << " in Ottawa" << endl;
print(victoria);cout << " in Victoria" << endl;
print(edmonton);cout << " in Edmonton" << endl;
print(winnipeg);cout << " in Winnipeg" << endl;
print(toronto);cout << " in Toronto" << endl;
print(halifax);cout << " in Halifax" << endl;
print(stjohn);cout << " in St. John's" << endl;
} | [
"adamxhy123@outlook.com"
] | adamxhy123@outlook.com |
99c06722b7a96abbbda981c3d3d15abe5fa4cc3c | ccbf5fed9549089050046bd1fa9b96b02c10034e | /firmware/src/console.cpp | 42dc887220f648c553a3b68ad0494cb97a574a4e | [
"BSD-3-Clause"
] | permissive | HeterogeneousChao/sapog | 5964f359647a1de8a40732343a8a7c2d705d9044 | 43d981f94d2e8b79721e56cc339bb4d01f181a1d | refs/heads/master | 2021-06-01T07:39:58.898578 | 2016-07-23T09:29:16 | 2016-07-23T09:29:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,089 | cpp | /****************************************************************************
*
* Copyright (C) 2013 PX4 Development Team. All rights reserved.
* Author: Pavel Kirienko <pavel.kirienko@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name PX4 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.
*
****************************************************************************/
// TODO: rewrite in C++
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ch.h>
#include <hal.h>
#include <shell.h>
#include <chprintf.h>
#include <unistd.h>
#include <board/board.hpp>
#include <motor/motor.h>
#include <zubax_chibios/util/base64.hpp>
#include "console.hpp"
#pragma GCC diagnostic ignored "-Wunused-parameter"
static void cmd_cfg(BaseSequentialStream *, int argc, char *argv[])
{
// TODO: refuse to save/erase while the motor is running
os::config::executeCLICommand(argc, argv);
}
static void cmd_reboot(BaseSequentialStream *chp, int argc, char *argv[])
{
os::requestReboot();
}
static void cmd_beep(BaseSequentialStream *chp, int argc, char *argv[])
{
if (argc > 0 && !strcmp(argv[0], "help")) {
puts("beep [freq_hz [duration_msec]]");
return;
}
int freq = 500;
if (argc > 0) {
freq = atoi(argv[0]);
}
int duration = 300;
if (argc > 1) {
duration = atoi(argv[1]);
}
motor_beep(freq, duration);
}
static void cmd_stat(BaseSequentialStream *chp, int argc, char *argv[])
{
float voltage = 0, current = 0;
motor_get_input_voltage_current(&voltage, ¤t);
std::printf("Power V/A %-9f %f\n", voltage, current);
std::printf("RPM/DC %-9u %f\n", motor_get_rpm(), motor_get_duty_cycle());
std::printf("Active limits %i\n", motor_get_limit_mask());
std::printf("ZC failures %lu\n", (unsigned long)motor_get_zc_failures_since_start());
}
static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[])
{
puts("Hardware test...");
int res = motor_test_hardware();
if (res) {
std::printf("FAILED %i\n", res);
} else {
puts("OK");
}
puts("Motor test...");
res = motor_test_motor();
puts(res ? "Not connected" : "Connected");
}
static void cmd_dc(BaseSequentialStream *chp, int argc, char *argv[])
{
static const int TTL_MS = 30000;
if (argc == 0) {
motor_stop();
puts("Usage:\n"
" dc <duty cycle>\n"
" dc arm");
return;
}
// Safety check
static bool _armed = false;
if (!strcmp(argv[0], "arm")) {
_armed = true;
puts("OK");
return;
}
if (!_armed) {
puts("Error: Not armed");
return;
}
const float value = atoff(argv[0]);
std::printf("Duty cycle %f\n", value);
motor_set_duty_cycle(value, TTL_MS);
}
static void cmd_rpm(BaseSequentialStream *chp, int argc, char *argv[])
{
static const int TTL_MS = 30000;
if (argc == 0) {
motor_stop();
puts("Usage:\n"
" rpm <RPM>\n"
" rpm arm");
return;
}
// Safety check
static bool _armed = false;
if (!strcmp(argv[0], "arm")) {
_armed = true;
puts("OK");
return;
}
if (!_armed) {
puts("Error: Not armed");
return;
}
long value = (long)atoff(argv[0]);
value = (value < 0) ? 0 : value;
value = (value > 65535) ? 65535 : value;
std::printf("RPM %li\n", value);
motor_set_rpm((unsigned)value, TTL_MS);
}
static void cmd_startstop(BaseSequentialStream *chp, int argc, char *argv[])
{
static const int TTL_MS = 5000;
if (argc == 0) {
motor_stop();
puts("Usage:\n"
" startstop <number of cycles> [duty cycle = 0.1]");
return;
}
motor_stop();
const int num_cycles = (int)atoff(argv[0]);
const float dc = (argc > 1) ? atoff(argv[1]) : 0.1;
int current_cycle = 0;
for (; current_cycle < num_cycles; current_cycle++) {
printf("Cycle %d of %d, dc %f...\n", current_cycle + 1, num_cycles, dc);
// Waiting for the motor to spin down
sleep(3);
if (!motor_is_idle()) {
puts("NOT STOPPED");
break;
}
// Starting with the specified duty cycle
motor_set_duty_cycle(dc, TTL_MS);
// Checking if started and stopping
sleep(3);
if (!motor_is_running()) {
puts("NOT RUNNING");
break;
}
motor_stop();
}
printf("Finished %d cycles of %d\n", current_cycle, num_cycles);
}
static void cmd_md(BaseSequentialStream *chp, int argc, char *argv[])
{
motor_print_debug_info();
}
static void cmd_m(BaseSequentialStream *chp, int argc, char *argv[])
{
motor_execute_cli_command(argc, (const char**)argv);
}
static void cmd_zubax_id(BaseSequentialStream *chp, int argc, char *argv[])
{
if (argc == 0) {
// Product identification
printf("product_id : '%s'\n", NODE_NAME);
printf("product_name : 'PX4 Sapog'\n");
// SW version
printf("sw_version : '%u.%u'\n", FW_VERSION_MAJOR, FW_VERSION_MINOR);
printf("sw_vcs_commit: %u\n", unsigned(GIT_HASH));
printf("sw_build_date: %s\n", __DATE__);
// HW version
const auto hw_version = board::detect_hardware_version();
printf("hw_version : '%u.%u'\n", hw_version.major, hw_version.minor);
// Unique ID and signature
char base64_buf[os::base64::predictEncodedDataLength(std::tuple_size<board::DeviceSignature>::value) + 1];
std::array<std::uint8_t, 16> uid_128;
std::fill(std::begin(uid_128), std::end(uid_128), 0);
{
const auto uid = board::read_unique_id();
std::copy(std::begin(uid), std::end(uid), std::begin(uid_128));
}
printf("hw_unique_id : '%s'\n", os::base64::encode(uid_128, base64_buf));
board::DeviceSignature signature;
if (board::try_read_device_signature(signature)) {
printf("hw_signature : '%s'\n", os::base64::encode(signature, base64_buf));
std::memset(&base64_buf[0], 0, sizeof(base64_buf));
for (unsigned i = 0; i < 16; i++) {
chsnprintf(&base64_buf[i * 2], 3, "%02x", uid_128[i]);
}
printf("hw_info_url : http://device.zubax.com/device_info?uid=%s\n", &base64_buf[0]);
}
} else if (argc == 1) {
const char* const encoded = argv[0];
board::DeviceSignature sign;
if (!os::base64::decode(sign, encoded)) {
std::puts("Error: Invalid base64");
return;
}
if (!board::try_write_device_signature(sign)) {
std::puts("Error: Write failed");
return;
}
} else {
std::puts("Error: Invalid usage. Format: zubax_id [base64 signature]");
}
}
#define COMMAND(cmd) {#cmd, cmd_##cmd},
static const ShellCommand _commands[] =
{
COMMAND(cfg)
COMMAND(reboot)
COMMAND(beep)
COMMAND(stat)
COMMAND(test)
COMMAND(dc)
COMMAND(rpm)
COMMAND(startstop)
COMMAND(md)
COMMAND(m)
COMMAND(zubax_id)
{NULL, NULL}
};
// --------------------------
static const ShellConfig _config = {(BaseSequentialStream*)&STDOUT_SD, _commands};
static THD_WORKING_AREA(_wa_shell, 1024);
void console_init(void)
{
shellInit();
ASSERT_ALWAYS(shellCreateStatic(&_config, _wa_shell, sizeof(_wa_shell), LOWPRIO));
}
| [
"pavel.kirienko@gmail.com"
] | pavel.kirienko@gmail.com |
b714555588b16cef4c0e99264a74a3eb2abde535 | 920272e547d716937c5e90e9cbf27855a9b44ad8 | /bookingaroom.cpp | e163062446907bddea194665b6affeddb0172957 | [] | no_license | khanghy3004/Kattis | 405ec4471432cc00dde71cd196a520e5cce62b26 | 00f70cdfacbe29e732b0f6c80da25c6e56ff9553 | refs/heads/master | 2020-07-02T07:22:23.261341 | 2019-08-11T14:21:27 | 2019-08-11T14:21:27 | 201,455,618 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 419 | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, r, a;
bool b[105];
bool check = false;
cin >> n >> r;
for(int i = 1; i <= r; ++i) {
cin >> a;
b[a] = true;
}
for(int i = 1; i <= n; ++i) {
if(b[i] == false) {
cout << i;
check = true;
return 0;
}
}
if(!check) cout << "too late";
return 0;
}
| [
"khanghy3004@gmail.com"
] | khanghy3004@gmail.com |
7f805d27c063d690e7589d35e0fcf5e60963e94b | 45820e48851ac883478003fce0756374198a0393 | /Shoot-Game-Ver.1/Project3/ShapeShaderClass.h | b30bf2c15b757e0dc33400e3f1d4dcfe95ea8a8c | [
"MIT",
"GPL-3.0-only"
] | permissive | Piorosen/Yore-Program | 48dd3a9b13578aa79a13574d09fd49980430825d | 939e4633648db0f5b2e24fe7b639a232f5518a16 | refs/heads/master | 2022-12-10T06:34:19.951158 | 2019-02-07T01:58:23 | 2019-02-07T01:58:23 | 161,906,161 | 0 | 0 | MIT | 2022-12-08T01:48:08 | 2018-12-15T13:11:29 | C++ | UTF-8 | C++ | false | false | 1,061 | h | #pragma once
#include <d3d11.h>
#include <d3dx10math.h>
#include <d3dx11async.h>
#include <fstream>
using namespace std;
class ShapeShaderClass
{
private:
struct MatrixBufferType
{
D3DXMATRIX world;
D3DXMATRIX view;
D3DXMATRIX projection;
};
public:
ShapeShaderClass();
ShapeShaderClass(const ShapeShaderClass&);
~ShapeShaderClass();
bool Initialize(ID3D11Device*, HWND hwnd);
void Shutdown();
bool Render(ID3D11DeviceContext*, int indexCount, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix, D3DXMATRIX projectionMatrix);
private:
bool InitializeShader(ID3D11Device*, HWND, WCHAR* vsFilename, WCHAR* psFilename);
void ShutdownShader();
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR* shaderFilename);
bool SetShaderParameters(ID3D11DeviceContext*, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix, D3DXMATRIX projectionMatrix);
void RenderShader(ID3D11DeviceContext*, int indexCount);
private:
ID3D11VertexShader * m_vertexShader;
ID3D11PixelShader* m_pixelShader;
ID3D11InputLayout* m_layout;
ID3D11Buffer* m_matrixBuffer;
}; | [
"aoikazto@gmail.com"
] | aoikazto@gmail.com |
f33d9a1fea357a214e5540f6bb83dfa49f21f071 | 1865de97d9362499f81e49d0359ec0af3ec10a5d | /Lagrange.hpp | 29f346ca52eed1e48201d10085e43242b7c1062a | [] | no_license | mpily/numerical_methods | 7633f5fe138ca1ac3eacdbd30b4dc4f49c15188f | 275c197bb99f0df3d899a65cdae4e9ec6ace3b69 | refs/heads/main | 2023-06-16T21:10:21.308477 | 2021-07-07T11:00:29 | 2021-07-07T11:00:29 | 362,397,706 | 0 | 1 | null | 2021-07-07T11:00:30 | 2021-04-28T08:41:01 | C++ | UTF-8 | C++ | false | false | 1,380 | hpp | #ifndef LAGRANGE
#define LAGRANGE
#include"polynomials.hpp"
#include"polynomial.cpp"
#include<assert.h>
#include<vector>
template<class S>
struct Lagrange{
std:: vector<S> x_vals;
std :: vector<S> y_vals;
polynomial<S> lagrange_interpol;
Lagrange(std::vector<S>x, std::vector<S> y): x_vals(x),y_vals(y){};
void generate_Ls();
};
template<class S>
void Lagrange<S> :: generate_Ls(){
lagrange_interpol = make_poly<S>(S(0));
int n = x_vals.size();
assert((int)y_vals.size() == n && "the data is inconsistent");
for(int i = 0; i < n; ++i){
S denominator = 1;
auto numerator = make_poly<S>(S(1));
for(int j = 0; j < n; ++j){
if(i == j)continue;
std::vector<S> nxt = {-x_vals[j],S(1)};
polynomial<S>tomul(nxt);
numerator = numerator * tomul;
denominator = denominator * (x_vals[i] - x_vals[j]);
}
std:: cerr << numerator << "/" << denominator << "\n";
numerator = numerator * (y_vals[i] * 1.f/denominator);
lagrange_interpol = lagrange_interpol + numerator;
}
std :: cout << lagrange_interpol << "\n";
}
#endif
/*
Given a set of points generates a polynomial via Lagrange interpolation
the formula for Lagrange interpolation is
sum(l_i * y_i)
where l_i = (Product(x-xj))/(Product(xi - xj)) for all j != i;
*/
| [
"mboghobill16@gmail.com"
] | mboghobill16@gmail.com |
6c55d60036c29b3105152deaa40379302a0d17c6 | 920c4ef30727f0c51b5c9f00bdd9b923b541853e | /Code_Cpp/cppserver备份资料/code/library/source/encrypt/include/hmac_sha1.h | bd25d073dd7fc4f3553930894d9d96f0d520d6e8 | [] | no_license | fishney/TDServer | 10e50cd156b9109816ddebde241614a28546842a | 19305fc7bf649a9add86146bd1bfd253efa6e9cb | refs/heads/master | 2023-03-16T22:24:45.802339 | 2017-10-19T07:02:56 | 2017-10-19T07:02:56 | null | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 536 | h | /*----------------- hmac_sha1.h
*
* Copyright (C): 2011 Mokylin¡¤Mokyqi
* Author : ÕÔÎÄÔ´
* Version : V1.0
* Date : 2012/6/4 19:58:10
*--------------------------------------------------------------
*
*------------------------------------------------------------*/
#pragma once
/*************************************************************/
namespace hmac_sha1
{
unsigned int hmac_sha1(const char*key,unsigned int key_length,const char*data,unsigned int data_length,char*output,unsigned int out_lentth);
};
| [
"haibo tang"
] | haibo tang |
e238e3417b7eafbf021337691bde9d603d355ab1 | 8be023f90d9a18f4917af4bba8fb31230df3df2a | /SigLog_MibLib/hardware/memory/memory_netbsd.cpp | 6d4668b815a034b5e81ba0d6ba3002c6e78f9601 | [] | no_license | duniansampa/SigLog | d6dba1c0e851e1c8d3aef3af4bb85b4d038ab9c9 | 3dae0e42a36ebc5dca46fb044d3b1d40152ec786 | refs/heads/master | 2021-01-10T12:25:17.511236 | 2016-03-12T18:38:19 | 2016-03-12T18:38:19 | 44,571,851 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,427 | cpp | #include <siglog/net-snmp-config.h>
#include <siglog/net-snmp-includes.h>
#include <siglog/agent/net-snmp-agent-includes.h>
#include <siglog/agent/hardware/memory.h>
#include <unistd.h>
#include <errno.h>
#include <sys/sysctl.h>
#if HAVE_SYS_VMMETER_H
#include <sys/vmmeter.h>
#endif
#include <sys/swap.h>
#if defined(HAVE_UVM_UVM_PARAM_H) && defined(HAVE_UVM_UVM_EXTERN_H)
#include <uvm/uvm_param.h>
#include <uvm/uvm_extern.h>
#elif defined(HAVE_VM_VM_PARAM_H) && defined(HAVE_VM_VM_EXTERN_H)
#include <vm/vm_param.h>
#include <vm/vm_extern.h>
#else
#error memory_netbsd1.c: Is this really a NetBSD system?
#endif
#ifdef SWAP_NSWAP
void swapinfo(long);
#endif
/*
* Load the latest memory usage statistics
*/
int netsnmp_mem_arch_load( netsnmp_cache *cache, void *magic ) {
netsnmp_memory_info *mem;
long pagesize;
struct uvmexp uvmexp;
size_t uvmexp_size = sizeof(uvmexp);
struct vmtotal total;
size_t total_size = sizeof(total);
quad_t phys_mem;
quad_t user_mem;
size_t mem_size = sizeof(phys_mem);
#if defined(openbsd)
int phys_mem_mib[] = { CTL_HW, HW_PHYSMEM64 };
int user_mem_mib[] = { CTL_HW, HW_USERMEM64 };
int uvmexp_mib[] = { CTL_VM, VM_UVMEXP };
int total_mib[] = { CTL_VM, VM_METER };
#else
unsigned long bufspace;
unsigned long maxbufspace;
size_t buf_size = sizeof(bufspace);
#endif
/*
* Retrieve the memory information from the underlying O/S...
*/
#if defined(openbsd)
sysctl(uvmexp_mib, 2, &uvmexp, &uvmexp_size, NULL, 0);
sysctl(total_mib, 2, &total, &total_size, NULL, 0);
sysctl(phys_mem_mib, 2, &phys_mem, &mem_size, NULL, 0);
sysctl(user_mem_mib, 2, &user_mem, &mem_size, NULL, 0);
#else
if (sysctlbyname("vm.uvmexp", &uvmexp, &uvmexp_size, NULL, 0) == -1) {
snmp_log_perror("sysctl vm.uvmexp");
return -1;
}
if (sysctlbyname("vm.vmmeter", &total, &total_size, NULL, 0) == -1) {
snmp_log_perror("sysctl vm.vmmeter");
return -1;
}
if (sysctlbyname("hw.physmem64", &phys_mem, &mem_size, NULL, 0) == -1) {
snmp_log_perror("sysctl hw.physmem64");
return -1;
}
if (sysctlbyname("hw.usermem64", &user_mem, &mem_size, NULL, 0) == -1) {
snmp_log_perror("sysctl hw.usermem64");
return -1;
}
if (sysctlbyname("vm.bufmem", &bufspace, &buf_size, NULL, 0) == -1) {
snmp_log_perror("sysctl vm.bufmem");
return -1;
}
if (sysctlbyname("vm.bufmem_hiwater", &maxbufspace, &buf_size, NULL, 0) == -1) {
snmp_log_perror("sysctl vm.bufmem_hiwater");
return -1;
}
#endif
pagesize = sysconf(_SC_PAGESIZE);
/*
* ... and save this in a standard form.
*/
mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_PHYSMEM, 1 );
if (!mem) {
snmp_log_perror("No Physical Memory info entry");
} else {
if (!mem->descr)
mem->descr = strdup("Physical memory");
mem->units = pagesize;
mem->size = phys_mem/pagesize;
mem->free = total.t_free;
}
mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_USERMEM, 1 );
if (!mem) {
snmp_log_perror("No (user) Memory info entry");
} else {
if (!mem->descr)
mem->descr = strdup("Real memory");
mem->units = pagesize;
mem->size = user_mem/pagesize;
mem->free = uvmexp.free;
}
#if 1
mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_VIRTMEM, 1 );
if (!mem) {
snmp_log_perror("No Virtual Memory info entry");
} else {
if (!mem->descr)
mem->descr = strdup("Virtual memory");
mem->units = pagesize;
mem->size = total.t_vm;
mem->free = total.t_avm;
}
mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SHARED, 1 );
if (!mem) {
snmp_log_perror("No Shared Memory info entry");
} else {
if (!mem->descr)
mem->descr = strdup("Shared virtual memory");
mem->units = pagesize;
mem->size = total.t_vmshr;
mem->free = total.t_avmshr;
}
mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SHARED2, 1 );
if (!mem) {
snmp_log_perror("No Shared2 Memory info entry");
} else {
if (!mem->descr)
mem->descr = strdup("Shared real memory");
mem->units = pagesize;
mem->size = total.t_rmshr;
mem->free = total.t_armshr;
}
#endif
#ifdef SWAP_NSWAP
swapinfo(pagesize);
#endif
mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SWAP, 1 );
if (!mem) {
snmp_log_perror("No Swap info entry");
} else {
if (!mem->descr)
mem->descr = strdup("Swap space");
mem->units = pagesize;
mem->size = uvmexp.swpages;
mem->free = uvmexp.swpages - uvmexp.swpginuse;
mem->other = -1;
}
#if defined(__NetBSD__)
mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_MBUF, 1 );
if (!mem) {
snmp_log_perror("No Buffer, etc info entry");
} else {
if (!mem->descr)
mem->descr = strdup("Memory buffers");
mem->units = 1024;
mem->size = maxbufspace /1024;
mem->size = (maxbufspace - bufspace)/1024;
}
#endif
return 0;
}
#ifdef SWAP_NSWAP
/*
* If there are multiple swap devices, record
* the statistics for each one individually.
*/
void
swapinfo(long pagesize)
{
int i, n;
struct swapent *s;
netsnmp_memory_info *mem;
char buf[1024];
/*
* If there's only one swap device, don't bother
*/
n = swapctl( SWAP_NSWAP, NULL, 0 );
if ( n <= 1 )
return;
s = (struct swapent*)calloc(n, sizeof(struct swapent));
swapctl( SWAP_STATS, s, n );
for (i = 0; i < n; ++i) {
mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SWAP+1+i, 1 );
if (!mem)
continue;
if (!mem->descr) {
/* sprintf(buf, "swap #%d", s[i].se_dev); */
sprintf(buf, "swap %s", s[i].se_path);
mem->descr = strdup( buf );
}
mem->units = pagesize;
mem->size = s[i].se_nblks;
mem->free = s[i].se_nblks - s[i].se_inuse;
mem->other = -1;
}
}
#endif
| [
"duniansampa@outlook.com"
] | duniansampa@outlook.com |
df55a78469441b6379b2fd89babb2ed90a9bfad1 | b05328f849055f4e64803116c60ac05762b22430 | /src/user_type_value.cpp | dcdb4e35884e9ed75fee8a9d7b1895d3f3b1b4df | [
"Apache-2.0"
] | permissive | phongth7/cpp-driver | 956258c04c8e0b1cd3470a1add5aaed0cc295766 | ef6260412fe28d88390cb3aa8ea456f1972eff57 | refs/heads/master | 2021-01-22T06:14:24.396190 | 2016-03-01T19:19:26 | 2016-03-01T19:19:26 | 52,947,492 | 1 | 0 | null | 2016-03-02T08:42:22 | 2016-03-02T08:42:22 | null | UTF-8 | C++ | false | false | 4,927 | cpp | /*
Copyright (c) 2014-2015 DataStax
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "user_type_value.hpp"
#include "collection.hpp"
#include "macros.hpp"
#include "external_types.hpp"
#include "utils.hpp"
#include <string.h>
extern "C" {
CassUserType* cass_user_type_new_from_data_type(const CassDataType* data_type) {
if (!data_type->is_user_type()) {
return NULL;
}
return CassUserType::to(
new cass::UserTypeValue(
cass::SharedRefPtr<const cass::DataType>(data_type)));
}
void cass_user_type_free(CassUserType* user_type) {
delete user_type->from();
}
const CassDataType* cass_user_type_data_type(const CassUserType* user_type) {
return CassDataType::to(user_type->data_type().get());
}
#define CASS_USER_TYPE_SET(Name, Params, Value) \
CassError cass_user_type_set_##Name(CassUserType* user_type, \
size_t index Params) { \
return user_type->set(index, Value); \
} \
CassError cass_user_type_set_##Name##_by_name(CassUserType* user_type, \
const char* name Params) { \
return user_type->set(cass::StringRef(name), Value); \
} \
CassError cass_user_type_set_##Name##_by_name_n(CassUserType* user_type, \
const char* name, \
size_t name_length Params) { \
return user_type->set(cass::StringRef(name, name_length), Value); \
}
CASS_USER_TYPE_SET(null, ZERO_PARAMS_(), cass::CassNull())
CASS_USER_TYPE_SET(int8, ONE_PARAM_(cass_int8_t value), value)
CASS_USER_TYPE_SET(int16, ONE_PARAM_(cass_int16_t value), value)
CASS_USER_TYPE_SET(int32, ONE_PARAM_(cass_int32_t value), value)
CASS_USER_TYPE_SET(uint32, ONE_PARAM_(cass_uint32_t value), value)
CASS_USER_TYPE_SET(int64, ONE_PARAM_(cass_int64_t value), value)
CASS_USER_TYPE_SET(float, ONE_PARAM_(cass_float_t value), value)
CASS_USER_TYPE_SET(double, ONE_PARAM_(cass_double_t value), value)
CASS_USER_TYPE_SET(bool, ONE_PARAM_(cass_bool_t value), value)
CASS_USER_TYPE_SET(inet, ONE_PARAM_(CassInet value), value)
CASS_USER_TYPE_SET(uuid, ONE_PARAM_(CassUuid value), value)
CASS_USER_TYPE_SET(collection, ONE_PARAM_(const CassCollection* value), value)
CASS_USER_TYPE_SET(tuple, ONE_PARAM_(const CassTuple* value), value)
CASS_USER_TYPE_SET(user_type, ONE_PARAM_(const CassUserType* value), value)
CASS_USER_TYPE_SET(bytes,
TWO_PARAMS_(const cass_byte_t* value, size_t value_size),
cass::CassBytes(value, value_size))
CASS_USER_TYPE_SET(decimal,
THREE_PARAMS_(const cass_byte_t* varint, size_t varint_size, int scale),
cass::CassDecimal(varint, varint_size, scale))
#undef CASS_USER_TYPE_SET
CassError cass_user_type_set_string(CassUserType* user_type,
size_t index,
const char* value) {
return user_type->set(index, cass::CassString(value, strlen(value)));
}
CassError cass_user_type_set_string_n(CassUserType* user_type,
size_t index,
const char* value,
size_t value_length) {
return user_type->set(index, cass::CassString(value, value_length));
}
CassError cass_user_type_set_string_by_name(CassUserType* user_type,
const char* name,
const char* value) {
return user_type->set(cass::StringRef(name),
cass::CassString(value, strlen(value)));
}
CassError cass_user_type_set_string_by_name_n(CassUserType* user_type,
const char* name,
size_t name_length,
const char* value,
size_t value_length) {
return user_type->set(cass::StringRef(name, name_length),
cass::CassString(value, value_length));
}
} // extern "C"
| [
"michael.penick@datastax.com"
] | michael.penick@datastax.com |
6b287326e2fbb83f1277347a7ce74c1735b50d13 | 7d81122c54c1416612253cb359f8ab2b0afb4ded | /src/main.cpp | 047870307a177e684d10d3793d35deb21c24ccf9 | [] | no_license | anrothis/WemosD1mini_Motion_Sensor | 25ac3b9a3c2fb5ac8d5f4594d849fc920fa7610d | 80621069791f5115d4a2feafba921e8047433f12 | refs/heads/master | 2023-03-03T12:29:11.968177 | 2021-02-08T13:11:56 | 2021-02-08T13:11:56 | 337,077,178 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,948 | cpp | #include <Arduino.h>
#include <ESP8266WiFi.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
#include <credentials.h>
// #define DEBUG // Debug Node
#ifdef DEBUG
#define DEBUG_PRINT(x) Serial.print (x)
#define DEBUG_PRINTDEC(x) Serial.print (x, DEC)
#define DEBUG_PRINTLN(x) Serial.println (x)
#else
#define DEBUG_PRINT(x)
#define DEBUG_PRINTDEC(x)
#define DEBUG_PRINTLN(x)
#endif
//*----------------------------------------------------------------------------------------------*//
//*----------------------------- Init Classes & Variables ----------------------------------*//
//*----------------------------------------------------------------------------------------------*//
// const char* ssid = "xxxxxxxxxxxx";
// const char* password = "xxxxxxxxxxxxxx";
const long utcOffsetInSeconds = 3600;
char daysOfTheWeek[7][12] = {"Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"};
WiFiClient espClient;
WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP, "192.168.2.128", utcOffsetInSeconds);
void setup_wifi() {
delay(10);
DEBUG_PRINTLN();
DEBUG_PRINT("Connecting to ");
DEBUG_PRINTLN(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
DEBUG_PRINT(".");
}
randomSeed(micros());
DEBUG_PRINTLN("");
DEBUG_PRINTLN("WiFi connected");
DEBUG_PRINTLN("IP address: ");
DEBUG_PRINTLN(WiFi.localIP());
}
void setup() {
pinMode(14, INPUT);
pinMode(5, OUTPUT);
pinMode(LED_BUILTIN, OUTPUT);
#ifdef DEBUG
Serial.begin(115200);
DEBUG_PRINTLN(F("\nBuildtime"));
DEBUG_PRINTLN(__DATE__);
DEBUG_PRINTLN(__TIME__);
#endif
//*----------------------------------------------------------------------------------------------*//
//*--------------------------- Setup WiFi & MQTT ------------------------------------------*//
//*----------------------------------------------------------------------------------------------*//
setup_wifi();
timeClient.begin();
ArduinoOTA.setHostname("IoT_Movment_Light");
ArduinoOTA.onStart([]() {
String type;
if (ArduinoOTA.getCommand() == U_FLASH) {
type = "sketch";
} else { // U_FS
type = "filesystem";
}
// NOTE: if updating FS this would be the place to unmount FS using FS.end()
Serial.println("Start updating " + type);
});
ArduinoOTA.onEnd([]() {
Serial.println("\nEnd");
});
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
});
ArduinoOTA.onError([](ota_error_t error) {
Serial.printf("Error[%u]: ", error);
if (error == OTA_AUTH_ERROR) {
Serial.println("Auth Failed");
} else if (error == OTA_BEGIN_ERROR) {
Serial.println("Begin Failed");
} else if (error == OTA_CONNECT_ERROR) {
Serial.println("Connect Failed");
} else if (error == OTA_RECEIVE_ERROR) {
Serial.println("Receive Failed");
} else if (error == OTA_END_ERROR) {
Serial.println("End Failed");
}
});
ArduinoOTA.begin();
}
void loop() {
ArduinoOTA.handle();
long unsigned int time = millis();
int setTimer = 30;
int duration = setTimer * 1000;
timeClient.update();
int hour = timeClient.getHours();
if(digitalRead(14)== HIGH && (hour >= 17 || hour < 8))
{
while((duration > millis() - time) && (millis() - time >= 0))
{
digitalWrite(5,HIGH);
if(digitalRead(14)== HIGH)
{
time = millis();
digitalWrite(LED_BUILTIN, LOW);
DEBUG_PRINT(F("Movement detected at "));
DEBUG_PRINTLN(time);
DEBUG_PRINTLN(timeClient.getFormattedTime());
DEBUG_PRINTLN(daysOfTheWeek[timeClient.getDay()]);
delay(500);
digitalWrite(LED_BUILTIN, HIGH);
}
yield();
}
}
else
{
digitalWrite(LED_BUILTIN, HIGH);
digitalWrite(5, LOW);
delay(100);
}
} | [
"riedel-sebastian@t-online.de"
] | riedel-sebastian@t-online.de |
70da5dfdd46335db53aaa8f91597708dd755751c | a5c572b13be02f3b41eb4102eefd30e473c90e9b | /mytest02/test005.cc | 3d40eb1b676d0afdbcda5519d78da3c045f47847 | [] | no_license | dawoniu1991/cppstudyOnLinux | 626b6b5cafaf4b4e9cc7323cc2bb8e9ec21f88f1 | 58b2f9f597d60c85d3af652d34649e8d87a80ec9 | refs/heads/main | 2023-07-18T07:08:34.322609 | 2021-08-17T09:25:18 | 2021-08-17T09:25:18 | 361,681,700 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,094 | cc | #include <iostream>
#include <thread>
#include <zmq.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
using namespace std;
void say() {
cout << "this is say function print" << endl;
void *context = zmq_init(1);
// 与客户端通信的套接字
void *responder = zmq_socket(context, ZMQ_REP);
zmq_bind(responder, "tcp://*:7777");
printf("收到 Hello~~\n");
// 等待客户端请求
zmq_msg_t request;
zmq_msg_init(&request);
// zmq_msg_recv(&request, &responder, 0);
int num=1122;
printf("收到kaishi jieshou xiaoxi\n");
while (true) {
num=zmq_msg_recv(&request, responder, 0);
printf("waiting for you\n");
if ( num != -1) break;
// if (zmq_msg_recv(&request, responder, 0) != -1) break;
// std::cout<< "dengdaizhong=="<<std::endl;
}
printf("end kaishi jieshou xiaoxi\n");
std::cout<< "num=="<<num<<std::endl;
char* buf = (char *)zmq_msg_data(&request);
std::cout<< "buf=="<<buf<<std::endl;
std::cout<< "buf=="<<string(buf)<<std::endl;
std::cout<< "buf=="<<string(buf).size()<<std::endl;
int i=0;
size_t size = zmq_msg_size(&request);
std::cout<< "size=="<<size<<std::endl;
for (; i < size; ++i) {
std::cout<< buf[i]<<std::endl;
}
zmq_msg_close(&request);
zmq_close(responder);
zmq_term(context);
std::cout<< "server end======"<<std::endl;
}
int main() {
// thread t(say);
std::unique_ptr<std::thread> receiver_thread_ = std::unique_ptr<std::thread>(new std::thread(say));
for(int i=0;i<5;i++){
cout << "main hanshu" << endl;
}
// t.join();
receiver_thread_->join();
cout << "main end========" << endl;
return 0;
} | [
"1278943797@qq.com"
] | 1278943797@qq.com |
f32c848fb1a4f9044f281b540a082c1786e32766 | b5bf024dce1323dedd6ec357183d0585ba3d8fc2 | /lib/source/libcarla/Blueprint.cpp | 32c6db4c9e8669f31f380bb7da4515bebc54feb6 | [] | no_license | rafita96/Tutorial-CARLA | f79ab62bb10d5b28b0ae4f2d83c9475b889c8583 | 6cd03b6b08a011d4673b35b4cbba9139b61a42df | refs/heads/master | 2020-08-11T04:20:44.076393 | 2019-10-29T03:13:37 | 2019-10-29T03:13:37 | 214,489,616 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,362 | cpp | // Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
// de Barcelona (UAB).
//
// This work is licensed under the terms of the MIT license.
// For a copy, see <https://opensource.org/licenses/MIT>.
#include <carla/client/BlueprintLibrary.h>
#include <carla/client/ActorBlueprint.h>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
#include <ostream>
namespace carla {
namespace sensor {
namespace data {
std::ostream &operator<<(std::ostream &out, const Color &color) {
out << "Color(" << std::to_string(color.r)
<< ',' << std::to_string(color.g)
<< ',' << std::to_string(color.b)
<< ',' << std::to_string(color.a) << ')';
return out;
}
} // namespace data
} // namespace sensor
namespace client {
std::ostream &operator<<(std::ostream &out, const ActorAttribute &attr) {
using Type = carla::rpc::ActorAttributeType;
static_assert(static_cast<uint8_t>(Type::SIZE) == 5u, "Please update this function.");
out << "ActorAttribute(id=" << attr.GetId();
switch (attr.GetType()) {
case Type::Bool:
out << ",type=bool,value=" << (attr.As<bool>() ? "True" : "False");
break;
case Type::Int:
out << ",type=int,value=" << attr.As<int>();
break;
case Type::Float:
out << ",type=float,value=" << attr.As<float>();
break;
case Type::String:
out << ",type=str,value=" << attr.As<std::string>();
break;
case Type::RGBColor:
out << ",type=Color,value=" << attr.As<sensor::data::Color>();
break;
default:
out << ",INVALID";
}
if (!attr.IsModifiable()) {
out << "(const)";
}
out << ')';
return out;
}
std::ostream &operator<<(std::ostream &out, const ActorBlueprint &bp) {
out << "ActorBlueprint(id=" << bp.GetId() << ",tags=" << bp.GetTags() << ')';
return out;
}
std::ostream &operator<<(std::ostream &out, const BlueprintLibrary &blueprints) {
return PrintList(out, blueprints);
}
} // namespace client
} // namespace carla
void export_blueprint() {
using namespace boost::python;
namespace cc = carla::client;
namespace crpc = carla::rpc;
namespace csd = carla::sensor::data;
enum_<crpc::ActorAttributeType>("ActorAttributeType")
.value("Bool", crpc::ActorAttributeType::Bool)
.value("Int", crpc::ActorAttributeType::Int)
.value("Float", crpc::ActorAttributeType::Float)
.value("String", crpc::ActorAttributeType::String)
.value("RGBColor", crpc::ActorAttributeType::RGBColor)
;
class_<csd::Color>("Color")
.def(init<uint8_t, uint8_t, uint8_t, uint8_t>(
(arg("r")=0, arg("g")=0, arg("b")=0, arg("a")=255)))
.def_readwrite("r", &csd::Color::r)
.def_readwrite("g", &csd::Color::g)
.def_readwrite("b", &csd::Color::b)
.def_readwrite("a", &csd::Color::a)
.def("__eq__", &csd::Color::operator==)
.def("__ne__", &csd::Color::operator!=)
.def(self_ns::str(self_ns::self))
;
class_<cc::ActorAttribute>("ActorAttribute", no_init)
.add_property("id", CALL_RETURNING_COPY(cc::ActorAttribute, GetId))
.add_property("type", &cc::ActorAttribute::GetType)
.add_property("recommended_values", CALL_RETURNING_LIST(cc::ActorAttribute, GetRecommendedValues))
.add_property("is_modifiable", &cc::ActorAttribute::IsModifiable)
.def("as_bool", &cc::ActorAttribute::As<bool>)
.def("as_int", &cc::ActorAttribute::As<int>)
.def("as_float", &cc::ActorAttribute::As<float>)
.def("as_str", &cc::ActorAttribute::As<std::string>)
.def("as_color", &cc::ActorAttribute::As<csd::Color>)
.def("__eq__", &cc::ActorAttributeValueAccess::operator==<bool>)
.def("__eq__", &cc::ActorAttributeValueAccess::operator==<int>)
.def("__eq__", &cc::ActorAttributeValueAccess::operator==<float>)
.def("__eq__", &cc::ActorAttributeValueAccess::operator==<std::string>)
.def("__eq__", &cc::ActorAttributeValueAccess::operator==<csd::Color>)
.def("__eq__", &cc::ActorAttributeValueAccess::operator==<cc::ActorAttribute>)
.def("__ne__", &cc::ActorAttributeValueAccess::operator!=<bool>)
.def("__ne__", &cc::ActorAttributeValueAccess::operator!=<int>)
.def("__ne__", &cc::ActorAttributeValueAccess::operator!=<float>)
.def("__ne__", &cc::ActorAttributeValueAccess::operator!=<std::string>)
.def("__ne__", &cc::ActorAttributeValueAccess::operator!=<csd::Color>)
.def("__ne__", &cc::ActorAttributeValueAccess::operator!=<cc::ActorAttribute>)
.def("__nonzero__", &cc::ActorAttribute::As<bool>)
.def("__bool__", &cc::ActorAttribute::As<bool>)
.def("__int__", &cc::ActorAttribute::As<int>)
.def("__float__", &cc::ActorAttribute::As<float>)
.def("__str__", &cc::ActorAttribute::As<std::string>)
.def(self_ns::str(self_ns::self))
;
class_<cc::ActorBlueprint>("ActorBlueprint", no_init)
.add_property("id", CALL_RETURNING_COPY(cc::ActorBlueprint, GetId))
.add_property("tags", CALL_RETURNING_LIST(cc::ActorBlueprint, GetTags))
.def("has_tag", &cc::ActorBlueprint::ContainsTag)
.def("match_tags", &cc::ActorBlueprint::MatchTags)
.def("has_attribute", &cc::ActorBlueprint::ContainsAttribute)
.def("get_attribute", CALL_RETURNING_COPY_1(cc::ActorBlueprint, GetAttribute, const std::string &))
.def("set_attribute", &cc::ActorBlueprint::SetAttribute)
.def("__len__", &cc::ActorBlueprint::size)
.def("__iter__", range(&cc::ActorBlueprint::begin, &cc::ActorBlueprint::end))
.def(self_ns::str(self_ns::self))
;
class_<cc::BlueprintLibrary, boost::noncopyable, boost::shared_ptr<cc::BlueprintLibrary>>("BlueprintLibrary", no_init)
.def("find", +[](const cc::BlueprintLibrary &self, const std::string &key) -> cc::ActorBlueprint {
return self.at(key);
}, (arg("id")))
.def("filter", &cc::BlueprintLibrary::Filter, (arg("wildcard_pattern")))
.def("__getitem__", +[](const cc::BlueprintLibrary &self, size_t pos) -> cc::ActorBlueprint {
return self.at(pos);
})
.def("__len__", &cc::BlueprintLibrary::size)
.def("__iter__", range(&cc::BlueprintLibrary::begin, &cc::BlueprintLibrary::end))
.def(self_ns::str(self_ns::self))
;
}
| [
"rperalta@cicese.edu.mx"
] | rperalta@cicese.edu.mx |
79cd3948301c55c811f1926a9c30c553b7b4f247 | d7e492e40c23573a9ab6cd0dd572390bbef2a1ae | /src/syntax/ExprSyntaxNodeBuilders.cpp | e179db19455944f1ad2db370010501b33f4a756a | [] | no_license | aimeidefashi/polarphp | 1971ebd6189caef114a9d650455ea35dd0f21cc4 | bf3b2f796a8d533ae7557cd50f0742719d4918da | refs/heads/master | 2020-06-27T21:29:29.353040 | 2019-08-01T13:14:10 | 2019-08-01T13:14:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 15,210 | cpp | // This source file is part of the polarphp.org open source project
//
// Copyright (c) 2017 - 2019 polarphp software foundation
// Copyright (c) 2017 - 2019 zzu_softboy <zzu_softboy@163.com>
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://polarphp.org/LICENSE.txt for license information
// See https://polarphp.org/CONTRIBUTORS.txt for the list of polarphp project authors
//
// Created by polarboy on 2019/05/17.
#include "polarphp/syntax/builder/ExprSyntaxNodeBuilders.h"
namespace polar::syntax {
///
/// NullExprSyntaxBuilder
///
NullExprSyntaxBuilder &NullExprSyntaxBuilder::useNullKeyword(TokenSyntax nullKeyword)
{
m_layout[cursor_index(Cursor::NullKeyword)] = nullKeyword.getRaw();
return *this;
}
NullExprSyntax NullExprSyntaxBuilder::build()
{
CursorIndex nullKeywordIndex = cursor_index(Cursor::NullKeyword);
if (!m_layout[nullKeywordIndex]) {
m_layout[nullKeywordIndex] = RawSyntax::missing(TokenKindType::T_NULL,
OwnedString::makeUnowned(get_token_text(TokenKindType::T_NULL)));
}
RefCountPtr<RawSyntax> rawNullExpr = RawSyntax::make(SyntaxKind::NullExpr, m_layout,
SourcePresence::Present, m_arena);
return make<NullExprSyntax>(rawNullExpr);
}
///
/// ClassRefParentExprSyntaxBuilder
///
ClassRefParentExprSyntaxBuilder &ClassRefParentExprSyntaxBuilder::useParentKeyword(TokenSyntax parentKeyword)
{
m_layout[cursor_index(Cursor::ParentKeyword)] = parentKeyword.getRaw();
return *this;
}
ClassRefParentExprSyntax ClassRefParentExprSyntaxBuilder::build()
{
CursorIndex parentKeywordIndex = cursor_index(Cursor::ParentKeyword);
if (!m_layout[parentKeywordIndex]) {
m_layout[parentKeywordIndex] = RawSyntax::missing(TokenKindType::T_CLASS_REF_PARENT,
OwnedString::makeUnowned(get_token_text(TokenKindType::T_CLASS_REF_PARENT)));
}
RefCountPtr<RawSyntax> rawParentKeyword = RawSyntax::make(SyntaxKind::ClassRefParentExpr, m_layout, SourcePresence::Present,
m_arena);
return make<ClassRefParentExprSyntax>(rawParentKeyword);
}
///
/// ClassRefSelfExprSyntaxBuilder
///
ClassRefSelfExprSyntaxBuilder &ClassRefSelfExprSyntaxBuilder::useSelfKeyword(TokenSyntax selfKeyword)
{
m_layout[cursor_index(Cursor::SelfKeyword)] = selfKeyword.getRaw();
return *this;
}
ClassRefSelfExprSyntax ClassRefSelfExprSyntaxBuilder::build()
{
CursorIndex selfKeywordIndex = cursor_index(Cursor::SelfKeyword);
if (!m_layout[selfKeywordIndex]) {
m_layout[selfKeywordIndex] = RawSyntax::missing(TokenKindType::T_CLASS_REF_SELF,
OwnedString::makeUnowned(get_token_text(TokenKindType::T_CLASS_REF_SELF)));
}
RefCountPtr<RawSyntax> rawParentKeyword = RawSyntax::make(SyntaxKind::ClassRefSelfExpr, m_layout, SourcePresence::Present,
m_arena);
return make<ClassRefSelfExprSyntax>(rawParentKeyword);
}
///
/// ClassRefStaticExprSyntaxBuilder
///
ClassRefStaticExprSyntaxBuilder &ClassRefStaticExprSyntaxBuilder::useStaticKeyword(TokenSyntax staticKeyword)
{
m_layout[cursor_index(Cursor::StaticKeyword)] = staticKeyword.getRaw();
return *this;
}
ClassRefStaticExprSyntax ClassRefStaticExprSyntaxBuilder::build()
{
CursorIndex staticKeywordIndex = cursor_index(Cursor::StaticKeyword);
if (!m_layout[staticKeywordIndex]) {
m_layout[staticKeywordIndex] = RawSyntax::missing(TokenKindType::T_CLASS_REF_STATIC,
OwnedString::makeUnowned(get_token_text(TokenKindType::T_CLASS_REF_STATIC)));
}
RefCountPtr<RawSyntax> rawParentKeyword = RawSyntax::make(SyntaxKind::ClassRefStaticExpr, m_layout, SourcePresence::Present,
m_arena);
return make<ClassRefStaticExprSyntax>(rawParentKeyword);
}
///
/// IntegerLiteralExprSyntaxBuilder
///
IntegerLiteralExprSyntaxBuilder &IntegerLiteralExprSyntaxBuilder::useDigits(TokenSyntax digits)
{
m_layout[cursor_index(Cursor::Digits)] = digits.getRaw();
return *this;
}
IntegerLiteralExprSyntax IntegerLiteralExprSyntaxBuilder::build()
{
CursorIndex digitsIndex = cursor_index(Cursor::Digits);
if (!m_layout[digitsIndex]) {
m_layout[digitsIndex] = RawSyntax::missing(TokenKindType::T_LNUMBER,
OwnedString::makeUnowned(get_token_text(TokenKindType::T_LNUMBER)));
}
RefCountPtr<RawSyntax> rawDigits = RawSyntax::make(SyntaxKind::IntegerLiteralExpr, m_layout, SourcePresence::Present,
m_arena);
return make<IntegerLiteralExprSyntax>(rawDigits);
}
///
/// FloatLiteralExprSyntaxBuilder
///
FloatLiteralExprSyntaxBuilder &FloatLiteralExprSyntaxBuilder::useFloatDigits(TokenSyntax digits)
{
m_layout[cursor_index(Cursor::FloatDigits)] = digits.getRaw();
return *this;
}
FloatLiteralExprSyntax FloatLiteralExprSyntaxBuilder::build()
{
CursorIndex digitsIndex = cursor_index(Cursor::FloatDigits);
if (!m_layout[digitsIndex]) {
m_layout[digitsIndex] = RawSyntax::missing(TokenKindType::T_DNUMBER,
OwnedString::makeUnowned(get_token_text(TokenKindType::T_DNUMBER)));
}
RefCountPtr<RawSyntax> rawDigits = RawSyntax::make(SyntaxKind::FloatLiteralExpr, m_layout, SourcePresence::Present,
m_arena);
return make<FloatLiteralExprSyntax>(rawDigits);
}
///
/// StringLiteralExprSyntaxBuilder
///
StringLiteralExprSyntaxBuilder &StringLiteralExprSyntaxBuilder::useString(TokenSyntax str)
{
m_layout[cursor_index(Cursor::String)] = str.getRaw();
return *this;
}
StringLiteralExprSyntax StringLiteralExprSyntaxBuilder::build()
{
CursorIndex strIndex = cursor_index(Cursor::String);
if (!m_layout[strIndex]) {
m_layout[strIndex] = RawSyntax::missing(TokenKindType::T_IDENTIFIER_STRING,
OwnedString::makeUnowned(get_token_text(TokenKindType::T_IDENTIFIER_STRING)));
}
RefCountPtr<RawSyntax> rawDigits = RawSyntax::make(SyntaxKind::StringLiteralExpr, m_layout, SourcePresence::Present,
m_arena);
return make<StringLiteralExprSyntax>(rawDigits);
}
///
/// BooleanLiteralExprSyntaxBuilder
///
BooleanLiteralExprSyntaxBuilder &BooleanLiteralExprSyntaxBuilder::useBoolean(TokenSyntax booleanValue)
{
m_layout[cursor_index(Cursor::Boolean)] = booleanValue.getRaw();
return *this;
}
BooleanLiteralExprSyntax BooleanLiteralExprSyntaxBuilder::build()
{
CursorIndex booleanIndex = cursor_index(Cursor::Boolean);
if (!m_layout[booleanIndex]) {
m_layout[booleanIndex] = RawSyntax::missing(TokenKindType::T_TRUE,
OwnedString::makeUnowned(get_token_text(TokenKindType::T_TRUE)));
}
RefCountPtr<RawSyntax> rawDigits = RawSyntax::make(SyntaxKind::BooleanLiteralExpr, m_layout, SourcePresence::Present,
m_arena);
return make<BooleanLiteralExprSyntax>(rawDigits);
}
///
/// TernaryExprSyntaxBuilder
///
TernaryExprSyntaxBuilder &TernaryExprSyntaxBuilder::useConditionExpr(ExprSyntax conditionExpr)
{
m_layout[cursor_index(Cursor::ConditionExpr)] = conditionExpr.getRaw();
return *this;
}
TernaryExprSyntaxBuilder &TernaryExprSyntaxBuilder::useQuestionMark(TokenSyntax questionMark)
{
m_layout[cursor_index(Cursor::QuestionMark)] = questionMark.getRaw();
return *this;
}
TernaryExprSyntaxBuilder &TernaryExprSyntaxBuilder::useFirstChoice(ExprSyntax firstChoice)
{
m_layout[cursor_index(Cursor::FirstChoice)] = firstChoice.getRaw();
return *this;
}
TernaryExprSyntaxBuilder &TernaryExprSyntaxBuilder::useColonMark(TokenSyntax colonMark)
{
m_layout[cursor_index(Cursor::ColonMark)] = colonMark.getRaw();
return *this;
}
TernaryExprSyntaxBuilder &TernaryExprSyntaxBuilder::useSecondChoice(ExprSyntax secondChoice)
{
m_layout[cursor_index(Cursor::SecondChoice)] = secondChoice.getRaw();
return *this;
}
TernaryExprSyntax TernaryExprSyntaxBuilder::build()
{
CursorIndex conditionExprIndex = cursor_index(Cursor::ConditionExpr);
CursorIndex questionMarkIndex = cursor_index(Cursor::QuestionMark);
CursorIndex firstChoiceIndex = cursor_index(Cursor::FirstChoice);
CursorIndex colonMarkIndex = cursor_index(Cursor::ColonMark);
CursorIndex secondChoiceIndex = cursor_index(Cursor::SecondChoice);
if (!m_layout[conditionExprIndex]) {
m_layout[conditionExprIndex] = RawSyntax::missing(SyntaxKind::Expr);
}
if (!m_layout[questionMarkIndex]) {
m_layout[questionMarkIndex] = RawSyntax::missing(TokenKindType::T_QUESTION_MARK,
OwnedString::makeUnowned(get_token_text(TokenKindType::T_QUESTION_MARK)));
}
if (!m_layout[firstChoiceIndex]) {
m_layout[firstChoiceIndex] = RawSyntax::missing(SyntaxKind::Expr);
}
if (!m_layout[colonMarkIndex]) {
m_layout[colonMarkIndex] = RawSyntax::missing(TokenKindType::T_COLON,
OwnedString::makeUnowned(get_token_text(TokenKindType::T_COLON)));
}
if (!m_layout[secondChoiceIndex]) {
m_layout[secondChoiceIndex] = RawSyntax::missing(SyntaxKind::Expr);
}
RefCountPtr<RawSyntax> rawTernaryExprSyntax = RawSyntax::make(SyntaxKind::TernaryExpr, m_layout, SourcePresence::Present,
m_arena);
return make<TernaryExprSyntax>(rawTernaryExprSyntax);
}
///
/// AssignmentExprSyntax
///
AssignmentExprSyntaxBuilder &AssignmentExprSyntaxBuilder::useAssignToken(TokenSyntax assignToken)
{
m_layout[cursor_index(Cursor::AssignToken)] = assignToken.getRaw();
return *this;
}
AssignmentExprSyntax AssignmentExprSyntaxBuilder::build()
{
CursorIndex assignTokenIndex = cursor_index(Cursor::AssignToken);
if (!m_layout[assignTokenIndex]) {
m_layout[assignTokenIndex] = RawSyntax::missing(TokenKindType::T_EQUAL,
OwnedString::makeUnowned(get_token_text(TokenKindType::T_EQUAL)));
}
RefCountPtr<RawSyntax> rawAssignTokenSyntax = RawSyntax::make(SyntaxKind::AssignmentExpr, m_layout, SourcePresence::Present,
m_arena);
return make<AssignmentExprSyntax>(rawAssignTokenSyntax);
}
///
/// SequenceExprSyntax
///
SequenceExprSyntaxBuilder &SequenceExprSyntaxBuilder::useElements(ExprListSyntax elements)
{
m_layout[cursor_index(Cursor::Elements)] = elements.getRaw();
return *this;
}
SequenceExprSyntaxBuilder &SequenceExprSyntaxBuilder::addElement(ExprSyntax element)
{
RefCountPtr<RawSyntax> rawElements = m_layout[cursor_index(Cursor::Elements)];
if (!rawElements) {
rawElements = RawSyntax::make(SyntaxKind::ExprList, {element.getRaw()}, SourcePresence::Present, m_arena);
} else {
rawElements = rawElements->append(element.getRaw());
}
return *this;
}
SequenceExprSyntax SequenceExprSyntaxBuilder::build()
{
CursorIndex elementsIndex = cursor_index(Cursor::Elements);
if (!m_layout[elementsIndex]) {
m_layout[elementsIndex] = RawSyntax::missing(SyntaxKind::ExprList);
}
RefCountPtr<RawSyntax> rawSequenceExprSyntax = RawSyntax::make(SyntaxKind::SequenceExpr, m_layout,
SourcePresence::Present, m_arena);
return make<SequenceExprSyntax>(rawSequenceExprSyntax);
}
///
/// PrefixOperatorExprSyntaxBuilder
///
PrefixOperatorExprSyntaxBuilder &PrefixOperatorExprSyntaxBuilder::useOperatorToken(TokenSyntax operatorToken)
{
m_layout[cursor_index(Cursor::OperatorToken)] = operatorToken.getRaw();
return *this;
}
PrefixOperatorExprSyntaxBuilder &PrefixOperatorExprSyntaxBuilder::useExpr(ExprSyntax expr)
{
m_layout[cursor_index(Cursor::Expr)] = expr.getRaw();
return *this;
}
PrefixOperatorExprSyntax PrefixOperatorExprSyntaxBuilder::build()
{
CursorIndex operatorTokenIndex = cursor_index(Cursor::OperatorToken);
CursorIndex exprIndex = cursor_index(Cursor::Expr);
if (!m_layout[operatorTokenIndex]) {
m_layout[operatorTokenIndex] = RawSyntax::missing(TokenKindType::T_PREFIX_OPERATOR,
OwnedString::makeUnowned(""));
}
if (!m_layout[exprIndex]) {
m_layout[exprIndex] = RawSyntax::missing(SyntaxKind::Expr);
}
RefCountPtr<RawSyntax> rawPrefixOperatorExpr = RawSyntax::make(SyntaxKind::PrefixOperatorExpr, m_layout, SourcePresence::Present,
m_arena);
return make<PrefixOperatorExprSyntax>(rawPrefixOperatorExpr);
}
///
/// PostfixOperatorExprSyntaxBuilder
///
PostfixOperatorExprSyntaxBuilder &PostfixOperatorExprSyntaxBuilder::useExpr(ExprSyntax expr)
{
m_layout[cursor_index(Cursor::Expr)] = expr.getRaw();
return *this;
}
PostfixOperatorExprSyntaxBuilder &PostfixOperatorExprSyntaxBuilder::useOperatorToken(TokenSyntax operatorToken)
{
m_layout[cursor_index(Cursor::OperatorToken)] = operatorToken.getRaw();
return *this;
}
PostfixOperatorExprSyntax PostfixOperatorExprSyntaxBuilder::build()
{
CursorIndex operatorTokenIndex = cursor_index(Cursor::OperatorToken);
CursorIndex exprIndex = cursor_index(Cursor::Expr);
if (!m_layout[operatorTokenIndex]) {
m_layout[operatorTokenIndex] = RawSyntax::missing(TokenKindType::T_POSTFIX_OPERATOR,
OwnedString::makeUnowned(""));
}
if (!m_layout[exprIndex]) {
m_layout[exprIndex] = RawSyntax::missing(SyntaxKind::Expr);
}
RefCountPtr<RawSyntax> rawPostfixOperatorExpr = RawSyntax::make(SyntaxKind::PostfixOperatorExpr, m_layout, SourcePresence::Present,
m_arena);
return make<PostfixOperatorExprSyntax>(rawPostfixOperatorExpr);
}
///
/// BinaryOperatorExprSyntaxBuilder
///
BinaryOperatorExprSyntaxBuilder &BinaryOperatorExprSyntaxBuilder::useOperatorToken(TokenSyntax operatorToken)
{
m_layout[cursor_index(Cursor::OperatorToken)] = operatorToken.getRaw();
return *this;
}
BinaryOperatorExprSyntax BinaryOperatorExprSyntaxBuilder::build()
{
CursorIndex operatorTokenIndex = cursor_index(Cursor::OperatorToken);
if (!m_layout[operatorTokenIndex]) {
m_layout[operatorTokenIndex] = RawSyntax::missing(TokenKindType::T_BINARY_OPERATOR,
OwnedString::makeUnowned(""));
}
RefCountPtr<RawSyntax> rawBinaryOperatorExprSyntax = RawSyntax::make(SyntaxKind::BinaryOperatorExpr, m_layout, SourcePresence::Present,
m_arena);
return make<BinaryOperatorExprSyntax>(rawBinaryOperatorExprSyntax);
}
} // polar::syntax
| [
"zzu_softboy@163.com"
] | zzu_softboy@163.com |
7e3db80412556e72597cfbb2c1e7d0ec41d8e52b | 3aade8553e7a07134cf53e4e49b65360f58ba06a | /collection/cp/Algorithm_Collection-master/swap_nods_in_paris.cpp | 7cce7dc28986c607b7ab267db0bb3804e9ab5b73 | [
"Apache-2.0"
] | permissive | bruler/Notebook | beb529f027816abda776a88f36bfc5051fcc5880 | a9880be9bd86955afd6b8f7352822bc18673eda3 | refs/heads/master | 2021-06-13T17:25:22.460991 | 2017-04-07T18:42:25 | 2017-04-07T18:42:25 | 73,064,126 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 738 | cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *swapPairs(ListNode *head) {
if (!head) return NULL;
ListNode* start = new ListNode(0);
ListNode* pre = start;
pre-> next = head;
head = pre;
while(true){
if (!pre->next || !pre->next->next) break;
ListNode* p1 = pre->next;
ListNode* p2 = pre->next->next;
p1->next = p2->next;
p2->next = p1;
pre->next = p2;
pre = p1;
}
return head->next;
}
};
| [
"kpgupta98@gmail.com"
] | kpgupta98@gmail.com |
3fb3c1a7904c31e32543240916435c685eb984c7 | 6b2a8dd202fdce77c971c412717e305e1caaac51 | /solutions_1482494_1/C++/lewha0/B.cpp | 7cd83c81988323d133153ba9d85186e566396309 | [] | no_license | alexandraback/datacollection | 0bc67a9ace00abbc843f4912562f3a064992e0e9 | 076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf | refs/heads/master | 2021-01-24T18:27:24.417992 | 2017-05-23T09:23:38 | 2017-05-23T09:23:38 | 84,313,442 | 2 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 1,113 | cpp | #include<stdio.h>
int T;
int a[11111], b[11111];
int earn[11111];
int ret;
int tot;
int n;
int main(void)
{
int l0, l1, l2;
freopen("b2.in","r",stdin);
freopen("b2.out","w",stdout);
scanf("%d",&T);
for(l0=1;l0<=T;l0++)
{
scanf("%d",&n);
for(l1=0;l1<n;l1++)
{
scanf("%d %d",&a[l1],&b[l1]);
earn[l1] = 0;
}
ret = 0;
tot = 0;
while(1)
{
int l1;
for(l1=0;l1<n;l1++)
{
if(earn[l1] == 0 || earn[l1] == 1) break;
}
if(l1 == n)
{
printf("Case #%d: %d\n",l0,ret);
break;
}
int flag = 0;
for(l1=0;l1<n;l1++)
{
if(earn[l1] < 2 && tot >= b[l1])
{
tot += 2 - earn[l1];
earn[l1] = 2;
flag = 1;
ret++;
}
}
if(flag == 0)
{
int idx = -1;
for(l1=0;l1<n;l1++)
{
if(earn[l1] == 0 && tot >= a[l1])
{
if(idx == -1 || b[l1] > b[idx])
{
idx = l1;
}
}
}
if(idx == -1)
{
printf("Case #%d: Too Bad\n",l0);
break;
}
tot++;
earn[idx] = 1;
ret++;
}
}
}
} | [
"eewestman@gmail.com"
] | eewestman@gmail.com |
62131a111ce85a5f3ca59919f1fcde221a5430cc | bd1fea86d862456a2ec9f56d57f8948456d55ee6 | /000/104/255/CWE457_Use_of_Uninitialized_Variable__twointsclass_array_new_partial_init_15.cpp | ac6a44f62d19950489fc13bdfb754d745f1078ef | [] | no_license | CU-0xff/juliet-cpp | d62b8485104d8a9160f29213368324c946f38274 | d8586a217bc94cbcfeeec5d39b12d02e9c6045a2 | refs/heads/master | 2021-03-07T15:44:19.446957 | 2020-03-10T12:45:40 | 2020-03-10T12:45:40 | 246,275,244 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 6,511 | cpp | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE457_Use_of_Uninitialized_Variable__twointsclass_array_new_partial_init_15.cpp
Label Definition File: CWE457_Use_of_Uninitialized_Variable__twointsclass_array.label.xml
Template File: sources-sinks-15.tmpl.cpp
*/
/*
* @description
* CWE: 457 Use of Uninitialized Variable
* BadSource: partial_init Initialize part, but not all of the array
* GoodSource: Initialize data
* Sinks: use
* GoodSink: Initialize then use data
* BadSink : Use data
* Flow Variant: 15 Control flow: switch(6) and switch(7)
* */
#include "std_testcase.h"
namespace CWE457_Use_of_Uninitialized_Variable__twointsclass_array_new_partial_init_15
{
#ifndef OMITBAD
void bad()
{
TwoIntsClass * data;
data = new TwoIntsClass[10];
switch(6)
{
case 6:
/* POTENTIAL FLAW: Partially initialize data */
for(int i=0; i<(10/2); i++)
{
data[i].intOne = i;
data[i].intTwo = i;
}
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
switch(7)
{
case 7:
/* POTENTIAL FLAW: Use data without initializing it */
for(int i=0; i<10; i++)
{
printIntLine(data[i].intOne);
printIntLine(data[i].intTwo);
}
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodB2G1() - use badsource and goodsink by changing the second switch to switch(8) */
static void goodB2G1()
{
TwoIntsClass * data;
data = new TwoIntsClass[10];
switch(6)
{
case 6:
/* POTENTIAL FLAW: Partially initialize data */
for(int i=0; i<(10/2); i++)
{
data[i].intOne = i;
data[i].intTwo = i;
}
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
switch(8)
{
case 7:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
default:
/* FIX: Ensure data is initialized before use */
for(int i=0; i<10; i++)
{
data[i].intOne = i;
data[i].intTwo = i;
}
for(int i=0; i<10; i++)
{
printIntLine(data[i].intOne);
printIntLine(data[i].intTwo);
}
break;
}
}
/* goodB2G2() - use badsource and goodsink by reversing the blocks in the second switch */
static void goodB2G2()
{
TwoIntsClass * data;
data = new TwoIntsClass[10];
switch(6)
{
case 6:
/* POTENTIAL FLAW: Partially initialize data */
for(int i=0; i<(10/2); i++)
{
data[i].intOne = i;
data[i].intTwo = i;
}
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
switch(7)
{
case 7:
/* FIX: Ensure data is initialized before use */
for(int i=0; i<10; i++)
{
data[i].intOne = i;
data[i].intTwo = i;
}
for(int i=0; i<10; i++)
{
printIntLine(data[i].intOne);
printIntLine(data[i].intTwo);
}
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
}
/* goodG2B1() - use goodsource and badsink by changing the first switch to switch(5) */
static void goodG2B1()
{
TwoIntsClass * data;
data = new TwoIntsClass[10];
switch(5)
{
case 6:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
default:
/* FIX: Completely initialize data */
for(int i=0; i<10; i++)
{
data[i].intOne = i;
data[i].intTwo = i;
}
break;
}
switch(7)
{
case 7:
/* POTENTIAL FLAW: Use data without initializing it */
for(int i=0; i<10; i++)
{
printIntLine(data[i].intOne);
printIntLine(data[i].intTwo);
}
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
}
/* goodG2B2() - use goodsource and badsink by reversing the blocks in the first switch */
static void goodG2B2()
{
TwoIntsClass * data;
data = new TwoIntsClass[10];
switch(6)
{
case 6:
/* FIX: Completely initialize data */
for(int i=0; i<10; i++)
{
data[i].intOne = i;
data[i].intTwo = i;
}
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
switch(7)
{
case 7:
/* POTENTIAL FLAW: Use data without initializing it */
for(int i=0; i<10; i++)
{
printIntLine(data[i].intOne);
printIntLine(data[i].intTwo);
}
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
}
void good()
{
goodB2G1();
goodB2G2();
goodG2B1();
goodG2B2();
}
#endif /* OMITGOOD */
} /* close namespace */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
using namespace CWE457_Use_of_Uninitialized_Variable__twointsclass_array_new_partial_init_15; /* so that we can use good and bad easily */
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
| [
"frank@fischer.com.mt"
] | frank@fischer.com.mt |
b6a116bd08bc4dd1fc1c9424e887804b87bc26b6 | 303f4ec40aa362688ec1ca96832bda3a2f30c140 | /examples/lab1.1/lab1.1/lab1.1.cpp | 8cfb0cf2dd7748419145848181b8fbf07db950ca | [] | no_license | nihlete/CPP | 5bcffb9f1c744a54d56ac856fb16ae05e902ba4b | a4cb11365a7bde2ace26412201d966ee92cb393b | refs/heads/master | 2022-11-04T21:16:01.427066 | 2020-07-02T08:40:03 | 2020-07-02T08:40:03 | null | 0 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 2,368 | cpp | // lab1.1.cpp: определяет точку входа для консольного приложения.
//
#include "stdafx.h"
#include <math.h>
#include <iostream>
#include <iomanip> // std::setprecision
#include <limits>
/*
y = 3.1 x^3 + sqrt(x^2 + 9) - e^-x
Составьте программу, которая строит таблицу значений
функции. Количество строк в таблице n, начальное значение
аргумента и шаг изменения аргумента step вводятся программистом.
В каждой строке должно выводиться значение аргумента и
соответствующее ему значение функции с 4 знаками после запятой.
После таблицы в соответствие с номером варианта должно
быть выведено следующее:
Максимальное значение среди значений функций, у
которых первая цифра дробной части равна 7 или 3.
*/
double y(double x)
{
return 3.1 * pow(x, 3) + sqrt(pow(x, 2) + 9) - exp(-x);
}
int _tmain(int argc, _TCHAR* argv[])
{
int n;
double x0;
double step;
std::cout << "Write number of lines ";
std::cin >> n;
std::cout << "x0 = ";
std::cin >> x0;
std::cout << "step = ";
std::cin >> step;
std::cout << "n\tx\ty(x)\n";
double x = x0;
std::cout << std::fixed;
double max = std::numeric_limits<double>::min();
bool flag = false;
for (int i = 1; i <= n; i++)
{
std::cout << i << '\t' << std::setprecision(4) << x
<< '\t' << std::setprecision(4) << y(x) << std::endl;
int first_float = static_cast<int>(y(x) * 10) % 10;
if (first_float == 7 || first_float == 3)
{
flag = true;
if (y(x) > max)
max = y(x);
}
x += step;
}
if (flag)
std::cout << "Max of results with first decimal equal 7 or 3: "
<< max << std::endl;
else
std::cout << "There is no results with first decimal equal 7 or 3: " << std::endl;
/*
printf("n\tx\ty(x)\n");
x = x0;
for (int i = 1; i <= n; i++)
{
printf("%d\t%.4f\t%.4f\n", i, x, y(x));
x += step;
}
*/
return 0;
}
| [
"v.andrei@protonmail.com"
] | v.andrei@protonmail.com |
5a3f2ca80c9927c44484c987d2e99cbe00781375 | 0539dbd82c9d304811f7421ebfdcd03dc6674859 | /InpOut.cc | a19ac51af3dc5fad316cf388712bc3f0a34f88f3 | [] | no_license | Anastasia1004-7/emi | 9155565e5c1dfaec566694a7a915b8c194fb2422 | b4820b25538bfe450ef6fc859b55fcc8a7b7e2e3 | refs/heads/master | 2023-01-29T01:37:19.380192 | 2020-12-08T13:43:01 | 2020-12-08T13:43:01 | 319,651,556 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,076 | cc | #include "InpOut.h"
void IO::write(unsigned address, uint8_t value) {
if ((address & 1) == 0) {
_port_fe = value;
int lev = (_port_fe >> 3) & 0x03;
switch (lev) {
case 0x00:
_adrv->set_level(-16384 - 8192);
break;
case 0x01:
_adrv->set_level(-16384);
break;
case 0x02:
_adrv->set_level(16384);
break;
case 0x03:
_adrv->set_level(16384 + 8192);
break;
default:
;
}
}
}
uint8_t IO::read(unsigned address) const {
uint8_t a = (address >> 8);
uint8_t p = (address & 0xff);
if (p == 0xfe) {
switch (a) {
case 0x7f:
return _key_matrix[0];
case 0xbf:
return _key_matrix[1];
case 0xdf:
return _key_matrix[2];
case 0xef:
return _key_matrix[3];
case 0xf7:
return _key_matrix[4];
case 0xfb:
return _key_matrix[5];
case 0xfd:
return _key_matrix[6];
case 0xfe:
return _key_matrix[7];
default:
return 0;
}
}
return 0;
}
void IO::keydown(unsigned row, unsigned col) {
_key_matrix[row] &= ~(1 << col);
}
void IO::keyup(unsigned row, unsigned col) {
_key_matrix[row] |= (1 << col);
}
| [
"75675336+Anastasia1004-7@users.noreply.github.com"
] | 75675336+Anastasia1004-7@users.noreply.github.com |
8e919f6fef2959dfa54f5566cef8440f70bde18a | 5490551d65e4976f2f49bd2f6df431c077ce69a4 | /Exercises/exercise_20.cpp | d197a444460b958acf717c90ae8719b8e6cf21f9 | [] | no_license | ariyonaty/ECE1310 | a3db89fdba91937620ae183916289426788fb53d | d26d4814002753562219b4ffa022768898212081 | refs/heads/master | 2020-05-05T12:45:54.958220 | 2019-05-14T22:24:49 | 2019-05-14T22:24:49 | 170,028,942 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 608 | cpp | /*
Ari Yonaty
ECE 1310
1.24.2019
Exercise 20: Input within range of input
*/
#include <iostream>
using namespace std;
int main()
{
int num1, num2, num3;
cout << "Enter a number: ";
cin >> num1;
cout << "Enter a number: ";
cin >> num2;
cout << "Enter a number: ";
cin >> num3;
if (num3 >= num1 && num3 <= num2)
{
cout << num3 << " is within range.\n";
}
else if (num3 >= num2 && num3 <= num1)
{
cout << num3 << " is within range.\n";
}
else
{
cout << num3 << " is not in range.\n";
}
return 0;
} | [
"ariyonaty@ariyonMacbook.lan1"
] | ariyonaty@ariyonMacbook.lan1 |
448f5cb15eff011db72ba2025f3254fbedb8430e | 1e04e7e0d35b7a570475818f699925a238b04220 | /Lv1/9215/9215.cpp | 77020ee256cf45f5c3b08fa8c3adc9cdaf65bc7b | [
"MIT"
] | permissive | justidle2012/Solution_XJOI | 3dfa24550a13b414ff374f096accd5abd465015c | ce97b4380d16faf12cf8024d4abe40266c7e37f3 | refs/heads/master | 2020-09-07T19:07:53.038018 | 2019-11-12T05:39:12 | 2019-11-12T05:39:12 | 220,887,027 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 171 | cpp | //圈地
//http://dev.xjoi.net/problem/9215
#include <cstdio>
int main() {
unsigned long long w;
scanf("%llu", &w);
printf("%llu\n", w*w/4);
return 0;
} | [
"1540168075@qq.com"
] | 1540168075@qq.com |
c8661f64855eea5ceba60180a41ca93c5b2b3157 | 948ba2d917d97a38e42dca42b3ced103b1b1f9e2 | /src/logistic.cpp | 975c1864e2d5380981f022941e291d206ac72808 | [] | no_license | yasirs/gibbsLogistic | db334ceccfeff8c59fd97f7e3c95a2bcea4125a1 | 69c2207eee91e1e80d80b47fe7cfd72740c1d02c | refs/heads/master | 2016-09-09T20:58:22.534517 | 2012-01-12T07:00:40 | 2012-01-12T07:00:40 | 3,128,736 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,701 | cpp | #include <RcppArmadillo.h>
#include <vector>
#include <armadillo>
#include <cppbugs/cppbugs.hpp>
#include <algorithm>
using namespace cppbugs;
using std::cout;
using std::endl;
class TestModel: public MCModel {
public:
const arma::ivec& y; // given
const arma::mat& X; // given
Uniform<arma::vec> b;
Deterministic<arma::vec> p_hat;
Bernoulli<arma::ivec> likelihood;
Deterministic<double> rsq;
TestModel(const arma::ivec& y_,const arma::mat& X_, const arma::mat& b_init): y(y_), X(X_),
b(b_init),
p_hat(1/(1+arma::exp(-X*b.value))),
likelihood(y_,true),
rsq(0)
{
add(b);
add(likelihood);
add(rsq);
}
void update() {
p_hat.value = 1/(1+exp(-X*b.value));
rsq.value = arma::as_scalar(1 - var(y - p_hat.value) / var(arma::conv_to<arma::vec>::from(y)));
b.dunif(-5,5);
likelihood.dbern(p_hat.value);
}
};
RcppExport SEXP logistic(SEXP x_, SEXP y_, SEXP iterations_, SEXP burnin_, SEXP adapt_, SEXP thin_, SEXP b_start_) {
arma::mat X = Rcpp::as<arma::mat>(x_);
arma::ivec y = Rcpp::as<arma::ivec>(y_);
const int iterations = Rcpp::as<int>(iterations_);
const int burnin = Rcpp::as<int>(burnin_);
const int adapt = Rcpp::as<int>(adapt_);
const int thin = Rcpp::as<int>(thin_);
const arma::vec b_start = Rcpp::as<arma::vec>(b_start_);
const int NR = X.n_rows;
const int NC = X.n_cols;
TestModel m(y,X, b_start);
m.p_hat.setSaveHistory(false);
if (adapt>0) {
m.tune(adapt, std::max(1,adapt/100));
}
m.b.value = b_start;
m.sample(iterations, burnin, 0, thin);
Rcpp::List ans;
ans["b mean"] = m.b.mean();
ans["mean likelihood"] = m.likelihood.meanLogLikelihood();
typename std::list<double>::iterator max_logp_it = std::max_element(m.likelihood.logp_history.begin(), m.likelihood.logp_history.end());
typename std::list<double>::iterator min_logp_it = std::min_element(m.likelihood.logp_history.begin(), m.likelihood.logp_history.end());
typename std::list<arma::vec>::iterator max_b_it = m.b.history.begin(); std::advance(max_b_it, std::distance(m.likelihood.logp_history.begin(),max_logp_it));
typename std::list<arma::vec>::iterator min_b_it = m.b.history.begin(); std::advance(min_b_it, std::distance(m.likelihood.logp_history.begin(),min_logp_it));
ans["best logP"]= *max_logp_it;
ans["best b"]= *max_b_it;
ans["worst logP"]= *min_logp_it;
ans["worst b"]= *min_b_it;
ans["R^2"]= m.rsq.mean();
ans["samples"]= m.b.history.size();
ans["acceptance ratio"]= m.acceptance_ratio();
return Rcpp::wrap(ans);
};
| [
"yasir.suhail@gmail.com"
] | yasir.suhail@gmail.com |
a7689181483edf0619550b13de694171da7fe016 | 134cb6b67fcc2c618e3a252eb88b8d6aabbb01eb | /sleep_sort/main.cpp | 8f3dd0fa4e624e4403390e6d623c997622012563 | [] | no_license | strahlistvan/algorithms | 6696c1a5c159a02e29441f165fd4b52fbe5cdaf5 | 93fc142b5c59f6ef9783d344fec6048524decd22 | refs/heads/master | 2020-12-29T02:37:33.310343 | 2020-03-26T16:27:57 | 2020-03-26T16:27:57 | 53,169,965 | 2 | 0 | null | 2017-01-03T21:49:01 | 2016-03-04T22:36:12 | C++ | UTF-8 | C++ | false | false | 1,916 | cpp | #include <iostream>
#include <cstdlib>
#include <thread>
#include <vector>
using namespace std;
const int MAX_INPUT_VALUE = 100;
const int INPUT_SIZE = 200;
const int TIME_SLOT_RATE = 1000;
// vector<int> result_list;
void thread_delay(int seconds)
{
chrono::duration<int, ratio<1, TIME_SLOT_RATE> > duration(seconds);
this_thread::sleep_for(duration);
//push the number to the global result list after thread delaying
//result_list.push_back(seconds);
cout << seconds << endl;
}
void sleep_sort(vector<int> input)
{
int vec_size = input.size();
vector<thread> thread_list(vec_size);
// result_list.clear();
//Running threads
for (int i=0; i<vec_size; ++i)
{
thread_list[i] = thread(thread_delay, input[i]);
}
//Join threads to the main thread
for (int i=0; i<vec_size; ++i)
{
if (thread_list[i].joinable())
thread_list[i].join();
}
// return result_list;
}
int main(int arc, char ** argv)
{
srand(time(0));
std::vector<int> input, output;
double approx_run_time = (double)(1.0/TIME_SLOT_RATE)*MAX_INPUT_VALUE;
cout << "Sleep sort is running." << endl;
cout << "INPUT SIZE : " << INPUT_SIZE << endl;
cout << "MAXIMUM INPUT ELEMENT VALUE: " << MAX_INPUT_VALUE << endl;
cout << "Approximate running time is " << approx_run_time << " seconds" << endl;
auto start = chrono::high_resolution_clock::now();
//Generate random input
for (int i=0; i<INPUT_SIZE; ++i)
{
input.push_back(rand()%MAX_INPUT_VALUE+1);
}
//output = sleep_sort(input);
sleep_sort(input);
//Print the result
//for (int i=0; i<output.size(); ++i)
// {
// cout << "output[" << i << "] = " << output[i] << endl;
// }
auto end = chrono::high_resolution_clock::now();
chrono::duration<double, milli> elapsed = end-start;
cout << "Real running time: " << elapsed.count() << " ms\n";
return 0;
}
| [
"strahlistvan0@gmail.com"
] | strahlistvan0@gmail.com |
61ef54c22e7da50596c834c09e750f622642d5b3 | 71bd065fb12ab2d07d4371f1903b45411b91735d | /controller/src/vnsw/agent/test/test_route.cc | 511157374b249d8d989c5e27c247670012f66a2f | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | syedaliawaissabir/BGPaaS | dffc3d07eddec91be3d70d8d226b2192511b61ff | 71931e462944e39d31ca16167f273ab9fa84145a | refs/heads/master | 2020-06-30T23:38:29.650304 | 2017-07-31T11:13:46 | 2017-07-31T11:13:46 | 74,343,705 | 0 | 1 | null | 2016-12-02T14:15:51 | 2016-11-21T08:46:43 | C++ | UTF-8 | C++ | false | false | 91,388 | cc | /*
* Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
*/
#include "base/os.h"
#include <boost/assign/list_of.hpp>
#include <base/logging.h>
#include <io/event_manager.h>
#include <tbb/task.h>
#include <base/task.h>
#include <cmn/agent_cmn.h>
#include <cfg/cfg_init.h>
#include "oper/operdb_init.h"
#include "controller/controller_init.h"
#include "pkt/pkt_init.h"
#include "services/services_init.h"
#include "vrouter/ksync/ksync_init.h"
#include "oper/interface_common.h"
#include "oper/nexthop.h"
#include "oper/tunnel_nh.h"
#include "route/route.h"
#include "oper/vrf.h"
#include "oper/mpls.h"
#include "oper/vm.h"
#include "oper/vn.h"
#include "filter/acl.h"
#include "oper/path_preference.h"
#include "test_cmn_util.h"
#include "kstate/test/test_kstate_util.h"
#include "vr_types.h"
#include "net/bgp_af.h"
#include <controller/controller_export.h>
using namespace boost::assign;
std::string eth_itf;
void RouterIdDepInit(Agent *agent) {
}
static void ValidateSandeshResponse(Sandesh *sandesh, vector<int> &result) {
//TBD
//Validate the response by the expectation
}
class RouteTest : public ::testing::Test {
public:
void NhListener(DBTablePartBase *partition, DBEntryBase *dbe) {
return;
}
void RtListener(DBTablePartBase *partition, DBEntryBase *dbe) {
return;
}
static void SetTunnelType(TunnelType::Type type) {
TunnelType::SetDefaultType(type);
type_ = type;
}
static TunnelType::Type GetTunnelType() {
return type_;
}
protected:
RouteTest() : vrf_name_("vrf1"), eth_name_(eth_itf) {
default_dest_ip_ = Ip4Address::from_string("0.0.0.0");
if (Agent::GetInstance()->router_id_configured()) {
vhost_ip_ = Agent::GetInstance()->router_id();
} else {
vhost_ip_ = Ip4Address::from_string("10.1.1.10");
}
if (Agent::GetInstance()->vhost_default_gateway() != default_dest_ip_) {
is_gateway_configured = true;
fabric_gw_ip_ = Agent::GetInstance()->vhost_default_gateway();
} else {
is_gateway_configured = false;
fabric_gw_ip_ = Ip4Address::from_string("10.1.1.254");
}
foreign_gw_ip_ = Ip4Address::from_string("10.10.10.254");
server1_ip_ = Ip4Address::from_string("10.1.1.11");
server2_ip_ = Ip4Address::from_string("10.1.122.11");
local_vm_ip_ = Ip4Address::from_string("1.1.1.10");
subnet_vm_ip_1_ = Ip4Address::from_string("1.1.1.0");
subnet_vm_ip_2_ = Ip4Address::from_string("2.2.2.96");
subnet_vm_ip_3_ = Ip4Address::from_string("3.3.0.0");
remote_vm_ip_ = Ip4Address::from_string("1.1.1.11");
remote_subnet_ip_ = Ip4Address::from_string("1.1.1.9");
trap_ip_ = Ip4Address::from_string("1.1.1.100");
lpm1_ip_ = Ip4Address::from_string("2.0.0.0");
lpm2_ip_ = Ip4Address::from_string("2.1.0.0");
lpm3_ip_ = Ip4Address::from_string("2.1.1.0");
lpm4_ip_ = Ip4Address::from_string("2.1.1.1");
lpm5_ip_ = Ip4Address::from_string("2.1.1.2");
}
virtual void SetUp() {
client->Reset();
//Create a VRF
VrfAddReq(vrf_name_.c_str());
PhysicalInterface::CreateReq(Agent::GetInstance()->interface_table(),
eth_name_,
Agent::GetInstance()->fabric_vrf_name(),
PhysicalInterface::FABRIC,
PhysicalInterface::ETHERNET, false, nil_uuid(),
Ip4Address(0), Interface::TRANSPORT_ETHERNET);
AddResolveRoute(server1_ip_, 24);
client->WaitForIdle();
agent_ = Agent::GetInstance();
}
virtual void TearDown() {
VrfDelReq(vrf_name_.c_str());
client->WaitForIdle();
TestRouteTable table1(1);
WAIT_FOR(100, 1000, (table1.Size() == 0));
EXPECT_EQ(table1.Size(), 0U);
TestRouteTable table2(2);
WAIT_FOR(100, 1000, (table2.Size() == 0));
EXPECT_EQ(table2.Size(), 0U);
TestRouteTable table3(3);
WAIT_FOR(100, 1000, (table3.Size() == 0));
EXPECT_EQ(table3.Size(), 0U);
WAIT_FOR(100, 1000, (VrfFind(vrf_name_.c_str()) != true));
WAIT_FOR(1000, 1000, agent_->vrf_table()->Size() == 1);
}
void AddHostRoute(Ip4Address addr) {
Agent::GetInstance()->fabric_inet4_unicast_table()->AddHostRoute(
vrf_name_, addr, 32, Agent::GetInstance()->fabric_vn_name(),
false);
client->WaitForIdle();
}
void AddVhostRoute() {
Agent::GetInstance()->fabric_inet4_unicast_table()->AddVHostRecvRouteReq(
Agent::GetInstance()->local_peer(),
Agent::GetInstance()->fabric_vrf_name(),
"vhost0", vhost_ip_, 32, "", false);
client->WaitForIdle();
}
void AddRemoteVmRoute(const Ip4Address &remote_vm_ip,
const Ip4Address &server_ip, uint32_t plen,
uint32_t label, TunnelType::TypeBmap bmap) {
//Passing vn name as vrf name itself
Inet4TunnelRouteAdd(NULL, vrf_name_, remote_vm_ip, plen, server_ip,
bmap, label, vrf_name_,
SecurityGroupList(), PathPreference());
client->WaitForIdle();
}
void AddRemoteVmRoute(const Ip4Address &remote_vm_ip,
const Ip4Address &server_ip, uint32_t plen,
uint32_t label) {
AddRemoteVmRoute(remote_vm_ip, server_ip, plen, label,
TunnelType::AllType());
}
void AddResolveRoute(const Ip4Address &server_ip, uint32_t plen) {
InetInterfaceKey vhost_intf_key(
Agent::GetInstance()->vhost_interface()->name());
Agent::GetInstance()->fabric_inet4_unicast_table()->AddResolveRoute(
Agent::GetInstance()->local_peer(),
Agent::GetInstance()->fabric_vrf_name(), server_ip, plen,
vhost_intf_key, 0, false, "", SecurityGroupList());
client->WaitForIdle();
}
void AddGatewayRoute(const std::string &vrf_name,
const Ip4Address &ip, int plen,
const Ip4Address &server) {
Agent::GetInstance()->fabric_inet4_unicast_table()->AddGatewayRouteReq
(Agent::GetInstance()->local_peer(),
vrf_name, ip, plen, server, "", MplsTable::kInvalidLabel,
SecurityGroupList(), CommunityList());
client->WaitForIdle();
}
void AddVlanNHRoute(const std::string &vrf_name, const std::string &ip,
uint16_t plen, int id, uint16_t tag,
uint16_t label, const std::string &vn_name) {
SecurityGroupList sg_l;
VnListType vn_list;
vn_list.insert(vn_name);
Agent::GetInstance()->fabric_inet4_unicast_table()->
AddVlanNHRouteReq(NULL, vrf_name_, Ip4Address::from_string(ip), plen,
MakeUuid(id), tag, label, vn_list, sg_l,
PathPreference());
client->WaitForIdle();
}
void DeleteRoute(const Peer *peer, const std::string &vrf_name,
const Ip4Address &addr, uint32_t plen) {
AgentRoute *rt = RouteGet(vrf_name, addr, plen);
uint32_t path_count = rt->GetPathList().size();
Agent::GetInstance()->fabric_inet4_unicast_table()->DeleteReq(peer, vrf_name,
addr, plen, NULL);
client->WaitForIdle();
WAIT_FOR(1000, 10000, ((RouteFind(vrf_name, addr, plen) != true) ||
(rt->GetPathList().size() == (path_count - 1))));
}
bool IsSameNH(const Ip4Address &ip1, uint32_t plen1, const Ip4Address &ip2,
uint32_t plen2, const string vrf_name) {
InetUnicastRouteEntry *rt1 = RouteGet(vrf_name, ip1, plen1);
const NextHop *nh1 = rt1->GetActiveNextHop();
InetUnicastRouteEntry *rt2 = RouteGet(vrf_name, ip1, plen1);
const NextHop *nh2 = rt2->GetActiveNextHop();
return (nh1 == nh2);
}
std::string vrf_name_;
std::string eth_name_;
Ip4Address default_dest_ip_;
Ip4Address local_vm_ip_;
Ip4Address subnet_vm_ip_1_;
Ip4Address subnet_vm_ip_2_;
Ip4Address subnet_vm_ip_3_;
Ip4Address remote_vm_ip_;
Ip4Address remote_subnet_ip_;
Ip4Address vhost_ip_;
Ip4Address fabric_gw_ip_;
Ip4Address foreign_gw_ip_;
Ip4Address trap_ip_;
Ip4Address server1_ip_;
Ip4Address server2_ip_;
Ip4Address lpm1_ip_;
Ip4Address lpm2_ip_;
Ip4Address lpm3_ip_;
Ip4Address lpm4_ip_;
Ip4Address lpm5_ip_;
bool is_gateway_configured;
Agent *agent_;
static TunnelType::Type type_;
};
TunnelType::Type RouteTest::type_;
class TestRtState : public DBState {
public:
TestRtState() : DBState(), dummy_(0) { };
int dummy_;
};
// Validate that routes db-tables have 1 partition only
TEST_F(RouteTest, PartitionCount_1) {
string vrf_name = agent_->fabric_vrf_name();
VrfEntry *vrf = agent_->vrf_table()->FindVrfFromName(vrf_name);
EXPECT_TRUE(vrf != NULL);
for (int i = Agent::INVALID + 1; i < Agent::ROUTE_TABLE_MAX; i++) {
EXPECT_EQ(1, vrf->GetRouteTable(i)->PartitionCount());
}
}
TEST_F(RouteTest, HostRoute_1) {
//Host Route - Used to trap packets to agent
//Add and delete host route
AddHostRoute(trap_ip_);
EXPECT_TRUE(RouteFind(vrf_name_, trap_ip_, 32));
DeleteRoute(Agent::GetInstance()->local_peer(), vrf_name_, trap_ip_, 32);
EXPECT_FALSE(RouteFind(vrf_name_, trap_ip_, 32));
}
TEST_F(RouteTest, SubnetRoute_1) {
client->Reset();
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.1", "00:00:00:01:01:01", 1, 1},
};
IpamInfo ipam_info[] = {
{"1.1.1.0", 24, "1.1.1.200", true},
{"2.2.2.100", 28, "2.2.2.200", true},
{"3.3.3.0", 16, "3.3.30.200", true},
};
client->Reset();
CreateVmportEnv(input, 1, 0);
client->WaitForIdle();
AddIPAM("vn1", ipam_info, 3);
client->WaitForIdle();
InetUnicastRouteEntry *rt1 = RouteGet(vrf_name_, subnet_vm_ip_1_, 24);
InetUnicastRouteEntry *rt2 = RouteGet(vrf_name_, subnet_vm_ip_2_, 28);
InetUnicastRouteEntry *rt3 = RouteGet(vrf_name_, subnet_vm_ip_3_, 16);
EXPECT_TRUE(rt1 != NULL);
EXPECT_TRUE(rt2 != NULL);
EXPECT_TRUE(rt3 != NULL);
EXPECT_TRUE(rt1->GetActiveNextHop()->GetType() == NextHop::DISCARD);
EXPECT_TRUE(rt2->GetActiveNextHop()->GetType() == NextHop::DISCARD);
EXPECT_TRUE(rt3->GetActiveNextHop()->GetType() == NextHop::DISCARD);
EXPECT_TRUE(rt1->ipam_subnet_route() == true);
EXPECT_TRUE(rt2->ipam_subnet_route() == true);
EXPECT_TRUE(rt3->ipam_subnet_route() == true);
EXPECT_TRUE(rt1->IsRPFInvalid());
EXPECT_TRUE(rt2->IsRPFInvalid());
EXPECT_TRUE(rt3->IsRPFInvalid());
EXPECT_TRUE(rt1->dest_vn_name() == "vn1");
EXPECT_TRUE(rt2->dest_vn_name() == "vn1");
EXPECT_TRUE(rt3->dest_vn_name() == "vn1");
BgpPeer *peer = CreateBgpPeer("127.0.0.1", "remote");
FillEvpnNextHop(peer, "vrf1", 1000, TunnelType::MplsType());
client->WaitForIdle();
//Addition of evpn composite NH should not change subnet route
EXPECT_TRUE(rt1->GetActiveNextHop()->GetType() == NextHop::DISCARD);
EXPECT_TRUE(rt2->GetActiveNextHop()->GetType() == NextHop::DISCARD);
EXPECT_TRUE(rt3->GetActiveNextHop()->GetType() == NextHop::DISCARD);
EXPECT_TRUE(rt1->ipam_subnet_route() == true);
EXPECT_TRUE(rt2->ipam_subnet_route() == true);
EXPECT_TRUE(rt3->ipam_subnet_route() == true);
EXPECT_TRUE(rt1->IsRPFInvalid());
EXPECT_TRUE(rt2->IsRPFInvalid());
EXPECT_TRUE(rt3->IsRPFInvalid());
//Call for sandesh
Inet4UcRouteReq *uc_list_req = new Inet4UcRouteReq();
std::vector<int> result = list_of(1);
Sandesh::set_response_callback(boost::bind(ValidateSandeshResponse, _1, result));
uc_list_req->set_vrf_index(1);
uc_list_req->HandleRequest();
client->WaitForIdle();
uc_list_req->Release();
client->WaitForIdle();
client->Reset();
DelIPAM("vn1");
client->WaitForIdle();
FlushEvpnNextHop(peer, "vrf1", 0);
DeleteVmportEnv(input, 1, 1, 0);
client->WaitForIdle();
DeleteBgpPeer(peer);
client->WaitForIdle();
}
/* Change IPAM list and verify clear/add of subnet route */
TEST_F(RouteTest, SubnetRoute_2) {
client->Reset();
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.1", "00:00:00:01:01:01", 1, 1},
};
IpamInfo ipam_info[] = {
{"1.1.1.0", 24, "1.1.1.200", true},
{"2.2.2.100", 28, "2.2.2.200", true},
{"3.3.3.0", 16, "3.3.30.200", true},
};
IpamInfo ipam_info_2[] = {
{"2.2.2.100", 28, "2.2.2.200", true},
};
IpamInfo ipam_info_3[] = {
{"1.1.1.0", 24, "1.1.1.200", true},
};
client->Reset();
CreateVmportEnv(input, 1, 0);
client->WaitForIdle();
AddIPAM("vn1", ipam_info, 3);
client->WaitForIdle();
InetUnicastRouteEntry *rt1 = RouteGet(vrf_name_, subnet_vm_ip_1_, 24);
InetUnicastRouteEntry *rt2 = RouteGet(vrf_name_, subnet_vm_ip_2_, 28);
InetUnicastRouteEntry *rt3 = RouteGet(vrf_name_, subnet_vm_ip_3_, 16);
if((rt1 == NULL) && (rt2 == NULL) && (rt3 == NULL))
return;
EXPECT_TRUE(rt1 != NULL);
EXPECT_TRUE(rt2 != NULL);
EXPECT_TRUE(rt3 != NULL);
EXPECT_TRUE(rt1->GetActiveNextHop()->GetType() == NextHop::DISCARD);
EXPECT_TRUE(rt2->GetActiveNextHop()->GetType() == NextHop::DISCARD);
EXPECT_TRUE(rt3->GetActiveNextHop()->GetType() == NextHop::DISCARD);
EXPECT_TRUE(rt1->IsRPFInvalid());
EXPECT_TRUE(rt2->IsRPFInvalid());
EXPECT_TRUE(rt3->IsRPFInvalid());
BgpPeer *peer = CreateBgpPeer("127.0.0.1", "remote");
FillEvpnNextHop(peer, "vrf1", 1000, TunnelType::MplsType());
client->WaitForIdle();
EXPECT_TRUE(rt1->GetActiveNextHop()->GetType() == NextHop::DISCARD);
EXPECT_TRUE(rt2->GetActiveNextHop()->GetType() == NextHop::DISCARD);
EXPECT_TRUE(rt3->GetActiveNextHop()->GetType() == NextHop::DISCARD);
EXPECT_TRUE(rt1->IsRPFInvalid());
EXPECT_TRUE(rt2->IsRPFInvalid());
EXPECT_TRUE(rt3->IsRPFInvalid());
FlushEvpnNextHop(peer, "vrf1", 0);
AddIPAM("vn1", ipam_info_2, 1);
client->WaitForIdle();
rt1 = RouteGet(vrf_name_, subnet_vm_ip_1_, 24);
rt2 = RouteGet(vrf_name_, subnet_vm_ip_2_, 28);
rt3 = RouteGet(vrf_name_, subnet_vm_ip_3_, 16);
EXPECT_TRUE(rt1 == NULL);
EXPECT_TRUE(rt2 != NULL);
EXPECT_TRUE(rt3 == NULL);
EXPECT_TRUE(rt2->GetActiveNextHop()->GetType() == NextHop::DISCARD);
EXPECT_TRUE(rt2->IsRPFInvalid());
FillEvpnNextHop(peer, "vrf1", 1000, TunnelType::MplsType());
EXPECT_TRUE(rt2->GetActiveNextHop()->GetType() == NextHop::DISCARD);
EXPECT_TRUE(rt2->ipam_subnet_route());
EXPECT_TRUE(rt2->IsRPFInvalid());
AddIPAM("vn1", ipam_info_3, 1);
FlushEvpnNextHop(peer, "vrf1", 0);
client->WaitForIdle();
//Just check for sandesh message handling
Inet4UcRouteReq *uc_list_req = new Inet4UcRouteReq();
std::vector<int> result = list_of(1);
Sandesh::set_response_callback(boost::bind(ValidateSandeshResponse, _1, result));
uc_list_req->set_vrf_index(1);
uc_list_req->HandleRequest();
client->WaitForIdle();
uc_list_req->Release();
client->WaitForIdle();
rt1 = RouteGet(vrf_name_, subnet_vm_ip_1_, 24);
rt2 = RouteGet(vrf_name_, subnet_vm_ip_2_, 28);
rt3 = RouteGet(vrf_name_, subnet_vm_ip_3_, 16);
EXPECT_TRUE(rt1 != NULL);
EXPECT_TRUE(rt2 == NULL);
EXPECT_TRUE(rt3 == NULL);
EXPECT_TRUE(rt1->GetActiveNextHop()->GetType() == NextHop::DISCARD);
client->Reset();
DelIPAM("vn1");
client->WaitForIdle();
rt1 = RouteGet(vrf_name_, subnet_vm_ip_1_, 24);
rt2 = RouteGet(vrf_name_, subnet_vm_ip_2_, 28);
rt3 = RouteGet(vrf_name_, subnet_vm_ip_3_, 16);
EXPECT_TRUE(rt1 == NULL);
EXPECT_TRUE(rt2 == NULL);
EXPECT_TRUE(rt3 == NULL);
DeleteVmportEnv(input, 1, 1, 0);
client->WaitForIdle();
DeleteBgpPeer(peer);
client->WaitForIdle();
}
TEST_F(RouteTest, VhostRecvRoute_1) {
//Recv route for IP address set on vhost interface
//Add and delete recv route on fabric VRF
AddVhostRoute();
EXPECT_TRUE(RouteFind(Agent::GetInstance()->fabric_vrf_name(), vhost_ip_, 32));
DeleteRoute(Agent::GetInstance()->local_peer(), Agent::GetInstance()->fabric_vrf_name(), vhost_ip_, 32);
EXPECT_FALSE(RouteFind(Agent::GetInstance()->fabric_vrf_name(), vhost_ip_, 32));
}
TEST_F(RouteTest, LocalVmRoute_1) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.10", "00:00:00:01:01:01", 1, 1},
};
client->Reset();
CreateVmportEnv(input, 1);
client->WaitForIdle();
EXPECT_TRUE(VmPortActive(input, 0));
EXPECT_TRUE(RouteFind(vrf_name_, local_vm_ip_, 32));
InetUnicastRouteEntry *rt = RouteGet(vrf_name_, local_vm_ip_, 32);
EXPECT_TRUE(rt->dest_vn_name() == "vn1");
EXPECT_TRUE(rt->GetActivePath()->vxlan_id() == VxLanTable::kInvalidvxlan_id);
EXPECT_TRUE(rt->GetActivePath()->tunnel_bmap() == TunnelType::MplsType());
EXPECT_FALSE(rt->ipam_subnet_route());
DeleteVmportEnv(input, 1, true);
client->WaitForIdle();
int i = 0;
while(RouteFind(vrf_name_, local_vm_ip_, 32) == true && ++i < 25) {
client->WaitForIdle();
}
EXPECT_FALSE(VmPortFind(input, 0));
}
TEST_F(RouteTest, RemoteVmRoute_1) {
AddRemoteVmRoute(remote_vm_ip_, fabric_gw_ip_, 32, MplsTable::kStartLabel);
EXPECT_TRUE(RouteFind(vrf_name_, remote_vm_ip_, 32));
InetUnicastRouteEntry *rt = RouteGet(vrf_name_, remote_vm_ip_, 32);
EXPECT_TRUE(rt->dest_vn_name() == vrf_name_);
EXPECT_TRUE(rt->GetActiveLabel() == MplsTable::kStartLabel);
EXPECT_TRUE(rt->GetActiveNextHop()->GetType() == NextHop::TUNNEL);
EXPECT_FALSE(rt->ipam_subnet_route());
DeleteRoute(NULL, vrf_name_, remote_vm_ip_, 32);
EXPECT_FALSE(RouteFind(vrf_name_, remote_vm_ip_, 32));
}
TEST_F(RouteTest, RemoteVmRoute_2) {
//Add remote VM route, make it point to a server
//whose ARP is not resolved, since there is no resolve
//route, tunnel NH will be marked invalid.
AddRemoteVmRoute(remote_vm_ip_, server1_ip_, 32, MplsTable::kStartLabel);
EXPECT_TRUE(RouteFind(vrf_name_, remote_vm_ip_, 32));
InetUnicastRouteEntry *addr_rt = RouteGet(vrf_name_, remote_vm_ip_, 32);
const NextHop *addr_nh = addr_rt->GetActiveNextHop();
EXPECT_TRUE(addr_nh->IsValid() == false);
//Add ARP for server IP address
//Once Arp address is added, remote VM tunnel nexthop
//would be reevaluated, and tunnel nexthop would be valid
AddArp(server1_ip_.to_string().c_str(), "0a:0b:0c:0d:0e:0f", eth_name_.c_str());
client->WaitForIdle();
EXPECT_TRUE(addr_nh->IsValid() == true);
//Delete Remote VM route
DeleteRoute(NULL, vrf_name_, remote_vm_ip_, 32);
EXPECT_FALSE(RouteFind(vrf_name_, remote_vm_ip_, 32));
//Delete ARP route
DeleteRoute(Agent::GetInstance()->local_peer(), Agent::GetInstance()->fabric_vrf_name(),
server1_ip_, 32);
EXPECT_FALSE(RouteFind(Agent::GetInstance()->fabric_vrf_name(), server1_ip_, 32));
DelArp(server1_ip_.to_string().c_str(), "0a:0b:0c:0d:0e:0f", eth_name_.c_str());
client->WaitForIdle();
}
TEST_F(RouteTest, RemoteVmRoute_3) {
//Add a remote VM route with prefix len 32
AddRemoteVmRoute(remote_vm_ip_, server1_ip_, 32, MplsTable::kStartLabel);
//Add a remote VM route with prefix len 24
AddRemoteVmRoute(remote_vm_ip_, server1_ip_, 24, MplsTable::kStartLabel+1);
//Delete more specific(/32) route, and verify in kernel
//that specific route points to nexthop of /24 route
DeleteRoute(NULL, vrf_name_, remote_vm_ip_, 32);
//Cleanup /24 route also
DeleteRoute(NULL, vrf_name_, remote_vm_ip_, 24);
}
TEST_F(RouteTest, RemoteVmRoute_4) {
//Add resolve route
AddResolveRoute(server1_ip_, 24);
//Add a remote VM route pointing to server in same
//subnet, tunnel NH will trigger ARP resolution
AddRemoteVmRoute(remote_vm_ip_, server1_ip_, 32, MplsTable::kStartLabel);
EXPECT_TRUE(RouteFind(vrf_name_, remote_vm_ip_, 32));
InetUnicastRouteEntry *addr_rt = RouteGet(vrf_name_, remote_vm_ip_, 32);
const NextHop *addr_nh = addr_rt->GetActiveNextHop();
EXPECT_TRUE(addr_nh->IsValid() == false);
EXPECT_TRUE(addr_nh->GetType() == NextHop::TUNNEL);
if (addr_nh->GetType() == NextHop::TUNNEL) {
const TunnelNH *tun = static_cast<const TunnelNH *>(addr_nh);
TunnelType t(RouteTest::GetTunnelType());
EXPECT_TRUE(tun->GetTunnelType().Compare(t));
}
client->Reset();
//Add ARP for server IP address
//Once Arp address is added, remote VM tunnel nexthop
//would be reevaluated, and tunnel nexthop would be valid
AddArp(server1_ip_.to_string().c_str(), "0a:0b:0c:0d:0e:0f", eth_name_.c_str());
client->WaitForIdle();
EXPECT_TRUE(addr_nh->IsValid() == true);
client->NHWait(2);
//Trigger change of route. verify tunnel NH is also notified
AddArp(server1_ip_.to_string().c_str(), "0a:0b:0c:0d:0e:0e", eth_name_.c_str());
client->WaitForIdle();
EXPECT_TRUE(addr_nh->IsValid() == true);
client->NHWait(4);
//No-op change, verify tunnel NH is not notified
AddArp(server1_ip_.to_string().c_str(), "0a:0b:0c:0d:0e:0e", eth_name_.c_str());
client->WaitForIdle();
EXPECT_TRUE(addr_nh->IsValid() == true);
client->NHWait(4);
EXPECT_TRUE(client->nh_notify_ == 4);
//Delete the ARP NH and make sure tunnel NH is marked
//invalid
DelArp(server1_ip_.to_string().c_str(), "0a:0b:0c:0d:0e:0e", eth_name_.c_str());
client->WaitForIdle();
client->NHWait(6);
EXPECT_TRUE(addr_nh->IsValid() == false);
//Readd ARP and verify tunnel NH is changed
AddArp(server1_ip_.to_string().c_str(), "0a:0b:0c:0d:0e:0e", eth_name_.c_str());
client->WaitForIdle();
EXPECT_TRUE(addr_nh->IsValid() == true);
//Delete Remote VM route
DeleteRoute(NULL, vrf_name_, remote_vm_ip_, 32);
EXPECT_FALSE(RouteFind(vrf_name_, remote_vm_ip_, 32));
//Delete ARP route
DeleteRoute(Agent::GetInstance()->local_peer(), Agent::GetInstance()->fabric_vrf_name(),
server1_ip_, 32);
EXPECT_FALSE(RouteFind(Agent::GetInstance()->fabric_vrf_name(), server1_ip_, 32));
//Delete Resolve route
DeleteRoute(Agent::GetInstance()->local_peer(), Agent::GetInstance()->fabric_vrf_name(),
server1_ip_, 24);
EXPECT_FALSE(RouteFind(Agent::GetInstance()->fabric_vrf_name(), server1_ip_, 24));
DelArp(server1_ip_.to_string().c_str(), "0a:0b:0c:0d:0e:0f", eth_name_.c_str());
client->WaitForIdle();
}
TEST_F(RouteTest, RemoteVmRoute_5) {
if (!is_gateway_configured) {
Agent::GetInstance()->set_vhost_default_gateway(fabric_gw_ip_);
AddGatewayRoute(Agent::GetInstance()->fabric_vrf_name(),
default_dest_ip_, 0, fabric_gw_ip_);
client->WaitForIdle();
}
//Add remote VM route IP, pointing to 0.0.0.0
AddRemoteVmRoute(remote_vm_ip_, server2_ip_, 32, MplsTable::kStartLabel);
EXPECT_TRUE(RouteFind(vrf_name_, remote_vm_ip_, 32));
InetUnicastRouteEntry *addr_rt = RouteGet(vrf_name_, remote_vm_ip_, 32);
const NextHop *addr_nh = addr_rt->GetActiveNextHop();
EXPECT_TRUE(addr_nh->IsValid() == false);
//Resolve ARP for gw
AddArp(fabric_gw_ip_.to_string().c_str(), "0a:0b:0c:0d:0e:0f",
eth_name_.c_str());
client->WaitForIdle();
addr_nh = addr_rt->GetActiveNextHop();
EXPECT_TRUE(addr_nh->IsValid() == true);
//Delete ARP for gw
DelArp(fabric_gw_ip_.to_string().c_str(), "0a:0b:0c:0d:0e:0f",
eth_name_.c_str());
client->WaitForIdle();
addr_nh = addr_rt->GetActiveNextHop();
EXPECT_TRUE(addr_nh->IsValid() == false);
//Delete remote server route
DeleteRoute(NULL, vrf_name_, remote_vm_ip_, 32);
EXPECT_FALSE(RouteFind(vrf_name_, remote_vm_ip_, 32));
if (!is_gateway_configured) {
Agent::GetInstance()->set_vhost_default_gateway(default_dest_ip_);
AddGatewayRoute(Agent::GetInstance()->fabric_vrf_name(),
default_dest_ip_, 0, default_dest_ip_);
client->WaitForIdle();
}
}
TEST_F(RouteTest, RemoteVmRoute_no_gw) {
if (is_gateway_configured) {
Agent::GetInstance()->set_vhost_default_gateway(default_dest_ip_);
AddGatewayRoute(Agent::GetInstance()->fabric_vrf_name(),
default_dest_ip_, 0, default_dest_ip_);
client->WaitForIdle();
}
//Add remote VM route IP, pointing to 0.0.0.0
AddRemoteVmRoute(remote_vm_ip_, server2_ip_, 32, MplsTable::kStartLabel);
EXPECT_TRUE(RouteFind(vrf_name_, remote_vm_ip_, 32));
InetUnicastRouteEntry *addr_rt = RouteGet(vrf_name_, remote_vm_ip_, 32);
const NextHop *addr_nh = addr_rt->GetActiveNextHop();
EXPECT_TRUE(addr_nh->IsValid() == true);
EXPECT_TRUE(addr_nh->GetType() == NextHop::TUNNEL);
if (addr_nh->GetType() == NextHop::TUNNEL) {
const TunnelNH *tun = static_cast<const TunnelNH *>(addr_nh);
EXPECT_TRUE(tun->GetRt()->GetActiveNextHop()->GetType() == NextHop::DISCARD);
Agent::GetInstance()->set_vhost_default_gateway(fabric_gw_ip_);
AddGatewayRoute(Agent::GetInstance()->fabric_vrf_name(),
default_dest_ip_, 0, fabric_gw_ip_);
client->WaitForIdle();
//addr_nh = addr_rt->GetActiveNextHop();
EXPECT_TRUE(addr_nh->IsValid() == false);
//Resolve ARP for gw
AddArp(fabric_gw_ip_.to_string().c_str(), "0a:0b:0c:0d:0e:0f",
eth_name_.c_str());
client->WaitForIdle();
EXPECT_TRUE(addr_nh->IsValid() == true);
//Delete ARP for gw
DelArp(fabric_gw_ip_.to_string().c_str(), "0a:0b:0c:0d:0e:0f",
eth_name_.c_str());
client->WaitForIdle();
EXPECT_TRUE(addr_nh->IsValid() == false);
Agent::GetInstance()->set_vhost_default_gateway(default_dest_ip_);
AddGatewayRoute(Agent::GetInstance()->fabric_vrf_name(),
default_dest_ip_, 0, default_dest_ip_);
client->WaitForIdle();
}
//Delete remote server route
DeleteRoute(NULL, vrf_name_, remote_vm_ip_, 32);
EXPECT_FALSE(RouteFind(vrf_name_, remote_vm_ip_, 32));
if (is_gateway_configured) {
Agent::GetInstance()->set_vhost_default_gateway(fabric_gw_ip_);
AddGatewayRoute(Agent::GetInstance()->fabric_vrf_name(),
default_dest_ip_, 0, fabric_gw_ip_);
client->WaitForIdle();
}
}
TEST_F(RouteTest, RemoteVmRoute_foreign_gw) {
Agent::GetInstance()->set_vhost_default_gateway(foreign_gw_ip_);
AddGatewayRoute(Agent::GetInstance()->fabric_vrf_name(),
default_dest_ip_, 0, foreign_gw_ip_);
client->WaitForIdle();
//Add remote VM route IP, pointing to 0.0.0.0
AddRemoteVmRoute(remote_vm_ip_, server2_ip_, 32, MplsTable::kStartLabel);
EXPECT_TRUE(RouteFind(vrf_name_, remote_vm_ip_, 32));
InetUnicastRouteEntry *addr_rt = RouteGet(vrf_name_, remote_vm_ip_, 32);
const NextHop *addr_nh = addr_rt->GetActiveNextHop();
EXPECT_TRUE(addr_nh->IsValid() == true);
EXPECT_TRUE(addr_nh->GetType() == NextHop::TUNNEL);
if (addr_nh->GetType() == NextHop::TUNNEL) {
const TunnelNH *tun = static_cast<const TunnelNH *>(addr_nh);
EXPECT_TRUE(tun->GetRt()->GetActiveNextHop()->GetType() == NextHop::DISCARD);
}
//Delete remote server route
DeleteRoute(NULL, vrf_name_, remote_vm_ip_, 32);
EXPECT_FALSE(RouteFind(vrf_name_, remote_vm_ip_, 32));
if (is_gateway_configured) {
Agent::GetInstance()->set_vhost_default_gateway(fabric_gw_ip_);
AddGatewayRoute(Agent::GetInstance()->fabric_vrf_name(),
default_dest_ip_, 0, fabric_gw_ip_);
client->WaitForIdle();
} else {
Agent::GetInstance()->set_vhost_default_gateway(default_dest_ip_);
AddGatewayRoute(Agent::GetInstance()->fabric_vrf_name(),
default_dest_ip_, 0, default_dest_ip_);
client->WaitForIdle();
}
}
TEST_F(RouteTest, GatewayRoute_1) {
//Addition and deletion of gateway route.
//We add a gateway route as below
//server2_ip ----->GW---->ARP NH
//Server2 route and GW route, should have same NH
AddGatewayRoute(Agent::GetInstance()->fabric_vrf_name(), server2_ip_, 32,
fabric_gw_ip_);
EXPECT_TRUE(RouteFind(Agent::GetInstance()->fabric_vrf_name(), server2_ip_, 32));
//Resolve ARP for subnet gateway route
AddArp(fabric_gw_ip_.to_string().c_str(), "0a:0b:0c:0d:0e:0f",
eth_name_.c_str());
client->WaitForIdle();
EXPECT_TRUE(IsSameNH(server2_ip_, 32, fabric_gw_ip_, 32,
Agent::GetInstance()->fabric_vrf_name()));
//Change mac, and verify that nexthop of gateway route
//also get updated
AddArp(fabric_gw_ip_.to_string().c_str(), "0a:0b:0c:0d:0e:0e",
eth_name_.c_str());
client->WaitForIdle();
EXPECT_TRUE(IsSameNH(server2_ip_, 32, fabric_gw_ip_, 32,
Agent::GetInstance()->fabric_vrf_name()));
//Delete indirect route
DeleteRoute(Agent::GetInstance()->local_peer(),
Agent::GetInstance()->fabric_vrf_name(), server2_ip_, 32);
EXPECT_FALSE(RouteFind(Agent::GetInstance()->fabric_vrf_name(), server2_ip_, 32));
//Delete ARP route, since no covering resolve route
//is present server2 route would point to discard NH
DelArp(fabric_gw_ip_.to_string(), "0a:0b:0c:0d:0e:0e", eth_name_);
client->WaitForIdle();
}
TEST_F(RouteTest, GatewayRoute_2) {
Ip4Address a = Ip4Address::from_string("4.4.4.4");
Ip4Address b = Ip4Address::from_string("5.5.5.5");
Ip4Address c = Ip4Address::from_string("6.6.6.6");
Ip4Address d = Ip4Address::from_string("7.7.7.7");
//Add gateway route a reachable via b, b reachable
//via c, c reachable via d.
AddArp(d.to_string().c_str(), "0a:0b:0c:0d:0e:0f", eth_name_.c_str());
AddGatewayRoute(Agent::GetInstance()->fabric_vrf_name(), c, 32, d);
AddGatewayRoute(Agent::GetInstance()->fabric_vrf_name(), b, 32, c);
AddGatewayRoute(Agent::GetInstance()->fabric_vrf_name(), a, 32, b);
client->WaitForIdle();
EXPECT_TRUE(IsSameNH(a, 32, b, 32, Agent::GetInstance()->fabric_vrf_name()));
EXPECT_TRUE(IsSameNH(b, 32, c, 32, Agent::GetInstance()->fabric_vrf_name()));
EXPECT_TRUE(IsSameNH(c, 32, d, 32, Agent::GetInstance()->fabric_vrf_name()));
DelArp(d.to_string().c_str(), "0a:0b:0c:0d:0e:0f", eth_name_.c_str());
client->WaitForIdle();
EXPECT_TRUE(IsSameNH(a, 32, b, 32, Agent::GetInstance()->fabric_vrf_name()));
EXPECT_TRUE(IsSameNH(b, 32, c, 32, Agent::GetInstance()->fabric_vrf_name()));
EXPECT_TRUE(IsSameNH(c, 32, d, 32, Agent::GetInstance()->fabric_vrf_name()));
DeleteRoute(Agent::GetInstance()->local_peer(),
Agent::GetInstance()->fabric_vrf_name(), a, 32);
EXPECT_FALSE(RouteFind(Agent::GetInstance()->fabric_vrf_name(), a ,32));
DeleteRoute(Agent::GetInstance()->local_peer(),
Agent::GetInstance()->fabric_vrf_name(), b, 32);
EXPECT_FALSE(RouteFind(Agent::GetInstance()->fabric_vrf_name(), b, 32));
DeleteRoute(Agent::GetInstance()->local_peer(),
Agent::GetInstance()->fabric_vrf_name(), c, 32);
EXPECT_FALSE(RouteFind(Agent::GetInstance()->fabric_vrf_name(), c, 32));
}
// Delete unresolved gateway route
TEST_F(RouteTest, GatewayRoute_3) {
Ip4Address a = Ip4Address::from_string("4.4.4.4");
Ip4Address gw = Ip4Address::from_string("5.5.5.254");
// Add gateway route. Gateway
AddGatewayRoute(agent_->fabric_vrf_name(), a, 32, gw);
client->WaitForIdle();
InetUnicastRouteEntry* rt = RouteGet(agent_->fabric_vrf_name(), a, 32);
EXPECT_TRUE(rt != NULL);
DeleteRoute(agent_->local_peer(), agent_->fabric_vrf_name(), a, 32);
client->WaitForIdle();
EXPECT_FALSE(RouteFind(agent_->fabric_vrf_name(), a ,32));
gw = Ip4Address::from_string("10.1.1.253");
AddGatewayRoute(agent_->fabric_vrf_name(), a, 32, gw);
client->WaitForIdle();
rt = RouteGet(agent_->fabric_vrf_name(), a, 32);
EXPECT_TRUE(rt != NULL);
DeleteRoute(agent_->local_peer(), agent_->fabric_vrf_name(), a, 32);
client->WaitForIdle();
EXPECT_FALSE(RouteFind(agent_->fabric_vrf_name(), a ,32));
}
TEST_F(RouteTest, ResyncUnresolvedRoute_1) {
// There should be no unresolved route
InetUnicastAgentRouteTable *table =
Agent::GetInstance()->fabric_inet4_unicast_table();
EXPECT_EQ(table->unresolved_route_size(), 0);
Ip4Address gw = Ip4Address::from_string("1.1.1.2");
// Add an unresolved gateway route.
// Add a route to force RESYNC of unresolved route
AddGatewayRoute(Agent::GetInstance()->fabric_vrf_name(), server1_ip_, 32,
gw);
EXPECT_TRUE(RouteFind(Agent::GetInstance()->fabric_vrf_name(), server1_ip_,
32));
// One unresolved route should be added
EXPECT_EQ(table->unresolved_route_size(), 1);
InetUnicastRouteEntry *rt =
RouteGet(Agent::GetInstance()->fabric_vrf_name(), server1_ip_, 32);
InetUnicastAgentRouteTable::ReEvaluatePaths(Agent::GetInstance(),
rt->vrf()->GetName(),
rt->addr(),
rt->plen());
client->WaitForIdle();
EXPECT_EQ(table->unresolved_route_size(), 1);
// Add second route.
AddGatewayRoute(Agent::GetInstance()->fabric_vrf_name(), server2_ip_, 32,
gw);
EXPECT_TRUE(RouteFind(Agent::GetInstance()->fabric_vrf_name(), server2_ip_,
32));
WAIT_FOR(100, 1000, (table->unresolved_route_size() == 2));
DeleteRoute(Agent::GetInstance()->local_peer(),
Agent::GetInstance()->fabric_vrf_name(), server1_ip_, 32);
DeleteRoute(Agent::GetInstance()->local_peer(),
Agent::GetInstance()->fabric_vrf_name(), server2_ip_, 32);
EXPECT_FALSE(RouteFind(Agent::GetInstance()->fabric_vrf_name(), server1_ip_,
32));
EXPECT_FALSE(RouteFind(Agent::GetInstance()->fabric_vrf_name(), server2_ip_,
32));
}
TEST_F(RouteTest, FindLPM) {
InetUnicastRouteEntry *rt;
AddResolveRoute(lpm1_ip_, 8);
client->WaitForIdle();
AddResolveRoute(lpm2_ip_, 16);
client->WaitForIdle();
AddResolveRoute(lpm3_ip_, 24);
client->WaitForIdle();
AddArp(lpm4_ip_.to_string().c_str(), "0d:0b:0c:0d:0e:0f", eth_name_.c_str());
client->WaitForIdle();
AddArp(lpm5_ip_.to_string().c_str(), "0d:0b:0c:0d:0e:0a", eth_name_.c_str());
client->WaitForIdle();
rt = Agent::GetInstance()->fabric_inet4_unicast_table()->FindLPM(lpm4_ip_);
EXPECT_EQ(lpm4_ip_, rt->addr());
DeleteRoute(Agent::GetInstance()->local_peer(), Agent::GetInstance()->fabric_vrf_name(), lpm4_ip_, 32);
client->WaitForIdle();
rt = Agent::GetInstance()->fabric_inet4_unicast_table()->FindLPM(lpm4_ip_);
EXPECT_EQ(lpm3_ip_, rt->addr());
DeleteRoute(Agent::GetInstance()->local_peer(), Agent::GetInstance()->fabric_vrf_name(), lpm3_ip_, 24);
client->WaitForIdle();
rt = Agent::GetInstance()->fabric_inet4_unicast_table()->FindLPM(lpm4_ip_);
EXPECT_EQ(lpm2_ip_, rt->addr());
DeleteRoute(Agent::GetInstance()->local_peer(), Agent::GetInstance()->fabric_vrf_name(), lpm2_ip_, 16);
client->WaitForIdle();
rt = Agent::GetInstance()->fabric_inet4_unicast_table()->FindLPM(lpm4_ip_);
EXPECT_EQ(lpm1_ip_, rt->addr());
DeleteRoute(Agent::GetInstance()->local_peer(), Agent::GetInstance()->fabric_vrf_name(), lpm1_ip_, 8);
client->WaitForIdle();
DeleteRoute(Agent::GetInstance()->local_peer(), Agent::GetInstance()->fabric_vrf_name(), lpm5_ip_, 32);
client->WaitForIdle();
DelArp(lpm4_ip_.to_string().c_str(), "0d:0b:0c:0d:0e:0f", eth_name_.c_str());
client->WaitForIdle();
DelArp(lpm5_ip_.to_string().c_str(), "0d:0b:0c:0d:0e:0a", eth_name_.c_str());
client->WaitForIdle();
}
TEST_F(RouteTest, VlanNHRoute_1) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.10", "00:00:00:01:01:01", 1, 1},
};
client->Reset();
CreateVmportEnv(input, 1);
client->WaitForIdle();
EXPECT_TRUE(VmPortActive(input, 0));
EXPECT_TRUE(RouteFind(vrf_name_, local_vm_ip_, 32));
InetUnicastRouteEntry *rt = RouteGet(vrf_name_, local_vm_ip_, 32);
EXPECT_TRUE(rt != NULL);
if (rt) {
EXPECT_TRUE(rt->dest_vn_name() == "vn1");
}
// Add service interface-1
AddVrf("vrf2");
AddVmPortVrf("ser1", "2.2.2.1", 1);
AddLink("virtual-machine-interface-routing-instance", "ser1",
"routing-instance", "vrf2");
AddLink("virtual-machine-interface-routing-instance", "ser1",
"virtual-machine-interface", "vnet1");
client->WaitForIdle();
// Validate service vlan route
rt = RouteGet("vrf2", Ip4Address::from_string("2.2.2.1"), 32);
EXPECT_TRUE(rt != NULL);
// Add a route using NH created for service interface
client->WaitForIdle();
AddVlanNHRoute("vrf1", "2.2.2.0", 24, 1, 1, rt->GetActiveLabel(), "TestVn");
rt = RouteGet("vrf1", Ip4Address::from_string("2.2.2.0"), 24);
EXPECT_TRUE(rt != NULL);
if (rt) {
EXPECT_TRUE(rt->dest_vn_name() == "TestVn");
}
EXPECT_TRUE(rt->GetActivePath()->tunnel_bmap() == TunnelType::MplsType());
AddVmPortVrf("ser1", "2.2.2.1", 10);
client->WaitForIdle();
DelLink("virtual-machine-interface-routing-instance", "ser1",
"routing-instance", "vrf2");
DelLink("virtual-machine-interface-routing-instance", "ser1",
"virtual-machine-interface", "vnet1");
DelVmPortVrf("ser1");
int i = 0;
while (i++ < 50) {
rt = RouteGet("vrf2", Ip4Address::from_string("2.2.2.1"), 32);
if (rt == NULL) {
break;
}
client->WaitForIdle();
}
EXPECT_TRUE(rt == NULL);
DeleteVmportEnv(input, 1, true);
client->WaitForIdle();
i = 0;
while(RouteFind(vrf_name_, local_vm_ip_, 32) == true && ++i < 25) {
client->WaitForIdle();
}
EXPECT_FALSE(VmPortFind(input, 0));
DeleteRoute(NULL, "vrf1", Ip4Address::from_string("2.2.2.0"), 24);
client->WaitForIdle();
WAIT_FOR(100, 100,
(RouteGet("vrf1", Ip4Address::from_string("2.2.2.0"), 24) == NULL));
DelVrf("vrf2");
client->WaitForIdle();
}
class TestNhState : public DBState {
public:
TestNhState() : DBState(), dummy_(0) { };
int dummy_;
};
class TestNhPeer : public Peer {
public:
TestNhPeer() : Peer(BGP_PEER, "TestNH", false), dummy_(0) { };
int dummy_;
};
TEST_F(RouteTest, RouteToDeletedNH_1) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.10", "00:00:00:01:01:01", 1, 1},
};
client->Reset();
CreateVmportEnv(input, 1);
client->WaitForIdle();
EXPECT_TRUE(VmPortActive(input, 0));
EXPECT_TRUE(RouteFind(vrf_name_, local_vm_ip_, 32));
InetUnicastRouteEntry *rt = RouteGet(vrf_name_, local_vm_ip_, 32);
EXPECT_TRUE(rt->dest_vn_name() == "vn1");
MacAddress vm_mac = MacAddress::FromString("00:00:00:01:01:01");
// Add state to NextHop so that entry is not freed on delete
DBTableBase::ListenerId id =
Agent::GetInstance()->nexthop_table()->Register(
boost::bind(&RouteTest::NhListener, this, _1, _2));
InterfaceNHKey key(new VmInterfaceKey(AgentKey::ADD_DEL_CHANGE,
MakeUuid(1), ""),
false, InterfaceNHFlags::INET4, vm_mac);
NextHop *nh =
static_cast<NextHop *>(Agent::GetInstance()->nexthop_table()->FindActiveEntry(&key));
TestNhState *state = new TestNhState();
nh->SetState(Agent::GetInstance()->nexthop_table(), id, state);
DeleteVmportEnv(input, 1, false);
client->WaitForIdle();
EXPECT_TRUE(Agent::GetInstance()->nexthop_table()->FindActiveEntry(&key) == NULL);
EXPECT_TRUE(Agent::GetInstance()->nexthop_table()->Find(&key, true) != NULL);
TestNhPeer *peer = new TestNhPeer();
Ip4Address addr = Ip4Address::from_string("1.1.1.10");
VnListType vn_list;
vn_list.insert("Test");
agent_->fabric_inet4_unicast_table()->AddLocalVmRouteReq(peer, "vrf1",
addr, 32,
MakeUuid(1), vn_list,
10,
SecurityGroupList(),
CommunityList(),
false,
PathPreference(),
Ip4Address(0),
EcmpLoadBalance(),
false, false);
client->WaitForIdle();
InetUnicastAgentRouteTable::DeleteReq(peer, "vrf1", addr, 32, NULL);
client->WaitForIdle();
nh->ClearState(Agent::GetInstance()->nexthop_table(), id);
client->WaitForIdle();
delete state;
delete peer;
Agent::GetInstance()->nexthop_table()->Unregister(id);
client->WaitForIdle();
DeleteVmportEnv(input, 1, true);
client->WaitForIdle();
EXPECT_TRUE(Agent::GetInstance()->nexthop_table()->Find(&key, true) == NULL);
int i = 0;
while(RouteFind(vrf_name_, local_vm_ip_, 32) == true && ++i < 25) {
client->WaitForIdle();
}
EXPECT_FALSE(VmPortFind(input, 0));
}
TEST_F(RouteTest, RouteToDeletedNH_2) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.1", "00:00:00:01:01:01", 1, 1},
};
client->Reset();
CreateVmportEnv(input, 1, 1);
client->WaitForIdle();
EXPECT_TRUE(VmPortActive(input, 0));
TestNhPeer *peer1 = new TestNhPeer();
TestNhPeer *peer2 = new TestNhPeer();
Ip4Address addr = Ip4Address::from_string("1.1.1.1");
VnListType vn_list;
vn_list.insert("Test");
agent_->fabric_inet4_unicast_table()->AddLocalVmRouteReq(peer1, "vrf1",
addr, 32,
MakeUuid(1),
vn_list, 10,
SecurityGroupList(),
CommunityList(),
false,
PathPreference(),
Ip4Address(0),
EcmpLoadBalance(),
false, false);
agent_->fabric_inet4_unicast_table()->AddLocalVmRouteReq(peer2, "vrf1",
addr, 32,
MakeUuid(1),
vn_list, 10,
SecurityGroupList(),
CommunityList(),
false,
PathPreference(),
Ip4Address(0),
EcmpLoadBalance(),
false, false);
client->WaitForIdle();
DelNode("access-control-list", "acl1");
DelNode("virtual-network", "vn1");
client->WaitForIdle();
agent_->fabric_inet4_unicast_table()->AddLocalVmRouteReq(peer1, "vrf1",
addr, 32,
MakeUuid(1),
vn_list, 10,
SecurityGroupList(),
CommunityList(),
false,
PathPreference(),
Ip4Address(0),
EcmpLoadBalance(),
false, false);
client->WaitForIdle();
InetUnicastAgentRouteTable::DeleteReq(peer1, "vrf1", addr, 32, NULL);
InetUnicastAgentRouteTable::DeleteReq(peer2, "vrf1", addr, 32, NULL);
client->WaitForIdle();
delete peer1;
delete peer2;
DeleteVmportEnv(input, 1, true, 1);
client->WaitForIdle();
WAIT_FOR(100, 100, (RouteFind("vrf1", addr, 32) == false));
EXPECT_FALSE(VmPortFind(input, 0));
}
TEST_F(RouteTest, RouteToInactiveInterface) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.10", "00:00:00:01:01:01", 1, 1},
};
client->Reset();
CreateVmportEnv(input, 1);
client->WaitForIdle();
EXPECT_TRUE(VmPortActive(input, 0));
EXPECT_TRUE(RouteFind(vrf_name_, local_vm_ip_, 32));
InetUnicastRouteEntry *rt = RouteGet(vrf_name_, local_vm_ip_, 32);
EXPECT_TRUE(rt->dest_vn_name() == "vn1");
TestNhPeer *peer = new TestNhPeer();
Ip4Address addr = Ip4Address::from_string("1.1.1.10");
VnListType vn_list;
vn_list.insert("Test");
agent_->fabric_inet4_unicast_table()->AddLocalVmRouteReq(peer, "vrf1",
addr, 32,
MakeUuid(1),
vn_list, 10,
SecurityGroupList(),
CommunityList(),
false,
PathPreference(),
Ip4Address(0),
EcmpLoadBalance(),
false, false);
client->WaitForIdle();
DelVn("vn1");
client->WaitForIdle();
EXPECT_TRUE(VmPortInactive(1));
agent_->fabric_inet4_unicast_table()->AddLocalVmRouteReq(peer, "vrf1",
addr, 32,
MakeUuid(1),
vn_list, 10,
SecurityGroupList(),
CommunityList(),
false,
PathPreference(),
Ip4Address(0),
EcmpLoadBalance(),
false, false);
client->WaitForIdle();
InetUnicastAgentRouteTable::DeleteReq(peer, "vrf1", addr, 32, NULL);
client->WaitForIdle();
delete peer;
DeleteVmportEnv(input, 1, true);
client->WaitForIdle();
int i = 0;
while(RouteFind(vrf_name_, local_vm_ip_, 32) == true && ++i < 25) {
client->WaitForIdle();
}
EXPECT_FALSE(VmPortFind(input, 0));
}
TEST_F(RouteTest, RtEntryReuse) {
client->Reset();
DBTableBase::ListenerId id =
Agent::GetInstance()->fabric_inet4_unicast_table()->Register(
boost::bind(&RouteTest::RtListener,
this, _1, _2));
InetUnicastRouteEntry *rt;
InetUnicastRouteEntry *rt_hold;
AddResolveRoute(lpm3_ip_, 24);
client->WaitForIdle();
AddArp(lpm4_ip_.to_string().c_str(), "0d:0b:0c:0d:0e:0f", eth_name_.c_str());
client->WaitForIdle();
rt = Agent::GetInstance()->fabric_inet4_unicast_table()->FindLPM(lpm4_ip_);
EXPECT_EQ(lpm4_ip_, rt->addr());
boost::scoped_ptr<TestRtState> state(new TestRtState());
rt->SetState(Agent::GetInstance()->fabric_inet4_unicast_table(), id, state.get());
rt_hold = rt;
DeleteRoute(Agent::GetInstance()->local_peer(), Agent::GetInstance()->fabric_vrf_name(), lpm4_ip_, 32);
client->WaitForIdle();
rt = Agent::GetInstance()->fabric_inet4_unicast_table()->FindLPM(lpm4_ip_);
EXPECT_EQ(lpm3_ip_, rt->addr());
AddArp(lpm4_ip_.to_string().c_str(), "0d:0b:0c:0d:0e:0f", eth_name_.c_str());
client->WaitForIdle();
rt = Agent::GetInstance()->fabric_inet4_unicast_table()->FindLPM(lpm4_ip_);
EXPECT_EQ(lpm4_ip_, rt->addr());
EXPECT_EQ(rt, rt_hold);
rt->ClearState(Agent::GetInstance()->fabric_inet4_unicast_table(), id);
DeleteRoute(Agent::GetInstance()->local_peer(), Agent::GetInstance()->fabric_vrf_name(), lpm4_ip_, 32);
client->WaitForIdle();
DeleteRoute(Agent::GetInstance()->local_peer(), Agent::GetInstance()->fabric_vrf_name(), lpm3_ip_, 24);
client->WaitForIdle();
DelArp(lpm4_ip_.to_string().c_str(), "0d:0b:0c:0d:0e:0f", eth_name_.c_str());
client->WaitForIdle();
Agent::GetInstance()->fabric_inet4_unicast_table()->Unregister(id);
}
TEST_F(RouteTest, ScaleRouteAddDel_1) {
uint32_t i = 0;
for (i = 0; i < 1000; i++) {
AddRemoteVmRoute(remote_vm_ip_, fabric_gw_ip_, 32,
MplsTable::kStartLabel);
InetUnicastAgentRouteTable::DeleteReq(NULL, "vrf1", remote_vm_ip_, 32, NULL);
}
client->WaitForIdle(5);
EXPECT_FALSE(RouteFind(vrf_name_, remote_vm_ip_, 32));
}
TEST_F(RouteTest, ScaleRouteAddDel_2) {
uint32_t repeat = 1000;
uint32_t i = 0;
for (i = 0; i < repeat; i++) {
AddRemoteVmRoute(remote_vm_ip_, fabric_gw_ip_, 32,
MplsTable::kStartLabel);
if (i != (repeat - 1)) {
InetUnicastAgentRouteTable::DeleteReq
(Agent::GetInstance()->local_peer(), "vrf1", remote_vm_ip_,
32, NULL);
}
}
client->WaitForIdle(5);
EXPECT_TRUE(RouteFind(vrf_name_, remote_vm_ip_, 32));
InetUnicastRouteEntry *rt = RouteGet(vrf_name_, remote_vm_ip_, 32);
EXPECT_TRUE(rt->GetActiveNextHop()->GetType() == NextHop::TUNNEL);
EXPECT_TRUE(rt->GetActiveNextHop()->IsDeleted() == false);
DeleteRoute(NULL, vrf_name_, remote_vm_ip_, 32);
EXPECT_FALSE(RouteFind(vrf_name_, remote_vm_ip_, 32));
TunnelNHKey key(Agent::GetInstance()->fabric_vrf_name(),
Agent::GetInstance()->router_id(), fabric_gw_ip_, false,
TunnelType::DefaultType());
EXPECT_FALSE(FindNH(&key));
}
//Test scale add and delete of composite routes
TEST_F(RouteTest, ScaleRouteAddDel_3) {
ComponentNHKeyList comp_nh_list;
int remote_server_ip = 0x0A0A0A0A;
int label = 16;
int nh_count = 3;
for(int i = 0; i < nh_count; i++) {
ComponentNHKeyPtr comp_nh(new ComponentNHKey(label,
Agent::GetInstance()->fabric_vrf_name(),
Agent::GetInstance()->router_id(), Ip4Address(remote_server_ip++),
false, TunnelType::AllType()));
comp_nh_list.push_back(comp_nh);
label++;
}
SecurityGroupList sg_id_list;
for (uint32_t i = 0; i < 1000; i++) {
EcmpTunnelRouteAdd(NULL, vrf_name_, remote_vm_ip_, 32,
comp_nh_list, false, "test", sg_id_list,
PathPreference());
client->WaitForIdle();
DeleteRoute(NULL, vrf_name_, remote_vm_ip_, 32);
}
client->WaitForIdle(5);
EXPECT_FALSE(RouteFind(vrf_name_, remote_vm_ip_, 32));
CompositeNHKey key(Composite::ECMP, true, comp_nh_list, vrf_name_);
EXPECT_FALSE(FindNH(&key));
}
//Test scale add and delete of composite routes
TEST_F(RouteTest, ScaleRouteAddDel_4) {
ComponentNHKeyList comp_nh_list;
int remote_server_ip = 0x0A0A0A0A;
int label = 16;
int nh_count = 3;
for(int i = 0; i < nh_count; i++) {
ComponentNHKeyPtr comp_nh(new ComponentNHKey(label,
Agent::GetInstance()->fabric_vrf_name(),
Agent::GetInstance()->router_id(),
Ip4Address(remote_server_ip++),
false, TunnelType::AllType()));
comp_nh_list.push_back(comp_nh);
label++;
}
uint32_t repeat = 1000;
SecurityGroupList sg_id_list;
sg_id_list.push_back(1);
for (uint32_t i = 0; i < repeat; i++) {
EcmpTunnelRouteAdd(NULL, vrf_name_, remote_vm_ip_, 32,
comp_nh_list, -1, "test", sg_id_list,
PathPreference());
client->WaitForIdle();
if (i != (repeat - 1)) {
DeleteRoute(NULL, vrf_name_, remote_vm_ip_, 32);
}
}
client->WaitForIdle(5);
EXPECT_TRUE(RouteFind(vrf_name_, remote_vm_ip_, 32));
InetUnicastRouteEntry *rt = RouteGet(vrf_name_, remote_vm_ip_, 32);
EXPECT_TRUE(rt->GetActiveNextHop()->GetType() == NextHop::COMPOSITE);
EXPECT_TRUE(rt->GetActiveNextHop()->IsDeleted() == false);
const SecurityGroupList &sg = rt->GetActivePath()->sg_list();
EXPECT_TRUE(sg[0] == 1);
DeleteRoute(NULL, vrf_name_, remote_vm_ip_, 32);
EXPECT_FALSE(RouteFind(vrf_name_, remote_vm_ip_, 32));
CompositeNHKey key(Composite::ECMP, true, comp_nh_list, vrf_name_);
EXPECT_FALSE(FindNH(&key));
}
//Check path with highest preference gets priority
TEST_F(RouteTest, PathPreference) {
client->Reset();
struct PortInfo input[] = {
{"vnet3", 3, "1.1.1.1", "00:00:00:01:01:01", 3, 3},
{"vnet4", 4, "1.1.1.1", "00:00:00:01:01:01", 3, 4},
};
CreateVmportEnv(input, 2);
client->WaitForIdle();
VmInterface *vnet3 = VmInterfaceGet(3);
VmInterface *vnet4 = VmInterfaceGet(4);
Ip4Address ip = Ip4Address::from_string("1.1.1.1");
InetUnicastRouteEntry *rt = RouteGet("vrf3", ip, 32);
//Enqueue traffic seen from vnet4 interface
Agent::GetInstance()->oper_db()->route_preference_module()->
EnqueueTrafficSeen(ip, 32, vnet4->id(), vnet4->vrf()->vrf_id(),
MacAddress());
client->WaitForIdle();
EXPECT_TRUE(rt->GetActivePath()->peer() == vnet4->peer());
//Enqueue traffic seen from vnet3 interface
Agent::GetInstance()->oper_db()->route_preference_module()->
EnqueueTrafficSeen(ip, 32, vnet3->id(), vnet3->vrf()->vrf_id(),
MacAddress());
client->WaitForIdle();
//Check that path from vnet3 is preferred path
EXPECT_TRUE(rt->GetActivePath()->peer() == vnet3->peer());
DeleteVmportEnv(input, 2, true);
client->WaitForIdle();
}
//If ecmp flag is removed from instance ip, verify that path gets removed from
//ecmp peer path
TEST_F(RouteTest, EcmpPathDelete) {
client->Reset();
struct PortInfo input[] = {
{"vnet3", 3, "1.1.1.1", "00:00:00:01:01:01", 3, 3},
{"vnet4", 4, "1.1.1.1", "00:00:00:01:01:01", 3, 4},
};
CreateVmportWithEcmp(input, 2);
client->WaitForIdle();
Ip4Address ip = Ip4Address::from_string("1.1.1.1");
InetUnicastRouteEntry *rt = RouteGet("vrf3", ip, 32);
EXPECT_TRUE(rt->GetActiveNextHop()->GetType() == NextHop::COMPOSITE);
CreateVmportEnv(input, 2);
client->WaitForIdle();
//One of the interface becomes active path
EXPECT_TRUE(rt->GetActiveNextHop()->GetType() == NextHop::INTERFACE);
CreateVmportWithEcmp(input, 2);
client->WaitForIdle();
EXPECT_TRUE(rt->GetActiveNextHop()->GetType() == NextHop::COMPOSITE);
DeleteVmportEnv(input, 2, true);
client->WaitForIdle();
EXPECT_TRUE(RouteGet("vrf3", ip, 32) == NULL);
//Make sure vrf and all routes are deleted
EXPECT_TRUE(VrfFind("vrf3", true) == false);
}
TEST_F(RouteTest, Enqueue_uc_route_add_on_deleted_vrf) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.10", "00:00:00:01:01:01", 1, 1},
};
client->Reset();
CreateVmportEnv(input, 1);
client->WaitForIdle();
VrfEntryRef vrf_ref = VrfGet(vrf_name_.c_str());
DeleteVmportEnv(input, 1, true);
client->WaitForIdle();
TaskScheduler::GetInstance()->Stop();
Inet4TunnelRouteAdd(NULL, vrf_name_, remote_vm_ip_, 32, server1_ip_,
TunnelType::AllType(), MplsTable::kStartLabel,
vrf_name_,
SecurityGroupList(), PathPreference());
vrf_ref = NULL;
TaskScheduler::GetInstance()->Start();
client->WaitForIdle();
}
TEST_F(RouteTest, Enqueue_uc_route_del_on_deleted_vrf) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.10", "00:00:00:01:01:01", 1, 1},
};
client->Reset();
CreateVmportEnv(input, 1);
client->WaitForIdle();
VrfEntryRef vrf_ref = VrfGet(vrf_name_.c_str());
DeleteVmportEnv(input, 1, true);
client->WaitForIdle();
TaskScheduler::GetInstance()->Stop();
InetUnicastAgentRouteTable::DeleteReq(NULL, vrf_name_, remote_vm_ip_, 32,
NULL);
vrf_ref = NULL;
TaskScheduler::GetInstance()->Start();
client->WaitForIdle();
}
TEST_F(RouteTest, Enqueue_mc_route_add_on_deleted_vrf) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.10", "00:00:00:01:01:01", 1, 1},
};
client->Reset();
CreateVmportEnv(input, 1);
client->WaitForIdle();
VrfEntryRef vrf_ref = VrfGet(vrf_name_.c_str());
DeleteVmportEnv(input, 1, true);
client->WaitForIdle();
TaskScheduler::GetInstance()->Stop();
ComponentNHKeyList component_nh_key_list;
Inet4MulticastAgentRouteTable::AddMulticastRoute(vrf_name_, "vn1",
Ip4Address::from_string("0.0.0.0"),
Ip4Address::from_string("255.255.255.255"),
component_nh_key_list);
vrf_ref = NULL;
TaskScheduler::GetInstance()->Start();
client->WaitForIdle();
}
TEST_F(RouteTest, Enqueue_mc_route_del_on_deleted_vrf) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.10", "00:00:00:01:01:01", 1, 1},
};
client->Reset();
CreateVmportEnv(input, 1);
client->WaitForIdle();
VrfEntryRef vrf_ref = VrfGet(vrf_name_.c_str());
DeleteVmportEnv(input, 1, true);
client->WaitForIdle();
TaskScheduler::GetInstance()->Stop();
Inet4MulticastAgentRouteTable::DeleteMulticastRoute(vrf_name_,
Ip4Address::from_string("0.0.0.0"),
Ip4Address::from_string("255.255.255.255"));
vrf_ref = NULL;
TaskScheduler::GetInstance()->Start();
client->WaitForIdle();
}
TEST_F(RouteTest, SubnetGwForRoute_1) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.10", "00:00:00:01:01:01", 1, 1},
};
client->Reset();
CreateVmportEnv(input, 1);
client->WaitForIdle();
IpamInfo ipam_info[] = {
{"1.1.1.0", 24, "1.1.1.200", true},
};
AddIPAM("vn1", ipam_info, 1, NULL, "vdns1");
client->WaitForIdle();
//Check if the subnet gateway is set to 1.1.1.200 for a route
Ip4Address vm_ip = Ip4Address::from_string("1.1.1.10");
InetUnicastRouteEntry *rt = RouteGet("vrf1", vm_ip, 32);
Ip4Address subnet_service_ip = Ip4Address::from_string("1.1.1.200");
EXPECT_TRUE(rt->GetActivePath()->subnet_service_ip() == subnet_service_ip);
//Update ipam to have different gw address
IpamInfo ipam_info2[] = {
{"1.1.1.0", 24, "1.1.1.201", true},
};
AddIPAM("vn1", ipam_info2, 1, NULL, "vdns1");
client->WaitForIdle();
subnet_service_ip = Ip4Address::from_string("1.1.1.201");
EXPECT_TRUE(rt->GetActivePath()->subnet_service_ip() == subnet_service_ip);
DelIPAM("vn1", "vdns1");
DeleteVmportEnv(input, 1, true);
client->WaitForIdle();
//Make sure vrf and all routes are deleted
EXPECT_TRUE(VrfFind("vrf1", true) == false);
}
//Enqueue a pth preference change for
//non existent path and make sure, path change is not
//notified
TEST_F(RouteTest, PathPreference_1) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.10", "00:00:00:01:01:01", 1, 1},
};
client->Reset();
CreateVmportEnv(input, 1);
client->WaitForIdle();
Peer peer(Peer::LOCAL_VM_PORT_PEER, "test_peer", true);
Ip4Address ip = Ip4Address::from_string("1.1.1.10");
//Enqueue path change for non existent path
DBRequest req(DBRequest::DB_ENTRY_ADD_CHANGE);
InetUnicastRouteKey *rt_key =
new InetUnicastRouteKey(&peer, "vrf1", ip, 32);
rt_key->sub_op_ = AgentKey::RESYNC;
req.key.reset(rt_key);
req.data.reset(new PathPreferenceData(PathPreference()));
AgentRouteTable *table =
agent_->vrf_table()->GetInet4UnicastRouteTable("vrf1");
table->Enqueue(&req);
client->WaitForIdle();
EXPECT_TRUE(RouteFind("vrf1", ip, 32) == true);
DeleteVmportEnv(input, 1, true);
client->WaitForIdle();
//Make sure vrf and all routes are deleted
EXPECT_TRUE(VrfFind("vrf1", true) == false);
}
// Enqueue a route resync for a peer which does not
// have a path to route make sure, path change is not
// notified
TEST_F(RouteTest, RouteResync_1) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.10", "00:00:00:01:01:01", 1, 1},
};
client->Reset();
CreateVmportEnv(input, 1);
client->WaitForIdle();
Peer peer(Peer::LOCAL_VM_PORT_PEER, "test_peer", true);
Ip4Address ip = Ip4Address::from_string("1.1.1.10");
//Enqueue path change for non existent path
DBRequest req(DBRequest::DB_ENTRY_ADD_CHANGE);
InetUnicastRouteKey *rt_key =
new InetUnicastRouteKey(&peer, "vrf1", ip, 32);
rt_key->sub_op_ = AgentKey::RESYNC;
req.key.reset(rt_key);
InetInterfaceKey intf_key("vnet1");
VnListType vn_list;
vn_list.insert("vn1");
req.data.reset(new InetInterfaceRoute(intf_key, 1, TunnelType::GREType(),
vn_list));
AgentRouteTable *table =
agent_->vrf_table()->GetInet4UnicastRouteTable("vrf1");
table->Enqueue(&req);
client->WaitForIdle();
EXPECT_TRUE(RouteFind("vrf1", ip, 32) == true);
DeleteVmportEnv(input, 1, true);
client->WaitForIdle();
//Make sure vrf and all routes are deleted
EXPECT_TRUE(VrfFind("vrf1", true) == false);
}
//Add IPAM and then add a smaller subnet as remote route.
//Flood flag shud be set in both.
TEST_F(RouteTest, SubnetRoute_Flood_1) {
client->Reset();
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.1", "00:00:00:01:01:01", 1, 1},
};
IpamInfo ipam_info[] = {
{"1.1.1.0", 24, "1.1.1.200", true},
{"2.2.2.100", 28, "2.2.2.200", true},
{"3.3.3.0", 16, "3.3.30.200", true},
};
client->Reset();
CreateVmportEnv(input, 1, 0);
client->WaitForIdle();
AddIPAM("vn1", ipam_info, 3);
client->WaitForIdle();
InetUnicastRouteEntry *rt1 = RouteGet(vrf_name_, subnet_vm_ip_1_, 24);
InetUnicastRouteEntry *rt2 = RouteGet(vrf_name_, subnet_vm_ip_2_, 28);
InetUnicastRouteEntry *rt3 = RouteGet(vrf_name_, subnet_vm_ip_3_, 16);
EXPECT_TRUE(rt1 != NULL);
EXPECT_TRUE(rt2 != NULL);
EXPECT_TRUE(rt3 != NULL);
EXPECT_TRUE(rt1->ipam_subnet_route() == true);
EXPECT_TRUE(rt2->ipam_subnet_route() == true);
EXPECT_TRUE(rt3->ipam_subnet_route() == true);
//Now add remote route
AddRemoteVmRoute(remote_subnet_ip_, fabric_gw_ip_, 29, MplsTable::kStartLabel);
EXPECT_TRUE(RouteFind(vrf_name_, remote_subnet_ip_, 29));
InetUnicastRouteEntry *rt = RouteGet(vrf_name_, remote_subnet_ip_, 29);
EXPECT_TRUE(rt->ipam_subnet_route() == true);
//On IPAM going off remote route should remove its flood flag.
client->Reset();
DelIPAM("vn1");
client->WaitForIdle();
EXPECT_FALSE(rt->ipam_subnet_route());
client->Reset();
DeleteRoute(NULL, vrf_name_, remote_subnet_ip_, 29);
DeleteVmportEnv(input, 1, 1, 0);
client->WaitForIdle();
}
//Add remote route and then add IPAM subnet.
//Flood flag shud be set in both.
TEST_F(RouteTest, SubnetRoute_Flood_2) {
client->Reset();
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.1", "00:00:00:01:01:01", 1, 1},
};
IpamInfo ipam_info[] = {
{"1.1.1.0", 24, "1.1.1.200", true},
{"2.2.2.100", 28, "2.2.2.200", true},
{"3.3.3.0", 16, "3.3.30.200", true},
};
client->Reset();
CreateVmportEnv(input, 1, 0);
client->WaitForIdle();
//Now add remote route
AddRemoteVmRoute(remote_subnet_ip_, fabric_gw_ip_, 29, MplsTable::kStartLabel);
EXPECT_TRUE(RouteFind(vrf_name_, remote_subnet_ip_, 29));
InetUnicastRouteEntry *rt = RouteGet(vrf_name_, remote_subnet_ip_, 29);
EXPECT_FALSE(rt->ipam_subnet_route());
AddIPAM("vn1", ipam_info, 3);
client->WaitForIdle();
InetUnicastRouteEntry *rt1 = RouteGet(vrf_name_, subnet_vm_ip_1_, 24);
InetUnicastRouteEntry *rt2 = RouteGet(vrf_name_, subnet_vm_ip_2_, 28);
InetUnicastRouteEntry *rt3 = RouteGet(vrf_name_, subnet_vm_ip_3_, 16);
EXPECT_TRUE(rt1 != NULL);
EXPECT_TRUE(rt2 != NULL);
EXPECT_TRUE(rt3 != NULL);
EXPECT_TRUE(rt1->ipam_subnet_route() == true);
EXPECT_TRUE(rt2->ipam_subnet_route() == true);
EXPECT_TRUE(rt3->ipam_subnet_route() == true);
EXPECT_TRUE(RouteFind(vrf_name_, remote_subnet_ip_, 29));
rt = RouteGet(vrf_name_, remote_subnet_ip_, 29);
EXPECT_TRUE(rt->ipam_subnet_route());
//On IPAM going off remote route should remove its flood flag.
client->Reset();
DelIPAM("vn1");
client->WaitForIdle();
EXPECT_FALSE(rt->ipam_subnet_route());
client->Reset();
DeleteRoute(NULL, vrf_name_, remote_subnet_ip_, 29);
DeleteVmportEnv(input, 1, 1, 0);
client->WaitForIdle();
}
TEST_F(RouteTest, null_ip_subnet_add) {
Ip4Address null_subnet_ip;
null_subnet_ip = Ip4Address::from_string("0.0.0.0");
AddRemoteVmRoute(null_subnet_ip, fabric_gw_ip_, 0, MplsTable::kStartLabel);
EXPECT_TRUE(RouteFind(vrf_name_, null_subnet_ip, 0));
InetUnicastRouteEntry *rt = RouteGet(vrf_name_, null_subnet_ip, 0);
EXPECT_TRUE(rt->GetActiveNextHop()->GetType() == NextHop::TUNNEL);
EXPECT_FALSE(rt->ipam_subnet_route());
DeleteRoute(NULL, vrf_name_, null_subnet_ip, 0);
EXPECT_FALSE(RouteFind(vrf_name_, null_subnet_ip, 0));
}
// Test case checks for arp and proxy flag setting
// on different routes.
TEST_F(RouteTest, route_arp_flags_1) {
client->Reset();
BgpPeer *peer = CreateBgpPeer("127.0.0.1", "remote");
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.1", "00:00:00:01:01:01", 1, 1},
};
IpamInfo ipam_info[] = {
{"1.1.1.0", 24, "1.1.1.200", true},
{"2.2.2.100", 28, "2.2.2.200", true},
{"3.3.3.0", 16, "3.3.30.200", true},
};
client->Reset();
CreateVmportEnv(input, 1, 0);
client->WaitForIdle();
AddIPAM("vn1", ipam_info, 3);
client->WaitForIdle();
//Local unicast route arp proxy and flood check
InetUnicastRouteEntry *uc_rt = RouteGet(vrf_name_,
Ip4Address::from_string("1.1.1.1"),
32);
//In ksync binding decides if flood flag i.e. ipam_subnet_route needs to be
//enabled or not.
EXPECT_FALSE(uc_rt->ipam_subnet_route());
EXPECT_FALSE(uc_rt->proxy_arp());
//Subnet routes check
InetUnicastRouteEntry *rt1 = RouteGet(vrf_name_, subnet_vm_ip_1_, 24);
InetUnicastRouteEntry *rt2 = RouteGet(vrf_name_, subnet_vm_ip_2_, 28);
InetUnicastRouteEntry *rt3 = RouteGet(vrf_name_, subnet_vm_ip_3_, 16);
EXPECT_TRUE(rt1 != NULL);
EXPECT_TRUE(rt2 != NULL);
EXPECT_TRUE(rt3 != NULL);
//All ipam added gateway routes should have flood enabled and proxy disabled
//for arp.
EXPECT_TRUE(rt1->ipam_subnet_route());
EXPECT_TRUE(rt2->ipam_subnet_route());
EXPECT_TRUE(rt3->ipam_subnet_route());
EXPECT_FALSE(rt1->proxy_arp());
EXPECT_FALSE(rt2->proxy_arp());
EXPECT_FALSE(rt3->proxy_arp());
//Add remote route for ipam gw (1.1.1.0/24) with bgp peer, route flag should
//be retained.
Inet4TunnelRouteAdd(peer, vrf_name_, subnet_vm_ip_1_, 24, server1_ip_,
TunnelType::MplsType(), MplsTable::kStartLabel,
vrf_name_,
SecurityGroupList(), PathPreference());
client->WaitForIdle();
rt1 = RouteGet(vrf_name_, subnet_vm_ip_1_, 24);
EXPECT_TRUE(rt1->GetPathList().size() == 2);
EXPECT_TRUE(rt1->ipam_subnet_route());
EXPECT_FALSE(rt1->proxy_arp());
//Delete 1.1.1.0/24 from BGP peer, no change in flags
DeleteRoute(peer, vrf_name_, subnet_vm_ip_1_, 24);
client->WaitForIdle();
rt1 = RouteGet(vrf_name_, subnet_vm_ip_1_, 24);
EXPECT_TRUE(rt1->GetPathList().size() == 1);
EXPECT_TRUE(rt1->ipam_subnet_route());
EXPECT_FALSE(rt1->proxy_arp());
//Add remote route for ipam gw (3.3.3.0/16) with bgp peer, route flag should
//be retained.
Inet4TunnelRouteAdd(peer, vrf_name_, subnet_vm_ip_3_, 16, server1_ip_,
TunnelType::MplsType(), MplsTable::kStartLabel,
vrf_name_,
SecurityGroupList(), PathPreference());
client->WaitForIdle();
rt3 = RouteGet(vrf_name_, subnet_vm_ip_3_, 16);
EXPECT_TRUE(rt3->GetPathList().size() == 2);
EXPECT_TRUE(rt3->ipam_subnet_route());
EXPECT_FALSE(rt3->proxy_arp());
//Add another smaller subnet, should inherit 3.3.0.0/16 flags
Ip4Address smaller_subnet_3;
smaller_subnet_3 = Ip4Address::from_string("3.3.3.3");
Inet4TunnelRouteAdd(peer, vrf_name_, smaller_subnet_3, 28, server1_ip_,
TunnelType::MplsType(), MplsTable::kStartLabel,
vrf_name_,
SecurityGroupList(), PathPreference());
client->WaitForIdle();
rt3 = RouteGet(vrf_name_, smaller_subnet_3, 28);
EXPECT_TRUE(rt3->ipam_subnet_route());
EXPECT_FALSE(rt3->proxy_arp());
//Delete Ipam path for 3.3.3.0/16 and there shud be only one path
//i.e. from remote peer and flags should be toggled. Proxy - yes,
//flood - no.
IpamInfo ipam_info_2[] = {
{"1.1.1.0", 24, "1.1.1.200", true},
{"2.2.2.100", 28, "2.2.2.200", true},
};
AddIPAM("vn1", ipam_info_2, 2);
client->WaitForIdle();
rt3 = RouteGet(vrf_name_, subnet_vm_ip_3_, 16);
EXPECT_TRUE(rt3->GetPathList().size() == 1);
EXPECT_FALSE(rt3->ipam_subnet_route());
EXPECT_FALSE(rt3->proxy_arp());
//Smaller subnet 3.3.3.3/28 also toggles
rt3 = RouteGet(vrf_name_, smaller_subnet_3, 28);
EXPECT_FALSE(rt3->ipam_subnet_route());
EXPECT_FALSE(rt3->proxy_arp());
//Add back IPAM 3.3.0.0/16 and see flags are restored.
AddIPAM("vn1", ipam_info, 3);
client->WaitForIdle();
rt3 = RouteGet(vrf_name_, subnet_vm_ip_3_, 16);
EXPECT_TRUE(rt3->ipam_subnet_route());
EXPECT_FALSE(rt3->proxy_arp());
//Smaller subnet 3.3.3.3/28 also toggles
rt3 = RouteGet(vrf_name_, smaller_subnet_3, 28);
EXPECT_TRUE(rt3->ipam_subnet_route());
EXPECT_FALSE(rt3->proxy_arp());
//Add back IPAM 3.3.0.0/16 and see flags are restored.
//Delete the 3.3.3.0/16 remotr route
DeleteRoute(peer, vrf_name_, subnet_vm_ip_3_, 16);
DeleteRoute(peer, vrf_name_, smaller_subnet_3, 28);
client->WaitForIdle();
//Add and delete a super net 2.2.2.0/24 and see 2.2.2.100/28 is not impacted
Ip4Address subnet_supernet_2;
subnet_supernet_2 = Ip4Address::from_string("2.2.2.0");
Inet4TunnelRouteAdd(peer, vrf_name_, subnet_supernet_2, 24, server1_ip_,
TunnelType::MplsType(), MplsTable::kStartLabel,
vrf_name_,
SecurityGroupList(), PathPreference());
client->WaitForIdle();
rt2 = RouteGet(vrf_name_, subnet_supernet_2, 24);
EXPECT_FALSE(rt2->ipam_subnet_route());
EXPECT_TRUE(rt2->proxy_arp());
rt2 = RouteGet(vrf_name_, subnet_vm_ip_2_, 28);
EXPECT_TRUE(rt2->ipam_subnet_route());
EXPECT_FALSE(rt2->proxy_arp());
//Delete super net
DeleteRoute(peer, vrf_name_, subnet_vm_ip_2_, 24);
client->WaitForIdle();
EXPECT_TRUE(rt2->ipam_subnet_route());
EXPECT_FALSE(rt2->proxy_arp());
//Add any arbitrary remote route outside ipam say 4.4.4.0/24
//proxy - yes, flood - no
Ip4Address subnet_vm_ip_non_ipam;
subnet_vm_ip_non_ipam = Ip4Address::from_string("4.4.4.0");
Inet4TunnelRouteAdd(peer, vrf_name_, subnet_vm_ip_non_ipam, 24, server1_ip_,
TunnelType::MplsType(), MplsTable::kStartLabel,
vrf_name_,
SecurityGroupList(), PathPreference());
client->WaitForIdle();
InetUnicastRouteEntry *rt4 = RouteGet(vrf_name_, subnet_vm_ip_non_ipam, 24);
EXPECT_FALSE(rt4->ipam_subnet_route());
EXPECT_TRUE(rt4->proxy_arp());
//Add another smaller subnet in 4.4.4.0/24 say 4.4.4.10/28
//proxy - yes, flood -no
Ip4Address subnet_vm_ip_non_ipam_2;
subnet_vm_ip_non_ipam_2 = Ip4Address::from_string("4.4.4.10");
Inet4TunnelRouteAdd(peer, vrf_name_, subnet_vm_ip_non_ipam_2, 28,
server1_ip_,
TunnelType::MplsType(), MplsTable::kStartLabel,
vrf_name_,
SecurityGroupList(), PathPreference());
client->WaitForIdle();
InetUnicastRouteEntry *rt5 = RouteGet(vrf_name_, subnet_vm_ip_non_ipam_2, 28);
EXPECT_FALSE(rt5->ipam_subnet_route());
EXPECT_TRUE(rt5->proxy_arp());
//Add super net 4.4.0.0/16
Ip4Address subnet_vm_ip_non_ipam_3;
subnet_vm_ip_non_ipam_3 = Ip4Address::from_string("4.4.0.0");
Inet4TunnelRouteAdd(peer, vrf_name_, subnet_vm_ip_non_ipam_3, 16,
server1_ip_,
TunnelType::MplsType(), MplsTable::kStartLabel,
vrf_name_,
SecurityGroupList(), PathPreference());
client->WaitForIdle();
InetUnicastRouteEntry *rt6 = RouteGet(vrf_name_, subnet_vm_ip_non_ipam_3, 16);
EXPECT_FALSE(rt6->ipam_subnet_route());
EXPECT_TRUE(rt6->proxy_arp());
//Delete all these external prefixes 4.4.0.0 and keep checking flags dont
//change
DeleteRoute(peer, vrf_name_, subnet_vm_ip_non_ipam, 24);
client->WaitForIdle();
EXPECT_FALSE(rt5->ipam_subnet_route());
EXPECT_TRUE(rt5->proxy_arp());
EXPECT_FALSE(rt6->ipam_subnet_route());
EXPECT_TRUE(rt6->proxy_arp());
DeleteRoute(peer, vrf_name_, subnet_vm_ip_non_ipam_2, 28);
client->WaitForIdle();
EXPECT_FALSE(rt6->ipam_subnet_route());
EXPECT_TRUE(rt6->proxy_arp());
DeleteRoute(peer, vrf_name_, subnet_vm_ip_non_ipam_3, 16);
client->WaitForIdle();
client->Reset();
DelIPAM("vn1");
client->WaitForIdle();
DeleteVmportEnv(input, 1, 1, 0);
client->WaitForIdle();
DeleteBgpPeer(peer);
client->WaitForIdle();
}
TEST_F(RouteTest, NonEcmpToEcmpConversion) {
struct PortInfo input2[] = {
{"vnet11", 11, "2.1.1.1", "00:00:00:01:01:01", 8, 11},
{"vnet12", 12, "2.1.1.1", "00:00:00:02:02:01", 8, 12},
{"vnet13", 13, "2.1.1.1", "00:00:00:02:02:01", 8, 13},
};
//Add interface in non ecmp mode
CreateVmportEnv(input2, 3);
client->WaitForIdle();
Ip4Address ip = Ip4Address::from_string("2.1.1.1");
InetUnicastRouteEntry *rt = RouteGet("vrf8", ip, 32);
EXPECT_TRUE(rt != NULL);
EXPECT_TRUE(rt->GetPathList().size() == 3);
EXPECT_TRUE(rt->GetActiveNextHop()->GetType() == NextHop::INTERFACE);
CreateVmportWithEcmp(input2, 3);
client->WaitForIdle();
EXPECT_TRUE(rt->GetPathList().size() == 4);
EXPECT_TRUE(rt->GetActiveNextHop()->GetType() == NextHop::COMPOSITE);
CreateVmportEnv(input2, 3);
client->WaitForIdle();
EXPECT_TRUE(rt->GetPathList().size() == 3);
EXPECT_TRUE(rt->GetActiveNextHop()->GetType() == NextHop::INTERFACE);
DeleteVmportEnv(input2, 3, true);
client->WaitForIdle();
EXPECT_TRUE(VrfFind("vrf8", true) == false);
}
TEST_F(RouteTest, Dhcp_enabled_ipam) {
client->Reset();
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.1", "00:00:00:01:01:01", 1, 1},
};
IpamInfo ipam_info[] = {
{"1.1.1.0", 24, "1.1.1.200", true},
};
client->Reset();
CreateVmportEnv(input, 1, 0);
client->WaitForIdle();
AddIPAM("vn1", ipam_info, 1);
client->WaitForIdle();
//Find Bridge route
BridgeRouteEntry *rt =
L2RouteGet("vrf1",
MacAddress::FromString("00:00:00:01:01:01"),
Ip4Address::from_string("1.1.1.1"));
const AgentPath *path = rt->FindMacVmBindingPath();
const MacVmBindingPath *dhcp_path = dynamic_cast<const MacVmBindingPath *>(path);
EXPECT_TRUE(dhcp_path != NULL);
EXPECT_TRUE(dhcp_path->vm_interface()->GetUuid() == MakeUuid(1));
EXPECT_TRUE(dhcp_path->nexthop()->GetType() == NextHop::DISCARD);
EXPECT_TRUE(dhcp_path->flood_dhcp() == false);
client->Reset();
DelIPAM("vn1");
client->WaitForIdle();
DeleteVmportEnv(input, 1, 1, 0);
client->WaitForIdle();
}
TEST_F(RouteTest, Dhcp_disabled_ipam) {
client->Reset();
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.1", "00:00:00:01:01:01", 1, 1},
};
IpamInfo ipam_info[] = {
{"1.1.1.0", 24, "1.1.1.200", false},
};
client->Reset();
CreateVmportEnv(input, 1, 0);
client->WaitForIdle();
AddIPAM("vn1", ipam_info, 1);
client->WaitForIdle();
//Find Bridge route
BridgeRouteEntry *rt =
L2RouteGet("vrf1",
MacAddress::FromString("00:00:00:01:01:01"),
Ip4Address::from_string("1.1.1.1"));
const MacVmBindingPath *dhcp_path =
dynamic_cast<const MacVmBindingPath *>(rt->FindMacVmBindingPath());
EXPECT_TRUE(dhcp_path != NULL);
EXPECT_TRUE(dhcp_path->vm_interface()->GetUuid() == MakeUuid(1));
EXPECT_TRUE(dhcp_path->nexthop()->GetType() == NextHop::DISCARD);
EXPECT_TRUE(dhcp_path->flood_dhcp() == true);
client->Reset();
DelIPAM("vn1");
client->WaitForIdle();
DeleteVmportEnv(input, 1, 1, 0);
client->WaitForIdle();
}
TEST_F(RouteTest, Dhcp_mode_toggled_ipam) {
client->Reset();
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.1", "00:00:00:01:01:01", 1, 1},
{"vnet2", 2, "1.1.1.2", "00:00:00:01:01:02", 1, 1},
};
IpamInfo ipam_info[] = {
{"1.1.1.0", 24, "1.1.1.200", true},
};
client->Reset();
CreateVmportEnv(input, 2, 0);
client->WaitForIdle();
AddIPAM("vn1", ipam_info, 1);
client->WaitForIdle();
//Find Bridge route
BridgeRouteEntry *rt =
L2RouteGet("vrf1",
MacAddress::FromString("00:00:00:01:01:01"),
Ip4Address::from_string("1.1.1.1"));
const AgentPath *path = rt->FindMacVmBindingPath();
const MacVmBindingPath *dhcp_path = dynamic_cast<const MacVmBindingPath *>(path);
EXPECT_TRUE(dhcp_path != NULL);
EXPECT_TRUE(dhcp_path->vm_interface()->GetUuid() == MakeUuid(1));
EXPECT_TRUE(dhcp_path->nexthop()->GetType() == NextHop::DISCARD);
EXPECT_TRUE(dhcp_path->flood_dhcp() == false);
rt = L2RouteGet("vrf1",
MacAddress::FromString("00:00:00:01:01:02"),
Ip4Address::from_string("1.1.1.2"));
dhcp_path = dynamic_cast<const MacVmBindingPath *>(rt->FindMacVmBindingPath());
EXPECT_TRUE(dhcp_path->vm_interface()->GetUuid() == MakeUuid(2));
EXPECT_TRUE(dhcp_path->nexthop()->GetType() == NextHop::DISCARD);
EXPECT_TRUE(dhcp_path->flood_dhcp() == false);
//Toggle to disable
IpamInfo ipam_info_disabled[] = {
{"1.1.1.0", 24, "1.1.1.200", false},
};
AddIPAM("vn1", ipam_info_disabled, 1);
client->WaitForIdle();
rt = L2RouteGet("vrf1",
MacAddress::FromString("00:00:00:01:01:01"),
Ip4Address::from_string("1.1.1.1"));
dhcp_path = dynamic_cast<const MacVmBindingPath *>(rt->FindMacVmBindingPath());
EXPECT_TRUE(dhcp_path->vm_interface()->GetUuid() == MakeUuid(1));
EXPECT_TRUE(dhcp_path->nexthop()->GetType() == NextHop::DISCARD);
EXPECT_TRUE(dhcp_path->flood_dhcp() == true);
rt = L2RouteGet("vrf1",
MacAddress::FromString("00:00:00:01:01:02"),
Ip4Address::from_string("1.1.1.2"));
dhcp_path = dynamic_cast<const MacVmBindingPath *>(rt->FindMacVmBindingPath());
EXPECT_TRUE(dhcp_path->vm_interface()->GetUuid() == MakeUuid(2));
EXPECT_TRUE(dhcp_path->nexthop()->GetType() == NextHop::DISCARD);
EXPECT_TRUE(dhcp_path->flood_dhcp() == true);
//Toggle to enable
AddIPAM("vn1", ipam_info, 1);
client->WaitForIdle();
rt = L2RouteGet("vrf1",
MacAddress::FromString("00:00:00:01:01:01"),
Ip4Address::from_string("1.1.1.1"));
dhcp_path = dynamic_cast<const MacVmBindingPath *>(rt->FindMacVmBindingPath());
EXPECT_TRUE(dhcp_path != NULL);
EXPECT_TRUE(dhcp_path->vm_interface()->GetUuid() == MakeUuid(1));
EXPECT_TRUE(dhcp_path->nexthop()->GetType() == NextHop::DISCARD);
EXPECT_TRUE(dhcp_path->flood_dhcp() == false);
rt = L2RouteGet("vrf1",
MacAddress::FromString("00:00:00:01:01:02"),
Ip4Address::from_string("1.1.1.2"));
dhcp_path = dynamic_cast<const MacVmBindingPath *>(rt->FindMacVmBindingPath());
EXPECT_TRUE(dhcp_path->vm_interface()->GetUuid() == MakeUuid(2));
EXPECT_TRUE(dhcp_path->nexthop()->GetType() == NextHop::DISCARD);
EXPECT_TRUE(dhcp_path->flood_dhcp() == false);
client->Reset();
DelIPAM("vn1");
client->WaitForIdle();
DeleteVmportEnv(input, 2, 1, 0);
client->WaitForIdle();
}
//Double delete ARP route and verify that ARP NH
//get deleted, since we always enqueu RESYNC for arp NH change
//from ARP route deletiong path
TEST_F(RouteTest, ArpRouteDelete) {
ArpNHKey key(Agent::GetInstance()->fabric_vrf_name(), server1_ip_, false);
AddArp(server1_ip_.to_string().c_str(), "0a:0b:0c:0d:0e:0f", eth_name_.c_str());
client->WaitForIdle();
EXPECT_TRUE(FindNH(&key));
EXPECT_TRUE(GetNH(&key)->IsValid() == true);
//Delete Remote VM route
DelArp(server1_ip_.to_string(), "0a:0b:0c:0d:0e:0f", eth_name_.c_str());
client->WaitForIdle();
EXPECT_FALSE(RouteFind(vrf_name_, server1_ip_, 32));
DelArp(server1_ip_.to_string(), "0a:0b:0c:0d:0e:0f", eth_name_.c_str());
client->WaitForIdle();
EXPECT_FALSE(RouteFind(vrf_name_, server1_ip_, 32));
EXPECT_FALSE(FindNH(&key));
}
TEST_F(RouteTest, verify_channel_delete_results_in_path_delete) {
client->Reset();
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.1", "00:00:00:01:01:01", 1, 1},
};
IpamInfo ipam_info[] = {
{"1.1.1.0", 24, "1.1.1.200", true},
};
client->Reset();
CreateVmportEnv(input, 1, 0);
client->WaitForIdle();
AddIPAM("vn1", ipam_info, 1);
client->WaitForIdle();
BgpPeer *peer = CreateBgpPeer("127.0.0.1", "remote");
FillEvpnNextHop(peer, "vrf1", 1000, TunnelType::MplsType());
client->WaitForIdle();
//Get Channel and delete it.
AgentXmppChannel *ch = peer->GetAgentXmppChannel();
XmppChannelMock *xmpp_channel = static_cast<XmppChannelMock *>
(ch->GetXmppChannel());
AgentXmppChannel::HandleAgentXmppClientChannelEvent(ch, xmps::NOT_READY);
client->WaitForIdle();
client->Reset();
DelIPAM("vn1");
client->WaitForIdle();
FlushEvpnNextHop(peer, "vrf1", 0);
DeleteVmportEnv(input, 1, 1, 0);
client->WaitForIdle();
DeleteBgpPeer(NULL);
delete ch;
delete xmpp_channel;
client->WaitForIdle();
}
// https://bugs.launchpad.net/juniperopenstack/+bug/1458194
TEST_F(RouteTest, EcmpTest_1) {
ComponentNHKeyList comp_nh_list;
const Agent *agent = Agent::GetInstance();
int remote_server_ip = 0x0A0A0A0A;
int label = agent->mpls_table()->AllocLabel();
int nh_count = 3;
//Create CNH
ComponentNHKeyList component_nh_list;
DBRequest nh_req(DBRequest::DB_ENTRY_ADD_CHANGE);
nh_req.key.reset(new CompositeNHKey(Composite::LOCAL_ECMP,
false,
component_nh_list,
vrf_name_));
nh_req.data.reset(new CompositeNHData());
agent->nexthop_table()->Enqueue(&nh_req);
client->WaitForIdle();
//Attach CNH to MPLS
DBRequest req1;
req1.oper = DBRequest::DB_ENTRY_ADD_CHANGE;
MplsLabelKey *key1 = new MplsLabelKey(MplsLabel::VPORT_NH, label);
req1.key.reset(key1);
MplsLabelData *data1 = new MplsLabelData(Composite::LOCAL_ECMP, true,
component_nh_list,
vrf_name_);
req1.data.reset(data1);
agent->mpls_table()->Enqueue(&req1);
client->WaitForIdle();
BgpPeer *peer = CreateBgpPeer("127.0.0.1", "remote");
client->WaitForIdle();
MplsLabel *mpls =
agent->mpls_table()->FindMplsLabel(label);
DBEntryBase::KeyPtr key_tmp = mpls->nexthop()->GetDBRequestKey();
NextHopKey *comp_nh_key = static_cast<NextHopKey *>(key_tmp.release());
std::auto_ptr<const NextHopKey> nh_key_ptr(comp_nh_key);
ComponentNHKeyPtr component_nh_key(new ComponentNHKey(label,
nh_key_ptr));
comp_nh_list.push_back(component_nh_key);
for(int i = 1; i < nh_count; i++) {
ComponentNHKeyPtr comp_nh(new ComponentNHKey((label + i),
Agent::GetInstance()->fabric_vrf_name(),
Agent::GetInstance()->router_id(),
Ip4Address(remote_server_ip++),
false, TunnelType::AllType()));
comp_nh_list.push_back(comp_nh);
}
SecurityGroupList sg_id_list;
TaskScheduler::GetInstance()->Stop();
//Move label to tunnel enqueue request
DBRequest req;
req.oper = DBRequest::DB_ENTRY_ADD_CHANGE;
MacAddress vm_mac = MacAddress::FromString("00:00:01:01:01:10");
MplsLabelKey *key = new MplsLabelKey(MplsLabel::VPORT_NH, label);
req.key.reset(key);
MplsLabelData *data = new MplsLabelData("vnet1", false,
InterfaceNHFlags::INET4,
vm_mac);
req.data.reset(data);
agent->mpls_table()->Enqueue(&req);
//Now add ecmp tunnel add request
EcmpTunnelRouteAdd(peer, vrf_name_, remote_vm_ip_, 32,
comp_nh_list, false, "test", sg_id_list,
PathPreference());
client->WaitForIdle();
TaskScheduler::GetInstance()->Start();
//DeleteRoute(vrf_name_.c_str(), remote_vm_ip_, 32, peer);
Agent::GetInstance()->fabric_inet4_unicast_table()->
DeleteReq(peer, vrf_name_.c_str(), remote_vm_ip_, 32,
new ControllerVmRoute(peer));
MplsLabel::DeleteReq(agent, label);
client->WaitForIdle(5);
EXPECT_FALSE(RouteFind(vrf_name_, remote_vm_ip_, 32));
CompositeNHKey comp_key(Composite::ECMP, true, comp_nh_list, vrf_name_);
EXPECT_FALSE(FindNH(&comp_key));
DeleteBgpPeer(peer);
client->WaitForIdle();
}
TEST_F(RouteTest, fip_evpn_route_local) {
struct PortInfo input[] = {
{"vnet1", 1, "1.1.1.10", "00:00:01:01:01:10", 1, 1},
};
client->Reset();
//Creation
CreateVmportFIpEnv(input, 1);
client->WaitForIdle();
//Create floating IP pool
AddFloatingIpPool("fip-pool1", 1);
AddFloatingIp("fip1", 1, "2.2.2.10");
AddLink("floating-ip", "fip1", "floating-ip-pool", "fip-pool1");
AddLink("floating-ip-pool", "fip-pool1", "virtual-network",
"default-project:vn1");
//Associate vnet1 with floating IP
AddLink("virtual-machine-interface", "vnet1", "floating-ip", "fip1");
client->WaitForIdle();
//Add a peer
BgpPeer *bgp_peer_ptr = CreateBgpPeer(Ip4Address(1), "BGP Peer1");
boost::shared_ptr<BgpPeer> bgp_peer =
bgp_peer_ptr->GetAgentXmppChannel()->bgp_peer_id_ref();
client->WaitForIdle();
//Search our evpn route
EvpnRouteEntry *rt = EvpnRouteGet("default-project:vn1:vn1",
MacAddress::FromString(input[0].mac),
Ip4Address::from_string("2.2.2.10"), 0);
EXPECT_TRUE(rt != NULL);
AgentPath *path = rt->FindLocalVmPortPath();
EXPECT_TRUE(path != NULL);
EXPECT_TRUE(rt->GetActivePath() == path);
EXPECT_TRUE(rt->GetActiveNextHop()->GetType() == NextHop::L2_RECEIVE);
//Reflect CN route and see if its added.
stringstream ss_node;
autogen::EnetItemType item;
SecurityGroupList sg;
item.entry.nlri.af = BgpAf::L2Vpn;
item.entry.nlri.safi = BgpAf::Enet;
item.entry.nlri.address="2.2.2.10/32";
item.entry.nlri.ethernet_tag = 0;
autogen::EnetNextHopType nh;
nh.af = Address::INET;
nh.address = agent_->router_ip_ptr()->to_string();
nh.label = rt->GetActiveLabel();
item.entry.next_hops.next_hop.push_back(nh);
item.entry.med = 0;
bgp_peer_ptr->GetAgentXmppChannel()->AddEvpnRoute("default-project:vn1:vn1",
"00:00:01:01:01:10",
&item);
client->WaitForIdle();
EXPECT_TRUE(rt->GetActivePath() != path);
client->WaitForIdle();
DeleteVmportFIpEnv(input, 1, true);
client->WaitForIdle();
DeleteBgpPeer(bgp_peer.get());
client->WaitForIdle();
}
int main(int argc, char *argv[]) {
::testing::InitGoogleTest(&argc, argv);
GETUSERARGS();
client = TestInit(init_file, ksync_init, true, false);
eth_itf = Agent::GetInstance()->fabric_interface_name();
RouteTest::SetTunnelType(TunnelType::MPLS_GRE);
int ret = RUN_ALL_TESTS();
RouteTest::SetTunnelType(TunnelType::MPLS_UDP);
ret += RUN_ALL_TESTS();
client->WaitForIdle();
TestShutdown();
delete client;
return ret;
}
| [
"awaisalisabir@yahoo.com"
] | awaisalisabir@yahoo.com |
4f77792da6bcbdadcf7355b45a2b0e7eb78004ba | 14749d1fdaff6852c754dc1fbf7d9399dd5fb678 | /Subtrador.cpp | aecfd17e7d3cdb761fdf171d1e423a718c90ac31 | [] | no_license | Vincentius004/Non-Decimal-Calculator | 94ccb72616f02171763ef1292a99499fc44bdd90 | 58d9cefcd862dc3efacb64216def8138f671293b | refs/heads/main | 2023-02-04T06:27:43.006111 | 2020-12-14T10:54:59 | 2020-12-14T10:54:59 | 319,074,236 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,668 | cpp | #include <iostream>
#include<string>
#include <stdlib.h>
#include <math.h>
#include "Subtrador.h"
#include "Somador.h"
using std::string;
string Subtrador::subtrair(string numeroUm, string numeroDois, int base)
{
ajeitarStrings(numeroUm, numeroDois);
Somador s;
if(!primeiroNegativo && segundoNegativo)
return s.somar(primeiro, segundo, base);
else if(primeiroNegativo && segundoNegativo)
return getSubtracao(segundo, primeiro, base);
else if(primeiroNegativo && !segundoNegativo)
return s.somar("-" + primeiro, "-" + segundo, base);
return getSubtracao(primeiro, segundo, base);
}
string Subtrador::getSubtracao(string numeroUm, string numeroDois, int base)
{
string um = numeroUm;
string dois = numeroDois;
int size1 = numeroUm.length();
int size2 = numeroDois.length();
bool resultNegativo = false;
int size;
if(numeroUm.length() > numeroDois.length())
size = size1;
else if(numeroUm.length() < numeroDois.length())
{
size = size2;
um = segundo;
dois = primeiro;
resultNegativo = true;
}
else
{
for(int i =0; i <= size1-1; i++) // percorrer os numeros para ver qual é o maior
{
if(numeroUm[i] == '.')
continue;
size = size1;
char atual1 = numeroUm[i];
char atual2 = numeroDois[i];
int val1;
int val2;
if(isdigit(atual1))
val1 = atual1 - 48;
else
val1 = charToInt(atual1);
if(isdigit(atual2))
val2 = atual2 - 48;
else
val2 = charToInt(atual2);
if(val1 > val2)
{
break;
}
if (val1 < val2)
{
um = numeroDois;
dois = numeroUm;
resultNegativo = true;
break;
}
}
}
bool peso = false;
for(int i= size-1; i>=0;i--)
{
if(i >= size1 || i >= size2)
break;
if(um[i] == '.')
continue;
char atual1 = um[i];
char atual2 = dois[i];
int val1;
int val2;
if(isdigit(atual1))
val1 = atual1 - '0';
else
val1 = charToInt(atual1);
if(isdigit(atual2))
val2 = atual2 - '0';
else
val2 = charToInt(atual2);
if(val1 >= val2) // se o valor atual do primeiro for maior ou igual ao segundo
{
if(isdigit(um[i]))
um[i] = ((um[i] - '0') - val2) + '0';
else
{
int valor = charToInt(um[i]) - val2;
if(valor >= 10)
um[i] = intToChar(valor);
else
um[i] = valor + '0';
}
}
else
{
for(int n = i - 1; n >= 0; n--)
{
if(um[n] == '.')
continue;
if(isalpha(um[n]) || um[n] - '0' > 0)
{
int valAtual;
if(isdigit(um[n]))
valAtual = um[n] - '0';
else
valAtual = charToInt(um[n]);
valAtual--;
val1 += base;
val1 -= val2;
if(val1 >= 10)
um[i] = intToChar(val1);
else
um[i] = val1 + '0';
if(valAtual >= 10)
um[n] = intToChar(valAtual);
else
um[n] = valAtual + '0';
for(int x = n + 1; x < i; x++)
{
if(um[x] == '.')
continue;
int valAnterior;
if(isdigit(um[x]))
valAnterior = um[n] - '0';
else
valAnterior = charToInt(um[x]);
valAnterior--;
if(valAtual >= 10)
um[x] = intToChar(valAnterior);
else
um[x] = valAnterior + '0';
}
break;
}
else
continue;
}
}
}
string resultadoFormatado="";
int i=0;
while((char)um[i]==48)
{
i++;
}
if(i == um.length())
resultadoFormatado +="0";
for(;i<um.length();i++)
{
resultadoFormatado = resultadoFormatado + um[i];
}
if(resultNegativo)
resultadoFormatado = "-" + resultadoFormatado;
return resultadoFormatado;
}
int Subtrador::charToInt(char letter) // retorna a letra equivalente a um numero
{
return (int) (letter - 55);
}
char Subtrador::intToChar(int number) // retorna o numero equivalene a uma letra
{
return (char) (number + 55);
}
void Subtrador::ajeitarStrings(string numeroUm, string numeroDois)
{
primeiro = numeroUm;
segundo = numeroDois;
string primeiroAntes = "";
string primeiroDepois = "";
string segundoAntes = "";
string segundoDepois = "";
bool temVirgula1 = false;
bool temVirgula2 = false;
if((char)primeiro[0] == 45) // se o primeiro caractere for "-"
{
string aux = "";
for(int i = 1; i < primeiro.length(); i++)
{
aux += primeiro[i];
}
primeiro = aux;
primeiroNegativo = true;
}
if((char)segundo[0] == 45) // se o primeiro caractere for "-"
{
string aux = "";
for(int i = 1; i < segundo.length(); i++)
{
aux += segundo[i];
}
segundo = aux;
segundoNegativo = true;
}
for(int i = 0; i < primeiro.length(); i++)
{
if(primeiro[i] == '.' || primeiro[i] == ',')
{
temVirgula1 = true;
continue;
}
if(!temVirgula1)
primeiroAntes += primeiro[i];
else
primeiroDepois += primeiro[i];
}
for(int i = 0; i < segundo.length(); i++)
{
if(segundo[i] == '.' || segundo[i] == ',')
{
temVirgula2 = true;
continue;
}
if(!temVirgula2)
segundoAntes += segundo[i];
else
segundoDepois += segundo[i];
}
if(primeiroAntes.length() > segundoAntes.length())
{
while(primeiroAntes.length() > segundoAntes.length())
{
segundoAntes = "0" + segundoAntes;
}
}
else
{
while(segundoAntes.length() > primeiroAntes.length())
{
primeiroAntes = "0" + primeiroAntes;
}
}
if(primeiroDepois.length() > segundoDepois.length())
{
while(primeiroDepois.length() > segundoDepois.length())
{
segundoDepois += "0";
}
}
else
{
while(segundoDepois.length() > primeiroDepois.length())
{
primeiroDepois += "0";
}
}
if(temVirgula1)
primeiro = primeiroAntes + "." + primeiroDepois;
else
primeiro = primeiroAntes;
if(temVirgula2)
segundo = segundoAntes + "." + segundoDepois;
else
segundo = segundoAntes;
if(primeiro.length() > segundo.length())
{
segundo += ".";
while(segundo.length() < primeiro.length())
segundo += "0";
}
else if (segundo.length() > primeiro.length())
{
primeiro += ".";
while(primeiro.length() < segundo.length())
primeiro += "0";
}
}
| [
"vitormugnol10@gmail.com"
] | vitormugnol10@gmail.com |
65106d9df83fc7d7af5abf6bf26218f4c16a6cc7 | 91a882547e393d4c4946a6c2c99186b5f72122dd | /Source/XPSP1/NT/multimedia/directx/dplay/dvoice/dxvoice/dvsetupi.cpp | e2ab0635fcd89d9044bbc3d58ae5df64759a9e3b | [] | no_license | IAmAnubhavSaini/cryptoAlgorithm-nt5src | 94f9b46f101b983954ac6e453d0cf8d02aa76fc7 | d9e1cdeec650b9d6d3ce63f9f0abe50dabfaf9e2 | refs/heads/master | 2023-09-02T10:14:14.795579 | 2021-11-20T13:47:06 | 2021-11-20T13:47:06 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,234 | cpp | /*==========================================================================
*
* Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
*
* File: dvsetupi.cpp
* Content: Implementation of class for DirectXVoice Setup utility functions
*
* History:
* Date By Reason
* ==== == ======
* 09/02/99 pnewson Created it
* 11/04/99 pnewson Bug #115297 - removed unused members of Setup interface
* - added HWND to check audio setup
* 05/03/2000 rodtoll Bug #33640 - CheckAudioSetup takes GUID * instead of const GUID *
*
***************************************************************************/
#include "dxvoicepch.h"
// CDirectVoiceSetup
//
// This class represents the IDirectXVoiceSetup interface.
//
// The class is thread safe except for construction and
// destruction.
//
CDirectVoiceSetup::CDirectVoiceSetup( DIRECTVOICESETUPOBJECT *lpObject )
{
return;
}
CDirectVoiceSetup::~CDirectVoiceSetup()
{
return;
}
HRESULT CDirectVoiceSetup::CheckAudioSetup(
const GUID * lpguidRenderDevice,
const GUID * lpguidCaptureDevice,
HWND hwndParent,
DWORD dwFlags)
{
return SupervisorCheckAudioSetup(
lpguidRenderDevice,
lpguidCaptureDevice,
hwndParent,
dwFlags);
}
| [
"support@cryptoalgo.cf"
] | support@cryptoalgo.cf |
71281dd347f8feb15f300ea3246a9f691762a5c7 | dd80a584130ef1a0333429ba76c1cee0eb40df73 | /external/chromium_org/chrome/browser/extensions/script_badge_controller_unittest.cc | 0eab0f5d79d4fd338b0d8aa94d44b3f7e68d182e | [
"MIT",
"BSD-3-Clause"
] | permissive | karunmatharu/Android-4.4-Pay-by-Data | 466f4e169ede13c5835424c78e8c30ce58f885c1 | fcb778e92d4aad525ef7a995660580f948d40bc9 | refs/heads/master | 2021-03-24T13:33:01.721868 | 2017-02-18T17:48:49 | 2017-02-18T17:48:49 | 81,847,777 | 0 | 2 | MIT | 2020-03-09T00:02:12 | 2017-02-13T16:47:00 | null | UTF-8 | C++ | false | false | 10,218 | cc | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <string>
#include "base/command_line.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/extension_action_manager.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/script_badge_controller.h"
#include "chrome/browser/extensions/tab_helper.h"
#include "chrome/browser/extensions/test_extension_system.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/extensions/features/feature_channel.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/test_browser_thread.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/feature_switch.h"
#include "extensions/common/value_builder.h"
#include "testing/gmock/include/gmock/gmock.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chrome/browser/chromeos/settings/device_settings_service.h"
#endif
namespace extensions {
namespace {
class ScriptBadgeControllerTest : public ChromeRenderViewHostTestHarness {
public:
ScriptBadgeControllerTest()
: feature_override_(FeatureSwitch::script_badges(), true),
current_channel_(chrome::VersionInfo::CHANNEL_DEV) {}
virtual void SetUp() OVERRIDE {
// Note that this sets a PageActionController into the
// extensions::TabHelper's location_bar_controller field. Do
// not use that for testing.
ChromeRenderViewHostTestHarness::SetUp();
#if defined OS_CHROMEOS
test_user_manager_.reset(new chromeos::ScopedTestUserManager());
#endif
Profile* profile =
Profile::FromBrowserContext(web_contents()->GetBrowserContext());
TestExtensionSystem* extension_system =
static_cast<TestExtensionSystem*>(ExtensionSystem::Get(profile));
// Create an ExtensionService so the ScriptBadgeController can find its
// extensions.
CommandLine command_line(CommandLine::NO_PROGRAM);
extension_service_ = extension_system->CreateExtensionService(
&command_line, base::FilePath(), false);
TabHelper::CreateForWebContents(web_contents());
script_badge_controller_ = static_cast<ScriptBadgeController*>(
TabHelper::FromWebContents(web_contents())->location_bar_controller());
}
virtual void TearDown() OVERRIDE {
#if defined OS_CHROMEOS
test_user_manager_.reset();
#endif
ChromeRenderViewHostTestHarness::TearDown();
}
protected:
// Creates a test extension and adds it to |extension_service_|.
scoped_refptr<const Extension> AddTestExtension() {
scoped_refptr<const Extension> extension = ExtensionBuilder()
.SetManifest(DictionaryBuilder()
.Set("name", "Extension with page action")
.Set("version", "1.0.0")
.Set("manifest_version", 2)
.Set("permissions", ListBuilder()
.Append("tabs"))
.Set("page_action", DictionaryBuilder()
.Set("default_title", "Hello")))
.Build();
extension_service_->AddExtension(extension.get());
return extension;
}
ExtensionAction* GetScriptBadge(const Extension& extension) {
return ExtensionActionManager::Get(profile())->GetScriptBadge(extension);
}
ExtensionService* extension_service_;
ScriptBadgeController* script_badge_controller_;
private:
FeatureSwitch::ScopedOverride feature_override_;
ScopedCurrentChannel current_channel_;
#if defined OS_CHROMEOS
chromeos::ScopedTestDeviceSettingsService test_device_settings_service_;
chromeos::ScopedTestCrosSettings test_cros_settings_;
scoped_ptr<chromeos::ScopedTestUserManager> test_user_manager_;
#endif
};
struct CountingNotificationObserver : public content::NotificationObserver {
CountingNotificationObserver() : events(0) {}
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE {
events++;
}
int events;
};
TEST_F(ScriptBadgeControllerTest, ExecutionMakesBadgeVisible) {
content::NotificationRegistrar notification_registrar;
EXPECT_THAT(script_badge_controller_->GetCurrentActions(),
testing::ElementsAre());
scoped_refptr<const Extension> extension = AddTestExtension();
// Establish a page id.
NavigateAndCommit(GURL("http://www.google.com"));
CountingNotificationObserver location_bar_updated;
Profile* profile =
Profile::FromBrowserContext(web_contents()->GetBrowserContext());
notification_registrar.Add(
&location_bar_updated,
chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED,
content::Source<Profile>(profile));
// Initially, no script badges.
EXPECT_THAT(script_badge_controller_->GetCurrentActions(),
testing::ElementsAre());
TabHelper::ScriptExecutionObserver::ExecutingScriptsMap id_map;
id_map[extension->id()] = std::set<std::string>();
script_badge_controller_->OnScriptsExecuted(
web_contents(),
id_map,
web_contents()->GetController().GetVisibleEntry()->GetPageID(),
GURL(std::string()));
EXPECT_THAT(script_badge_controller_->GetCurrentActions(),
testing::ElementsAre(GetScriptBadge(*extension.get())));
EXPECT_THAT(location_bar_updated.events, testing::Gt(0));
};
TEST_F(ScriptBadgeControllerTest, FragmentNavigation) {
scoped_refptr<const Extension> extension = AddTestExtension();
Profile* profile =
Profile::FromBrowserContext(web_contents()->GetBrowserContext());
// Establish a page id.
NavigateAndCommit(GURL("http://www.google.com"));
// Run script. Should be a notification and a script badge.
{
content::NotificationRegistrar notification_registrar;
CountingNotificationObserver location_bar_updated;
notification_registrar.Add(
&location_bar_updated,
chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED,
content::Source<Profile>(profile));
TabHelper::ScriptExecutionObserver::ExecutingScriptsMap id_map;
id_map[extension->id()] = std::set<std::string>();
script_badge_controller_->OnScriptsExecuted(
web_contents(),
id_map,
web_contents()->GetController().GetVisibleEntry()->GetPageID(),
GURL(std::string()));
EXPECT_THAT(script_badge_controller_->GetCurrentActions(),
testing::ElementsAre(GetScriptBadge(*extension.get())));
EXPECT_EQ(1, location_bar_updated.events);
}
// Navigate to a hash fragment. Shouldn't change.
{
content::NotificationRegistrar notification_registrar;
CountingNotificationObserver location_bar_updated;
notification_registrar.Add(
&location_bar_updated,
chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED,
content::Source<Profile>(profile));
NavigateAndCommit(GURL("http://www.google.com#hash"));
EXPECT_THAT(script_badge_controller_->GetCurrentActions(),
testing::ElementsAre(GetScriptBadge(*extension.get())));
EXPECT_EQ(0, location_bar_updated.events);
}
// Refreshing the page should reset the badges.
{
content::NotificationRegistrar notification_registrar;
CountingNotificationObserver location_bar_updated;
notification_registrar.Add(
&location_bar_updated,
chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED,
content::Source<Profile>(profile));
Reload();
EXPECT_THAT(script_badge_controller_->GetCurrentActions(),
testing::ElementsAre());
}
}
TEST_F(ScriptBadgeControllerTest, GetAttentionMakesBadgeVisible) {
content::NotificationRegistrar notification_registrar;
scoped_refptr<const Extension> extension =
ExtensionBuilder()
.SetManifest(DictionaryBuilder()
.Set("name", "Extension")
.Set("version", "1.0.0")
.Set("manifest_version", 2)
.Set("permissions", ListBuilder()
.Append("tabs")))
.Build();
extension_service_->AddExtension(extension.get());
// Establish a page id.
NavigateAndCommit(GURL("http://www.google.com"));
CountingNotificationObserver initial_badge_display;
Profile* profile =
Profile::FromBrowserContext(web_contents()->GetBrowserContext());
notification_registrar.Add(
&initial_badge_display,
chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED,
content::Source<Profile>(profile));
// Initially, no script badges.
EXPECT_THAT(script_badge_controller_->GetCurrentActions(),
testing::ElementsAre());
// Getting attention the first time should display the badge.
script_badge_controller_->GetAttentionFor(extension->id());
EXPECT_THAT(script_badge_controller_->GetCurrentActions(),
testing::ElementsAre(GetScriptBadge(*extension.get())));
EXPECT_THAT(initial_badge_display.events, testing::Gt(0));
CountingNotificationObserver subsequent_get_attention_call;
notification_registrar.Add(
&subsequent_get_attention_call,
chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED,
content::Source<Profile>(profile));
// Getting attention a second time should have no effect.
script_badge_controller_->GetAttentionFor(extension->id());
EXPECT_THAT(script_badge_controller_->GetCurrentActions(),
testing::ElementsAre(GetScriptBadge(*extension.get())));
EXPECT_EQ(0, subsequent_get_attention_call.events);
};
} // namespace
} // namespace extensions
| [
"karun.matharu@gmail.com"
] | karun.matharu@gmail.com |
85d39900e81c844799b8c94055c1c2ba40e038da | 309975d60e30260f2e02d11e71eaaf6e08b93659 | /Sources/Internal/Render/RHI/Common/Parser/sl_Common.cpp | e86b145cdd3bd80717c7921ae578e89a13f413c5 | [] | permissive | BlitzModder/dava.engine | e83b038a9d24b37c00b095e83ffdfd8cd497823c | 0c7a16e627fc0d12309250d6e5e207333b35361e | refs/heads/development | 2023-03-15T12:30:32.342501 | 2018-02-19T11:09:02 | 2018-02-19T11:09:02 | 122,161,150 | 4 | 3 | BSD-3-Clause | 2018-02-20T06:00:07 | 2018-02-20T06:00:07 | null | UTF-8 | C++ | false | false | 2,169 | cpp |
#include "sl_Common.h"
#include <stdio.h> // vsnprintf
#include <string.h> // strcmp, strcasecmp
#include <stdlib.h> // strtod, strtol
#include <cstdarg> // va_start, va_end
namespace sl
{
DAVA::int32 String_PrintfArgList(char* buffer, int size, const char* format, va_list args)
{
va_list tmp;
va_copy(tmp, args);
#if _MSC_VER >= 1400
int n = vsnprintf_s(buffer, size, _TRUNCATE, format, tmp);
#else
int n = vsnprintf(buffer, size, format, tmp);
#endif
va_end(tmp);
if (n < 0 || n > size)
return -1;
return n;
}
DAVA::int32 String_FormatFloat(char* buffer, int size, float value)
{
return Snprintf(buffer, size, "%f", value);
}
bool String_Equal(const char* a, const char* b)
{
if (a == b)
return true;
if (a == NULL || b == NULL)
return false;
return strcmp(a, b) == 0;
}
bool String_EqualNoCase(const char* a, const char* b)
{
if (a == b)
return true;
if (a == NULL || b == NULL)
return false;
#if _MSC_VER
return _stricmp(a, b) == 0;
#else
return strcasecmp(a, b) == 0;
#endif
}
double String_ToDouble(const char* str, char** endptr)
{
return strtod(str, endptr);
}
int String_ToInteger(const char* str, char** endptr)
{
return strtol(str, endptr, 10);
}
int String_ToIntegerHex(const char* str, char** endptr)
{
return strtol(str, endptr, 16);
}
StringPool::StringPool(Allocator* allocator)
: stringArray(allocator)
{
}
StringPool::~StringPool()
{
for (int i = 0; i < stringArray.GetSize(); i++)
{
::free(stringArray[i]);
}
}
const char* StringPool::AddString(const char* string)
{
for (int i = 0; i < stringArray.GetSize(); i++)
{
if (String_Equal(stringArray[i], string))
return stringArray[i];
}
#if _MSC_VER
char* dup = _strdup(string);
#else
char* dup = strdup(string);
#endif
stringArray.PushBack(dup);
return dup;
}
bool StringPool::GetContainsString(const char* string) const
{
for (int i = 0; i < stringArray.GetSize(); i++)
{
if (String_Equal(stringArray[i], string))
return true;
}
return false;
}
} // namespace sl
| [
"m_molokovskih@wargaming.net"
] | m_molokovskih@wargaming.net |
543366bf03ebe0021821676db3164217f77a4585 | 351b592576d3d84687ca91549cba9051f50b707d | /packets/play/CBPlayerInfo.h | fe68a0529fed74cc1e164bb2b5d0f605ab74f078 | [
"MIT"
] | permissive | WorkingRobot/CMine | f09f450071a21699339a4584e3c4f5d30e55c92c | c4d8b3988487c7dc480b0f252cba1eab53555bb7 | refs/heads/master | 2022-06-18T15:51:49.586515 | 2020-04-29T02:33:00 | 2020-04-29T02:33:00 | 259,745,104 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,360 | h | #pragma once
#include "../types/SocketPrimitives.h"
struct CBPlayerInfo {
static const int Id = 0x34;
struct Property {
SocketString Name;
SocketString Value;
std::optional<SocketString> Signature;
};
struct Player {
SocketGUID Uuid;
// 0: add player
SocketString Name;
std::vector<Property> Properties;
SocketVarInt Gamemode;
SocketVarInt Ping;
std::optional<SocketChat> DisplayName;
// 1: update gamemode
// Gamemode
// 2: update latency
// Ping
// 3: update display name
// DisplayName
// 4: remove player
// no fields
};
SocketVarInt Action; // enum
std::vector<Player> Players;
friend SocketOStream& operator<<(SocketOStream& sock, const CBPlayerInfo& out) {
sock << out.Action << SocketVarInt(out.Players.size());
for (auto& player : out.Players) {
sock << player.Uuid;
switch (out.Action)
{
case 0:
sock
<< player.Name
<< SocketVarInt(player.Properties.size());
for (auto& prop : player.Properties) {
sock
<< prop.Name
<< prop.Value
<< SocketBool(prop.Signature.has_value());
if (prop.Signature.has_value()) {
sock << prop.Signature.value();
}
}
sock
<< player.Gamemode
<< player.Ping
<< SocketBool(player.DisplayName.has_value());
if (player.DisplayName.has_value()) {
sock << player.DisplayName.value();
}
break;
case 1:
sock << player.Gamemode;
break;
case 2:
sock << player.Ping;
break;
case 3:
sock << SocketBool(player.DisplayName.has_value());
if (player.DisplayName.has_value()) {
sock << player.DisplayName.value();
}
break;
case 4:
break;
}
}
return sock;
}
}; | [
"aleks.margarian1@gmail.com"
] | aleks.margarian1@gmail.com |
21ad837f97c8e3a134922159dd1f7dfa8e0828b5 | 8777932e80b579c9081eaf2a20a65b19ff725c2b | /System.h | 7c69ee27955fe342ee595997b2f610b76d26ebcf | [] | no_license | dunk111/projekt_zespolowy | 1591930b69e0c3bb997f658c79ee1023c7ec3efe | 056ded8cfb1c2719c7099a37bcdad4471b234948 | refs/heads/master | 2021-01-10T12:21:21.074410 | 2016-01-24T08:55:44 | 2016-01-24T08:55:44 | 44,260,870 | 0 | 3 | null | 2016-01-09T12:19:17 | 2015-10-14T16:23:54 | null | UTF-8 | C++ | false | false | 18 | h | class System {
};
| [
"martyna.pawlowska@opoczta.pl"
] | martyna.pawlowska@opoczta.pl |
1374806a389951ec5274dc2fadf03098395ec13f | bfcddcc7cca87f51a067e82d00b596659b6c3f6d | /CSES/2 Sorting and Searching/4 - 1091 - Concert Tickets.cpp | ea52cd5c263ffb47d566a37a3b72be5c81d14974 | [] | no_license | IshanManchanda/competitive-cpp | 1ffb88b19abbbff6643e40706c5b13b166422255 | d423fec6641e4525ce52c5a49517269497276607 | refs/heads/master | 2023-09-04T11:02:31.265177 | 2023-08-31T17:29:27 | 2023-08-31T17:29:27 | 184,057,901 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,905 | cpp | //#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx,avx2,fma,tune=native")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define PB emplace_back
#define MP make_pair
#define MT make_tuple
#define REP(i, a, b) for (ll i = (a); i < (b); ++i)
#define RREP(i, a, b) for (ll i = (a); i > (b); --i)
#define cinai(a, n) REP(ii, 0, (n)) cin >> (a)[ii];
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define FILE_IN freopen("input.txt", "r", stdin);
#define FILE_OUT freopen("output.txt", "w", stdout);
#define TESTCASES ll tt; cin >> tt; while (tt--)
#define TESTCASES1 ll tt; cin >> tt; REP(ttt, 1, tt + 1)
#define CASEOUT cout << "Case #" << ttt << ": "
#define NEG_INF (-LLONG_MAX)
#define FLOAT_EQ(a, b) (abs((a) - (b)) < 1e-9)
#define MOD (1'000'000'007)
//#define MOD_SUM(a, b) ((a) + (b) >= MOD) ? ((a) + (b) - MOD) : ((a) + (b))
#define NEWL "\n";
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree<int, null_type, less<int>, rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;
/* find_by_order(k) and order_of_key(x) */
typedef long long ll;
//typedef __int128_t lll;
//typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef tuple<int, int, int> ti;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vi> vvl;
int main() {
FAST_IO
// FILE_IN
// FILE_OUT
// TESTCASES {
int n, m, x;
cin >> n >> m;
multiset<int> s;
int c[m];
REP(i, 0, n) {
cin >> x;
s.insert(x);
}
cinai(c, m);
for (auto p : c) {
auto idx = s.upper_bound(p);
if (idx == s.begin()) {
cout << "-1\n";
continue;
}
idx--;
cout << *idx << "\n";
s.erase(idx);
}
// }
cout << flush;
}
| [
"ishanmanchanda70@gmail.com"
] | ishanmanchanda70@gmail.com |
a2a4860ff45af64929362aab2a1a1d7500803179 | 0b5a0b18704cb94cf7d987f0a23f942391860ee1 | /tests/cpp/dcWebservice/HandlerTests.cpp | 472f925c6b0730f4c8ebace75d60d6d5e77a0f16 | [
"BSD-2-Clause"
] | permissive | kaust-vislab/DisplayCluster | ea14764c9581d2ab3d9f6f982f18720bd1565711 | a87057e6992ec016ed82734a7e9cda8b4634ff5a | refs/heads/master | 2022-10-21T05:16:58.379552 | 2015-10-26T07:23:47 | 2015-10-26T07:23:47 | 12,727,480 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,671 | cpp | /*********************************************************************/
/* Copyright (c) 2014, EPFL/Blue Brain Project */
/* Julio Delgado <julio.delgadomangas@epfl.ch> */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``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 UNIVERSITY OF TEXAS AT */
/* AUSTIN 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. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#define BOOST_TEST_MODULE DefaultHandlerTests
#include <boost/test/unit_test.hpp>
#include "dcWebservice/DefaultHandler.h"
#include "dcWebservice/Response.h"
#include "dcWebservice/Request.h"
namespace ut = boost::unit_test;
/*
* Mock handler that always returns an OK resonse, regardless of the request
*/
class MockHandler : public dcWebservice::Handler
{
public:
dcWebservice::ConstResponsePtr handle(const dcWebservice::Request&) const override
{
return dcWebservice::Response::OK();
}
};
BOOST_AUTO_TEST_CASE( testConstructorWithoutParameters )
{
dcWebservice::DefaultHandler handler;
dcWebservice::Request request;
BOOST_CHECK_EQUAL(dcWebservice::Response::NotFound(), handler.handle(request));
}
BOOST_AUTO_TEST_CASE( testConstructorWithParameters )
{
MockHandler mock;
dcWebservice::Request request;
BOOST_CHECK_EQUAL(dcWebservice::Response::OK(), mock.handle(request));
}
| [
"raphael.dumusc@epfl.ch"
] | raphael.dumusc@epfl.ch |
2bbe3562bf0e4c3759bbdd2513feffc1bf50aad7 | e3411990a5c252f439b7d1b771e9204eeb71b293 | /EGC_Tema4_Animatii_2D_Cu_Sprite-uri/Source/Laboratoare/Laborator9/Animation.cpp | 2184e1887a7a61f984d327399ddeae4b270d0cde | [] | no_license | GroapaMihai/CTI_Anul_3_Sem_1 | b517978d1b3789d756f2367e0311edff13f2046e | c84753707d3d6981cbd7fc13a3b41a536547a124 | refs/heads/master | 2021-01-01T17:38:27.457677 | 2017-07-24T06:54:45 | 2017-07-24T06:54:45 | 98,116,367 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,249 | cpp | #include <iostream>
#include <Core/Engine.h>
#include "Animation.h"
Animation::Animation(std::string name)
{
this->name = name;
}
std::string Animation::getName()
{
return name;
}
void Animation::addFrame(Mesh* frame)
{
frames.push_back(frame);
}
Mesh* Animation::getFrameAt(int i)
{
if (i >= frames.size() || i < 0)
return frames[0];
return frames[i];
}
int Animation::getNumberOfFrames()
{
return frames.size();
}
void Animation::addTextureWidth(double textureWidth)
{
totalTextureWidth += textureWidth;
frameWidth.push_back(textureWidth);
}
void Animation::computeAverageTextureWidth()
{
averageTexturewidth = totalTextureWidth / frames.size();
}
void Animation::computeScaleFactors()
{
double fraction;
for (int i = 0; i < frames.size(); i++) {
fraction = frameWidth[i] / averageTexturewidth;
if (fraction < 1)
scaleFactor.push_back(fraction);
else
scaleFactor.push_back(1);
}
}
double Animation::getScaleFactorAt(int i)
{
if (i >= frames.size() || i < 0)
return 1;
return scaleFactor[i];
}
void Animation::setFramePeriod()
{
int numberOfFrames = getNumberOfFrames();
if (numberOfFrames > 6)
framePeriod = 15;
else
framePeriod = 20;
}
int Animation::getFramePeriod()
{
return framePeriod;
}
| [
"gmihai9549@gmail.com"
] | gmihai9549@gmail.com |
ad7c28ddbd0f6a4bdb36b9e7956e98a3fb872592 | 083100943aa21e05d2eb0ad745349331dd35239a | /aws-cpp-sdk-autoscaling/include/aws/autoscaling/model/NotificationConfiguration.h | e99c94160ddeb1f0d5fc3f075039f0de7fd4ecdd | [
"JSON",
"MIT",
"Apache-2.0"
] | permissive | bmildner/aws-sdk-cpp | d853faf39ab001b2878de57aa7ba132579d1dcd2 | 983be395fdff4ec944b3bcfcd6ead6b4510b2991 | refs/heads/master | 2021-01-15T16:52:31.496867 | 2015-09-10T06:57:18 | 2015-09-10T06:57:18 | 41,954,994 | 1 | 0 | null | 2015-09-05T08:57:22 | 2015-09-05T08:57:22 | null | UTF-8 | C++ | false | false | 8,139 | h | /*
* Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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 <aws/autoscaling/AutoScaling_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSStreamFwd.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
namespace Utils
{
namespace Xml
{
class XmlNode;
} // namespace Xml
} // namespace Utils
namespace AutoScaling
{
namespace Model
{
/*
<p>Describes a notification.</p>
*/
class AWS_AUTOSCALING_API NotificationConfiguration
{
public:
NotificationConfiguration();
NotificationConfiguration(const Aws::Utils::Xml::XmlNode& xmlNode);
NotificationConfiguration& operator=(const Aws::Utils::Xml::XmlNode& xmlNode);
void OutputToStream(Aws::OStream& ostream, const char* location, unsigned index, const char* locationValue) const;
void OutputToStream(Aws::OStream& oStream, const char* location) const;
/*
<p>The name of the group.</p>
*/
inline const Aws::String& GetAutoScalingGroupName() const{ return m_autoScalingGroupName; }
/*
<p>The name of the group.</p>
*/
inline void SetAutoScalingGroupName(const Aws::String& value) { m_autoScalingGroupNameHasBeenSet = true; m_autoScalingGroupName = value; }
/*
<p>The name of the group.</p>
*/
inline void SetAutoScalingGroupName(Aws::String&& value) { m_autoScalingGroupNameHasBeenSet = true; m_autoScalingGroupName = value; }
/*
<p>The name of the group.</p>
*/
inline void SetAutoScalingGroupName(const char* value) { m_autoScalingGroupNameHasBeenSet = true; m_autoScalingGroupName.assign(value); }
/*
<p>The name of the group.</p>
*/
inline NotificationConfiguration& WithAutoScalingGroupName(const Aws::String& value) { SetAutoScalingGroupName(value); return *this;}
/*
<p>The name of the group.</p>
*/
inline NotificationConfiguration& WithAutoScalingGroupName(Aws::String&& value) { SetAutoScalingGroupName(value); return *this;}
/*
<p>The name of the group.</p>
*/
inline NotificationConfiguration& WithAutoScalingGroupName(const char* value) { SetAutoScalingGroupName(value); return *this;}
/*
<p>The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (SNS) topic.</p>
*/
inline const Aws::String& GetTopicARN() const{ return m_topicARN; }
/*
<p>The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (SNS) topic.</p>
*/
inline void SetTopicARN(const Aws::String& value) { m_topicARNHasBeenSet = true; m_topicARN = value; }
/*
<p>The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (SNS) topic.</p>
*/
inline void SetTopicARN(Aws::String&& value) { m_topicARNHasBeenSet = true; m_topicARN = value; }
/*
<p>The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (SNS) topic.</p>
*/
inline void SetTopicARN(const char* value) { m_topicARNHasBeenSet = true; m_topicARN.assign(value); }
/*
<p>The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (SNS) topic.</p>
*/
inline NotificationConfiguration& WithTopicARN(const Aws::String& value) { SetTopicARN(value); return *this;}
/*
<p>The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (SNS) topic.</p>
*/
inline NotificationConfiguration& WithTopicARN(Aws::String&& value) { SetTopicARN(value); return *this;}
/*
<p>The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (SNS) topic.</p>
*/
inline NotificationConfiguration& WithTopicARN(const char* value) { SetTopicARN(value); return *this;}
/*
<p>The types of events for an action to start.</p> <ul> <li><p><code>autoscaling:EC2_INSTANCE_LAUNCH</code></p></li> <li><p><code>autoscaling:EC2_INSTANCE_LAUNCH_ERROR</code></p></li> <li><p><code>autoscaling:EC2_INSTANCE_TERMINATE</code></p></li> <li><p><code>autoscaling:EC2_INSTANCE_TERMINATE_ERROR</code></p></li> <li><p><code>autoscaling:TEST_NOTIFICATION</code></p></li> </ul>
*/
inline const Aws::String& GetNotificationType() const{ return m_notificationType; }
/*
<p>The types of events for an action to start.</p> <ul> <li><p><code>autoscaling:EC2_INSTANCE_LAUNCH</code></p></li> <li><p><code>autoscaling:EC2_INSTANCE_LAUNCH_ERROR</code></p></li> <li><p><code>autoscaling:EC2_INSTANCE_TERMINATE</code></p></li> <li><p><code>autoscaling:EC2_INSTANCE_TERMINATE_ERROR</code></p></li> <li><p><code>autoscaling:TEST_NOTIFICATION</code></p></li> </ul>
*/
inline void SetNotificationType(const Aws::String& value) { m_notificationTypeHasBeenSet = true; m_notificationType = value; }
/*
<p>The types of events for an action to start.</p> <ul> <li><p><code>autoscaling:EC2_INSTANCE_LAUNCH</code></p></li> <li><p><code>autoscaling:EC2_INSTANCE_LAUNCH_ERROR</code></p></li> <li><p><code>autoscaling:EC2_INSTANCE_TERMINATE</code></p></li> <li><p><code>autoscaling:EC2_INSTANCE_TERMINATE_ERROR</code></p></li> <li><p><code>autoscaling:TEST_NOTIFICATION</code></p></li> </ul>
*/
inline void SetNotificationType(Aws::String&& value) { m_notificationTypeHasBeenSet = true; m_notificationType = value; }
/*
<p>The types of events for an action to start.</p> <ul> <li><p><code>autoscaling:EC2_INSTANCE_LAUNCH</code></p></li> <li><p><code>autoscaling:EC2_INSTANCE_LAUNCH_ERROR</code></p></li> <li><p><code>autoscaling:EC2_INSTANCE_TERMINATE</code></p></li> <li><p><code>autoscaling:EC2_INSTANCE_TERMINATE_ERROR</code></p></li> <li><p><code>autoscaling:TEST_NOTIFICATION</code></p></li> </ul>
*/
inline void SetNotificationType(const char* value) { m_notificationTypeHasBeenSet = true; m_notificationType.assign(value); }
/*
<p>The types of events for an action to start.</p> <ul> <li><p><code>autoscaling:EC2_INSTANCE_LAUNCH</code></p></li> <li><p><code>autoscaling:EC2_INSTANCE_LAUNCH_ERROR</code></p></li> <li><p><code>autoscaling:EC2_INSTANCE_TERMINATE</code></p></li> <li><p><code>autoscaling:EC2_INSTANCE_TERMINATE_ERROR</code></p></li> <li><p><code>autoscaling:TEST_NOTIFICATION</code></p></li> </ul>
*/
inline NotificationConfiguration& WithNotificationType(const Aws::String& value) { SetNotificationType(value); return *this;}
/*
<p>The types of events for an action to start.</p> <ul> <li><p><code>autoscaling:EC2_INSTANCE_LAUNCH</code></p></li> <li><p><code>autoscaling:EC2_INSTANCE_LAUNCH_ERROR</code></p></li> <li><p><code>autoscaling:EC2_INSTANCE_TERMINATE</code></p></li> <li><p><code>autoscaling:EC2_INSTANCE_TERMINATE_ERROR</code></p></li> <li><p><code>autoscaling:TEST_NOTIFICATION</code></p></li> </ul>
*/
inline NotificationConfiguration& WithNotificationType(Aws::String&& value) { SetNotificationType(value); return *this;}
/*
<p>The types of events for an action to start.</p> <ul> <li><p><code>autoscaling:EC2_INSTANCE_LAUNCH</code></p></li> <li><p><code>autoscaling:EC2_INSTANCE_LAUNCH_ERROR</code></p></li> <li><p><code>autoscaling:EC2_INSTANCE_TERMINATE</code></p></li> <li><p><code>autoscaling:EC2_INSTANCE_TERMINATE_ERROR</code></p></li> <li><p><code>autoscaling:TEST_NOTIFICATION</code></p></li> </ul>
*/
inline NotificationConfiguration& WithNotificationType(const char* value) { SetNotificationType(value); return *this;}
private:
Aws::String m_autoScalingGroupName;
bool m_autoScalingGroupNameHasBeenSet;
Aws::String m_topicARN;
bool m_topicARNHasBeenSet;
Aws::String m_notificationType;
bool m_notificationTypeHasBeenSet;
};
} // namespace Model
} // namespace AutoScaling
} // namespace Aws
| [
"henso@amazon.com"
] | henso@amazon.com |
056880af7809b017d7aa7579b01028b8c213dbad | d7e33511c2d5f9a115b34fdfae3d22d3d8d3a41b | /libkeye/keye/htio/websocketpp/roles/client_endpoint.hpp | 7e1c796b5bee410adf4a8016905628000e57655a | [] | no_license | jjuri-socialmining/public | 7c4f2351a346d4ddb92efe1c46f8819be3e4754f | 7c759aa9fa12ffdc80d0aeb2e2d854c39dcf4980 | refs/heads/master | 2022-03-04T05:14:32.543235 | 2016-12-27T04:22:44 | 2016-12-27T04:22:44 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,663 | hpp | /*
* Copyright (c) 2014, Peter Thorson. 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 WebSocket++ 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 PETER THORSON 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 WEBSOCKETPP_CLIENT_ENDPOINT_HPP
#define WEBSOCKETPP_CLIENT_ENDPOINT_HPP
#include <websocketpp/endpoint.hpp>
#include <websocketpp/uri.hpp>
#include <websocketpp/logger/levels.hpp>
#include <websocketpp/common/system_error.hpp>
#include <string>
namespace websocketpp {
/// Client endpoint role based on the given config
/**
*
*/
template <typename config>
class client : public endpoint<connection<config>,config> {
public:
/// Type of this endpoint
typedef client<config> type;
/// Type of the endpoint concurrency component
typedef typename config::concurrency_type concurrency_type;
/// Type of the endpoint transport component
typedef typename config::transport_type transport_type;
/// Type of the connections this server will create
typedef connection<config> connection_type;
/// Type of a shared pointer to the connections this server will create
typedef typename connection_type::ptr connection_ptr;
/// Type of the connection transport component
typedef typename transport_type::transport_con_type transport_con_type;
/// Type of a shared pointer to the connection transport component
typedef typename transport_con_type::ptr transport_con_ptr;
/// Type of the endpoint component of this server
typedef endpoint<connection_type,config> endpoint_type;
friend class connection<config>;
explicit client() : endpoint_type(false)
{
endpoint_type::m_alog.write(log::alevel::devel, "client constructor");
}
/// Create and initialize a new connection
/**
* The connection will be initialized and ready to begin. Call its start()
* method to begin the processing loop.
*
* Note: The connection must either be started or terminated using
* connection::terminate in order to avoid memory leaks.
*
* @return A pointer to the new connection.
*/
connection_ptr get_connection(){
return endpoint_type::create_connection();
}
/// Get a new connection
/**
* Creates and returns a pointer to a new connection to the given URI
* suitable for passing to connect(connection_ptr). This method allows
* applying connection specific settings before performing the opening
* handshake.
*
* @param [in] location URI to open the connection to as a uri_ptr
* @param [out] ec An status code indicating failure reasons, if any
*
* @return A connection_ptr to the new connection
*/
connection_ptr get_connection(uri_ptr location, lib::error_code & ec) {
if (location->get_secure() && !transport_type::is_secure()) {
ec = error::make_error_code(error::endpoint_not_secure);
return connection_ptr();
}
connection_ptr con = endpoint_type::create_connection();
if (!con) {
ec = error::make_error_code(error::con_creation_failed);
return con;
}
con->set_uri(location);
ec = lib::error_code();
return con;
}
/// Get a new connection (string version)
/**
* Creates and returns a pointer to a new connection to the given URI
* suitable for passing to connect(connection_ptr). This overload allows
* default construction of the uri_ptr from a standard string.
*
* @param [in] u URI to open the connection to as a string
* @param [out] ec An status code indicating failure reasons, if any
*
* @return A connection_ptr to the new connection
*/
connection_ptr get_connection(std::string const & u, lib::error_code & ec) {
uri_ptr location = lib::make_shared<uri>(u);
if (!location->get_valid()) {
ec = error::make_error_code(error::invalid_uri);
return connection_ptr();
}
return get_connection(location, ec);
}
/// Begin the connection process for the given connection
/**
* Initiates the opening connection handshake for connection con. Exact
* behavior depends on the underlying transport policy.
*
* @param con The connection to connect
*
* @return The pointer to the connection originally passed in.
*/
connection_ptr connect(connection_ptr con) {
// Ask transport to perform a connection
transport_type::async_connect(
lib::static_pointer_cast<transport_con_type>(con),
con->get_uri(),
lib::bind(
&type::handle_connect,
this,
con,
lib::placeholders::_1
)
);
return con;
}
private:
// handle_connect
void handle_connect(connection_ptr con, lib::error_code const & ec) {
if (ec) {
con->terminate(ec);
endpoint_type::m_elog.write(log::elevel::rerror,
"handle_connect error: "+ec.message());
} else {
endpoint_type::m_alog.write(log::alevel::connect,
"Successful connection");
con->start();
}
}
};
} // namespace websocketpp
#endif //WEBSOCKETPP_CLIENT_ENDPOINT_HPP
| [
"keyeleo@163.com"
] | keyeleo@163.com |
9e06959e955161e68bd9b046ea6988ed6ad5a4ad | 1122c5c8740c81468388ab236ff84876e947ae31 | /Lab_04/main.cpp | 87a9edb2dbea116e871d21c07202c6fa54d5aa20 | [] | no_license | hubert-mazur/Cpp-2018-3rd-sem- | 15f7fb66822dd19ae3d5629a52a66772300673d6 | 45d5c494fa2d36cbc888aeb7432e99ab6c97e535 | refs/heads/master | 2020-04-26T00:15:05.574721 | 2019-02-28T19:50:26 | 2019-02-28T19:50:26 | 173,171,111 | 0 | 0 | null | 2019-02-28T19:50:27 | 2019-02-28T19:03:58 | C++ | UTF-8 | C++ | false | false | 2,929 | cpp | // Prosze dopisac kod, dodac nowe pliki, tak aby program wykonywal
// sie, a wynik jego dzialania byl taki sam jak podany na ko�cu tego
// pliku.
// Prosze napisac strukture MapPoint, ktore reprezentuje punkt na
// mapie skladajacy sie z nazwy, dlugosci (longitude) i szerokosci
// (latitude) geograficznej (bez oznaczania polkol).
// Funkcja inTheMiddle powinna tworzyc nowy punkt na mapie o zadanej
// nazwie i polozeniu, ktore jest srednia arytmetyczna z polozen
// podanych punktow czyli x = (x_1 + x_2)/2
// Pliku Main.cpp, nie wolno modyfikowac.
// Ostateczny program powinien byc przyjazny dla programisty (miec
// czytelny i dobrze napisany kod).
// Zarzadzanie procesem kompilacji oraz definicjami zmiennych preprocesora
// mo�na wykona� poprzez dedykowany Makefile lub CMakeLists.txt (pro�ciej).
// Przy wykonaniu zadania nie wolno korzystac z internetu, notatek,
// ani zadnych innych materialow (w tym w�asnych wczesniej
// przygotowanych plikow opr�cz makefile)
// Pliki programu prosz� uporz�dkowa� wed�ug nast�puj�cego schematu:
// Lab04/
// /CMakeLists.txt (lub Makefile)
// /Main.cpp
// /include/MapPoint.h
// /include/MapDistance.h
// /src/MapPoint.cpp
// /src/MapDistance.cpp
//
// Kody zrodlowe musza znajdowac sie w katalogu do ktorego nikt oprocz
// wlasciciela nie ma praw dostepu.
#include <iostream>
#include "MapPoint.h"
#ifdef MAPCALC
#include "MapDistance.h"
#endif
int main()
{
const double longitude = 19.938333;
const double latitude = 50.061389;
MapPoint krk = construct("Krakow", latitude, longitude);
print(krk); //ok
MapPoint nyc = construct("NYC", 40.7127, -74.0059);
print(nyc); //ok
MapPoint irkutsk = construct("Irkutsk", 52.283333, 104.283333);
print(irkutsk); //ok
const MapPoint &siberiaCapital = irkutsk; //&
print(siberiaCapital); //ok
#ifdef MAPCALC
const double longitudeShift = 4.1234;
const double latitudeShift = -25.987;
movePoint(irkutsk, latitudeShift, longitudeShift); //ok //zmienić na *irkutsk
print(siberiaCapital); //ok
MapPoint mp = inTheMiddle(krk, siberiaCapital, "Somewhere but not here"); //ok
print(mp); //ok
clear(mp);
#endif
clear(nyc);
clear(krk);
clear(irkutsk);
}
/** Wynik dzialania programu:
brachwal@vbox:[build]$ ./Lab04
Position of Krakow. Latitude: 50.0614. Longitude: 19.9383
Position of NYC. Latitude: 40.7127. Longitude: -74.0059
Position of Irkutsk. Latitude: 52.2833. Longitude: 104.283
Position of Irkutsk. Latitude: 52.2833. Longitude: 104.283
Position of Irkutsk. Latitude: 26.2963. Longitude: 108.407
Position of Somewhere but not here. Latitude: 38.1789. Longitude: 64.1725
*/
| [
"hiusvii@gmail.com"
] | hiusvii@gmail.com |
3b1dbd4f120b6498cb882118e12590093c71d454 | 037d518773420f21d74079ee492827212ba6e434 | /blazetest/src/mathtest/dmatdmatmult/U3x3bU3x3b.cpp | ecff53576c24d244797ffb742e9ef4627fb08b37 | [
"BSD-3-Clause"
] | permissive | chkob/forked-blaze | 8d228f3e8d1f305a9cf43ceaba9d5fcd603ecca8 | b0ce91c821608e498b3c861e956951afc55c31eb | refs/heads/master | 2021-09-05T11:52:03.715469 | 2018-01-27T02:31:51 | 2018-01-27T02:31:51 | 112,014,398 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,622 | cpp | //=================================================================================================
/*!
// \file src/mathtest/dmatdmatmult/U3x3bU3x3b.cpp
// \brief Source file for the U3x3bU3x3b dense matrix/dense matrix multiplication math test
//
// Copyright (C) 2012-2018 Klaus Iglberger - All Rights Reserved
//
// This file is part of the Blaze library. You can redistribute it and/or modify it under
// the terms of the New (Revised) BSD License. Redistribution and use in source and binary
// forms, with or without modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
// 3. Neither the names of the Blaze development group nor the names of its contributors
// may be used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
// SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
// DAMAGE.
*/
//=================================================================================================
//*************************************************************************************************
// Includes
//*************************************************************************************************
#include <cstdlib>
#include <iostream>
#include <blaze/math/StaticMatrix.h>
#include <blaze/math/UpperMatrix.h>
#include <blazetest/mathtest/Creator.h>
#include <blazetest/mathtest/dmatdmatmult/OperationTest.h>
#include <blazetest/system/MathTest.h>
//=================================================================================================
//
// MAIN FUNCTION
//
//=================================================================================================
//*************************************************************************************************
int main()
{
std::cout << " Running 'U3x3bU3x3b'..." << std::endl;
using blazetest::mathtest::TypeB;
try
{
// Matrix type definitions
typedef blaze::UpperMatrix< blaze::StaticMatrix<TypeB,3UL,3UL> > U3x3b;
// Creator type definitions
typedef blazetest::Creator<U3x3b> CU3x3b;
// Running the tests
RUN_DMATDMATMULT_OPERATION_TEST( CU3x3b(), CU3x3b() );
}
catch( std::exception& ex ) {
std::cerr << "\n\n ERROR DETECTED during dense matrix/dense matrix multiplication:\n"
<< ex.what() << "\n";
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
//*************************************************************************************************
| [
"klaus.iglberger@gmail.com"
] | klaus.iglberger@gmail.com |
2d0889b0164a5e112f0688de5b599df3c6e7c3fc | 4adb1be9cb3ba85b21e9c8cf8a215f62af9a8e98 | /LeetCode/Explore/Tencent/Array/ThreeSum.cpp | 99532de5197c5ca36911c86e7c34ebb7bc01b214 | [
"MIT"
] | permissive | GoatGirl98/online-judge | e15fc8200434e22199d1bad209439deae81b7b52 | ab0f494ef267dd8e25f4d0a03e916980c6dc1bb0 | refs/heads/master | 2023-04-18T15:53:59.576552 | 2021-05-06T14:56:16 | 2021-05-06T14:56:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,020 | cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
vector<vector<int>> threeSum(vector<int> &nums) {
int size = nums.size();
sort(nums.begin(), nums.end());
vector<vector<int>> res;
for (int i = 0; i < size - 2; i++) {
if (nums[i] > 0)
break;
if (i > 0 && nums[i] == nums[i - 1])
continue;
int l = i + 1, r = size - 1;
while (l < r) {
int sum = nums[i] + nums[l] + nums[r];
if (sum == 0) {
res.push_back({nums[i], nums[l], nums[r]});
while (l + 1 < r && nums[l] == nums[l + 1])
++l;
while (l < r - 1 && nums[r] == nums[r - 1])
--r;
++l;
--r;
} else if (sum < 0)
++l;
else
--r;
}
}
return res;
}
}; | [
"sunyufei963@gmail.com"
] | sunyufei963@gmail.com |
a94657aa39c7963a3e591f2a258b175bbfc760cc | 21ede326b6cfcf5347ca6772d392d3acca80cfa0 | /cc/paint/paint_image.h | 55555bee2eefac8cb2cc574304e801966f21456f | [
"BSD-3-Clause"
] | permissive | csagan5/kiwi | 6eaab0ab4db60468358291956506ad6f889401f8 | eb2015c28925be91b4a3130b3c2bee2f5edc91de | refs/heads/master | 2020-04-04T17:06:54.003121 | 2018-10-24T08:20:01 | 2018-10-24T08:20:01 | 156,107,399 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,742 | h | // Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CC_PAINT_PAINT_IMAGE_H_
#define CC_PAINT_PAINT_IMAGE_H_
#include <vector>
#include "base/gtest_prod_util.h"
#include "base/logging.h"
#include "cc/paint/frame_metadata.h"
#include "cc/paint/image_animation_count.h"
#include "cc/paint/paint_export.h"
#include "cc/paint/skia_paint_image_generator.h"
#include "third_party/skia/include/core/SkImage.h"
#include "ui/gfx/geometry/rect.h"
namespace cc {
class PaintImageGenerator;
class PaintOpBuffer;
using PaintRecord = PaintOpBuffer;
// A representation of an image for the compositor.
// Note that aside from default construction, it can only be constructed using a
// PaintImageBuilder, or copied/moved into using operator=.
class CC_PAINT_EXPORT PaintImage {
public:
using Id = int;
using AnimationSequenceId = uint32_t;
// A ContentId is used to identify the content for which images which can be
// lazily generated (generator/record backed images). As opposed to Id, which
// stays constant for the same image, the content id can be updated when the
// backing encoded data for this image changes. For instance, in the case of
// images which can be progressively updated as more encoded data is received.
using ContentId = int;
// The default frame index to use if no index is provided. For multi-frame
// images, this would imply the first frame of the animation.
static const size_t kDefaultFrameIndex;
static const Id kInvalidId;
static const ContentId kInvalidContentId;
class CC_PAINT_EXPORT FrameKey {
public:
FrameKey(ContentId content_id, size_t frame_index, gfx::Rect subset_rect);
bool operator==(const FrameKey& other) const;
bool operator!=(const FrameKey& other) const;
uint64_t hash() const { return hash_; }
std::string ToString() const;
size_t frame_index() const { return frame_index_; }
ContentId content_id() const { return content_id_; }
private:
ContentId content_id_;
size_t frame_index_;
// TODO(khushalsagar): Remove this when callers take care of subsetting.
gfx::Rect subset_rect_;
size_t hash_;
};
struct CC_PAINT_EXPORT FrameKeyHash {
size_t operator()(const FrameKey& frame_key) const {
return frame_key.hash();
}
};
enum class AnimationType { ANIMATED, VIDEO, STATIC };
enum class CompletionState { DONE, PARTIALLY_DONE };
enum class DecodingMode {
// No preference has been specified. The compositor may choose to use sync
// or async decoding. See CheckerImageTracker for the default behaviour.
kUnspecified,
// It's preferred to display this image synchronously with the rest of the
// content updates, skipping any heuristics.
kSync,
// Async is preferred. The compositor may decode async if it meets the
// heuristics used to avoid flickering (for instance vetoing of multipart
// response, animated, partially loaded images) and would be performant. See
// CheckerImageTracker for all heuristics used.
kAsync
};
// Returns the more conservative mode out of the two given ones.
static DecodingMode GetConservative(DecodingMode one, DecodingMode two);
static Id GetNextId();
static ContentId GetNextContentId();
PaintImage();
PaintImage(const PaintImage& other);
PaintImage(PaintImage&& other);
~PaintImage();
PaintImage& operator=(const PaintImage& other);
PaintImage& operator=(PaintImage&& other);
bool operator==(const PaintImage& other) const;
bool operator!=(const PaintImage& other) const { return !(*this == other); }
// Returns the smallest size that is at least as big as the requested_size
// such that we can decode to exactly that scale. If the requested size is
// larger than the image, this returns the image size. Any returned value is
// guaranteed to be stable. That is,
// GetSupportedDecodeSize(GetSupportedDecodeSize(size)) is guaranteed to be
// GetSupportedDecodeSize(size).
SkISize GetSupportedDecodeSize(const SkISize& requested_size) const;
// Decode the image into the given memory for the given SkImageInfo.
// - Size in |info| must be supported.
// - The amount of memory allocated must be at least
// |info|.minRowBytes() * |info|.height().
// Returns true on success and false on failure. Updates |info| to match the
// requested color space, if provided.
// Note that for non-lazy images this will do a copy or readback if the image
// is texture backed.
bool Decode(void* memory,
SkImageInfo* info,
sk_sp<SkColorSpace> color_space,
size_t frame_index) const;
Id stable_id() const { return id_; }
const sk_sp<SkImage>& GetSkImage() const;
AnimationType animation_type() const { return animation_type_; }
CompletionState completion_state() const { return completion_state_; }
bool is_multipart() const { return is_multipart_; }
int repetition_count() const { return repetition_count_; }
bool ShouldAnimate() const;
size_t frame_index() const { return frame_index_; }
AnimationSequenceId reset_animation_sequence_id() const {
return reset_animation_sequence_id_;
}
DecodingMode decoding_mode() const { return decoding_mode_; }
PaintImage::ContentId content_id() const { return content_id_; }
// TODO(vmpstr): Don't get the SkImage here if you don't need to.
uint32_t unique_id() const { return GetSkImage()->uniqueID(); }
explicit operator bool() const { return !!GetSkImage(); }
bool IsLazyGenerated() const { return GetSkImage()->isLazyGenerated(); }
int width() const { return GetSkImage()->width(); }
int height() const { return GetSkImage()->height(); }
SkColorSpace* color_space() const { return GetSkImage()->colorSpace(); }
// Returns a unique id for the pixel data for the frame at |frame_index|.
FrameKey GetKeyForFrame(size_t frame_index) const;
// Returns the metadata for each frame of a multi-frame image. Should only be
// used with animated images.
const std::vector<FrameMetadata>& GetFrameMetadata() const;
// Returns the total number of frames known to exist in this image.
size_t FrameCount() const;
// Returns an SkImage for the frame at |index|.
sk_sp<SkImage> GetSkImageForFrame(size_t index) const;
std::string ToString() const;
private:
friend class PaintImageBuilder;
FRIEND_TEST_ALL_PREFIXES(PaintImageTest, Subsetting);
// Used internally for PaintImages created at raster.
static const Id kNonLazyStableId;
friend class ScopedRasterFlags;
friend class PaintOpReader;
bool DecodeFromGenerator(void* memory,
SkImageInfo* info,
sk_sp<SkColorSpace> color_space,
size_t frame_index) const;
bool DecodeFromSkImage(void* memory,
SkImageInfo* info,
sk_sp<SkColorSpace> color_space,
size_t frame_index) const;
void CreateSkImage();
PaintImage MakeSubset(const gfx::Rect& subset) const;
sk_sp<SkImage> sk_image_;
sk_sp<PaintRecord> paint_record_;
gfx::Rect paint_record_rect_;
ContentId content_id_ = kInvalidContentId;
sk_sp<PaintImageGenerator> paint_image_generator_;
Id id_ = 0;
AnimationType animation_type_ = AnimationType::STATIC;
CompletionState completion_state_ = CompletionState::DONE;
int repetition_count_ = kAnimationNone;
// If non-empty, holds the subset of this image relative to the original image
// at the origin.
gfx::Rect subset_rect_;
// The frame index to use when rasterizing this image.
size_t frame_index_ = kDefaultFrameIndex;
// Whether the data fetched for this image is a part of a multpart response.
bool is_multipart_ = false;
// An incrementing sequence number maintained by the painter to indicate if
// this animation should be reset in the compositor. Incrementing this number
// will reset this animation in the compositor for the first frame which has a
// recording with a PaintImage storing the updated sequence id.
AnimationSequenceId reset_animation_sequence_id_ = 0u;
DecodingMode decoding_mode_ = DecodingMode::kSync;
// The |cached_sk_image_| can be derived/created from other inputs present in
// the PaintImage but we always construct it at creation time for 2 reasons:
// 1) This ensures that the underlying SkImage is shared across PaintImage
// copies, which is necessary to allow reuse of decodes from this image in
// skia's cache.
// 2) Ensures that accesses to it are thread-safe.
sk_sp<SkImage> cached_sk_image_;
};
} // namespace cc
#endif // CC_PAINT_PAINT_IMAGE_H_
| [
"team@geometry.ee"
] | team@geometry.ee |
0557efd5caddce6b10344a1cae3bd2e1e979c4c0 | d782889122ef79b124712adc6d350c9e88fb022e | /Source/MultiGame/Concentration/ConCard.cpp | fe621a621101ca478598cbb37e82878fae2e4f78 | [] | no_license | nicex000/MultiGame | e952ef76b5ecbcfc28a5e39b9281ecad8f38c5fd | 4f63f3a4b387b675dd2f38b992ae2bc1a938eaa5 | refs/heads/master | 2023-03-04T09:41:18.539677 | 2021-02-22T20:52:52 | 2021-02-22T20:52:52 | 331,596,619 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,591 | cpp | // Fill out your copyright notice in the Description page of Project Settings.
#include "ConCard.h"
#include "UObject/ConstructorHelpers.h"
#include "ConGrid.h"
#include "Components/StaticMeshComponent.h"
#include "Curves/CurveFloat.h"
#include "Engine/StaticMesh.h"
#include "Kismet/GameplayStatics.h"
#include "Materials/MaterialInstance.h"
#include "Materials/MaterialInstanceDynamic.h"
// Sets default values
AConCard::AConCard()
{
// 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;
struct FConstructionStatics
{
ConstructorHelpers::FObjectFinderOptional<UStaticMesh> CardMesh;
ConstructorHelpers::FObjectFinderOptional<UMaterial> CardBaseMaterial;
ConstructorHelpers::FObjectFinderOptional<UMaterial> CardBackMaterial;
ConstructorHelpers::FObjectFinderOptional<UMaterial> CardFrontMaterial;
FConstructionStatics() : CardMesh(TEXT("/Game/Concentration/CardMesh.CardMesh")),
CardBaseMaterial(TEXT("/Game/Concentration/CardMaterial.CardMaterial")),
CardBackMaterial(TEXT("/Game/Concentration/CardBackMat.CardBackMat")),
CardFrontMaterial(TEXT("/Game/Concentration/CardFrontMat.CardFrontMat"))
{
}
};
static FConstructionStatics ConstructorStatics;
CardRoot = CreateDefaultSubobject<USceneComponent>(TEXT("CardRoot"));
RootComponent = CardRoot;
CardMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("CardMesh"));
if (ConstructorStatics.CardMesh.Succeeded())
{
CardMesh->SetStaticMesh(ConstructorStatics.CardMesh.Get());
CardMesh->SetRelativeScale3D(FVector(1.f, 1.35f, 0.035f));
CardMesh->SetRelativeLocation(FVector(0.f, 0.f, 25.f));
baseMaterial = ConstructorStatics.CardBaseMaterial.Get();
backMaterial = ConstructorStatics.CardBackMaterial.Get();
frontMaterial = ConstructorStatics.CardFrontMaterial.Get();
CardMesh->OnClicked.AddDynamic(this, &AConCard::CardClicked);
CardMesh->OnInputTouchBegin.AddDynamic(this, &AConCard::OnFingerPressedBlock);
}
}
void AConCard::BeginPlay()
{
Super::BeginPlay();
DynamicBaseMaterial = UMaterialInstanceDynamic::Create(baseMaterial,
this, FName(TEXT("base mat")));
DynamicBackMaterial = UMaterialInstanceDynamic::Create(backMaterial,
this, FName(TEXT("back mat")));
DynamicFrontMaterial = UMaterialInstanceDynamic::Create(frontMaterial,
this, FName(TEXT("front mat")));
CardMesh->SetMaterial(0, DynamicBaseMaterial);
CardMesh->SetMaterial(1, DynamicBackMaterial);
CardMesh->SetMaterial(2, DynamicFrontMaterial);
CardMesh->AttachToComponent(RootComponent, FAttachmentTransformRules::KeepRelativeTransform);
RootComponent->SetRelativeRotation(FRotator(0.f, -90.f, 0.f));
}
void AConCard::Init(UCurveFloat* flipCurve, AConGrid* owner)
{
FlipCurve = flipCurve;
OwningGrid = owner;
FOnTimelineFloat timelineCallback;
FOnTimelineEventStatic timelineFinishedCallback;
timelineCallback.BindUFunction(this, FName("FlipCard"));
timelineFinishedCallback.BindUFunction(this, FName("TimelineRotateEnd"));
if (FlipCurve) rotationTimeline.AddInterpFloat(FlipCurve, timelineCallback);
rotationTimeline.SetTimelineFinishedFunc(timelineFinishedCallback);
}
void AConCard::SetType(int32 type, UTexture2D* frontTexture, UTexture2D* backTexture)
{
Type = type;
if (frontTexture != nullptr)
{
DynamicFrontMaterial->SetTextureParameterValue("Tex", frontTexture);
}
if (backTexture != nullptr)
{
DynamicBackMaterial->SetTextureParameterValue("Tex", backTexture);
}
}
void AConCard::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
rotationTimeline.TickTimeline(DeltaTime);
}
void AConCard::FlipCard()
{
//animation
curveRotValue = FlipCurve->GetFloatValue(rotationTimeline.GetPlaybackPosition());
CardMesh->SetRelativeRotation(FRotator(180.f * curveRotValue, startingRotation.Yaw, startingRotation.Roll));
}
void AConCard::TimelineRotateEnd()
{
if (rotationTimeline.GetPlaybackPosition() > 0 || !FlipCurve)
{
OwningGrid->MatchCards(*this);
faceUp = true;
}
else
{
faceUp = false;
}
}
void AConCard::CardClicked(UPrimitiveComponent* ClickedComp, FKey ButtonClicked)
{
HandleClicked();
}
void AConCard::OnFingerPressedBlock(ETouchIndex::Type FingerIndex, UPrimitiveComponent* TouchedComponent)
{
HandleClicked();
}
void AConCard::HandleClicked()
{
// Do nothing if it's already face up or already in animation
if (faceUp || rotationTimeline.IsPlaying())
{
return;
}
//timeline -> https://unrealcpp.com/open-door-with-timeline/ timeline finished callback
startingRotation = CardMesh->GetRelativeRotation();
rotationTimeline.PlayFromStart();
}
void AConCard::HideCard()
{
//animation with timeline
rotationTimeline.ReverseFromEnd();
}
void AConCard::Highlight(bool bOn)
{
// Do not highlight if it's already face up.
if (faceUp)
{
return;
}
if (bOn)
{
DynamicBackMaterial->SetScalarParameterValue("Opacity", 0.4f);
}
else
{
DynamicBackMaterial->SetScalarParameterValue("Opacity", 1.f);
}
}
void AConCard::SuccessEffect(UParticleSystem* pSystem)
{
auto pos = CardMesh->GetComponentLocation();
pos.Y -= 1.f;
UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), pSystem, pos);
}
void AConCard::EnablePhysicsWithPush(float impulseStrength, float impulseOffset)
{
CardMesh->SetSimulatePhysics(true);
FVector impulsePoint = CardMesh->GetComponentLocation();
impulsePoint.X += (FMath::RandBool() ? 1.f : -1.f) * impulseOffset;
impulsePoint.Y += (FMath::RandBool() ? 1.f : -1.f) * impulseOffset;
CardMesh->AddImpulseAtLocation(FVector::DownVector * impulseStrength, impulsePoint);
}
| [
"martinlagas@hotmail.com"
] | martinlagas@hotmail.com |
25c1a44edc7a388470b7a08a36314ce1f35a9c73 | c7370d2d8ddfcd6f2f39f0645c5852ab42242e9f | /src/logging/src/logging_loguru.cpp | 1dd87cc79c1b5fa515d3fcd854f884fc27966ef2 | [] | no_license | kczapla/lasy_pomorza | 62146dc43b9e92494844fa689b23897b6342d4f4 | b0d78763ef1058a2d3248915d3d0ccd7c36c4fd9 | refs/heads/master | 2020-05-01T05:45:38.019945 | 2019-04-24T18:05:57 | 2019-04-24T18:07:28 | 177,311,427 | 0 | 0 | null | 2019-04-24T18:07:29 | 2019-03-23T16:16:03 | C++ | UTF-8 | C++ | false | false | 502 | cpp | #define LOGURU_WITH_STREAMS 1
#include <loguru.cpp>
#include "logging_loguru.hpp"
void logging::LoguruLogging::add_file(std::string path)
{
loguru::add_file(path.c_str(), loguru::Truncate, loguru::Verbosity_MAX);
}
void logging::LoguruLogging::info(std::ostringstream & msg)
{
LOG_S(INFO) << msg.str();
}
void logging::LoguruLogging::warning(std::ostringstream & msg)
{
LOG_S(WARNING) << msg.str();
}
void logging::LoguruLogging::error(std::ostringstream & msg)
{
LOG_S(ERROR) << msg.str();
}
| [
"k.czapla68@gmail.com"
] | k.czapla68@gmail.com |
0bbf85cd473492ab1bbb1eb3057f61b57d0e3314 | 2edbce1c655fc8c5d859c5e27b4f2a59f28ec88b | /src/Normal.cpp | 87126815ff367d7c0423512a67e5dada07df00b7 | [] | no_license | axhoover/raytracer | 4f242fdeeaa262481e14b72f2db544d77d742c1c | e90bf7c00bf9fe19f5e009f445b97880dea05993 | refs/heads/master | 2021-05-30T11:04:45.264865 | 2015-06-03T23:48:46 | 2015-06-03T23:48:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,650 | cpp | #include "gssmraytracer/geometry/Normal.h"
#include <OpenEXR/ImathVec.h>
namespace gssmraytracer {
namespace geometry {
class Normal::Impl {
public:
Imath::Vec3<float> vec;
};
Normal::Normal() : mImpl(new Impl) {
mImpl->vec.x = 0;
mImpl->vec.y = 0;
mImpl->vec.z = 0;
}
Normal::Normal(const math::Vector &vec) : mImpl(new Impl) {
mImpl->vec.x = vec.x();
mImpl->vec.y = vec.y();
mImpl->vec.z = vec.z();
}
Normal::Normal(const float x, const float y, const float z): mImpl(new Impl) {
mImpl->vec.x = x;
mImpl->vec.y = y;
mImpl->vec.z = z;
}
Normal::Normal(const Normal &normal) : mImpl(new Impl) {
mImpl->vec = normal.mImpl->vec;
}
Normal& Normal::operator=(const Normal &normal) {
if (this != &normal) {
mImpl->vec = normal.mImpl->vec;
}
return *this;
}
Normal& Normal::operator=(const math::Vector &vector) {
Imath::Vec3<float> v(vector.x(), vector.y(), vector.z());
mImpl->vec = v;
return *this;
}
void Normal::normalize() { mImpl->vec.normalize();}
const Normal Normal::normalized() const {
Normal new_normal = *this;
new_normal.normalize();
return new_normal;
}
const float Normal::x() const { return mImpl->vec.x;}
const float Normal::y() const { return mImpl->vec.y;}
const float Normal::z() const { return mImpl->vec.z;}
std::ostream& operator<<(std::ostream &os, const Normal &normal) {
os << "(" << normal.x() << ", " << normal.y() << ", " << normal.z() << ")" << std::endl;
return os;
}
}
}
| [
"ahoover@localhost.localdomain"
] | ahoover@localhost.localdomain |
acae7d0a13e54816e4371f1c40032870b3879107 | b9529c95b01310c45799c12d98937ae37e931b7c | /프로그래밍 강의/COS Pro 2급 Python 모의고사/공항 방문객.cpp | c2447895ad70a152e85301fed535057476757723 | [] | no_license | C13H12N4O2/Programmers | 98b04f3b0241a3f6ed68a2db740460cc014bcf83 | 20157630714c02702b9ffcb55ac193624a784e91 | refs/heads/master | 2022-12-22T15:18:27.949061 | 2020-10-05T14:40:12 | 2020-10-05T14:40:12 | 293,683,163 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 756 | cpp | #include <string>
#include <vector>
using namespace std;
vector<int> func_a(vector<int> arr, int n){
vector<int> ret;
for(int i = 0; i < arr.size(); ++i)
if(arr[i] != n)
ret.push_back(arr[i]);
return ret;
}
int func_b(int a, int b){
if (a >= b)
return a - b;
else
return b - a;
}
int func_c(vector<int> arr){
int ret = -1;
for (int i = 0; i < arr.size(); ++i){
if(ret < arr[i] )
ret = arr[i];
}
return ret;
}
int solution(vector<int> visitor) {
int max_first = func_c(visitor);
vector<int> visitor_removed = func_a(visitor, max_first);
int max_second = func_c(visitor_removed);
int answer = func_b(max_first, max_second);
return answer;
}
| [
"c13h12n4o2@gmail.com"
] | c13h12n4o2@gmail.com |
4ceadce1b0e9100d54c79170988528a6b1064bad | e5b4a366cfb61130dd3dcaa84083cb0d0451cd32 | /src/sendalert.cpp | d2be387df24689a99add22aa52fcc76fe81ad151 | [
"MIT"
] | permissive | nToken/ntoken-core | b98f5db2c075b75f4135a9b2f89b299238e2bf06 | f17fea2c91f72d0bfe80818b5a9211234df5ae67 | refs/heads/master | 2021-05-11T13:02:35.559270 | 2018-04-06T08:27:37 | 2018-04-06T08:27:37 | 117,670,025 | 4 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,699 | cpp | #include "alert.h"
#include "clientversion.h"
#include "chainparams.h"
#include "init.h"
#include "net.h"
#include "utilstrencodings.h"
#include "utiltime.h"
/*
If you need to broadcast an alert, here's what to do:
1. Modify alert parameters below, see alert.* and comments in the code
for what does what.
2. run ntokend with -printalert or -sendalert like this:
/path/to/ntokend -printalert
One minute after starting up the alert will be broadcast. It is then
flooded through the network until the nRelayUntil time, and will be
active until nExpiration OR the alert is cancelled.
If you screw up something, send another alert with nCancel set to cancel
the bad alert.
*/
void ThreadSendAlert(CConnman& connman)
{
if (!mapArgs.count("-sendalert") && !mapArgs.count("-printalert"))
return;
// Wait one minute so we get well connected. If we only need to print
// but not to broadcast - do this right away.
if (mapArgs.count("-sendalert"))
MilliSleep(60*1000);
//
// Alerts are relayed around the network until nRelayUntil, flood
// filling to every node.
// After the relay time is past, new nodes are told about alerts
// when they connect to peers, until either nExpiration or
// the alert is cancelled by a newer alert.
// Nodes never save alerts to disk, they are in-memory-only.
//
CAlert alert;
alert.nRelayUntil = GetAdjustedTime() + 15 * 60;
alert.nExpiration = GetAdjustedTime() + 30 * 60 * 60;
alert.nID = 1; // keep track of alert IDs somewhere
alert.nCancel = 0; // cancels previous messages up to this ID number
// These versions are protocol versions
alert.nMinVer = 70000;
alert.nMaxVer = 70103;
//
// 1000 for Misc warnings like out of disk space and clock is wrong
// 2000 for longer invalid proof-of-work chain
// Higher numbers mean higher priority
alert.nPriority = 5000;
alert.strComment = "";
alert.strStatusBar = "URGENT: Upgrade required: see https://www.ntoken.org";
// Set specific client version/versions here. If setSubVer is empty, no filtering on subver is done:
// alert.setSubVer.insert(std::string("/NToken Core:0.12.0.58/"));
// Sign
if(!alert.Sign())
{
LogPrintf("ThreadSendAlert() : could not sign alert\n");
return;
}
// Test
CDataStream sBuffer(SER_NETWORK, CLIENT_VERSION);
sBuffer << alert;
CAlert alert2;
sBuffer >> alert2;
if (!alert2.CheckSignature(Params().AlertKey()))
{
printf("ThreadSendAlert() : CheckSignature failed\n");
return;
}
assert(alert2.vchMsg == alert.vchMsg);
assert(alert2.vchSig == alert.vchSig);
alert.SetNull();
printf("\nThreadSendAlert:\n");
printf("hash=%s\n", alert2.GetHash().ToString().c_str());
printf("%s", alert2.ToString().c_str());
printf("vchMsg=%s\n", HexStr(alert2.vchMsg).c_str());
printf("vchSig=%s\n", HexStr(alert2.vchSig).c_str());
// Confirm
if (!mapArgs.count("-sendalert"))
return;
while (connman.GetNodeCount(CConnman::CONNECTIONS_ALL) == 0 && !ShutdownRequested())
MilliSleep(500);
if (ShutdownRequested())
return;
// Send
printf("ThreadSendAlert() : Sending alert\n");
int nSent = 0;
{
connman.ForEachNode([&alert2, &connman, &nSent](CNode* pnode) {
if (alert2.RelayTo(pnode, connman))
{
printf("ThreadSendAlert() : Sent alert to %s\n", pnode->addr.ToString().c_str());
nSent++;
}
});
}
printf("ThreadSendAlert() : Alert sent to %d nodes\n", nSent);
}
| [
"dev@ntoken.org"
] | dev@ntoken.org |
769610a5a39333f2d190fb234e162391eb47e084 | ba8dc2138a034eb8c5bb45031fbe2d806beecc52 | /Roflan-Syntax/example/main.cpp | f5d15acb1ca40ffe4e60c8082953cd47cc115555 | [] | no_license | Fals3R/Roflan-Syntax | d3146b4d5e99c46c410de22ee3245b163f8e0bdc | 657e1dadb486a170d093b61c83d76f334ff40aae | refs/heads/master | 2020-07-26T01:47:22.317366 | 2019-09-14T19:45:39 | 2019-09-14T19:45:39 | 208,492,455 | 6 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,259 | cpp | #include "../roflan/RoflanSyntax.hpp"
#include <iostream>
#include <windows.h>
#include <string>
инт сложить_целые_числа(инт а, инт б) начало
возвратить а плюс б;
конец
пустота main() начало
язык("ru")
установить_кодировку(1251)
установить_кодировку_вывода(1251)
написать_в_консоль("Привет!\n")
ждать(1000)
инт результат_один = выполнить(сложить_целые_числа(22, 49))
написать_в_консоль("Результатом сложения чисел 22 и 49 будет %i.\n", результат_один)
ждать(1000)
инт результат_два = возвести_в_степень(5, 3)
написать_в_консоль("А 5 в степени 3 это %i.\n", результат_два)
ждать(1000)
инт результат_три = модуль_числа(-20)
написать_в_консоль("Но сейчас ты не поверишь... Модуль числа -20 это %i!!!\n", результат_три)
ждать(1000)
написать_в_консоль("А теперь, введи какое-нибудь слово или несколько слов, а я покажу тебе, как они пишутся задом наперёд.\nВведи что-нибудь: ")
юникод ввод = L"" закончить
получить_юникод_ввода_и_записать_в(ввод)
если(текст_пустой(ввод)) начало
написать_в_консоль("Ты видимо не понял. Тебе нужно было ввести что-нибудь, а ты проигнорировал мою просьбу...\n")
пауза
выход
конец иначе начало
написать_в_консоль("Ты ввёл: %ws\n", массив_символов(ввод))
перевернуть_текст(ввод)
написать_в_консоль("Я перевернул это и вот что получилось: %ws\n", массив_символов(ввод))
конец
написать_в_консоль("Пока!\n")
пауза
конец | [
"fals3r@gmail.com"
] | fals3r@gmail.com |
935f265bf2b74ef2ed22a47a8f2064ccc1b4ccfe | b536f7af4700b761814fc01b2b2356ad6cae6481 | /MyTest/xService/code/x_service_door_util.hpp | 21a464ff7922302eb3765492a5856e4cb9fce9bf | [] | no_license | QC-git/MyTest | 5c3bb3bc92259b65945e4044d655c1a55f7bd166 | 84724a0e0d208412840fdc4ab184c307a297aa7a | refs/heads/master | 2021-01-10T20:22:32.437573 | 2015-04-17T13:18:36 | 2015-04-17T13:18:36 | 34,115,837 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 5,136 | hpp |
#ifdef X_SERVICE_USE_PRAGMAONCE
#pragma once
#endif
#ifndef _SERVOCE_DOOR_UTIL_HEADER
#define _SERVOCE_DOOR_UTIL_HEADER
//////////////////////////////////////////////////////////////////////////
_SERVOCE_DOOR_BEGIN
#if X_SERVICE_HAVE_SPEPRINT > 0
_SERVICE_EXPORT VOID_T Print_f();
# define PRINT_F _SERVICE_NAME::Print_f
#else
# ifdef _WIN32
# ifdef _MFC_VERSION
# define PRINT_F TRACE
# else
# define PRINT_F printf
# endif
# else // linux
# define PRINT_F printf
# endif
#endif
#if X_SERVICE_HAVE_LOGFILE > 0
enum E_LOG_LEVEL
{
E_LOG_LEVEL_NORMAL = 0,
E_LOG_LEVEL_DEBUG = 1,
E_LOG_LEVEL_WARNING = 2,
E_LOG_LEVEL_ERROR = 3
};
_SERVICE_EXPORT VOID_T Log_f(E_LOG_LEVEL emLevel, const CHAR_T* sFmt, ...);
# define _SERVICE_LOG_F _SERVICE_NAME::Log_f
# define LOG_F(fmt, ...) _SERVICE_LOG_F(_SERVICE_NAME::E_LOG_LEVEL_NORMAL, fmt, __VA_ARGS__)
# define LOGD_F(fmt, ...) _SERVICE_LOG_F(_SERVICE_NAME::E_LOG_LEVEL_DEBUG, fmt, __VA_ARGS__)
# define LOGW_F(fmt, ...) _SERVICE_LOG_F(_SERVICE_NAME::E_LOG_LEVEL_WARNING, fmt, __VA_ARGS__)
# define LOGERR_F(fmt, ...) _SERVICE_LOG_F(_SERVICE_NAME::E_LOG_LEVEL_ERROR, fmt, __VA_ARGS__)
#else
# define LOG_F(fmt, ...) PRINT_F("\n\n[DB-LOG] "fmt, __VA_ARGS__)
# define LOGD_F(fmt, ...) PRINT_F("\n\n[DB-DEBUG] "fmt, __VA_ARGS__)
# define LOGW_F(fmt, ...) PRINT_F("\n\n[DB-WARNING] "fmt, __VA_ARGS__)
# define LOGERR_F(fmt, ...) PRINT_F("\n\n[DB-ERROR] "fmt, __VA_ARGS__)
#endif
#if X_SERVICE_HAVE_CMDWIN > 0
# ifdef _MFC_VERSION
# undef X_SERVICE_HAVE_CMDWIN
# define X_SERVICE_HAVE_CMDWIN 0
# endif
#endif
class CPrint
{
public:
virtual CPrint& operator<<(const char* str) = 0;
virtual CPrint& operator<<(int i) = 0;
virtual CPrint& operator<<(unsigned u) = 0;
virtual CPrint& operator<<(double d) = 0;
virtual CPrint& operator<<(void* p) = 0;
};
_SERVICE_EXPORT CPrint& GetPrint_f();
#define _SERVICE_OUT_F _SERVICE_NAME::GetPrint_f()
#define OUT_F _SERVICE_OUT_F
/*
************************************************************************************************************************
* GetDataTimeString_f
*
* Description: 获取字符串型时间
*
* Arguments : 内存
*
* Returns : 成功返回true
*
* Note(s) :
*
************************************************************************************************************************
*/
_SERVICE_EXPORT BOOL_T GetDataTimeString_f(CHAR_T *pDataBuff);
/*
************************************************************************************************************************
* GetTime_f
*
* Description: 获取秒级时间
*
* Arguments : 无
*
* Returns : 返回时间
*
* Note(s) :
*
************************************************************************************************************************
*/
_SERVICE_EXPORT TIME_T GetTime_f();
/*
************************************************************************************************************************
* GetMsTime_f
*
* Description: 获取毫秒级时间
*
* Arguments : 无
*
* Returns : 返回时间
*
* Note(s) :
*
************************************************************************************************************************
*/
_SERVICE_EXPORT TIME_T GetMsTime_f();
/*
************************************************************************************************************************
* Sleep_f
*
* Description: 休眠
*
* Arguments : 输入毫秒即时间段
*
* Returns : 无
*
* Note(s) :
*
************************************************************************************************************************
*/
_SERVICE_EXPORT VOID_T Sleep_f(TIME_T lMs);
/*
************************************************************************************************************************
* StrDup_f
*
* Description: 字符串拷贝
*
* Arguments : 原字符串
*
* Returns : 返回新的字符串,需要手动释放
*
* Note(s) :
*
************************************************************************************************************************
*/
_SERVICE_EXPORT CHAR_T* StrDup_f(const CHAR_T* sSrc);
/*
************************************************************************************************************************
* UtilTest
*
* Description: 测试
*
* Arguments : 无
*
* Returns : 随机
*
* Note(s) :
*
************************************************************************************************************************
*/
_SERVICE_EXPORT ERR_T UtilTest();
_SERVOCE_DOOR_END
//////////////////////////////////////////////////////////////////////////
#ifdef _SERVICE_DOOR_LOCK
#error "this file can not include the door"
#endif
#endif | [
"273143979@qq.com"
] | 273143979@qq.com |
765c72fb2288695bffb1cde6edd390d57e6540d7 | daba6e9665ba4294601180187e1cce6d2bcc7855 | /QConsole/app/Foo.cpp | f6419b3aae031c25cc28199bdc2f62575b6ec209 | [
"Apache-2.0"
] | permissive | szmurlor/fiver | 6c9fcfa0106f686ea2d584993338e117c41ee280 | 083251420eb934d860c99dcf1eb07ae5b8ba7e8c | refs/heads/master | 2021-01-10T18:45:32.704247 | 2015-04-22T10:28:07 | 2015-04-22T10:28:07 | 34,375,842 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 460 | cpp | #include <iostream>
#include <string>
#include <QString>
#include "Foo.h"
#include "Bar.h"
void Foo::hello() {
std::cout << "Hello, nice to see you." << std::endl;
}
int Foo::add(int a, int b) {
return a + b;
}
int Foo::length(std::string s) {
std::cout << "Size of " << s << " is " << s.size() << std::endl;
return s.size();
}
Bar* Foo::getBar(QString name) {
if(name == "bar")
return bar;
else
return new Bar();
}
| [
"szmurlor@f3fdd263-7064-37e0-4400-c306c3018cec"
] | szmurlor@f3fdd263-7064-37e0-4400-c306c3018cec |
8af5569f1a2ec32c18c9b1684709d0853629a149 | dfbf881a7419f35c344e5d271d112a2d3e9fd525 | /ExperPortHLabTrainingBoxes/Modules/TCPClient/NetClient.cpp | 0c18731204e8421cf94ee1665d7910ca034f013b | [] | no_license | jonathansy/BControl_Primary | 13ea066fd16c55a30774a68b73f50d63b2a25b94 | 057039f984741107e37d768889aaf3321188e6d7 | refs/heads/master | 2016-09-02T01:19:48.312376 | 2015-02-28T00:02:13 | 2015-02-28T00:02:13 | 31,345,565 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,547 | cpp |
#include "NetClient.h"
NetClient::NetClient(const std::string & h, unsigned short p)
: Socket(TCP)
{
setHost(h);
setPort(p);
}
NetClient::~NetClient() {}
unsigned NetClient::sendData(const void *d, unsigned dataSize) throw (const SocketException &)
{
unsigned sent = 0;
const char *dataBuf = static_cast<const char *>(d);
while (sent < dataSize)
sent += Socket::sendData(dataBuf + sent, dataSize - sent);
return sent;
}
unsigned NetClient::receiveData(void *d, unsigned dataSize, bool require_full) throw (const SocketException &)
{
unsigned recvd = 0;
char *dataBuf = static_cast<char *>(d);
while ( (require_full && recvd < dataSize) || !recvd) {
recvd += Socket::receiveData(dataBuf + recvd, dataSize - recvd);
if (recvd == 0 && dataSize == 0) break; // force break from loop
}
return recvd;
}
std::string NetClient::receiveString(int desired_sz) throw (const SocketException &)
{
unsigned sz = 2048;
if (desired_sz > 0)
sz = desired_sz;
char *data = new char[sz];
unsigned read = receiveData(data, sz, false);
if (read >= sz) read--;
data[read] = 0;
std::string ret(data);
delete [] data;
return ret;
}
std::string NetClient::receiveLine() throw(const SocketException &)
{
// sub-optimal implementation grabs one character at a time..
char c;
int num;
std::string ret = "";
while(1) {
num = receiveData(&c, 1);
if (!num) break;
if (c == '\n') break;
ret += c;
}
return ret;
}
char ** NetClient::receiveLines() throw(const SocketException &)
{
int NLINES = 8;
char **lines = new char *[NLINES+1];
int i = 0;
do {
std::string line = receiveLine();
int len = line.length()+1;
char *pcstr = new char [len];
::strncpy(pcstr, line.c_str(), len);
pcstr[len-1] = 0;
lines[i++] = pcstr;
if (i >= NLINES) { /* grow the array since we got more lines.. */
char **newptr = new char *[NLINES*2+1];
for (int j = 0; j < NLINES; ++j) newptr[j] = lines[j];
delete [] lines;
lines = newptr;
NLINES *= 2;
}
} while (hasData());
lines[i] = 0;
return lines;
}
/* static */
void NetClient::deleteReceivedLines(char ** ptr_from_receiveLines)
{
char **cur = ptr_from_receiveLines;
while (*cur) delete [] *cur++;
delete [] ptr_from_receiveLines;
}
unsigned NetClient::sendString(const std::string &s) throw(const SocketException &)
{
return sendData(s.data(), s.length());
}
#ifdef TESTNETCLIENT
#ifdef WIN32
# include <io.h>
#endif
#include <stdio.h>
#include <string>
int main(void)
{
char buf[2048];
int nread;
unsigned nsent;
try {
NetClient c("10.10.10.87", 3333);
c.setSocketOption(Socket::TCPNoDelay, true);
if (!c.connect()) {
std::string err = c.errorReason();
fprintf(stderr, "Error connecting: %s\n", err.c_str());
return 1;
}
while ( ( nread = ::read(::fileno(stdin), buf, sizeof(buf)) ) >= 0 ) {
if (nread >= (int)sizeof(buf)) nread = sizeof(buf)-1;
buf[nread] = 0;
nsent = c.sendString(buf);
fprintf(stderr, "Sent %u\n", nsent);
char **lines = c.receiveLines(), **cur;
for (cur = lines; *cur; cur++)
fprintf(stderr, "got: %s\n", *cur);
NetClient::deleteReceivedLines(lines);
}
} catch (const ConnectionClosed & e) {
fprintf(stderr, "Connection closed. (%s)\n", e.why().c_str());
return 2;
} catch (const SocketException & e) {
fprintf(stderr, "Caught exception.. (%s)\n", e.why().c_str());
return 1;
}
return 0;
}
#endif
| [
"jonathbs@usc.edu"
] | jonathbs@usc.edu |
a8f9b6c28ebd5002d702603fc7458b01ac617971 | b3287cda4d87f652756cd17826ad0ec1df4afb42 | /Object-Oriented Programming/Lab12/firstpage.h | 22f97034a1e0aa330c3e05aaae53dbf3d74612be | [] | no_license | skiry/University | 52e0eab4d18d6623250ac3b3588822aebe278844 | 1ad8f02eca0f8876f7436283c4637ae594cf40b9 | refs/heads/master | 2022-12-24T11:00:53.304614 | 2020-06-16T17:23:03 | 2020-06-16T17:23:03 | 116,440,486 | 0 | 0 | null | 2022-12-10T16:05:40 | 2018-01-06T00:29:33 | Python | UTF-8 | C++ | false | false | 825 | h | #ifndef FIRSTPAGE_H
#define FIRSTPAGE_H
#include <QDialog>
#include <QVBoxLayout>
#include <QRadioButton>
#include <QWidget>
#include <QGroupBox>
#include <QPushButton>
#include <QPalette>
#include "fileplaylist.h"
#include "mainwindow.h"
#include "usermode.h"
namespace Ui
{
class FirstPage;
}
class FirstPage : public QDialog
{
Q_OBJECT
public:
explicit FirstPage(QWidget *parent = 0);
void init();
void gui();
void connectSS();
~FirstPage();
private slots:
void start();
private:
Ui::FirstPage *ui;
QWidget* wdg;
QHBoxLayout* main;
QVBoxLayout* userType, * fileType, *last;
QRadioButton* adm, *usr, *csv, *html;
QGroupBox* grOne, *grTwo;
QPushButton* done;
QPalette pal;
FilePlaylist* p;
MainWindow* mw;
userMode* um;
};
#endif // FIRSTPAGE_H
| [
"skiry@localhost.localdomain"
] | skiry@localhost.localdomain |
07d2fd097917acfa3aef566a30be98f94ed8d4bc | 037440687e80d95f72a71edd563d9d2468e132d3 | /shapes/Cylinder.h | 0034c3011267f116779d197c9ca4a30f2f360902 | [] | no_license | linbojun/CG-Project | 9e62d07fa744ec4da94732fe97b7441a11691b84 | 2d9c76d1b86eac1204bdcb13b2f30d9664c2c53d | refs/heads/master | 2023-03-20T20:03:58.589479 | 2020-11-26T00:15:21 | 2020-11-26T00:15:21 | 345,007,623 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 304 | h | #ifndef CYLINDER_H
#define CYLINDER_H
#include "Shape.h"
class Cylinder : public Shape
{
public :
Cylinder();
Cylinder(int p1, int p2);
~Cylinder();
private:
void create_vertex_data();
void create_cycle(float y_axis, bool face_top);
int mesh_size;
int side_size;
};
#endif
| [
"blin@iastate.edu"
] | blin@iastate.edu |
85d43c36a53ba0361ae4a206fadb8db23b3935dd | 6ca55659d3807a60d06d5294d5483c7db0d3284c | /Temp/StagingArea/Data/il2cppOutput/Bulk_UnityEngine.UIModule_0.cpp | 3fe76ff242f9827fdd3bce8a24c621c755dd0762 | [] | no_license | JordanSchuetz/PubNub-Unity-Image-Switcher | c59de86604d8f3f6eb1a203c0388d1e09c2fe164 | 1a139b3a81ce5b973f7afbc786245686b33e7ace | refs/heads/master | 2020-03-16T16:26:56.096607 | 2018-05-10T22:51:13 | 2018-05-10T22:51:13 | 132,788,081 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 160,214 | cpp | #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"
// UnityEngine.Canvas
struct Canvas_t3310196443;
// UnityEngine.Behaviour
struct Behaviour_t1437897464;
// UnityEngine.Camera
struct Camera_t4157153871;
// UnityEngine.Material
struct Material_t340375123;
// UnityEngine.Canvas/WillRenderCanvases
struct WillRenderCanvases_t3309123499;
// System.Delegate
struct Delegate_t1188392813;
// System.IAsyncResult
struct IAsyncResult_t767004451;
// System.AsyncCallback
struct AsyncCallback_t3962456242;
// UnityEngine.CanvasGroup
struct CanvasGroup_t4083511760;
// UnityEngine.CanvasRenderer
struct CanvasRenderer_t2598313366;
// UnityEngine.Texture
struct Texture_t3661962703;
// UnityEngine.Mesh
struct Mesh_t3648964284;
// System.Collections.Generic.List`1<UnityEngine.UIVertex>
struct List_1_t1234605051;
// System.Collections.Generic.List`1<UnityEngine.Vector3>
struct List_1_t899420910;
// System.Collections.Generic.List`1<UnityEngine.Color32>
struct List_1_t4072576034;
// System.Collections.Generic.List`1<UnityEngine.Vector2>
struct List_1_t3628304265;
// System.Collections.Generic.List`1<UnityEngine.Vector4>
struct List_1_t496136383;
// System.Collections.Generic.List`1<System.Int32>
struct List_1_t128053199;
// UnityEngine.RectTransform
struct RectTransform_t3704657025;
// UnityEngine.Transform
struct Transform_t3600365921;
// UnityEngine.Object
struct Object_t631007953;
// System.String
struct String_t;
// UnityEngine.UIVertex[]
struct UIVertexU5BU5D_t1981460040;
// UnityEngine.Vector3[]
struct Vector3U5BU5D_t1718750761;
// UnityEngine.Color32[]
struct Color32U5BU5D_t3850468773;
// UnityEngine.Vector2[]
struct Vector2U5BU5D_t1457185986;
// UnityEngine.Vector4[]
struct Vector4U5BU5D_t934056436;
// System.Int32[]
struct Int32U5BU5D_t385246372;
// System.Char[]
struct CharU5BU5D_t3528271667;
// System.Void
struct Void_t1185182177;
// System.Reflection.MethodInfo
struct MethodInfo_t;
// System.DelegateData
struct DelegateData_t1677132599;
// UnityEngine.Camera/CameraCallback
struct CameraCallback_t190067161;
// UnityEngine.RectTransform/ReapplyDrivenProperties
struct ReapplyDrivenProperties_t1258266594;
extern RuntimeClass* Canvas_t3310196443_il2cpp_TypeInfo_var;
extern RuntimeClass* WillRenderCanvases_t3309123499_il2cpp_TypeInfo_var;
extern const uint32_t Canvas_add_willRenderCanvases_m1234571137_MetadataUsageId;
extern const uint32_t Canvas_remove_willRenderCanvases_m3663577790_MetadataUsageId;
extern const uint32_t Canvas_SendWillRenderCanvases_m4288867005_MetadataUsageId;
extern RuntimeClass* RectTransformUtility_t1743242446_il2cpp_TypeInfo_var;
extern const uint32_t RectTransformUtility_RectangleContainsScreenPoint_m4031431712_MetadataUsageId;
extern const uint32_t RectTransformUtility_PixelAdjustPoint_m1850521440_MetadataUsageId;
extern const uint32_t RectTransformUtility_PixelAdjustRect_m1716244231_MetadataUsageId;
extern RuntimeClass* Vector2_t2156229523_il2cpp_TypeInfo_var;
extern RuntimeClass* Vector3_t3722313464_il2cpp_TypeInfo_var;
extern RuntimeClass* Quaternion_t2301928331_il2cpp_TypeInfo_var;
extern const uint32_t RectTransformUtility_ScreenPointToWorldPointInRectangle_m1761902807_MetadataUsageId;
extern const uint32_t RectTransformUtility_ScreenPointToLocalPointInRectangle_m2327269187_MetadataUsageId;
extern RuntimeClass* Object_t631007953_il2cpp_TypeInfo_var;
extern const uint32_t RectTransformUtility_ScreenPointToRay_m85042072_MetadataUsageId;
extern RuntimeClass* RectTransform_t3704657025_il2cpp_TypeInfo_var;
extern const uint32_t RectTransformUtility_FlipLayoutOnAxis_m2606646065_MetadataUsageId;
extern const uint32_t RectTransformUtility_FlipLayoutAxes_m2526204952_MetadataUsageId;
extern RuntimeClass* Vector3U5BU5D_t1718750761_il2cpp_TypeInfo_var;
extern const uint32_t RectTransformUtility__cctor_m1529820864_MetadataUsageId;
struct Vector3U5BU5D_t1718750761;
#ifndef U3CMODULEU3E_T692745539_H
#define U3CMODULEU3E_T692745539_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// <Module>
struct U3CModuleU3E_t692745539
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // U3CMODULEU3E_T692745539_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
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 UISYSTEMPROFILERAPI_T2230074258_H
#define UISYSTEMPROFILERAPI_T2230074258_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UISystemProfilerApi
struct UISystemProfilerApi_t2230074258 : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // UISYSTEMPROFILERAPI_T2230074258_H
#ifndef LIST_1_T1234605051_H
#define LIST_1_T1234605051_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Collections.Generic.List`1<UnityEngine.UIVertex>
struct List_1_t1234605051 : public RuntimeObject
{
public:
// T[] System.Collections.Generic.List`1::_items
UIVertexU5BU5D_t1981460040* ____items_1;
// System.Int32 System.Collections.Generic.List`1::_size
int32_t ____size_2;
// System.Int32 System.Collections.Generic.List`1::_version
int32_t ____version_3;
public:
inline static int32_t get_offset_of__items_1() { return static_cast<int32_t>(offsetof(List_1_t1234605051, ____items_1)); }
inline UIVertexU5BU5D_t1981460040* get__items_1() const { return ____items_1; }
inline UIVertexU5BU5D_t1981460040** get_address_of__items_1() { return &____items_1; }
inline void set__items_1(UIVertexU5BU5D_t1981460040* value)
{
____items_1 = value;
Il2CppCodeGenWriteBarrier((&____items_1), value);
}
inline static int32_t get_offset_of__size_2() { return static_cast<int32_t>(offsetof(List_1_t1234605051, ____size_2)); }
inline int32_t get__size_2() const { return ____size_2; }
inline int32_t* get_address_of__size_2() { return &____size_2; }
inline void set__size_2(int32_t value)
{
____size_2 = value;
}
inline static int32_t get_offset_of__version_3() { return static_cast<int32_t>(offsetof(List_1_t1234605051, ____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;
}
};
struct List_1_t1234605051_StaticFields
{
public:
// T[] System.Collections.Generic.List`1::EmptyArray
UIVertexU5BU5D_t1981460040* ___EmptyArray_4;
public:
inline static int32_t get_offset_of_EmptyArray_4() { return static_cast<int32_t>(offsetof(List_1_t1234605051_StaticFields, ___EmptyArray_4)); }
inline UIVertexU5BU5D_t1981460040* get_EmptyArray_4() const { return ___EmptyArray_4; }
inline UIVertexU5BU5D_t1981460040** get_address_of_EmptyArray_4() { return &___EmptyArray_4; }
inline void set_EmptyArray_4(UIVertexU5BU5D_t1981460040* value)
{
___EmptyArray_4 = value;
Il2CppCodeGenWriteBarrier((&___EmptyArray_4), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // LIST_1_T1234605051_H
#ifndef LIST_1_T899420910_H
#define LIST_1_T899420910_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Collections.Generic.List`1<UnityEngine.Vector3>
struct List_1_t899420910 : public RuntimeObject
{
public:
// T[] System.Collections.Generic.List`1::_items
Vector3U5BU5D_t1718750761* ____items_1;
// System.Int32 System.Collections.Generic.List`1::_size
int32_t ____size_2;
// System.Int32 System.Collections.Generic.List`1::_version
int32_t ____version_3;
public:
inline static int32_t get_offset_of__items_1() { return static_cast<int32_t>(offsetof(List_1_t899420910, ____items_1)); }
inline Vector3U5BU5D_t1718750761* get__items_1() const { return ____items_1; }
inline Vector3U5BU5D_t1718750761** get_address_of__items_1() { return &____items_1; }
inline void set__items_1(Vector3U5BU5D_t1718750761* value)
{
____items_1 = value;
Il2CppCodeGenWriteBarrier((&____items_1), value);
}
inline static int32_t get_offset_of__size_2() { return static_cast<int32_t>(offsetof(List_1_t899420910, ____size_2)); }
inline int32_t get__size_2() const { return ____size_2; }
inline int32_t* get_address_of__size_2() { return &____size_2; }
inline void set__size_2(int32_t value)
{
____size_2 = value;
}
inline static int32_t get_offset_of__version_3() { return static_cast<int32_t>(offsetof(List_1_t899420910, ____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;
}
};
struct List_1_t899420910_StaticFields
{
public:
// T[] System.Collections.Generic.List`1::EmptyArray
Vector3U5BU5D_t1718750761* ___EmptyArray_4;
public:
inline static int32_t get_offset_of_EmptyArray_4() { return static_cast<int32_t>(offsetof(List_1_t899420910_StaticFields, ___EmptyArray_4)); }
inline Vector3U5BU5D_t1718750761* get_EmptyArray_4() const { return ___EmptyArray_4; }
inline Vector3U5BU5D_t1718750761** get_address_of_EmptyArray_4() { return &___EmptyArray_4; }
inline void set_EmptyArray_4(Vector3U5BU5D_t1718750761* value)
{
___EmptyArray_4 = value;
Il2CppCodeGenWriteBarrier((&___EmptyArray_4), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // LIST_1_T899420910_H
#ifndef LIST_1_T4072576034_H
#define LIST_1_T4072576034_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Collections.Generic.List`1<UnityEngine.Color32>
struct List_1_t4072576034 : public RuntimeObject
{
public:
// T[] System.Collections.Generic.List`1::_items
Color32U5BU5D_t3850468773* ____items_1;
// System.Int32 System.Collections.Generic.List`1::_size
int32_t ____size_2;
// System.Int32 System.Collections.Generic.List`1::_version
int32_t ____version_3;
public:
inline static int32_t get_offset_of__items_1() { return static_cast<int32_t>(offsetof(List_1_t4072576034, ____items_1)); }
inline Color32U5BU5D_t3850468773* get__items_1() const { return ____items_1; }
inline Color32U5BU5D_t3850468773** get_address_of__items_1() { return &____items_1; }
inline void set__items_1(Color32U5BU5D_t3850468773* value)
{
____items_1 = value;
Il2CppCodeGenWriteBarrier((&____items_1), value);
}
inline static int32_t get_offset_of__size_2() { return static_cast<int32_t>(offsetof(List_1_t4072576034, ____size_2)); }
inline int32_t get__size_2() const { return ____size_2; }
inline int32_t* get_address_of__size_2() { return &____size_2; }
inline void set__size_2(int32_t value)
{
____size_2 = value;
}
inline static int32_t get_offset_of__version_3() { return static_cast<int32_t>(offsetof(List_1_t4072576034, ____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;
}
};
struct List_1_t4072576034_StaticFields
{
public:
// T[] System.Collections.Generic.List`1::EmptyArray
Color32U5BU5D_t3850468773* ___EmptyArray_4;
public:
inline static int32_t get_offset_of_EmptyArray_4() { return static_cast<int32_t>(offsetof(List_1_t4072576034_StaticFields, ___EmptyArray_4)); }
inline Color32U5BU5D_t3850468773* get_EmptyArray_4() const { return ___EmptyArray_4; }
inline Color32U5BU5D_t3850468773** get_address_of_EmptyArray_4() { return &___EmptyArray_4; }
inline void set_EmptyArray_4(Color32U5BU5D_t3850468773* value)
{
___EmptyArray_4 = value;
Il2CppCodeGenWriteBarrier((&___EmptyArray_4), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // LIST_1_T4072576034_H
#ifndef LIST_1_T3628304265_H
#define LIST_1_T3628304265_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Collections.Generic.List`1<UnityEngine.Vector2>
struct List_1_t3628304265 : public RuntimeObject
{
public:
// T[] System.Collections.Generic.List`1::_items
Vector2U5BU5D_t1457185986* ____items_1;
// System.Int32 System.Collections.Generic.List`1::_size
int32_t ____size_2;
// System.Int32 System.Collections.Generic.List`1::_version
int32_t ____version_3;
public:
inline static int32_t get_offset_of__items_1() { return static_cast<int32_t>(offsetof(List_1_t3628304265, ____items_1)); }
inline Vector2U5BU5D_t1457185986* get__items_1() const { return ____items_1; }
inline Vector2U5BU5D_t1457185986** get_address_of__items_1() { return &____items_1; }
inline void set__items_1(Vector2U5BU5D_t1457185986* value)
{
____items_1 = value;
Il2CppCodeGenWriteBarrier((&____items_1), value);
}
inline static int32_t get_offset_of__size_2() { return static_cast<int32_t>(offsetof(List_1_t3628304265, ____size_2)); }
inline int32_t get__size_2() const { return ____size_2; }
inline int32_t* get_address_of__size_2() { return &____size_2; }
inline void set__size_2(int32_t value)
{
____size_2 = value;
}
inline static int32_t get_offset_of__version_3() { return static_cast<int32_t>(offsetof(List_1_t3628304265, ____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;
}
};
struct List_1_t3628304265_StaticFields
{
public:
// T[] System.Collections.Generic.List`1::EmptyArray
Vector2U5BU5D_t1457185986* ___EmptyArray_4;
public:
inline static int32_t get_offset_of_EmptyArray_4() { return static_cast<int32_t>(offsetof(List_1_t3628304265_StaticFields, ___EmptyArray_4)); }
inline Vector2U5BU5D_t1457185986* get_EmptyArray_4() const { return ___EmptyArray_4; }
inline Vector2U5BU5D_t1457185986** get_address_of_EmptyArray_4() { return &___EmptyArray_4; }
inline void set_EmptyArray_4(Vector2U5BU5D_t1457185986* value)
{
___EmptyArray_4 = value;
Il2CppCodeGenWriteBarrier((&___EmptyArray_4), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // LIST_1_T3628304265_H
#ifndef LIST_1_T496136383_H
#define LIST_1_T496136383_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Collections.Generic.List`1<UnityEngine.Vector4>
struct List_1_t496136383 : public RuntimeObject
{
public:
// T[] System.Collections.Generic.List`1::_items
Vector4U5BU5D_t934056436* ____items_1;
// System.Int32 System.Collections.Generic.List`1::_size
int32_t ____size_2;
// System.Int32 System.Collections.Generic.List`1::_version
int32_t ____version_3;
public:
inline static int32_t get_offset_of__items_1() { return static_cast<int32_t>(offsetof(List_1_t496136383, ____items_1)); }
inline Vector4U5BU5D_t934056436* get__items_1() const { return ____items_1; }
inline Vector4U5BU5D_t934056436** get_address_of__items_1() { return &____items_1; }
inline void set__items_1(Vector4U5BU5D_t934056436* value)
{
____items_1 = value;
Il2CppCodeGenWriteBarrier((&____items_1), value);
}
inline static int32_t get_offset_of__size_2() { return static_cast<int32_t>(offsetof(List_1_t496136383, ____size_2)); }
inline int32_t get__size_2() const { return ____size_2; }
inline int32_t* get_address_of__size_2() { return &____size_2; }
inline void set__size_2(int32_t value)
{
____size_2 = value;
}
inline static int32_t get_offset_of__version_3() { return static_cast<int32_t>(offsetof(List_1_t496136383, ____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;
}
};
struct List_1_t496136383_StaticFields
{
public:
// T[] System.Collections.Generic.List`1::EmptyArray
Vector4U5BU5D_t934056436* ___EmptyArray_4;
public:
inline static int32_t get_offset_of_EmptyArray_4() { return static_cast<int32_t>(offsetof(List_1_t496136383_StaticFields, ___EmptyArray_4)); }
inline Vector4U5BU5D_t934056436* get_EmptyArray_4() const { return ___EmptyArray_4; }
inline Vector4U5BU5D_t934056436** get_address_of_EmptyArray_4() { return &___EmptyArray_4; }
inline void set_EmptyArray_4(Vector4U5BU5D_t934056436* value)
{
___EmptyArray_4 = value;
Il2CppCodeGenWriteBarrier((&___EmptyArray_4), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // LIST_1_T496136383_H
#ifndef LIST_1_T128053199_H
#define LIST_1_T128053199_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Collections.Generic.List`1<System.Int32>
struct List_1_t128053199 : public RuntimeObject
{
public:
// T[] System.Collections.Generic.List`1::_items
Int32U5BU5D_t385246372* ____items_1;
// System.Int32 System.Collections.Generic.List`1::_size
int32_t ____size_2;
// System.Int32 System.Collections.Generic.List`1::_version
int32_t ____version_3;
public:
inline static int32_t get_offset_of__items_1() { return static_cast<int32_t>(offsetof(List_1_t128053199, ____items_1)); }
inline Int32U5BU5D_t385246372* get__items_1() const { return ____items_1; }
inline Int32U5BU5D_t385246372** get_address_of__items_1() { return &____items_1; }
inline void set__items_1(Int32U5BU5D_t385246372* value)
{
____items_1 = value;
Il2CppCodeGenWriteBarrier((&____items_1), value);
}
inline static int32_t get_offset_of__size_2() { return static_cast<int32_t>(offsetof(List_1_t128053199, ____size_2)); }
inline int32_t get__size_2() const { return ____size_2; }
inline int32_t* get_address_of__size_2() { return &____size_2; }
inline void set__size_2(int32_t value)
{
____size_2 = value;
}
inline static int32_t get_offset_of__version_3() { return static_cast<int32_t>(offsetof(List_1_t128053199, ____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;
}
};
struct List_1_t128053199_StaticFields
{
public:
// T[] System.Collections.Generic.List`1::EmptyArray
Int32U5BU5D_t385246372* ___EmptyArray_4;
public:
inline static int32_t get_offset_of_EmptyArray_4() { return static_cast<int32_t>(offsetof(List_1_t128053199_StaticFields, ___EmptyArray_4)); }
inline Int32U5BU5D_t385246372* get_EmptyArray_4() const { return ___EmptyArray_4; }
inline Int32U5BU5D_t385246372** get_address_of_EmptyArray_4() { return &___EmptyArray_4; }
inline void set_EmptyArray_4(Int32U5BU5D_t385246372* value)
{
___EmptyArray_4 = value;
Il2CppCodeGenWriteBarrier((&___EmptyArray_4), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // LIST_1_T128053199_H
#ifndef RECTTRANSFORMUTILITY_T1743242446_H
#define RECTTRANSFORMUTILITY_T1743242446_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.RectTransformUtility
struct RectTransformUtility_t1743242446 : public RuntimeObject
{
public:
public:
};
struct RectTransformUtility_t1743242446_StaticFields
{
public:
// UnityEngine.Vector3[] UnityEngine.RectTransformUtility::s_Corners
Vector3U5BU5D_t1718750761* ___s_Corners_0;
public:
inline static int32_t get_offset_of_s_Corners_0() { return static_cast<int32_t>(offsetof(RectTransformUtility_t1743242446_StaticFields, ___s_Corners_0)); }
inline Vector3U5BU5D_t1718750761* get_s_Corners_0() const { return ___s_Corners_0; }
inline Vector3U5BU5D_t1718750761** get_address_of_s_Corners_0() { return &___s_Corners_0; }
inline void set_s_Corners_0(Vector3U5BU5D_t1718750761* value)
{
___s_Corners_0 = value;
Il2CppCodeGenWriteBarrier((&___s_Corners_0), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RECTTRANSFORMUTILITY_T1743242446_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::length
int32_t ___length_0;
// System.Char System.String::start_char
Il2CppChar ___start_char_1;
public:
inline static int32_t get_offset_of_length_0() { return static_cast<int32_t>(offsetof(String_t, ___length_0)); }
inline int32_t get_length_0() const { return ___length_0; }
inline int32_t* get_address_of_length_0() { return &___length_0; }
inline void set_length_0(int32_t value)
{
___length_0 = value;
}
inline static int32_t get_offset_of_start_char_1() { return static_cast<int32_t>(offsetof(String_t, ___start_char_1)); }
inline Il2CppChar get_start_char_1() const { return ___start_char_1; }
inline Il2CppChar* get_address_of_start_char_1() { return &___start_char_1; }
inline void set_start_char_1(Il2CppChar value)
{
___start_char_1 = value;
}
};
struct String_t_StaticFields
{
public:
// System.String System.String::Empty
String_t* ___Empty_2;
// System.Char[] System.String::WhiteChars
CharU5BU5D_t3528271667* ___WhiteChars_3;
public:
inline static int32_t get_offset_of_Empty_2() { return static_cast<int32_t>(offsetof(String_t_StaticFields, ___Empty_2)); }
inline String_t* get_Empty_2() const { return ___Empty_2; }
inline String_t** get_address_of_Empty_2() { return &___Empty_2; }
inline void set_Empty_2(String_t* value)
{
___Empty_2 = value;
Il2CppCodeGenWriteBarrier((&___Empty_2), value);
}
inline static int32_t get_offset_of_WhiteChars_3() { return static_cast<int32_t>(offsetof(String_t_StaticFields, ___WhiteChars_3)); }
inline CharU5BU5D_t3528271667* get_WhiteChars_3() const { return ___WhiteChars_3; }
inline CharU5BU5D_t3528271667** get_address_of_WhiteChars_3() { return &___WhiteChars_3; }
inline void set_WhiteChars_3(CharU5BU5D_t3528271667* value)
{
___WhiteChars_3 = value;
Il2CppCodeGenWriteBarrier((&___WhiteChars_3), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // STRING_T_H
#ifndef SINGLE_T1397266774_H
#define SINGLE_T1397266774_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Single
struct Single_t1397266774
{
public:
// System.Single System.Single::m_value
float ___m_value_7;
public:
inline static int32_t get_offset_of_m_value_7() { return static_cast<int32_t>(offsetof(Single_t1397266774, ___m_value_7)); }
inline float get_m_value_7() const { return ___m_value_7; }
inline float* get_address_of_m_value_7() { return &___m_value_7; }
inline void set_m_value_7(float value)
{
___m_value_7 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SINGLE_T1397266774_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_2;
public:
inline static int32_t get_offset_of_m_value_2() { return static_cast<int32_t>(offsetof(Boolean_t97287965, ___m_value_2)); }
inline bool get_m_value_2() const { return ___m_value_2; }
inline bool* get_address_of_m_value_2() { return &___m_value_2; }
inline void set_m_value_2(bool value)
{
___m_value_2 = value;
}
};
struct Boolean_t97287965_StaticFields
{
public:
// System.String System.Boolean::FalseString
String_t* ___FalseString_0;
// System.String System.Boolean::TrueString
String_t* ___TrueString_1;
public:
inline static int32_t get_offset_of_FalseString_0() { return static_cast<int32_t>(offsetof(Boolean_t97287965_StaticFields, ___FalseString_0)); }
inline String_t* get_FalseString_0() const { return ___FalseString_0; }
inline String_t** get_address_of_FalseString_0() { return &___FalseString_0; }
inline void set_FalseString_0(String_t* value)
{
___FalseString_0 = value;
Il2CppCodeGenWriteBarrier((&___FalseString_0), value);
}
inline static int32_t get_offset_of_TrueString_1() { return static_cast<int32_t>(offsetof(Boolean_t97287965_StaticFields, ___TrueString_1)); }
inline String_t* get_TrueString_1() const { return ___TrueString_1; }
inline String_t** get_address_of_TrueString_1() { return &___TrueString_1; }
inline void set_TrueString_1(String_t* value)
{
___TrueString_1 = value;
Il2CppCodeGenWriteBarrier((&___TrueString_1), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // BOOLEAN_T97287965_H
#ifndef RECT_T2360479859_H
#define RECT_T2360479859_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Rect
struct Rect_t2360479859
{
public:
// System.Single UnityEngine.Rect::m_XMin
float ___m_XMin_0;
// System.Single UnityEngine.Rect::m_YMin
float ___m_YMin_1;
// System.Single UnityEngine.Rect::m_Width
float ___m_Width_2;
// System.Single UnityEngine.Rect::m_Height
float ___m_Height_3;
public:
inline static int32_t get_offset_of_m_XMin_0() { return static_cast<int32_t>(offsetof(Rect_t2360479859, ___m_XMin_0)); }
inline float get_m_XMin_0() const { return ___m_XMin_0; }
inline float* get_address_of_m_XMin_0() { return &___m_XMin_0; }
inline void set_m_XMin_0(float value)
{
___m_XMin_0 = value;
}
inline static int32_t get_offset_of_m_YMin_1() { return static_cast<int32_t>(offsetof(Rect_t2360479859, ___m_YMin_1)); }
inline float get_m_YMin_1() const { return ___m_YMin_1; }
inline float* get_address_of_m_YMin_1() { return &___m_YMin_1; }
inline void set_m_YMin_1(float value)
{
___m_YMin_1 = value;
}
inline static int32_t get_offset_of_m_Width_2() { return static_cast<int32_t>(offsetof(Rect_t2360479859, ___m_Width_2)); }
inline float get_m_Width_2() const { return ___m_Width_2; }
inline float* get_address_of_m_Width_2() { return &___m_Width_2; }
inline void set_m_Width_2(float value)
{
___m_Width_2 = value;
}
inline static int32_t get_offset_of_m_Height_3() { return static_cast<int32_t>(offsetof(Rect_t2360479859, ___m_Height_3)); }
inline float get_m_Height_3() const { return ___m_Height_3; }
inline float* get_address_of_m_Height_3() { return &___m_Height_3; }
inline void set_m_Height_3(float value)
{
___m_Height_3 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RECT_T2360479859_H
#ifndef COLOR_T2555686324_H
#define COLOR_T2555686324_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Color
struct Color_t2555686324
{
public:
// System.Single UnityEngine.Color::r
float ___r_0;
// System.Single UnityEngine.Color::g
float ___g_1;
// System.Single UnityEngine.Color::b
float ___b_2;
// System.Single UnityEngine.Color::a
float ___a_3;
public:
inline static int32_t get_offset_of_r_0() { return static_cast<int32_t>(offsetof(Color_t2555686324, ___r_0)); }
inline float get_r_0() const { return ___r_0; }
inline float* get_address_of_r_0() { return &___r_0; }
inline void set_r_0(float value)
{
___r_0 = value;
}
inline static int32_t get_offset_of_g_1() { return static_cast<int32_t>(offsetof(Color_t2555686324, ___g_1)); }
inline float get_g_1() const { return ___g_1; }
inline float* get_address_of_g_1() { return &___g_1; }
inline void set_g_1(float value)
{
___g_1 = value;
}
inline static int32_t get_offset_of_b_2() { return static_cast<int32_t>(offsetof(Color_t2555686324, ___b_2)); }
inline float get_b_2() const { return ___b_2; }
inline float* get_address_of_b_2() { return &___b_2; }
inline void set_b_2(float value)
{
___b_2 = value;
}
inline static int32_t get_offset_of_a_3() { return static_cast<int32_t>(offsetof(Color_t2555686324, ___a_3)); }
inline float get_a_3() const { return ___a_3; }
inline float* get_address_of_a_3() { return &___a_3; }
inline void set_a_3(float value)
{
___a_3 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // COLOR_T2555686324_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:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // VOID_T1185182177_H
#ifndef VECTOR3_T3722313464_H
#define VECTOR3_T3722313464_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Vector3
struct Vector3_t3722313464
{
public:
// System.Single UnityEngine.Vector3::x
float ___x_1;
// System.Single UnityEngine.Vector3::y
float ___y_2;
// System.Single UnityEngine.Vector3::z
float ___z_3;
public:
inline static int32_t get_offset_of_x_1() { return static_cast<int32_t>(offsetof(Vector3_t3722313464, ___x_1)); }
inline float get_x_1() const { return ___x_1; }
inline float* get_address_of_x_1() { return &___x_1; }
inline void set_x_1(float value)
{
___x_1 = value;
}
inline static int32_t get_offset_of_y_2() { return static_cast<int32_t>(offsetof(Vector3_t3722313464, ___y_2)); }
inline float get_y_2() const { return ___y_2; }
inline float* get_address_of_y_2() { return &___y_2; }
inline void set_y_2(float value)
{
___y_2 = value;
}
inline static int32_t get_offset_of_z_3() { return static_cast<int32_t>(offsetof(Vector3_t3722313464, ___z_3)); }
inline float get_z_3() const { return ___z_3; }
inline float* get_address_of_z_3() { return &___z_3; }
inline void set_z_3(float value)
{
___z_3 = value;
}
};
struct Vector3_t3722313464_StaticFields
{
public:
// UnityEngine.Vector3 UnityEngine.Vector3::zeroVector
Vector3_t3722313464 ___zeroVector_4;
// UnityEngine.Vector3 UnityEngine.Vector3::oneVector
Vector3_t3722313464 ___oneVector_5;
// UnityEngine.Vector3 UnityEngine.Vector3::upVector
Vector3_t3722313464 ___upVector_6;
// UnityEngine.Vector3 UnityEngine.Vector3::downVector
Vector3_t3722313464 ___downVector_7;
// UnityEngine.Vector3 UnityEngine.Vector3::leftVector
Vector3_t3722313464 ___leftVector_8;
// UnityEngine.Vector3 UnityEngine.Vector3::rightVector
Vector3_t3722313464 ___rightVector_9;
// UnityEngine.Vector3 UnityEngine.Vector3::forwardVector
Vector3_t3722313464 ___forwardVector_10;
// UnityEngine.Vector3 UnityEngine.Vector3::backVector
Vector3_t3722313464 ___backVector_11;
// UnityEngine.Vector3 UnityEngine.Vector3::positiveInfinityVector
Vector3_t3722313464 ___positiveInfinityVector_12;
// UnityEngine.Vector3 UnityEngine.Vector3::negativeInfinityVector
Vector3_t3722313464 ___negativeInfinityVector_13;
public:
inline static int32_t get_offset_of_zeroVector_4() { return static_cast<int32_t>(offsetof(Vector3_t3722313464_StaticFields, ___zeroVector_4)); }
inline Vector3_t3722313464 get_zeroVector_4() const { return ___zeroVector_4; }
inline Vector3_t3722313464 * get_address_of_zeroVector_4() { return &___zeroVector_4; }
inline void set_zeroVector_4(Vector3_t3722313464 value)
{
___zeroVector_4 = value;
}
inline static int32_t get_offset_of_oneVector_5() { return static_cast<int32_t>(offsetof(Vector3_t3722313464_StaticFields, ___oneVector_5)); }
inline Vector3_t3722313464 get_oneVector_5() const { return ___oneVector_5; }
inline Vector3_t3722313464 * get_address_of_oneVector_5() { return &___oneVector_5; }
inline void set_oneVector_5(Vector3_t3722313464 value)
{
___oneVector_5 = value;
}
inline static int32_t get_offset_of_upVector_6() { return static_cast<int32_t>(offsetof(Vector3_t3722313464_StaticFields, ___upVector_6)); }
inline Vector3_t3722313464 get_upVector_6() const { return ___upVector_6; }
inline Vector3_t3722313464 * get_address_of_upVector_6() { return &___upVector_6; }
inline void set_upVector_6(Vector3_t3722313464 value)
{
___upVector_6 = value;
}
inline static int32_t get_offset_of_downVector_7() { return static_cast<int32_t>(offsetof(Vector3_t3722313464_StaticFields, ___downVector_7)); }
inline Vector3_t3722313464 get_downVector_7() const { return ___downVector_7; }
inline Vector3_t3722313464 * get_address_of_downVector_7() { return &___downVector_7; }
inline void set_downVector_7(Vector3_t3722313464 value)
{
___downVector_7 = value;
}
inline static int32_t get_offset_of_leftVector_8() { return static_cast<int32_t>(offsetof(Vector3_t3722313464_StaticFields, ___leftVector_8)); }
inline Vector3_t3722313464 get_leftVector_8() const { return ___leftVector_8; }
inline Vector3_t3722313464 * get_address_of_leftVector_8() { return &___leftVector_8; }
inline void set_leftVector_8(Vector3_t3722313464 value)
{
___leftVector_8 = value;
}
inline static int32_t get_offset_of_rightVector_9() { return static_cast<int32_t>(offsetof(Vector3_t3722313464_StaticFields, ___rightVector_9)); }
inline Vector3_t3722313464 get_rightVector_9() const { return ___rightVector_9; }
inline Vector3_t3722313464 * get_address_of_rightVector_9() { return &___rightVector_9; }
inline void set_rightVector_9(Vector3_t3722313464 value)
{
___rightVector_9 = value;
}
inline static int32_t get_offset_of_forwardVector_10() { return static_cast<int32_t>(offsetof(Vector3_t3722313464_StaticFields, ___forwardVector_10)); }
inline Vector3_t3722313464 get_forwardVector_10() const { return ___forwardVector_10; }
inline Vector3_t3722313464 * get_address_of_forwardVector_10() { return &___forwardVector_10; }
inline void set_forwardVector_10(Vector3_t3722313464 value)
{
___forwardVector_10 = value;
}
inline static int32_t get_offset_of_backVector_11() { return static_cast<int32_t>(offsetof(Vector3_t3722313464_StaticFields, ___backVector_11)); }
inline Vector3_t3722313464 get_backVector_11() const { return ___backVector_11; }
inline Vector3_t3722313464 * get_address_of_backVector_11() { return &___backVector_11; }
inline void set_backVector_11(Vector3_t3722313464 value)
{
___backVector_11 = value;
}
inline static int32_t get_offset_of_positiveInfinityVector_12() { return static_cast<int32_t>(offsetof(Vector3_t3722313464_StaticFields, ___positiveInfinityVector_12)); }
inline Vector3_t3722313464 get_positiveInfinityVector_12() const { return ___positiveInfinityVector_12; }
inline Vector3_t3722313464 * get_address_of_positiveInfinityVector_12() { return &___positiveInfinityVector_12; }
inline void set_positiveInfinityVector_12(Vector3_t3722313464 value)
{
___positiveInfinityVector_12 = value;
}
inline static int32_t get_offset_of_negativeInfinityVector_13() { return static_cast<int32_t>(offsetof(Vector3_t3722313464_StaticFields, ___negativeInfinityVector_13)); }
inline Vector3_t3722313464 get_negativeInfinityVector_13() const { return ___negativeInfinityVector_13; }
inline Vector3_t3722313464 * get_address_of_negativeInfinityVector_13() { return &___negativeInfinityVector_13; }
inline void set_negativeInfinityVector_13(Vector3_t3722313464 value)
{
___negativeInfinityVector_13 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // VECTOR3_T3722313464_H
#ifndef INTPTR_T_H
#define INTPTR_T_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.IntPtr
struct IntPtr_t
{
public:
// System.Void* System.IntPtr::m_value
void* ___m_value_0;
public:
inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(IntPtr_t, ___m_value_0)); }
inline void* get_m_value_0() const { return ___m_value_0; }
inline void** get_address_of_m_value_0() { return &___m_value_0; }
inline void set_m_value_0(void* value)
{
___m_value_0 = value;
}
};
struct IntPtr_t_StaticFields
{
public:
// System.IntPtr System.IntPtr::Zero
intptr_t ___Zero_1;
public:
inline static int32_t get_offset_of_Zero_1() { return static_cast<int32_t>(offsetof(IntPtr_t_StaticFields, ___Zero_1)); }
inline intptr_t get_Zero_1() const { return ___Zero_1; }
inline intptr_t* get_address_of_Zero_1() { return &___Zero_1; }
inline void set_Zero_1(intptr_t value)
{
___Zero_1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // INTPTR_T_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_2;
public:
inline static int32_t get_offset_of_m_value_2() { return static_cast<int32_t>(offsetof(Int32_t2950945753, ___m_value_2)); }
inline int32_t get_m_value_2() const { return ___m_value_2; }
inline int32_t* get_address_of_m_value_2() { return &___m_value_2; }
inline void set_m_value_2(int32_t value)
{
___m_value_2 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // INT32_T2950945753_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::split_char
CharU5BU5D_t3528271667* ___split_char_0;
public:
inline static int32_t get_offset_of_split_char_0() { return static_cast<int32_t>(offsetof(Enum_t4135868527_StaticFields, ___split_char_0)); }
inline CharU5BU5D_t3528271667* get_split_char_0() const { return ___split_char_0; }
inline CharU5BU5D_t3528271667** get_address_of_split_char_0() { return &___split_char_0; }
inline void set_split_char_0(CharU5BU5D_t3528271667* value)
{
___split_char_0 = value;
Il2CppCodeGenWriteBarrier((&___split_char_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 QUATERNION_T2301928331_H
#define QUATERNION_T2301928331_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Quaternion
struct Quaternion_t2301928331
{
public:
// System.Single UnityEngine.Quaternion::x
float ___x_0;
// System.Single UnityEngine.Quaternion::y
float ___y_1;
// System.Single UnityEngine.Quaternion::z
float ___z_2;
// System.Single UnityEngine.Quaternion::w
float ___w_3;
public:
inline static int32_t get_offset_of_x_0() { return static_cast<int32_t>(offsetof(Quaternion_t2301928331, ___x_0)); }
inline float get_x_0() const { return ___x_0; }
inline float* get_address_of_x_0() { return &___x_0; }
inline void set_x_0(float value)
{
___x_0 = value;
}
inline static int32_t get_offset_of_y_1() { return static_cast<int32_t>(offsetof(Quaternion_t2301928331, ___y_1)); }
inline float get_y_1() const { return ___y_1; }
inline float* get_address_of_y_1() { return &___y_1; }
inline void set_y_1(float value)
{
___y_1 = value;
}
inline static int32_t get_offset_of_z_2() { return static_cast<int32_t>(offsetof(Quaternion_t2301928331, ___z_2)); }
inline float get_z_2() const { return ___z_2; }
inline float* get_address_of_z_2() { return &___z_2; }
inline void set_z_2(float value)
{
___z_2 = value;
}
inline static int32_t get_offset_of_w_3() { return static_cast<int32_t>(offsetof(Quaternion_t2301928331, ___w_3)); }
inline float get_w_3() const { return ___w_3; }
inline float* get_address_of_w_3() { return &___w_3; }
inline void set_w_3(float value)
{
___w_3 = value;
}
};
struct Quaternion_t2301928331_StaticFields
{
public:
// UnityEngine.Quaternion UnityEngine.Quaternion::identityQuaternion
Quaternion_t2301928331 ___identityQuaternion_4;
public:
inline static int32_t get_offset_of_identityQuaternion_4() { return static_cast<int32_t>(offsetof(Quaternion_t2301928331_StaticFields, ___identityQuaternion_4)); }
inline Quaternion_t2301928331 get_identityQuaternion_4() const { return ___identityQuaternion_4; }
inline Quaternion_t2301928331 * get_address_of_identityQuaternion_4() { return &___identityQuaternion_4; }
inline void set_identityQuaternion_4(Quaternion_t2301928331 value)
{
___identityQuaternion_4 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // QUATERNION_T2301928331_H
#ifndef VECTOR2_T2156229523_H
#define VECTOR2_T2156229523_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Vector2
struct Vector2_t2156229523
{
public:
// System.Single UnityEngine.Vector2::x
float ___x_0;
// System.Single UnityEngine.Vector2::y
float ___y_1;
public:
inline static int32_t get_offset_of_x_0() { return static_cast<int32_t>(offsetof(Vector2_t2156229523, ___x_0)); }
inline float get_x_0() const { return ___x_0; }
inline float* get_address_of_x_0() { return &___x_0; }
inline void set_x_0(float value)
{
___x_0 = value;
}
inline static int32_t get_offset_of_y_1() { return static_cast<int32_t>(offsetof(Vector2_t2156229523, ___y_1)); }
inline float get_y_1() const { return ___y_1; }
inline float* get_address_of_y_1() { return &___y_1; }
inline void set_y_1(float value)
{
___y_1 = value;
}
};
struct Vector2_t2156229523_StaticFields
{
public:
// UnityEngine.Vector2 UnityEngine.Vector2::zeroVector
Vector2_t2156229523 ___zeroVector_2;
// UnityEngine.Vector2 UnityEngine.Vector2::oneVector
Vector2_t2156229523 ___oneVector_3;
// UnityEngine.Vector2 UnityEngine.Vector2::upVector
Vector2_t2156229523 ___upVector_4;
// UnityEngine.Vector2 UnityEngine.Vector2::downVector
Vector2_t2156229523 ___downVector_5;
// UnityEngine.Vector2 UnityEngine.Vector2::leftVector
Vector2_t2156229523 ___leftVector_6;
// UnityEngine.Vector2 UnityEngine.Vector2::rightVector
Vector2_t2156229523 ___rightVector_7;
// UnityEngine.Vector2 UnityEngine.Vector2::positiveInfinityVector
Vector2_t2156229523 ___positiveInfinityVector_8;
// UnityEngine.Vector2 UnityEngine.Vector2::negativeInfinityVector
Vector2_t2156229523 ___negativeInfinityVector_9;
public:
inline static int32_t get_offset_of_zeroVector_2() { return static_cast<int32_t>(offsetof(Vector2_t2156229523_StaticFields, ___zeroVector_2)); }
inline Vector2_t2156229523 get_zeroVector_2() const { return ___zeroVector_2; }
inline Vector2_t2156229523 * get_address_of_zeroVector_2() { return &___zeroVector_2; }
inline void set_zeroVector_2(Vector2_t2156229523 value)
{
___zeroVector_2 = value;
}
inline static int32_t get_offset_of_oneVector_3() { return static_cast<int32_t>(offsetof(Vector2_t2156229523_StaticFields, ___oneVector_3)); }
inline Vector2_t2156229523 get_oneVector_3() const { return ___oneVector_3; }
inline Vector2_t2156229523 * get_address_of_oneVector_3() { return &___oneVector_3; }
inline void set_oneVector_3(Vector2_t2156229523 value)
{
___oneVector_3 = value;
}
inline static int32_t get_offset_of_upVector_4() { return static_cast<int32_t>(offsetof(Vector2_t2156229523_StaticFields, ___upVector_4)); }
inline Vector2_t2156229523 get_upVector_4() const { return ___upVector_4; }
inline Vector2_t2156229523 * get_address_of_upVector_4() { return &___upVector_4; }
inline void set_upVector_4(Vector2_t2156229523 value)
{
___upVector_4 = value;
}
inline static int32_t get_offset_of_downVector_5() { return static_cast<int32_t>(offsetof(Vector2_t2156229523_StaticFields, ___downVector_5)); }
inline Vector2_t2156229523 get_downVector_5() const { return ___downVector_5; }
inline Vector2_t2156229523 * get_address_of_downVector_5() { return &___downVector_5; }
inline void set_downVector_5(Vector2_t2156229523 value)
{
___downVector_5 = value;
}
inline static int32_t get_offset_of_leftVector_6() { return static_cast<int32_t>(offsetof(Vector2_t2156229523_StaticFields, ___leftVector_6)); }
inline Vector2_t2156229523 get_leftVector_6() const { return ___leftVector_6; }
inline Vector2_t2156229523 * get_address_of_leftVector_6() { return &___leftVector_6; }
inline void set_leftVector_6(Vector2_t2156229523 value)
{
___leftVector_6 = value;
}
inline static int32_t get_offset_of_rightVector_7() { return static_cast<int32_t>(offsetof(Vector2_t2156229523_StaticFields, ___rightVector_7)); }
inline Vector2_t2156229523 get_rightVector_7() const { return ___rightVector_7; }
inline Vector2_t2156229523 * get_address_of_rightVector_7() { return &___rightVector_7; }
inline void set_rightVector_7(Vector2_t2156229523 value)
{
___rightVector_7 = value;
}
inline static int32_t get_offset_of_positiveInfinityVector_8() { return static_cast<int32_t>(offsetof(Vector2_t2156229523_StaticFields, ___positiveInfinityVector_8)); }
inline Vector2_t2156229523 get_positiveInfinityVector_8() const { return ___positiveInfinityVector_8; }
inline Vector2_t2156229523 * get_address_of_positiveInfinityVector_8() { return &___positiveInfinityVector_8; }
inline void set_positiveInfinityVector_8(Vector2_t2156229523 value)
{
___positiveInfinityVector_8 = value;
}
inline static int32_t get_offset_of_negativeInfinityVector_9() { return static_cast<int32_t>(offsetof(Vector2_t2156229523_StaticFields, ___negativeInfinityVector_9)); }
inline Vector2_t2156229523 get_negativeInfinityVector_9() const { return ___negativeInfinityVector_9; }
inline Vector2_t2156229523 * get_address_of_negativeInfinityVector_9() { return &___negativeInfinityVector_9; }
inline void set_negativeInfinityVector_9(Vector2_t2156229523 value)
{
___negativeInfinityVector_9 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // VECTOR2_T2156229523_H
#ifndef RENDERMODE_T4077056833_H
#define RENDERMODE_T4077056833_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.RenderMode
struct RenderMode_t4077056833
{
public:
// System.Int32 UnityEngine.RenderMode::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(RenderMode_t4077056833, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RENDERMODE_T4077056833_H
#ifndef RAY_T3785851493_H
#define RAY_T3785851493_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Ray
struct Ray_t3785851493
{
public:
// UnityEngine.Vector3 UnityEngine.Ray::m_Origin
Vector3_t3722313464 ___m_Origin_0;
// UnityEngine.Vector3 UnityEngine.Ray::m_Direction
Vector3_t3722313464 ___m_Direction_1;
public:
inline static int32_t get_offset_of_m_Origin_0() { return static_cast<int32_t>(offsetof(Ray_t3785851493, ___m_Origin_0)); }
inline Vector3_t3722313464 get_m_Origin_0() const { return ___m_Origin_0; }
inline Vector3_t3722313464 * get_address_of_m_Origin_0() { return &___m_Origin_0; }
inline void set_m_Origin_0(Vector3_t3722313464 value)
{
___m_Origin_0 = value;
}
inline static int32_t get_offset_of_m_Direction_1() { return static_cast<int32_t>(offsetof(Ray_t3785851493, ___m_Direction_1)); }
inline Vector3_t3722313464 get_m_Direction_1() const { return ___m_Direction_1; }
inline Vector3_t3722313464 * get_address_of_m_Direction_1() { return &___m_Direction_1; }
inline void set_m_Direction_1(Vector3_t3722313464 value)
{
___m_Direction_1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RAY_T3785851493_H
#ifndef SAMPLETYPE_T1208595618_H
#define SAMPLETYPE_T1208595618_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UISystemProfilerApi/SampleType
struct SampleType_t1208595618
{
public:
// System.Int32 UnityEngine.UISystemProfilerApi/SampleType::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(SampleType_t1208595618, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SAMPLETYPE_T1208595618_H
#ifndef DELEGATE_T1188392813_H
#define DELEGATE_T1188392813_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Delegate
struct Delegate_t1188392813 : public RuntimeObject
{
public:
// System.IntPtr System.Delegate::method_ptr
Il2CppMethodPointer ___method_ptr_0;
// System.IntPtr System.Delegate::invoke_impl
intptr_t ___invoke_impl_1;
// System.Object System.Delegate::m_target
RuntimeObject * ___m_target_2;
// System.IntPtr System.Delegate::method
intptr_t ___method_3;
// System.IntPtr System.Delegate::delegate_trampoline
intptr_t ___delegate_trampoline_4;
// System.IntPtr System.Delegate::method_code
intptr_t ___method_code_5;
// System.Reflection.MethodInfo System.Delegate::method_info
MethodInfo_t * ___method_info_6;
// System.Reflection.MethodInfo System.Delegate::original_method_info
MethodInfo_t * ___original_method_info_7;
// System.DelegateData System.Delegate::data
DelegateData_t1677132599 * ___data_8;
public:
inline static int32_t get_offset_of_method_ptr_0() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___method_ptr_0)); }
inline Il2CppMethodPointer get_method_ptr_0() const { return ___method_ptr_0; }
inline Il2CppMethodPointer* get_address_of_method_ptr_0() { return &___method_ptr_0; }
inline void set_method_ptr_0(Il2CppMethodPointer value)
{
___method_ptr_0 = value;
}
inline static int32_t get_offset_of_invoke_impl_1() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___invoke_impl_1)); }
inline intptr_t get_invoke_impl_1() const { return ___invoke_impl_1; }
inline intptr_t* get_address_of_invoke_impl_1() { return &___invoke_impl_1; }
inline void set_invoke_impl_1(intptr_t value)
{
___invoke_impl_1 = value;
}
inline static int32_t get_offset_of_m_target_2() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___m_target_2)); }
inline RuntimeObject * get_m_target_2() const { return ___m_target_2; }
inline RuntimeObject ** get_address_of_m_target_2() { return &___m_target_2; }
inline void set_m_target_2(RuntimeObject * value)
{
___m_target_2 = value;
Il2CppCodeGenWriteBarrier((&___m_target_2), value);
}
inline static int32_t get_offset_of_method_3() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___method_3)); }
inline intptr_t get_method_3() const { return ___method_3; }
inline intptr_t* get_address_of_method_3() { return &___method_3; }
inline void set_method_3(intptr_t value)
{
___method_3 = value;
}
inline static int32_t get_offset_of_delegate_trampoline_4() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___delegate_trampoline_4)); }
inline intptr_t get_delegate_trampoline_4() const { return ___delegate_trampoline_4; }
inline intptr_t* get_address_of_delegate_trampoline_4() { return &___delegate_trampoline_4; }
inline void set_delegate_trampoline_4(intptr_t value)
{
___delegate_trampoline_4 = value;
}
inline static int32_t get_offset_of_method_code_5() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___method_code_5)); }
inline intptr_t get_method_code_5() const { return ___method_code_5; }
inline intptr_t* get_address_of_method_code_5() { return &___method_code_5; }
inline void set_method_code_5(intptr_t value)
{
___method_code_5 = value;
}
inline static int32_t get_offset_of_method_info_6() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___method_info_6)); }
inline MethodInfo_t * get_method_info_6() const { return ___method_info_6; }
inline MethodInfo_t ** get_address_of_method_info_6() { return &___method_info_6; }
inline void set_method_info_6(MethodInfo_t * value)
{
___method_info_6 = value;
Il2CppCodeGenWriteBarrier((&___method_info_6), value);
}
inline static int32_t get_offset_of_original_method_info_7() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___original_method_info_7)); }
inline MethodInfo_t * get_original_method_info_7() const { return ___original_method_info_7; }
inline MethodInfo_t ** get_address_of_original_method_info_7() { return &___original_method_info_7; }
inline void set_original_method_info_7(MethodInfo_t * value)
{
___original_method_info_7 = value;
Il2CppCodeGenWriteBarrier((&___original_method_info_7), value);
}
inline static int32_t get_offset_of_data_8() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___data_8)); }
inline DelegateData_t1677132599 * get_data_8() const { return ___data_8; }
inline DelegateData_t1677132599 ** get_address_of_data_8() { return &___data_8; }
inline void set_data_8(DelegateData_t1677132599 * value)
{
___data_8 = value;
Il2CppCodeGenWriteBarrier((&___data_8), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // DELEGATE_T1188392813_H
#ifndef PLANE_T1000493321_H
#define PLANE_T1000493321_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Plane
struct Plane_t1000493321
{
public:
// UnityEngine.Vector3 UnityEngine.Plane::m_Normal
Vector3_t3722313464 ___m_Normal_0;
// System.Single UnityEngine.Plane::m_Distance
float ___m_Distance_1;
public:
inline static int32_t get_offset_of_m_Normal_0() { return static_cast<int32_t>(offsetof(Plane_t1000493321, ___m_Normal_0)); }
inline Vector3_t3722313464 get_m_Normal_0() const { return ___m_Normal_0; }
inline Vector3_t3722313464 * get_address_of_m_Normal_0() { return &___m_Normal_0; }
inline void set_m_Normal_0(Vector3_t3722313464 value)
{
___m_Normal_0 = value;
}
inline static int32_t get_offset_of_m_Distance_1() { return static_cast<int32_t>(offsetof(Plane_t1000493321, ___m_Distance_1)); }
inline float get_m_Distance_1() const { return ___m_Distance_1; }
inline float* get_address_of_m_Distance_1() { return &___m_Distance_1; }
inline void set_m_Distance_1(float value)
{
___m_Distance_1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // PLANE_T1000493321_H
#ifndef OBJECT_T631007953_H
#define OBJECT_T631007953_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Object
struct Object_t631007953 : public RuntimeObject
{
public:
// System.IntPtr UnityEngine.Object::m_CachedPtr
intptr_t ___m_CachedPtr_0;
public:
inline static int32_t get_offset_of_m_CachedPtr_0() { return static_cast<int32_t>(offsetof(Object_t631007953, ___m_CachedPtr_0)); }
inline intptr_t get_m_CachedPtr_0() const { return ___m_CachedPtr_0; }
inline intptr_t* get_address_of_m_CachedPtr_0() { return &___m_CachedPtr_0; }
inline void set_m_CachedPtr_0(intptr_t value)
{
___m_CachedPtr_0 = value;
}
};
struct Object_t631007953_StaticFields
{
public:
// System.Int32 UnityEngine.Object::OffsetOfInstanceIDInCPlusPlusObject
int32_t ___OffsetOfInstanceIDInCPlusPlusObject_1;
public:
inline static int32_t get_offset_of_OffsetOfInstanceIDInCPlusPlusObject_1() { return static_cast<int32_t>(offsetof(Object_t631007953_StaticFields, ___OffsetOfInstanceIDInCPlusPlusObject_1)); }
inline int32_t get_OffsetOfInstanceIDInCPlusPlusObject_1() const { return ___OffsetOfInstanceIDInCPlusPlusObject_1; }
inline int32_t* get_address_of_OffsetOfInstanceIDInCPlusPlusObject_1() { return &___OffsetOfInstanceIDInCPlusPlusObject_1; }
inline void set_OffsetOfInstanceIDInCPlusPlusObject_1(int32_t value)
{
___OffsetOfInstanceIDInCPlusPlusObject_1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of UnityEngine.Object
struct Object_t631007953_marshaled_pinvoke
{
intptr_t ___m_CachedPtr_0;
};
// Native definition for COM marshalling of UnityEngine.Object
struct Object_t631007953_marshaled_com
{
intptr_t ___m_CachedPtr_0;
};
#endif // OBJECT_T631007953_H
#ifndef COMPONENT_T1923634451_H
#define COMPONENT_T1923634451_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Component
struct Component_t1923634451 : public Object_t631007953
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // COMPONENT_T1923634451_H
#ifndef MULTICASTDELEGATE_T_H
#define MULTICASTDELEGATE_T_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.MulticastDelegate
struct MulticastDelegate_t : public Delegate_t1188392813
{
public:
// System.MulticastDelegate System.MulticastDelegate::prev
MulticastDelegate_t * ___prev_9;
// System.MulticastDelegate System.MulticastDelegate::kpm_next
MulticastDelegate_t * ___kpm_next_10;
public:
inline static int32_t get_offset_of_prev_9() { return static_cast<int32_t>(offsetof(MulticastDelegate_t, ___prev_9)); }
inline MulticastDelegate_t * get_prev_9() const { return ___prev_9; }
inline MulticastDelegate_t ** get_address_of_prev_9() { return &___prev_9; }
inline void set_prev_9(MulticastDelegate_t * value)
{
___prev_9 = value;
Il2CppCodeGenWriteBarrier((&___prev_9), value);
}
inline static int32_t get_offset_of_kpm_next_10() { return static_cast<int32_t>(offsetof(MulticastDelegate_t, ___kpm_next_10)); }
inline MulticastDelegate_t * get_kpm_next_10() const { return ___kpm_next_10; }
inline MulticastDelegate_t ** get_address_of_kpm_next_10() { return &___kpm_next_10; }
inline void set_kpm_next_10(MulticastDelegate_t * value)
{
___kpm_next_10 = value;
Il2CppCodeGenWriteBarrier((&___kpm_next_10), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // MULTICASTDELEGATE_T_H
#ifndef MESH_T3648964284_H
#define MESH_T3648964284_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Mesh
struct Mesh_t3648964284 : public Object_t631007953
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // MESH_T3648964284_H
#ifndef TEXTURE_T3661962703_H
#define TEXTURE_T3661962703_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Texture
struct Texture_t3661962703 : public Object_t631007953
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // TEXTURE_T3661962703_H
#ifndef MATERIAL_T340375123_H
#define MATERIAL_T340375123_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Material
struct Material_t340375123 : public Object_t631007953
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // MATERIAL_T340375123_H
#ifndef BEHAVIOUR_T1437897464_H
#define BEHAVIOUR_T1437897464_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Behaviour
struct Behaviour_t1437897464 : public Component_t1923634451
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // BEHAVIOUR_T1437897464_H
#ifndef WILLRENDERCANVASES_T3309123499_H
#define WILLRENDERCANVASES_T3309123499_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Canvas/WillRenderCanvases
struct WillRenderCanvases_t3309123499 : public MulticastDelegate_t
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // WILLRENDERCANVASES_T3309123499_H
#ifndef TRANSFORM_T3600365921_H
#define TRANSFORM_T3600365921_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Transform
struct Transform_t3600365921 : public Component_t1923634451
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // TRANSFORM_T3600365921_H
#ifndef CANVASGROUP_T4083511760_H
#define CANVASGROUP_T4083511760_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.CanvasGroup
struct CanvasGroup_t4083511760 : public Component_t1923634451
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // CANVASGROUP_T4083511760_H
#ifndef CANVASRENDERER_T2598313366_H
#define CANVASRENDERER_T2598313366_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.CanvasRenderer
struct CanvasRenderer_t2598313366 : public Component_t1923634451
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // CANVASRENDERER_T2598313366_H
#ifndef ASYNCCALLBACK_T3962456242_H
#define ASYNCCALLBACK_T3962456242_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.AsyncCallback
struct AsyncCallback_t3962456242 : public MulticastDelegate_t
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // ASYNCCALLBACK_T3962456242_H
#ifndef CAMERA_T4157153871_H
#define CAMERA_T4157153871_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Camera
struct Camera_t4157153871 : public Behaviour_t1437897464
{
public:
public:
};
struct Camera_t4157153871_StaticFields
{
public:
// UnityEngine.Camera/CameraCallback UnityEngine.Camera::onPreCull
CameraCallback_t190067161 * ___onPreCull_2;
// UnityEngine.Camera/CameraCallback UnityEngine.Camera::onPreRender
CameraCallback_t190067161 * ___onPreRender_3;
// UnityEngine.Camera/CameraCallback UnityEngine.Camera::onPostRender
CameraCallback_t190067161 * ___onPostRender_4;
public:
inline static int32_t get_offset_of_onPreCull_2() { return static_cast<int32_t>(offsetof(Camera_t4157153871_StaticFields, ___onPreCull_2)); }
inline CameraCallback_t190067161 * get_onPreCull_2() const { return ___onPreCull_2; }
inline CameraCallback_t190067161 ** get_address_of_onPreCull_2() { return &___onPreCull_2; }
inline void set_onPreCull_2(CameraCallback_t190067161 * value)
{
___onPreCull_2 = value;
Il2CppCodeGenWriteBarrier((&___onPreCull_2), value);
}
inline static int32_t get_offset_of_onPreRender_3() { return static_cast<int32_t>(offsetof(Camera_t4157153871_StaticFields, ___onPreRender_3)); }
inline CameraCallback_t190067161 * get_onPreRender_3() const { return ___onPreRender_3; }
inline CameraCallback_t190067161 ** get_address_of_onPreRender_3() { return &___onPreRender_3; }
inline void set_onPreRender_3(CameraCallback_t190067161 * value)
{
___onPreRender_3 = value;
Il2CppCodeGenWriteBarrier((&___onPreRender_3), value);
}
inline static int32_t get_offset_of_onPostRender_4() { return static_cast<int32_t>(offsetof(Camera_t4157153871_StaticFields, ___onPostRender_4)); }
inline CameraCallback_t190067161 * get_onPostRender_4() const { return ___onPostRender_4; }
inline CameraCallback_t190067161 ** get_address_of_onPostRender_4() { return &___onPostRender_4; }
inline void set_onPostRender_4(CameraCallback_t190067161 * value)
{
___onPostRender_4 = value;
Il2CppCodeGenWriteBarrier((&___onPostRender_4), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // CAMERA_T4157153871_H
#ifndef RECTTRANSFORM_T3704657025_H
#define RECTTRANSFORM_T3704657025_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.RectTransform
struct RectTransform_t3704657025 : public Transform_t3600365921
{
public:
public:
};
struct RectTransform_t3704657025_StaticFields
{
public:
// UnityEngine.RectTransform/ReapplyDrivenProperties UnityEngine.RectTransform::reapplyDrivenProperties
ReapplyDrivenProperties_t1258266594 * ___reapplyDrivenProperties_2;
public:
inline static int32_t get_offset_of_reapplyDrivenProperties_2() { return static_cast<int32_t>(offsetof(RectTransform_t3704657025_StaticFields, ___reapplyDrivenProperties_2)); }
inline ReapplyDrivenProperties_t1258266594 * get_reapplyDrivenProperties_2() const { return ___reapplyDrivenProperties_2; }
inline ReapplyDrivenProperties_t1258266594 ** get_address_of_reapplyDrivenProperties_2() { return &___reapplyDrivenProperties_2; }
inline void set_reapplyDrivenProperties_2(ReapplyDrivenProperties_t1258266594 * value)
{
___reapplyDrivenProperties_2 = value;
Il2CppCodeGenWriteBarrier((&___reapplyDrivenProperties_2), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RECTTRANSFORM_T3704657025_H
#ifndef CANVAS_T3310196443_H
#define CANVAS_T3310196443_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Canvas
struct Canvas_t3310196443 : public Behaviour_t1437897464
{
public:
public:
};
struct Canvas_t3310196443_StaticFields
{
public:
// UnityEngine.Canvas/WillRenderCanvases UnityEngine.Canvas::willRenderCanvases
WillRenderCanvases_t3309123499 * ___willRenderCanvases_2;
public:
inline static int32_t get_offset_of_willRenderCanvases_2() { return static_cast<int32_t>(offsetof(Canvas_t3310196443_StaticFields, ___willRenderCanvases_2)); }
inline WillRenderCanvases_t3309123499 * get_willRenderCanvases_2() const { return ___willRenderCanvases_2; }
inline WillRenderCanvases_t3309123499 ** get_address_of_willRenderCanvases_2() { return &___willRenderCanvases_2; }
inline void set_willRenderCanvases_2(WillRenderCanvases_t3309123499 * value)
{
___willRenderCanvases_2 = value;
Il2CppCodeGenWriteBarrier((&___willRenderCanvases_2), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // CANVAS_T3310196443_H
// UnityEngine.Vector3[]
struct Vector3U5BU5D_t1718750761 : public RuntimeArray
{
public:
ALIGN_FIELD (8) Vector3_t3722313464 m_Items[1];
public:
inline Vector3_t3722313464 GetAt(il2cpp_array_size_t index) const
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
return m_Items[index];
}
inline Vector3_t3722313464 * 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, Vector3_t3722313464 value)
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
m_Items[index] = value;
}
inline Vector3_t3722313464 GetAtUnchecked(il2cpp_array_size_t index) const
{
return m_Items[index];
}
inline Vector3_t3722313464 * GetAddressAtUnchecked(il2cpp_array_size_t index)
{
return m_Items + index;
}
inline void SetAtUnchecked(il2cpp_array_size_t index, Vector3_t3722313464 value)
{
m_Items[index] = value;
}
};
// System.Void UnityEngine.Behaviour::.ctor()
extern "C" void Behaviour__ctor_m346897018 (Behaviour_t1437897464 * __this, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Delegate System.Delegate::Combine(System.Delegate,System.Delegate)
extern "C" Delegate_t1188392813 * Delegate_Combine_m1859655160 (RuntimeObject * __this /* static, unused */, Delegate_t1188392813 * p0, Delegate_t1188392813 * p1, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Delegate System.Delegate::Remove(System.Delegate,System.Delegate)
extern "C" Delegate_t1188392813 * Delegate_Remove_m334097152 (RuntimeObject * __this /* static, unused */, Delegate_t1188392813 * p0, Delegate_t1188392813 * p1, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.Canvas/WillRenderCanvases::Invoke()
extern "C" void WillRenderCanvases_Invoke_m1240663687 (WillRenderCanvases_t3309123499 * __this, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.Canvas::SendWillRenderCanvases()
extern "C" void Canvas_SendWillRenderCanvases_m4288867005 (RuntimeObject * __this /* static, unused */, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Boolean UnityEngine.CanvasGroup::get_blocksRaycasts()
extern "C" bool CanvasGroup_get_blocksRaycasts_m1805542303 (CanvasGroup_t4083511760 * __this, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.CanvasRenderer::INTERNAL_CALL_SetColor(UnityEngine.CanvasRenderer,UnityEngine.Color&)
extern "C" void CanvasRenderer_INTERNAL_CALL_SetColor_m324218710 (RuntimeObject * __this /* static, unused */, CanvasRenderer_t2598313366 * ___self0, Color_t2555686324 * ___color1, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.CanvasRenderer::INTERNAL_CALL_GetColor(UnityEngine.CanvasRenderer,UnityEngine.Color&)
extern "C" void CanvasRenderer_INTERNAL_CALL_GetColor_m597074473 (RuntimeObject * __this /* static, unused */, CanvasRenderer_t2598313366 * ___self0, Color_t2555686324 * ___value1, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.CanvasRenderer::INTERNAL_CALL_EnableRectClipping(UnityEngine.CanvasRenderer,UnityEngine.Rect&)
extern "C" void CanvasRenderer_INTERNAL_CALL_EnableRectClipping_m3318097918 (RuntimeObject * __this /* static, unused */, CanvasRenderer_t2598313366 * ___self0, Rect_t2360479859 * ___rect1, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Int32 UnityEngine.CanvasRenderer::get_materialCount()
extern "C" int32_t CanvasRenderer_get_materialCount_m2162898709 (CanvasRenderer_t2598313366 * __this, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Int32 System.Math::Max(System.Int32,System.Int32)
extern "C" int32_t Math_Max_m1873195862 (RuntimeObject * __this /* static, unused */, int32_t p0, int32_t p1, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.CanvasRenderer::set_materialCount(System.Int32)
extern "C" void CanvasRenderer_set_materialCount_m4286588063 (CanvasRenderer_t2598313366 * __this, int32_t ___value0, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.CanvasRenderer::SetMaterial(UnityEngine.Material,System.Int32)
extern "C" void CanvasRenderer_SetMaterial_m824577244 (CanvasRenderer_t2598313366 * __this, Material_t340375123 * ___material0, int32_t ___index1, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.CanvasRenderer::SetTexture(UnityEngine.Texture)
extern "C" void CanvasRenderer_SetTexture_m1600559835 (CanvasRenderer_t2598313366 * __this, Texture_t3661962703 * ___texture0, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.CanvasRenderer::SplitUIVertexStreamsInternal(System.Object,System.Object,System.Object,System.Object,System.Object,System.Object,System.Object,System.Object,System.Object)
extern "C" void CanvasRenderer_SplitUIVertexStreamsInternal_m3280623346 (RuntimeObject * __this /* static, unused */, RuntimeObject * ___verts0, RuntimeObject * ___positions1, RuntimeObject * ___colors2, RuntimeObject * ___uv0S3, RuntimeObject * ___uv1S4, RuntimeObject * ___uv2S5, RuntimeObject * ___uv3S6, RuntimeObject * ___normals7, RuntimeObject * ___tangents8, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.CanvasRenderer::SplitIndicesStreamsInternal(System.Object,System.Object)
extern "C" void CanvasRenderer_SplitIndicesStreamsInternal_m2851933301 (RuntimeObject * __this /* static, unused */, RuntimeObject * ___verts0, RuntimeObject * ___indices1, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.CanvasRenderer::CreateUIVertexStreamInternal(System.Object,System.Object,System.Object,System.Object,System.Object,System.Object,System.Object,System.Object,System.Object,System.Object)
extern "C" void CanvasRenderer_CreateUIVertexStreamInternal_m543814397 (RuntimeObject * __this /* static, unused */, RuntimeObject * ___verts0, RuntimeObject * ___positions1, RuntimeObject * ___colors2, RuntimeObject * ___uv0S3, RuntimeObject * ___uv1S4, RuntimeObject * ___uv2S5, RuntimeObject * ___uv3S6, RuntimeObject * ___normals7, RuntimeObject * ___tangents8, RuntimeObject * ___indices9, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Boolean UnityEngine.RectTransformUtility::INTERNAL_CALL_RectangleContainsScreenPoint(UnityEngine.RectTransform,UnityEngine.Vector2&,UnityEngine.Camera)
extern "C" bool RectTransformUtility_INTERNAL_CALL_RectangleContainsScreenPoint_m1214874141 (RuntimeObject * __this /* static, unused */, RectTransform_t3704657025 * ___rect0, Vector2_t2156229523 * ___screenPoint1, Camera_t4157153871 * ___cam2, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.RectTransformUtility::INTERNAL_CALL_PixelAdjustPoint(UnityEngine.Vector2&,UnityEngine.Transform,UnityEngine.Canvas,UnityEngine.Vector2&)
extern "C" void RectTransformUtility_INTERNAL_CALL_PixelAdjustPoint_m1064459754 (RuntimeObject * __this /* static, unused */, Vector2_t2156229523 * ___point0, Transform_t3600365921 * ___elementTransform1, Canvas_t3310196443 * ___canvas2, Vector2_t2156229523 * ___value3, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.RectTransformUtility::INTERNAL_CALL_PixelAdjustRect(UnityEngine.RectTransform,UnityEngine.Canvas,UnityEngine.Rect&)
extern "C" void RectTransformUtility_INTERNAL_CALL_PixelAdjustRect_m740389236 (RuntimeObject * __this /* static, unused */, RectTransform_t3704657025 * ___rectTransform0, Canvas_t3310196443 * ___canvas1, Rect_t2360479859 * ___value2, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// UnityEngine.Vector2 UnityEngine.Vector2::get_zero()
extern "C" Vector2_t2156229523 Vector2_get_zero_m540426400 (RuntimeObject * __this /* static, unused */, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// UnityEngine.Vector3 UnityEngine.Vector2::op_Implicit(UnityEngine.Vector2)
extern "C" Vector3_t3722313464 Vector2_op_Implicit_m1860157806 (RuntimeObject * __this /* static, unused */, Vector2_t2156229523 p0, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// UnityEngine.Ray UnityEngine.RectTransformUtility::ScreenPointToRay(UnityEngine.Camera,UnityEngine.Vector2)
extern "C" Ray_t3785851493 RectTransformUtility_ScreenPointToRay_m85042072 (RuntimeObject * __this /* static, unused */, Camera_t4157153871 * ___cam0, Vector2_t2156229523 ___screenPos1, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// UnityEngine.Quaternion UnityEngine.Transform::get_rotation()
extern "C" Quaternion_t2301928331 Transform_get_rotation_m3502953881 (Transform_t3600365921 * __this, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// UnityEngine.Vector3 UnityEngine.Vector3::get_back()
extern "C" Vector3_t3722313464 Vector3_get_back_m4077847766 (RuntimeObject * __this /* static, unused */, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// UnityEngine.Vector3 UnityEngine.Quaternion::op_Multiply(UnityEngine.Quaternion,UnityEngine.Vector3)
extern "C" Vector3_t3722313464 Quaternion_op_Multiply_m2607404835 (RuntimeObject * __this /* static, unused */, Quaternion_t2301928331 p0, Vector3_t3722313464 p1, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// UnityEngine.Vector3 UnityEngine.Transform::get_position()
extern "C" Vector3_t3722313464 Transform_get_position_m36019626 (Transform_t3600365921 * __this, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.Plane::.ctor(UnityEngine.Vector3,UnityEngine.Vector3)
extern "C" void Plane__ctor_m2890438515 (Plane_t1000493321 * __this, Vector3_t3722313464 p0, Vector3_t3722313464 p1, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Boolean UnityEngine.Plane::Raycast(UnityEngine.Ray,System.Single&)
extern "C" bool Plane_Raycast_m62370169 (Plane_t1000493321 * __this, Ray_t3785851493 p0, float* p1, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// UnityEngine.Vector3 UnityEngine.Ray::GetPoint(System.Single)
extern "C" Vector3_t3722313464 Ray_GetPoint_m1852405345 (Ray_t3785851493 * __this, float p0, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Boolean UnityEngine.RectTransformUtility::ScreenPointToWorldPointInRectangle(UnityEngine.RectTransform,UnityEngine.Vector2,UnityEngine.Camera,UnityEngine.Vector3&)
extern "C" bool RectTransformUtility_ScreenPointToWorldPointInRectangle_m1761902807 (RuntimeObject * __this /* static, unused */, RectTransform_t3704657025 * ___rect0, Vector2_t2156229523 ___screenPoint1, Camera_t4157153871 * ___cam2, Vector3_t3722313464 * ___worldPoint3, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// UnityEngine.Vector3 UnityEngine.Transform::InverseTransformPoint(UnityEngine.Vector3)
extern "C" Vector3_t3722313464 Transform_InverseTransformPoint_m1343916000 (Transform_t3600365921 * __this, Vector3_t3722313464 p0, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// UnityEngine.Vector2 UnityEngine.Vector2::op_Implicit(UnityEngine.Vector3)
extern "C" Vector2_t2156229523 Vector2_op_Implicit_m4260192859 (RuntimeObject * __this /* static, unused */, Vector3_t3722313464 p0, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Boolean UnityEngine.Object::op_Inequality(UnityEngine.Object,UnityEngine.Object)
extern "C" bool Object_op_Inequality_m4071470834 (RuntimeObject * __this /* static, unused */, Object_t631007953 * p0, Object_t631007953 * p1, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// UnityEngine.Ray UnityEngine.Camera::ScreenPointToRay(UnityEngine.Vector3)
extern "C" Ray_t3785851493 Camera_ScreenPointToRay_m3764635188 (Camera_t4157153871 * __this, Vector3_t3722313464 p0, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// UnityEngine.Vector3 UnityEngine.Vector3::get_forward()
extern "C" Vector3_t3722313464 Vector3_get_forward_m3100859705 (RuntimeObject * __this /* static, unused */, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.Ray::.ctor(UnityEngine.Vector3,UnityEngine.Vector3)
extern "C" void Ray__ctor_m168149494 (Ray_t3785851493 * __this, Vector3_t3722313464 p0, Vector3_t3722313464 p1, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Boolean UnityEngine.Object::op_Equality(UnityEngine.Object,UnityEngine.Object)
extern "C" bool Object_op_Equality_m1810815630 (RuntimeObject * __this /* static, unused */, Object_t631007953 * p0, Object_t631007953 * p1, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// UnityEngine.Transform UnityEngine.Transform::GetChild(System.Int32)
extern "C" Transform_t3600365921 * Transform_GetChild_m1092972975 (Transform_t3600365921 * __this, int32_t p0, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.RectTransformUtility::FlipLayoutOnAxis(UnityEngine.RectTransform,System.Int32,System.Boolean,System.Boolean)
extern "C" void RectTransformUtility_FlipLayoutOnAxis_m2606646065 (RuntimeObject * __this /* static, unused */, RectTransform_t3704657025 * ___rect0, int32_t ___axis1, bool ___keepPositioning2, bool ___recursive3, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Int32 UnityEngine.Transform::get_childCount()
extern "C" int32_t Transform_get_childCount_m3145433196 (Transform_t3600365921 * __this, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// UnityEngine.Vector2 UnityEngine.RectTransform::get_pivot()
extern "C" Vector2_t2156229523 RectTransform_get_pivot_m3425744470 (RectTransform_t3704657025 * __this, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Single UnityEngine.Vector2::get_Item(System.Int32)
extern "C" float Vector2_get_Item_m3559215723 (Vector2_t2156229523 * __this, int32_t p0, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.Vector2::set_Item(System.Int32,System.Single)
extern "C" void Vector2_set_Item_m3557490725 (Vector2_t2156229523 * __this, int32_t p0, float p1, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.RectTransform::set_pivot(UnityEngine.Vector2)
extern "C" void RectTransform_set_pivot_m909387058 (RectTransform_t3704657025 * __this, Vector2_t2156229523 p0, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// UnityEngine.Vector2 UnityEngine.RectTransform::get_anchoredPosition()
extern "C" Vector2_t2156229523 RectTransform_get_anchoredPosition_m1813443094 (RectTransform_t3704657025 * __this, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.RectTransform::set_anchoredPosition(UnityEngine.Vector2)
extern "C" void RectTransform_set_anchoredPosition_m4126691837 (RectTransform_t3704657025 * __this, Vector2_t2156229523 p0, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// UnityEngine.Vector2 UnityEngine.RectTransform::get_anchorMin()
extern "C" Vector2_t2156229523 RectTransform_get_anchorMin_m2928307238 (RectTransform_t3704657025 * __this, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// UnityEngine.Vector2 UnityEngine.RectTransform::get_anchorMax()
extern "C" Vector2_t2156229523 RectTransform_get_anchorMax_m2495270048 (RectTransform_t3704657025 * __this, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.RectTransform::set_anchorMin(UnityEngine.Vector2)
extern "C" void RectTransform_set_anchorMin_m4230103102 (RectTransform_t3704657025 * __this, Vector2_t2156229523 p0, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.RectTransform::set_anchorMax(UnityEngine.Vector2)
extern "C" void RectTransform_set_anchorMax_m2998668828 (RectTransform_t3704657025 * __this, Vector2_t2156229523 p0, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.RectTransformUtility::FlipLayoutAxes(UnityEngine.RectTransform,System.Boolean,System.Boolean)
extern "C" void RectTransformUtility_FlipLayoutAxes_m2526204952 (RuntimeObject * __this /* static, unused */, RectTransform_t3704657025 * ___rect0, bool ___keepPositioning1, bool ___recursive2, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// UnityEngine.Vector2 UnityEngine.RectTransformUtility::GetTransposed(UnityEngine.Vector2)
extern "C" Vector2_t2156229523 RectTransformUtility_GetTransposed_m3952754222 (RuntimeObject * __this /* static, unused */, Vector2_t2156229523 ___input0, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// UnityEngine.Vector2 UnityEngine.RectTransform::get_sizeDelta()
extern "C" Vector2_t2156229523 RectTransform_get_sizeDelta_m2183112744 (RectTransform_t3704657025 * __this, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.RectTransform::set_sizeDelta(UnityEngine.Vector2)
extern "C" void RectTransform_set_sizeDelta_m3462269772 (RectTransform_t3704657025 * __this, Vector2_t2156229523 p0, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
// System.Void UnityEngine.Vector2::.ctor(System.Single,System.Single)
extern "C" void Vector2__ctor_m3970636864 (Vector2_t2156229523 * __this, float p0, float p1, const RuntimeMethod* method) IL2CPP_METHOD_ATTR;
#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.Void UnityEngine.Canvas::.ctor()
extern "C" void Canvas__ctor_m2509635467 (Canvas_t3310196443 * __this, const RuntimeMethod* method)
{
{
Behaviour__ctor_m346897018(__this, /*hidden argument*/NULL);
return;
}
}
// UnityEngine.RenderMode UnityEngine.Canvas::get_renderMode()
extern "C" int32_t Canvas_get_renderMode_m841659411 (Canvas_t3310196443 * __this, const RuntimeMethod* method)
{
typedef int32_t (*Canvas_get_renderMode_m841659411_ftn) (Canvas_t3310196443 *);
static Canvas_get_renderMode_m841659411_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (Canvas_get_renderMode_m841659411_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.Canvas::get_renderMode()");
int32_t retVal = _il2cpp_icall_func(__this);
return retVal;
}
// System.Boolean UnityEngine.Canvas::get_isRootCanvas()
extern "C" bool Canvas_get_isRootCanvas_m1263191473 (Canvas_t3310196443 * __this, const RuntimeMethod* method)
{
typedef bool (*Canvas_get_isRootCanvas_m1263191473_ftn) (Canvas_t3310196443 *);
static Canvas_get_isRootCanvas_m1263191473_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (Canvas_get_isRootCanvas_m1263191473_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.Canvas::get_isRootCanvas()");
bool retVal = _il2cpp_icall_func(__this);
return retVal;
}
// UnityEngine.Camera UnityEngine.Canvas::get_worldCamera()
extern "C" Camera_t4157153871 * Canvas_get_worldCamera_m3516267897 (Canvas_t3310196443 * __this, const RuntimeMethod* method)
{
typedef Camera_t4157153871 * (*Canvas_get_worldCamera_m3516267897_ftn) (Canvas_t3310196443 *);
static Canvas_get_worldCamera_m3516267897_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (Canvas_get_worldCamera_m3516267897_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.Canvas::get_worldCamera()");
Camera_t4157153871 * retVal = _il2cpp_icall_func(__this);
return retVal;
}
// System.Single UnityEngine.Canvas::get_scaleFactor()
extern "C" float Canvas_get_scaleFactor_m3314757802 (Canvas_t3310196443 * __this, const RuntimeMethod* method)
{
typedef float (*Canvas_get_scaleFactor_m3314757802_ftn) (Canvas_t3310196443 *);
static Canvas_get_scaleFactor_m3314757802_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (Canvas_get_scaleFactor_m3314757802_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.Canvas::get_scaleFactor()");
float retVal = _il2cpp_icall_func(__this);
return retVal;
}
// System.Void UnityEngine.Canvas::set_scaleFactor(System.Single)
extern "C" void Canvas_set_scaleFactor_m3943377587 (Canvas_t3310196443 * __this, float ___value0, const RuntimeMethod* method)
{
typedef void (*Canvas_set_scaleFactor_m3943377587_ftn) (Canvas_t3310196443 *, float);
static Canvas_set_scaleFactor_m3943377587_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (Canvas_set_scaleFactor_m3943377587_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.Canvas::set_scaleFactor(System.Single)");
_il2cpp_icall_func(__this, ___value0);
}
// System.Single UnityEngine.Canvas::get_referencePixelsPerUnit()
extern "C" float Canvas_get_referencePixelsPerUnit_m3420541976 (Canvas_t3310196443 * __this, const RuntimeMethod* method)
{
typedef float (*Canvas_get_referencePixelsPerUnit_m3420541976_ftn) (Canvas_t3310196443 *);
static Canvas_get_referencePixelsPerUnit_m3420541976_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (Canvas_get_referencePixelsPerUnit_m3420541976_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.Canvas::get_referencePixelsPerUnit()");
float retVal = _il2cpp_icall_func(__this);
return retVal;
}
// System.Void UnityEngine.Canvas::set_referencePixelsPerUnit(System.Single)
extern "C" void Canvas_set_referencePixelsPerUnit_m2526332713 (Canvas_t3310196443 * __this, float ___value0, const RuntimeMethod* method)
{
typedef void (*Canvas_set_referencePixelsPerUnit_m2526332713_ftn) (Canvas_t3310196443 *, float);
static Canvas_set_referencePixelsPerUnit_m2526332713_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (Canvas_set_referencePixelsPerUnit_m2526332713_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.Canvas::set_referencePixelsPerUnit(System.Single)");
_il2cpp_icall_func(__this, ___value0);
}
// System.Boolean UnityEngine.Canvas::get_pixelPerfect()
extern "C" bool Canvas_get_pixelPerfect_m333060872 (Canvas_t3310196443 * __this, const RuntimeMethod* method)
{
typedef bool (*Canvas_get_pixelPerfect_m333060872_ftn) (Canvas_t3310196443 *);
static Canvas_get_pixelPerfect_m333060872_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (Canvas_get_pixelPerfect_m333060872_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.Canvas::get_pixelPerfect()");
bool retVal = _il2cpp_icall_func(__this);
return retVal;
}
// System.Int32 UnityEngine.Canvas::get_renderOrder()
extern "C" int32_t Canvas_get_renderOrder_m1489855841 (Canvas_t3310196443 * __this, const RuntimeMethod* method)
{
typedef int32_t (*Canvas_get_renderOrder_m1489855841_ftn) (Canvas_t3310196443 *);
static Canvas_get_renderOrder_m1489855841_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (Canvas_get_renderOrder_m1489855841_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.Canvas::get_renderOrder()");
int32_t retVal = _il2cpp_icall_func(__this);
return retVal;
}
// System.Boolean UnityEngine.Canvas::get_overrideSorting()
extern "C" bool Canvas_get_overrideSorting_m2740418462 (Canvas_t3310196443 * __this, const RuntimeMethod* method)
{
typedef bool (*Canvas_get_overrideSorting_m2740418462_ftn) (Canvas_t3310196443 *);
static Canvas_get_overrideSorting_m2740418462_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (Canvas_get_overrideSorting_m2740418462_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.Canvas::get_overrideSorting()");
bool retVal = _il2cpp_icall_func(__this);
return retVal;
}
// System.Void UnityEngine.Canvas::set_overrideSorting(System.Boolean)
extern "C" void Canvas_set_overrideSorting_m4088794420 (Canvas_t3310196443 * __this, bool ___value0, const RuntimeMethod* method)
{
typedef void (*Canvas_set_overrideSorting_m4088794420_ftn) (Canvas_t3310196443 *, bool);
static Canvas_set_overrideSorting_m4088794420_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (Canvas_set_overrideSorting_m4088794420_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.Canvas::set_overrideSorting(System.Boolean)");
_il2cpp_icall_func(__this, ___value0);
}
// System.Int32 UnityEngine.Canvas::get_sortingOrder()
extern "C" int32_t Canvas_get_sortingOrder_m1860900812 (Canvas_t3310196443 * __this, const RuntimeMethod* method)
{
typedef int32_t (*Canvas_get_sortingOrder_m1860900812_ftn) (Canvas_t3310196443 *);
static Canvas_get_sortingOrder_m1860900812_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (Canvas_get_sortingOrder_m1860900812_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.Canvas::get_sortingOrder()");
int32_t retVal = _il2cpp_icall_func(__this);
return retVal;
}
// System.Void UnityEngine.Canvas::set_sortingOrder(System.Int32)
extern "C" void Canvas_set_sortingOrder_m609532562 (Canvas_t3310196443 * __this, int32_t ___value0, const RuntimeMethod* method)
{
typedef void (*Canvas_set_sortingOrder_m609532562_ftn) (Canvas_t3310196443 *, int32_t);
static Canvas_set_sortingOrder_m609532562_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (Canvas_set_sortingOrder_m609532562_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.Canvas::set_sortingOrder(System.Int32)");
_il2cpp_icall_func(__this, ___value0);
}
// System.Int32 UnityEngine.Canvas::get_targetDisplay()
extern "C" int32_t Canvas_get_targetDisplay_m594669079 (Canvas_t3310196443 * __this, const RuntimeMethod* method)
{
typedef int32_t (*Canvas_get_targetDisplay_m594669079_ftn) (Canvas_t3310196443 *);
static Canvas_get_targetDisplay_m594669079_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (Canvas_get_targetDisplay_m594669079_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.Canvas::get_targetDisplay()");
int32_t retVal = _il2cpp_icall_func(__this);
return retVal;
}
// System.Int32 UnityEngine.Canvas::get_sortingLayerID()
extern "C" int32_t Canvas_get_sortingLayerID_m3685979122 (Canvas_t3310196443 * __this, const RuntimeMethod* method)
{
typedef int32_t (*Canvas_get_sortingLayerID_m3685979122_ftn) (Canvas_t3310196443 *);
static Canvas_get_sortingLayerID_m3685979122_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (Canvas_get_sortingLayerID_m3685979122_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.Canvas::get_sortingLayerID()");
int32_t retVal = _il2cpp_icall_func(__this);
return retVal;
}
// System.Void UnityEngine.Canvas::set_sortingLayerID(System.Int32)
extern "C" void Canvas_set_sortingLayerID_m861680532 (Canvas_t3310196443 * __this, int32_t ___value0, const RuntimeMethod* method)
{
typedef void (*Canvas_set_sortingLayerID_m861680532_ftn) (Canvas_t3310196443 *, int32_t);
static Canvas_set_sortingLayerID_m861680532_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (Canvas_set_sortingLayerID_m861680532_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.Canvas::set_sortingLayerID(System.Int32)");
_il2cpp_icall_func(__this, ___value0);
}
// UnityEngine.Canvas UnityEngine.Canvas::get_rootCanvas()
extern "C" Canvas_t3310196443 * Canvas_get_rootCanvas_m3165691493 (Canvas_t3310196443 * __this, const RuntimeMethod* method)
{
typedef Canvas_t3310196443 * (*Canvas_get_rootCanvas_m3165691493_ftn) (Canvas_t3310196443 *);
static Canvas_get_rootCanvas_m3165691493_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (Canvas_get_rootCanvas_m3165691493_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.Canvas::get_rootCanvas()");
Canvas_t3310196443 * retVal = _il2cpp_icall_func(__this);
return retVal;
}
// UnityEngine.Material UnityEngine.Canvas::GetDefaultCanvasMaterial()
extern "C" Material_t340375123 * Canvas_GetDefaultCanvasMaterial_m3379307325 (RuntimeObject * __this /* static, unused */, const RuntimeMethod* method)
{
typedef Material_t340375123 * (*Canvas_GetDefaultCanvasMaterial_m3379307325_ftn) ();
static Canvas_GetDefaultCanvasMaterial_m3379307325_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (Canvas_GetDefaultCanvasMaterial_m3379307325_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.Canvas::GetDefaultCanvasMaterial()");
Material_t340375123 * retVal = _il2cpp_icall_func();
return retVal;
}
// UnityEngine.Material UnityEngine.Canvas::GetETC1SupportedCanvasMaterial()
extern "C" Material_t340375123 * Canvas_GetETC1SupportedCanvasMaterial_m112029782 (RuntimeObject * __this /* static, unused */, const RuntimeMethod* method)
{
typedef Material_t340375123 * (*Canvas_GetETC1SupportedCanvasMaterial_m112029782_ftn) ();
static Canvas_GetETC1SupportedCanvasMaterial_m112029782_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (Canvas_GetETC1SupportedCanvasMaterial_m112029782_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.Canvas::GetETC1SupportedCanvasMaterial()");
Material_t340375123 * retVal = _il2cpp_icall_func();
return retVal;
}
// System.Void UnityEngine.Canvas::add_willRenderCanvases(UnityEngine.Canvas/WillRenderCanvases)
extern "C" void Canvas_add_willRenderCanvases_m1234571137 (RuntimeObject * __this /* static, unused */, WillRenderCanvases_t3309123499 * ___value0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (Canvas_add_willRenderCanvases_m1234571137_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
WillRenderCanvases_t3309123499 * V_0 = NULL;
WillRenderCanvases_t3309123499 * V_1 = NULL;
{
WillRenderCanvases_t3309123499 * L_0 = ((Canvas_t3310196443_StaticFields*)il2cpp_codegen_static_fields_for(Canvas_t3310196443_il2cpp_TypeInfo_var))->get_willRenderCanvases_2();
V_0 = L_0;
}
IL_0006:
{
WillRenderCanvases_t3309123499 * L_1 = V_0;
V_1 = L_1;
WillRenderCanvases_t3309123499 * L_2 = V_1;
WillRenderCanvases_t3309123499 * L_3 = ___value0;
Delegate_t1188392813 * L_4 = Delegate_Combine_m1859655160(NULL /*static, unused*/, L_2, L_3, /*hidden argument*/NULL);
WillRenderCanvases_t3309123499 * L_5 = V_0;
WillRenderCanvases_t3309123499 * L_6 = InterlockedCompareExchangeImpl<WillRenderCanvases_t3309123499 *>((((Canvas_t3310196443_StaticFields*)il2cpp_codegen_static_fields_for(Canvas_t3310196443_il2cpp_TypeInfo_var))->get_address_of_willRenderCanvases_2()), ((WillRenderCanvases_t3309123499 *)CastclassSealed((RuntimeObject*)L_4, WillRenderCanvases_t3309123499_il2cpp_TypeInfo_var)), L_5);
V_0 = L_6;
WillRenderCanvases_t3309123499 * L_7 = V_0;
WillRenderCanvases_t3309123499 * L_8 = V_1;
if ((!(((RuntimeObject*)(WillRenderCanvases_t3309123499 *)L_7) == ((RuntimeObject*)(WillRenderCanvases_t3309123499 *)L_8))))
{
goto IL_0006;
}
}
{
return;
}
}
// System.Void UnityEngine.Canvas::remove_willRenderCanvases(UnityEngine.Canvas/WillRenderCanvases)
extern "C" void Canvas_remove_willRenderCanvases_m3663577790 (RuntimeObject * __this /* static, unused */, WillRenderCanvases_t3309123499 * ___value0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (Canvas_remove_willRenderCanvases_m3663577790_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
WillRenderCanvases_t3309123499 * V_0 = NULL;
WillRenderCanvases_t3309123499 * V_1 = NULL;
{
WillRenderCanvases_t3309123499 * L_0 = ((Canvas_t3310196443_StaticFields*)il2cpp_codegen_static_fields_for(Canvas_t3310196443_il2cpp_TypeInfo_var))->get_willRenderCanvases_2();
V_0 = L_0;
}
IL_0006:
{
WillRenderCanvases_t3309123499 * L_1 = V_0;
V_1 = L_1;
WillRenderCanvases_t3309123499 * L_2 = V_1;
WillRenderCanvases_t3309123499 * L_3 = ___value0;
Delegate_t1188392813 * L_4 = Delegate_Remove_m334097152(NULL /*static, unused*/, L_2, L_3, /*hidden argument*/NULL);
WillRenderCanvases_t3309123499 * L_5 = V_0;
WillRenderCanvases_t3309123499 * L_6 = InterlockedCompareExchangeImpl<WillRenderCanvases_t3309123499 *>((((Canvas_t3310196443_StaticFields*)il2cpp_codegen_static_fields_for(Canvas_t3310196443_il2cpp_TypeInfo_var))->get_address_of_willRenderCanvases_2()), ((WillRenderCanvases_t3309123499 *)CastclassSealed((RuntimeObject*)L_4, WillRenderCanvases_t3309123499_il2cpp_TypeInfo_var)), L_5);
V_0 = L_6;
WillRenderCanvases_t3309123499 * L_7 = V_0;
WillRenderCanvases_t3309123499 * L_8 = V_1;
if ((!(((RuntimeObject*)(WillRenderCanvases_t3309123499 *)L_7) == ((RuntimeObject*)(WillRenderCanvases_t3309123499 *)L_8))))
{
goto IL_0006;
}
}
{
return;
}
}
// System.Void UnityEngine.Canvas::SendWillRenderCanvases()
extern "C" void Canvas_SendWillRenderCanvases_m4288867005 (RuntimeObject * __this /* static, unused */, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (Canvas_SendWillRenderCanvases_m4288867005_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
WillRenderCanvases_t3309123499 * L_0 = ((Canvas_t3310196443_StaticFields*)il2cpp_codegen_static_fields_for(Canvas_t3310196443_il2cpp_TypeInfo_var))->get_willRenderCanvases_2();
if (!L_0)
{
goto IL_0015;
}
}
{
WillRenderCanvases_t3309123499 * L_1 = ((Canvas_t3310196443_StaticFields*)il2cpp_codegen_static_fields_for(Canvas_t3310196443_il2cpp_TypeInfo_var))->get_willRenderCanvases_2();
WillRenderCanvases_Invoke_m1240663687(L_1, /*hidden argument*/NULL);
}
IL_0015:
{
return;
}
}
// System.Void UnityEngine.Canvas::ForceUpdateCanvases()
extern "C" void Canvas_ForceUpdateCanvases_m3151644478 (RuntimeObject * __this /* static, unused */, const RuntimeMethod* method)
{
{
Canvas_SendWillRenderCanvases_m4288867005(NULL /*static, unused*/, /*hidden argument*/NULL);
return;
}
}
#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
extern "C" void DelegatePInvokeWrapper_WillRenderCanvases_t3309123499 (WillRenderCanvases_t3309123499 * __this, const RuntimeMethod* method)
{
typedef void (STDCALL *PInvokeFunc)();
PInvokeFunc il2cppPInvokeFunc = reinterpret_cast<PInvokeFunc>(il2cpp_codegen_get_method_pointer(((RuntimeDelegate*)__this)->method));
// Native function invocation
il2cppPInvokeFunc();
}
// System.Void UnityEngine.Canvas/WillRenderCanvases::.ctor(System.Object,System.IntPtr)
extern "C" void WillRenderCanvases__ctor_m147079397 (WillRenderCanvases_t3309123499 * __this, RuntimeObject * ___object0, intptr_t ___method1, const RuntimeMethod* method)
{
__this->set_method_ptr_0(il2cpp_codegen_get_method_pointer((RuntimeMethod*)___method1));
__this->set_method_3(___method1);
__this->set_m_target_2(___object0);
}
// System.Void UnityEngine.Canvas/WillRenderCanvases::Invoke()
extern "C" void WillRenderCanvases_Invoke_m1240663687 (WillRenderCanvases_t3309123499 * __this, const RuntimeMethod* method)
{
if(__this->get_prev_9() != NULL)
{
WillRenderCanvases_Invoke_m1240663687((WillRenderCanvases_t3309123499 *)__this->get_prev_9(), method);
}
Il2CppMethodPointer targetMethodPointer = __this->get_method_ptr_0();
RuntimeMethod* targetMethod = (RuntimeMethod*)(__this->get_method_3());
RuntimeObject* targetThis = __this->get_m_target_2();
il2cpp_codegen_raise_execution_engine_exception_if_method_is_not_found(targetMethod);
bool ___methodIsStatic = MethodIsStatic(targetMethod);
if (___methodIsStatic)
{
if (il2cpp_codegen_method_parameter_count(targetMethod) == 0)
{
// open
typedef void (*FunctionPointerType) (RuntimeObject *, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(NULL, targetMethod);
}
else
{
// closed
typedef void (*FunctionPointerType) (RuntimeObject *, void*, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(NULL, targetThis, targetMethod);
}
}
else
{
{
// closed
typedef void (*FunctionPointerType) (void*, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(targetThis, targetMethod);
}
}
}
// System.IAsyncResult UnityEngine.Canvas/WillRenderCanvases::BeginInvoke(System.AsyncCallback,System.Object)
extern "C" RuntimeObject* WillRenderCanvases_BeginInvoke_m1804779886 (WillRenderCanvases_t3309123499 * __this, AsyncCallback_t3962456242 * ___callback0, RuntimeObject * ___object1, const RuntimeMethod* method)
{
void *__d_args[1] = {0};
return (RuntimeObject*)il2cpp_codegen_delegate_begin_invoke((RuntimeDelegate*)__this, __d_args, (RuntimeDelegate*)___callback0, (RuntimeObject*)___object1);
}
// System.Void UnityEngine.Canvas/WillRenderCanvases::EndInvoke(System.IAsyncResult)
extern "C" void WillRenderCanvases_EndInvoke_m164864243 (WillRenderCanvases_t3309123499 * __this, RuntimeObject* ___result0, const RuntimeMethod* method)
{
il2cpp_codegen_delegate_end_invoke((Il2CppAsyncResult*) ___result0, 0);
}
#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.Single UnityEngine.CanvasGroup::get_alpha()
extern "C" float CanvasGroup_get_alpha_m2918269489 (CanvasGroup_t4083511760 * __this, const RuntimeMethod* method)
{
typedef float (*CanvasGroup_get_alpha_m2918269489_ftn) (CanvasGroup_t4083511760 *);
static CanvasGroup_get_alpha_m2918269489_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (CanvasGroup_get_alpha_m2918269489_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.CanvasGroup::get_alpha()");
float retVal = _il2cpp_icall_func(__this);
return retVal;
}
// System.Void UnityEngine.CanvasGroup::set_alpha(System.Single)
extern "C" void CanvasGroup_set_alpha_m4032573 (CanvasGroup_t4083511760 * __this, float ___value0, const RuntimeMethod* method)
{
typedef void (*CanvasGroup_set_alpha_m4032573_ftn) (CanvasGroup_t4083511760 *, float);
static CanvasGroup_set_alpha_m4032573_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (CanvasGroup_set_alpha_m4032573_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.CanvasGroup::set_alpha(System.Single)");
_il2cpp_icall_func(__this, ___value0);
}
// System.Boolean UnityEngine.CanvasGroup::get_interactable()
extern "C" bool CanvasGroup_get_interactable_m1362547832 (CanvasGroup_t4083511760 * __this, const RuntimeMethod* method)
{
typedef bool (*CanvasGroup_get_interactable_m1362547832_ftn) (CanvasGroup_t4083511760 *);
static CanvasGroup_get_interactable_m1362547832_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (CanvasGroup_get_interactable_m1362547832_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.CanvasGroup::get_interactable()");
bool retVal = _il2cpp_icall_func(__this);
return retVal;
}
// System.Boolean UnityEngine.CanvasGroup::get_blocksRaycasts()
extern "C" bool CanvasGroup_get_blocksRaycasts_m1805542303 (CanvasGroup_t4083511760 * __this, const RuntimeMethod* method)
{
typedef bool (*CanvasGroup_get_blocksRaycasts_m1805542303_ftn) (CanvasGroup_t4083511760 *);
static CanvasGroup_get_blocksRaycasts_m1805542303_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (CanvasGroup_get_blocksRaycasts_m1805542303_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.CanvasGroup::get_blocksRaycasts()");
bool retVal = _il2cpp_icall_func(__this);
return retVal;
}
// System.Boolean UnityEngine.CanvasGroup::get_ignoreParentGroups()
extern "C" bool CanvasGroup_get_ignoreParentGroups_m865591534 (CanvasGroup_t4083511760 * __this, const RuntimeMethod* method)
{
typedef bool (*CanvasGroup_get_ignoreParentGroups_m865591534_ftn) (CanvasGroup_t4083511760 *);
static CanvasGroup_get_ignoreParentGroups_m865591534_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (CanvasGroup_get_ignoreParentGroups_m865591534_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.CanvasGroup::get_ignoreParentGroups()");
bool retVal = _il2cpp_icall_func(__this);
return retVal;
}
// System.Boolean UnityEngine.CanvasGroup::IsRaycastLocationValid(UnityEngine.Vector2,UnityEngine.Camera)
extern "C" bool CanvasGroup_IsRaycastLocationValid_m2128397950 (CanvasGroup_t4083511760 * __this, Vector2_t2156229523 ___sp0, Camera_t4157153871 * ___eventCamera1, const RuntimeMethod* method)
{
bool V_0 = false;
{
bool L_0 = CanvasGroup_get_blocksRaycasts_m1805542303(__this, /*hidden argument*/NULL);
V_0 = L_0;
goto IL_000d;
}
IL_000d:
{
bool L_1 = V_0;
return L_1;
}
}
#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.Void UnityEngine.CanvasRenderer::SetColor(UnityEngine.Color)
extern "C" void CanvasRenderer_SetColor_m3072996306 (CanvasRenderer_t2598313366 * __this, Color_t2555686324 ___color0, const RuntimeMethod* method)
{
{
CanvasRenderer_INTERNAL_CALL_SetColor_m324218710(NULL /*static, unused*/, __this, (&___color0), /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.CanvasRenderer::INTERNAL_CALL_SetColor(UnityEngine.CanvasRenderer,UnityEngine.Color&)
extern "C" void CanvasRenderer_INTERNAL_CALL_SetColor_m324218710 (RuntimeObject * __this /* static, unused */, CanvasRenderer_t2598313366 * ___self0, Color_t2555686324 * ___color1, const RuntimeMethod* method)
{
typedef void (*CanvasRenderer_INTERNAL_CALL_SetColor_m324218710_ftn) (CanvasRenderer_t2598313366 *, Color_t2555686324 *);
static CanvasRenderer_INTERNAL_CALL_SetColor_m324218710_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (CanvasRenderer_INTERNAL_CALL_SetColor_m324218710_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.CanvasRenderer::INTERNAL_CALL_SetColor(UnityEngine.CanvasRenderer,UnityEngine.Color&)");
_il2cpp_icall_func(___self0, ___color1);
}
// UnityEngine.Color UnityEngine.CanvasRenderer::GetColor()
extern "C" Color_t2555686324 CanvasRenderer_GetColor_m2699192164 (CanvasRenderer_t2598313366 * __this, const RuntimeMethod* method)
{
Color_t2555686324 V_0;
memset(&V_0, 0, sizeof(V_0));
Color_t2555686324 V_1;
memset(&V_1, 0, sizeof(V_1));
{
CanvasRenderer_INTERNAL_CALL_GetColor_m597074473(NULL /*static, unused*/, __this, (&V_0), /*hidden argument*/NULL);
Color_t2555686324 L_0 = V_0;
V_1 = L_0;
goto IL_0010;
}
IL_0010:
{
Color_t2555686324 L_1 = V_1;
return L_1;
}
}
// System.Void UnityEngine.CanvasRenderer::INTERNAL_CALL_GetColor(UnityEngine.CanvasRenderer,UnityEngine.Color&)
extern "C" void CanvasRenderer_INTERNAL_CALL_GetColor_m597074473 (RuntimeObject * __this /* static, unused */, CanvasRenderer_t2598313366 * ___self0, Color_t2555686324 * ___value1, const RuntimeMethod* method)
{
typedef void (*CanvasRenderer_INTERNAL_CALL_GetColor_m597074473_ftn) (CanvasRenderer_t2598313366 *, Color_t2555686324 *);
static CanvasRenderer_INTERNAL_CALL_GetColor_m597074473_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (CanvasRenderer_INTERNAL_CALL_GetColor_m597074473_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.CanvasRenderer::INTERNAL_CALL_GetColor(UnityEngine.CanvasRenderer,UnityEngine.Color&)");
_il2cpp_icall_func(___self0, ___value1);
}
// System.Void UnityEngine.CanvasRenderer::EnableRectClipping(UnityEngine.Rect)
extern "C" void CanvasRenderer_EnableRectClipping_m3229830510 (CanvasRenderer_t2598313366 * __this, Rect_t2360479859 ___rect0, const RuntimeMethod* method)
{
{
CanvasRenderer_INTERNAL_CALL_EnableRectClipping_m3318097918(NULL /*static, unused*/, __this, (&___rect0), /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.CanvasRenderer::INTERNAL_CALL_EnableRectClipping(UnityEngine.CanvasRenderer,UnityEngine.Rect&)
extern "C" void CanvasRenderer_INTERNAL_CALL_EnableRectClipping_m3318097918 (RuntimeObject * __this /* static, unused */, CanvasRenderer_t2598313366 * ___self0, Rect_t2360479859 * ___rect1, const RuntimeMethod* method)
{
typedef void (*CanvasRenderer_INTERNAL_CALL_EnableRectClipping_m3318097918_ftn) (CanvasRenderer_t2598313366 *, Rect_t2360479859 *);
static CanvasRenderer_INTERNAL_CALL_EnableRectClipping_m3318097918_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (CanvasRenderer_INTERNAL_CALL_EnableRectClipping_m3318097918_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.CanvasRenderer::INTERNAL_CALL_EnableRectClipping(UnityEngine.CanvasRenderer,UnityEngine.Rect&)");
_il2cpp_icall_func(___self0, ___rect1);
}
// System.Void UnityEngine.CanvasRenderer::DisableRectClipping()
extern "C" void CanvasRenderer_DisableRectClipping_m56522661 (CanvasRenderer_t2598313366 * __this, const RuntimeMethod* method)
{
typedef void (*CanvasRenderer_DisableRectClipping_m56522661_ftn) (CanvasRenderer_t2598313366 *);
static CanvasRenderer_DisableRectClipping_m56522661_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (CanvasRenderer_DisableRectClipping_m56522661_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.CanvasRenderer::DisableRectClipping()");
_il2cpp_icall_func(__this);
}
// System.Void UnityEngine.CanvasRenderer::set_hasPopInstruction(System.Boolean)
extern "C" void CanvasRenderer_set_hasPopInstruction_m888468686 (CanvasRenderer_t2598313366 * __this, bool ___value0, const RuntimeMethod* method)
{
typedef void (*CanvasRenderer_set_hasPopInstruction_m888468686_ftn) (CanvasRenderer_t2598313366 *, bool);
static CanvasRenderer_set_hasPopInstruction_m888468686_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (CanvasRenderer_set_hasPopInstruction_m888468686_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.CanvasRenderer::set_hasPopInstruction(System.Boolean)");
_il2cpp_icall_func(__this, ___value0);
}
// System.Int32 UnityEngine.CanvasRenderer::get_materialCount()
extern "C" int32_t CanvasRenderer_get_materialCount_m2162898709 (CanvasRenderer_t2598313366 * __this, const RuntimeMethod* method)
{
typedef int32_t (*CanvasRenderer_get_materialCount_m2162898709_ftn) (CanvasRenderer_t2598313366 *);
static CanvasRenderer_get_materialCount_m2162898709_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (CanvasRenderer_get_materialCount_m2162898709_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.CanvasRenderer::get_materialCount()");
int32_t retVal = _il2cpp_icall_func(__this);
return retVal;
}
// System.Void UnityEngine.CanvasRenderer::set_materialCount(System.Int32)
extern "C" void CanvasRenderer_set_materialCount_m4286588063 (CanvasRenderer_t2598313366 * __this, int32_t ___value0, const RuntimeMethod* method)
{
typedef void (*CanvasRenderer_set_materialCount_m4286588063_ftn) (CanvasRenderer_t2598313366 *, int32_t);
static CanvasRenderer_set_materialCount_m4286588063_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (CanvasRenderer_set_materialCount_m4286588063_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.CanvasRenderer::set_materialCount(System.Int32)");
_il2cpp_icall_func(__this, ___value0);
}
// System.Void UnityEngine.CanvasRenderer::SetMaterial(UnityEngine.Material,System.Int32)
extern "C" void CanvasRenderer_SetMaterial_m824577244 (CanvasRenderer_t2598313366 * __this, Material_t340375123 * ___material0, int32_t ___index1, const RuntimeMethod* method)
{
typedef void (*CanvasRenderer_SetMaterial_m824577244_ftn) (CanvasRenderer_t2598313366 *, Material_t340375123 *, int32_t);
static CanvasRenderer_SetMaterial_m824577244_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (CanvasRenderer_SetMaterial_m824577244_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.CanvasRenderer::SetMaterial(UnityEngine.Material,System.Int32)");
_il2cpp_icall_func(__this, ___material0, ___index1);
}
// System.Void UnityEngine.CanvasRenderer::SetMaterial(UnityEngine.Material,UnityEngine.Texture)
extern "C" void CanvasRenderer_SetMaterial_m633746949 (CanvasRenderer_t2598313366 * __this, Material_t340375123 * ___material0, Texture_t3661962703 * ___texture1, const RuntimeMethod* method)
{
{
int32_t L_0 = CanvasRenderer_get_materialCount_m2162898709(__this, /*hidden argument*/NULL);
int32_t L_1 = Math_Max_m1873195862(NULL /*static, unused*/, 1, L_0, /*hidden argument*/NULL);
CanvasRenderer_set_materialCount_m4286588063(__this, L_1, /*hidden argument*/NULL);
Material_t340375123 * L_2 = ___material0;
CanvasRenderer_SetMaterial_m824577244(__this, L_2, 0, /*hidden argument*/NULL);
Texture_t3661962703 * L_3 = ___texture1;
CanvasRenderer_SetTexture_m1600559835(__this, L_3, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.CanvasRenderer::set_popMaterialCount(System.Int32)
extern "C" void CanvasRenderer_set_popMaterialCount_m1224846275 (CanvasRenderer_t2598313366 * __this, int32_t ___value0, const RuntimeMethod* method)
{
typedef void (*CanvasRenderer_set_popMaterialCount_m1224846275_ftn) (CanvasRenderer_t2598313366 *, int32_t);
static CanvasRenderer_set_popMaterialCount_m1224846275_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (CanvasRenderer_set_popMaterialCount_m1224846275_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.CanvasRenderer::set_popMaterialCount(System.Int32)");
_il2cpp_icall_func(__this, ___value0);
}
// System.Void UnityEngine.CanvasRenderer::SetPopMaterial(UnityEngine.Material,System.Int32)
extern "C" void CanvasRenderer_SetPopMaterial_m2720611463 (CanvasRenderer_t2598313366 * __this, Material_t340375123 * ___material0, int32_t ___index1, const RuntimeMethod* method)
{
typedef void (*CanvasRenderer_SetPopMaterial_m2720611463_ftn) (CanvasRenderer_t2598313366 *, Material_t340375123 *, int32_t);
static CanvasRenderer_SetPopMaterial_m2720611463_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (CanvasRenderer_SetPopMaterial_m2720611463_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.CanvasRenderer::SetPopMaterial(UnityEngine.Material,System.Int32)");
_il2cpp_icall_func(__this, ___material0, ___index1);
}
// System.Void UnityEngine.CanvasRenderer::SetTexture(UnityEngine.Texture)
extern "C" void CanvasRenderer_SetTexture_m1600559835 (CanvasRenderer_t2598313366 * __this, Texture_t3661962703 * ___texture0, const RuntimeMethod* method)
{
typedef void (*CanvasRenderer_SetTexture_m1600559835_ftn) (CanvasRenderer_t2598313366 *, Texture_t3661962703 *);
static CanvasRenderer_SetTexture_m1600559835_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (CanvasRenderer_SetTexture_m1600559835_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.CanvasRenderer::SetTexture(UnityEngine.Texture)");
_il2cpp_icall_func(__this, ___texture0);
}
// System.Void UnityEngine.CanvasRenderer::SetAlphaTexture(UnityEngine.Texture)
extern "C" void CanvasRenderer_SetAlphaTexture_m2009567627 (CanvasRenderer_t2598313366 * __this, Texture_t3661962703 * ___texture0, const RuntimeMethod* method)
{
typedef void (*CanvasRenderer_SetAlphaTexture_m2009567627_ftn) (CanvasRenderer_t2598313366 *, Texture_t3661962703 *);
static CanvasRenderer_SetAlphaTexture_m2009567627_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (CanvasRenderer_SetAlphaTexture_m2009567627_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.CanvasRenderer::SetAlphaTexture(UnityEngine.Texture)");
_il2cpp_icall_func(__this, ___texture0);
}
// System.Void UnityEngine.CanvasRenderer::SetMesh(UnityEngine.Mesh)
extern "C" void CanvasRenderer_SetMesh_m769025979 (CanvasRenderer_t2598313366 * __this, Mesh_t3648964284 * ___mesh0, const RuntimeMethod* method)
{
typedef void (*CanvasRenderer_SetMesh_m769025979_ftn) (CanvasRenderer_t2598313366 *, Mesh_t3648964284 *);
static CanvasRenderer_SetMesh_m769025979_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (CanvasRenderer_SetMesh_m769025979_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.CanvasRenderer::SetMesh(UnityEngine.Mesh)");
_il2cpp_icall_func(__this, ___mesh0);
}
// System.Void UnityEngine.CanvasRenderer::Clear()
extern "C" void CanvasRenderer_Clear_m1522820210 (CanvasRenderer_t2598313366 * __this, const RuntimeMethod* method)
{
typedef void (*CanvasRenderer_Clear_m1522820210_ftn) (CanvasRenderer_t2598313366 *);
static CanvasRenderer_Clear_m1522820210_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (CanvasRenderer_Clear_m1522820210_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.CanvasRenderer::Clear()");
_il2cpp_icall_func(__this);
}
// System.Void UnityEngine.CanvasRenderer::SplitUIVertexStreams(System.Collections.Generic.List`1<UnityEngine.UIVertex>,System.Collections.Generic.List`1<UnityEngine.Vector3>,System.Collections.Generic.List`1<UnityEngine.Color32>,System.Collections.Generic.List`1<UnityEngine.Vector2>,System.Collections.Generic.List`1<UnityEngine.Vector2>,System.Collections.Generic.List`1<UnityEngine.Vector2>,System.Collections.Generic.List`1<UnityEngine.Vector2>,System.Collections.Generic.List`1<UnityEngine.Vector3>,System.Collections.Generic.List`1<UnityEngine.Vector4>,System.Collections.Generic.List`1<System.Int32>)
extern "C" void CanvasRenderer_SplitUIVertexStreams_m2753637362 (RuntimeObject * __this /* static, unused */, List_1_t1234605051 * ___verts0, List_1_t899420910 * ___positions1, List_1_t4072576034 * ___colors2, List_1_t3628304265 * ___uv0S3, List_1_t3628304265 * ___uv1S4, List_1_t3628304265 * ___uv2S5, List_1_t3628304265 * ___uv3S6, List_1_t899420910 * ___normals7, List_1_t496136383 * ___tangents8, List_1_t128053199 * ___indices9, const RuntimeMethod* method)
{
{
List_1_t1234605051 * L_0 = ___verts0;
List_1_t899420910 * L_1 = ___positions1;
List_1_t4072576034 * L_2 = ___colors2;
List_1_t3628304265 * L_3 = ___uv0S3;
List_1_t3628304265 * L_4 = ___uv1S4;
List_1_t3628304265 * L_5 = ___uv2S5;
List_1_t3628304265 * L_6 = ___uv3S6;
List_1_t899420910 * L_7 = ___normals7;
List_1_t496136383 * L_8 = ___tangents8;
CanvasRenderer_SplitUIVertexStreamsInternal_m3280623346(NULL /*static, unused*/, L_0, L_1, L_2, L_3, L_4, L_5, L_6, L_7, L_8, /*hidden argument*/NULL);
List_1_t1234605051 * L_9 = ___verts0;
List_1_t128053199 * L_10 = ___indices9;
CanvasRenderer_SplitIndicesStreamsInternal_m2851933301(NULL /*static, unused*/, L_9, L_10, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.CanvasRenderer::SplitUIVertexStreamsInternal(System.Object,System.Object,System.Object,System.Object,System.Object,System.Object,System.Object,System.Object,System.Object)
extern "C" void CanvasRenderer_SplitUIVertexStreamsInternal_m3280623346 (RuntimeObject * __this /* static, unused */, RuntimeObject * ___verts0, RuntimeObject * ___positions1, RuntimeObject * ___colors2, RuntimeObject * ___uv0S3, RuntimeObject * ___uv1S4, RuntimeObject * ___uv2S5, RuntimeObject * ___uv3S6, RuntimeObject * ___normals7, RuntimeObject * ___tangents8, const RuntimeMethod* method)
{
typedef void (*CanvasRenderer_SplitUIVertexStreamsInternal_m3280623346_ftn) (RuntimeObject *, RuntimeObject *, RuntimeObject *, RuntimeObject *, RuntimeObject *, RuntimeObject *, RuntimeObject *, RuntimeObject *, RuntimeObject *);
static CanvasRenderer_SplitUIVertexStreamsInternal_m3280623346_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (CanvasRenderer_SplitUIVertexStreamsInternal_m3280623346_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.CanvasRenderer::SplitUIVertexStreamsInternal(System.Object,System.Object,System.Object,System.Object,System.Object,System.Object,System.Object,System.Object,System.Object)");
_il2cpp_icall_func(___verts0, ___positions1, ___colors2, ___uv0S3, ___uv1S4, ___uv2S5, ___uv3S6, ___normals7, ___tangents8);
}
// System.Void UnityEngine.CanvasRenderer::SplitIndicesStreamsInternal(System.Object,System.Object)
extern "C" void CanvasRenderer_SplitIndicesStreamsInternal_m2851933301 (RuntimeObject * __this /* static, unused */, RuntimeObject * ___verts0, RuntimeObject * ___indices1, const RuntimeMethod* method)
{
typedef void (*CanvasRenderer_SplitIndicesStreamsInternal_m2851933301_ftn) (RuntimeObject *, RuntimeObject *);
static CanvasRenderer_SplitIndicesStreamsInternal_m2851933301_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (CanvasRenderer_SplitIndicesStreamsInternal_m2851933301_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.CanvasRenderer::SplitIndicesStreamsInternal(System.Object,System.Object)");
_il2cpp_icall_func(___verts0, ___indices1);
}
// System.Void UnityEngine.CanvasRenderer::CreateUIVertexStream(System.Collections.Generic.List`1<UnityEngine.UIVertex>,System.Collections.Generic.List`1<UnityEngine.Vector3>,System.Collections.Generic.List`1<UnityEngine.Color32>,System.Collections.Generic.List`1<UnityEngine.Vector2>,System.Collections.Generic.List`1<UnityEngine.Vector2>,System.Collections.Generic.List`1<UnityEngine.Vector2>,System.Collections.Generic.List`1<UnityEngine.Vector2>,System.Collections.Generic.List`1<UnityEngine.Vector3>,System.Collections.Generic.List`1<UnityEngine.Vector4>,System.Collections.Generic.List`1<System.Int32>)
extern "C" void CanvasRenderer_CreateUIVertexStream_m2424310831 (RuntimeObject * __this /* static, unused */, List_1_t1234605051 * ___verts0, List_1_t899420910 * ___positions1, List_1_t4072576034 * ___colors2, List_1_t3628304265 * ___uv0S3, List_1_t3628304265 * ___uv1S4, List_1_t3628304265 * ___uv2S5, List_1_t3628304265 * ___uv3S6, List_1_t899420910 * ___normals7, List_1_t496136383 * ___tangents8, List_1_t128053199 * ___indices9, const RuntimeMethod* method)
{
{
List_1_t1234605051 * L_0 = ___verts0;
List_1_t899420910 * L_1 = ___positions1;
List_1_t4072576034 * L_2 = ___colors2;
List_1_t3628304265 * L_3 = ___uv0S3;
List_1_t3628304265 * L_4 = ___uv1S4;
List_1_t3628304265 * L_5 = ___uv2S5;
List_1_t3628304265 * L_6 = ___uv3S6;
List_1_t899420910 * L_7 = ___normals7;
List_1_t496136383 * L_8 = ___tangents8;
List_1_t128053199 * L_9 = ___indices9;
CanvasRenderer_CreateUIVertexStreamInternal_m543814397(NULL /*static, unused*/, L_0, L_1, L_2, L_3, L_4, L_5, L_6, L_7, L_8, L_9, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.CanvasRenderer::CreateUIVertexStreamInternal(System.Object,System.Object,System.Object,System.Object,System.Object,System.Object,System.Object,System.Object,System.Object,System.Object)
extern "C" void CanvasRenderer_CreateUIVertexStreamInternal_m543814397 (RuntimeObject * __this /* static, unused */, RuntimeObject * ___verts0, RuntimeObject * ___positions1, RuntimeObject * ___colors2, RuntimeObject * ___uv0S3, RuntimeObject * ___uv1S4, RuntimeObject * ___uv2S5, RuntimeObject * ___uv3S6, RuntimeObject * ___normals7, RuntimeObject * ___tangents8, RuntimeObject * ___indices9, const RuntimeMethod* method)
{
typedef void (*CanvasRenderer_CreateUIVertexStreamInternal_m543814397_ftn) (RuntimeObject *, RuntimeObject *, RuntimeObject *, RuntimeObject *, RuntimeObject *, RuntimeObject *, RuntimeObject *, RuntimeObject *, RuntimeObject *, RuntimeObject *);
static CanvasRenderer_CreateUIVertexStreamInternal_m543814397_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (CanvasRenderer_CreateUIVertexStreamInternal_m543814397_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.CanvasRenderer::CreateUIVertexStreamInternal(System.Object,System.Object,System.Object,System.Object,System.Object,System.Object,System.Object,System.Object,System.Object,System.Object)");
_il2cpp_icall_func(___verts0, ___positions1, ___colors2, ___uv0S3, ___uv1S4, ___uv2S5, ___uv3S6, ___normals7, ___tangents8, ___indices9);
}
// System.Void UnityEngine.CanvasRenderer::AddUIVertexStream(System.Collections.Generic.List`1<UnityEngine.UIVertex>,System.Collections.Generic.List`1<UnityEngine.Vector3>,System.Collections.Generic.List`1<UnityEngine.Color32>,System.Collections.Generic.List`1<UnityEngine.Vector2>,System.Collections.Generic.List`1<UnityEngine.Vector2>,System.Collections.Generic.List`1<UnityEngine.Vector2>,System.Collections.Generic.List`1<UnityEngine.Vector2>,System.Collections.Generic.List`1<UnityEngine.Vector3>,System.Collections.Generic.List`1<UnityEngine.Vector4>)
extern "C" void CanvasRenderer_AddUIVertexStream_m1208603572 (RuntimeObject * __this /* static, unused */, List_1_t1234605051 * ___verts0, List_1_t899420910 * ___positions1, List_1_t4072576034 * ___colors2, List_1_t3628304265 * ___uv0S3, List_1_t3628304265 * ___uv1S4, List_1_t3628304265 * ___uv2S5, List_1_t3628304265 * ___uv3S6, List_1_t899420910 * ___normals7, List_1_t496136383 * ___tangents8, const RuntimeMethod* method)
{
{
List_1_t1234605051 * L_0 = ___verts0;
List_1_t899420910 * L_1 = ___positions1;
List_1_t4072576034 * L_2 = ___colors2;
List_1_t3628304265 * L_3 = ___uv0S3;
List_1_t3628304265 * L_4 = ___uv1S4;
List_1_t3628304265 * L_5 = ___uv2S5;
List_1_t3628304265 * L_6 = ___uv3S6;
List_1_t899420910 * L_7 = ___normals7;
List_1_t496136383 * L_8 = ___tangents8;
CanvasRenderer_SplitUIVertexStreamsInternal_m3280623346(NULL /*static, unused*/, L_0, L_1, L_2, L_3, L_4, L_5, L_6, L_7, L_8, /*hidden argument*/NULL);
return;
}
}
// System.Boolean UnityEngine.CanvasRenderer::get_cull()
extern "C" bool CanvasRenderer_get_cull_m2436587240 (CanvasRenderer_t2598313366 * __this, const RuntimeMethod* method)
{
typedef bool (*CanvasRenderer_get_cull_m2436587240_ftn) (CanvasRenderer_t2598313366 *);
static CanvasRenderer_get_cull_m2436587240_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (CanvasRenderer_get_cull_m2436587240_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.CanvasRenderer::get_cull()");
bool retVal = _il2cpp_icall_func(__this);
return retVal;
}
// System.Void UnityEngine.CanvasRenderer::set_cull(System.Boolean)
extern "C" void CanvasRenderer_set_cull_m4222419074 (CanvasRenderer_t2598313366 * __this, bool ___value0, const RuntimeMethod* method)
{
typedef void (*CanvasRenderer_set_cull_m4222419074_ftn) (CanvasRenderer_t2598313366 *, bool);
static CanvasRenderer_set_cull_m4222419074_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (CanvasRenderer_set_cull_m4222419074_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.CanvasRenderer::set_cull(System.Boolean)");
_il2cpp_icall_func(__this, ___value0);
}
// System.Int32 UnityEngine.CanvasRenderer::get_absoluteDepth()
extern "C" int32_t CanvasRenderer_get_absoluteDepth_m2703237819 (CanvasRenderer_t2598313366 * __this, const RuntimeMethod* method)
{
typedef int32_t (*CanvasRenderer_get_absoluteDepth_m2703237819_ftn) (CanvasRenderer_t2598313366 *);
static CanvasRenderer_get_absoluteDepth_m2703237819_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (CanvasRenderer_get_absoluteDepth_m2703237819_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.CanvasRenderer::get_absoluteDepth()");
int32_t retVal = _il2cpp_icall_func(__this);
return retVal;
}
// System.Boolean UnityEngine.CanvasRenderer::get_hasMoved()
extern "C" bool CanvasRenderer_get_hasMoved_m2236392341 (CanvasRenderer_t2598313366 * __this, const RuntimeMethod* method)
{
typedef bool (*CanvasRenderer_get_hasMoved_m2236392341_ftn) (CanvasRenderer_t2598313366 *);
static CanvasRenderer_get_hasMoved_m2236392341_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (CanvasRenderer_get_hasMoved_m2236392341_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.CanvasRenderer::get_hasMoved()");
bool retVal = _il2cpp_icall_func(__this);
return retVal;
}
#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.RectTransformUtility::RectangleContainsScreenPoint(UnityEngine.RectTransform,UnityEngine.Vector2,UnityEngine.Camera)
extern "C" bool RectTransformUtility_RectangleContainsScreenPoint_m4031431712 (RuntimeObject * __this /* static, unused */, RectTransform_t3704657025 * ___rect0, Vector2_t2156229523 ___screenPoint1, Camera_t4157153871 * ___cam2, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (RectTransformUtility_RectangleContainsScreenPoint_m4031431712_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
bool V_0 = false;
{
RectTransform_t3704657025 * L_0 = ___rect0;
Camera_t4157153871 * L_1 = ___cam2;
IL2CPP_RUNTIME_CLASS_INIT(RectTransformUtility_t1743242446_il2cpp_TypeInfo_var);
bool L_2 = RectTransformUtility_INTERNAL_CALL_RectangleContainsScreenPoint_m1214874141(NULL /*static, unused*/, L_0, (&___screenPoint1), L_1, /*hidden argument*/NULL);
V_0 = L_2;
goto IL_0010;
}
IL_0010:
{
bool L_3 = V_0;
return L_3;
}
}
// System.Boolean UnityEngine.RectTransformUtility::INTERNAL_CALL_RectangleContainsScreenPoint(UnityEngine.RectTransform,UnityEngine.Vector2&,UnityEngine.Camera)
extern "C" bool RectTransformUtility_INTERNAL_CALL_RectangleContainsScreenPoint_m1214874141 (RuntimeObject * __this /* static, unused */, RectTransform_t3704657025 * ___rect0, Vector2_t2156229523 * ___screenPoint1, Camera_t4157153871 * ___cam2, const RuntimeMethod* method)
{
typedef bool (*RectTransformUtility_INTERNAL_CALL_RectangleContainsScreenPoint_m1214874141_ftn) (RectTransform_t3704657025 *, Vector2_t2156229523 *, Camera_t4157153871 *);
static RectTransformUtility_INTERNAL_CALL_RectangleContainsScreenPoint_m1214874141_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (RectTransformUtility_INTERNAL_CALL_RectangleContainsScreenPoint_m1214874141_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.RectTransformUtility::INTERNAL_CALL_RectangleContainsScreenPoint(UnityEngine.RectTransform,UnityEngine.Vector2&,UnityEngine.Camera)");
bool retVal = _il2cpp_icall_func(___rect0, ___screenPoint1, ___cam2);
return retVal;
}
// UnityEngine.Vector2 UnityEngine.RectTransformUtility::PixelAdjustPoint(UnityEngine.Vector2,UnityEngine.Transform,UnityEngine.Canvas)
extern "C" Vector2_t2156229523 RectTransformUtility_PixelAdjustPoint_m1850521440 (RuntimeObject * __this /* static, unused */, Vector2_t2156229523 ___point0, Transform_t3600365921 * ___elementTransform1, Canvas_t3310196443 * ___canvas2, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (RectTransformUtility_PixelAdjustPoint_m1850521440_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
Vector2_t2156229523 V_0;
memset(&V_0, 0, sizeof(V_0));
Vector2_t2156229523 V_1;
memset(&V_1, 0, sizeof(V_1));
{
Transform_t3600365921 * L_0 = ___elementTransform1;
Canvas_t3310196443 * L_1 = ___canvas2;
IL2CPP_RUNTIME_CLASS_INIT(RectTransformUtility_t1743242446_il2cpp_TypeInfo_var);
RectTransformUtility_INTERNAL_CALL_PixelAdjustPoint_m1064459754(NULL /*static, unused*/, (&___point0), L_0, L_1, (&V_0), /*hidden argument*/NULL);
Vector2_t2156229523 L_2 = V_0;
V_1 = L_2;
goto IL_0013;
}
IL_0013:
{
Vector2_t2156229523 L_3 = V_1;
return L_3;
}
}
// System.Void UnityEngine.RectTransformUtility::INTERNAL_CALL_PixelAdjustPoint(UnityEngine.Vector2&,UnityEngine.Transform,UnityEngine.Canvas,UnityEngine.Vector2&)
extern "C" void RectTransformUtility_INTERNAL_CALL_PixelAdjustPoint_m1064459754 (RuntimeObject * __this /* static, unused */, Vector2_t2156229523 * ___point0, Transform_t3600365921 * ___elementTransform1, Canvas_t3310196443 * ___canvas2, Vector2_t2156229523 * ___value3, const RuntimeMethod* method)
{
typedef void (*RectTransformUtility_INTERNAL_CALL_PixelAdjustPoint_m1064459754_ftn) (Vector2_t2156229523 *, Transform_t3600365921 *, Canvas_t3310196443 *, Vector2_t2156229523 *);
static RectTransformUtility_INTERNAL_CALL_PixelAdjustPoint_m1064459754_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (RectTransformUtility_INTERNAL_CALL_PixelAdjustPoint_m1064459754_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.RectTransformUtility::INTERNAL_CALL_PixelAdjustPoint(UnityEngine.Vector2&,UnityEngine.Transform,UnityEngine.Canvas,UnityEngine.Vector2&)");
_il2cpp_icall_func(___point0, ___elementTransform1, ___canvas2, ___value3);
}
// UnityEngine.Rect UnityEngine.RectTransformUtility::PixelAdjustRect(UnityEngine.RectTransform,UnityEngine.Canvas)
extern "C" Rect_t2360479859 RectTransformUtility_PixelAdjustRect_m1716244231 (RuntimeObject * __this /* static, unused */, RectTransform_t3704657025 * ___rectTransform0, Canvas_t3310196443 * ___canvas1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (RectTransformUtility_PixelAdjustRect_m1716244231_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
Rect_t2360479859 V_0;
memset(&V_0, 0, sizeof(V_0));
Rect_t2360479859 V_1;
memset(&V_1, 0, sizeof(V_1));
{
RectTransform_t3704657025 * L_0 = ___rectTransform0;
Canvas_t3310196443 * L_1 = ___canvas1;
IL2CPP_RUNTIME_CLASS_INIT(RectTransformUtility_t1743242446_il2cpp_TypeInfo_var);
RectTransformUtility_INTERNAL_CALL_PixelAdjustRect_m740389236(NULL /*static, unused*/, L_0, L_1, (&V_0), /*hidden argument*/NULL);
Rect_t2360479859 L_2 = V_0;
V_1 = L_2;
goto IL_0011;
}
IL_0011:
{
Rect_t2360479859 L_3 = V_1;
return L_3;
}
}
// System.Void UnityEngine.RectTransformUtility::INTERNAL_CALL_PixelAdjustRect(UnityEngine.RectTransform,UnityEngine.Canvas,UnityEngine.Rect&)
extern "C" void RectTransformUtility_INTERNAL_CALL_PixelAdjustRect_m740389236 (RuntimeObject * __this /* static, unused */, RectTransform_t3704657025 * ___rectTransform0, Canvas_t3310196443 * ___canvas1, Rect_t2360479859 * ___value2, const RuntimeMethod* method)
{
typedef void (*RectTransformUtility_INTERNAL_CALL_PixelAdjustRect_m740389236_ftn) (RectTransform_t3704657025 *, Canvas_t3310196443 *, Rect_t2360479859 *);
static RectTransformUtility_INTERNAL_CALL_PixelAdjustRect_m740389236_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (RectTransformUtility_INTERNAL_CALL_PixelAdjustRect_m740389236_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.RectTransformUtility::INTERNAL_CALL_PixelAdjustRect(UnityEngine.RectTransform,UnityEngine.Canvas,UnityEngine.Rect&)");
_il2cpp_icall_func(___rectTransform0, ___canvas1, ___value2);
}
// System.Boolean UnityEngine.RectTransformUtility::ScreenPointToWorldPointInRectangle(UnityEngine.RectTransform,UnityEngine.Vector2,UnityEngine.Camera,UnityEngine.Vector3&)
extern "C" bool RectTransformUtility_ScreenPointToWorldPointInRectangle_m1761902807 (RuntimeObject * __this /* static, unused */, RectTransform_t3704657025 * ___rect0, Vector2_t2156229523 ___screenPoint1, Camera_t4157153871 * ___cam2, Vector3_t3722313464 * ___worldPoint3, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (RectTransformUtility_ScreenPointToWorldPointInRectangle_m1761902807_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
Ray_t3785851493 V_0;
memset(&V_0, 0, sizeof(V_0));
Plane_t1000493321 V_1;
memset(&V_1, 0, sizeof(V_1));
float V_2 = 0.0f;
bool V_3 = false;
{
Vector3_t3722313464 * L_0 = ___worldPoint3;
IL2CPP_RUNTIME_CLASS_INIT(Vector2_t2156229523_il2cpp_TypeInfo_var);
Vector2_t2156229523 L_1 = Vector2_get_zero_m540426400(NULL /*static, unused*/, /*hidden argument*/NULL);
Vector3_t3722313464 L_2 = Vector2_op_Implicit_m1860157806(NULL /*static, unused*/, L_1, /*hidden argument*/NULL);
*(Vector3_t3722313464 *)L_0 = L_2;
Camera_t4157153871 * L_3 = ___cam2;
Vector2_t2156229523 L_4 = ___screenPoint1;
IL2CPP_RUNTIME_CLASS_INIT(RectTransformUtility_t1743242446_il2cpp_TypeInfo_var);
Ray_t3785851493 L_5 = RectTransformUtility_ScreenPointToRay_m85042072(NULL /*static, unused*/, L_3, L_4, /*hidden argument*/NULL);
V_0 = L_5;
RectTransform_t3704657025 * L_6 = ___rect0;
Quaternion_t2301928331 L_7 = Transform_get_rotation_m3502953881(L_6, /*hidden argument*/NULL);
IL2CPP_RUNTIME_CLASS_INIT(Vector3_t3722313464_il2cpp_TypeInfo_var);
Vector3_t3722313464 L_8 = Vector3_get_back_m4077847766(NULL /*static, unused*/, /*hidden argument*/NULL);
IL2CPP_RUNTIME_CLASS_INIT(Quaternion_t2301928331_il2cpp_TypeInfo_var);
Vector3_t3722313464 L_9 = Quaternion_op_Multiply_m2607404835(NULL /*static, unused*/, L_7, L_8, /*hidden argument*/NULL);
RectTransform_t3704657025 * L_10 = ___rect0;
Vector3_t3722313464 L_11 = Transform_get_position_m36019626(L_10, /*hidden argument*/NULL);
Plane__ctor_m2890438515((&V_1), L_9, L_11, /*hidden argument*/NULL);
Ray_t3785851493 L_12 = V_0;
bool L_13 = Plane_Raycast_m62370169((&V_1), L_12, (&V_2), /*hidden argument*/NULL);
if (L_13)
{
goto IL_004c;
}
}
{
V_3 = (bool)0;
goto IL_0061;
}
IL_004c:
{
Vector3_t3722313464 * L_14 = ___worldPoint3;
float L_15 = V_2;
Vector3_t3722313464 L_16 = Ray_GetPoint_m1852405345((&V_0), L_15, /*hidden argument*/NULL);
*(Vector3_t3722313464 *)L_14 = L_16;
V_3 = (bool)1;
goto IL_0061;
}
IL_0061:
{
bool L_17 = V_3;
return L_17;
}
}
// System.Boolean UnityEngine.RectTransformUtility::ScreenPointToLocalPointInRectangle(UnityEngine.RectTransform,UnityEngine.Vector2,UnityEngine.Camera,UnityEngine.Vector2&)
extern "C" bool RectTransformUtility_ScreenPointToLocalPointInRectangle_m2327269187 (RuntimeObject * __this /* static, unused */, RectTransform_t3704657025 * ___rect0, Vector2_t2156229523 ___screenPoint1, Camera_t4157153871 * ___cam2, Vector2_t2156229523 * ___localPoint3, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (RectTransformUtility_ScreenPointToLocalPointInRectangle_m2327269187_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
Vector3_t3722313464 V_0;
memset(&V_0, 0, sizeof(V_0));
bool V_1 = false;
{
Vector2_t2156229523 * L_0 = ___localPoint3;
IL2CPP_RUNTIME_CLASS_INIT(Vector2_t2156229523_il2cpp_TypeInfo_var);
Vector2_t2156229523 L_1 = Vector2_get_zero_m540426400(NULL /*static, unused*/, /*hidden argument*/NULL);
*(Vector2_t2156229523 *)L_0 = L_1;
RectTransform_t3704657025 * L_2 = ___rect0;
Vector2_t2156229523 L_3 = ___screenPoint1;
Camera_t4157153871 * L_4 = ___cam2;
IL2CPP_RUNTIME_CLASS_INIT(RectTransformUtility_t1743242446_il2cpp_TypeInfo_var);
bool L_5 = RectTransformUtility_ScreenPointToWorldPointInRectangle_m1761902807(NULL /*static, unused*/, L_2, L_3, L_4, (&V_0), /*hidden argument*/NULL);
if (!L_5)
{
goto IL_0035;
}
}
{
Vector2_t2156229523 * L_6 = ___localPoint3;
RectTransform_t3704657025 * L_7 = ___rect0;
Vector3_t3722313464 L_8 = V_0;
Vector3_t3722313464 L_9 = Transform_InverseTransformPoint_m1343916000(L_7, L_8, /*hidden argument*/NULL);
IL2CPP_RUNTIME_CLASS_INIT(Vector2_t2156229523_il2cpp_TypeInfo_var);
Vector2_t2156229523 L_10 = Vector2_op_Implicit_m4260192859(NULL /*static, unused*/, L_9, /*hidden argument*/NULL);
*(Vector2_t2156229523 *)L_6 = L_10;
V_1 = (bool)1;
goto IL_003c;
}
IL_0035:
{
V_1 = (bool)0;
goto IL_003c;
}
IL_003c:
{
bool L_11 = V_1;
return L_11;
}
}
// UnityEngine.Ray UnityEngine.RectTransformUtility::ScreenPointToRay(UnityEngine.Camera,UnityEngine.Vector2)
extern "C" Ray_t3785851493 RectTransformUtility_ScreenPointToRay_m85042072 (RuntimeObject * __this /* static, unused */, Camera_t4157153871 * ___cam0, Vector2_t2156229523 ___screenPos1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (RectTransformUtility_ScreenPointToRay_m85042072_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
Ray_t3785851493 V_0;
memset(&V_0, 0, sizeof(V_0));
Vector3_t3722313464 V_1;
memset(&V_1, 0, sizeof(V_1));
{
Camera_t4157153871 * L_0 = ___cam0;
IL2CPP_RUNTIME_CLASS_INIT(Object_t631007953_il2cpp_TypeInfo_var);
bool L_1 = Object_op_Inequality_m4071470834(NULL /*static, unused*/, L_0, (Object_t631007953 *)NULL, /*hidden argument*/NULL);
if (!L_1)
{
goto IL_001f;
}
}
{
Camera_t4157153871 * L_2 = ___cam0;
Vector2_t2156229523 L_3 = ___screenPos1;
IL2CPP_RUNTIME_CLASS_INIT(Vector2_t2156229523_il2cpp_TypeInfo_var);
Vector3_t3722313464 L_4 = Vector2_op_Implicit_m1860157806(NULL /*static, unused*/, L_3, /*hidden argument*/NULL);
Ray_t3785851493 L_5 = Camera_ScreenPointToRay_m3764635188(L_2, L_4, /*hidden argument*/NULL);
V_0 = L_5;
goto IL_004a;
}
IL_001f:
{
Vector2_t2156229523 L_6 = ___screenPos1;
IL2CPP_RUNTIME_CLASS_INIT(Vector2_t2156229523_il2cpp_TypeInfo_var);
Vector3_t3722313464 L_7 = Vector2_op_Implicit_m1860157806(NULL /*static, unused*/, L_6, /*hidden argument*/NULL);
V_1 = L_7;
Vector3_t3722313464 * L_8 = (&V_1);
float L_9 = L_8->get_z_3();
L_8->set_z_3(((float)il2cpp_codegen_subtract((float)L_9, (float)(100.0f))));
Vector3_t3722313464 L_10 = V_1;
IL2CPP_RUNTIME_CLASS_INIT(Vector3_t3722313464_il2cpp_TypeInfo_var);
Vector3_t3722313464 L_11 = Vector3_get_forward_m3100859705(NULL /*static, unused*/, /*hidden argument*/NULL);
Ray_t3785851493 L_12;
memset(&L_12, 0, sizeof(L_12));
Ray__ctor_m168149494((&L_12), L_10, L_11, /*hidden argument*/NULL);
V_0 = L_12;
goto IL_004a;
}
IL_004a:
{
Ray_t3785851493 L_13 = V_0;
return L_13;
}
}
// System.Void UnityEngine.RectTransformUtility::FlipLayoutOnAxis(UnityEngine.RectTransform,System.Int32,System.Boolean,System.Boolean)
extern "C" void RectTransformUtility_FlipLayoutOnAxis_m2606646065 (RuntimeObject * __this /* static, unused */, RectTransform_t3704657025 * ___rect0, int32_t ___axis1, bool ___keepPositioning2, bool ___recursive3, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (RectTransformUtility_FlipLayoutOnAxis_m2606646065_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
int32_t V_0 = 0;
RectTransform_t3704657025 * V_1 = NULL;
Vector2_t2156229523 V_2;
memset(&V_2, 0, sizeof(V_2));
Vector2_t2156229523 V_3;
memset(&V_3, 0, sizeof(V_3));
Vector2_t2156229523 V_4;
memset(&V_4, 0, sizeof(V_4));
Vector2_t2156229523 V_5;
memset(&V_5, 0, sizeof(V_5));
float V_6 = 0.0f;
{
RectTransform_t3704657025 * L_0 = ___rect0;
IL2CPP_RUNTIME_CLASS_INIT(Object_t631007953_il2cpp_TypeInfo_var);
bool L_1 = Object_op_Equality_m1810815630(NULL /*static, unused*/, L_0, (Object_t631007953 *)NULL, /*hidden argument*/NULL);
if (!L_1)
{
goto IL_0012;
}
}
{
goto IL_00f3;
}
IL_0012:
{
bool L_2 = ___recursive3;
if (!L_2)
{
goto IL_0055;
}
}
{
V_0 = 0;
goto IL_0048;
}
IL_0020:
{
RectTransform_t3704657025 * L_3 = ___rect0;
int32_t L_4 = V_0;
Transform_t3600365921 * L_5 = Transform_GetChild_m1092972975(L_3, L_4, /*hidden argument*/NULL);
V_1 = ((RectTransform_t3704657025 *)IsInstSealed((RuntimeObject*)L_5, RectTransform_t3704657025_il2cpp_TypeInfo_var));
RectTransform_t3704657025 * L_6 = V_1;
IL2CPP_RUNTIME_CLASS_INIT(Object_t631007953_il2cpp_TypeInfo_var);
bool L_7 = Object_op_Inequality_m4071470834(NULL /*static, unused*/, L_6, (Object_t631007953 *)NULL, /*hidden argument*/NULL);
if (!L_7)
{
goto IL_0043;
}
}
{
RectTransform_t3704657025 * L_8 = V_1;
int32_t L_9 = ___axis1;
IL2CPP_RUNTIME_CLASS_INIT(RectTransformUtility_t1743242446_il2cpp_TypeInfo_var);
RectTransformUtility_FlipLayoutOnAxis_m2606646065(NULL /*static, unused*/, L_8, L_9, (bool)0, (bool)1, /*hidden argument*/NULL);
}
IL_0043:
{
int32_t L_10 = V_0;
V_0 = ((int32_t)il2cpp_codegen_add((int32_t)L_10, (int32_t)1));
}
IL_0048:
{
int32_t L_11 = V_0;
RectTransform_t3704657025 * L_12 = ___rect0;
int32_t L_13 = Transform_get_childCount_m3145433196(L_12, /*hidden argument*/NULL);
if ((((int32_t)L_11) < ((int32_t)L_13)))
{
goto IL_0020;
}
}
{
}
IL_0055:
{
RectTransform_t3704657025 * L_14 = ___rect0;
Vector2_t2156229523 L_15 = RectTransform_get_pivot_m3425744470(L_14, /*hidden argument*/NULL);
V_2 = L_15;
int32_t L_16 = ___axis1;
int32_t L_17 = ___axis1;
float L_18 = Vector2_get_Item_m3559215723((&V_2), L_17, /*hidden argument*/NULL);
Vector2_set_Item_m3557490725((&V_2), L_16, ((float)il2cpp_codegen_subtract((float)(1.0f), (float)L_18)), /*hidden argument*/NULL);
RectTransform_t3704657025 * L_19 = ___rect0;
Vector2_t2156229523 L_20 = V_2;
RectTransform_set_pivot_m909387058(L_19, L_20, /*hidden argument*/NULL);
bool L_21 = ___keepPositioning2;
if (!L_21)
{
goto IL_0084;
}
}
{
goto IL_00f3;
}
IL_0084:
{
RectTransform_t3704657025 * L_22 = ___rect0;
Vector2_t2156229523 L_23 = RectTransform_get_anchoredPosition_m1813443094(L_22, /*hidden argument*/NULL);
V_3 = L_23;
int32_t L_24 = ___axis1;
int32_t L_25 = ___axis1;
float L_26 = Vector2_get_Item_m3559215723((&V_3), L_25, /*hidden argument*/NULL);
Vector2_set_Item_m3557490725((&V_3), L_24, ((-L_26)), /*hidden argument*/NULL);
RectTransform_t3704657025 * L_27 = ___rect0;
Vector2_t2156229523 L_28 = V_3;
RectTransform_set_anchoredPosition_m4126691837(L_27, L_28, /*hidden argument*/NULL);
RectTransform_t3704657025 * L_29 = ___rect0;
Vector2_t2156229523 L_30 = RectTransform_get_anchorMin_m2928307238(L_29, /*hidden argument*/NULL);
V_4 = L_30;
RectTransform_t3704657025 * L_31 = ___rect0;
Vector2_t2156229523 L_32 = RectTransform_get_anchorMax_m2495270048(L_31, /*hidden argument*/NULL);
V_5 = L_32;
int32_t L_33 = ___axis1;
float L_34 = Vector2_get_Item_m3559215723((&V_4), L_33, /*hidden argument*/NULL);
V_6 = L_34;
int32_t L_35 = ___axis1;
int32_t L_36 = ___axis1;
float L_37 = Vector2_get_Item_m3559215723((&V_5), L_36, /*hidden argument*/NULL);
Vector2_set_Item_m3557490725((&V_4), L_35, ((float)il2cpp_codegen_subtract((float)(1.0f), (float)L_37)), /*hidden argument*/NULL);
int32_t L_38 = ___axis1;
float L_39 = V_6;
Vector2_set_Item_m3557490725((&V_5), L_38, ((float)il2cpp_codegen_subtract((float)(1.0f), (float)L_39)), /*hidden argument*/NULL);
RectTransform_t3704657025 * L_40 = ___rect0;
Vector2_t2156229523 L_41 = V_4;
RectTransform_set_anchorMin_m4230103102(L_40, L_41, /*hidden argument*/NULL);
RectTransform_t3704657025 * L_42 = ___rect0;
Vector2_t2156229523 L_43 = V_5;
RectTransform_set_anchorMax_m2998668828(L_42, L_43, /*hidden argument*/NULL);
}
IL_00f3:
{
return;
}
}
// System.Void UnityEngine.RectTransformUtility::FlipLayoutAxes(UnityEngine.RectTransform,System.Boolean,System.Boolean)
extern "C" void RectTransformUtility_FlipLayoutAxes_m2526204952 (RuntimeObject * __this /* static, unused */, RectTransform_t3704657025 * ___rect0, bool ___keepPositioning1, bool ___recursive2, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (RectTransformUtility_FlipLayoutAxes_m2526204952_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
int32_t V_0 = 0;
RectTransform_t3704657025 * V_1 = NULL;
{
RectTransform_t3704657025 * L_0 = ___rect0;
IL2CPP_RUNTIME_CLASS_INIT(Object_t631007953_il2cpp_TypeInfo_var);
bool L_1 = Object_op_Equality_m1810815630(NULL /*static, unused*/, L_0, (Object_t631007953 *)NULL, /*hidden argument*/NULL);
if (!L_1)
{
goto IL_0012;
}
}
{
goto IL_00b4;
}
IL_0012:
{
bool L_2 = ___recursive2;
if (!L_2)
{
goto IL_0054;
}
}
{
V_0 = 0;
goto IL_0047;
}
IL_0020:
{
RectTransform_t3704657025 * L_3 = ___rect0;
int32_t L_4 = V_0;
Transform_t3600365921 * L_5 = Transform_GetChild_m1092972975(L_3, L_4, /*hidden argument*/NULL);
V_1 = ((RectTransform_t3704657025 *)IsInstSealed((RuntimeObject*)L_5, RectTransform_t3704657025_il2cpp_TypeInfo_var));
RectTransform_t3704657025 * L_6 = V_1;
IL2CPP_RUNTIME_CLASS_INIT(Object_t631007953_il2cpp_TypeInfo_var);
bool L_7 = Object_op_Inequality_m4071470834(NULL /*static, unused*/, L_6, (Object_t631007953 *)NULL, /*hidden argument*/NULL);
if (!L_7)
{
goto IL_0042;
}
}
{
RectTransform_t3704657025 * L_8 = V_1;
IL2CPP_RUNTIME_CLASS_INIT(RectTransformUtility_t1743242446_il2cpp_TypeInfo_var);
RectTransformUtility_FlipLayoutAxes_m2526204952(NULL /*static, unused*/, L_8, (bool)0, (bool)1, /*hidden argument*/NULL);
}
IL_0042:
{
int32_t L_9 = V_0;
V_0 = ((int32_t)il2cpp_codegen_add((int32_t)L_9, (int32_t)1));
}
IL_0047:
{
int32_t L_10 = V_0;
RectTransform_t3704657025 * L_11 = ___rect0;
int32_t L_12 = Transform_get_childCount_m3145433196(L_11, /*hidden argument*/NULL);
if ((((int32_t)L_10) < ((int32_t)L_12)))
{
goto IL_0020;
}
}
{
}
IL_0054:
{
RectTransform_t3704657025 * L_13 = ___rect0;
RectTransform_t3704657025 * L_14 = ___rect0;
Vector2_t2156229523 L_15 = RectTransform_get_pivot_m3425744470(L_14, /*hidden argument*/NULL);
IL2CPP_RUNTIME_CLASS_INIT(RectTransformUtility_t1743242446_il2cpp_TypeInfo_var);
Vector2_t2156229523 L_16 = RectTransformUtility_GetTransposed_m3952754222(NULL /*static, unused*/, L_15, /*hidden argument*/NULL);
RectTransform_set_pivot_m909387058(L_13, L_16, /*hidden argument*/NULL);
RectTransform_t3704657025 * L_17 = ___rect0;
RectTransform_t3704657025 * L_18 = ___rect0;
Vector2_t2156229523 L_19 = RectTransform_get_sizeDelta_m2183112744(L_18, /*hidden argument*/NULL);
Vector2_t2156229523 L_20 = RectTransformUtility_GetTransposed_m3952754222(NULL /*static, unused*/, L_19, /*hidden argument*/NULL);
RectTransform_set_sizeDelta_m3462269772(L_17, L_20, /*hidden argument*/NULL);
bool L_21 = ___keepPositioning1;
if (!L_21)
{
goto IL_0081;
}
}
{
goto IL_00b4;
}
IL_0081:
{
RectTransform_t3704657025 * L_22 = ___rect0;
RectTransform_t3704657025 * L_23 = ___rect0;
Vector2_t2156229523 L_24 = RectTransform_get_anchoredPosition_m1813443094(L_23, /*hidden argument*/NULL);
IL2CPP_RUNTIME_CLASS_INIT(RectTransformUtility_t1743242446_il2cpp_TypeInfo_var);
Vector2_t2156229523 L_25 = RectTransformUtility_GetTransposed_m3952754222(NULL /*static, unused*/, L_24, /*hidden argument*/NULL);
RectTransform_set_anchoredPosition_m4126691837(L_22, L_25, /*hidden argument*/NULL);
RectTransform_t3704657025 * L_26 = ___rect0;
RectTransform_t3704657025 * L_27 = ___rect0;
Vector2_t2156229523 L_28 = RectTransform_get_anchorMin_m2928307238(L_27, /*hidden argument*/NULL);
Vector2_t2156229523 L_29 = RectTransformUtility_GetTransposed_m3952754222(NULL /*static, unused*/, L_28, /*hidden argument*/NULL);
RectTransform_set_anchorMin_m4230103102(L_26, L_29, /*hidden argument*/NULL);
RectTransform_t3704657025 * L_30 = ___rect0;
RectTransform_t3704657025 * L_31 = ___rect0;
Vector2_t2156229523 L_32 = RectTransform_get_anchorMax_m2495270048(L_31, /*hidden argument*/NULL);
Vector2_t2156229523 L_33 = RectTransformUtility_GetTransposed_m3952754222(NULL /*static, unused*/, L_32, /*hidden argument*/NULL);
RectTransform_set_anchorMax_m2998668828(L_30, L_33, /*hidden argument*/NULL);
}
IL_00b4:
{
return;
}
}
// UnityEngine.Vector2 UnityEngine.RectTransformUtility::GetTransposed(UnityEngine.Vector2)
extern "C" Vector2_t2156229523 RectTransformUtility_GetTransposed_m3952754222 (RuntimeObject * __this /* static, unused */, Vector2_t2156229523 ___input0, const RuntimeMethod* method)
{
Vector2_t2156229523 V_0;
memset(&V_0, 0, sizeof(V_0));
{
float L_0 = (&___input0)->get_y_1();
float L_1 = (&___input0)->get_x_0();
Vector2_t2156229523 L_2;
memset(&L_2, 0, sizeof(L_2));
Vector2__ctor_m3970636864((&L_2), L_0, L_1, /*hidden argument*/NULL);
V_0 = L_2;
goto IL_001a;
}
IL_001a:
{
Vector2_t2156229523 L_3 = V_0;
return L_3;
}
}
// System.Void UnityEngine.RectTransformUtility::.cctor()
extern "C" void RectTransformUtility__cctor_m1529820864 (RuntimeObject * __this /* static, unused */, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (RectTransformUtility__cctor_m1529820864_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
((RectTransformUtility_t1743242446_StaticFields*)il2cpp_codegen_static_fields_for(RectTransformUtility_t1743242446_il2cpp_TypeInfo_var))->set_s_Corners_0(((Vector3U5BU5D_t1718750761*)SZArrayNew(Vector3U5BU5D_t1718750761_il2cpp_TypeInfo_var, (uint32_t)4)));
return;
}
}
#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
#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.Void UnityEngine.UISystemProfilerApi::BeginSample(UnityEngine.UISystemProfilerApi/SampleType)
extern "C" void UISystemProfilerApi_BeginSample_m3272505833 (RuntimeObject * __this /* static, unused */, int32_t ___type0, const RuntimeMethod* method)
{
typedef void (*UISystemProfilerApi_BeginSample_m3272505833_ftn) (int32_t);
static UISystemProfilerApi_BeginSample_m3272505833_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (UISystemProfilerApi_BeginSample_m3272505833_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.UISystemProfilerApi::BeginSample(UnityEngine.UISystemProfilerApi/SampleType)");
_il2cpp_icall_func(___type0);
}
// System.Void UnityEngine.UISystemProfilerApi::EndSample(UnityEngine.UISystemProfilerApi/SampleType)
extern "C" void UISystemProfilerApi_EndSample_m3294865474 (RuntimeObject * __this /* static, unused */, int32_t ___type0, const RuntimeMethod* method)
{
typedef void (*UISystemProfilerApi_EndSample_m3294865474_ftn) (int32_t);
static UISystemProfilerApi_EndSample_m3294865474_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (UISystemProfilerApi_EndSample_m3294865474_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.UISystemProfilerApi::EndSample(UnityEngine.UISystemProfilerApi/SampleType)");
_il2cpp_icall_func(___type0);
}
// System.Void UnityEngine.UISystemProfilerApi::AddMarker(System.String,UnityEngine.Object)
extern "C" void UISystemProfilerApi_AddMarker_m495483138 (RuntimeObject * __this /* static, unused */, String_t* ___name0, Object_t631007953 * ___obj1, const RuntimeMethod* method)
{
typedef void (*UISystemProfilerApi_AddMarker_m495483138_ftn) (String_t*, Object_t631007953 *);
static UISystemProfilerApi_AddMarker_m495483138_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (UISystemProfilerApi_AddMarker_m495483138_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.UISystemProfilerApi::AddMarker(System.String,UnityEngine.Object)");
_il2cpp_icall_func(___name0, ___obj1);
}
#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
#ifdef __clang__
#pragma clang diagnostic pop
#endif
| [
"schuetz@jordan-schuetz.local"
] | schuetz@jordan-schuetz.local |
541ab80e2cb2e8d706edd918151c5d48b1f50e24 | 4a8067d25f4bf239259a32d87e6a3cbd3aa8e500 | /src/BTSerialPortBinding.h | eea9fbc8e039897f086f1dced987ff6bc42cf99e | [
"MIT",
"BSD-2-Clause",
"BSD-2-Clause-Views",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | normanb/bluetooth-serial-port | 8f09fed7e1a65a2e1434fd15d92a046711856a66 | 229dd77fe0a5f8161428d6b5db95f924312048c7 | refs/heads/master | 2021-01-14T14:27:33.314211 | 2014-12-03T09:53:24 | 2014-12-03T09:53:24 | 29,368,601 | 0 | 0 | null | 2015-01-16T21:27:07 | 2015-01-16T21:27:05 | C | UTF-8 | C++ | false | false | 567 | h | #pragma once
#include <string>
#include <memory>
struct bluetooth_data;
class BTSerialPortBinding
{
private:
std::unique_ptr<bluetooth_data> data;
std::string address;
int channelID;
//int readTimeout;
//int writeTimeout;
BTSerialPortBinding(std::string address, int channelID);
public:
~BTSerialPortBinding();
static BTSerialPortBinding *Create(std::string address, int channelID);
void Connect();
void Close();
int Read(char *buffer, int length);
void Write(const char *buffer, int length);
//void SetTimeouts(int readTimeout, int writeTimeout);
}; | [
"agamnentzar@gmail.com"
] | agamnentzar@gmail.com |
8a886d45f52e5647e27f9a918800afa51ea33fe4 | f3e357d81ae3c12db383742620ba228eb8b4afb1 | /Minigin/TextComponent.cpp | 98b23ed38bd279b85397588b81871c9c7e4c96ef | [] | no_license | Kuuyo/Small_2D_Engine_DigDug | 0e7968bf092c8ffc03efbd98b87c32cf102d078b | d51c4048d6883f1cb474f911740912260c594a79 | refs/heads/master | 2020-04-28T15:45:03.604398 | 2019-10-10T12:55:14 | 2019-10-10T12:55:14 | 175,387,036 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,447 | cpp | #include "MiniginPCH.h"
#include "TextComponent.h"
#include "Renderer.h"
#include "Font.h"
#include "Texture2D.h"
#include "GameObject.h"
#include "ResourceManager.h"
#include "Scene.h"
namespace dae
{
TextComponent::TextComponent(const std::string& text, bool isCentered, unsigned int fontSize, SDL_Color color, const std::string& font)
: m_NeedsUpdate(false)
, m_IsCentered(isCentered)
, m_Text(text)
, m_pFont(nullptr)
, m_pTexture(nullptr)
, m_FontSize(fontSize)
, m_Font(font)
, m_Color(color)
{}
TextComponent::~TextComponent()
{
m_pParent->GetScene()->RemoveTexture(m_pTexture);
delete m_pTexture;
}
void TextComponent::SetText(const std::string& text)
{
m_Text = text;
m_NeedsUpdate = true;
}
void TextComponent::SetColor(const SDL_Color &color)
{
m_Color = color;
m_NeedsUpdate = true;
}
void TextComponent::Initialize(const SceneContext &sceneContext)
{
m_pFont = sceneContext.GameContext->Resources->LoadFont(m_Font, m_FontSize);
sceneContext.GameContext->Resources->CreateTextTexture(m_Color, m_pFont, m_Text, m_pTexture,
m_pParent, false);
m_pTexture->SetIsCentered(m_IsCentered);
m_pParent->GetScene()->AddTexture(m_pTexture);
}
void TextComponent::Update(const SceneContext &sceneContext)
{
if (m_NeedsUpdate)
{
sceneContext.GameContext->Resources->CreateTextTexture(m_Color, m_pFont, m_Text, m_pTexture,
m_pParent, false);
m_NeedsUpdate = false;
}
}
}
| [
"brokenkyuu@gmail.com"
] | brokenkyuu@gmail.com |
14bdb90099546d5668a03e4775cd15d0265cce59 | 67563a4436b914654dd441eb2e1915bbd41aa8ca | /Engine/sdk/src/MPShadeMap.cpp | cee3eba625b5a27e75cd76437913d930d9f055c9 | [
"Apache-2.0"
] | permissive | PKO-Community-Sources/ClientSide-Sources | 1cab923af538ffe9d9cb9154b14dd3e0a903ca14 | ddbcd293d6ef3f58ff02290c02382cbb7e0939a2 | refs/heads/main | 2023-05-13T00:15:04.162386 | 2021-06-02T15:35:36 | 2021-06-02T15:35:36 | 372,753,278 | 3 | 0 | Apache-2.0 | 2021-06-02T15:26:17 | 2021-06-01T08:17:07 | C++ | GB18030 | C++ | false | false | 27,243 | cpp | #include "StdAfx.h"
//#include <mindpower.h>
#include "GlobalInc.h"
#include "MPModelEff.h"
#include "lwPredefinition.h"
#include "MPMap.h"
#include ".\mpshademap.h"
#include "MPRender.h"
#define TILESIZE 1.0f
//#include "..\include\mpshademap.h"
#define CLAMP(A, MIN, MAX) ( (A) > (MAX) ) ? (MAX) : ( ( (A) < (MIN) ) ? (MIN) : (A) )
CMPShadeMap::CMPShadeMap(void)
{
m_iType = SHADE_SINGLE;
#ifndef USE_MGR
_lpIB = NULL;
#endif
//_fSin = sinf(3.141592654f / 2);
//_fCos = cosf(3.141592654f / 2);
_SVerPos = D3DXVECTOR3(0.0f,0.0f,0);
_dwColor = 0x80ffffff;
_pfDailTime = NULL;
_bShow = true;
_iIdxTech = 2;
_pCEffectFile = NULL;
_eSrcBlend = D3DBLEND_SRCALPHA;
_eDestBlend = D3DBLEND_INVSRCALPHA;
_bUpdate = true;
_UpSea = false;
_pModel = NULL;
}
CMPShadeMap::~CMPShadeMap(void)
{
#ifndef USE_MGR
SAFE_RELEASE(_lpIB);
#endif
SAFE_DELETE(_pModel);
}
void CMPShadeMap::setTextureName(s_string& strName)
{
if((strstr(strName.c_str(),".dds")==NULL)&&strstr(strName.c_str(),".tga")==NULL)
{
_strTexName = strName;
}else
{
_strTexName = strName.substr(0, strName.length() - 4);
}
}
void CMPShadeMap::BoundingRes(CMPResManger *m_CResMagr)
{
int t_iID;
t_iID = m_CResMagr->GetTextureID(_strTexName);
if(t_iID == -1)
{
MessageBox(NULL,_strTexName.c_str() ,"shade纹理不存在",MB_OK);
_lpCurTex = NULL;
}
else
{
#ifdef USE_MGR
//m_CResMagr->GetTextureByID(t_iID);
_lpCurTex = m_CResMagr->GetTextureByIDlw(t_iID);
#else
_lpCurTex = m_CResMagr->GetTextureByID(t_iID);
#endif
}
//_pModel = m_CResMagr->GetShadeMesh();
//SAFE_DELETE(_pModel);
if(!_pModel)
{
_pModel = new CEffectModel;
_pModel->InitDevice(m_CResMagr->m_pDev,m_CResMagr->m_pSysGraphics->GetResourceMgr());
}
_pdwVShader = m_CResMagr->GetShadeVS();
_pfDailTime = m_CResMagr->GetDailTime();
_pCEffectFile = m_CResMagr->GetEffectFile();
_pMatViewProj = m_CResMagr->GetViewProjMat();
m_bUseSoft = m_CResMagr->m_bUseSoftOrg;
DWORD BOL = 0;
_pModel->GetDev()->GetRenderState( D3DRS_SOFTWAREVERTEXPROCESSING , &BOL );
if (BOL == 1)
{
m_bUseSoft = TRUE;
//LG("debug","msgUsesoft");
}
//m_bUseSoft = TRUE;
//if(m_bUseSoft)
// LG("debug","msguse soft vertex processing");
//else
// LG("debug","msguse hard vertex processing");
m_dwVsConst = m_CResMagr->GetDevCap()->MaxVertexShaderConst;
//m_bUseSoft = TRUE;
_UpSea = false;
}
bool CMPShadeMap::CreateShadeMap(float fRadius)
{
//if(fRadius > 7.0f)
// UseSoft(TRUE);
_fRadius = fRadius;
_fGridMax = _fRadius / TILESIZE + 1;
_iGridCrossNum = (int)_fGridMax;
if(_fGridMax - (float)_iGridCrossNum > 0)
_iGridCrossNum++;
if(!SetGridNum(_iGridCrossNum))
return false;
//!创建VB
for( int n = 0; n < _iVerNum; n++)
{
_SShadePos[n] = D3DXVECTOR3(0,0,0);
_SShadeUV[n] = D3DXVECTOR2(0,0);
}
return true;
}
bool CMPShadeMap::SetGridNum(int iNum)
{
_iGridCrossNum = iNum;/////77777
_iGridNum = _iGridCrossNum * _iGridCrossNum;
_iFaceCount = _iGridNum * 2;
_iVerNum = (_iGridCrossNum + 1)*(_iGridCrossNum + 1);
_iIndexNum = _iGridCrossNum * _iGridCrossNum * 6;
if(DWORD(_iVerNum * 2 + 8)>m_dwVsConst)
m_bUseSoft = TRUE;
//m_bUseSoft = TRUE;
//HRESULT hr;
//hr = _pModel->m_pDev->CreateVertexBuffer(sizeof(SEFFECT_SHADE_VERTEX)*4,
// D3DUSAGE_WRITEONLY |D3DUSAGE_DYNAMIC,
// EFFECT_SHADE_FVF,
// D3DPOOL_DEFAULT, &_lpVB);
//if( FAILED(hr) )
// return false;
//SEFFECT_SHADE_VERTEX *pVertex;
//_lpVB->Lock(0, 0, (BYTE**)&pVertex, D3DLOCK_NOOVERWRITE );
//pVertex[0].m_SPos = D3DXVECTOR3(0, 0, 0);//*/D3DXVECTOR3(-0.5f, -0.5f, 0);
//pVertex[0].m_dwDiffuse = 0xffffffff;
//pVertex[0].m_SUV = D3DXVECTOR2(0.0f, 1.0f);
//pVertex[0].m_SUV2 = D3DXVECTOR2(0, 1);
//pVertex[1].m_SPos = D3DXVECTOR3(0, 0, 0);//*/D3DXVECTOR3(-0.5f, 0.5f, 0);
//pVertex[1].m_dwDiffuse = 0xffffffff;
//pVertex[1].m_SUV = D3DXVECTOR2(0.0f, 0);
//pVertex[1].m_SUV2 = D3DXVECTOR2(2, 3);
//pVertex[2].m_SPos = D3DXVECTOR3(0, 0, 0);//*/D3DXVECTOR3(0.5f, 0.5f, 0);
//pVertex[2].m_dwDiffuse = 0xffffffff;
//pVertex[2].m_SUV = D3DXVECTOR2(1.0f, 0.0f);
//pVertex[2].m_SUV2 = D3DXVECTOR2(4, 5);
//pVertex[3].m_SPos = D3DXVECTOR3(0, 0, 0);//*/D3DXVECTOR3(0.5f, -0.5f, 0);
//pVertex[3].m_dwDiffuse = 0xffffffff;
//pVertex[3].m_SUV = D3DXVECTOR2(1.0f, 1.0f);
//pVertex[3].m_SUV2 = D3DXVECTOR2(6, 7);
//_lpVB->Unlock();
//!创建IB
#ifndef USE_MGR
SAFE_RELEASE(_lpIB);
if(FAILED(_pModel->m_pDev->CreateIndexBuffer(sizeof(WORD) * _iIndexNum,
D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_DEFAULT, &_lpIB)))
return false;
//WORD t_wIndex[6] =
//{
// 0,1,2,0,2,3,
//};
WORD* t_pwIndex;
_lpIB->Lock(0, 0, (BYTE**)&t_pwIndex, 0);
int nIndex = 0;
for( int nY = 0; nY < _iGridCrossNum; nY++ )
{
for( int nX = 0; nX < _iGridCrossNum; nX++ )
{
//t_pwIndex[nIndex++] = nX + nY * (_iGridCrossNum + 1);
//t_pwIndex[nIndex++] = (nX+1) + nY * (_iGridCrossNum + 1);
//t_pwIndex[nIndex++] = nX + (nY+1) * (_iGridCrossNum + 1);
//t_pwIndex[nIndex++] = nX + nY * (_iGridCrossNum + 1);
//t_pwIndex[nIndex++] = nX + (nY+1) * (_iGridCrossNum + 1);
//t_pwIndex[nIndex++] = (nX+1) + (nY+1) * (_iGridCrossNum + 1);
t_pwIndex[nIndex++] = nX + nY * (_iGridCrossNum + 1);
t_pwIndex[nIndex++] = (nX+1) + nY * (_iGridCrossNum + 1);
t_pwIndex[nIndex++] = nX + (nY+1) * (_iGridCrossNum + 1);
t_pwIndex[nIndex++] = nX + (nY+1) * (_iGridCrossNum + 1);
t_pwIndex[nIndex++] = (nX+1) + nY * (_iGridCrossNum + 1);
t_pwIndex[nIndex++] = (nX+1) + (nY+1) * (_iGridCrossNum + 1);
//t_pwIndex[nIndex++] = (nX+1) + nY * (_iGridCrossNum + 1);
//t_pwIndex[nIndex++] = nX + (nY+1) * (_iGridCrossNum + 1);
//t_pwIndex[nIndex++] = nX + nY * (_iGridCrossNum + 1);
//t_pwIndex[nIndex++] = (nX+1) + (nY+1) * (_iGridCrossNum + 1);
//t_pwIndex[nIndex++] = (nX+1) + nY * (_iGridCrossNum + 1);
//t_pwIndex[nIndex++] = (nX+1) + (nY+1) * (_iGridCrossNum + 1);
//t_pwIndex[nIndex++] = nX + (nY+1) * (_iGridCrossNum + 1);
}
}
//memcpy(t_pwIndex, t_wIndex, sizeof(WORD)*6);
_lpIB->Unlock();
#else
_pModel->CreateShadeModel(_iVerNum,_iFaceCount,_iGridCrossNum,m_bUseSoft);
/*int nIndex = 0;
for( int nY = 0; nY < _iGridCrossNum; nY++ )
{
for( int nX = 0; nX < _iGridCrossNum; nX++ )
{
_wIndex[nIndex++] = nX + nY * (_iGridCrossNum + 1);
_wIndex[nIndex++] = (nX+1) + nY * (_iGridCrossNum + 1);
_wIndex[nIndex++] = nX + (nY+1) * (_iGridCrossNum + 1);
_wIndex[nIndex++] = nX + (nY+1) * (_iGridCrossNum + 1);
_wIndex[nIndex++] = (nX+1) + nY * (_iGridCrossNum + 1);
_wIndex[nIndex++] = (nX+1) + (nY+1) * (_iGridCrossNum + 1);
}
}*/
/*WORD* wIdx= NULL;
_pModel->LockIB((BYTE**)&wIdx);
memcpy(wIdx,_wIndex,sizeof(WORD)*_iIndexNum);
_pModel->UnlockIB();*/
#endif
return true;
}
void CMPShadeMap::setFrameTexture(s_string& strTexName, CMPResManger *pCResMagr)
{
_strTexName = strTexName;
int t_iID;
t_iID = pCResMagr->GetTextureID(_strTexName);
if(t_iID == -1)
{
MessageBox(NULL,_strTexName.c_str(),"纹理不存在",MB_OK);
_lpCurTex = NULL;
}
else
{
#ifdef USE_MGR
//LPDIRECT3DTEXTURE8 tex= pCResMagr->GetTextureByID(t_iID);
_lpCurTex = pCResMagr->GetTextureByIDlw(t_iID);
#else
_lpCurTex = pCResMagr->GetTextureByID(t_iID);
#endif
}
//assert(_lpCurTex);
}
void CMPShadeMap::FrameMove(DWORD dwDailTime)
{
static float dwTime = 1.5f;
_bUpdate = false;
dwTime += *_pfDailTime;
if(dwTime > 1.5f)
{
dwTime = 0;
_bUpdate = true;
}
}
void CMPShadeMap::MoveTo(D3DXVECTOR3 SVerPos, MPMap* pMap, float fAngle)
{
if(!_bShow)
return;
if(!_bUpdate)
{
//if(_SVerPos == SVerPos)
// return;
if(fEquat(_SVerPos.x,SVerPos.x) &&fEquat(_SVerPos.y,SVerPos.y)/*&&fEquat(_SVerPos.z,SVerPos.z)*/)
{
return;
}
}
_bUpdate = false;
_SVerPos = SVerPos;
//!求当前TILE的位置
int nX = (int)((_SVerPos.x - _fRadius / 2 ) /*/ TILESIZE*/);
int nY = (int)((_SVerPos.y - _fRadius / 2 ) /*/ TILESIZE*/);
//D3DXVECTOR2 vCenter;
//vCenter.x = nX* TILESIZE + ((_fGridMax * TILESIZE) / 2);
//vCenter.y = nY* TILESIZE + ((_fGridMax * TILESIZE) / 2);
//!当前TILE的中心世界坐标点
//float X = nX / TILESIZE + 0.5f;
//float Y = nY / TILESIZE + 0.5f;
//MPTile *TileList;
for( int y = 0; y < _iGridCrossNum + 1; y++ )
{
for( int x = 0; x < _iGridCrossNum + 1; x++ )
{
int iIndex = x + y*(_iGridCrossNum + 1);
//if(pMap)
// TileList = pMap->GetTile(int(nX) + x, int(nY) + y);
float fGridX = (float)(nX + x * TILESIZE)/* / TILESIZE*/;
float fGridY = (float)(nY + y * TILESIZE)/* / TILESIZE*/;
_SShadePos[iIndex].x = fGridX;
_SShadePos[iIndex].y = fGridY;
if(pMap)
{
//int iUnitNo = int(fGridY) % 2 + int(fGridX ) % 2;
//float height = pMap ? pMap->GetHeight(fGridX,fGridY) : 0.0f; // TileList->getHeight();
float objHeight,height;
//float height;
///* for(int q =0; q < 4; q++)
// {
// objHeight = float(TileList->sObjHeight[q])/100;
// if(objHeight > height)
// {
// height = objHeight;
// height += 0.001f;
// }
// }*/
// //_SShadePos[iIndex].z = height;
//
// objHeight = 0.0f; // float(TileList->sObjHeight[iUnitNo])/100;
// /*if(TileList->Block[iUnitNo])
// {
// objHeight += 1.0f;
// }*/
//if(objHeight > height)
//{
// height = objHeight;
//}
/* if(!TileList ||TileList->IsDefault())
height = 0.0f;
else*/
{
int iGridx = (int)(fGridX * 2);
int iGridy = (int)(fGridY* 2);
if(y == _iGridCrossNum)
iGridy -= 1;
if(x == _iGridCrossNum)
iGridx -= 1;
height = pMap->GetGridHeight(iGridx, iGridy);
//objHeight = pMap ? pMap->GetGridHeight((int)(fGridX * 2), (int)(fGridY* 2)) : 0.0f;
objHeight = pMap->GetTileHeight((int)(fGridX), (int)(fGridY));
if(_UpSea)
{
if(objHeight <= 0)
objHeight = 0;
}
if(height > objHeight && !pMap->IsGridBlock(iGridx, iGridy))
objHeight = height;
}
//if(objHeight > 0 && objHeight > height)
//{
// height = objHeight;
//}
_SShadePos[iIndex].z = objHeight + 0.015f;
}
else
_SShadePos[iIndex].z = SVerPos.z + 0.015f;
float fU,fV;
{
fU = ( fGridX - _SVerPos.x ) / ( _fGridMax * TILESIZE);
fV = ( fGridY - _SVerPos.y ) / ( _fGridMax * TILESIZE);
_SShadeUV[iIndex].x = CLAMP(fU + 0.5f, 0.0f, 1.0f); //*/_fCos * fU - _fSin * fV + 0.5f;
_SShadeUV[iIndex].y = CLAMP(fV + 0.5f, 0.0f, 1.0f);//*/_fSin * fU + _fCos * fV + 0.5f;
}
if(fAngle != 0)
{
D3DXMATRIX mat;
D3DXVECTOR3 vpos(0.5f,0.5f,0);
GetMatrixRotation(&mat,&vpos,\
&D3DXVECTOR3(0,0,1),fAngle);
D3DXVec2TransformCoord(&_SShadeUV[iIndex], &_SShadeUV[iIndex], &mat);
//_SShadeUV[iIndex] = vUV;
}
}
}
if(m_bUseSoft)
FillVertex();
}
void CMPShadeMap::RenderVS()
{
if(!_bShow)
return;
D3DXMATRIX t_mat;
//D3DXMatrixScaling(&t_mat,1,1,1);
D3DXMatrixIdentity(&t_mat);
//D3DXMatrixTranspose(&t_mat, &t_mat);
#ifdef USE_MGR
//#ifdef MULTITHREAD_LOADING_TEXTURE
if(_lpCurTex && _lpCurTex->IsLoadingOK())
_pModel->m_pDev->SetTexture(0, _lpCurTex->GetTex());
else
{
_pCEffectFile->End();
return;
}
//#else
// if(_lpCurTex)
// _pModel->m_pDev->SetTexture(0, _lpCurTex->GetTex());
// else
// _pModel->m_pDev->SetTexture(0, NULL);
//#endif
_pModel->Begin();
_pCEffectFile->SetTechnique(_iIdxTech);
_pCEffectFile->Begin();
_pCEffectFile->Pass(0);
_pModel->m_pDev->SetRenderStateForced( D3DRS_SRCBLEND,_eSrcBlend );
_pModel->m_pDev->SetRenderStateForced( D3DRS_DESTBLEND,_eDestBlend);
#else
if( _lpCurTex )
{
_pModel->m_pDev->SetTexture(0, _lpCurTex);
}
#endif
_pModel->m_pDev->SetVertexShader(*_pdwVShader);
_pModel->m_pDev->SetVertexShaderConstant(0, &t_mat, 4);
_pModel->m_pDev->SetVertexShaderConstant(4, _pMatViewProj, 4);
_pModel->m_pDev->SetVertexShaderConstant(8, &_dwColor, 1);
D3DXVECTOR4 tv(0,0,0,0);
int nIndex = 9;
for(int n = 0; n < _iVerNum; n++)
{
tv.x = _SShadeUV[n].x;
tv.y = _SShadeUV[n].y;
_pModel->m_pDev->SetVertexShaderConstant(nIndex++, &/*_SShadeUV[n]*/tv, 1);
tv.x = _SShadePos[n].x;
tv.y = _SShadePos[n].y;
tv.z = _SShadePos[n].z;
tv.w = 1;
_pModel->m_pDev->SetVertexShaderConstant(nIndex++, &/*D3DXVECTOR4(_SShadePos[n].x
,_SShadePos[n].y,_SShadePos[n].z, 0)*/tv, 1);
}
#ifdef USE_MGR
//WORD* wIdx= NULL;
//_pModel->LockIB((BYTE**)&wIdx);
//memcpy(wIdx,_wIndex,sizeof(WORD)*_iIndexNum);
//_pModel->UnlockIB();
//_pModel->SetRenderNum( _iVerNum, _iFaceCount);
_pModel->RenderModel();
#else
_pModel->m_pDev->SetStreamSource(0, _pModel->GetVertexBuffer(), sizeof(SEFFECT_SHADE_VERTEX));
_pModel->m_pDev->SetIndices(_lpIB,0);
_pModel->m_pDev->DrawIndexedPrimitive( D3DPT_TRIANGLELIST, 0, _iVerNum, 0, _iFaceCount);
#endif
#ifdef USE_MGR
_pModel->End();
#endif
//_pModel->m_pDev->SetRenderState( D3DRS_SRCBLEND,D3DBLEND_SRCALPHA );
//_pModel->m_pDev->SetRenderState( D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);
_pCEffectFile->End();
//_pModel->GetDev()->SetRenderStateForced(D3DRS_ALPHATESTENABLE, FALSE);
//_pModel->m_pDev->SetVertexShader(EFFECT_SHADE_FVF);
}
void CMPShadeMap::FillVertex()
{
SEFFECT_SHADE_VERTEX *pVertex(0);
if (!_pModel)
return;
_pModel->SetRenderNum( _iVerNum, _iFaceCount);
_pModel->Lock((BYTE**)&pVertex);
if(pVertex == 0)
{
MessageBox(NULL, "msgLockFailed lock error msglock error CMPShadeMap::FillVertex() line 552", "error", 0);
//LG("error","msgLockFailed CMPShadeMap::FillVertex() %s\n ", _pModel->m_strName.c_str());
return;
}
int nIndex = 9;//!设置的VS常量从9开始
for( int n = 0; n < _iVerNum; n++)
{
pVertex[n].m_dwDiffuse = _dwColor;
pVertex[n].m_SPos.x = _SShadePos[n].x;
pVertex[n].m_SPos.y = _SShadePos[n].y;
pVertex[n].m_SPos.z = _SShadePos[n].z;
pVertex[n].m_SUV.x = _SShadeUV[n].x;
pVertex[n].m_SUV.y = _SShadeUV[n].y;
pVertex[n].m_SUV2.x = (float)nIndex;
nIndex++;
pVertex[n].m_SUV2.y = (float)nIndex;
nIndex++;
}
_pModel->Unlock();
}
void CMPShadeMap::RenderSoft()
{
if(!_bShow)
return;
//_pModel->m_pDev->SetVertexShader(EFFECT_SHADE_FVF);
#ifdef USE_MGR
_pModel->Begin();
_pCEffectFile->SetTechnique(_iIdxTech);
_pCEffectFile->Begin();
_pCEffectFile->Pass(0);
_pModel->GetDev()->SetRenderStateForced( D3DRS_SRCBLEND,_eSrcBlend );
_pModel->GetDev()->SetRenderStateForced( D3DRS_DESTBLEND,_eDestBlend);
D3DXMATRIX t_mat;
D3DXMatrixIdentity(&t_mat);
if(_lpCurTex && _lpCurTex->IsLoadingOK())
_pModel->m_pDev->SetTexture(0, _lpCurTex->GetTex());
else
{
_pCEffectFile->End();
return;
}
#ifdef USE_RENDER
_pModel->GetDev()->SetTransformWorld(&t_mat);
#else
_pModel->GetDev()->SetTransform(D3DTS_WORLDMATRIX(0), &t_mat);
#endif
_pModel->RenderModel();
_pModel->End();
_pModel->m_pDev->SetVertexShader(EFFECT_SHADE_FVF);
#else
_pCEffectFile->SetTechnique(_iIdxTech);
_pCEffectFile->Begin();
_pCEffectFile->Pass(0);
_pModel->GetDev()->SetRenderState( D3DRS_SRCBLEND,_eSrcBlend );
_pModel->GetDev()->SetRenderState( D3DRS_DESTBLEND,_eDestBlend);
D3DXMATRIX t_mat;
D3DXMatrixIdentity(&t_mat);
if( _lpCurTex )
{
_pModel->GetDev()->SetTexture(0, _lpCurTex);
}
_pModel->GetDev()->SetTransform(D3DTS_WORLDMATRIX(0), &t_mat);
_pModel->GetDev()->SetVertexShader(EFFECT_SHADE_FVF);
SEFFECT_SHADE_VERTEX *pVertex;
_pModel->Lock((BYTE**)&pVertex);
for( int n = 0; n < _iVerNum; n++)
{
pVertex[n].m_dwDiffuse = _dwColor;
pVertex[n].m_SPos.x = _SShadePos[n].x;
pVertex[n].m_SPos.y = _SShadePos[n].y;
pVertex[n].m_SPos.z = _SShadePos[n].z;
pVertex[n].m_SUV.x = _SShadeUV[n].x;
pVertex[n].m_SUV.y = _SShadeUV[n].y;
}
_pModel->Unlock();
_pModel->GetDev()->SetStreamSource(0, _pModel->GetVertexBuffer(), sizeof(SEFFECT_SHADE_VERTEX));
_pModel->GetDev()->SetIndices(_lpIB,0);
_pModel->GetDev()->DrawIndexedPrimitive( D3DPT_TRIANGLELIST, 0, _iVerNum, 0, _iFaceCount);
#endif
_pCEffectFile->End();
//_pModel->GetDev()->SetRenderStateForced(D3DRS_ALPHATESTENABLE, FALSE);
//_pModel->GetDev()->SetRenderState( D3DRS_SRCBLEND,D3DBLEND_SRCALPHA );
//_pModel->GetDev()->SetRenderState( D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);
}
void CMPShadeMap::Render()
{
if(!m_bUseSoft)
RenderVS();
else
RenderSoft();
}
bool CMPShadeMap::SaveToFile(FILE* pFile)
{
char t_pszName[32];
int t_temp;
//!大小半径
fwrite(&_fRadius,sizeof(float),1,pFile);
lstrcpy(t_pszName,_strTexName.c_str());
fwrite(t_pszName, sizeof(char),32,pFile);
//!类型
t_temp = (int)_eSrcBlend;
fwrite(&t_temp,sizeof(int),1,pFile);
t_temp = (int)_eDestBlend;
fwrite(&t_temp,sizeof(int),1,pFile);
fwrite(&_dwColor, sizeof(D3DXCOLOR),1,pFile);
fwrite(&_iIdxTech, sizeof(int),1,pFile);
return true;
}
bool CMPShadeMap::LoadFromFile(FILE* pFile)
{
//char t_pszName[32];
int t_temp;
////!大小半径
//fread(&_fRadius,sizeof(float),1,pFile);
//fread(t_pszName, sizeof(char),32,pFile);
//_strTexName = t_pszName;
//!类型
fread(&t_temp,sizeof(int),1,pFile);
_eSrcBlend = (D3DBLEND)t_temp;
fread(&t_temp,sizeof(int),1,pFile);
_eDestBlend = (D3DBLEND)t_temp;
fread(&_dwColor, sizeof(D3DXCOLOR),1,pFile);
fread(&_iIdxTech, sizeof(int),1,pFile);
return true;
}
///////////////////////////////////////////////////////////
//class CMPShadeEX
///////////////////////////////////////////////////////////
CMPShadeEX::CMPShadeEX(int iFrameCount)
{
m_iType = SHADE_ANI;
_iFrameCount = iFrameCount;
//_fLife = 0.1f * _iFrameCount;
_iCurFrame =0;
_fCurTime = 0;
_vecFrameColor.resize(_iFrameCount);
for(int n = 0; n < _iFrameCount; n++)
{
_vecFrameColor[n] = 0xffffffff;
}
_fFrameTime = 0.1f;
_bLoop = false;
_bShow = false;
_iCurTex = 0;
_vecTexOffset.clear();
_iRow = 1;
_iCol = 1;
_fTexFrameTime = 0.1f;
_fTexCurTime = 0;
_iNumTex = 1;
_vecTexOffset.resize(_iNumTex);
for(int n = 0; n < _iNumTex; n++)
{
_vecTexOffset[n] = D3DXVECTOR2(0,0);
}
_vecTexSave.clear();
}
CMPShadeEX::~CMPShadeEX(void)
{
}
bool CMPShadeEX::CreateSpliteTexture(int iRow, int iColnum)
{
_iRow = iRow;
_iCol = iColnum;
_iNumTex = iRow * iColnum;
float fsizew = 1.0f / iRow;
float fsizeh = 1.0f / iColnum;
_vecTexOffset.resize(_iNumTex);
for(int h = 0;h < iColnum; h++)
{
for(int w = 0; w < iRow; w++)
{
int idx = w + h * iRow;
_vecTexOffset[idx].x = w * fsizew;
_vecTexOffset[idx].y = h * fsizeh ;
}
}
_vecTexSave.resize(_iVerNum);
return true;
}
void CMPShadeEX::setFrameCount(int iCount)
{
_iFrameCount = iCount;
}
void CMPShadeEX::setFrameTime(float fTime)
{
_fFrameTime = fTime;
}
void CMPShadeEX::setTexFrameTime(float fTime)
{
_fTexFrameTime = fTime;
}
void CMPShadeEX::setFrameColor(int iIdx, D3DCOLOR SColor)
{
_vecFrameColor[iIdx] = SColor;
}
void CMPShadeEX::setColor(D3DXCOLOR SColor)
{
for(int n = 0; n < _iFrameCount; n++)
{
_vecFrameColor[n] = SColor;
}
}
void CMPShadeEX::FrameMove(DWORD dwDailTime)
{
if(!_bShow)
return;
int iNextFrame;
_fCurTime += *_pfDailTime;
if(_fCurTime >=_fFrameTime)
{
_iCurFrame++;
if(_iCurFrame >= _iFrameCount)
{
if(_bLoop)
_iCurFrame = 0;
else
{
_bLoop = false;
_bShow = false;
return;
}
}
_fCurTime = 0;
}
if(_iCurFrame == _iFrameCount - 1)
iNextFrame = _iCurFrame;
else
iNextFrame = _iCurFrame + 1;
_fLerp = _fCurTime / _fFrameTime;
D3DXColorLerp( &_dwColor, &_vecFrameColor[_iCurFrame], &_vecFrameColor[iNextFrame], _fLerp );
_fTexCurTime += *_pfDailTime;
if(_fTexCurTime >= _fTexFrameTime)
{
_iCurTex++;
if(_iCurTex == _iNumTex)
{
_iCurTex = 0;
}
_fTexCurTime = 0;
}
}
void CMPShadeEX::MoveTo(D3DXVECTOR3 SVerPos, MPMap* pMap, float fAngle)
{
if(!_bShow)
return;
if(_SVerPos == SVerPos)
{
if(_iNumTex > 1)
{
for(int n = 0; n < _iVerNum; n++)
{
_SShadeUV[n].x = _vecTexSave[n].x / _iRow;
_SShadeUV[n].y = _vecTexSave[n].y / _iCol;
_SShadeUV[n].x += _vecTexOffset[_iCurTex].x;
_SShadeUV[n].y += _vecTexOffset[_iCurTex].y;
}
}
return;
}
_SVerPos = SVerPos;
//!求当前TILE的位置
int nX = (int)((_SVerPos.x - _fRadius / 2 ) /*/ TILESIZE*/);
int nY = (int)((_SVerPos.y - _fRadius / 2 ) /*/ TILESIZE*/);
//MPTile *TileList;
for( int y = 0; y < _iGridCrossNum + 1; y++ )
{
for( int x = 0; x < _iGridCrossNum + 1; x++ )
{
int iIndex = x + y*(_iGridCrossNum + 1);
//if(pMap)
// TileList = pMap->GetTile(nX + x, nY + y);
float fGridX = (float)(nX + x * TILESIZE) /*/ TILESIZE*/;
float fGridY = (float)(nY + y * TILESIZE) /*/ TILESIZE*/;
_SShadePos[iIndex].x = fGridX;
_SShadePos[iIndex].y = fGridY;
if(pMap)
{
float height,objheight;
// if(!TileList->IsDefault())
// {
// int iUnitNo = int(fGridY) % 2 + int(fGridX) % 2;
// height = TileList->fHeight; // getHeight();
//float objHeight = TileList->getObjHeight(iUnitNo);
//if(objHeight > height)
//{
// height = objHeight;
//}
// }
int iGridx = (int)(fGridX * 2);
int iGridy = (int)(fGridY* 2);
if(y == _iGridCrossNum)
iGridy -= 1;
if(x == _iGridCrossNum)
iGridx -= 1;
objheight = pMap->GetGridHeight(iGridx, iGridy);
height = pMap->GetTileHeight((int)(fGridX), (int)(fGridY));
if(_UpSea)
{
if(height <= 0)
height = 0;
}
if( objheight > height )
height = objheight;
_SShadePos[iIndex].z = height + 0.01f;
}
else
_SShadePos[iIndex].z = SVerPos.z + 0.01f;
float fU,fV;
{
fU = ( fGridX - _SVerPos.x ) / ( _fGridMax * TILESIZE);
fV = ( fGridY - _SVerPos.y ) / ( _fGridMax * TILESIZE);
_SShadeUV[iIndex].x = CLAMP(fU + 0.5f, 0.0f, 1.0f);
_SShadeUV[iIndex].y = CLAMP(fV + 0.5f, 0.0f, 1.0f);
}
if(fAngle != 0)
{
D3DXMATRIX mat;
D3DXVECTOR3 vpos(0.5f,0.5f,0);
GetMatrixRotation(&mat,&vpos,\
&D3DXVECTOR3(0,0,1),fAngle);
D3DXVec2TransformCoord(&_SShadeUV[iIndex], &_SShadeUV[iIndex], &mat);
}
}
}
if(_iNumTex > 1)
{
for(int n = 0; n < _iVerNum; n++)
{
_vecTexSave[n] = _SShadeUV[n];
_SShadeUV[n].x /= _iRow;
_SShadeUV[n].y /= _iCol;
_SShadeUV[n] += _vecTexOffset[_iCurTex];
}
}
}
bool CMPShadeEX::SaveToFile(FILE* pFile)
{
char t_pszName[32];
int t_temp;
//!大小半径
fwrite(&_fRadius,sizeof(float),1,pFile);
lstrcpy(t_pszName,_strTexName.c_str());
fwrite(t_pszName, sizeof(char),32,pFile);
fwrite(&_iRow,sizeof(int),1,pFile);
fwrite(&_iCol,sizeof(int),1,pFile);
//!类型
t_temp = (int)_eSrcBlend;
fwrite(&t_temp,sizeof(int),1,pFile);
t_temp = (int)_eDestBlend;
fwrite(&t_temp,sizeof(int),1,pFile);
//!时间长度
//fwrite(&_fLife,sizeof(float),1,pFile);
//!帧数量
fwrite(&_iFrameCount,sizeof(int),1,pFile);
//!每一帧时间
fwrite(&_fFrameTime,sizeof(float),1,pFile);
//!每一帧颜色
for( int n = 0; n < _iFrameCount; n++)
{
fwrite(&_vecFrameColor[n],sizeof(D3DXCOLOR),1,pFile);
}
///////////////!保存坐标变换
//!每一帧坐标变换时间
fwrite(&_fTexFrameTime,sizeof(float),1,pFile);
fwrite(&_iIdxTech, sizeof(int),1,pFile);
return true;
}
bool CMPShadeEX::LoadFromFile(FILE* pFile)
{
//char t_pszName[32];
int t_temp;
////!大小半径
//fread(&_fRadius,sizeof(float),1,pFile);
//fread(t_pszName, sizeof(char),32,pFile);
//_strTexName = t_pszName;
//fread(&_iRow,sizeof(int),1,pFile);
//fread(&_iCol,sizeof(int),1,pFile);
//!类型
fread(&t_temp,sizeof(int),1,pFile);
_eSrcBlend = (D3DBLEND)t_temp;
fread(&t_temp,sizeof(int),1,pFile);
_eDestBlend = (D3DBLEND)t_temp;
//!帧数量
fread(&_iFrameCount,sizeof(int),1,pFile);
//!每一帧时间
fread(&_fFrameTime,sizeof(float),1,pFile);
//!每一帧颜色
_vecFrameColor.resize(_iFrameCount);
for( int n = 0; n < _iFrameCount; n++)
{
fread(&_vecFrameColor[n],sizeof(D3DXCOLOR),1,pFile);
}
///////////////!保存坐标变换
//!每一帧坐标变换时间
fread(&_fTexFrameTime,sizeof(float),1,pFile);
fread(&_iIdxTech, sizeof(int),1,pFile);
return true;
}
///////////////////////////////////////////////////////////
//class CMPShadeCtrl
///////////////////////////////////////////////////////////
CMPShadeCtrl::CMPShadeCtrl(void)
{
_pShadeMap = NULL;
}
CMPShadeCtrl::~CMPShadeCtrl(void)
{
SAFE_DELETE(_pShadeMap);
}
bool CMPShadeCtrl::Create(s_string& strTexName, CMPResManger *pCResMagr, float fSize,
bool bAni,int iRow, int iColnum)
{
SAFE_DELETE(_pShadeMap);
if(!bAni)
_pShadeMap = new CMPShadeMap;
else
_pShadeMap = new CMPShadeEX;
_pShadeMap->setTextureName(strTexName);
_pShadeMap->BoundingRes(pCResMagr);
_pShadeMap->CreateShadeMap(fSize);
if(bAni)
((CMPShadeEX*)_pShadeMap)->CreateSpliteTexture(iRow,iColnum);
return true;
}
void CMPShadeCtrl::SetAlphaType(D3DBLEND eSrcBlend, D3DBLEND eDestBlend)
{
_pShadeMap->SetAlphaType(eSrcBlend,eDestBlend);
}
/////////////////////
void CMPShadeCtrl::setFrameCount(int iCount)
{
if(_pShadeMap->m_iType == SHADE_ANI)
((CMPShadeEX*)_pShadeMap)->setFrameCount(iCount);
}
void CMPShadeCtrl::setFrameTime(float fTime)
{
if(_pShadeMap->m_iType == SHADE_ANI)
((CMPShadeEX*)_pShadeMap)->setFrameTime(fTime);
}
void CMPShadeCtrl::setTexFrameTime(float fTime)
{
if(_pShadeMap->m_iType == SHADE_ANI)
((CMPShadeEX*)_pShadeMap)->setTexFrameTime(fTime);
}
void CMPShadeCtrl::setFrameColor(int iIdx, D3DCOLOR SColor)
{
if(_pShadeMap->m_iType == SHADE_ANI)
((CMPShadeEX*)_pShadeMap)->setFrameColor(iIdx,SColor);
}
void CMPShadeCtrl::setColor(D3DXCOLOR SColor)
{
if(_pShadeMap->m_iType == SHADE_SINGLE)
_pShadeMap->SetColor(SColor);
else
((CMPShadeEX*)_pShadeMap)->SetColor(SColor);
}
int CMPShadeCtrl::getFrameCount()
{
if(_pShadeMap->m_iType == SHADE_ANI)
return ((CMPShadeEX*)_pShadeMap)->getFrameCount();
return 0;
}
float CMPShadeCtrl::getFrameTime()
{
if(_pShadeMap->m_iType == SHADE_ANI)
return ((CMPShadeEX*)_pShadeMap)->getFrameTime();
return 0;
}
float CMPShadeCtrl::getTexFrameTime()
{
if(_pShadeMap->m_iType == SHADE_ANI)
return ((CMPShadeEX*)_pShadeMap)->getTexFrameTime();
return 0;
}
void CMPShadeCtrl::getFrameColor(int iIdx, D3DCOLOR* pSColor)
{
if(_pShadeMap->m_iType == SHADE_ANI)
return ((CMPShadeEX*)_pShadeMap)->getFrameColor(iIdx, pSColor);
}
void CMPShadeCtrl::getColor(D3DXCOLOR* pSColor)
{
//if(_pShadeMap->m_iType == SHADE_SINGLE)
_pShadeMap->getColor(pSColor);
}
/////////////////////
void CMPShadeCtrl::setFrameTexture(s_string& strTexName, CMPResManger *pCResMagr)
{
_pShadeMap->setFrameTexture(strTexName,pCResMagr);
}
void CMPShadeCtrl::FrameMove(DWORD dwDailTime)
{
_pShadeMap->FrameMove(dwDailTime);
}
void CMPShadeCtrl::MoveTo(D3DXVECTOR3 SVerPos, MPMap* pMap, float fAngle)
{
_pShadeMap->MoveTo(SVerPos,pMap,-fAngle);
}
void CMPShadeCtrl::Render()
{
_pShadeMap->Render();
}
bool CMPShadeCtrl::SaveToFile(char* pchName)
{
FILE* pFile;
pFile = fopen(pchName, "wb");
if(!pFile)
return false;
fwrite(&_pShadeMap->m_iType, sizeof(int),1,pFile);
if(_pShadeMap->m_iType == SHADE_ANI)
return ((CMPShadeEX*)_pShadeMap)->SaveToFile(pFile);
else
_pShadeMap->SaveToFile(pFile);
fclose(pFile);
return true;
}
bool CMPShadeCtrl::LoadFromFile(char* pchName)
{
return true;
}
| [
"businessyagura2k@gmail.com"
] | businessyagura2k@gmail.com |
4b92a6566d6d95d8545f8fb75712237696022dac | b28305dab0be0e03765c62b97bcd7f49a4f8073d | /components/arc/volume_mounter/arc_volume_mounter_bridge.cc | 5ac2058ae89d839b803280b22c678e8528685a52 | [
"BSD-3-Clause"
] | permissive | svarvel/browser-android-tabs | 9e5e27e0a6e302a12fe784ca06123e5ce090ced5 | bd198b4c7a1aca2f3e91f33005d881f42a8d0c3f | refs/heads/base-72.0.3626.105 | 2020-04-24T12:16:31.442851 | 2019-08-02T19:15:36 | 2019-08-02T19:15:36 | 171,950,555 | 1 | 2 | NOASSERTION | 2019-08-02T19:15:37 | 2019-02-21T21:47:44 | null | UTF-8 | C++ | false | false | 5,431 | cc | // Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/arc/volume_mounter/arc_volume_mounter_bridge.h"
#include "base/bind.h"
#include "base/logging.h"
#include "base/memory/singleton.h"
#include "base/task/post_task.h"
#include "chromeos/disks/disk.h"
#include "chromeos/disks/disk_mount_manager.h"
#include "components/arc/arc_bridge_service.h"
#include "components/arc/arc_browser_context_keyed_service_factory_base.h"
#include "third_party/re2/src/re2/re2.h"
using chromeos::disks::DiskMountManager;
namespace arc {
namespace {
// Singleton factory for ArcVolumeMounterBridge.
class ArcVolumeMounterBridgeFactory
: public internal::ArcBrowserContextKeyedServiceFactoryBase<
ArcVolumeMounterBridge,
ArcVolumeMounterBridgeFactory> {
public:
// Factory name used by ArcBrowserContextKeyedServiceFactoryBase.
static constexpr const char* kName = "ArcVolumeMounterBridgeFactory";
static ArcVolumeMounterBridgeFactory* GetInstance() {
return base::Singleton<ArcVolumeMounterBridgeFactory>::get();
}
private:
friend base::DefaultSingletonTraits<ArcVolumeMounterBridgeFactory>;
ArcVolumeMounterBridgeFactory() = default;
~ArcVolumeMounterBridgeFactory() override = default;
};
} // namespace
// static
ArcVolumeMounterBridge* ArcVolumeMounterBridge::GetForBrowserContext(
content::BrowserContext* context) {
return ArcVolumeMounterBridgeFactory::GetForBrowserContext(context);
}
ArcVolumeMounterBridge::ArcVolumeMounterBridge(content::BrowserContext* context,
ArcBridgeService* bridge_service)
: arc_bridge_service_(bridge_service), weak_ptr_factory_(this) {
arc_bridge_service_->volume_mounter()->AddObserver(this);
arc_bridge_service_->volume_mounter()->SetHost(this);
DCHECK(DiskMountManager::GetInstance());
DiskMountManager::GetInstance()->AddObserver(this);
}
ArcVolumeMounterBridge::~ArcVolumeMounterBridge() {
DiskMountManager::GetInstance()->RemoveObserver(this);
arc_bridge_service_->volume_mounter()->SetHost(nullptr);
arc_bridge_service_->volume_mounter()->RemoveObserver(this);
}
// Sends MountEvents of all existing MountPoints in cros-disks.
void ArcVolumeMounterBridge::SendAllMountEvents() {
for (const auto& keyValue : DiskMountManager::GetInstance()->mount_points()) {
OnMountEvent(DiskMountManager::MountEvent::MOUNTING,
chromeos::MountError::MOUNT_ERROR_NONE, keyValue.second);
}
}
void ArcVolumeMounterBridge::OnConnectionReady() {
// Deferring the SendAllMountEvents as a task to current thread to not
// block the mojo request since SendAllMountEvents might takes non trivial
// amount of time.
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(&ArcVolumeMounterBridge::SendAllMountEvents,
weak_ptr_factory_.GetWeakPtr()));
}
void ArcVolumeMounterBridge::OnMountEvent(
DiskMountManager::MountEvent event,
chromeos::MountError error_code,
const chromeos::disks::DiskMountManager::MountPointInfo& mount_info) {
// ArcVolumeMounter is limited for local storage, as Android's StorageManager
// volume concept relies on assumption that it is local filesystem. Hence,
// special volumes like DriveFS should not come through this path.
if (RE2::FullMatch(mount_info.source_path, "[a-z]+://.*")) {
DVLOG(1) << "Ignoring mount event for source_path: "
<< mount_info.source_path;
return;
}
if (error_code != chromeos::MountError::MOUNT_ERROR_NONE) {
DVLOG(1) << "Error " << error_code << "occurs during MountEvent " << event;
return;
}
// Get disks informations that are needed by Android MountService.
const chromeos::disks::Disk* disk =
DiskMountManager::GetInstance()->FindDiskBySourcePath(
mount_info.source_path);
std::string fs_uuid, device_label;
chromeos::DeviceType device_type = chromeos::DeviceType::DEVICE_TYPE_UNKNOWN;
// There are several cases where disk can be null:
// 1. The disk is removed physically before being ejected/unmounted.
// 2. The disk is inserted, but then immediately removed physically. The
// disk removal will race with mount event in this case.
if (disk) {
fs_uuid = disk->fs_uuid();
device_label = disk->device_label();
device_type = disk->device_type();
} else {
DVLOG(1) << "Disk at " << mount_info.source_path
<< " is null during MountEvent " << event;
}
mojom::VolumeMounterInstance* volume_mounter_instance =
ARC_GET_INSTANCE_FOR_METHOD(arc_bridge_service_->volume_mounter(),
OnMountEvent);
if (!volume_mounter_instance)
return;
volume_mounter_instance->OnMountEvent(mojom::MountPointInfo::New(
event, mount_info.source_path, mount_info.mount_path, fs_uuid,
device_label, device_type));
}
void ArcVolumeMounterBridge::RequestAllMountPoints() {
// Deferring the SendAllMountEvents as a task to current thread to not
// block the mojo request since SendAllMountEvents might takes non trivial
// amount of time.
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(&ArcVolumeMounterBridge::SendAllMountEvents,
weak_ptr_factory_.GetWeakPtr()));
}
} // namespace arc
| [
"artem@brave.com"
] | artem@brave.com |
863b257d5c2b7dabd062c26493049442fec9b869 | a3d6556180e74af7b555f8d47d3fea55b94bcbda | /third_party/blink/renderer/modules/webtransport/datagram_duplex_stream.h | 2412e30095d39e4808d3c8791bd40622c3cfde32 | [
"LGPL-2.0-or-later",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-only",
"GPL-1.0-or-later",
"GPL-2.0-only",
"LGPL-2.0-only",
"BSD-2-Clause",
"LicenseRef-scancode-other-copyleft",
"BSD-3-Clause",
"MIT",
"Apache-2.0"
] | permissive | chromium/chromium | aaa9eda10115b50b0616d2f1aed5ef35d1d779d6 | a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c | refs/heads/main | 2023-08-24T00:35:12.585945 | 2023-08-23T22:01:11 | 2023-08-23T22:01:11 | 120,360,765 | 17,408 | 7,102 | BSD-3-Clause | 2023-09-10T23:44:27 | 2018-02-05T20:55:32 | null | UTF-8 | C++ | false | false | 2,953 | h | // Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_WEBTRANSPORT_DATAGRAM_DUPLEX_STREAM_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBTRANSPORT_DATAGRAM_DUPLEX_STREAM_H_
#include <stdint.h>
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/renderer/modules/modules_export.h"
#include "third_party/blink/renderer/modules/webtransport/web_transport.h"
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
#include "third_party/blink/renderer/platform/heap/visitor.h"
namespace blink {
class ReadableStream;
class WritableStream;
constexpr int32_t kDefaultIncomingHighWaterMark = 1;
class MODULES_EXPORT DatagramDuplexStream : public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
public:
// Currently we delegate to the WebTransport object rather than store the
// readable and writable separately.
// TODO(ricea): Once the legacy getters are removed from WebTransport, store
// the readable and writable in this object.
explicit DatagramDuplexStream(WebTransport* web_transport,
int32_t initial_outgoing_high_water_mark)
: web_transport_(web_transport),
outgoing_high_water_mark_(initial_outgoing_high_water_mark) {}
ReadableStream* readable() const {
return web_transport_->datagramReadable();
}
WritableStream* writable() const {
return web_transport_->datagramWritable();
}
uint32_t maxDatagramSize() const { return max_datagram_size_; }
absl::optional<double> incomingMaxAge() const { return incoming_max_age_; }
void setIncomingMaxAge(absl::optional<double> max_age);
absl::optional<double> outgoingMaxAge() const { return outgoing_max_age_; }
void setOutgoingMaxAge(absl::optional<double> max_age);
int32_t incomingHighWaterMark() const { return incoming_high_water_mark_; }
void setIncomingHighWaterMark(int32_t high_water_mark);
int32_t outgoingHighWaterMark() const { return outgoing_high_water_mark_; }
void setOutgoingHighWaterMark(int32_t high_water_mark);
void Trace(Visitor* visitor) const override {
visitor->Trace(web_transport_);
ScriptWrappable::Trace(visitor);
}
private:
const Member<WebTransport> web_transport_;
// TODO(yhirano): Update this variable when the session is established.
// We need to choose an initial value without knowing the actual network
// condition, so let's choose a conservative value. This will be update when
// the path migration happens.
uint32_t max_datagram_size_ = 1024;
absl::optional<double> incoming_max_age_;
absl::optional<double> outgoing_max_age_;
int32_t incoming_high_water_mark_ = kDefaultIncomingHighWaterMark;
int32_t outgoing_high_water_mark_;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_WEBTRANSPORT_DATAGRAM_DUPLEX_STREAM_H_
| [
"chromium-scoped@luci-project-accounts.iam.gserviceaccount.com"
] | chromium-scoped@luci-project-accounts.iam.gserviceaccount.com |
000459f94508d9eab7dcf3ca54973d6b4d5e96d0 | 3129e06c67d9b0e20f0c6f52fe854540237acd1d | /Sources/Elastos/LibCore/inc/elastosx/crypto/MacSpi.h | 894b89291e24d645cb23d7220007ae2854e72059 | [] | no_license | imace/ElastosRDK5_0 | 0300d0e63871422e03d21664ae9eab9aec2d1c25 | c4dc183c148960450198a3b59832c9a69327d3f3 | refs/heads/master | 2021-01-15T16:11:18.368138 | 2015-08-09T14:34:05 | 2015-08-09T14:34:05 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,209 | h |
#ifndef __MACSPI_H__
#define __MACSPI_H__
#include <elastos/core/Object.h>
using Elastos::Core::Object;
using Elastos::IO::IByteBuffer;
using Elastos::IO::IBuffer;
using Elastos::Security::IKey;
using Elastos::Security::Spec::IAlgorithmParameterSpec;
namespace Elastosx {
namespace Crypto {
class MacSpi
: public Object
, public IMacSpi
{
public:
CAR_INTERFACE_DECL()
MacSpi();
virtual ~MacSpi();
/**
* Creates a new {@code MacSpi} instance.
*/
CARAPI constructor();
/**
* Returns the length of this MAC (in bytes).
*
* @return the length of this MAC (in bytes).
*/
virtual CARAPI EngineGetMacLength(
/* [out] */ Int32 ** result) = 0;
/**
* Initializes this {@code MacSpi} instance with the specified key and
* algorithm parameters.
*
* @param key
* the key to initialize this algorithm.
* @param params
* the parameters for this algorithm.
* @throws InvalidKeyException
* if the specified key cannot be used to initialize this
* algorithm, or it is {@code null}.
* @throws InvalidAlgorithmParameterException
* if the specified parameters cannot be used to initialize this
* algorithm.
*/
virtual CARAPI EngineInit(
/* [in] */ IKey * key,
/* [in] */ IAlgorithmParameterSpec * params) = 0;
/**
* Updates this {@code MacSpi} instance with the specified byte.
*
* @param input
* the byte.
*/
virtual CARAPI EngineUpdate(
/* [in] */ Byte input) = 0;
/**
* Updates this {@code MacSpi} instance with the data from the specified
* buffer {@code input} from the specified {@code offset} and length {@code
* len}.
*
* @param input
* the buffer.
* @param offset
* the offset in the buffer.
* @param len
* the length of the data in the buffer.
*/
virtual CARAPI EngineUpdate(
/* [in] */ ArrayOf<Byte> * input,
/* [in] */ Int32 offset,
/* [in] */ Int32 len) = 0;
/**
* Computes the digest of this MAC based on the data previously specified in
* {@link #engineUpdate} calls.
* <p>
* This {@code MacSpi} instance is reverted to its initial state and
* can be used to start the next MAC computation with the same parameters or
* initialized with different parameters.
*
* @return the generated digest.
*/
virtual CARAPI EngineDoFinal(
/* [out, callee] */ ArrayOf<Byte> ** input) = 0;
/**
* Resets this {@code MacSpi} instance to its initial state.
* <p>
* This {@code MacSpi} instance is reverted to its initial state and can be
* used to start the next MAC computation with the same parameters or
* initialized with different parameters.
*/
virtual CARAPI EngineReset();
CARAPI Clone(
/* [out] */ IInterface** result);
protected:
CARAPI EngineUpdate(
/* [in] */ IByteBuffer * input);
CARAPI CloneImpl(
/* [in] */ IMacSpi* spi);
};
}
}
#endif // __MACSPI_H__
| [
"ma.li@kortide.com"
] | ma.li@kortide.com |
0a50a554b731b62bcd09904055b20e3dfda45970 | 1c8e5a1fc7f9dfee4969194c1bd77918eea73095 | /Source/AllProjects/CIDLib/CIDLib_UniqueName.cpp | fd39c773daa9f0d5f1540da0fb40d5100f75fa3e | [] | no_license | naushad-rahman/CIDLib | bcb579a6f9517d23d25ad17a152cc99b7508330e | 577c343d33d01e0f064d76dfc0b3433d1686f488 | refs/heads/master | 2020-04-28T01:08:35.084154 | 2019-03-10T02:03:20 | 2019-03-10T02:03:20 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,803 | cpp | //
// FILE NAME: CIDLib_UniqueName.cpp
//
// AUTHOR: Dean Roddey
//
// CREATED: 03/10/2001
//
// COPYRIGHT: $_CIDLib_CopyRight_$
//
// $_CIDLib_CopyRight2_$
//
// DESCRIPTION:
//
//
// CAVEATS/GOTCHAS:
//
// LOG:
//
// $_CIDLib_Log_$
//
// ---------------------------------------------------------------------------
// Facility specific includes
// ---------------------------------------------------------------------------
#include "CIDLib_.hpp"
// ---------------------------------------------------------------------------
// Magic macros
// ---------------------------------------------------------------------------
RTTIDecls(TUniqueName,TObject)
// ---------------------------------------------------------------------------
// TUniqueName: Constructors and Destructor
// ---------------------------------------------------------------------------
TUniqueName::TUniqueName() :
m_c4Number(1)
{
}
TUniqueName::TUniqueName(const TString& strText
, const tCIDLib::TCard4 c4Value) :
m_c4Number(c4Value)
, m_crsLock()
, m_strText(strText)
{
// Validate that it has the required replacement parm
ValidateText(strText);
}
TUniqueName::TUniqueName(const tCIDLib::TCh* const pszText
, const tCIDLib::TCard4 c4Value) :
m_c4Number(c4Value)
, m_crsLock()
, m_strText(pszText)
{
// Validate that it has the required replacement parm
ValidateText(m_strText);
}
TUniqueName::~TUniqueName()
{
}
// ---------------------------------------------------------------------------
// TUniqueName: Public, non-virtual methods
// ---------------------------------------------------------------------------
tCIDLib::TCard4
TUniqueName::c4SetSequenceNum(const tCIDLib::TCard4 c4NewNum)
{
TCritSecLocker crslSync(&m_crsLock);
m_c4Number = c4NewNum;
return c4NewNum;
}
tCIDLib::TVoid TUniqueName::QueryNewName(TString& strToFill)
{
// If debugging, make sure the text was set
CIDAssert(!m_strText.bIsEmpty(), L"The unique name object has not be set up yet");
// Get the current value out and add 1 for next time
tCIDLib::TCard4 c4New;
{
TCritSecLocker crslSync(&m_crsLock);
c4New = m_c4Number++;
}
// Get a copy of the text and replace the parameter
strToFill = m_strText;
strToFill.eReplaceToken(TCardinal(c4New), L'1');
}
TString TUniqueName::strQueryNewName()
{
// If debugging, make sure the text was set
CIDAssert(!m_strText.bIsEmpty(), L"The unique name object has not be set up yet");
// Get the current value and add 1 for the next time
tCIDLib::TCard4 c4New;
{
TCritSecLocker crslSync(&m_crsLock);
c4New = m_c4Number++;
}
// Get a copy of the text and replace the parameter
TString strRet = m_strText;
strRet.eReplaceToken(TCardinal(c4New), L'1');
return strRet;
}
const TString& TUniqueName::strText() const
{
return m_strText;
}
const TString& TUniqueName::strText(const TString& strNew)
{
// Validate that it has the required replacement parm
ValidateText(strNew);
TCritSecLocker crslSync(&m_crsLock);
m_strText = strNew;
return m_strText;
}
// ---------------------------------------------------------------------------
// TUniqueName: Private, non-virtual methods
// ---------------------------------------------------------------------------
tCIDLib::TVoid TUniqueName::ValidateText(const TString& strToValidate)
{
if (!strToValidate.bTokenExists(L'1'))
{
facCIDLib().ThrowErr
(
CID_FILE
, CID_LINE
, kCIDErrs::errcUName_BadText
, tCIDLib::ESeverities::Failed
, tCIDLib::EErrClasses::Format
, strToValidate
);
}
}
| [
"droddey@charmedquark.com"
] | droddey@charmedquark.com |
810d1a869d35df884ac179fbc25cdc0c13af9301 | 467eb15f68718790273d31763da509a726302abf | /binary-tree-right-side-view.cc | 3c361cbd71d03cd52fd54e1ee0de5f8d168da8f1 | [] | no_license | terryterry841/leetcode | 5693408baf55751c065af9180a5ff9d299c456b7 | 54fd9d5da703b51872e6395c4c101fd4ad33d1a0 | refs/heads/master | 2021-01-10T02:27:53.831026 | 2016-04-05T23:46:15 | 2016-04-05T23:46:15 | 54,294,691 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 980 | cc | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
vector<int> rightSideView(TreeNode* root) {
if (!root) {
return {};
}
vector<int> result;
queue<TreeNode*> queue;
queue.emplace(root);
while (!queue.empty()) {
int size = queue.size();
for (int i = 0; i < size; ++i) {
auto current = queue.front();
queue.pop();
if (i == size - 1) {
result.emplace_back(current->val);
}
if (current->left) {
queue.emplace(current->left);
}
if (current->right) {
queue.emplace(current->right);
}
}
}
return result;
}
};
| [
"terryterry841@gmail.com"
] | terryterry841@gmail.com |
ad6e963e66dcaead8513047ba1b2495f235b157e | e7e497b20442a4220296dea1550091a457df5a38 | /main_project/feed/FeedAsync/src/SqlQueue.h | 97d7a944a47e1b4eb6c4c19076468b3a81302382 | [] | no_license | gunner14/old_rr_code | cf17a2dedf8dfcdcf441d49139adaadc770c0eea | bb047dc88fa7243ded61d840af0f8bad22d68dee | refs/heads/master | 2021-01-17T18:23:28.154228 | 2013-12-02T23:45:33 | 2013-12-02T23:45:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,973 | h | /*
* Queue.h
*
* Created on: Feb 17, 2011
* Author: yejingwei
*/
#ifndef QUEUE_H_
#define QUEUE_H_
#include <vector>
#include <queue>
#include "IceUtil/Thread.h"
#include "IceUtil/Monitor.h"
#include "Singleton.h"
#include "Ice/Config.h"
#include "QueryRunner.h"
using namespace com::xiaonei::xce;
using namespace MyUtil;
using namespace std;
namespace xce {
namespace feed {
const static string kInTag = "##INTAG##";
const static string kOutTag = "##OUTTAG##";
const static string kInTagNoRestore = "##INTAG_NORESTORE##";
const static string kOutTagNoRestore = "##OUTTAG_NORESTORE##";
class Unit: public IceUtil::Shared {
public:
Unit(Ice::Long id, int retry, const string & instance, int wrflag,
const string &pattern, const string& statement,bool restore);
string DumpToString();
string MakeInLog();
string MakeOutLog();
// SqlInfoPtr info_;
string instance_;
int wrflag_;
string pattern_;
string statement_;
Ice::Long id_;
int retry_;
bool restore_;
};
typedef IceUtil::Handle<Unit> UnitPtr;
class QueueManager;
typedef IceUtil::Handle<QueueManager> QueueManagerPtr;
class SqlQueue: public IceUtil::Monitor<IceUtil::Mutex>, public IceUtil::Thread {
public:
void Init(QueueManager * manager);
void Push(const UnitPtr& unit);
virtual void run();
int Size();
int exe_cnt(bool reset = true){
int tmp = exe_cnt_;
if(reset){
exe_cnt_ = 0;
}
return tmp;
}
private:
void Execute(const UnitPtr& unit);
bool Check();
queue<UnitPtr> q_;
int exe_cnt_;
QueueManagerPtr manager_;
};
typedef IceUtil::Handle<SqlQueue> SqlQueuePtr;
class QueueManager: public IceUtil::Shared {
public:
void Init(int size, int sqlsize) {
for (int i = 0; i != size; ++i) {
SqlQueuePtr mq = new SqlQueue;
mq->Init(this);
queues_.push_back(mq);
}
cur_index_ = 0;
size_sql_ = sqlsize;
Reset();
}
void Push(long id,int retry,const string & instance,int wrflag,const string & pattern,const Statement & statement,bool restore = false);
int Size() {
return count_;
}
int exe_cnt() {
int exe_cnt = 0;
for (unsigned i = 0; i != queues_.size(); ++i) {
exe_cnt += queues_.at(i)->exe_cnt();
}
return exe_cnt;
}
bool Check() {
return (Size() < size_sql_);
}
void Reset(){
push_cnt_ = abort_cnt_ = 0;
}
string DumpToString();
void Update(int i){
IceUtil::Mutex::Lock lock(mutex_);
count_ += i;
}
int NextIndex(){
cur_index_ = ++cur_index_ % queue_size_;
return cur_index_;
}
private:
vector<SqlQueuePtr> queues_;
// int size_q_;
int size_sql_;
int cur_index_;
int queue_size_;
int push_cnt_,abort_cnt_;
int count_;
IceUtil::Mutex mutex_;
};
typedef IceUtil::Handle<QueueManager> QueueManagerPtr;
class IdGenerator: public MyUtil::Singleton<IdGenerator> {
public:
void Init();
Ice::Long Generate() {
return id_++;
}
private:
Ice::Long id_;
};
}
}
#endif /* QUEUE_H_ */
| [
"liyong19861014@gmail.com"
] | liyong19861014@gmail.com |
8e08c0290ce7f2b704b02b841ad2ab988a66b752 | a7080720a08343936af62530eaef5af337e72ed1 | /operatorpresedence.cpp | 68e434a263ef54e95cc52ad69211fafd5b01e756 | [] | no_license | VISHAL2981/codingblock_data_structure_algorithm | f46d9a9c8e4d5130560e5e74acd5f659e9889a8d | 14ab94ba8fea2727f0df0bf75cdc0d6f52327c7e | refs/heads/master | 2023-06-10T10:31:37.808847 | 2021-07-09T17:00:48 | 2021-07-09T17:00:48 | 384,502,026 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 767 | cpp | #include <iostream>
using namespace std;
int main()
{
int digit = 0;
int alphabets = 0;
int spaces = 0;
int others = 0;
char ch;
// ch = cin.get();
while (ch != '$')
{
if (ch >= '0' and ch <= '9')
{
digit++;
}
else if ((ch >= 'a' and ch <= 'z') or (ch >= 'A' and ch <= 'Z'))
{
alphabets++;
}
else if (ch == ' ' or ch == '\n' or ch == '\t')
{
spaces++;
}
else
{
others++;
}
ch = cin.get();
}
cout << "digits" << digit << endl;
cout << "alphabets" << alphabets << endl;
cout << "spaces" << spaces << endl;
cout << "others" << others << endl;
return 0;
} | [
"vishalnimesh29@gmail.com"
] | vishalnimesh29@gmail.com |
2462ec30c6e8b9e8ab3e8d0d8e3849a0fa863340 | df75154e1344bc4f1817d55cad7379dc2eb6deec | /hdr/transform/falcon_dsp_freq_shift_cuda.h | 0a681b20c225b7f164cc820dd2e224cec05fba9c | [
"MIT"
] | permissive | OrthogonalHawk/libfalcon_dsp | 02b34c18074b5c74b7b24d22eb11ea90a857d123 | 93b8e78ae768688df495e1c67770370c206044cd | refs/heads/master | 2020-05-09T14:08:48.565757 | 2020-02-18T20:51:30 | 2020-02-18T20:51:30 | 181,182,936 | 2 | 0 | MIT | 2019-09-04T02:56:08 | 2019-04-13T14:28:05 | C++ | UTF-8 | C++ | false | false | 8,859 | h | /******************************************************************************
*
* MIT License
*
* Copyright (c) 2020 OrthogonalHawk
* 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.
*
*****************************************************************************/
/******************************************************************************
*
* @file falcon_dsp_freq_shift_cuda.h
* @author OrthogonalHawk
* @date 19-Jan-2020
*
* @brief Signal processing transformation functions for frequency shifting;
* CUDA versions.
*
* @section DESCRIPTION
*
* Defines a set of signal processing transformation frequency shift functions.
* Includes CUDA implementations.
*
* @section HISTORY
*
* 19-Jan-2020 OrthogonalHawk File broken out from falcon_dsp_transform.h
* 12-Feb-2020 OrthogonalHawk Updated to use an 'initialize' method.
*
*****************************************************************************/
#ifndef __FALCON_DSP_TRANSFORM_FREQ_SHIFT_CUDA_H__
#define __FALCON_DSP_TRANSFORM_FREQ_SHIFT_CUDA_H__
/******************************************************************************
* INCLUDE_FILES
*****************************************************************************/
#include <complex>
#include <memory>
#include <mutex>
#include <vector>
#include <cuComplex.h>
#include "transform/falcon_dsp_freq_shift.h"
#include "utilities/falcon_dsp_cuda_utils.h"
/******************************************************************************
* CONSTANTS
*****************************************************************************/
/******************************************************************************
* ENUMS & TYPEDEFS
*****************************************************************************/
struct freq_shift_channel_s
{
freq_shift_channel_s(void)
: num_samples_handled(0),
time_shift_rollover_sample_idx(1e6),
angular_freq(0.0),
out_data(nullptr),
out_data_len(0)
{ }
~freq_shift_channel_s(void)
{
cleanup_memory();
}
void allocate_memory(uint32_t input_vector_len)
{
if (out_data)
{
cudaErrChk(cudaFree(out_data));
out_data = nullptr;
out_data_len = 0;
}
cudaErrChkAssert(cudaMallocManaged(&out_data,
input_vector_len * sizeof(std::complex<float>)));
out_data_len = input_vector_len;
}
void cleanup_memory(void)
{
if (out_data)
{
cudaErrChk(cudaFree(out_data));
out_data = nullptr;
out_data_len = 0;
}
}
void reset_state(void)
{
num_samples_handled = 0;
}
uint64_t num_samples_handled;
uint32_t time_shift_rollover_sample_idx;
double angular_freq;
cuFloatComplex * out_data;
uint32_t out_data_len;
};
/******************************************************************************
* MACROS
*****************************************************************************/
namespace falcon_dsp
{
/******************************************************************************
* FUNCTION DECLARATION
*****************************************************************************/
/* @brief CUDA implementation of a frequency shift vector operation.
* @param[in] in_sample_rate_in_sps - input vector sample rate in samples
* per second.
* @param[in] in - input vector
* @param[in] freq_shift_in_hz - amount to frequency shift in Hz
* @param[out] out - frequency shifted vector
* @return True if the input vector was frequency shifted as requested;
* false otherwise.
*/
bool freq_shift_cuda(uint32_t in_sample_rate_in_sps, std::vector<std::complex<float>>& in,
int32_t freq_shift_in_hz, std::vector<std::complex<float>>& out);
/* @brief CUDA implementation of a multi-channel frequency shift vector operation.
* @param[in] in_sample_rate_in_sps - input vector sample rate in samples
* per second.
* @param[in] in - input vector
* @param[in] freq_shift_in_hz - vector of requested frequency shifts; each shift value
* generates a separate output 'channel'
* @param[out] out - vector of frequency shifted vectors
* @return True if the input vector was frequency shifted as requested;
* false otherwise.
*/
bool freq_shift_cuda(uint32_t in_sample_rate_in_sps, std::vector<std::complex<float>>& in,
std::vector<int32_t>& freq_shift_in_hz, std::vector<std::vector<std::complex<float>>>& out);
/* CUDA kernel function that applies a frequency shift and puts the shifted data
* into a (new?) memory location. can either be used to modify the data in-place
* or to make a new vector with the shifted data. */
__global__
void __freq_shift(uint32_t num_samples_handled_previously,
uint32_t time_shift_rollover_sample_idx,
double angular_freq,
cuFloatComplex * in_data,
uint32_t in_data_len,
cuFloatComplex * out_data,
uint32_t out_data_len);
/* CUDA kernel function that supports multi-channel frequency shifting. */
__global__
void __freq_shift_multi_chan(freq_shift_channel_s * channels,
uint32_t num_channels,
cuFloatComplex * in_data,
uint32_t in_data_len);
/******************************************************************************
* CLASS DECLARATION
*****************************************************************************/
/* @brief CUDA implementation of a frequency shift utility class.
* @description Derives from the C++ version since there is significant overlap
* in implementation. CUDA vs. C++ differentiation in the 'apply'
* method where the frequency shift is applied.
*/
class falcon_dsp_freq_shift_cuda : public falcon_dsp_freq_shift
{
public:
falcon_dsp_freq_shift_cuda(void);
~falcon_dsp_freq_shift_cuda(void);
falcon_dsp_freq_shift_cuda(const falcon_dsp_freq_shift_cuda&) = delete;
bool initialize(uint32_t input_sample_rate_in_sps, int32_t freq_shift_in_hz) override;
bool initialize(uint32_t input_sample_rate_in_sps, std::vector<int32_t> freq_shift_in_hz);
bool apply(std::vector<std::complex<int16_t>>& in, std::vector<std::complex<int16_t>>& out) override;
bool apply(std::vector<std::complex<float>>& in, std::vector<std::complex<float>>& out);
bool apply(std::vector<std::complex<float>>& in, std::vector<std::vector<std::complex<float>>>& out);
private:
/* variables for input data memory management */
void * m_cuda_input_data;
uint32_t m_max_num_input_samples;
/* variables for multi-channel management */
std::vector<std::unique_ptr<freq_shift_channel_s>> m_freq_shift_channels;
freq_shift_channel_s * d_freq_shift_channels;
};
}
#endif // __FALCON_DSP_TRANSFORM_FREQ_SHIFT_CUDA_H__
| [
"OrthogonalHawk@gmail.com"
] | OrthogonalHawk@gmail.com |
f41bc1b0ec723b704677b876f96a36ab87b4fce8 | f9be1d8e2abaff6f0febf2ad6b76ac57b329a785 | /src/qt/coingui.h | bcc4dd1ff808df119fbe7d8f18fc571b939a49ef | [
"MIT",
"Apache-2.0"
] | permissive | jonspock/tessa | 47e1f6444d4e04322c703df570c4e02ef0616de6 | 1a1b64b05510dffa8221b193b014dc7ccb9fbe4a | refs/heads/master | 2020-05-14T21:53:33.144627 | 2018-10-04T04:26:31 | 2018-10-04T04:26:31 | 181,966,556 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,677 | h | // Copyright (c) 2011-2014 The Bitcoin developers
// Copyright (c) 2017-2018 The PIVX developers
// Copyright (c) 2018 The TessaChain developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_QT_BITCOINGUI_H
#define BITCOIN_QT_BITCOINGUI_H
#if defined(HAVE_CONFIG_H)
#include "coin-config.h"
#endif
#include "amount.h"
#include <QLabel>
#include <QMainWindow>
#include <QMap>
#include <QMenu>
#include <QPoint>
#include <QPushButton>
#include <QSystemTrayIcon>
class ClientModel;
class NetworkStyle;
class Notificator;
class OptionsModel;
class BlockExplorer;
class RPCConsole;
class SendCoinsRecipient;
class UnitDisplayStatusBarControl;
class WalletFrame;
class WalletModel;
class CWallet;
QT_BEGIN_NAMESPACE
class QAction;
class QProgressBar;
class QProgressDialog;
QT_END_NAMESPACE
/**
Bitcoin GUI main class. This class represents the main window of the Bitcoin UI. It communicates with both the client
and wallet models to give the user an up-to-date view of the current core state.
*/
class BitcoinGUI : public QMainWindow {
Q_OBJECT
public:
static const QString DEFAULT_WALLET;
explicit BitcoinGUI(const NetworkStyle* networkStyle, QWidget* parent = 0);
~BitcoinGUI();
/** Set the client model.
The client model represents the part of the core that communicates with the P2P network, and is wallet-agnostic.
*/
void setClientModel(ClientModel* clientModel);
/** Set the wallet model.
The wallet model represents a bitcoin wallet, and offers access to the list of transactions, address book and
sending functionality.
*/
bool addWallet(const QString& name, WalletModel* walletModel);
bool setCurrentWallet(const QString& name);
void removeAllWallets();
bool enableWallet;
bool fMultiSend = false;
protected:
void changeEvent(QEvent* e);
void closeEvent(QCloseEvent* event);
void dragEnterEvent(QDragEnterEvent* event);
void dropEvent(QDropEvent* event);
bool eventFilter(QObject* object, QEvent* event);
private:
ClientModel* clientModel;
WalletFrame* walletFrame;
UnitDisplayStatusBarControl* unitDisplayControl;
QLabel* labelStakingIcon;
QPushButton* labelEncryptionIcon;
QPushButton* labelConnectionsIcon;
QLabel* labelBlocksIcon;
QLabel* progressBarLabel;
QProgressBar* progressBar;
QProgressDialog* progressDialog;
QMenuBar* appMenuBar;
QAction* overviewAction;
QAction* historyAction;
QAction* masternodeAction;
QAction* quitAction;
QAction* sendCoinsAction;
QAction* usedSendingAddressesAction;
QAction* usedReceivingAddressesAction;
QAction* signMessageAction;
QAction* verifyMessageAction;
QAction* multisigCreateAction;
QAction* multisigSpendAction;
QAction* multisigSignAction;
QAction* aboutAction;
QAction* receiveCoinsAction;
QAction* privacyAction;
QAction* optionsAction;
QAction* toggleHideAction;
QAction* encryptWalletAction;
QAction* backupWalletAction;
QAction* changePassphraseAction;
QAction* unlockWalletAction;
QAction* lockWalletAction;
QAction* aboutQtAction;
QAction* openInfoAction;
QAction* openRPCConsoleAction;
QAction* openNetworkAction;
QAction* openPeersAction;
QAction* openRepairAction;
QAction* openConfEditorAction;
QAction* showBackupsAction;
QAction* openAction;
QAction* openBlockExplorerAction;
QAction* showHelpMessageAction;
QAction* multiSendAction;
QSystemTrayIcon* trayIcon;
QMenu* trayIconMenu;
Notificator* notificator;
RPCConsole* rpcConsole;
BlockExplorer* explorerWindow;
/** Keep track of previous number of blocks, to detect progress */
int prevBlocks;
int spinnerFrame;
/** Create the main UI actions. */
void createActions(const NetworkStyle* networkStyle);
/** Create the menu bar and sub-menus. */
void createMenuBar();
/** Create the toolbars */
void createToolBars();
/** Create system tray icon and notification */
void createTrayIcon(const NetworkStyle* networkStyle);
/** Create system tray menu (or setup the dock menu) */
void createTrayIconMenu();
/** Enable or disable all wallet-related actions */
void setWalletActionsEnabled(bool enabled);
/** Connect core signals to GUI client */
void subscribeToCoreSignals();
/** Disconnect core signals from GUI client */
void unsubscribeFromCoreSignals();
signals:
/** Signal raised when a URI was entered or dragged to the GUI */
void receivedURI(const QString& uri);
/** Restart handling */
void requestedRestart(QStringList args);
public slots:
/** Set number of connections shown in the UI */
void setNumConnections(int count);
/** Set number of blocks shown in the UI */
void setNumBlocks(int count);
/** Get restart command-line parameters and request restart */
void handleRestart(QStringList args);
/** Notify the user of an event from the core network or transaction handling code.
@param[in] title the message box / notification title
@param[in] message the displayed text
@param[in] style modality and style definitions (icon and used buttons - buttons only for message boxes)
@see CClientUIInterface::MessageBoxFlags
@param[in] ret pointer to a bool that will be modified to whether Ok was clicked (modal only)
*/
void message(const QString& title, const QString& message, unsigned int style, bool* ret = nullptr);
void setStakingStatus();
/** Set the encryption status as shown in the UI.
@param[in] status current encryption status
@see WalletModel::EncryptionStatus
*/
void setEncryptionStatus(int status);
bool handlePaymentRequest(const SendCoinsRecipient& recipient);
/** Show incoming transaction notification for new transactions. */
void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type,
const QString& address);
private slots:
/** Switch to overview (home) page */
void gotoOverviewPage();
/** Switch to history (transactions) page */
void gotoHistoryPage();
/** Switch to Explorer Page */
void gotoBlockExplorerPage();
/** Switch to privacy page */
void gotoReceiveCoinsPage();
/** Switch to receive coins page */
void gotoPrivacyPage();
/** Switch to send coins page */
void gotoSendCoinsPage(QString addr = "");
/** Show Sign/Verify Message dialog and switch to sign message tab */
void gotoSignMessageTab(QString addr = "");
/** Show Sign/Verify Message dialog and switch to verify message tab */
void gotoVerifyMessageTab(QString addr = "");
/** Show MultiSend Dialog */
void gotoMultiSendDialog();
/** Show MultiSig Dialog */
void gotoMultisigCreate();
void gotoMultisigSpend();
void gotoMultisigSign();
/** Show open dialog */
void openClicked();
/** Show configuration dialog */
void optionsClicked();
/** Show about dialog */
void aboutClicked();
/** Show help message dialog */
void showHelpMessageClicked();
#ifndef Q_OS_MAC
/** Handle tray icon clicked */
void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
#endif
/** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true
*/
void showNormalIfMinimized(bool fToggleHidden = false);
/** Simply calls showNormalIfMinimized(true) for use in SLOT() macro */
void toggleHidden();
/** called by a timer to check if fRequestShutdown has been set **/
void detectShutdown();
/** Show progress dialog e.g. for verifychain */
void showProgress(const QString& title, int nProgress);
};
class UnitDisplayStatusBarControl : public QLabel {
Q_OBJECT
public:
explicit UnitDisplayStatusBarControl();
/** Lets the control know about the Options Model (and its signals) */
void setOptionsModel(OptionsModel* optionsModel);
protected:
/** So that it responds to left-button clicks */
void mousePressEvent(QMouseEvent* event);
private:
OptionsModel* optionsModel;
QMenu* menu;
/** Shows context menu with Display Unit options by the mouse coordinates */
void onDisplayUnitsClicked(const QPoint& point);
/** Creates context menu, its actions, and wires up all the relevant signals for mouse events. */
void createContextMenu();
private slots:
/** When Display Units are changed on OptionsModel it will refresh the display text of the control on the status bar
*/
void updateDisplayUnit(int newUnits);
/** Tells underlying optionsModel to update its current display unit. */
void onMenuSelection(QAction* action);
};
#endif // BITCOIN_QT_BITCOINGUI_H
| [
"jonspock@gmail.com"
] | jonspock@gmail.com |
e7cef6e6e110a6d68511430e7ce39a2581eda995 | 56fcab9393f0ec379e2abb00d2d8eda36f64e823 | /uintah/kokkos_src_original/Core/Grid/axiCptiInterpolator.h | 12e921c264bb86672a933e49c0270476982007a2 | [
"MIT",
"CC-BY-4.0"
] | permissive | damu1000/hypre_ep | 4a13a5545ac90b231ca9e0f29f23f041f344afb9 | a6701de3d455fa4ee95ac7d79608bffa3eb115ee | refs/heads/master | 2023-04-11T11:38:21.157249 | 2021-08-16T21:50:44 | 2021-08-16T21:50:44 | 41,874,948 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,974 | h | /*
* The MIT License
*
* Copyright (c) 1997-2017 The University of Utah
*
* 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 AXICPTI_INTERPOLATOR_H
#define AXICPTI_INTERPOLATOR_H
#include <Core/Grid/ParticleInterpolator.h>
#include <Core/Grid/cptiInterpolator.h>
/* Axisymmetric CPTI (Convected Particle Triangle/Prism domain Integrator)
This has not actually been implemented yet, but is proposed based on
methods developed by Alireza Sadeghirad and Rebecca Brannon
See Brian Leavy for more details
*/
namespace Uintah {
class Patch;
class axiCptiInterpolator : public cptiInterpolator {
public:
axiCptiInterpolator();
axiCptiInterpolator(const Patch* patch);
virtual ~axiCptiInterpolator();
virtual axiCptiInterpolator* clone(const Patch*);
virtual int findCellAndWeights(const Point& p,std::vector<IntVector>& ni,
std::vector<double>& S, const Matrix3& size,
const Matrix3& defgrad);
virtual int findCellAndShapeDerivatives(const Point& pos,
std::vector<IntVector>& ni,
std::vector<Vector>& d_S,
const Matrix3& size,
const Matrix3& defgrad);
virtual int findCellAndWeightsAndShapeDerivatives(const Point& pos,
std::vector<IntVector>& ni,
std::vector<double>& S,
std::vector<Vector>& d_S,
const Matrix3& size,
const Matrix3& defgrad);
virtual int size();
private:
const Patch* d_patch;
int d_size;
};
}
#endif
| [
"damodars@sci.utah.edu"
] | damodars@sci.utah.edu |
b5df00449c124e1dd4476588403ecc683cb975d3 | 5286798f369775a6607636a7c97c87d2a4380967 | /thirdparty/instant-meshes/instant-meshes-dust3d/ext/tbb/src/rml/test/test_rml_mixed.cpp | a20b17fcd063941fe020eaf808173c826fa08a94 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"MIT",
"LicenseRef-scancode-free-unknown"
] | permissive | MelvinG24/dust3d | d03e9091c1368985302bd69e00f59fa031297037 | c4936fd900a9a48220ebb811dfeaea0effbae3ee | refs/heads/master | 2023-08-24T20:33:06.967388 | 2021-08-10T10:44:24 | 2021-08-10T10:44:24 | 293,045,595 | 0 | 0 | MIT | 2020-09-05T09:38:30 | 2020-09-05T09:38:29 | null | UTF-8 | C++ | false | false | 9,209 | cpp | /*
Copyright (c) 2005-2016 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.
*/
#include <tbb/tbb_config.h>
#if __TBB_WIN8UI_SUPPORT || __TBB_MIC_OFFLOAD
#include "harness.h"
int TestMain () {
return Harness::Skipped;
}
#else
#include "rml_tbb.h"
#include "rml_omp.h"
#include "tbb/atomic.h"
#include "tbb/tick_count.h"
#define HARNESS_DEFAULT_MIN_THREADS 4
#include "harness.h"
// dynamic_link initializes its data structures in a static constructor. But
// the initialization order of static constructors in different modules is
// non-deterministic. Thus dynamic_link fails on some systems when the
// application changes its current directory after the library (TBB/OpenMP/...)
// is loaded but before the static constructors in the library are executed.
#define CHDIR_SUPPORT_BROKEN ( __TBB_GCC_VERSION >= 40600 || (__linux__ && __TBB_CLANG_VERSION >= 30500) )
const int OMP_ParallelRegionSize = 16;
int TBB_MaxThread = 4; // Includes master
int OMP_MaxThread = int(~0u>>1); // Includes master
template<typename Client>
class ClientBase: public Client {
protected:
typedef typename Client::version_type version_type;
typedef typename Client::job job;
typedef typename Client::policy_type policy_type;
private:
version_type version() const __TBB_override {
return 0;
}
size_t min_stack_size() const __TBB_override {
return 1<<20;
}
job* create_one_job() __TBB_override {
return new rml::job;
}
policy_type policy() const __TBB_override {
return Client::turnaround;
}
void acknowledge_close_connection() __TBB_override {
delete this;
}
void cleanup( job& j ) __TBB_override {delete &j;}
public:
virtual ~ClientBase() {}
};
#if _WIN32
#include <direct.h>
#define PATH_LEN MAX_PATH+1
#define SLASH '\\'
#define ROOT_DIR "\\"
// ROOT_DIR_REST means how many symbols before first slash in the path
#define ROOT_DIR_REST 2
#else
#include <unistd.h>
#include <limits.h>
#define PATH_LEN PATH_MAX+1
#define SLASH '/'
#define ROOT_DIR "/"
// ROOT_DIR_REST means how many symbols before first slash in the path
#define ROOT_DIR_REST 0
#define _getcwd getcwd
#define _chdir chdir
#endif
#if !CHDIR_SUPPORT_BROKEN
class ChangeCurrentDir {
char dir[PATH_LEN+1];
char *last_slash;
public:
ChangeCurrentDir() {
if ( !_getcwd( dir, PATH_LEN ) ) {
REPORT_FATAL_ERROR("ERROR: Couldn't get current working directory\n");
}
last_slash = strrchr( dir, SLASH );
ASSERT( last_slash, "The current directory doesn't contain slashes" );
*last_slash = 0;
if ( _chdir( last_slash-dir == ROOT_DIR_REST ? ROOT_DIR : dir ) ) {
REPORT_FATAL_ERROR("ERROR: Couldn't change current working directory (%s)\n", dir );
}
}
// Restore current dir
~ChangeCurrentDir() {
*last_slash = SLASH;
if ( _chdir(dir) ) {
REPORT_FATAL_ERROR("ERROR: Couldn't change current working directory\n");
}
}
};
#endif
//! Represents a TBB or OpenMP run-time that uses RML.
template<typename Factory, typename Client>
class RunTime {
public:
//! Factory that run-time uses to make servers.
Factory factory;
Client* client;
typename Factory::server_type* server;
#if _WIN32||_WIN64
::rml::server::execution_resource_t me;
#endif
RunTime() {
factory.open();
}
~RunTime() {
factory.close();
}
//! Create server for this run-time
void create_connection();
//! Destroy server for this run-time
void destroy_connection();
};
class ThreadLevelRecorder {
tbb::atomic<int> level;
struct record {
tbb::tick_count time;
int nthread;
};
tbb::atomic<unsigned> next;
/** Must be power of two */
static const unsigned max_record_count = 1<<20;
record array[max_record_count];
public:
void change_level( int delta );
void dump();
};
void ThreadLevelRecorder::change_level( int delta ) {
int x = level+=delta;
tbb::tick_count t = tbb::tick_count::now();
unsigned k = next++;
if( k<max_record_count ) {
record& r = array[k];
r.time = t;
r.nthread = x;
}
}
void ThreadLevelRecorder::dump() {
FILE* f = fopen("time.txt","w");
if( !f ) {
perror("fopen(time.txt)\n");
exit(1);
}
unsigned limit = next;
if( limit>max_record_count ) {
// Clip
limit = next;
}
for( unsigned i=0; i<limit; ++i ) {
fprintf(f,"%f\t%d\n",(array[i].time-array[0].time).seconds(),array[i].nthread);
}
fclose(f);
}
class TBB_Client: public ClientBase<tbb::internal::rml::tbb_client> {
void process( job& j ) __TBB_override;
size_type max_job_count() const __TBB_override {
return TBB_MaxThread-1;
}
};
class OMP_Client: public ClientBase<__kmp::rml::omp_client> {
void process( job&, void* cookie, omp_client::size_type ) __TBB_override;
size_type max_job_count() const __TBB_override {
return OMP_MaxThread-1;
}
};
#if !CHDIR_SUPPORT_BROKEN
// A global instance of ChangeCurrentDir should be declared before TBB_RunTime and OMP_RunTime
// since we want to change current directory before opening factory
ChangeCurrentDir Changer;
#endif
RunTime<tbb::internal::rml::tbb_factory, TBB_Client> TBB_RunTime;
RunTime<__kmp::rml::omp_factory, OMP_Client> OMP_RunTime;
ThreadLevelRecorder TotalThreadLevel;
template<typename Factory, typename Client>
void RunTime<Factory,Client>::create_connection() {
client = new Client;
typename Factory::status_type status = factory.make_server( server, *client );
ASSERT( status==Factory::st_success, NULL );
#if _WIN32||_WIN64
server->register_master( me );
#endif /* _WIN32||_WIN64 */
}
template<typename Factory, typename Client>
void RunTime<Factory,Client>::destroy_connection() {
#if _WIN32||_WIN64
server->unregister_master( me );
#endif /* _WIN32||_WIN64 */
server->request_close_connection();
server = NULL;
}
class OMP_Team {
public:
OMP_Team( __kmp::rml::omp_server& ) {}
tbb::atomic<unsigned> barrier;
};
tbb::atomic<int> AvailWork;
tbb::atomic<int> CompletionCount;
void OMPWork() {
tbb::atomic<int> x;
for( x=0; x<2000000; ++x ) {
continue;
}
}
void TBBWork() {
if( AvailWork>=0 ) {
int k = --AvailWork;
if( k==-1 ) {
TBB_RunTime.server->adjust_job_count_estimate(-(TBB_MaxThread-1));
++CompletionCount;
} else if( k>=0 ) {
for( int j=0; j<4; ++j ) {
OMP_Team team( *OMP_RunTime.server );
int n = OMP_RunTime.server->try_increase_load( OMP_ParallelRegionSize-1, /*strict=*/false );
team.barrier = 0;
::rml::job* array[OMP_ParallelRegionSize-1];
if( n>0)
OMP_RunTime.server->get_threads( n, &team, array );
// Master does work inside parallel region too.
OMPWork();
// Master waits for workers to finish
if( n>0 )
while( team.barrier!=unsigned(n) ) {
__TBB_Yield();
}
}
++CompletionCount;
}
}
}
void TBB_Client::process( job& ) {
TotalThreadLevel.change_level(1);
TBBWork();
TotalThreadLevel.change_level(-1);
}
void OMP_Client::process( job& /* j */, void* cookie, omp_client::size_type ) {
TotalThreadLevel.change_level(1);
ASSERT( OMP_RunTime.server, NULL );
OMPWork();
ASSERT( OMP_RunTime.server, NULL );
static_cast<OMP_Team*>(cookie)->barrier+=1;
TotalThreadLevel.change_level(-1);
}
void TBBOutSideOpenMPInside() {
TotalThreadLevel.change_level(1);
CompletionCount = 0;
int tbbtasks = 32;
AvailWork = tbbtasks;
TBB_RunTime.server->adjust_job_count_estimate(TBB_MaxThread-1);
while( CompletionCount!=tbbtasks+1 ) {
TBBWork();
}
TotalThreadLevel.change_level(-1);
}
int TestMain () {
#if CHDIR_SUPPORT_BROKEN
REPORT("Known issue: dynamic_link does not support current directory changing before its initialization.\n");
#endif
for( TBB_MaxThread=MinThread; TBB_MaxThread<=MaxThread; ++TBB_MaxThread ) {
REMARK("Testing with TBB_MaxThread=%d\n", TBB_MaxThread);
TBB_RunTime.create_connection();
OMP_RunTime.create_connection();
TBBOutSideOpenMPInside();
OMP_RunTime.destroy_connection();
TBB_RunTime.destroy_connection();
}
TotalThreadLevel.dump();
return Harness::Done;
}
#endif /* __TBB_WIN8UI_SUPPORT || __TBB_MIC_OFFLOAD */
| [
"huxingyi@msn.com"
] | huxingyi@msn.com |
83559fadef8b97701a337a6881127873ebd85348 | 2b970f99745d31eb067ba59d03c28f1d93c2625d | /Proyecto_Tesis_AdaFruit/tesis_sol_adafruit/MouseDevice/MouseDevice.cpp | c8f48d7f1157005b754b9212bf03119a30946936 | [] | no_license | solvaldes/tesis | 45d429d05207fc4d240b14cd73fc219ab4e6454e | 6a44f5fe84b4decc501f5f3b9ce3062fa8008b56 | refs/heads/master | 2021-01-23T13:29:55.079284 | 2017-11-08T23:23:23 | 2017-11-08T23:23:23 | 102,665,792 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 965 | cpp | #include "Arduino.h"
#include "MouseDevice.h"
#include <PS2Mouse.h>
MouseDevice::MouseDevice(int numero, int mouseData, int mouseClock)
{
_numero = numero;
_clockPin= mouseClock;
_dataPin= mouseData;
}
void MouseDevice::setup(){
_mouse= new PS2Mouse(_clockPin, _dataPin, STREAM);
_mouse->initialize();
_mouse->set_resolution(02);
}
int MouseDevice::procesarEstado()
{ _mouse->report(_data);
return procesarMovimiento();
}
bool MouseDevice::estaVivo(){
return _estaVivo;
}
int MouseDevice::procesarMovimiento(){
int mx= _data[1];
int my= _data[2];
int result= 0;
if (hayMovimiento(mx,my)){
if (!_estaVivo){
result= 1;
}
_estaVivo= true;
_vecesSinMov=0;
}
else{
if (_estaVivo && _vecesSinMov >= 2){
result= -1;
_estaVivo= false;
}
_vecesSinMov++;
}
return result;
}
bool MouseDevice::hayMovimiento(int mx, int my){
return my != 0 || mx != 0;
}
| [
"solvaldes15@gmail.com"
] | solvaldes15@gmail.com |
62a456ab5bd56cb80cdebfca17aae4901a337cd2 | 412a08f5d43fcd9dc5e06d2f587efa578ea40e8a | /BOJ/Math/boj15995_잉여역수_구하기.cpp | 29dae6a60ebbd515735326f2bcc73a73aa241052 | [] | no_license | onww1/Problem-Solving | 19b920f5f4caec50a3aded971e1f1e630e8b6c46 | 86cc8854ef0457f8f7741cbae401af5038f8ae05 | refs/heads/master | 2022-06-07T15:47:45.685775 | 2022-05-25T12:59:59 | 2022-05-25T12:59:59 | 130,528,244 | 6 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,667 | cpp | #pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <algorithm>
#include <functional>
#include <iostream>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#define X first
#define Y second
#ifdef NON_SUBMIT
#define TEST(n) (n)
#else
#define TEST(n) ((void)0)
#endif
#pragma warning(disable:4996)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <int, pii> piii;
typedef tuple <int, int, int> ti3;
clock_t start_time, end_time;
void open() {
TEST(freopen("input.txt", "r", stdin));
TEST(freopen("output.txt", "w", stdout));
TEST(freopen("debug.txt", "w", stderr));
TEST(start_time = clock());
}
void close() {
TEST(end_time = clock());
TEST(printf("Total time : %Lf seconds\n", (long double)(end_time - start_time) / CLOCKS_PER_SEC));
}
const int MAX = 1e5 + 1;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3fLL;
const db PI = acos(-1);
const ldb ERR = 1e-10;
const int move_r[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int move_c[] = {0, -1, 0, 1, -1, 1, -1, 1};
int main(int argc, char *argv[]) {
open();
int a, m;
scanf("%d %d", &a, &m);
for (int i = 1; i < m; ++i)
if (a * i % m == 1)
return !printf("%d\n", i);
close();
return 0;
} | [
"sewon.dev@gmail.com"
] | sewon.dev@gmail.com |
2f4eeb4f061f62963809688f0792097bc024b15e | 7bfbb049130da0ba0b54472e7bef1f6fa0abe228 | /srcs/box/bonus/ExtraLife.cpp | 9bf81444106e4c79a2d6f4168f733ac645dfe96b | [] | no_license | aismann/Bomb-Erman | ffca721d1521e745d860948328e3f70d64e9e1e6 | a1e229ccdd54d6604b27a4dc2bdf09e35c6c9ba7 | refs/heads/main | 2023-01-27T13:09:48.998187 | 2020-12-09T23:05:42 | 2020-12-09T23:05:42 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 611 | cpp | #include "ExtraLife.hh"
ExtraLife::ExtraLife(Position pos, Map &map, MeshesLoader *mesh, ImagesLoader *img) :
ABonus(BoxType::eBoxType::BONUS_EXTRA_LIFE, pos, map, mesh, img)
{
_meshi->setMaterialTexture(0, _img->Get_texture("indie_ressources/textures/coeur.png"));
}
ExtraLife::ExtraLife(const ExtraLife &other) :
ABonus(other)
{
}
ExtraLife &ExtraLife::operator=(const ExtraLife &other)
{
if (&other == this)
return (*this);
Set_type(other.Get_type());
Set_pos(other.Get_pos());
return (*this);
}
void ExtraLife::Apply(ACharacter &character) const
{
character.Set_extra_life(true);
}
| [
"ronan.boiteau@epitech.eu"
] | ronan.boiteau@epitech.eu |
cf369983828365481d6af35e30ce7c6230e8d0ac | f4a9d73016203c51c178726572d8920e88ab7dfe | /source/patchers/Patcher_.h | 838d6858e0e1cec085d52f9d05c7bbf13aa68eae | [] | no_license | sokcuri/Noginogi-Party | ebb720992fbab1464870d1075eb2401605a3c3de | dc22cae03d456e1c900a45a5704de1e76e35d4c9 | refs/heads/master | 2021-01-02T09:33:57.896638 | 2015-02-22T01:39:39 | 2015-02-22T01:39:39 | 31,148,426 | 11 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 707 | h | #pragma once
/* Name Of Mod
* Description of mod
* PATCHES: XXX.dll
*
* CTRL+H "NameOfMod"
*/
#include "../Main.h"
#include "../Singleton.h"
#include "GenericPatcher.h"
class CPatcher_NameOfMod : public IGenericPatcher {
public:
CPatcher_NameOfMod();
bool Uninstall( void );
bool Toggle( void );
bool ReadINI( void );
bool WriteINI( void );
static bool IsPatchEnabled(void);
static bool PatchToggle(void);
static bool PatchEnable(void);
static bool PatchDisable(void);
private:
// Options
static bool PatchEnabled;
// Hook functions
static void patchNameOfMod(void);
// Variables for hook functions
LPBYTE funcPointer;
};
typedef Singleton<CPatcher_NameOfMod> SngPatcher_NameOfMod; | [
"sokcuri@naver.com"
] | sokcuri@naver.com |
67878999b2bb115249ccf20213815898cd6aa1bb | aed24cec661949087e9de5596a211c3fd5f84fca | /server_src/ResourceRepository.cpp | 18ce70246138b8e3cac65bbd61b65e33c1147381 | [] | no_license | eleonoraluna/tp3-taller-pages | dc4ff22b7a6af48874c6f8cee023fdb18e709176 | 0941636d316d8d9e224a1e2f93db3095bc4e9a10 | refs/heads/main | 2023-01-21T21:05:35.860691 | 2020-11-21T04:01:12 | 2020-11-21T04:01:12 | 311,477,161 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 600 | cpp | #include "ResourceRepository.h"
#include <exception>
#include <string>
ResourceRepository::ResourceRepository() {}
const std::string ResourceRepository::get(const std::string &resource){
std::unique_lock<std::mutex> lock(this->m);
std::string body;
try{
body=this->resources.at(resource);
}catch(const std::exception &e){}
return body;
}
void ResourceRepository::post(const std::string &resource,
const std::string &body){
std::unique_lock<std::mutex> lock(this->m);
this->resources.emplace(resource,body);
}
ResourceRepository::~ResourceRepository() {}
| [
"eleluna@fi.uba.ar"
] | eleluna@fi.uba.ar |
4d0a72ebdfde9aea43e9b40e16ba933937ae0672 | 448e3b95bf831afe2d6844fcd8813540aec64f01 | /src/Parser/Token.cpp | 04c7cd09cbc1ccda52526ac1969acdd5bd01dcad | [
"MIT"
] | permissive | dinkoosmankovic/LogicToolbox | a82beaf8d86eed39de7ac2bcae0e3823d8eb743b | b56b35f99acdabd8bcdb4498e0cc00df441b2764 | refs/heads/master | 2020-05-21T21:12:56.560363 | 2020-02-02T20:19:23 | 2020-02-02T20:19:23 | 84,643,274 | 0 | 5 | MIT | 2019-10-25T13:52:14 | 2017-03-11T10:54:06 | C++ | UTF-8 | C++ | false | false | 448 | cpp | //
// Created by infloop on 7/16/17.
//
#include "../../include/Token.h"
Token::Token(const char read){
if(read == '\000' || read == '\0' || read == '\n'){
type = TokenType::EXPR_END;
value = "";
return;
}
if(token_map.find(read) != token_map.end()){
type = token_map[read].first;
value = token_map[read].second;
} else{
type = TokenType::LITERAL;
value = read;
}
} | [
"acimovic.alek@gmail.com"
] | acimovic.alek@gmail.com |
c8e0b38d472d453c3118203b8a3e6b02bb2cc28b | 7fcb2a603ae73c8e3670e803d9114e03eedf4a67 | /exam718/sqrt.cpp | 56c035e8fbc0bae72e203fc6c5203a43a65420c5 | [] | no_license | RiceyuCui/exam | c68a6ce682d2c17bb8d73215e5f10d8ad0b20930 | 15ab25aedd7652d88583880bd53c180cf51624b0 | refs/heads/master | 2020-06-23T15:47:27.062321 | 2017-08-16T10:03:27 | 2017-08-16T10:03:27 | 96,907,097 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 276 | cpp | #include<stdio.h>
#include<math.h>
#include<conio.h>
int main(void)
{
long int i, x, y;
for (i = 1; i < 100000; i++)
{
x = sqrt(i + 100);
y = sqrt(i + 268);
if ((x * x == i + 100) && (y * y == i +268))
{
printf("\n%ld\n", i);
}
}
getch();
return 0;
} | [
"646017778@qq.com"
] | 646017778@qq.com |
400e14140dec380b1f08e264b2f2a7473d08f21a | 27466e78d3cd1ed168d96fd4c2fb26add1ec7cc3 | /FDYN/NDYN_Debug/include/Physics/Physics/NEPhysicalMaterial.h | e5f3708844efdfd9a4ddcb4a0eb1ade091996679 | [] | no_license | gpudev0517/Fire-Simulator | 37e1190d638a30c186ae1532975a56b23ffaac67 | 46581c19356e47a5c6fc8a9ee6f6478b96d02968 | refs/heads/master | 2023-04-26T02:54:53.458427 | 2021-05-14T10:16:10 | 2021-05-14T15:25:28 | 277,579,935 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,614 | h | #pragma once
#include "NENode.h"
#include "Base/NENodeFactory.h"
class NEPhysicalMaterialPrivate;
/*!
Class defining a solid and its physical properties.
*/
class NEPhysicalMaterial : public NENode
{
Q_OBJECT
NE_CLASS("Physical Material")
public:
enum PhysicalPresetType
{
NoPreset = 0,
Gypsum = 1,
Concrete,
Wood
};
NE_PROP_RW(PhysicalPresetType, PhysicalPreset, "Material Preset", "Physical Property Preset", true, )
NE_PROP_RW(int, ID, "Material ID", "Material ID", true, )
NE_PROP_RW(double, RefTemperature, "Ref. Temperature", "Temperature at which the physical properties of the solid are defined", true, )
NE_PROP_RW(double, Density, "Density", "Density of the solid", true, )
NE_PROP_RW(double, Thickness, "Thickness", "Material Thickness", true, )
NE_PROP_RW(double, SpecificHeat, "Specific Heat Capacity", "Mass heat capacity", true, )
NE_PROP_RW(double, ThermalConductivity, "Thermal Conductivity", "Thermal conductivity", true, )
NE_PROP_RW(double, Emissivity, "Emissivity", "Emission Control", true, )
Q_ENUMS(PhysicalPresetType)
public:
NEPhysicalMaterial(NENodeFactory* factory);
~NEPhysicalMaterial();
//! NENode overriden functions
uint init(uint initMode = NE::kInitOnCreate) override;
void resetProperties() override;
signals:
private:
NE_DECL_PRIVATE(NEPhysicalMaterial)
};
class NEPhysicalMaterialFactory : public NENodeFactory
{
public:
NEPhysicalMaterialFactory(NEManager* m);
virtual ~NEPhysicalMaterialFactory();
NE_DERIVED(NENodeFactory, Public)
};
| [
"59606840+gpudev0517@users.noreply.github.com"
] | 59606840+gpudev0517@users.noreply.github.com |
630ae165bc0e5c45406442bb88ac4b8b7a5756b3 | e0d906c1e84c1f83a3da27db086aab7b7b4212af | /Server/Server/Gamepad.h | 6406f0ec5af64f404299108105bf787d3cdd38a8 | [] | no_license | StarikTenger/SpaceSodomyOnline | 8904034c5ec400e17404f6e41bafb9da5fe7d2ff | cdbe6975d293bd214f8a591cbe5dfba4ea415a5d | refs/heads/master | 2023-02-09T04:53:11.604384 | 2020-12-30T19:02:45 | 2020-12-30T19:02:45 | 237,202,605 | 3 | 5 | null | 2020-12-30T18:55:32 | 2020-01-30T11:51:53 | C++ | UTF-8 | C++ | false | false | 335 | h | #pragma once
#include <SFML/Graphics.hpp>
#include "geometry.h"
class Gamepad {
public:
int button1 = 0;
int button2 = 0;
int button3 = 0;
int button4 = 0;
int leftUp = 0;
int leftDown = 0;
int rightUp = 0;
int rightDown = 0;
int button9 = 0;
int button10 = 0;
Vec2 pos;
Gamepad();
~Gamepad();
int& get(int button);
};
| [
"stariktenger@gmail.com"
] | stariktenger@gmail.com |
23f3a41da6c4393354df5a9fe33f82bbc5b18833 | 7f62f204ffde7fed9c1cb69e2bd44de9203f14c8 | /DboServer/Server/GameServer/BotAiAction_SPSEnd.h | 1f02054eb04cc69116cafa406cf3da9cc4d4b7be | [] | no_license | 4l3dx/DBOGLOBAL | 9853c49f19882d3de10b5ca849ba53b44ab81a0c | c5828b24e99c649ae6a2953471ae57a653395ca2 | refs/heads/master | 2022-05-28T08:57:10.293378 | 2020-05-01T00:41:08 | 2020-05-01T00:41:08 | 259,094,679 | 3 | 3 | null | 2020-04-29T17:06:22 | 2020-04-26T17:43:08 | null | UTF-8 | C++ | false | false | 363 | h | #ifndef __AI_DBOG_BOTACTION_SPSEND_H__
#define __AI_DBOG_BOTACTION_SPSEND_H__
#include "BotAiAction.h"
class CBotAiAction_SPSEnd : public CBotAiAction
{
public:
CBotAiAction_SPSEnd(CNpc* pBot);
virtual ~CBotAiAction_SPSEnd();
public:
virtual void OnEnter();
virtual void OnExit();
virtual int OnUpdate(DWORD dwTickDiff, float fMultiple);
};
#endif | [
"64261665+dboguser@users.noreply.github.com"
] | 64261665+dboguser@users.noreply.github.com |
13fa3e9068be74396915723ee0b421ecd4139ac6 | 06123737a66d437ed0664bfcf15b85e6d50e7da1 | /libraries/chain/include/steem/chain/util/smt_token.hpp | af0188959e844a2a07d5e8b79e68e93857df4755 | [
"MIT"
] | permissive | reactivespace/Steemit-Fork-2.0 | 03959d019c818dbb719dadcab586c884e8c8b723 | 1bf860963f5715309bda6f77e362e09e9d3ccf8a | refs/heads/main | 2023-03-02T15:56:20.192616 | 2021-02-17T12:54:06 | 2021-02-17T12:54:06 | 339,644,647 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,772 | hpp | #pragma once
#include <fc/optional.hpp>
#include <clout/chain/database.hpp>
#include <clout/chain/smt_objects.hpp>
#include <clout/protocol/asset_symbol.hpp>
namespace clout { namespace chain { namespace util { namespace smt {
const smt_token_object* find_token( const database& db, uint32_t nai );
const smt_token_object* find_token( const database& db, asset_symbol_type symbol, bool precision_agnostic = false );
const smt_token_emissions_object* last_emission( const database& db, const asset_symbol_type& symbol );
fc::optional< time_point_sec > last_emission_time( const database& db, const asset_symbol_type& symbol );
fc::optional< time_point_sec > next_emission_time( const database& db, const asset_symbol_type& symbol, time_point_sec time = time_point_sec() );
const smt_token_emissions_object* get_emission_object( const database& db, const asset_symbol_type& symbol, time_point_sec t );
flat_map< unit_target_type, share_type > generate_emissions( const smt_token_object& token, const smt_token_emissions_object& emission, time_point_sec t );
namespace ico {
bool schedule_next_refund( database& db, const asset_symbol_type& a );
bool schedule_next_contributor_payout( database& db, const asset_symbol_type& a );
bool schedule_founder_payout( database& db, const asset_symbol_type& a );
share_type payout( database& db, const asset_symbol_type& symbol, const account_object& account, const std::vector< contribution_payout >& payouts );
fc::optional< share_type > get_ico_clout_hard_cap( database& db, const asset_symbol_type& a );
std::size_t ico_tier_size( database& db, const asset_symbol_type& symbol );
void remove_ico_objects( database& db, const asset_symbol_type& symbol );
} // clout::chain::util::smt::ico
} } } } // clout::chain::util::smt
| [
"danish.rabbani90@gmail.com"
] | danish.rabbani90@gmail.com |
15584488d262b067e7aaed4e9a279d7739fe9513 | 5d7807e52888b9505c4b5a0e24f5f87e4f6c343f | /cryengine/CryGame/Projectile.cpp | 558f78fdf52f63be3e05e2766e557325f0317a14 | [] | no_license | CapsAdmin/oohh | 01533c72450c5ac036a245ffbaba09b6fda00e69 | b63abeb717e1cd1ee2d3483bd5f0954c81bfc6e9 | refs/heads/master | 2021-01-25T10:44:22.976777 | 2016-10-11T19:05:47 | 2016-10-11T19:05:47 | 32,117,923 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 40,003 | cpp | /*************************************************************************
Crytek Source File.
Copyright (C), Crytek Studios, 2001-2004.
-------------------------------------------------------------------------
$Id$
$DateTime$
-------------------------------------------------------------------------
History:
- 18:10:2005 14:14 : Created by Marcio Martins
*************************************************************************/
#include "StdAfx.h"
#include "Game.h"
#include "GameCVars.h"
#include "Projectile.h"
#include "Bullet.h"
#include "WeaponSystem.h"
#include "ISerialize.h"
#include "IGameObject.h"
#include <IEntitySystem.h>
#include <ISound.h>
#include <IItemSystem.h>
#include <IAgent.h>
#include "ItemParamReader.h"
#include "GameRules.h"
#include "Environment/BattleDust.h"
#include <IVehicleSystem.h>
#include "IAIActor.h"
//------------------------------------------------------------------------
CProjectile::CProjectile()
: m_whizSoundId(INVALID_SOUNDID),
m_trailSoundId(INVALID_SOUNDID),
m_trailEffectId(-1),
m_trailUnderWaterId(-1),
m_pPhysicalEntity(0),
m_pAmmoParams(0),
m_destroying(false),
m_remote(false),
m_totalLifetime(0.0f),
m_scaledEffectval(0.0f),
m_obstructObject(0),
m_damageDropPerMeter(0.0f),
m_damageDropMinDisSqr(0.0f),
m_firstDropApplied(false),
m_hitTypeId(0),
m_scaledEffectSignaled(false),
m_hitListener(false),
m_hitPoints(-1),
m_noBulletHits(false),
m_initial_pos(ZERO),
m_initial_dir(ZERO),
m_initial_vel(ZERO),
m_bShouldHaveExploded(false)
{
}
//------------------------------------------------------------------------
CProjectile::~CProjectile()
{
if (g_pGame)
g_pGame->GetWeaponSystem()->RemoveProjectile(this);
}
//------------------------------------------------------------------------
bool CProjectile::SetAspectProfile( EEntityAspects aspect, uint8 profile )
{
//if (m_pAmmoParams->physicalizationType == ePT_None)
//return true;
if (aspect == eEA_Physics)
{
Vec3 spin(m_pAmmoParams->spin);
Vec3 spinRandom(BiRandom(m_pAmmoParams->spinRandom.x), BiRandom(m_pAmmoParams->spinRandom.y), BiRandom(m_pAmmoParams->spinRandom.z));
spin += spinRandom;
spin = DEG2RAD(spin);
switch (profile)
{
case ePT_Particle:
{
if (m_pAmmoParams->pParticleParams)
{
m_pAmmoParams->pParticleParams->wspin = spin;
if (!m_initial_dir.IsZero() && !gEnv->bServer)
m_pAmmoParams->pParticleParams->heading=m_initial_dir;
}
SEntityPhysicalizeParams params;
params.type = PE_PARTICLE;
params.mass = m_pAmmoParams->mass;
if (m_pAmmoParams->pParticleParams)
params.pParticle = m_pAmmoParams->pParticleParams;
GetEntity()->Physicalize(params);
}
break;
case ePT_Rigid:
{
SEntityPhysicalizeParams params;
params.type = PE_RIGID;
params.mass = m_pAmmoParams->mass;
params.nSlot = 0;
GetEntity()->Physicalize(params);
pe_action_set_velocity velocity;
m_pPhysicalEntity = GetEntity()->GetPhysics();
velocity.w = spin;
m_pPhysicalEntity->Action(&velocity);
if (m_pAmmoParams->pSurfaceType)
{
int sfid = m_pAmmoParams->pSurfaceType->GetId();
pe_params_part part;
part.ipart = 0;
GetEntity()->GetPhysics()->GetParams(&part);
if (!is_unused(part.pMatMapping))
{
for (int i=0; i<part.nMats; i++)
part.pMatMapping[i] = sfid;
}
}
}
break;
case ePT_Static:
{
SEntityPhysicalizeParams params;
params.type = PE_STATIC;
params.nSlot = 0;
GetEntity()->Physicalize(params);
if (m_pAmmoParams->pSurfaceType)
{
int sfid = m_pAmmoParams->pSurfaceType->GetId();
pe_params_part part;
part.ipart = 0;
if (GetEntity()->GetPhysics()->GetParams(&part))
if (!is_unused(part.pMatMapping))
for (int i=0; i<part.nMats; i++)
part.pMatMapping[i] = sfid;
}
}
break;
case ePT_None:
{
SEntityPhysicalizeParams params;
params.type = PE_NONE;
params.nSlot = 0;
GetEntity()->Physicalize(params);
}
break;
}
m_pPhysicalEntity = GetEntity()->GetPhysics();
if (m_pPhysicalEntity)
{
pe_simulation_params simulation;
simulation.maxLoggedCollisions = m_pAmmoParams->maxLoggedCollisions;
pe_params_flags flags;
flags.flagsOR = pef_log_collisions|(m_pAmmoParams->traceable?pef_traceable:0);
pe_params_part colltype;
colltype.flagsAND=~geom_colltype_explosion;
m_pPhysicalEntity->SetParams(&simulation);
m_pPhysicalEntity->SetParams(&flags);
m_pPhysicalEntity->SetParams(&colltype);
}
}
return true;
}
//------------------------------------------------------------------------
bool CProjectile::NetSerialize(TSerialize ser, EEntityAspects aspect, uint8 profile, int pflags)
{
if (aspect == eEA_Physics)
{
pe_type type = PE_NONE;
switch (profile)
{
case ePT_Rigid:
type = PE_RIGID;
break;
case ePT_Particle:
type = PE_PARTICLE;
break;
case ePT_None:
return true;
case ePT_Static:
{
Vec3 pos = GetEntity()->GetWorldPos();
Quat ori = GetEntity()->GetWorldRotation();
ser.Value("pos", pos, 'wrld');
ser.Value("ori", ori, 'ori1');
if (ser.IsReading())
GetEntity()->SetWorldTM( Matrix34::Create( Vec3(1,1,1), ori, pos ) );
}
return true;
default:
return false;
}
IEntityPhysicalProxy * pEPP = (IEntityPhysicalProxy *) GetEntity()->GetProxy(ENTITY_PROXY_PHYSICS);
if (ser.IsWriting())
{
if (!pEPP || !pEPP->GetPhysicalEntity() || pEPP->GetPhysicalEntity()->GetType() != type)
{
gEnv->pPhysicalWorld->SerializeGarbageTypedSnapshot( ser, type, 0 );
return true;
}
}
else if (!pEPP)
{
return false;
}
pEPP->SerializeTyped( ser, type, pflags );
}
return true;
}
//------------------------------------------------------------------------
bool CProjectile::Init(IGameObject *pGameObject)
{
SetGameObject(pGameObject);
g_pGame->GetWeaponSystem()->AddProjectile(GetEntity(), this);
if (!GetGameObject()->CaptureProfileManager(this))
return false;
m_pAmmoParams = g_pGame->GetWeaponSystem()->GetAmmoParams(GetEntity()->GetClass());
if (0 == (GetEntity()->GetFlags() & (ENTITY_FLAG_CLIENT_ONLY | ENTITY_FLAG_SERVER_ONLY)))
if (!m_pAmmoParams->predictSpawn)
if (!GetGameObject()->BindToNetwork())
return false;
LoadGeometry();
Physicalize();
IEntityRenderProxy *pProxy = static_cast<IEntityRenderProxy *>(GetEntity()->GetProxy(ENTITY_PROXY_RENDER));
if (pProxy && pProxy->GetRenderNode())
{
pProxy->GetRenderNode()->SetViewDistRatio(255);
pProxy->GetRenderNode()->SetLodRatio(255);
}
float lifetime = m_pAmmoParams->lifetime;
if (lifetime > 0.0f)
GetEntity()->SetTimer(ePTIMER_LIFETIME, (int)(lifetime*1000.0f));
float showtime = m_pAmmoParams->showtime;
if (showtime > 0.0f)
{
GetEntity()->SetSlotFlags(0, GetEntity()->GetSlotFlags(0)&(~ENTITY_SLOT_RENDER));
GetEntity()->SetTimer(ePTIMER_SHOWTIME, (int)(showtime*1000.0f));
}
else
GetEntity()->SetSlotFlags(0, GetEntity()->GetSlotFlags(0)|ENTITY_SLOT_RENDER);
return true;
}
//---------------------------------------------------------------------
////If the projectile is in a pool, this function will be called when this projectile is about to be "re-spawn"
void CProjectile::ReInitFromPool()
{
assert(m_pAmmoParams);
float lifetime = m_pAmmoParams->lifetime;
if (lifetime > 0.0f)
GetEntity()->SetTimer(ePTIMER_LIFETIME, (int)(lifetime*1000.0f));
float showtime = m_pAmmoParams->showtime;
if (showtime > 0.0f)
{
GetEntity()->SetSlotFlags(0, GetEntity()->GetSlotFlags(0)&(~ENTITY_SLOT_RENDER));
GetEntity()->SetTimer(ePTIMER_SHOWTIME, (int)(showtime*1000.0f));
}
else
GetEntity()->SetSlotFlags(0, GetEntity()->GetSlotFlags(0)|ENTITY_SLOT_RENDER);
//Reset some members
m_remote=false;
m_totalLifetime=0.0f;
m_scaledEffectval=0.0f;
m_obstructObject=0;
m_scaledEffectSignaled=false;
m_hitListener=false;
m_hitPoints=-1;
m_noBulletHits=false;
m_bShouldHaveExploded = false;
}
//------------------------------------------------------------------------
void CProjectile::PostInit(IGameObject *pGameObject)
{
GetGameObject()->EnableUpdateSlot(this, 0);
}
//------------------------------------------------------------------------
void CProjectile::Release()
{
delete this;
}
//------------------------------------------------------------------------
void CProjectile::FullSerialize(TSerialize ser)
{
assert(ser.GetSerializationTarget() != eST_Network);
ser.Value("Remote", m_remote);
// m_tracerpath should be serialized but the template-template stuff doesn't work under VS2005
ser.Value("Owner", m_ownerId, 'eid');
ser.Value("Weapon", m_weaponId, 'eid');
ser.Value("TrailEffect", m_trailEffectId);
ser.Value("TrailSound", m_trailSoundId);
ser.Value("WhizSound", m_whizSoundId);
ser.Value("Damage", m_damage);
ser.Value("Destroying", m_destroying);
ser.Value("LastPos", m_last);
ser.Value("InitialPos", m_initial_pos);
ser.Value("DamageDrop", m_damageDropPerMeter);
ser.Value("DamageDropMinR", m_damageDropMinDisSqr);
ser.Value("FirstDropApplied", m_firstDropApplied);
ser.Value("ScaledEffectSignaled", m_scaledEffectSignaled);
ser.Value("HitListener", m_hitListener);
ser.Value("HitPoints", m_hitPoints);
bool wasVisible = false;
if(ser.IsWriting())
wasVisible = (GetEntity()->GetSlotFlags(0)&(ENTITY_SLOT_RENDER))?true:false;
ser.Value("Visibility", wasVisible);
if(ser.IsReading())
{
if(wasVisible)
GetEntity()->SetSlotFlags(0, GetEntity()->GetSlotFlags(0)|ENTITY_SLOT_RENDER);
else
GetEntity()->SetSlotFlags(0, GetEntity()->GetSlotFlags(0)&(~ENTITY_SLOT_RENDER));
InitWithAI();
}
}
//------------------------------------------------------------------------
void CProjectile::Update(SEntityUpdateContext &ctx, int updateSlot)
{
FUNCTION_PROFILER(GetISystem(), PROFILE_GAME);
if (updateSlot!=0)
return;
float color[4] = {1,1,1,1};
bool bDebug = g_pGameCVars->i_debug_projectiles > 0;
if(bDebug)
gEnv->pRenderer->Draw2dLabel(50,15,2.0f,color,false,"Projectile: %s",GetEntity()->GetClass()->GetName());
Vec3 pos = GetEntity()->GetWorldPos();
ScaledEffect(m_pAmmoParams->pScaledEffect);
// update whiz
if(m_pAmmoParams->pWhiz)
{
if (m_whizSoundId == INVALID_SOUNDID)
{
IActor *pActor = g_pGame->GetIGameFramework()->GetClientActor();
if (pActor && (m_ownerId != pActor->GetEntityId()))
{
float probability = 0.85f;
if (Random()<=probability)
{
Lineseg line(m_last, pos);
Vec3 player = pActor->GetEntity()->GetWorldPos();
float t;
float distanceSq=Distance::Point_LinesegSq(player, line, t);
if (distanceSq < 4.7f*4.7f && (t>=0.0f && t<=1.0f))
{
if (distanceSq >= 0.65*0.65)
{
Sphere s;
s.center = player;
s.radius = 4.7f;
Vec3 entry,exit;
int intersect=Intersect::Lineseg_Sphere(line, s, entry,exit);
if (intersect==0x1 || intersect==0x3) // one entry or one entry and one exit
WhizSound(true, entry, (pos-m_last).GetNormalized());
}
}
}
}
}
}
if (m_trailSoundId==INVALID_SOUNDID)
TrailSound(true);
m_totalLifetime += ctx.fFrameTime;
m_last = pos;
}
//------------------------------------------------------------------------
void CProjectile::HandleEvent(const SGameObjectEvent &event)
{
if (m_destroying)
return;
FUNCTION_PROFILER(GetISystem(), PROFILE_GAME);
if (event.event == eGFE_OnCollision)
{
EventPhysCollision *pCollision = (EventPhysCollision *)event.ptr;
if(pCollision == NULL)
return;
const SCollisionParams* pCollisionParams = m_pAmmoParams->pCollision;
if (pCollisionParams)
{
if (pCollisionParams->pParticleEffect)
pCollisionParams->pParticleEffect->Spawn(true, IParticleEffect::ParticleLoc(pCollision->pt, pCollision->n, pCollisionParams->scale));
if (pCollisionParams->sound)
{
_smart_ptr<ISound> pSound = gEnv->pSoundSystem->CreateSound(pCollisionParams->sound, FLAG_SOUND_DEFAULT_3D);
if(pSound)
{
pSound->SetSemantic(eSoundSemantic_Projectile);
pSound->SetPosition(pCollision->pt);
pSound->Play();
}
}
}
// add battledust for bulletimpact
if(gEnv->bServer && g_pGame->GetGameRules())
{
if(CBattleDust* pBD = g_pGame->GetGameRules()->GetBattleDust())
{
pBD->RecordEvent(eBDET_ShotImpact, pCollision->pt, GetEntity()->GetClass());
}
}
Ricochet(pCollision);
//Update damage
if((m_damageDropPerMeter>0.0001f)&&
(((pCollision->pt-m_initial_pos).len2()>m_damageDropMinDisSqr)||m_firstDropApplied))
{
if(!m_firstDropApplied)
{
m_firstDropApplied = true;
m_initial_pos = m_initial_pos + (m_initial_dir*(sqrt_fast_tpl(m_damageDropMinDisSqr)));
}
Vec3 vDiff = pCollision->pt - m_initial_pos;
float dis = vDiff.len();
m_damage -= (int)(floor_tpl(m_damageDropPerMeter * dis));
//Check m_damage is positive
if(m_damage<MIN_DAMAGE)
m_damage=MIN_DAMAGE;
//Also modify initial position (the projectile could not be destroyed, cause of pirceability)
m_initial_pos = pCollision->pt;
}
// Notify AI system about grenades.
if (gEnv->pAISystem)
{
IAIObject* pAI = 0;
if ((pAI = GetEntity()->GetAI()) != NULL && pAI->GetAIType() == AIOBJECT_GRENADE)
{
// Associate event with vehicle if the shooter is in a vehicle (tank cannon shot, etc)
EntityId ownerId = m_ownerId;
IActor* pActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(ownerId);
if (pActor && pActor->GetLinkedVehicle() && pActor->GetLinkedVehicle()->GetEntityId())
ownerId = pActor->GetLinkedVehicle()->GetEntityId();
SAIStimulus stim(AISTIM_GRENADE, AIGRENADE_COLLISION, ownerId, GetEntityId(),
GetEntity()->GetWorldPos(), ZERO, 12.0f);
gEnv->pAISystem->RegisterStimulus(stim);
}
}
}
}
//------------------------------------------------------------------------
void CProjectile::ProcessEvent(SEntityEvent &event)
{
switch(event.event)
{
case ENTITY_EVENT_TIMER:
{
switch(event.nParam[0])
{
case ePTIMER_SHOWTIME:
GetEntity()->SetSlotFlags(0, GetEntity()->GetSlotFlags(0)|ENTITY_SLOT_RENDER);
break;
case ePTIMER_LIFETIME:
if(m_pAmmoParams->quietRemoval) // claymores don't explode when they timeout
Destroy();
else
Explode(true);
break;
}
}
break;
}
}
//------------------------------------------------------------------------
void CProjectile::SetAuthority(bool auth)
{
}
//------------------------------------------------------------------------
void CProjectile::LoadGeometry()
{
if (m_pAmmoParams && !m_pAmmoParams->fpGeometryName.empty())
{
//m_pAmmoParams->CacheGeometry(); //Ammo geometry is cached on load (the weapon that uses this ammo will take care)
GetEntity()->LoadGeometry(0,m_pAmmoParams->fpGeometryName.c_str());
GetEntity()->SetSlotLocalTM(0, m_pAmmoParams->fpLocalTM);
}
}
//------------------------------------------------------------------------
void CProjectile::Physicalize()
{
if (!m_pAmmoParams || m_pAmmoParams->physicalizationType == ePT_None)
return;
GetGameObject()->SetAspectProfile(eEA_Physics, m_pAmmoParams->physicalizationType);
}
//------------------------------------------------------------------------
void CProjectile::SetVelocity(const Vec3 &pos, const Vec3 &dir, const Vec3 &velocity, float speedScale)
{
if (!m_pPhysicalEntity)
return;
Vec3 totalVelocity = (dir * m_pAmmoParams->speed * speedScale) + velocity;
if (m_pPhysicalEntity->GetType()==PE_PARTICLE)
{
pe_params_particle particle;
particle.heading = totalVelocity.GetNormalized();
particle.velocity = totalVelocity.GetLength();
m_pPhysicalEntity->SetParams(&particle);
}
else if (m_pPhysicalEntity->GetType()==PE_RIGID)
{
pe_action_set_velocity vel;
vel.v = totalVelocity;
m_pPhysicalEntity->Action(&vel);
}
}
//------------------------------------------------------------------------
void CProjectile::SetParams(EntityId ownerId, EntityId hostId, EntityId weaponId, int damage, int hitTypeId, float damageDrop /*= 0.0f*/, float damageDropMinR /*=0.0f*/)
{
m_ownerId = ownerId;
m_weaponId = weaponId;
m_hostId = hostId;
m_damage = damage;
m_hitTypeId = hitTypeId;
m_damageDropPerMeter = damageDrop;
m_damageDropMinDisSqr = damageDropMinR*damageDropMinR;
if (m_hostId || m_ownerId)
{
IEntity* pSelfEntity = GetEntity();
if (pSelfEntity)
pSelfEntity->AddEntityLink("Shooter", m_ownerId);
IEntity *pEntity = gEnv->pEntitySystem->GetEntity(m_hostId?m_hostId:m_ownerId);
if (pEntity)
{
if (pSelfEntity)
{
//need to set AI species to the shooter - not to be scared of it's own rockets
IAIObject* projectileAI = pSelfEntity->GetAI();
IAIObject* shooterAI = pEntity->GetAI();
if (projectileAI && shooterAI)
projectileAI->SetFactionID(shooterAI->GetFactionID());
}
if (m_pPhysicalEntity && m_pPhysicalEntity->GetType()==PE_PARTICLE)
{
pe_params_particle pparams;
pparams.pColliderToIgnore = pEntity->GetPhysics();
m_pPhysicalEntity->SetParams(&pparams);
}
}
}
}
//------------------------------------------------------------------------
void CProjectile::Launch(const Vec3 &pos, const Vec3 &dir, const Vec3 &velocity, float speedScale)
{
m_destroying = false;
GetGameObject()->EnablePhysicsEvent(true, eEPE_OnCollisionLogged);
// Only for bullets
m_hitPoints = m_pAmmoParams->hitPoints;
m_hitListener = false;
if(m_hitPoints>0)
{
//Only projectiles with hit points are hit listeners
g_pGame->GetGameRules()->AddHitListener(this);
m_hitListener = true;
m_noBulletHits = m_pAmmoParams->noBulletHits;
}
Matrix34 worldTM=Matrix34(Matrix33::CreateRotationVDir(dir.GetNormalizedSafe()));
worldTM.SetTranslation(pos);
GetEntity()->SetWorldTM(worldTM);
//Must set velocity after position, if not velocity could be reseted for PE_RIGID
SetVelocity(pos, dir, velocity, speedScale);
m_initial_pos = pos;
m_initial_dir = dir;
m_initial_vel = velocity;
m_last = pos;
// Attach effect when fired (not first update)
if (m_trailEffectId<0)
TrailEffect(true);
IAIObject* pAI = 0;
if ((pAI = GetEntity()->GetAI()) != NULL && pAI->GetAIType() == AIOBJECT_GRENADE)
{
IEntity *pOwnerEntity = gEnv->pEntitySystem->GetEntity(m_ownerId);
pe_status_dynamics dyn;
pe_status_dynamics dynProj;
if (pOwnerEntity->GetPhysics()
&& pOwnerEntity->GetPhysics()->GetStatus(&dyn)
&& GetEntity()->GetPhysics()->GetStatus(&dynProj))
{
// Vec3 ownerVel(dyn.v);
Vec3 grenadeDir(dynProj.v.GetNormalizedSafe());
// Trigger the signal at the predicted landing position.
Vec3 predictedPos = pos;
float dummySpeed;
if (GetWeapon())
GetWeapon()->PredictProjectileHit(pOwnerEntity->GetPhysics(), pos, dir, velocity, speedScale * m_pAmmoParams->speed, predictedPos, dummySpeed);
// Associate event with vehicle if the shooter is in a vehicle (tank cannon shot, etc)
EntityId ownerId = pOwnerEntity->GetId();
IActor* pActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(ownerId);
if (pActor && pActor->GetLinkedVehicle() && pActor->GetLinkedVehicle()->GetEntityId())
ownerId = pActor->GetLinkedVehicle()->GetEntityId();
SAIStimulus stim(AISTIM_GRENADE, AIGRENADE_THROWN, ownerId, GetEntityId(),
predictedPos, ZERO, 20.0f);
gEnv->pAISystem->RegisterStimulus(stim);
}
}
}
//------------------------------------------------------------------------
void CProjectile::Destroy()
{
if (m_destroying)
return;
m_destroying=true;
EndScaledEffect(m_pAmmoParams->pScaledEffect);
GetGameObject()->ReleaseProfileManager(this);
GetGameObject()->EnablePhysicsEvent(false, eEPE_OnCollisionLogged);
if (m_obstructObject)
gEnv->pPhysicalWorld->DestroyPhysicalEntity(m_obstructObject);
if(m_hitListener)
if (CGameRules * pGameRules = g_pGame->GetGameRules())
pGameRules->RemoveHitListener(this);
WhizSound(false, ZERO, ZERO);
bool returnToPoolOK = true;
if (m_pAmmoParams->reusable)
{
returnToPoolOK = g_pGame->GetWeaponSystem()->ReturnToPool(this);
}
if (!m_pAmmoParams->reusable || !returnToPoolOK)
{
if ((GetEntity()->GetFlags()&ENTITY_FLAG_CLIENT_ONLY) || gEnv->bServer)
gEnv->pEntitySystem->RemoveEntity(GetEntity()->GetId());
}
}
//------------------------------------------------------------------------
bool CProjectile::IsRemote() const
{
return m_remote;
}
//------------------------------------------------------------------------
void CProjectile::SetRemote(bool remote)
{
m_remote = remote;
}
//------------------------------------------------------------------------
void CProjectile::Explode(bool destroy, bool impact, const Vec3 &pos, const Vec3 &normal, const Vec3 &vel, EntityId targetId)
{
const SExplosionParams* pExplosionParams = m_pAmmoParams->pExplosion;
if (pExplosionParams)
{
Vec3 dir(0,0,1);
if (impact && vel.len2()>0)
dir = vel.normalized();
else if (normal.len2()>0)
dir = -normal;
m_hitPoints = 0;
// marcok: using collision pos sometimes causes explosions to have no effect. Anton advised to use entity pos
Vec3 epos = pos.len2()>0 ? (pos - dir * 0.2f) : GetEntity()->GetWorldPos();
CGameRules *pGameRules = g_pGame->GetGameRules();
float minRadius = pExplosionParams->minRadius;
float maxRadius = pExplosionParams->maxRadius;
if (m_pAmmoParams->pFlashbang)
{
minRadius = m_pAmmoParams->pFlashbang->maxRadius;
maxRadius = m_pAmmoParams->pFlashbang->maxRadius;
}
ExplosionInfo explosionInfo(m_ownerId, GetEntityId(), 0, (float)m_damage, epos, dir, minRadius, maxRadius, pExplosionParams->minPhysRadius, pExplosionParams->maxPhysRadius, 0.0f, pExplosionParams->pressure, pExplosionParams->holeSize, pGameRules->GetHitTypeId(pExplosionParams->type.c_str()));
if(m_pAmmoParams->pFlashbang)
explosionInfo.SetEffect(pExplosionParams->effectName, pExplosionParams->effectScale, pExplosionParams->maxblurdist, m_pAmmoParams->pFlashbang->blindAmount, m_pAmmoParams->pFlashbang->flashbangBaseTime);
else
explosionInfo.SetEffect(pExplosionParams->effectName, pExplosionParams->effectScale, pExplosionParams->maxblurdist);
explosionInfo.SetEffectClass(m_pAmmoParams->pEntityClass->GetName());
if (impact)
explosionInfo.SetImpact(normal, vel, targetId);
if (gEnv->bServer)
{
pGameRules->ServerExplosion(explosionInfo);
// add battle dust as well
CBattleDust* pBD = pGameRules->GetBattleDust();
if(pBD)
pBD->RecordEvent(eBDET_Explosion, pos, GetEntity()->GetClass());
}
}
if(!gEnv->bMultiplayer)
{
//Single player (AI related code)is processed here, CGameRules::ClientExplosion process the effect
if (m_pAmmoParams->pFlashbang)
FlashbangEffect(m_pAmmoParams->pFlashbang);
}
if (destroy)
Destroy();
m_bShouldHaveExploded = true;
}
//------------------------------------------------------------------------
void CProjectile::TrailSound(bool enable, const Vec3 &dir)
{
if (enable)
{
if (!m_pAmmoParams->pTrail || !m_pAmmoParams->pTrail->sound)
return;
m_trailSoundId = GetSoundProxy()->PlaySound(m_pAmmoParams->pTrail->sound, Vec3(0,0,0), FORWARD_DIRECTION, FLAG_SOUND_DEFAULT_3D, 0, eSoundSemantic_Projectile, 0, 0);
if (m_trailSoundId != INVALID_SOUNDID)
{
ISound *pSound=GetSoundProxy()->GetSound(m_trailSoundId);
if (pSound)
pSound->GetInterfaceDeprecated()->SetLoopMode(true);
}
}
else if (m_trailSoundId!=INVALID_SOUNDID)
{
GetSoundProxy()->StopSound(m_trailSoundId);
m_trailSoundId=INVALID_SOUNDID;
}
}
//------------------------------------------------------------------------
void CProjectile::WhizSound(bool enable, const Vec3 &pos, const Vec3 &dir)
{
if (enable)
{
if (!m_pAmmoParams->pWhiz)
return;
ISound *pSound=gEnv->pSoundSystem->CreateSound(m_pAmmoParams->pWhiz->sound, FLAG_SOUND_DEFAULT_3D|FLAG_SOUND_SELFMOVING);
if (pSound)
{
m_whizSoundId = pSound->GetId();
pSound->SetSemantic(eSoundSemantic_Projectile);
pSound->SetPosition(pos);
pSound->SetDirection(dir*m_pAmmoParams->pWhiz->speed);
pSound->Play();
}
}
else if (m_whizSoundId!=INVALID_SOUNDID)
{
ISound *pSound = gEnv->pSoundSystem->GetSound(m_whizSoundId);
// only stop looping sounds and oneshots does not get cut when hitting a surface
if (pSound && pSound->GetFlags() & FLAG_SOUND_LOOP)
pSound->Stop();
m_whizSoundId=INVALID_SOUNDID;
}
}
//------------------------------------------------------------------------
void CProjectile::RicochetSound(const Vec3 &pos, const Vec3 &dir)
{
if (!m_pAmmoParams->pRicochet)
return;
ISound *pSound = gEnv->pSoundSystem->CreateSound(m_pAmmoParams->pRicochet->sound, FLAG_SOUND_DEFAULT_3D|FLAG_SOUND_SELFMOVING);
if (pSound)
{
pSound->GetId();
pSound->SetSemantic(eSoundSemantic_Projectile);
pSound->SetPosition(pos);
pSound->SetDirection(dir*m_pAmmoParams->pRicochet->speed);
pSound->Play();
}
}
//------------------------------------------------------------------------
void CProjectile::TrailEffect(bool enable, bool underWater /*=false*/)
{
if (enable)
{
const STrailParams* pTrail = NULL;
if(!underWater)
pTrail = m_pAmmoParams->pTrail;
else
pTrail = m_pAmmoParams->pTrailUnderWater;
if (!pTrail)
return;
bool fpOwner = false;
if(CWeapon *pWep = GetWeapon())
if(pWep->GetStats().fp)
fpOwner = true;
if(fpOwner && pTrail->effect_fp)
{
m_trailEffectId = AttachEffect(true, 0, pTrail->effect_fp, Vec3(0,0,0), Vec3(0,1,0), pTrail->scale, pTrail->prime);
}
else if (pTrail->effect)
{
if(!underWater)
m_trailEffectId = AttachEffect(true, 0, pTrail->effect, Vec3(0,0,0), Vec3(0,1,0), pTrail->scale, pTrail->prime);
else
m_trailUnderWaterId = AttachEffect(true, 0, pTrail->effect, Vec3(0,0,0), Vec3(0,1,0), pTrail->scale, pTrail->prime);
}
}
else if (m_trailEffectId>=0 && !underWater)
{
AttachEffect(false, m_trailEffectId);
m_trailEffectId=-1;
}
else if(m_trailUnderWaterId>=0 && underWater)
{
AttachEffect(false, m_trailUnderWaterId);
m_trailUnderWaterId=-1;
}
}
//------------------------------------------------------------------------
int CProjectile::AttachEffect(bool attach, int id, const char *name, const Vec3 &offset, const Vec3 &dir, float scale, bool bParticlePrime)
{
// m_trailEffectId is -1 for invalid, otherwise it's the slot number where the particle effect was loaded
if (!attach)
{
if (id>=0)
GetEntity()->FreeSlot(id);
}
else
{
IParticleEffect *pParticleEffect = gEnv->pParticleManager->FindEffect(name);
if (!pParticleEffect)
return -1;
// find a free slot
SEntitySlotInfo dummy;
int i=0;
while (GetEntity()->GetSlotInfo(i, dummy))
i++;
GetEntity()->LoadParticleEmitter(i, pParticleEffect, 0, bParticlePrime, true);
Matrix34 tm = IParticleEffect::ParticleLoc(offset, dir, scale);
GetEntity()->SetSlotLocalTM(i, tm);
return i;
}
return -1;
}
//------------------------------------------------------------------------
IEntitySoundProxy *CProjectile::GetSoundProxy()
{
IEntitySoundProxy *pSoundProxy=static_cast<IEntitySoundProxy *>(GetEntity()->GetProxy(ENTITY_PROXY_SOUND));
if (!pSoundProxy)
pSoundProxy=static_cast<IEntitySoundProxy *>(GetEntity()->CreateProxy(ENTITY_PROXY_SOUND));
assert(pSoundProxy);
return pSoundProxy;
}
void CProjectile::FlashbangEffect(const SFlashbangParams* flashbang)
{
if (!flashbang)
return;
const float radius = flashbang->maxRadius;
if (!gEnv->pAISystem)
return;
// Associate event with vehicle if the shooter is in a vehicle (tank cannon shot, etc)
EntityId ownerId = m_ownerId;
IActor* pActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(ownerId);
if (pActor && pActor->GetLinkedVehicle() && pActor->GetLinkedVehicle()->GetEntityId())
ownerId = pActor->GetLinkedVehicle()->GetEntityId();
SAIStimulus stim(AISTIM_GRENADE, AIGRENADE_FLASH_BANG, ownerId, GetEntityId(),
GetEntity()->GetWorldPos(), ZERO, radius);
gEnv->pAISystem->RegisterStimulus(stim);
SAIStimulus stimSound(AISTIM_SOUND, AISOUND_WEAPON, ownerId, 0,
GetEntity()->GetWorldPos(), ZERO, radius * 3.0f);
gEnv->pAISystem->RegisterStimulus(stimSound);
}
//------------------------------------------------------------------------
void CProjectile::ScaledEffect(const SScaledEffectParams* pScaledEffect)
{
if (!pScaledEffect)
return;
float lifetime = m_pAmmoParams->lifetime;
IActor *local = gEnv->pGame->GetIGameFramework()->GetClientActor();
if (local)
{
float dist = (GetEntity()->GetWorldPos() - local->GetEntity()->GetWorldPos()).len();
if (m_totalLifetime < pScaledEffect->delay || pScaledEffect->radius == 0.0f)
return;
float fadeInAmt = 1.0f;
float fadeOutAmt = 1.0f;
if (pScaledEffect->fadeInTime > 0.0f)
{
fadeInAmt = (m_totalLifetime - pScaledEffect->delay) / pScaledEffect->fadeInTime;
fadeInAmt = min(fadeInAmt, 1.0f);
fadeOutAmt = 1.0f - (m_totalLifetime - (lifetime - pScaledEffect->fadeOutTime)) / pScaledEffect->fadeOutTime;
fadeOutAmt = max(fadeOutAmt, 0.0f);
}
if (!m_obstructObject && pScaledEffect->aiObstructionRadius != 0.0f)
{
pe_params_pos pos;
pos.scale = 0.1f;
pos.pos = GetEntity()->GetWorldPos() + Vec3(0,0,pScaledEffect->aiObstructionRadius/4 * pos.scale);
m_obstructObject = gEnv->pPhysicalWorld->CreatePhysicalEntity(PE_STATIC, &pos);
if (m_obstructObject)
{
primitives::sphere sphere;
sphere.center = Vec3(0,0,0);
sphere.r = pScaledEffect->aiObstructionRadius;
int obstructID = gEnv->p3DEngine->GetMaterialManager()->GetSurfaceTypeIdByName("mat_obstruct");
IGeometry *pGeom = gEnv->pPhysicalWorld->GetGeomManager()->CreatePrimitive(primitives::sphere::type, &sphere);
phys_geometry *geometry = gEnv->pPhysicalWorld->GetGeomManager()->RegisterGeometry(pGeom, obstructID);
pe_geomparams params;
params.flags = geom_colltype14;
geometry->nRefCount = 0; // automatically delete geometry
m_obstructObject->AddGeometry(geometry, ¶ms);
}
}
else
{
pe_params_pos pos;
pos.scale = 0.1f + min(fadeInAmt, fadeOutAmt) * 0.9f;
pos.pos = GetEntity()->GetWorldPos() + Vec3(0,0, pScaledEffect->aiObstructionRadius/4.0f * pos.scale);
m_obstructObject->SetParams(&pos);
// Signal the AI
if (gEnv->pAISystem && !m_scaledEffectSignaled && m_totalLifetime > (pScaledEffect->delay + pScaledEffect->fadeInTime))
{
m_scaledEffectSignaled = true;
// Associate event with vehicle if the shooter is in a vehicle (tank cannon shot, etc)
EntityId ownerId = m_ownerId;
IActor* pActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(ownerId);
if (pActor && pActor->GetLinkedVehicle() && pActor->GetLinkedVehicle()->GetEntityId())
ownerId = pActor->GetLinkedVehicle()->GetEntityId();
SAIStimulus stim(AISTIM_GRENADE, AIGRENADE_SMOKE, ownerId, GetEntityId(),
pos.pos, ZERO, pScaledEffect->aiObstructionRadius*1.5f);
gEnv->pAISystem->RegisterStimulus(stim);
}
}
if (dist > pScaledEffect->radius)
{
gEnv->p3DEngine->SetPostEffectParam(pScaledEffect->ppname, 0.0f);
return;
}
float effectAmt = 1.0f - (dist / pScaledEffect->radius);
effectAmt = max(effectAmt, 0.0f);
float effectVal = effectAmt * pScaledEffect->maxValue;
effectVal *= fadeInAmt;
m_scaledEffectval = effectVal;
gEnv->p3DEngine->SetPostEffectParam(pScaledEffect->ppname, effectVal);
}
}
//------------------------------------------------------------------------
void CProjectile::EndScaledEffect(const SScaledEffectParams* pScaledEffect)
{
if (!pScaledEffect || m_scaledEffectval == 0.0f)
return;
IActor *local = gEnv->pGame->GetIGameFramework()->GetClientActor();
if (local)
{
if (pScaledEffect->fadeOutTime > 0.0f)
{
CActor *act = (CActor *)local;
CScreenEffects* pSE = act->GetScreenEffects();
if (pSE)
{
IBlendedEffect *blur = CBlendedEffect<CPostProcessEffect>::Create(CPostProcessEffect(local->GetEntityId(),pScaledEffect->ppname, 0.0f));
IBlendType *linear = CBlendType<CLinearBlend>::Create(CLinearBlend(1.0f));
pSE->StartBlend(blur, linear, 1.0f/pScaledEffect->fadeOutTime, CScreenEffects::eSFX_GID_SmokeBlur);
}
}
else
{
gEnv->p3DEngine->SetPostEffectParam(pScaledEffect->ppname, 0.0f);
}
}
}
//------------------------------------------------------------------------
void CProjectile::SetTrackedByHUD()
{
}
//------------------------------------------------------------------------
void CProjectile::Ricochet(EventPhysCollision *pCollision)
{
IActor *pActor = g_pGame->GetIGameFramework()->GetClientActor();
if (!pActor)
return;
Vec3 dir=pCollision->vloc[0];
dir.NormalizeSafe();
float dot=pCollision->n.Dot(dir);
if (dot>=0.0f) // backface
return;
float b=0,f=0;
uint32 matPierceability=0;
if (!gEnv->pPhysicalWorld->GetSurfaceParameters(pCollision->idmat[1], b, f, matPierceability))
return;
matPierceability&=sf_pierceable_mask;
float probability=0.25f+0.25f*((float)MAX(0,7-matPierceability)/7.0f);
if ((matPierceability && matPierceability>=8) || Random()>probability)
return;
f32 cosine = dir.Dot(-pCollision->n);
if (cosine>1.0f)cosine=1.0f;
if (cosine<-1.0f) cosine=-1.0f;
float angle=RAD2DEG( cry_fabsf(cry_acosf(cosine)) );
if (angle<10.0f)
return;
Vec3 ricochetDir = -2.0f*dot*pCollision->n+dir;
ricochetDir.NormalizeSafe();
Ang3 angles=Ang3::GetAnglesXYZ(Matrix33::CreateRotationVDir(ricochetDir));
float rx=Random()-0.5f;
float rz=Random()-0.5f;
angles.x+=rx*DEG2RAD(10.0f);
angles.z+=rz*DEG2RAD(10.0f);
ricochetDir=Matrix33::CreateRotationXYZ(angles).GetColumn(1).normalized();
Lineseg line(pCollision->pt, pCollision->pt+ricochetDir*20.0f);
Vec3 player = pActor->GetEntity()->GetWorldPos();
float t;
float distanceSq=Distance::Point_LinesegSq(player, line, t);
if (distanceSq < 7.5*7.5 && (t>=0.0f && t<=1.0f))
{
if (distanceSq >= 0.25*0.25)
{
Sphere s;
s.center = player;
s.radius = 6.0f;
Vec3 entry,exit;
int intersect=Intersect::Lineseg_Sphere(line, s, entry,exit);
if (intersect) // one entry or one entry and one exit
{
if (intersect==0x2)
entry=pCollision->pt;
RicochetSound(entry, ricochetDir);
//gEnv->pRenderer->GetIRenderAuxGeom()->DrawLine(entry, ColorB(255, 255, 255, 255), entry+ricochetDir, ColorB(255, 255, 255, 255), 2);
}
}
}
}
CWeapon *CProjectile::GetWeapon()
{
if (m_weaponId)
{
IItem *pItem=g_pGame->GetIGameFramework()->GetIItemSystem()->GetItem(m_weaponId);
if (pItem)
return static_cast<CWeapon *>(pItem->GetIWeapon());
}
return 0;
}
EntityId CProjectile::GetOwnerId()const
{
return m_ownerId;
}
float CProjectile::GetSpeed() const
{
return m_pAmmoParams->speed;
}
//==================================================================
void CProjectile::OnHit(const HitInfo& hit)
{
//C4, special case
if(m_noBulletHits)
return;
//Reduce hit points if hit, and explode (only for C4, AVMine and ClayMore)
if(hit.targetId==GetEntityId() && m_hitPoints>0 && !m_destroying)
{
m_hitPoints -= (int)hit.damage;
if(m_hitPoints<=0)
Explode(true);
}
}
//==================================================================
void CProjectile::OnExplosion(const ExplosionInfo& explosion)
{
}
//==================================================================
void CProjectile::OnServerExplosion(const ExplosionInfo& explosion)
{
//In case this was the same projectile that created the explosion, hitPoints should be already 0
if(m_hitPoints<=0 || m_destroying)
return;
//Not explode if frozen
if (CGameRules * pGameRules = g_pGame->GetGameRules())
if(pGameRules->IsFrozen(GetEntityId()))
return;
//One check more, just in case...
//if(CWeapon* pWep = GetWeapon())
//if(pWep->GetEntityId()==explosion.weaponId)
//return;
//Stolen from SinglePlayer.lua ;p
IPhysicalEntity *pPE = GetEntity()->GetPhysics();
if(pPE)
{
float obstruction = 1.0f-gEnv->pSystem->GetIPhysicalWorld()->IsAffectedByExplosion(pPE);
float distance = (GetEntity()->GetWorldPos()-explosion.pos).len();
distance = max(0.0f, min(distance,explosion.radius));
float effect = (explosion.radius-distance)/explosion.radius;
effect = max(min(1.0f, effect*effect), 0.0f);
effect = effect*(1.0f-obstruction*0.7f);
m_hitPoints -= (int)(effect*explosion.damage);
if(m_hitPoints<=0)
Explode(true);
}
}
//---------------------------------------------------------------------------------
void CProjectile::SetDefaultParticleParams(pe_params_particle *pParams)
{
//Use ammo params if they exist
if(m_pAmmoParams && m_pAmmoParams->pParticleParams)
{
pParams->mass = m_pAmmoParams->pParticleParams->mass;
pParams->size = m_pAmmoParams->pParticleParams->size;
pParams->thickness = m_pAmmoParams->pParticleParams->thickness;
pParams->heading.Set(0.0f,0.0f,0.0f);
pParams->velocity = 0.0f;
pParams->wspin = m_pAmmoParams->pParticleParams->wspin;
pParams->gravity = m_pAmmoParams->pParticleParams->gravity;
pParams->normal.Set(0.0f,0.0f,0.0f);
pParams->kAirResistance = m_pAmmoParams->pParticleParams->kAirResistance;
pParams->accThrust = m_pAmmoParams->pParticleParams->accThrust;
pParams->accLift = m_pAmmoParams->pParticleParams->accLift;
pParams->q0.SetIdentity();
pParams->surface_idx = m_pAmmoParams->pParticleParams->surface_idx;
pParams->flags = m_pAmmoParams->pParticleParams->flags;
pParams->pColliderToIgnore = NULL;
pParams->iPierceability = m_pAmmoParams->pParticleParams->iPierceability;
}
else
{
int type = pParams->type;
memset(pParams,0,sizeof(pe_params_particle));
pParams->type = type;
pParams->velocity = 0.0f;
pParams->iPierceability = 7;
}
}
void CProjectile::GetMemoryUsage(ICrySizer *s) const
{
s->Add(*this);
}
void CProjectile::PostRemoteSpawn()
{
Launch(m_initial_pos, m_initial_dir, m_initial_vel);
}
//------------------------------------------------------------------------
void CProjectile::SerializeSpawnInfo( TSerialize ser )
{
ser.Value("hostId", m_hostId, 'eid');
ser.Value("ownerId", m_ownerId, 'eid');
ser.Value("weaponId", m_weaponId, 'eid');
ser.Value("pos", m_initial_pos, 'wrld');
ser.Value("dir", m_initial_dir, 'dir0');
ser.Value("vel", m_initial_vel, 'vel0');
if (ser.IsReading())
SetParams(m_ownerId, m_hostId, m_weaponId, m_damage, m_hitTypeId, m_damageDropPerMeter, m_damageDropMinDisSqr);
}
//------------------------------------------------------------------------
namespace ProjectileDetail
{
struct SInfo : public ISerializableInfo
{
EntityId hostId;
EntityId ownerId;
EntityId weaponId;
Vec3 pos;
Vec3 dir;
Vec3 vel;
void SerializeWith( TSerialize ser )
{
ser.Value("hostId", hostId, 'eid');
ser.Value("ownerId", ownerId, 'eid');
ser.Value("weaponId", weaponId, 'eid');
ser.Value("pos", pos, 'wrld');
ser.Value("dir", dir, 'dir0');
ser.Value("vel", vel, 'vel0');
}
};
}
ISerializableInfoPtr CProjectile::GetSpawnInfo()
{
ProjectileDetail::SInfo *p = new ProjectileDetail::SInfo();
p->hostId=m_hostId;
p->ownerId=m_ownerId;
p->weaponId=m_weaponId;
p->pos=m_initial_pos;
p->dir=m_initial_dir;
p->vel=m_initial_vel;
return p;
}
uint8 CProjectile::GetDefaultProfile( EEntityAspects aspect )
{
if (aspect == eEA_Physics)
return m_pAmmoParams->physicalizationType;
else
return 0;
}
//------------------------------------------------------------------------
void CProjectile::PostSerialize()
{
// InitWithAI();
}
//------------------------------------------------------------------------
void CProjectile::InitWithAI()
{
// register with ai if needed
//FIXME
//make AI ignore grenades thrown by AI; needs proper/readable grenade reaction
if (m_pAmmoParams->aiType!=AIOBJECT_NONE)
{
bool isFriendlyGrenade(true);
IEntity *pOwnerEntity = gEnv->pEntitySystem->GetEntity(m_ownerId);
if (pOwnerEntity && pOwnerEntity->GetAI())
isFriendlyGrenade = (pOwnerEntity->GetAI()->GetAIType() == AIOBJECT_ACTOR);
if (!isFriendlyGrenade)
{
GetEntity()->RegisterInAISystem(AIObjectParams(m_pAmmoParams->aiType));
}
}
GetGameObject()->SetAIActivation(eGOAIAM_Always);
}
| [
"eliashogstvedt@gmail.com"
] | eliashogstvedt@gmail.com |
260b6ecc28919a32252048fcefd518515ee80d11 | 5a97be73f3c6e2987480194a791675259f8d7edf | /BZOJ/3224/code.cpp | c3a985cfcb526053f00b2cf93c98e44afee6fad9 | [
"MIT"
] | permissive | sjj118/OI-Code | 1d33d2a7a6eeba2ed16692d663e1b81cdc1341fd | 964ea6e799d14010f305c7e4aee269d860a781f7 | refs/heads/master | 2022-02-21T17:54:14.764880 | 2019-09-05T07:16:27 | 2019-09-05T07:16:27 | 65,370,460 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,936 | cpp | #include<iostream>
#include<cstdio>
#include<cstdlib>
#define pii pair<int,int>
#define mp make_pair
#define rg register
#define rep(i,x,y) for(rg int i=(x);i<=(y);++i)
#define per(i,x,y) for(rg int i=(x);i>=(y);--i)
using namespace std;
const int maxn=1e5+10,inf=1e9;
int root;
struct Treap{
int tot,ls[maxn],rs[maxn],rnd[maxn],key[maxn],size[maxn];
int newnode(int v){int k=++tot;rnd[k]=rand();key[k]=v;size[k]=1;return k;}
void update(int k){size[k]=size[ls[k]]+size[rs[k]]+1;}
int merge(int a,int b){
if(!a||!b)return a+b;
if(rnd[a]<rnd[b])return rs[a]=merge(rs[a],b),update(a),a;
else return ls[b]=merge(a,ls[b]),update(b),b;
}
void split(int k,int p,int&l,int&r){
if(p==0)l=0,r=k;
else if(size[ls[k]]==p)l=ls[k],ls[k]=0,update(k),r=k;
else if(size[ls[k]]>p)split(ls[k],p,l,ls[k]),update(k),r=k;
else split(rs[k],p-size[ls[k]]-1,rs[k],r),update(k),l=k;
}
int pth(int k,int p){
if(size[k]<p||p<=0)return -1;
if(size[ls[k]]>=p)return pth(ls[k],p);
if(size[ls[k]]+1==p)return key[k];
return pth(rs[k],p-size[ls[k]]-1);
}
int rank(int k,int x){
if(!k)return 1;
if(key[k]<x)return rank(rs[k],x)+size[ls[k]]+1;
return rank(ls[k],x);
}
void del(int k,int x){
int l,r,t;split(k,rank(k,x)-1,l,t);split(t,1,t,r);
root=merge(l,r);
}
void insert(int k,int x){
int l,r;split(k,rank(k,x)-1,l,r);
root=merge(l,newnode(x));root=merge(root,r);
}
int pre(int k,int x){
if(!k)return 0;
if(key[k]<x)return max(pre(rs[k],x),key[k]);
return pre(ls[k],x);
}
int suf(int k,int x){
if(!k)return inf;
if(key[k]>x)return min(suf(ls[k],x),key[k]);
return suf(rs[k],x);
}
}T;
int main(){
int n;scanf("%d",&n);
rep(i,1,n){
int op,x;scanf("%d%d",&op,&x);
if(op==1)T.insert(root,x);
if(op==2)T.del(root,x);
if(op==3)printf("%d\n",T.rank(root,x));
if(op==4)printf("%d\n",T.pth(root,x));
if(op==5)printf("%d\n",T.pre(root,x));
if(op==6)printf("%d\n",T.suf(root,x));
}
return 0;
}
| [
"史记"
] | 史记 |
d54feabbc679cae6a71403d574ed8e3012b8e1a3 | 10f8237265db1392ed4c5bcc888f0cecb32a3e54 | /src/cc/common/kfsdecls.h | 3d5301240d2ef6a3012570f3fe3ff8a6ddb189aa | [
"Apache-2.0"
] | permissive | jomie/kfs | c88f18334f9a4cf2a3dc4ce80f196e52304bfe9f | 8bce116e87f31b1e91f75c09e8aec19c1cafffd4 | refs/heads/master | 2021-01-16T20:56:49.943904 | 2012-05-03T22:12:07 | 2012-05-03T22:12:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,401 | h | //---------------------------------------------------------- -*- Mode: C++ -*-
// $Id: kfsdecls.h 1552 2011-01-06 22:21:54Z sriramr $
//
// \brief Common declarations of KFS structures
//
// Created 2006/10/20
//
// Copyright 2008 Quantcast Corp.
// Copyright 2006-2008 Kosmix Corp.
//
// This file is part of Kosmos File System (KFS).
//
// 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 COMMON_KFSDECLS_H
#define COMMON_KFSDECLS_H
#include <cassert>
#include <cerrno>
#include <string>
#include <sstream>
#include <stdlib.h>
namespace KFS {
///
/// Define a server process' location: hostname and the port at which
/// it is listening for incoming connections
///
struct ServerLocation {
ServerLocation(): hostname(""), port(-1) { }
ServerLocation(const ServerLocation &other):
hostname(other.hostname), port(other.port) { }
ServerLocation(const std::string &h, int p): hostname(h), port(p) { }
ServerLocation & operator = (const ServerLocation &other) {
hostname = other.hostname;
port = other.port;
return *this;
}
void Reset(const char *h, int p) {
hostname = h;
port = p;
}
bool operator == (const ServerLocation &other) const {
return hostname == other.hostname && port == other.port;
}
bool operator != (const ServerLocation &other) const {
return hostname != other.hostname || port != other.port;
}
bool operator < (const ServerLocation &other) const {
const int res = hostname.compare(other.hostname);
return (res < 0 || (res == 0 && port < other.port));
}
bool IsValid() const {
// Hostname better be non-null and port better
// be a positive number
return hostname.compare("") != 0 && port > 0;
}
// a proxy for distance between two hosts: take the difference
// between their hostnames. this will mostly work as long as all
// machines in the cluster are named as nodeXXX, where XXX is a number
int Distance(const std::string &otherhost) {
int len = (int) std::min(hostname.size(), otherhost.size());
int hosta = 0, hostb = 0;
int scalefactor = 1;
for (int i = len - 1; i >= 0; --i) {
if (isdigit(hostname[i]))
hosta += (hostname[i] - '0') * scalefactor;
if (isdigit(otherhost[i]))
hostb += (otherhost[i] - '0') * scalefactor;
scalefactor *= 10;
}
return abs(hosta - hostb);
}
std::string ToString() const {
std::ostringstream os;
os << hostname << ' ' << port;
return os.str();
}
void FromString(const std::string &s) {
std::istringstream is(s);
is >> hostname;
is >> port;
}
std::string hostname; //!< Location of the server: machine name/IP addr
int port; //!< Location of the server: port to connect to
};
}
#endif // COMMON_KFSDECLS_H
| [
"sriramsrao@gmail.com"
] | sriramsrao@gmail.com |
3b963cd6b8138ff51a88c55535e87ae5dc65803c | d320d6fed418f4339a953f3963e7bd4b6b4b3cd0 | /libapi/basalt/api/gfx/backend/types.h | 5cc2ab293843f35037923ef0c95d5a5f03a6c452 | [] | no_license | juli27/basaltcpp | 6ef93bb3c322f328262bb18c572968eb0ff8fc2b | 1c6bb55f80e8c1fa4aa3b52a7111e78741424955 | refs/heads/master | 2023-08-31T04:30:57.379453 | 2023-08-30T18:57:54 | 2023-08-30T18:57:54 | 189,708,858 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,515 | h | #pragma once
#include <basalt/api/shared/color.h>
#include <basalt/api/shared/handle.h>
#include <basalt/api/math/angle.h>
#include <basalt/api/math/vector3.h>
#include <basalt/api/base/enum_set.h>
#include <basalt/api/base/types.h>
#include <gsl/span>
#include <memory>
#include <variant>
namespace basalt::gfx {
enum class Attachment : u8 {
RenderTarget,
DepthBuffer,
StencilBuffer,
};
using Attachments = EnumSet<Attachment, Attachment::StencilBuffer>;
enum class BlendFactor : u8 {
Zero,
One,
SrcColor,
OneMinusSrcColor,
SrcAlpha,
OneMinusSrcAlpha,
Constant,
OneMinusConstant,
};
constexpr u8 BLEND_FACTOR_COUNT {8};
enum class BlendOp : u8 {
Add,
Subtract,
ReverseSubtract,
};
constexpr u8 BLEND_OP_COUNT {3};
enum class BorderColor : u8 {
BlackTransparent,
BlackOpaque,
WhiteOpaque,
// DeviceCaps.samplerCustomBorderColor
Custom,
};
constexpr u8 BORDER_COLOR_COUNT {4u};
enum class CullMode : u8 {
None,
Clockwise,
CounterClockwise,
};
constexpr u8 CULL_MODE_COUNT {3u};
enum class TestPassCond : u8 {
Never,
IfEqual,
IfNotEqual,
IfLess,
IfLessEqual,
IfGreater,
IfGreaterEqual,
Always,
};
constexpr u8 TEST_PASS_COND_COUNT {8u};
enum class FillMode : u8 {
Point,
Wireframe,
Solid,
};
constexpr u8 FILL_MODE_COUNT {3};
enum class PrimitiveType : u8 {
PointList,
LineList,
LineStrip,
TriangleList,
TriangleStrip,
TriangleFan,
};
constexpr u8 PRIMITIVE_TYPE_COUNT {6u};
enum class ShadeMode : u8 {
Flat,
Gouraud,
};
constexpr u8 SHADE_MODE_COUNT {2};
enum class FogMode : u8 {
None,
Linear,
Exponential,
ExponentialSquared,
};
constexpr u8 FOG_MODE_COUNT {4};
enum class TextureAddressMode : u8 {
Repeat,
Mirror,
ClampToEdge,
// DeviceCaps.samplerClampToBorder
ClampToBorder,
// DeviceCaps.samplerMirrorOnceClampToEdge
MirrorOnceClampToEdge,
};
constexpr u8 TEXTURE_ADDRESS_MODE_COUNT {5u};
enum class TextureCoordinateSrc : u8 {
Vertex,
PositionInViewSpace,
NormalInViewSpace,
ReflectionVectorInViewSpace,
};
constexpr u8 TEXTURE_COORDINATE_SOURCE_COUNT {4};
enum class TextureFilter : u8 {
Point,
Bilinear,
// DeviceCaps.samplerMinFilterAnisotropic
// DeviceCaps.samplerMagFilterAnisotropic
Anisotropic,
};
constexpr u8 TEXTURE_FILTER_COUNT {3u};
enum class TextureMipFilter : u8 {
None,
Point,
Linear,
};
constexpr u8 TEXTURE_MIP_FILTER_COUNT {3u};
enum class TextureOp : u8 {
// r = arg1
Replace,
// r = arg1 * arg2
Modulate,
// r = 2 * arg1 * arg2
Modulate2X,
// r = 4 * arg1 * arg2
Modulate4X,
// r = arg1 + arg2
Add,
// r = arg1 + arg2 - 0.5
AddSigned,
// r = 2 * (arg1 + arg2 - 0.5)
AddSigned2X,
// r = arg1 - arg2
Subtract,
// r = arg1 + arg2 - arg1 * arg2 = arg1 + arg2 (1 - arg1)
AddSmooth,
// r = arg1 * alpha_d + arg2 * (1 - alpha_d)
BlendDiffuseAlpha,
// r = arg1 * alpha_t + arg2 * (1 - alpha_t)
BlendTextureAlpha,
// r = arg1 * alpha_f + arg2 * (1 - alpha_f)
BlendFactorAlpha,
// r = arg1 * alpha_c + arg2 * (1 - alpha_c)
BlendCurrentAlpha,
// r = arg1 + arg2 * (1 - alpha_t)
BlendTextureAlphaPm,
// r = arg1, current = texture_{n+1} * current, if there is a texture in the
// next stage
PreModulate,
// r.rgba = arg1.rgb + arg1.a * arg2.rgb
ModulateAlphaAddColor,
// r.rgba = arg1.rgb * arg2.rgb + arg1.a
ModulateColorAddAlpha,
// r.rgba = arg1.rgb + (1 - arg1.a) * arg2.rgb
ModulateInvAlphaAddColor,
// r.rgba = (1 - arg1.rgb) * arg2.rgb + arg1.a
ModulateInvColorAddAlpha,
// performs per-pixel bump mapping using the env map in the next stage with
// luminance = 1
BumpEnvMap,
// performs per-pixel bump mapping using the env map in the next stage with
// luminance
BumpEnvMapLuminance,
// r.rgba = arg1.r * arg2.r + arg1.g * arg2.g + arg1.b * arg2.b
// with args biased to be signed
DotProduct3,
// r.rgba = arg1 + arg2 * arg3
MultiplyAdd,
// r.rgba = arg1 * arg2 + (1 - arg1) * arg3
Interpolate,
};
constexpr u8 TEXTURE_OP_COUNT {24};
using TextureOps = EnumSet<TextureOp, TextureOp::Interpolate>;
enum class TextureStageSrc : u8 {
Current,
Diffuse,
Specular,
SampledTexture,
TextureFactor,
Temporary,
// DeviceCaps.perTextureStageConstant
StageConstant,
};
constexpr u8 TEXTURE_STAGE_SRC_COUNT {7};
enum class TextureStageSrcMod : u8 {
None,
Complement,
AlphaReplicate,
};
constexpr u8 TEXTURE_STAGE_SRC_MOD_COUNT {3};
enum class TextureStageDestination : u8 {
Current,
Temporary,
};
constexpr u8 TEXTURE_STAGE_DESTINATION_COUNT {2};
enum class TextureCoordinateTransformMode : u8 {
Disabled,
Count1,
Count2,
Count3,
Count4,
};
constexpr u8 TEXTURE_COORDINATE_TRANSFORM_MODE_COUNT {5};
enum class TransformState : u8 {
ViewToClip,
WorldToView,
LocalToWorld,
Texture0,
Texture1,
Texture2,
Texture3,
Texture4,
Texture5,
Texture6,
Texture7,
};
constexpr u8 TRANSFORM_STATE_COUNT {11};
enum class VertexElement : u8 {
Position3F32,
PositionTransformed4F32,
Normal3F32,
PointSize1F32,
ColorDiffuse1U32A8R8G8B8,
ColorSpecular1U32A8R8G8B8,
TextureCoords1F32,
TextureCoords2F32,
TextureCoords3F32,
TextureCoords4F32,
};
constexpr u8 VERTEX_ELEMENT_COUNT {10u};
using VertexLayout = gsl::span<const VertexElement>;
enum class IndexType : u8 {
U16,
U32,
};
constexpr u8 INDEX_TYPE_COUNT {2u};
using IndexTypes = EnumSet<IndexType, IndexType::U32>;
namespace detail {
struct PipelineTag;
struct SamplerTag;
struct TextureTag;
struct VertexBufferTag;
struct IndexBufferTag;
} // namespace detail
using Pipeline = Handle<detail::PipelineTag>;
using Sampler = Handle<detail::SamplerTag>;
using Texture = Handle<detail::TextureTag>;
using VertexBuffer = Handle<detail::VertexBufferTag>;
using IndexBuffer = Handle<detail::IndexBufferTag>;
struct Command;
class CommandList;
class Device;
using DevicePtr = std::shared_ptr<Device>;
class SwapChain;
using SwapChainPtr = std::shared_ptr<SwapChain>;
using uDeviceSize = u64;
struct DeviceCaps final {
uDeviceSize maxVertexBufferSizeInBytes {};
uDeviceSize maxIndexBufferSizeInBytes {};
IndexTypes supportedIndexTypes {IndexType::U16};
u32 maxLights {1};
u32 maxTextureBlendStages {1};
u32 maxBoundSampledTextures {1};
bool samplerClampToBorder {false};
bool samplerCustomBorderColor {false};
bool samplerMirrorOnceClampToEdge {false};
bool samplerMinFilterAnisotropic {false};
bool samplerMagFilterAnisotropic {false};
bool samplerCubeMinFilterAnisotropic {false};
bool samplerCubeMagFilterAnisotropic {false};
bool sampler3DMinFilterAnisotropic {false};
bool sampler3DMagFilterAnisotropic {false};
u8 samplerMaxAnisotropy {1};
bool perTextureStageConstant {false};
TextureOps supportedColorOps;
TextureOps supportedAlphaOps;
};
struct TextureStageArgument {
TextureStageSrc src {TextureStageSrc::Current};
TextureStageSrcMod modifier {TextureStageSrcMod::None};
};
struct TextureCoordinateSet {
u8 stageIndex {};
TextureCoordinateSrc src {TextureCoordinateSrc::Vertex};
u8 srcIndex {};
TextureCoordinateTransformMode transformMode {
TextureCoordinateTransformMode::Disabled};
bool projected {false};
};
enum class MaterialColorSource : u8 {
DiffuseVertexColor,
SpecularVertexColor,
Material,
};
constexpr u8 MATERIAL_COLOR_SOURCE_COUNT {3};
// or enum set with wanted features
struct FixedVertexShaderCreateInfo {
gsl::span<const TextureCoordinateSet> textureCoordinateSets {};
ShadeMode shadeMode {ShadeMode::Gouraud};
bool lightingEnabled {false};
bool specularEnabled {false};
bool vertexColorEnabled {true};
bool normalizeViewSpaceNormals {false};
MaterialColorSource diffuseSource {MaterialColorSource::DiffuseVertexColor};
MaterialColorSource specularSource {MaterialColorSource::SpecularVertexColor};
MaterialColorSource ambientSource {MaterialColorSource::Material};
MaterialColorSource emissiveSource {MaterialColorSource::Material};
FogMode fog {FogMode::None};
bool fogRangeBased {false};
};
struct TextureStage {
TextureOp colorOp {TextureOp::Modulate};
TextureStageArgument colorArg1 {TextureStageSrc::SampledTexture};
TextureStageArgument colorArg2 {};
TextureStageArgument colorArg3 {};
TextureOp alphaOp {TextureOp::Replace};
TextureStageArgument alphaArg1 {TextureStageSrc::SampledTexture};
TextureStageArgument alphaArg2 {};
TextureStageArgument alphaArg3 {};
TextureStageDestination dest {TextureStageDestination::Current};
// TODO: replace with Matrix2x2
f32 bumpEnvMat00 {1};
f32 bumpEnvMat01 {0};
f32 bumpEnvMat10 {0};
f32 bumpEnvMat11 {1};
f32 bumpEnvLuminanceScale {1};
f32 bumpEnvLuminanceOffset {0};
};
struct FixedFragmentShaderCreateInfo {
gsl::span<const TextureStage> textureStages {};
// this overrides vertex fog
FogMode fog {FogMode::None};
};
enum class StencilOp : u8 {
Keep,
Zero,
Replace,
Invert,
IncrementClamp,
DecrementClamp,
IncrementWrap,
DecrementWrap,
};
constexpr u8 STENCIL_OP_COUNT {8};
struct StencilOpState {
TestPassCond test {TestPassCond::Always};
StencilOp failOp {StencilOp::Keep};
StencilOp passDepthFailOp {StencilOp::Keep};
StencilOp passDepthPassOp {StencilOp::Keep};
};
struct PipelineDescriptor final {
// null -> default fixed vertex shader
const FixedVertexShaderCreateInfo* vertexShader {};
// null -> default fixed fragment shader
const FixedFragmentShaderCreateInfo* fragmentShader {};
VertexLayout vertexLayout {};
PrimitiveType primitiveType {PrimitiveType::PointList};
CullMode cullMode {CullMode::None};
FillMode fillMode {FillMode::Solid};
TestPassCond depthTest {TestPassCond::Always};
bool depthWriteEnable {false};
StencilOpState frontFaceStencilOp {};
StencilOpState backFaceStencilOp {};
bool dithering {false};
TestPassCond alphaTest {TestPassCond::Always};
BlendFactor srcBlendFactor {BlendFactor::One};
BlendFactor destBlendFactor {BlendFactor::Zero};
BlendOp blendOp {BlendOp::Add};
};
struct SamplerDescriptor final {
TextureFilter magFilter {TextureFilter::Point};
TextureFilter minFilter {TextureFilter::Point};
TextureMipFilter mipFilter {TextureMipFilter::None};
TextureAddressMode addressModeU {TextureAddressMode::Repeat};
TextureAddressMode addressModeV {TextureAddressMode::Repeat};
TextureAddressMode addressModeW {TextureAddressMode::Repeat};
// DeviceCaps.samplerClampToBorder
BorderColor borderColor {BorderColor::BlackTransparent};
// DeviceCaps.samplerCustomBorderColor
Color customBorderColor {};
// DeviceCaps.samplerMaxAnisotropy
u8 maxAnisotropy {1};
};
struct VertexBufferDescriptor final {
uDeviceSize sizeInBytes {};
VertexLayout layout {};
};
struct IndexBufferDescriptor final {
uDeviceSize sizeInBytes {};
IndexType type {IndexType::U16};
};
struct DirectionalLightData final {
Color diffuse;
Color specular;
Color ambient;
Vector3f32 directionInWorld;
};
struct PointLightData final {
Color diffuse;
Color specular;
Color ambient;
Vector3f32 positionInWorld;
f32 rangeInWorld {};
f32 attenuation0 {};
f32 attenuation1 {};
f32 attenuation2 {};
};
struct SpotLightData final {
Color diffuse;
Color specular;
Color ambient;
Vector3f32 positionInWorld;
Vector3f32 directionInWorld;
f32 rangeInWorld {};
f32 attenuation0 {};
f32 attenuation1 {};
f32 attenuation2 {};
f32 falloff {};
Angle phi;
Angle theta;
};
using LightData =
std::variant<PointLightData, SpotLightData, DirectionalLightData>;
} // namespace basalt::gfx
| [
"juli27@users.noreply.github.com"
] | juli27@users.noreply.github.com |
016ef219544c72a50fd2cd6e5acf03c7d3f65a53 | 4af98acff7a65ed46e0a8738db3d34aa817acffe | /Objects/Nature.cpp | 79feaf0d7e3453217879983b55570b1190cce36b | [
"GPL-3.0-only"
] | permissive | Admiral-Fish/PokeFinderCore | 45d0e43a2850bd0ac28926f113354cbe31897dd2 | 2a1d3542147a1c502f786349580dcecf4a773b22 | refs/heads/develop | 2021-07-12T02:25:04.745179 | 2018-12-13T22:44:58 | 2018-12-13T22:44:58 | 113,494,472 | 0 | 0 | Apache-2.0 | 2017-12-10T20:17:08 | 2017-12-07T20:18:27 | JavaScript | UTF-8 | C++ | false | false | 2,743 | cpp | /*
* This file is part of PokéFinderCore
* Copyright (C) 2017 by Admiral_Fish, bumba, and EzPzStreamz
*
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "Nature.hpp"
QStringList Nature::getNatures()
{
QStringList natures =
{
QObject::tr("Adamant"), QObject::tr("Bold"), QObject::tr("Brave"), QObject::tr("Calm"),
QObject::tr("Careful"), QObject::tr("Hasty"), QObject::tr("Impish"), QObject::tr("Jolly"),
QObject::tr("Lonely"), QObject::tr("Mild"), QObject::tr("Modest"), QObject::tr("Naive"),
QObject::tr("Naughty"), QObject::tr("Quiet"), QObject::tr("Rash"), QObject::tr("Relaxed"),
QObject::tr("Sassy"), QObject::tr("Timid"), QObject::tr("Gentle"), QObject::tr("Lax"),
QObject::tr("Bashful"), QObject::tr("Docile"), QObject::tr("Hardy"), QObject::tr("Quirky"),
QObject::tr("Serious")
};
return natures;
}
QString Nature::getNature(u8 nature)
{
return getFrameNatures()[nature];
}
QStringList Nature::getFrameNatures()
{
QStringList natures =
{
QObject::tr("Hardy"), QObject::tr("Lonely"), QObject::tr("Brave"), QObject::tr("Adamant"),
QObject::tr("Naughty"), QObject::tr("Bold"), QObject::tr("Docile"), QObject::tr("Relaxed"),
QObject::tr("Impish"), QObject::tr("Lax"), QObject::tr("Timid"), QObject::tr("Hasty"),
QObject::tr("Serious"), QObject::tr("Jolly"), QObject::tr("Naive"), QObject::tr("Modest"),
QObject::tr("Mild"), QObject::tr("Quiet"), QObject::tr("Bashful"), QObject::tr("Rash"),
QObject::tr("Calm"), QObject::tr("Gentle"), QObject::tr("Sassy"), QObject::tr("Careful"),
QObject::tr("Quirky")
};
return natures;
}
u8 Nature::getAdjustedNature(u8 nature)
{
const u8 vals[25] = { 3, 5, 2, 20, 23, 11, 8, 13, 1, 16, 15, 14, 4, 17, 19, 7, 22, 10, 21, 9, 18, 6, 0, 24, 12 };
return vals[nature];
}
u8 Nature::getReversedNature(u8 nature)
{
const u8 vals[25] = { 22, 8, 2, 0, 12, 1, 21, 15, 6, 19, 17, 5, 24, 7, 11, 10, 9, 13, 20, 14, 3, 18, 16, 4, 23 };
return vals[nature];
}
| [
"admiralfish420@gmail.com"
] | admiralfish420@gmail.com |
8f8d213c536e9932795556fe79c101d193c9382f | 86816590ce33750d42525a38faf065d73ee272b4 | /my_punycode.h | d8b0a2f00d1e34fd9574b4cddde4ef239aac4016 | [] | no_license | vi-k/vi-k.mylib | 440cd4d9b93f62beaa0f6d6206d94ceab19a6c06 | e2cf3c14fbb7c57ac8a795a38452aed3bedb92c4 | refs/heads/master | 2021-01-10T02:01:17.460925 | 2010-09-01T06:11:53 | 2010-09-01T06:11:53 | 44,516,052 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 319 | h | #ifndef MY_PUNYCODE_H
#define MY_PUNYCODE_H
#include <cstddef> /* std::size_t */
#include <string>
namespace my {
/* Преобразование в/из Punycode */
std::string punycode_encode(const wchar_t *str, std::size_t length);
std::wstring punycode_decode(const char *str, std::size_t length);
}
#endif
| [
"victor dunaev (victor.dunaev@gmail.com)"
] | victor dunaev (victor.dunaev@gmail.com) |
2ccffb4a298d0f6a17ff83cf213d19c768668895 | 1e3a85a3ae498b34316e4938dd0bc5d39bfcf7c2 | /Assignments/Assignment_6/HW6_Complished/Assignment_6_Code/ex1/ex1 (i)/test.cpp | 15e4931102d5db3983d1493b7d974ac4c5f87c60 | [] | no_license | Geyuhao/CS225 | 987a90e416bbd058aeac9da79f2b9cc8e4b67134 | 42ddfe831674d2cfbe7236209bc7574b3e44c775 | refs/heads/main | 2023-04-26T01:56:58.270989 | 2021-05-21T02:12:49 | 2021-05-21T02:12:49 | 330,625,873 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 794 | cpp | #include <stdio.h>
#include <iostream>
#include <cstdlib>
#include "hashset.cpp"
using std::cout;
using std::cin;
using std::hash;
int main(){
int i;
hash<int> hashfunction;
hashset<int> myhashtable;
myhashtable = hashset<int>(20);
int test_input[14] = {202,32,7,15,74,9,12,16,102,4,8,22,3,2};
for (i = 0; i < 14; i ++){
myhashtable.add(test_input[i]);
cout << test_input[i] << "'s desired position: " << hashfunction(test_input[i]) % 20+1 << "\n";
}
/* pay attention to 3, 2, 22's position */
cout << "=============== my hashtable ===============\n";
myhashtable.display();
cout << "=============== remove 102 ===============\n";
myhashtable.remove_modified(102);
myhashtable.display();
}
| [
"guanshujie.19@intl.zju.edu.cn"
] | guanshujie.19@intl.zju.edu.cn |
5113dc78dd183e98dd804a96fc8a2d5288f5cf26 | 11e1311563f5bec80018e772c710557510dcb610 | /lib/Config/AboutLicense.cpp | 8a45e0828cc906d67c18aa89a7a1af0c207b60cf | [] | permissive | ffk0716/onnc | 03e42654b6707e361e3a9d8df176e624d5267032 | 91e4955ade64b479db17aaeccacf4b7339fe44d2 | refs/heads/master | 2020-03-26T14:41:35.911135 | 2018-08-26T14:23:16 | 2018-08-26T14:23:16 | 144,999,938 | 1 | 0 | BSD-3-Clause | 2018-08-16T14:33:31 | 2018-08-16T14:33:30 | null | UTF-8 | C++ | false | false | 1,836 | cpp | //===- AboutData.cpp ----------------------------------------------------===//
//
// The ONNC Project
//
// See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include <onnc/Config/AboutLicense.h>
#include <onnc/Config/AboutData.h>
#include <onnc/Support/IFStream.h>
#include <streambuf>
using namespace onnc;
//===----------------------------------------------------------------------===//
// AboutLicense
//===----------------------------------------------------------------------===//
AboutLicense::AboutLicense(const AboutData& pData)
: m_Key(kUnknown), m_Text() {
}
AboutLicense::AboutLicense(const Path& pLicenseFile, const AboutData& pData)
: m_Key(kUnknown) {
read(pLicenseFile);
}
AboutLicense::AboutLicense(const std::string& pLicenseText, const AboutData& pData)
: m_Key(kPrivate), m_Text(pLicenseText) {
}
AboutLicense::AboutLicense(const AboutLicense& pOther)
: m_Key(pOther.m_Key), m_Text(pOther.m_Text) {
}
AboutLicense& AboutLicense::operator=(const AboutLicense& pOther)
{
m_Key = pOther.m_Key;
m_Text = pOther.m_Text;
return *this;
}
void AboutLicense::read(const Path& pLicenseFile)
{
IFStream ifs(pLicenseFile);
if (!ifs.good() || !ifs.is_open())
return;
ifs.seekg(0, std::ios::end);
m_Text.reserve(ifs.tellg());
ifs.seekg(0, std::ios::beg);
m_Text.assign((std::istreambuf_iterator<char>(ifs)),
std::istreambuf_iterator<char>());
}
void AboutLicense::print(std::ostream& pOS) const
{
switch (this->key()) {
case kUnknown:
pOS << "Skymizer Confidential Class A+.";
break;
case kPrivate:
pOS << "Customized License, SPECIAL COSTUMER ONLY.";
break;
case kProprietary:
pOS << "See LICENSE.TXT for details.";
break;
}
}
| [
"luba@skymizer.com"
] | luba@skymizer.com |
2ae0d1b95ee8b178ad2d38f6aa282de525559053 | ee39de2901677d01dbef98a0deafd6f200134598 | /arch/Mips/MipsGenInstrInfo.inc | f2243dc5ee403dc4994a83e10972b5cd8706efa6 | [
"BSD-3-Clause",
"NCSA"
] | permissive | 0xKD/capstone | 9209b9811e4a8a97a269013f754ba7c53adc93a9 | 6b7b7d9c9721bb9b48715ab52f3742932e4766a3 | refs/heads/master | 2020-07-11T16:32:35.005465 | 2013-12-20T11:30:15 | 2013-12-20T11:30:15 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 36,026 | inc | /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
|* *|
|*Target Instruction Enum Values *|
|* *|
|* Automatically generated file, do not edit! *|
|* *|
\*===----------------------------------------------------------------------===*/
/* Capstone Disassembler Engine */
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013> */
#ifdef GET_INSTRINFO_ENUM
#undef GET_INSTRINFO_ENUM
enum {
Mips_PHI = 0,
Mips_INLINEASM = 1,
Mips_PROLOG_LABEL = 2,
Mips_EH_LABEL = 3,
Mips_GC_LABEL = 4,
Mips_KILL = 5,
Mips_EXTRACT_SUBREG = 6,
Mips_INSERT_SUBREG = 7,
Mips_IMPLICIT_DEF = 8,
Mips_SUBREG_TO_REG = 9,
Mips_COPY_TO_REGCLASS = 10,
Mips_DBG_VALUE = 11,
Mips_REG_SEQUENCE = 12,
Mips_COPY = 13,
Mips_BUNDLE = 14,
Mips_LIFETIME_START = 15,
Mips_LIFETIME_END = 16,
Mips_STACKMAP = 17,
Mips_PATCHPOINT = 18,
Mips_ABSQ_S_PH = 19,
Mips_ABSQ_S_QB = 20,
Mips_ABSQ_S_W = 21,
Mips_ADD = 22,
Mips_ADDQH_PH = 23,
Mips_ADDQH_R_PH = 24,
Mips_ADDQH_R_W = 25,
Mips_ADDQH_W = 26,
Mips_ADDQ_PH = 27,
Mips_ADDQ_S_PH = 28,
Mips_ADDQ_S_W = 29,
Mips_ADDSC = 30,
Mips_ADDS_A_B = 31,
Mips_ADDS_A_D = 32,
Mips_ADDS_A_H = 33,
Mips_ADDS_A_W = 34,
Mips_ADDS_S_B = 35,
Mips_ADDS_S_D = 36,
Mips_ADDS_S_H = 37,
Mips_ADDS_S_W = 38,
Mips_ADDS_U_B = 39,
Mips_ADDS_U_D = 40,
Mips_ADDS_U_H = 41,
Mips_ADDS_U_W = 42,
Mips_ADDUH_QB = 43,
Mips_ADDUH_R_QB = 44,
Mips_ADDU_PH = 45,
Mips_ADDU_QB = 46,
Mips_ADDU_S_PH = 47,
Mips_ADDU_S_QB = 48,
Mips_ADDVI_B = 49,
Mips_ADDVI_D = 50,
Mips_ADDVI_H = 51,
Mips_ADDVI_W = 52,
Mips_ADDV_B = 53,
Mips_ADDV_D = 54,
Mips_ADDV_H = 55,
Mips_ADDV_W = 56,
Mips_ADDWC = 57,
Mips_ADD_A_B = 58,
Mips_ADD_A_D = 59,
Mips_ADD_A_H = 60,
Mips_ADD_A_W = 61,
Mips_ADD_MM = 62,
Mips_ADDi = 63,
Mips_ADDi_MM = 64,
Mips_ADDiu = 65,
Mips_ADDiu_MM = 66,
Mips_ADDu = 67,
Mips_ADDu_MM = 68,
Mips_ADJCALLSTACKDOWN = 69,
Mips_ADJCALLSTACKUP = 70,
Mips_AND = 71,
Mips_AND64 = 72,
Mips_ANDI_B = 73,
Mips_AND_MM = 74,
Mips_AND_V = 75,
Mips_AND_V_D_PSEUDO = 76,
Mips_AND_V_H_PSEUDO = 77,
Mips_AND_V_W_PSEUDO = 78,
Mips_ANDi = 79,
Mips_ANDi64 = 80,
Mips_ANDi_MM = 81,
Mips_APPEND = 82,
Mips_ASUB_S_B = 83,
Mips_ASUB_S_D = 84,
Mips_ASUB_S_H = 85,
Mips_ASUB_S_W = 86,
Mips_ASUB_U_B = 87,
Mips_ASUB_U_D = 88,
Mips_ASUB_U_H = 89,
Mips_ASUB_U_W = 90,
Mips_ATOMIC_CMP_SWAP_I16 = 91,
Mips_ATOMIC_CMP_SWAP_I32 = 92,
Mips_ATOMIC_CMP_SWAP_I64 = 93,
Mips_ATOMIC_CMP_SWAP_I8 = 94,
Mips_ATOMIC_LOAD_ADD_I16 = 95,
Mips_ATOMIC_LOAD_ADD_I32 = 96,
Mips_ATOMIC_LOAD_ADD_I64 = 97,
Mips_ATOMIC_LOAD_ADD_I8 = 98,
Mips_ATOMIC_LOAD_AND_I16 = 99,
Mips_ATOMIC_LOAD_AND_I32 = 100,
Mips_ATOMIC_LOAD_AND_I64 = 101,
Mips_ATOMIC_LOAD_AND_I8 = 102,
Mips_ATOMIC_LOAD_NAND_I16 = 103,
Mips_ATOMIC_LOAD_NAND_I32 = 104,
Mips_ATOMIC_LOAD_NAND_I64 = 105,
Mips_ATOMIC_LOAD_NAND_I8 = 106,
Mips_ATOMIC_LOAD_OR_I16 = 107,
Mips_ATOMIC_LOAD_OR_I32 = 108,
Mips_ATOMIC_LOAD_OR_I64 = 109,
Mips_ATOMIC_LOAD_OR_I8 = 110,
Mips_ATOMIC_LOAD_SUB_I16 = 111,
Mips_ATOMIC_LOAD_SUB_I32 = 112,
Mips_ATOMIC_LOAD_SUB_I64 = 113,
Mips_ATOMIC_LOAD_SUB_I8 = 114,
Mips_ATOMIC_LOAD_XOR_I16 = 115,
Mips_ATOMIC_LOAD_XOR_I32 = 116,
Mips_ATOMIC_LOAD_XOR_I64 = 117,
Mips_ATOMIC_LOAD_XOR_I8 = 118,
Mips_ATOMIC_SWAP_I16 = 119,
Mips_ATOMIC_SWAP_I32 = 120,
Mips_ATOMIC_SWAP_I64 = 121,
Mips_ATOMIC_SWAP_I8 = 122,
Mips_AVER_S_B = 123,
Mips_AVER_S_D = 124,
Mips_AVER_S_H = 125,
Mips_AVER_S_W = 126,
Mips_AVER_U_B = 127,
Mips_AVER_U_D = 128,
Mips_AVER_U_H = 129,
Mips_AVER_U_W = 130,
Mips_AVE_S_B = 131,
Mips_AVE_S_D = 132,
Mips_AVE_S_H = 133,
Mips_AVE_S_W = 134,
Mips_AVE_U_B = 135,
Mips_AVE_U_D = 136,
Mips_AVE_U_H = 137,
Mips_AVE_U_W = 138,
Mips_AddiuRxImmX16 = 139,
Mips_AddiuRxPcImmX16 = 140,
Mips_AddiuRxRxImm16 = 141,
Mips_AddiuRxRxImmX16 = 142,
Mips_AddiuRxRyOffMemX16 = 143,
Mips_AddiuSpImm16 = 144,
Mips_AddiuSpImmX16 = 145,
Mips_AdduRxRyRz16 = 146,
Mips_AndRxRxRy16 = 147,
Mips_B = 148,
Mips_BALIGN = 149,
Mips_BAL_BR = 150,
Mips_BC1F = 151,
Mips_BC1T = 152,
Mips_BCLRI_B = 153,
Mips_BCLRI_D = 154,
Mips_BCLRI_H = 155,
Mips_BCLRI_W = 156,
Mips_BCLR_B = 157,
Mips_BCLR_D = 158,
Mips_BCLR_H = 159,
Mips_BCLR_W = 160,
Mips_BEQ = 161,
Mips_BEQ64 = 162,
Mips_BEQ_MM = 163,
Mips_BGEZ = 164,
Mips_BGEZ64 = 165,
Mips_BGEZAL = 166,
Mips_BGEZAL_MM = 167,
Mips_BGEZ_MM = 168,
Mips_BGTZ = 169,
Mips_BGTZ64 = 170,
Mips_BGTZ_MM = 171,
Mips_BINSLI_B = 172,
Mips_BINSLI_D = 173,
Mips_BINSLI_H = 174,
Mips_BINSLI_W = 175,
Mips_BINSL_B = 176,
Mips_BINSL_D = 177,
Mips_BINSL_H = 178,
Mips_BINSL_W = 179,
Mips_BINSRI_B = 180,
Mips_BINSRI_D = 181,
Mips_BINSRI_H = 182,
Mips_BINSRI_W = 183,
Mips_BINSR_B = 184,
Mips_BINSR_D = 185,
Mips_BINSR_H = 186,
Mips_BINSR_W = 187,
Mips_BITREV = 188,
Mips_BLEZ = 189,
Mips_BLEZ64 = 190,
Mips_BLEZ_MM = 191,
Mips_BLTZ = 192,
Mips_BLTZ64 = 193,
Mips_BLTZAL = 194,
Mips_BLTZAL_MM = 195,
Mips_BLTZ_MM = 196,
Mips_BMNZI_B = 197,
Mips_BMNZ_V = 198,
Mips_BMZI_B = 199,
Mips_BMZ_V = 200,
Mips_BNE = 201,
Mips_BNE64 = 202,
Mips_BNEGI_B = 203,
Mips_BNEGI_D = 204,
Mips_BNEGI_H = 205,
Mips_BNEGI_W = 206,
Mips_BNEG_B = 207,
Mips_BNEG_D = 208,
Mips_BNEG_H = 209,
Mips_BNEG_W = 210,
Mips_BNE_MM = 211,
Mips_BNZ_B = 212,
Mips_BNZ_D = 213,
Mips_BNZ_H = 214,
Mips_BNZ_V = 215,
Mips_BNZ_W = 216,
Mips_BPOSGE32 = 217,
Mips_BPOSGE32_PSEUDO = 218,
Mips_BREAK = 219,
Mips_BSELI_B = 220,
Mips_BSEL_D_PSEUDO = 221,
Mips_BSEL_FD_PSEUDO = 222,
Mips_BSEL_FW_PSEUDO = 223,
Mips_BSEL_H_PSEUDO = 224,
Mips_BSEL_V = 225,
Mips_BSEL_W_PSEUDO = 226,
Mips_BSETI_B = 227,
Mips_BSETI_D = 228,
Mips_BSETI_H = 229,
Mips_BSETI_W = 230,
Mips_BSET_B = 231,
Mips_BSET_D = 232,
Mips_BSET_H = 233,
Mips_BSET_W = 234,
Mips_BZ_B = 235,
Mips_BZ_D = 236,
Mips_BZ_H = 237,
Mips_BZ_V = 238,
Mips_BZ_W = 239,
Mips_BeqzRxImm16 = 240,
Mips_BeqzRxImmX16 = 241,
Mips_Bimm16 = 242,
Mips_BimmX16 = 243,
Mips_BnezRxImm16 = 244,
Mips_BnezRxImmX16 = 245,
Mips_Break16 = 246,
Mips_Bteqz16 = 247,
Mips_BteqzT8CmpX16 = 248,
Mips_BteqzT8CmpiX16 = 249,
Mips_BteqzT8SltX16 = 250,
Mips_BteqzT8SltiX16 = 251,
Mips_BteqzT8SltiuX16 = 252,
Mips_BteqzT8SltuX16 = 253,
Mips_BteqzX16 = 254,
Mips_Btnez16 = 255,
Mips_BtnezT8CmpX16 = 256,
Mips_BtnezT8CmpiX16 = 257,
Mips_BtnezT8SltX16 = 258,
Mips_BtnezT8SltiX16 = 259,
Mips_BtnezT8SltiuX16 = 260,
Mips_BtnezT8SltuX16 = 261,
Mips_BtnezX16 = 262,
Mips_BuildPairF64 = 263,
Mips_BuildPairF64_64 = 264,
Mips_CEIL_L_D64 = 265,
Mips_CEIL_L_S = 266,
Mips_CEIL_W_D32 = 267,
Mips_CEIL_W_D64 = 268,
Mips_CEIL_W_S = 269,
Mips_CEQI_B = 270,
Mips_CEQI_D = 271,
Mips_CEQI_H = 272,
Mips_CEQI_W = 273,
Mips_CEQ_B = 274,
Mips_CEQ_D = 275,
Mips_CEQ_H = 276,
Mips_CEQ_W = 277,
Mips_CFC1 = 278,
Mips_CFCMSA = 279,
Mips_CLEI_S_B = 280,
Mips_CLEI_S_D = 281,
Mips_CLEI_S_H = 282,
Mips_CLEI_S_W = 283,
Mips_CLEI_U_B = 284,
Mips_CLEI_U_D = 285,
Mips_CLEI_U_H = 286,
Mips_CLEI_U_W = 287,
Mips_CLE_S_B = 288,
Mips_CLE_S_D = 289,
Mips_CLE_S_H = 290,
Mips_CLE_S_W = 291,
Mips_CLE_U_B = 292,
Mips_CLE_U_D = 293,
Mips_CLE_U_H = 294,
Mips_CLE_U_W = 295,
Mips_CLO = 296,
Mips_CLO_MM = 297,
Mips_CLTI_S_B = 298,
Mips_CLTI_S_D = 299,
Mips_CLTI_S_H = 300,
Mips_CLTI_S_W = 301,
Mips_CLTI_U_B = 302,
Mips_CLTI_U_D = 303,
Mips_CLTI_U_H = 304,
Mips_CLTI_U_W = 305,
Mips_CLT_S_B = 306,
Mips_CLT_S_D = 307,
Mips_CLT_S_H = 308,
Mips_CLT_S_W = 309,
Mips_CLT_U_B = 310,
Mips_CLT_U_D = 311,
Mips_CLT_U_H = 312,
Mips_CLT_U_W = 313,
Mips_CLZ = 314,
Mips_CLZ_MM = 315,
Mips_CMPGDU_EQ_QB = 316,
Mips_CMPGDU_LE_QB = 317,
Mips_CMPGDU_LT_QB = 318,
Mips_CMPGU_EQ_QB = 319,
Mips_CMPGU_LE_QB = 320,
Mips_CMPGU_LT_QB = 321,
Mips_CMPU_EQ_QB = 322,
Mips_CMPU_LE_QB = 323,
Mips_CMPU_LT_QB = 324,
Mips_CMP_EQ_PH = 325,
Mips_CMP_LE_PH = 326,
Mips_CMP_LT_PH = 327,
Mips_CONSTPOOL_ENTRY = 328,
Mips_COPY_FD_PSEUDO = 329,
Mips_COPY_FW_PSEUDO = 330,
Mips_COPY_S_B = 331,
Mips_COPY_S_H = 332,
Mips_COPY_S_W = 333,
Mips_COPY_U_B = 334,
Mips_COPY_U_H = 335,
Mips_COPY_U_W = 336,
Mips_CTC1 = 337,
Mips_CTCMSA = 338,
Mips_CVT_D32_S = 339,
Mips_CVT_D32_W = 340,
Mips_CVT_D64_L = 341,
Mips_CVT_D64_S = 342,
Mips_CVT_D64_W = 343,
Mips_CVT_L_D64 = 344,
Mips_CVT_L_S = 345,
Mips_CVT_S_D32 = 346,
Mips_CVT_S_D64 = 347,
Mips_CVT_S_L = 348,
Mips_CVT_S_W = 349,
Mips_CVT_W_D32 = 350,
Mips_CVT_W_D64 = 351,
Mips_CVT_W_S = 352,
Mips_C_EQ_D32 = 353,
Mips_C_EQ_D64 = 354,
Mips_C_EQ_S = 355,
Mips_C_F_D32 = 356,
Mips_C_F_D64 = 357,
Mips_C_F_S = 358,
Mips_C_LE_D32 = 359,
Mips_C_LE_D64 = 360,
Mips_C_LE_S = 361,
Mips_C_LT_D32 = 362,
Mips_C_LT_D64 = 363,
Mips_C_LT_S = 364,
Mips_C_NGE_D32 = 365,
Mips_C_NGE_D64 = 366,
Mips_C_NGE_S = 367,
Mips_C_NGLE_D32 = 368,
Mips_C_NGLE_D64 = 369,
Mips_C_NGLE_S = 370,
Mips_C_NGL_D32 = 371,
Mips_C_NGL_D64 = 372,
Mips_C_NGL_S = 373,
Mips_C_NGT_D32 = 374,
Mips_C_NGT_D64 = 375,
Mips_C_NGT_S = 376,
Mips_C_OLE_D32 = 377,
Mips_C_OLE_D64 = 378,
Mips_C_OLE_S = 379,
Mips_C_OLT_D32 = 380,
Mips_C_OLT_D64 = 381,
Mips_C_OLT_S = 382,
Mips_C_SEQ_D32 = 383,
Mips_C_SEQ_D64 = 384,
Mips_C_SEQ_S = 385,
Mips_C_SF_D32 = 386,
Mips_C_SF_D64 = 387,
Mips_C_SF_S = 388,
Mips_C_UEQ_D32 = 389,
Mips_C_UEQ_D64 = 390,
Mips_C_UEQ_S = 391,
Mips_C_ULE_D32 = 392,
Mips_C_ULE_D64 = 393,
Mips_C_ULE_S = 394,
Mips_C_ULT_D32 = 395,
Mips_C_ULT_D64 = 396,
Mips_C_ULT_S = 397,
Mips_C_UN_D32 = 398,
Mips_C_UN_D64 = 399,
Mips_C_UN_S = 400,
Mips_CmpRxRy16 = 401,
Mips_CmpiRxImm16 = 402,
Mips_CmpiRxImmX16 = 403,
Mips_Constant32 = 404,
Mips_DADD = 405,
Mips_DADDi = 406,
Mips_DADDiu = 407,
Mips_DADDu = 408,
Mips_DCLO = 409,
Mips_DCLZ = 410,
Mips_DERET = 411,
Mips_DEXT = 412,
Mips_DEXTM = 413,
Mips_DEXTU = 414,
Mips_DI = 415,
Mips_DINS = 416,
Mips_DINSM = 417,
Mips_DINSU = 418,
Mips_DIV_S_B = 419,
Mips_DIV_S_D = 420,
Mips_DIV_S_H = 421,
Mips_DIV_S_W = 422,
Mips_DIV_U_B = 423,
Mips_DIV_U_D = 424,
Mips_DIV_U_H = 425,
Mips_DIV_U_W = 426,
Mips_DMFC0 = 427,
Mips_DMFC1 = 428,
Mips_DMFC2 = 429,
Mips_DMTC0 = 430,
Mips_DMTC1 = 431,
Mips_DMTC2 = 432,
Mips_DMULT = 433,
Mips_DMULTu = 434,
Mips_DOTP_S_D = 435,
Mips_DOTP_S_H = 436,
Mips_DOTP_S_W = 437,
Mips_DOTP_U_D = 438,
Mips_DOTP_U_H = 439,
Mips_DOTP_U_W = 440,
Mips_DPADD_S_D = 441,
Mips_DPADD_S_H = 442,
Mips_DPADD_S_W = 443,
Mips_DPADD_U_D = 444,
Mips_DPADD_U_H = 445,
Mips_DPADD_U_W = 446,
Mips_DPAQX_SA_W_PH = 447,
Mips_DPAQX_S_W_PH = 448,
Mips_DPAQ_SA_L_W = 449,
Mips_DPAQ_S_W_PH = 450,
Mips_DPAU_H_QBL = 451,
Mips_DPAU_H_QBR = 452,
Mips_DPAX_W_PH = 453,
Mips_DPA_W_PH = 454,
Mips_DPSQX_SA_W_PH = 455,
Mips_DPSQX_S_W_PH = 456,
Mips_DPSQ_SA_L_W = 457,
Mips_DPSQ_S_W_PH = 458,
Mips_DPSUB_S_D = 459,
Mips_DPSUB_S_H = 460,
Mips_DPSUB_S_W = 461,
Mips_DPSUB_U_D = 462,
Mips_DPSUB_U_H = 463,
Mips_DPSUB_U_W = 464,
Mips_DPSU_H_QBL = 465,
Mips_DPSU_H_QBR = 466,
Mips_DPSX_W_PH = 467,
Mips_DPS_W_PH = 468,
Mips_DROTR = 469,
Mips_DROTR32 = 470,
Mips_DROTRV = 471,
Mips_DSBH = 472,
Mips_DSDIV = 473,
Mips_DSHD = 474,
Mips_DSLL = 475,
Mips_DSLL32 = 476,
Mips_DSLL64_32 = 477,
Mips_DSLLV = 478,
Mips_DSRA = 479,
Mips_DSRA32 = 480,
Mips_DSRAV = 481,
Mips_DSRL = 482,
Mips_DSRL32 = 483,
Mips_DSRLV = 484,
Mips_DSUBu = 485,
Mips_DUDIV = 486,
Mips_DivRxRy16 = 487,
Mips_DivuRxRy16 = 488,
Mips_EI = 489,
Mips_ERET = 490,
Mips_EXT = 491,
Mips_EXTP = 492,
Mips_EXTPDP = 493,
Mips_EXTPDPV = 494,
Mips_EXTPV = 495,
Mips_EXTRV_RS_W = 496,
Mips_EXTRV_R_W = 497,
Mips_EXTRV_S_H = 498,
Mips_EXTRV_W = 499,
Mips_EXTR_RS_W = 500,
Mips_EXTR_R_W = 501,
Mips_EXTR_S_H = 502,
Mips_EXTR_W = 503,
Mips_EXT_MM = 504,
Mips_ExtractElementF64 = 505,
Mips_ExtractElementF64_64 = 506,
Mips_FABS_D = 507,
Mips_FABS_D32 = 508,
Mips_FABS_D64 = 509,
Mips_FABS_S = 510,
Mips_FABS_W = 511,
Mips_FADD_D = 512,
Mips_FADD_D32 = 513,
Mips_FADD_D64 = 514,
Mips_FADD_S = 515,
Mips_FADD_W = 516,
Mips_FCAF_D = 517,
Mips_FCAF_W = 518,
Mips_FCEQ_D = 519,
Mips_FCEQ_W = 520,
Mips_FCLASS_D = 521,
Mips_FCLASS_W = 522,
Mips_FCLE_D = 523,
Mips_FCLE_W = 524,
Mips_FCLT_D = 525,
Mips_FCLT_W = 526,
Mips_FCMP_D32 = 527,
Mips_FCMP_D64 = 528,
Mips_FCMP_S32 = 529,
Mips_FCNE_D = 530,
Mips_FCNE_W = 531,
Mips_FCOR_D = 532,
Mips_FCOR_W = 533,
Mips_FCUEQ_D = 534,
Mips_FCUEQ_W = 535,
Mips_FCULE_D = 536,
Mips_FCULE_W = 537,
Mips_FCULT_D = 538,
Mips_FCULT_W = 539,
Mips_FCUNE_D = 540,
Mips_FCUNE_W = 541,
Mips_FCUN_D = 542,
Mips_FCUN_W = 543,
Mips_FDIV_D = 544,
Mips_FDIV_D32 = 545,
Mips_FDIV_D64 = 546,
Mips_FDIV_S = 547,
Mips_FDIV_W = 548,
Mips_FEXDO_H = 549,
Mips_FEXDO_W = 550,
Mips_FEXP2_D = 551,
Mips_FEXP2_D_1_PSEUDO = 552,
Mips_FEXP2_W = 553,
Mips_FEXP2_W_1_PSEUDO = 554,
Mips_FEXUPL_D = 555,
Mips_FEXUPL_W = 556,
Mips_FEXUPR_D = 557,
Mips_FEXUPR_W = 558,
Mips_FFINT_S_D = 559,
Mips_FFINT_S_W = 560,
Mips_FFINT_U_D = 561,
Mips_FFINT_U_W = 562,
Mips_FFQL_D = 563,
Mips_FFQL_W = 564,
Mips_FFQR_D = 565,
Mips_FFQR_W = 566,
Mips_FILL_B = 567,
Mips_FILL_FD_PSEUDO = 568,
Mips_FILL_FW_PSEUDO = 569,
Mips_FILL_H = 570,
Mips_FILL_W = 571,
Mips_FLOG2_D = 572,
Mips_FLOG2_W = 573,
Mips_FLOOR_L_D64 = 574,
Mips_FLOOR_L_S = 575,
Mips_FLOOR_W_D32 = 576,
Mips_FLOOR_W_D64 = 577,
Mips_FLOOR_W_S = 578,
Mips_FMADD_D = 579,
Mips_FMADD_W = 580,
Mips_FMAX_A_D = 581,
Mips_FMAX_A_W = 582,
Mips_FMAX_D = 583,
Mips_FMAX_W = 584,
Mips_FMIN_A_D = 585,
Mips_FMIN_A_W = 586,
Mips_FMIN_D = 587,
Mips_FMIN_W = 588,
Mips_FMOV_D32 = 589,
Mips_FMOV_D64 = 590,
Mips_FMOV_S = 591,
Mips_FMSUB_D = 592,
Mips_FMSUB_W = 593,
Mips_FMUL_D = 594,
Mips_FMUL_D32 = 595,
Mips_FMUL_D64 = 596,
Mips_FMUL_S = 597,
Mips_FMUL_W = 598,
Mips_FNEG_D32 = 599,
Mips_FNEG_D64 = 600,
Mips_FNEG_S = 601,
Mips_FRCP_D = 602,
Mips_FRCP_W = 603,
Mips_FRINT_D = 604,
Mips_FRINT_W = 605,
Mips_FRSQRT_D = 606,
Mips_FRSQRT_W = 607,
Mips_FSAF_D = 608,
Mips_FSAF_W = 609,
Mips_FSEQ_D = 610,
Mips_FSEQ_W = 611,
Mips_FSLE_D = 612,
Mips_FSLE_W = 613,
Mips_FSLT_D = 614,
Mips_FSLT_W = 615,
Mips_FSNE_D = 616,
Mips_FSNE_W = 617,
Mips_FSOR_D = 618,
Mips_FSOR_W = 619,
Mips_FSQRT_D = 620,
Mips_FSQRT_D32 = 621,
Mips_FSQRT_D64 = 622,
Mips_FSQRT_S = 623,
Mips_FSQRT_W = 624,
Mips_FSUB_D = 625,
Mips_FSUB_D32 = 626,
Mips_FSUB_D64 = 627,
Mips_FSUB_S = 628,
Mips_FSUB_W = 629,
Mips_FSUEQ_D = 630,
Mips_FSUEQ_W = 631,
Mips_FSULE_D = 632,
Mips_FSULE_W = 633,
Mips_FSULT_D = 634,
Mips_FSULT_W = 635,
Mips_FSUNE_D = 636,
Mips_FSUNE_W = 637,
Mips_FSUN_D = 638,
Mips_FSUN_W = 639,
Mips_FTINT_S_D = 640,
Mips_FTINT_S_W = 641,
Mips_FTINT_U_D = 642,
Mips_FTINT_U_W = 643,
Mips_FTQ_H = 644,
Mips_FTQ_W = 645,
Mips_FTRUNC_S_D = 646,
Mips_FTRUNC_S_W = 647,
Mips_FTRUNC_U_D = 648,
Mips_FTRUNC_U_W = 649,
Mips_GotPrologue16 = 650,
Mips_HADD_S_D = 651,
Mips_HADD_S_H = 652,
Mips_HADD_S_W = 653,
Mips_HADD_U_D = 654,
Mips_HADD_U_H = 655,
Mips_HADD_U_W = 656,
Mips_HSUB_S_D = 657,
Mips_HSUB_S_H = 658,
Mips_HSUB_S_W = 659,
Mips_HSUB_U_D = 660,
Mips_HSUB_U_H = 661,
Mips_HSUB_U_W = 662,
Mips_ILVEV_B = 663,
Mips_ILVEV_D = 664,
Mips_ILVEV_H = 665,
Mips_ILVEV_W = 666,
Mips_ILVL_B = 667,
Mips_ILVL_D = 668,
Mips_ILVL_H = 669,
Mips_ILVL_W = 670,
Mips_ILVOD_B = 671,
Mips_ILVOD_D = 672,
Mips_ILVOD_H = 673,
Mips_ILVOD_W = 674,
Mips_ILVR_B = 675,
Mips_ILVR_D = 676,
Mips_ILVR_H = 677,
Mips_ILVR_W = 678,
Mips_INS = 679,
Mips_INSERT_B = 680,
Mips_INSERT_FD_PSEUDO = 681,
Mips_INSERT_FW_PSEUDO = 682,
Mips_INSERT_H = 683,
Mips_INSERT_W = 684,
Mips_INSV = 685,
Mips_INSVE_B = 686,
Mips_INSVE_D = 687,
Mips_INSVE_H = 688,
Mips_INSVE_W = 689,
Mips_INS_MM = 690,
Mips_J = 691,
Mips_JAL = 692,
Mips_JALR = 693,
Mips_JALR64 = 694,
Mips_JALR64Pseudo = 695,
Mips_JALRPseudo = 696,
Mips_JALR_MM = 697,
Mips_JAL_MM = 698,
Mips_JR = 699,
Mips_JR64 = 700,
Mips_JR_MM = 701,
Mips_J_MM = 702,
Mips_Jal16 = 703,
Mips_JalB16 = 704,
Mips_JrRa16 = 705,
Mips_JrcRa16 = 706,
Mips_JrcRx16 = 707,
Mips_JumpLinkReg16 = 708,
Mips_LB = 709,
Mips_LB64 = 710,
Mips_LBUX = 711,
Mips_LB_MM = 712,
Mips_LBu = 713,
Mips_LBu64 = 714,
Mips_LBu_MM = 715,
Mips_LD = 716,
Mips_LDC1 = 717,
Mips_LDC164 = 718,
Mips_LDC2 = 719,
Mips_LDI_B = 720,
Mips_LDI_D = 721,
Mips_LDI_H = 722,
Mips_LDI_W = 723,
Mips_LDL = 724,
Mips_LDR = 725,
Mips_LDXC1 = 726,
Mips_LDXC164 = 727,
Mips_LD_B = 728,
Mips_LD_D = 729,
Mips_LD_H = 730,
Mips_LD_W = 731,
Mips_LEA_ADDiu = 732,
Mips_LEA_ADDiu64 = 733,
Mips_LH = 734,
Mips_LH64 = 735,
Mips_LHX = 736,
Mips_LH_MM = 737,
Mips_LHu = 738,
Mips_LHu64 = 739,
Mips_LHu_MM = 740,
Mips_LL = 741,
Mips_LLD = 742,
Mips_LOAD_ACC128 = 743,
Mips_LOAD_ACC64 = 744,
Mips_LOAD_ACC64DSP = 745,
Mips_LOAD_CCOND_DSP = 746,
Mips_LSA = 747,
Mips_LUXC1 = 748,
Mips_LUXC164 = 749,
Mips_LUi = 750,
Mips_LUi64 = 751,
Mips_LUi_MM = 752,
Mips_LW = 753,
Mips_LW64 = 754,
Mips_LWC1 = 755,
Mips_LWC2 = 756,
Mips_LWL = 757,
Mips_LWL64 = 758,
Mips_LWL_MM = 759,
Mips_LWR = 760,
Mips_LWR64 = 761,
Mips_LWR_MM = 762,
Mips_LWX = 763,
Mips_LWXC1 = 764,
Mips_LW_MM = 765,
Mips_LWu = 766,
Mips_LbRxRyOffMemX16 = 767,
Mips_LbuRxRyOffMemX16 = 768,
Mips_LhRxRyOffMemX16 = 769,
Mips_LhuRxRyOffMemX16 = 770,
Mips_LiRxImm16 = 771,
Mips_LiRxImmAlignX16 = 772,
Mips_LiRxImmX16 = 773,
Mips_LoadAddr32Imm = 774,
Mips_LoadAddr32Reg = 775,
Mips_LoadImm32Reg = 776,
Mips_LwConstant32 = 777,
Mips_LwRxPcTcp16 = 778,
Mips_LwRxPcTcpX16 = 779,
Mips_LwRxRyOffMemX16 = 780,
Mips_LwRxSpImmX16 = 781,
Mips_MADD = 782,
Mips_MADDR_Q_H = 783,
Mips_MADDR_Q_W = 784,
Mips_MADDU = 785,
Mips_MADDU_DSP = 786,
Mips_MADDU_MM = 787,
Mips_MADDV_B = 788,
Mips_MADDV_D = 789,
Mips_MADDV_H = 790,
Mips_MADDV_W = 791,
Mips_MADD_D32 = 792,
Mips_MADD_D64 = 793,
Mips_MADD_DSP = 794,
Mips_MADD_MM = 795,
Mips_MADD_Q_H = 796,
Mips_MADD_Q_W = 797,
Mips_MADD_S = 798,
Mips_MAQ_SA_W_PHL = 799,
Mips_MAQ_SA_W_PHR = 800,
Mips_MAQ_S_W_PHL = 801,
Mips_MAQ_S_W_PHR = 802,
Mips_MAXI_S_B = 803,
Mips_MAXI_S_D = 804,
Mips_MAXI_S_H = 805,
Mips_MAXI_S_W = 806,
Mips_MAXI_U_B = 807,
Mips_MAXI_U_D = 808,
Mips_MAXI_U_H = 809,
Mips_MAXI_U_W = 810,
Mips_MAX_A_B = 811,
Mips_MAX_A_D = 812,
Mips_MAX_A_H = 813,
Mips_MAX_A_W = 814,
Mips_MAX_S_B = 815,
Mips_MAX_S_D = 816,
Mips_MAX_S_H = 817,
Mips_MAX_S_W = 818,
Mips_MAX_U_B = 819,
Mips_MAX_U_D = 820,
Mips_MAX_U_H = 821,
Mips_MAX_U_W = 822,
Mips_MFC0 = 823,
Mips_MFC1 = 824,
Mips_MFC2 = 825,
Mips_MFHC1 = 826,
Mips_MFHI = 827,
Mips_MFHI64 = 828,
Mips_MFHI_DSP = 829,
Mips_MFHI_MM = 830,
Mips_MFLO = 831,
Mips_MFLO64 = 832,
Mips_MFLO_DSP = 833,
Mips_MFLO_MM = 834,
Mips_MINI_S_B = 835,
Mips_MINI_S_D = 836,
Mips_MINI_S_H = 837,
Mips_MINI_S_W = 838,
Mips_MINI_U_B = 839,
Mips_MINI_U_D = 840,
Mips_MINI_U_H = 841,
Mips_MINI_U_W = 842,
Mips_MIN_A_B = 843,
Mips_MIN_A_D = 844,
Mips_MIN_A_H = 845,
Mips_MIN_A_W = 846,
Mips_MIN_S_B = 847,
Mips_MIN_S_D = 848,
Mips_MIN_S_H = 849,
Mips_MIN_S_W = 850,
Mips_MIN_U_B = 851,
Mips_MIN_U_D = 852,
Mips_MIN_U_H = 853,
Mips_MIN_U_W = 854,
Mips_MIPSeh_return32 = 855,
Mips_MIPSeh_return64 = 856,
Mips_MODSUB = 857,
Mips_MOD_S_B = 858,
Mips_MOD_S_D = 859,
Mips_MOD_S_H = 860,
Mips_MOD_S_W = 861,
Mips_MOD_U_B = 862,
Mips_MOD_U_D = 863,
Mips_MOD_U_H = 864,
Mips_MOD_U_W = 865,
Mips_MOVE_V = 866,
Mips_MOVF_D32 = 867,
Mips_MOVF_D64 = 868,
Mips_MOVF_I = 869,
Mips_MOVF_I64 = 870,
Mips_MOVF_I_MM = 871,
Mips_MOVF_S = 872,
Mips_MOVN_I64_D64 = 873,
Mips_MOVN_I64_I = 874,
Mips_MOVN_I64_I64 = 875,
Mips_MOVN_I64_S = 876,
Mips_MOVN_I_D32 = 877,
Mips_MOVN_I_D64 = 878,
Mips_MOVN_I_I = 879,
Mips_MOVN_I_I64 = 880,
Mips_MOVN_I_MM = 881,
Mips_MOVN_I_S = 882,
Mips_MOVT_D32 = 883,
Mips_MOVT_D64 = 884,
Mips_MOVT_I = 885,
Mips_MOVT_I64 = 886,
Mips_MOVT_I_MM = 887,
Mips_MOVT_S = 888,
Mips_MOVZ_I64_D64 = 889,
Mips_MOVZ_I64_I = 890,
Mips_MOVZ_I64_I64 = 891,
Mips_MOVZ_I64_S = 892,
Mips_MOVZ_I_D32 = 893,
Mips_MOVZ_I_D64 = 894,
Mips_MOVZ_I_I = 895,
Mips_MOVZ_I_I64 = 896,
Mips_MOVZ_I_MM = 897,
Mips_MOVZ_I_S = 898,
Mips_MSUB = 899,
Mips_MSUBR_Q_H = 900,
Mips_MSUBR_Q_W = 901,
Mips_MSUBU = 902,
Mips_MSUBU_DSP = 903,
Mips_MSUBU_MM = 904,
Mips_MSUBV_B = 905,
Mips_MSUBV_D = 906,
Mips_MSUBV_H = 907,
Mips_MSUBV_W = 908,
Mips_MSUB_D32 = 909,
Mips_MSUB_D64 = 910,
Mips_MSUB_DSP = 911,
Mips_MSUB_MM = 912,
Mips_MSUB_Q_H = 913,
Mips_MSUB_Q_W = 914,
Mips_MSUB_S = 915,
Mips_MTC0 = 916,
Mips_MTC1 = 917,
Mips_MTC2 = 918,
Mips_MTHC1 = 919,
Mips_MTHI = 920,
Mips_MTHI64 = 921,
Mips_MTHI_DSP = 922,
Mips_MTHI_MM = 923,
Mips_MTHLIP = 924,
Mips_MTLO = 925,
Mips_MTLO64 = 926,
Mips_MTLO_DSP = 927,
Mips_MTLO_MM = 928,
Mips_MUL = 929,
Mips_MULEQ_S_W_PHL = 930,
Mips_MULEQ_S_W_PHR = 931,
Mips_MULEU_S_PH_QBL = 932,
Mips_MULEU_S_PH_QBR = 933,
Mips_MULQ_RS_PH = 934,
Mips_MULQ_RS_W = 935,
Mips_MULQ_S_PH = 936,
Mips_MULQ_S_W = 937,
Mips_MULR_Q_H = 938,
Mips_MULR_Q_W = 939,
Mips_MULSAQ_S_W_PH = 940,
Mips_MULSA_W_PH = 941,
Mips_MULT = 942,
Mips_MULTU_DSP = 943,
Mips_MULT_DSP = 944,
Mips_MULT_MM = 945,
Mips_MULTu = 946,
Mips_MULTu_MM = 947,
Mips_MULV_B = 948,
Mips_MULV_D = 949,
Mips_MULV_H = 950,
Mips_MULV_W = 951,
Mips_MUL_MM = 952,
Mips_MUL_PH = 953,
Mips_MUL_Q_H = 954,
Mips_MUL_Q_W = 955,
Mips_MUL_S_PH = 956,
Mips_Mfhi16 = 957,
Mips_Mflo16 = 958,
Mips_Move32R16 = 959,
Mips_MoveR3216 = 960,
Mips_MultRxRy16 = 961,
Mips_MultRxRyRz16 = 962,
Mips_MultuRxRy16 = 963,
Mips_MultuRxRyRz16 = 964,
Mips_NLOC_B = 965,
Mips_NLOC_D = 966,
Mips_NLOC_H = 967,
Mips_NLOC_W = 968,
Mips_NLZC_B = 969,
Mips_NLZC_D = 970,
Mips_NLZC_H = 971,
Mips_NLZC_W = 972,
Mips_NMADD_D32 = 973,
Mips_NMADD_D64 = 974,
Mips_NMADD_S = 975,
Mips_NMSUB_D32 = 976,
Mips_NMSUB_D64 = 977,
Mips_NMSUB_S = 978,
Mips_NOP = 979,
Mips_NOR = 980,
Mips_NOR64 = 981,
Mips_NORI_B = 982,
Mips_NOR_MM = 983,
Mips_NOR_V = 984,
Mips_NOR_V_D_PSEUDO = 985,
Mips_NOR_V_H_PSEUDO = 986,
Mips_NOR_V_W_PSEUDO = 987,
Mips_NegRxRy16 = 988,
Mips_NotRxRy16 = 989,
Mips_OR = 990,
Mips_OR64 = 991,
Mips_ORI_B = 992,
Mips_OR_MM = 993,
Mips_OR_V = 994,
Mips_OR_V_D_PSEUDO = 995,
Mips_OR_V_H_PSEUDO = 996,
Mips_OR_V_W_PSEUDO = 997,
Mips_ORi = 998,
Mips_ORi64 = 999,
Mips_ORi_MM = 1000,
Mips_OrRxRxRy16 = 1001,
Mips_PACKRL_PH = 1002,
Mips_PCKEV_B = 1003,
Mips_PCKEV_D = 1004,
Mips_PCKEV_H = 1005,
Mips_PCKEV_W = 1006,
Mips_PCKOD_B = 1007,
Mips_PCKOD_D = 1008,
Mips_PCKOD_H = 1009,
Mips_PCKOD_W = 1010,
Mips_PCNT_B = 1011,
Mips_PCNT_D = 1012,
Mips_PCNT_H = 1013,
Mips_PCNT_W = 1014,
Mips_PICK_PH = 1015,
Mips_PICK_QB = 1016,
Mips_PRECEQU_PH_QBL = 1017,
Mips_PRECEQU_PH_QBLA = 1018,
Mips_PRECEQU_PH_QBR = 1019,
Mips_PRECEQU_PH_QBRA = 1020,
Mips_PRECEQ_W_PHL = 1021,
Mips_PRECEQ_W_PHR = 1022,
Mips_PRECEU_PH_QBL = 1023,
Mips_PRECEU_PH_QBLA = 1024,
Mips_PRECEU_PH_QBR = 1025,
Mips_PRECEU_PH_QBRA = 1026,
Mips_PRECRQU_S_QB_PH = 1027,
Mips_PRECRQ_PH_W = 1028,
Mips_PRECRQ_QB_PH = 1029,
Mips_PRECRQ_RS_PH_W = 1030,
Mips_PRECR_QB_PH = 1031,
Mips_PRECR_SRA_PH_W = 1032,
Mips_PRECR_SRA_R_PH_W = 1033,
Mips_PREPEND = 1034,
Mips_PseudoCMPU_EQ_QB = 1035,
Mips_PseudoCMPU_LE_QB = 1036,
Mips_PseudoCMPU_LT_QB = 1037,
Mips_PseudoCMP_EQ_PH = 1038,
Mips_PseudoCMP_LE_PH = 1039,
Mips_PseudoCMP_LT_PH = 1040,
Mips_PseudoCVT_D32_W = 1041,
Mips_PseudoCVT_D64_L = 1042,
Mips_PseudoCVT_D64_W = 1043,
Mips_PseudoCVT_S_L = 1044,
Mips_PseudoCVT_S_W = 1045,
Mips_PseudoDMULT = 1046,
Mips_PseudoDMULTu = 1047,
Mips_PseudoDSDIV = 1048,
Mips_PseudoDUDIV = 1049,
Mips_PseudoMADD = 1050,
Mips_PseudoMADDU = 1051,
Mips_PseudoMFHI = 1052,
Mips_PseudoMFHI64 = 1053,
Mips_PseudoMFLO = 1054,
Mips_PseudoMFLO64 = 1055,
Mips_PseudoMSUB = 1056,
Mips_PseudoMSUBU = 1057,
Mips_PseudoMTLOHI = 1058,
Mips_PseudoMTLOHI64 = 1059,
Mips_PseudoMTLOHI_DSP = 1060,
Mips_PseudoMULT = 1061,
Mips_PseudoMULTu = 1062,
Mips_PseudoPICK_PH = 1063,
Mips_PseudoPICK_QB = 1064,
Mips_PseudoSDIV = 1065,
Mips_PseudoUDIV = 1066,
Mips_RADDU_W_QB = 1067,
Mips_RDDSP = 1068,
Mips_RDHWR = 1069,
Mips_RDHWR64 = 1070,
Mips_REPLV_PH = 1071,
Mips_REPLV_QB = 1072,
Mips_REPL_PH = 1073,
Mips_REPL_QB = 1074,
Mips_RET = 1075,
Mips_RET_MM = 1076,
Mips_ROTR = 1077,
Mips_ROTRV = 1078,
Mips_ROTRV_MM = 1079,
Mips_ROTR_MM = 1080,
Mips_ROUND_L_D64 = 1081,
Mips_ROUND_L_S = 1082,
Mips_ROUND_W_D32 = 1083,
Mips_ROUND_W_D64 = 1084,
Mips_ROUND_W_S = 1085,
Mips_RestoreIncSpF16 = 1086,
Mips_RestoreRaF16 = 1087,
Mips_RetRA = 1088,
Mips_RetRA16 = 1089,
Mips_SAT_S_B = 1090,
Mips_SAT_S_D = 1091,
Mips_SAT_S_H = 1092,
Mips_SAT_S_W = 1093,
Mips_SAT_U_B = 1094,
Mips_SAT_U_D = 1095,
Mips_SAT_U_H = 1096,
Mips_SAT_U_W = 1097,
Mips_SB = 1098,
Mips_SB64 = 1099,
Mips_SB_MM = 1100,
Mips_SC = 1101,
Mips_SCD = 1102,
Mips_SD = 1103,
Mips_SDC1 = 1104,
Mips_SDC164 = 1105,
Mips_SDC2 = 1106,
Mips_SDIV = 1107,
Mips_SDIV_MM = 1108,
Mips_SDL = 1109,
Mips_SDR = 1110,
Mips_SDXC1 = 1111,
Mips_SDXC164 = 1112,
Mips_SEB = 1113,
Mips_SEB64 = 1114,
Mips_SEB_MM = 1115,
Mips_SEH = 1116,
Mips_SEH64 = 1117,
Mips_SEH_MM = 1118,
Mips_SH = 1119,
Mips_SH64 = 1120,
Mips_SHF_B = 1121,
Mips_SHF_H = 1122,
Mips_SHF_W = 1123,
Mips_SHILO = 1124,
Mips_SHILOV = 1125,
Mips_SHLLV_PH = 1126,
Mips_SHLLV_QB = 1127,
Mips_SHLLV_S_PH = 1128,
Mips_SHLLV_S_W = 1129,
Mips_SHLL_PH = 1130,
Mips_SHLL_QB = 1131,
Mips_SHLL_S_PH = 1132,
Mips_SHLL_S_W = 1133,
Mips_SHRAV_PH = 1134,
Mips_SHRAV_QB = 1135,
Mips_SHRAV_R_PH = 1136,
Mips_SHRAV_R_QB = 1137,
Mips_SHRAV_R_W = 1138,
Mips_SHRA_PH = 1139,
Mips_SHRA_QB = 1140,
Mips_SHRA_R_PH = 1141,
Mips_SHRA_R_QB = 1142,
Mips_SHRA_R_W = 1143,
Mips_SHRLV_PH = 1144,
Mips_SHRLV_QB = 1145,
Mips_SHRL_PH = 1146,
Mips_SHRL_QB = 1147,
Mips_SH_MM = 1148,
Mips_SLDI_B = 1149,
Mips_SLDI_D = 1150,
Mips_SLDI_H = 1151,
Mips_SLDI_W = 1152,
Mips_SLD_B = 1153,
Mips_SLD_D = 1154,
Mips_SLD_H = 1155,
Mips_SLD_W = 1156,
Mips_SLL = 1157,
Mips_SLL64_32 = 1158,
Mips_SLL64_64 = 1159,
Mips_SLLI_B = 1160,
Mips_SLLI_D = 1161,
Mips_SLLI_H = 1162,
Mips_SLLI_W = 1163,
Mips_SLLV = 1164,
Mips_SLLV_MM = 1165,
Mips_SLL_B = 1166,
Mips_SLL_D = 1167,
Mips_SLL_H = 1168,
Mips_SLL_MM = 1169,
Mips_SLL_W = 1170,
Mips_SLT = 1171,
Mips_SLT64 = 1172,
Mips_SLT_MM = 1173,
Mips_SLTi = 1174,
Mips_SLTi64 = 1175,
Mips_SLTi_MM = 1176,
Mips_SLTiu = 1177,
Mips_SLTiu64 = 1178,
Mips_SLTiu_MM = 1179,
Mips_SLTu = 1180,
Mips_SLTu64 = 1181,
Mips_SLTu_MM = 1182,
Mips_SNZ_B_PSEUDO = 1183,
Mips_SNZ_D_PSEUDO = 1184,
Mips_SNZ_H_PSEUDO = 1185,
Mips_SNZ_V_PSEUDO = 1186,
Mips_SNZ_W_PSEUDO = 1187,
Mips_SPLATI_B = 1188,
Mips_SPLATI_D = 1189,
Mips_SPLATI_H = 1190,
Mips_SPLATI_W = 1191,
Mips_SPLAT_B = 1192,
Mips_SPLAT_D = 1193,
Mips_SPLAT_H = 1194,
Mips_SPLAT_W = 1195,
Mips_SRA = 1196,
Mips_SRAI_B = 1197,
Mips_SRAI_D = 1198,
Mips_SRAI_H = 1199,
Mips_SRAI_W = 1200,
Mips_SRARI_B = 1201,
Mips_SRARI_D = 1202,
Mips_SRARI_H = 1203,
Mips_SRARI_W = 1204,
Mips_SRAR_B = 1205,
Mips_SRAR_D = 1206,
Mips_SRAR_H = 1207,
Mips_SRAR_W = 1208,
Mips_SRAV = 1209,
Mips_SRAV_MM = 1210,
Mips_SRA_B = 1211,
Mips_SRA_D = 1212,
Mips_SRA_H = 1213,
Mips_SRA_MM = 1214,
Mips_SRA_W = 1215,
Mips_SRL = 1216,
Mips_SRLI_B = 1217,
Mips_SRLI_D = 1218,
Mips_SRLI_H = 1219,
Mips_SRLI_W = 1220,
Mips_SRLRI_B = 1221,
Mips_SRLRI_D = 1222,
Mips_SRLRI_H = 1223,
Mips_SRLRI_W = 1224,
Mips_SRLR_B = 1225,
Mips_SRLR_D = 1226,
Mips_SRLR_H = 1227,
Mips_SRLR_W = 1228,
Mips_SRLV = 1229,
Mips_SRLV_MM = 1230,
Mips_SRL_B = 1231,
Mips_SRL_D = 1232,
Mips_SRL_H = 1233,
Mips_SRL_MM = 1234,
Mips_SRL_W = 1235,
Mips_STORE_ACC128 = 1236,
Mips_STORE_ACC64 = 1237,
Mips_STORE_ACC64DSP = 1238,
Mips_STORE_CCOND_DSP = 1239,
Mips_ST_B = 1240,
Mips_ST_D = 1241,
Mips_ST_H = 1242,
Mips_ST_W = 1243,
Mips_SUB = 1244,
Mips_SUBQH_PH = 1245,
Mips_SUBQH_R_PH = 1246,
Mips_SUBQH_R_W = 1247,
Mips_SUBQH_W = 1248,
Mips_SUBQ_PH = 1249,
Mips_SUBQ_S_PH = 1250,
Mips_SUBQ_S_W = 1251,
Mips_SUBSUS_U_B = 1252,
Mips_SUBSUS_U_D = 1253,
Mips_SUBSUS_U_H = 1254,
Mips_SUBSUS_U_W = 1255,
Mips_SUBSUU_S_B = 1256,
Mips_SUBSUU_S_D = 1257,
Mips_SUBSUU_S_H = 1258,
Mips_SUBSUU_S_W = 1259,
Mips_SUBS_S_B = 1260,
Mips_SUBS_S_D = 1261,
Mips_SUBS_S_H = 1262,
Mips_SUBS_S_W = 1263,
Mips_SUBS_U_B = 1264,
Mips_SUBS_U_D = 1265,
Mips_SUBS_U_H = 1266,
Mips_SUBS_U_W = 1267,
Mips_SUBUH_QB = 1268,
Mips_SUBUH_R_QB = 1269,
Mips_SUBU_PH = 1270,
Mips_SUBU_QB = 1271,
Mips_SUBU_S_PH = 1272,
Mips_SUBU_S_QB = 1273,
Mips_SUBVI_B = 1274,
Mips_SUBVI_D = 1275,
Mips_SUBVI_H = 1276,
Mips_SUBVI_W = 1277,
Mips_SUBV_B = 1278,
Mips_SUBV_D = 1279,
Mips_SUBV_H = 1280,
Mips_SUBV_W = 1281,
Mips_SUB_MM = 1282,
Mips_SUBu = 1283,
Mips_SUBu_MM = 1284,
Mips_SUXC1 = 1285,
Mips_SUXC164 = 1286,
Mips_SW = 1287,
Mips_SW64 = 1288,
Mips_SWC1 = 1289,
Mips_SWC2 = 1290,
Mips_SWL = 1291,
Mips_SWL64 = 1292,
Mips_SWL_MM = 1293,
Mips_SWR = 1294,
Mips_SWR64 = 1295,
Mips_SWR_MM = 1296,
Mips_SWXC1 = 1297,
Mips_SW_MM = 1298,
Mips_SYNC = 1299,
Mips_SYSCALL = 1300,
Mips_SZ_B_PSEUDO = 1301,
Mips_SZ_D_PSEUDO = 1302,
Mips_SZ_H_PSEUDO = 1303,
Mips_SZ_V_PSEUDO = 1304,
Mips_SZ_W_PSEUDO = 1305,
Mips_SaveDecSpF16 = 1306,
Mips_SaveRaF16 = 1307,
Mips_SbRxRyOffMemX16 = 1308,
Mips_SebRx16 = 1309,
Mips_SehRx16 = 1310,
Mips_SelBeqZ = 1311,
Mips_SelBneZ = 1312,
Mips_SelTBteqZCmp = 1313,
Mips_SelTBteqZCmpi = 1314,
Mips_SelTBteqZSlt = 1315,
Mips_SelTBteqZSlti = 1316,
Mips_SelTBteqZSltiu = 1317,
Mips_SelTBteqZSltu = 1318,
Mips_SelTBtneZCmp = 1319,
Mips_SelTBtneZCmpi = 1320,
Mips_SelTBtneZSlt = 1321,
Mips_SelTBtneZSlti = 1322,
Mips_SelTBtneZSltiu = 1323,
Mips_SelTBtneZSltu = 1324,
Mips_ShRxRyOffMemX16 = 1325,
Mips_SllX16 = 1326,
Mips_SllvRxRy16 = 1327,
Mips_SltCCRxRy16 = 1328,
Mips_SltRxRy16 = 1329,
Mips_SltiCCRxImmX16 = 1330,
Mips_SltiRxImm16 = 1331,
Mips_SltiRxImmX16 = 1332,
Mips_SltiuCCRxImmX16 = 1333,
Mips_SltiuRxImm16 = 1334,
Mips_SltiuRxImmX16 = 1335,
Mips_SltuCCRxRy16 = 1336,
Mips_SltuRxRy16 = 1337,
Mips_SltuRxRyRz16 = 1338,
Mips_SraX16 = 1339,
Mips_SravRxRy16 = 1340,
Mips_SrlX16 = 1341,
Mips_SrlvRxRy16 = 1342,
Mips_SubuRxRyRz16 = 1343,
Mips_SwRxRyOffMemX16 = 1344,
Mips_SwRxSpImmX16 = 1345,
Mips_TAILCALL = 1346,
Mips_TAILCALL64_R = 1347,
Mips_TAILCALL_R = 1348,
Mips_TEQ = 1349,
Mips_TEQI = 1350,
Mips_TEQI_MM = 1351,
Mips_TEQ_MM = 1352,
Mips_TGE = 1353,
Mips_TGEI = 1354,
Mips_TGEIU = 1355,
Mips_TGEIU_MM = 1356,
Mips_TGEI_MM = 1357,
Mips_TGEU = 1358,
Mips_TGEU_MM = 1359,
Mips_TGE_MM = 1360,
Mips_TLT = 1361,
Mips_TLTI = 1362,
Mips_TLTIU_MM = 1363,
Mips_TLTI_MM = 1364,
Mips_TLTU = 1365,
Mips_TLTU_MM = 1366,
Mips_TLT_MM = 1367,
Mips_TNE = 1368,
Mips_TNEI = 1369,
Mips_TNEI_MM = 1370,
Mips_TNE_MM = 1371,
Mips_TRAP = 1372,
Mips_TRUNC_L_D64 = 1373,
Mips_TRUNC_L_S = 1374,
Mips_TRUNC_W_D32 = 1375,
Mips_TRUNC_W_D64 = 1376,
Mips_TRUNC_W_S = 1377,
Mips_TTLTIU = 1378,
Mips_UDIV = 1379,
Mips_UDIV_MM = 1380,
Mips_VSHF_B = 1381,
Mips_VSHF_D = 1382,
Mips_VSHF_H = 1383,
Mips_VSHF_W = 1384,
Mips_WAIT = 1385,
Mips_WRDSP = 1386,
Mips_WSBH = 1387,
Mips_WSBH_MM = 1388,
Mips_XOR = 1389,
Mips_XOR64 = 1390,
Mips_XORI_B = 1391,
Mips_XOR_MM = 1392,
Mips_XOR_V = 1393,
Mips_XOR_V_D_PSEUDO = 1394,
Mips_XOR_V_H_PSEUDO = 1395,
Mips_XOR_V_W_PSEUDO = 1396,
Mips_XORi = 1397,
Mips_XORi64 = 1398,
Mips_XORi_MM = 1399,
Mips_XorRxRxRy16 = 1400,
Mips_INSTRUCTION_LIST_END = 1401
};
#endif // GET_INSTRINFO_ENUM
| [
"aquynh@gmail.com"
] | aquynh@gmail.com |
57a9543ec8ee63b5d4fe58848e2a4288afbfaa9e | d241a07c8fa1875da6e5858f2babb3377e782247 | /CustomSerialNumber/CustomSerialNumber/Item.cpp | 3ffe4f2f0c4e261711f51588082dfeadbb7d5b7f | [] | no_license | allenhuangxj/CustomerSerialNumberTools | 6d4626284b644bbc0be7dce874ff7cfd73d18f10 | 4d122cb2c8e6086967dfb3c373224f5ca42da189 | refs/heads/main | 2023-07-08T01:02:04.326599 | 2021-08-19T13:28:28 | 2021-08-19T13:28:28 | 397,488,325 | 0 | 0 | null | 2021-08-18T05:52:10 | 2021-08-18T05:52:10 | null | UTF-8 | C++ | false | false | 484 | cpp | #include "stdafx.h"
#include "Item.h"
IMPLEMENT_SERIAL(CItem, CObject, 1)
CItem::CItem()
{
}
CItem::~CItem()
{
}
void CItem::Serialize(CArchive& archive)
{
CObject::Serialize(archive);
if (archive.IsStoring())
{
archive << Type << Value;
}
else
{
int nType;
archive >> nType >> Value;
Type = (ItemType)nType;
}
}
CString CItem::ToString()
{
return Value;
}
BOOL CItem::Plus(int nloop)
{
return TRUE;
}
void CItem::Clear()
{
}
void CItem::Clone(CItem& ct)
{
} | [
"allenhuangxj@sina.cn"
] | allenhuangxj@sina.cn |
eb6f80c4a1021aa63bab9c96bc68c73620f5d245 | 5c8645d9c4deee4e77c7a9ca649d24c49794ce6f | /CPP/401-500/Q438_FindAllAnagramsInString_Hashmap.cpp | 4800e4ba82f9c603baf195ce788c90e50823a760 | [] | no_license | XiandaChen/LeetCode | 51e9c851f739a5e47195745a2dddc87462a0efbf | fb8b5c67b3876f4a6752cdbe8c8b8979e185ab93 | refs/heads/master | 2022-10-23T20:34:56.375847 | 2022-10-17T06:06:27 | 2022-10-17T06:06:27 | 205,062,375 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 715 | cpp | class Solution {
public:
vector<int> findAnagrams(string s, string p) {
if (s.empty()) return {};
unordered_map<char, int> ms, mp; // char-num
vector<int> res;
// first chars of size of p.size()
for (int i = 0; i < p.size(); ++i) {
++ms[s[i]]; ++mp[p[i]];
}
// if ms==mp
if (ms == mp) res.push_back(0);
// rest chars after p.size()
for (int i = p.size(); i < s.size(); ++i) {
// move the window forward by one char
if (--ms[s[i - p.size()]] == 0) ms.erase(s[i - p.size()]);
++ms[s[i]];
if (ms == mp) res.push_back(i - p.size() + 1);
}
return res;
}
}; | [
"xuc23@psu.edu"
] | xuc23@psu.edu |
b741d358d70ea870f60f6f87932da8b7cc85e14f | 8eae6774231f4a313e7aa8ac30d5c678dc1c2a42 | /SWUST OJ/0860.cpp | 3842120a0d5c0571892983b3601b282807f73706 | [
"MIT"
] | permissive | windcry1/My-ACM-ICPC | c97b203e5e54d355168ed14db888f4a1b3e6c363 | b85b1c83b72c6b51731dae946a0df57c31d3e7a1 | refs/heads/master | 2021-09-06T20:47:56.525749 | 2021-08-22T14:06:10 | 2021-08-22T14:06:10 | 231,622,263 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,333 | cpp | //Author:LanceYu
#include<iostream>
#include<string>
#include<cstring>
#include<cstdio>
#include<fstream>
#include<iosfwd>
#include<sstream>
#include<fstream>
#include<cwchar>
#include<iomanip>
#include<ostream>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<ctime>
#include<algorithm>
#include<complex>
#include<cmath>
#include<valarray>
#include<bitset>
#include<iterator>
#define ll long long
using namespace std;
const double clf=1e-8;
//const double e=2.718281828;
const double PI=3.141592653589793;
const int MMAX=2147483647;
const int mod=1e9+7;
//priority_queue<int>p;
//priority_queue<int,vector<int>,greater<int> >pq;
int main()
{
char s[101],c,t[101];
int pos,len;
while(scanf("%s",s)!=EOF)
{
while(scanf("%s",t)&&strcmp(t,"END")!=0)
{
if(strcmp(t,"A")==0)
{
getchar();
scanf("%c %d",&c,&pos);
len=strlen(s);
if(len<pos)
{
s[len]=c;
s[len+1]='\0';
}
else
{
for(int i=len;i>=pos;i--)
s[i]=s[i-1];
s[pos-1]=c;
s[len+1]='\0';
}
}
if(strcmp(t,"B")==0)
{
scanf(" %c",&c);
len=strlen(s);
for(int i=0;i<len;i++)
{
if(s[i]==c)
{
for(int j=i;j<len-1;j++)
s[j]=s[j+1];
s[len-1]='\0';
len--;
i--;
}
}
}
}
printf("%s\n",s);
}
return 0;
}
| [
"lanceyu120@gmail.com"
] | lanceyu120@gmail.com |
54fdafd90fc5754630d87c062c04e0e3c0066847 | f20263e46c5b79ecd27a68f57c888e73a6093585 | /Actor/Props/FootPush/Cpt_FootPushGround.h | 5c9a41eb39f96502a78cef85e44720028d3f68fa | [
"MIT"
] | permissive | Bornsoul/Revenger_JoyContinue | 63cd4365a725ce50b5c9e0d41c00e3b1eb0ff6da | 599716970ca87a493bf3a959b36de0b330b318f1 | refs/heads/master | 2020-06-13T09:50:47.245820 | 2019-09-16T05:01:50 | 2019-09-16T05:01:50 | 194,618,283 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,630 | h | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "Revenger.h"
#include "Components/ActorComponent.h"
#include "Cpt_FootPushGround.generated.h"
UCLASS(ClassGroup = (Custom), Blueprintable, meta = (BlueprintSpawnableComponent))
class REVENGER_API UCpt_FootPushGround : public UActorComponent
{
GENERATED_BODY()
private :
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = FootPush, meta = (AllowPrivateAccess = "true"))
FVector m_vOriginLocation;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = FootPush, meta = (AllowPrivateAccess = "true"))
bool m_bPushState = false;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = FootPush, meta = (AllowPrivateAccess = "true"))
float m_fPushDepth = 80.0f;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = FootPush, meta = (AllowPrivateAccess = "true"))
class UStaticMeshComponent* m_pMesh;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = FootPush, meta = (AllowPrivateAccess = "true"))
float m_fResetTime = 0.0f;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = FootPush, meta = (AllowPrivateAccess = "true"))
float m_fResetTime_Ago = 0.1f;
private :
public:
UCpt_FootPushGround();
virtual void BeginPlay() override;
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
public :
UFUNCTION(BlueprintImplementableEvent, BlueprintCallable, Category = "Event")
void Ground_Push_In();
UFUNCTION(BlueprintImplementableEvent, BlueprintCallable, Category = "Event")
void Ground_Push_Out();
};
| [
"dlwldks95@gmail.com"
] | dlwldks95@gmail.com |
aa91531540bc11145e2c36adf2242b3674db6808 | 498f5629f15083ac5dbbb3ba73f90bf59067f2e5 | /hackerearth/data structures/stacks/merge_sort.cpp | 2c95d7537724f70460508d7f6a6d7bc2da3ceb1e | [] | no_license | priyanshuN/Algorithms | b3103722fd6657d6507d72d73ba80b35e3a196dd | 22559ffc50939256f2324afd313d4a32bb63f6ac | refs/heads/master | 2022-01-31T06:17:52.577691 | 2022-01-08T14:33:56 | 2022-01-08T14:33:56 | 244,685,281 | 1 | 0 | null | 2022-01-08T14:33:57 | 2020-03-03T16:24:45 | C++ | UTF-8 | C++ | false | false | 825 | cpp | #include<bits/stdc++.h>
using namespace std;
void merge(int a[],int start,int mid,int end){
int p=start,q=mid+1,A[-start+end+1],k=0;
for(int i=start;i<=end;++i){
if(p>mid){
A[k++]=a[q++];
}
else if(q>end){
A[k++]=a[p++];
}
else if(a[p]<a[q]){
A[k++]=a[p++];
}
else{
A[k++]=a[q++];
}
}
for(int i=0;i<k;++i){
a[start++]=A[i];
}
}
void merge_sort(int a[],int start,int end){
if(start<end){
int mid = (start+end)/2;
merge_sort(a,start,mid);
merge_sort(a,mid+1,end);
merge(a,start,mid,end);
}
}
int main()
{
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
int n;
cin>>n;
int a[n];
for(int i=0;i<n;++i){
cin>>a[i];
}
for(int i=0;i<n;++i){
cout<<a[i]<<' ';
}
cout<<endl;
merge_sort(a,0,n-1);
for(int i=0;i<n;++i){
cout<<a[i]<<' ';
}
return 0;
}
| [
"priyanshunandan17@gmail.com"
] | priyanshunandan17@gmail.com |
59bb904f969a9bc418fceb51d27c2ef08095f95b | bae9d8d3d01202c704b08eea70b22c3cce83bb53 | /Lights/DirectionalLight.h | 68c14a50260a1da532fcd2e5e44d36a72c43c0ab | [] | no_license | christophzeller/mylittleraytracer | 633d1de4884991cf31f69f541202537c3fcac953 | f7f71fe7d191544460fea6ad84b2ef60d0965d56 | refs/heads/master | 2016-09-05T19:03:37.852606 | 2015-02-21T18:13:46 | 2015-02-21T18:13:46 | 31,036,186 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 649 | h | /*
* DirectionalLight.h
*
* Created on: 21.02.2015
* Author: Christoph
*/
#ifndef DIRECTIONALLIGHT_H_
#define DIRECTIONALLIGHT_H_
#include "Light.h"
#include "../Utility/Vector3D.h"
#include "../Utility/RGBColor.h"
#include "../Tracing/ShadeRec.h"
class DirectionalLight: public Light
{
public:
virtual Vector3D getDirection(ShadeRec& sr);
virtual RGBColor L(ShadeRec& sr);
DirectionalLight(const Vector3D& direction, const RGBColor& color);
DirectionalLight(const Vector3D& direction);
DirectionalLight();
virtual ~DirectionalLight();
Vector3D direction;
RGBColor color;
float l_scale;
};
#endif /* DIRECTIONALLIGHT_H_ */
| [
"christophzeller@users.noreply.github.com"
] | christophzeller@users.noreply.github.com |
386f8f646aa35a64cb420c28a3dab66b3c8984b5 | 641fa8341d8c436ad24945bcbf8e7d7d1dd7dbb2 | /mash/webtest/webtest.cc | 64b1aeecd8ef680b47e9c7ebb7103029fc4889cc | [
"BSD-3-Clause"
] | permissive | massnetwork/mass-browser | 7de0dfc541cbac00ffa7308541394bac1e945b76 | 67526da9358734698c067b7775be491423884339 | refs/heads/master | 2022-12-07T09:01:31.027715 | 2017-01-19T14:29:18 | 2017-01-19T14:29:18 | 73,799,690 | 4 | 4 | BSD-3-Clause | 2022-11-26T11:53:23 | 2016-11-15T09:49:29 | null | UTF-8 | C++ | false | false | 7,473 | cc | // Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "mash/webtest/webtest.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/string16.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/timer/timer.h"
#include "mash/public/interfaces/launchable.mojom.h"
#include "services/navigation/public/interfaces/view.mojom.h"
#include "services/service_manager/public/c/main.h"
#include "services/service_manager/public/cpp/connector.h"
#include "services/service_manager/public/cpp/interface_registry.h"
#include "services/service_manager/public/cpp/service.h"
#include "services/service_manager/public/cpp/service_context.h"
#include "services/service_manager/public/cpp/service_runner.h"
#include "services/tracing/public/cpp/provider.h"
#include "services/ui/public/cpp/window.h"
#include "services/ui/public/cpp/window_tree_client.h"
#include "ui/aura/mus/mus_util.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/paint_throbber.h"
#include "ui/native_theme/native_theme.h"
#include "ui/views/background.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/textfield/textfield.h"
#include "ui/views/controls/textfield/textfield_controller.h"
#include "ui/views/mus/aura_init.h"
#include "ui/views/mus/window_manager_connection.h"
#include "ui/views/widget/widget_delegate.h"
#include "url/gurl.h"
namespace views {
class AuraInit;
}
namespace mash {
namespace webtest {
class UI : public views::WidgetDelegateView,
public navigation::mojom::ViewClient {
public:
UI(Webtest* webtest,
navigation::mojom::ViewPtr view,
navigation::mojom::ViewClientRequest request)
: webtest_(webtest),
view_(std::move(view)),
view_client_binding_(this, std::move(request)) {}
~UI() override {
webtest_->RemoveWindow(GetWidget());
}
void NavigateTo(const GURL& url) {
view_->NavigateTo(url);
}
private:
// Overridden from views::WidgetDelegate:
base::string16 GetWindowTitle() const override {
// TODO(beng): use resources.
if (current_title_.empty())
return base::ASCIIToUTF16("navigation::View client");
base::string16 format = base::ASCIIToUTF16("%s - navigation::View client");
base::ReplaceFirstSubstringAfterOffset(
&format, 0, base::ASCIIToUTF16("%s"), current_title_);
return format;
}
bool CanResize() const override { return true; }
bool CanMaximize() const override { return true; }
bool CanMinimize() const override { return true; }
// Overridden from views::View:
void Layout() override {
gfx::Rect local_bounds = GetLocalBounds();
if (content_area_) {
gfx::Point offset = local_bounds.origin();
ConvertPointToWidget(this, &offset);
int width = local_bounds.width();
int height = local_bounds.height();
content_area_->SetBounds(
gfx::Rect(offset.x(), offset.y(), width, height));
}
}
void ViewHierarchyChanged(
const views::View::ViewHierarchyChangedDetails& details) override {
if (details.is_add && GetWidget() && !content_area_) {
ui::Window* window = aura::GetMusWindow(GetWidget()->GetNativeWindow());
content_area_ = window->window_tree()->NewWindow(nullptr);
window->AddChild(content_area_);
ui::mojom::WindowTreeClientPtr client;
view_->GetWindowTreeClient(GetProxy(&client));
content_area_->Embed(std::move(client));
}
}
// navigation::mojom::ViewClient:
void OpenURL(navigation::mojom::OpenURLParamsPtr params) override {}
void LoadingStateChanged(bool is_loading) override {}
void NavigationStateChanged(const GURL& url,
const std::string& title,
bool can_go_back,
bool can_go_forward) override {
current_title_ = base::UTF8ToUTF16(title);
GetWidget()->UpdateWindowTitle();
}
void LoadProgressChanged(double progress) override {}
void UpdateHoverURL(const GURL& url) override {}
void ViewCreated(navigation::mojom::ViewPtr view,
navigation::mojom::ViewClientRequest request,
bool is_popup,
const gfx::Rect& initial_rect,
bool user_gesture) override {
views::Widget* window = views::Widget::CreateWindowWithContextAndBounds(
new UI(webtest_, std::move(view), std::move(request)), nullptr,
initial_rect);
window->Show();
webtest_->AddWindow(window);
}
void Close() override {
GetWidget()->Close();
}
void NavigationPending(navigation::mojom::NavigationEntryPtr entry) override {
}
void NavigationCommitted(
navigation::mojom::NavigationCommittedDetailsPtr details,
int current_index) override {}
void NavigationEntryChanged(navigation::mojom::NavigationEntryPtr entry,
int entry_index) override {}
void NavigationListPruned(bool from_front, int count) override {}
Webtest* webtest_;
ui::Window* content_area_ = nullptr;
navigation::mojom::ViewPtr view_;
mojo::Binding<navigation::mojom::ViewClient> view_client_binding_;
base::string16 current_title_;
DISALLOW_COPY_AND_ASSIGN(UI);
};
Webtest::Webtest() {}
Webtest::~Webtest() {}
void Webtest::AddWindow(views::Widget* window) {
windows_.push_back(window);
}
void Webtest::RemoveWindow(views::Widget* window) {
auto it = std::find(windows_.begin(), windows_.end(), window);
DCHECK(it != windows_.end());
windows_.erase(it);
if (windows_.empty())
base::MessageLoop::current()->QuitWhenIdle();
}
void Webtest::OnStart() {
tracing_.Initialize(context()->connector(), context()->identity().name());
aura_init_ = base::MakeUnique<views::AuraInit>(
context()->connector(), context()->identity(), "views_mus_resources.pak");
window_manager_connection_ = views::WindowManagerConnection::Create(
context()->connector(), context()->identity());
}
bool Webtest::OnConnect(const service_manager::ServiceInfo& remote_info,
service_manager::InterfaceRegistry* registry) {
registry->AddInterface<mojom::Launchable>(this);
return true;
}
void Webtest::Launch(uint32_t what, mojom::LaunchMode how) {
bool reuse = how == mojom::LaunchMode::REUSE ||
how == mojom::LaunchMode::DEFAULT;
if (reuse && !windows_.empty()) {
windows_.back()->Activate();
return;
}
navigation::mojom::ViewFactoryPtr view_factory;
context()->connector()->ConnectToInterface("navigation", &view_factory);
navigation::mojom::ViewPtr view;
navigation::mojom::ViewClientPtr view_client;
navigation::mojom::ViewClientRequest view_client_request =
GetProxy(&view_client);
view_factory->CreateView(std::move(view_client), GetProxy(&view));
UI* ui = new UI(this, std::move(view), std::move(view_client_request));
views::Widget* window = views::Widget::CreateWindowWithContextAndBounds(
ui, nullptr, gfx::Rect(50, 10, 600, 600));
ui->NavigateTo(GURL("http://www.theverge.com/"));
window->Show();
AddWindow(window);
}
void Webtest::Create(const service_manager::Identity& remote_identity,
mojom::LaunchableRequest request) {
bindings_.AddBinding(this, std::move(request));
}
} // namespace webtest
} // namespace mash
| [
"xElvis89x@gmail.com"
] | xElvis89x@gmail.com |
085f43c9e6488c2d5345e7ec4df48c4e1c5a331d | 1fc4f5203d231f0abe1d1168298dd41e0ad2dc2e | /Bcode_WintgTerm_V2.6.6_Build_20180929(界面统一版本)/GpcTerms/WintgTerm/Tcc/C3/TccCommandSketchMapDlg.h | f7d51daf1a158773eabcb649531f8eb977083212 | [] | no_license | Huixaing/Project | 79d5ceb89620c0de6278cb211ef837c728f1af71 | fc3ab640265eaaed0c0a2c217370196525e1efc3 | refs/heads/master | 2020-03-30T00:44:07.773723 | 2018-10-08T05:44:22 | 2018-10-08T05:44:22 | 150,541,134 | 1 | 5 | null | null | null | null | GB18030 | C++ | false | false | 1,310 | h | #if !defined(TccCommandSketchMapDlg_H)
#define TccCommandSketchMapDlg_H
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// TccCommandSketchMapDlg.h : header file
//
#include "tcc.h"
#include "LS_SketchMap.h"
namespace TCC_C3
{
// CTccCommandSketchMapDlg 对话框
class CTccCommandSketchMapDlg : public CDialog
{
DECLARE_DYNAMIC(CTccCommandSketchMapDlg)
public:
CTccCommandSketchMapDlg(ITccClientInfoProvider *pInfoProvider,
CWnd* pParent = NULL); // 标准构造函数
virtual ~CTccCommandSketchMapDlg();
// CScrollBar SCrollBar;
// 对话框数据
enum { IDD = IDD_DLG_SKETCH_MAP };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
ITccClientInfoProvider *m_pInfoProvider;
// Generated message map functions
//{{AFX_MSG(CTccCommandSketchMapDlg)
virtual BOOL OnInitDialog();
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
virtual void OnOK();
afx_msg void OnClickedBtnBeginLimit();
afx_msg void OnClickedBtnEndLimit();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
void SetKmMark(int builtin_id, kmmark_t nKmBegin, kmmark_t nKmEnd);
CLS_SketchMap m_SketchMap;
BOOL m_BtnEn; //是否显示按钮可以改变当前的限速区段
//virtual BOOL OnInitDialog();
};
}
#endif //if !defined(TccCommandSketchMapDlg_H) | [
"32888508+Huixaing@users.noreply.github.com"
] | 32888508+Huixaing@users.noreply.github.com |
0138dc6b815787baede9d897a53a6de4e7827a77 | eb48be785029cf3a4b92a64e1231cab757148a3f | /SimpleMipsFunctionGenerator.cpp | cbe8fde9edd7669850826f6fd908b3221fc6c880 | [] | no_license | yueyang130/BUAA_CS_2020_compiler_design | 303727428e0e1da6949149ddef1b3d3b7077d84c | b2ab6b7f491b00ac4c28a9cecc29fb85063bbf8c | refs/heads/master | 2023-05-30T18:11:48.936468 | 2021-06-15T01:08:02 | 2021-06-15T01:08:02 | 336,000,895 | 3 | 0 | null | null | null | null | GB18030 | C++ | false | false | 9,461 | cpp | #include "SimpleMipsFunctionGenerator.h"
#include "tools.h"
namespace SimpleMips {
void SimpleMipsFunctionGenerator::map_local_var() {
for (auto& quater : func_.get_quater_list()) {
if (quater->quater_type_ == QuaternionType::VarDeclare) {
auto entry = dynamic_pointer_cast<VarEntry>(quater->result_);
ValueType value_type = entry->value_type();
// 无论有没有初始化,都要在偏移量中加上数组的字节大小
// ,因此不能通过初始化循环来计算byte_size
offset += entry->ByteSize();
// int要字对齐
if (entry->value_type() == ValueType::INTV) {
int ret = offset % 4;
if (ret != 0) {
offset = offset - ret + 4;
}
}
// 先把当前变量的size加入offset,再map var to offset
func_var_offset_map_[entry.get()] = -offset;
if (quater->opA_.get()) { // 是否有初始化
auto inum = dynamic_pointer_cast<ImmediateEntry>(quater->opA_);
int unit_byte = (entry->value_type() == ValueType::INTV) ? 4 : 1;
if (entry->isArray()) {
int a_off = 0;
for (string value : inum->initializingList()) {
mips_load_num(reg0, value, mips_list_);
mips_store(reg0, "$sp", -offset + a_off, value_type, mips_list_);
a_off += unit_byte;
}
} else {
mips_load_num(reg0, inum->getValue(), mips_list_);
mips_store(reg0, "$sp", -offset, value_type, mips_list_);
}
}
}
}
}
void SimpleMipsFunctionGenerator::map_temp_var() {
for (auto& quater : func_.get_quater_list()) {
// 目前只考虑出现在左值的临时编变量
auto entry = quater->result_;
if (isTempVar(entry)) {
offset += (entry->value_type() == ValueType::INTV) ? 4 : 1;
if (entry->value_type() == ValueType::INTV) {
int ret = offset % 4;
if (ret != 0) {
offset = offset - ret + 4;
}
}
func_var_offset_map_[entry.get()] = -offset;
}
}
}
void SimpleMipsFunctionGenerator::load_var(shared_ptr<TableEntry> var, string reg) {
EntryType entry_type = var->entry_type();
ValueType value_type = var->value_type();
if (entry_type == EntryType::TEMP || entry_type == EntryType::VAR) {
auto it = func_var_offset_map_.find(var.get());
if (it != func_var_offset_map_.end()) {
int offset = it->second;
mips_load_mem(reg, "$fp", offset, value_type, mips_list_);
return;
}
auto it2 = global_var_offset_map_.find(dynamic_pointer_cast<VarEntry>(var).get());
if (it2 != global_var_offset_map_.end()) {
int offset = it2->second;
mips_load_mem(reg, "$gp", offset, value_type, mips_list_);
return;
}
} else if (entry_type == EntryType::CONST || entry_type == EntryType::IMMEDIATE) {
string value = var->getValue();
mips_load_num(reg, value, mips_list_);
}
}
void SimpleMipsFunctionGenerator::store_var(shared_ptr<TableEntry> var, string reg) {
ValueType value_type = var->value_type();
auto it = func_var_offset_map_.find(var.get());
if (it != func_var_offset_map_.end()) {
int offset = it->second;
mips_store(reg, "$fp", offset, value_type, mips_list_);
return;
}
auto it2 = global_var_offset_map_.find(dynamic_pointer_cast<VarEntry>(var).get());
if (it2 != global_var_offset_map_.end()) {
int offset = it2->second;
mips_store(reg, "$gp", offset, value_type, mips_list_);
return;
}
cout << "the variable can not be found in global and local var map";
exit(EXIT_FAILURE);
}
void SimpleMipsFunctionGenerator::load_array(shared_ptr<TableEntry> var, string off_reg, string target_reg) {
ValueType value_type = var->value_type();
auto it = func_var_offset_map_.find(var.get());
if (it != func_var_offset_map_.end()) {
int offset = it->second; // 数组头相对于fp的偏移量
mips_alu(off_reg, off_reg, "$fp", QuaternionType::AddOp, mips_list_);
mips_load_mem(target_reg, off_reg, offset, value_type, mips_list_);
return;
}
// global array
mips_load_mem(target_reg, off_reg, var->identifier(), value_type, mips_list_);
return;
}
void SimpleMipsFunctionGenerator::store_array(shared_ptr<TableEntry> var, string off_reg, string source_reg) {
ValueType value_type = var->value_type();
auto it = func_var_offset_map_.find(var.get());
if (it != func_var_offset_map_.end()) {
int offset = it->second; // 数组头相对于fp的偏移量
mips_alu(off_reg, off_reg, "$fp", QuaternionType::AddOp, mips_list_);
mips_store(source_reg, off_reg, offset, value_type, mips_list_);
return;
}
// global array
mips_store(source_reg, off_reg, var->identifier(), value_type, mips_list_);
return;
}
SimpleMipsFunctionGenerator::SimpleMipsFunctionGenerator(Function& func, map<VarEntry*, int>& gb_var_map, vector<string>& mips_list) :
func_(func), global_var_offset_map_(gb_var_map), mips_list_(mips_list) {
// 调用子函数时,已经入栈的参数个数
int stack_param_cnt = 0;
// 进入函数时使用的参数,用于统计形参个数(形参不存在嵌套)
int formal_param_cnt = 0;
// 进入函数时使用的参数,函数参数总个数
int param_num = 0;
// 存有数组下标的寄存器
vector<string> reg_idxs{ "$t0", "$t1" };
int idx_cnt = 0;
for (auto& quater : func_.get_quater_list()) {
if (!quater) { continue; }
QuaternionType quater_type = quater->quater_type_;
auto result = quater->result_;
auto opA = quater->opA_;
auto opB = quater->opB_;
switch (quater_type) {
case FuncDeclareHead:
set_label(*quater, mips_list_);
param_num = dynamic_pointer_cast<FunctionEntry>(result)->formal_param_num();
// save ra, previous fp, local var, temp var
mips_store("$ra", "$sp", -4, ValueType::INTV, mips_list_);
mips_store("$fp", "$sp", -8, ValueType::INTV, mips_list_);
mips_load_reg("$fp", "$sp", mips_list_);
this->offset += 8;
map_local_var();
map_temp_var();
// 对齐offset
offset = (offset % 4 == 0) ? offset : (offset - (offset % 4) + 4);
mips_alu("$sp", "$sp", to_string(this->offset), QuaternionType::SubOp, mips_list_);
break;
case FuncFormalParam:
{
int offset = (param_num - (++formal_param_cnt)) * 4;
func_var_offset_map_[result.get()] = offset;
break;
}
case FuncReturn:
{
// set return value
if (result) {
this->load_var(result, "$v0");
}
// restore sp, fp, ra
mips_load_mem("$ra", "$fp", -4, ValueType::INTV, mips_list_);
mips_load_reg("$sp", "$fp", mips_list_);
mips_load_mem("$fp", "$fp", -8, ValueType::INTV, mips_list_);
bool ismain = strcmp_wo_case(func_.name(), "main");
mips_jr(ismain, mips_list_);
break;
}
case FuncParamPush:
this->load_var(opA, reg0);
mips_store(reg0, "$sp", -4 * (++stack_param_cnt), opA->value_type(), mips_list_);
break;
case FuncCall:
{
mips_alu("$sp", "$sp", to_string(stack_param_cnt * 4), QuaternionType::SubOp, mips_list_);
mips_jal(opA->identifier(), mips_list);
mips_alu("$sp", "$sp", to_string(stack_param_cnt * 4), QuaternionType::AddOp, mips_list_);
// 存在函数嵌套调用的情况,不应该对actual_param_cnt清零,应该减去已经使用到了的参数个数
//actual_param_cnt = 0;
int pnum = dynamic_pointer_cast<FunctionEntry>(opA)->formal_param_num();
stack_param_cnt -= pnum;
break;
}
case RetAssign:
this->store_var(result, "$v0");
break;
case BEQ: case BNE: case BLT:
case BLE: case BGT: case BGE:
this->load_var(opA, reg1);
this->load_var(opB, reg2);
conditional_jump(reg1, reg2, result->identifier(), quater_type, mips_list_);
break;
case Goto:
mips_j(*quater, mips_list_);
break;
case Label:
set_label(*quater, mips_list_);
break;
case PushArrayIndex:
this->load_var(result, reg_idxs[idx_cnt++]);
break;
case GetArrayElem:
off_in_array(reg0, reg1, opA, reg_idxs, mips_list_);
idx_cnt = 0;
this->load_array(opA, reg0, reg1);
this->store_var(result, reg1);
break;
case SetArrayELem:
off_in_array(reg0, reg1, result, reg_idxs, mips_list_);
idx_cnt = 0;
this->load_var(opA, reg1);
this->store_array(result, reg0, reg1);
break;
case AddOp: case SubOp:
case MulOp: case DivOp:
this->load_var(opA, reg1);
this->load_var(opB, reg2);
mips_alu(reg0, reg1, reg2, quater_type, mips_list_);
this->store_var(result, reg0);
break;
case Neg:
this->load_var(opA, reg2);
mips_alu(reg0, "$zero", reg2, quater_type, mips_list_);
this->store_var(result, reg0);
break;
case Assign:
this->load_var(opA, reg0);
this->store_var(result, reg0);
break;
case Read:
read(result->value_type(), mips_list_);
this->store_var(result, "$v0");
/* 对gui,不会过滤输入字符后的回车;但是,命令行会过滤字符后的回车
// 如果是读取字符,还需要读取回车
if (result->value_type() == ValueType::CHARV) {
read(ValueType::CHARV, mips_list_);
}
*/
break;
case Write:
if (opA.get()) {
write_str(opA->identifier(), mips_list_);
}
if (opB.get()) {
this->load_var(opB, "$a0");
write_expr(opB->value_type(), mips_list_);
}
write_lf(mips_list_);
break;
default:
break;
}
}
}
bool isTempVar(shared_ptr<TableEntry> entry) {
if (!entry.get()) {
return false;
}
if (entry->entry_type() != EntryType::TEMP) {
return false;
}
return true;
}
}
| [
"17377416@buaa.edu.cn"
] | 17377416@buaa.edu.cn |
bb0f8cc9ee47f11bd0fa1d30b07e36bb55c2923b | d3e83b33db4d6599be2939dfe88ad6893a5e9d84 | /utils.hpp | b4e564bc6aa334aad1ffa87d6fa0b37d8f8552bf | [] | no_license | aschrein/gfx-node | d9d7df069b691a269ca8b3a8f4b3f6a00415ce02 | fb5e22091e1d91b0ce140bd432bf37e534773365 | refs/heads/master | 2022-11-09T18:15:30.025855 | 2020-07-01T12:12:42 | 2020-07-01T12:12:42 | 264,950,550 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 29,243 | hpp | #ifndef UTILS_H
#define UTILS_H
#include <cstdlib>
#include <malloc.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#if __linux__
// UNIX headers
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#define DLL_EXPORT __attribute__((visibility("default")))
#define ATTR_USED __attribute__((used))
#elif WIN32
#include <Windows.h>
#define DLL_EXPORT __declspec(dllexport)
#define ATTR_USED
#else
#define DLL_EXPORT
#define ATTR_USED
#endif
#define ASSERT_ALWAYS(x) \
do { \
if (!(x)) { \
fprintf(stderr, "%s:%i [FAIL] at %s\n", __FILE__, __LINE__, #x); \
abort(); \
} \
} while (0)
#define ASSERT_DEBUG(x) ASSERT_ALWAYS(x)
#define NOTNULL(x) ASSERT_ALWAYS((x) != NULL)
#define ARRAY_SIZE(_ARR) ((int)(sizeof(_ARR) / sizeof(*_ARR)))
#undef MIN
#undef MAX
#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define MAX(x, y) ((x) > (y) ? (x) : (y))
#define CLAMP(x, a, b) ((x) < (a) ? (a) : ((x) > (b) ? (b) : (x)))
#define OFFSETOF(class, field) ((size_t) & (((class *)0)->field))
#define MEMZERO(x) memset(&x, 0, sizeof(x))
using u64 = uint64_t;
using u32 = uint32_t;
using u16 = uint16_t;
using u8 = uint8_t;
using i64 = int64_t;
using i32 = int32_t;
using i16 = int16_t;
using i8 = int8_t;
using i32 = int32_t;
using f32 = float;
using f64 = double;
template <typename T> T copy(T const &in) { return in; }
template <typename M, typename K> bool contains(M const &in, K const &key) {
return in.find(key) != in.end();
}
template <typename M> bool sets_equal(M const &a, M const &b) {
if (a.size() != b.size()) return false;
for (auto const &item : a) {
if (!contains(b, item)) return false;
}
return true;
}
template <typename M> M get_intersection(M const &a, M const &b) {
M out;
for (auto const &item : a) {
if (contains(b, item)) out.insert(item);
}
return out;
}
template <typename T, typename F> bool any(T set, F f) {
for (auto const &item : set)
if (f(item)) return true;
return false;
}
#define UNIMPLEMENTED_(s) \
do { \
fprintf(stderr, "%s:%i UNIMPLEMENTED %s\n", __FILE__, __LINE__, s); \
abort(); \
} while (0)
#define UNIMPLEMENTED UNIMPLEMENTED_("")
#define TRAP \
do { \
fprintf(stderr, "%s:%i TRAP\n", __FILE__, __LINE__); \
abort(); \
} while (0)
#define NOCOMMIT (void)0
template <typename F> struct __Defer__ {
F f;
__Defer__(F f) : f(f) {}
~__Defer__() { f(); }
};
template <typename F> __Defer__<F> defer_func(F f) { return __Defer__<F>(f); }
#define DEFER_1(x, y) x##y
#define DEFER_2(x, y) DEFER_1(x, y)
#define DEFER_3(x) DEFER_2(x, __COUNTER__)
#define defer(code) auto DEFER_3(_defer_) = defer_func([&]() { code; })
#define STRINGIFY(a) _STRINGIFY(a)
#define _STRINGIFY(a) #a
#define ito(N) for (uint32_t i = 0; i < N; ++i)
#define jto(N) for (uint32_t j = 0; j < N; ++j)
#define uto(N) for (uint32_t u = 0; u < N; ++u)
#define kto(N) for (uint32_t k = 0; k < N; ++k)
#define xto(N) for (uint32_t x = 0; x < N; ++x)
#define yto(N) for (uint32_t y = 0; y < N; ++y)
#define PERF_HIST_ADD(name, val)
#define PERF_ENTER(name)
#define PERF_EXIT(name)
#define OK_FALLTHROUGH (void)0;
#define TMP_STORAGE_SCOPE \
tl_alloc_tmp_enter(); \
defer(tl_alloc_tmp_exit(););
#define SWAP(x, y) \
do { \
auto tmp = x; \
x = y; \
y = tmp; \
} while (0)
#if __linux__
static inline size_t get_page_size() { return sysconf(_SC_PAGE_SIZE); }
#elif WIN32
static inline size_t get_page_size() {
SYSTEM_INFO si;
GetSystemInfo(&si);
return si.dwPageSize;
}
#else
static inline size_t get_page_size() { return 1 << 12; }
#endif
static inline size_t page_align_up(size_t n) {
return (n + get_page_size() - 1) & (~(get_page_size() - 1));
}
static inline size_t page_align_down(size_t n) { return (n) & (~(get_page_size() - 1)); }
static inline size_t get_num_pages(size_t size) { return page_align_up(size) / get_page_size(); }
#if __linux__
static inline void protect_pages(void *ptr, size_t num_pages) {
mprotect(ptr, num_pages * get_page_size(), PROT_NONE);
}
static inline void unprotect_pages(void *ptr, size_t num_pages, bool exec = false) {
mprotect(ptr, num_pages * get_page_size(), PROT_WRITE | PROT_READ | (exec ? PROT_EXEC : 0));
}
static inline void unmap_pages(void *ptr, size_t num_pages) {
int err = munmap(ptr, num_pages * get_page_size());
ASSERT_ALWAYS(err == 0);
}
static inline void map_pages(void *ptr, size_t num_pages) {
void *new_ptr =
mmap(ptr, num_pages * get_page_size(), PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0);
ASSERT_ALWAYS((size_t)new_ptr == (size_t)ptr);
}
#elif WIN32
// TODO
static inline void protect_pages(void *ptr, size_t num_pages) {}
static inline void unprotect_pages(void *ptr, size_t num_pages, bool exec = false) {}
static inline void unmap_pages(void *ptr, size_t num_pages) {}
static inline void map_pages(void *ptr, size_t num_pages) {}
#else
// Noops
static inline void protect_pages(void *ptr, size_t num_pages) {}
static inline void unprotect_pages(void *ptr, size_t num_pages, bool exec = false) {}
static inline void unmap_pages(void *ptr, size_t num_pages) {}
static inline void map_pages(void *ptr, size_t num_pages) {}
#endif
template <typename T, typename V> struct Pair {
T first;
V second;
};
template <typename T, typename V> Pair<T, V> make_pair(T t, V v) { return {t, v}; }
template <typename T = uint8_t> struct Pool {
uint8_t *ptr;
size_t cursor;
size_t capacity;
size_t mem_length;
size_t stack_capacity;
size_t stack_cursor;
static Pool create(size_t capacity) {
ASSERT_DEBUG(capacity > 0);
Pool out;
size_t STACK_CAPACITY = 0x20 * sizeof(size_t);
out.mem_length = get_num_pages(STACK_CAPACITY + capacity * sizeof(T)) * get_page_size();
#if __linux__
out.ptr = (uint8_t *)mmap(NULL, out.mem_length, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE,
-1, 0);
ASSERT_ALWAYS(out.ptr != MAP_FAILED);
#else
out.ptr = (uint8_t *)malloc(out.mem_length);
NOTNULL(out.ptr);
#endif
out.capacity = capacity;
out.cursor = 0;
out.stack_capacity = STACK_CAPACITY;
out.stack_cursor = 0;
return out;
}
T *back() { return (T *)(this->ptr + this->stack_capacity + this->cursor * sizeof(T)); }
void advance(size_t size) {
this->cursor += size;
ASSERT_DEBUG(this->cursor < this->capacity);
}
void release() {
#if __linux__
if (this->ptr) munmap(this->ptr, mem_length);
#else
if (this->ptr) free(this->ptr);
#endif
memset(this, 0, sizeof(Pool));
}
void push(T const &v) {
T *ptr = alloc(1);
memcpy(ptr, &v, sizeof(T));
}
bool has_items() { return this->cursor > 0; }
T *at(uint32_t i) { return (T *)(this->ptr + this->stack_capacity + i * sizeof(T)); }
T *alloc(size_t size) {
ASSERT_DEBUG(size != 0);
T *ptr = (T *)(this->ptr + this->stack_capacity + this->cursor * sizeof(T));
this->cursor += size;
ASSERT_DEBUG(this->cursor < this->capacity);
return ptr;
}
T *try_alloc(size_t size) {
ASSERT_DEBUG(size != 0);
if (this->cursor + size > this->capacity) return NULL;
T *ptr = (T *)(this->ptr + this->stack_capacity + this->cursor * sizeof(T));
this->cursor += size;
ASSERT_DEBUG(this->cursor < this->capacity);
return ptr;
}
T *alloc_zero(size_t size) {
T *mem = alloc(size);
memset(mem, 0, size * sizeof(T));
return mem;
}
T *alloc_align(size_t size, size_t alignment) {
T *ptr = alloc(size + alignment);
ptr = (T *)(((size_t)ptr + alignment - 1) & (~(alignment - 1)));
return ptr;
}
T *alloc_page_aligned(size_t size) {
ASSERT_DEBUG(size != 0);
size = page_align_up(size) + get_page_size();
T *ptr = (T *)(this->ptr + this->stack_capacity + this->cursor * sizeof(T));
T *aligned_ptr = (T *)(void *)page_align_down((size_t)ptr + get_page_size());
this->cursor += size;
ASSERT_DEBUG(this->cursor < this->capacity);
return aligned_ptr;
}
void enter_scope() {
// Save the cursor to the stack
size_t *top = (size_t *)(this->ptr + this->stack_cursor);
*top = this->cursor;
// Increment stack cursor
this->stack_cursor += sizeof(size_t);
ASSERT_DEBUG(this->stack_cursor < this->stack_capacity);
}
void exit_scope() {
// Decrement stack cursor
ASSERT_DEBUG(this->stack_cursor >= sizeof(size_t));
this->stack_cursor -= sizeof(size_t);
// Restore the cursor from the stack
size_t *top = (size_t *)(this->ptr + this->stack_cursor);
this->cursor = *top;
}
void reset() {
this->cursor = 0;
this->stack_cursor = 0;
}
T *put(T const *old_ptr, size_t count) {
T *new_ptr = alloc(count);
memcpy(new_ptr, old_ptr, count * sizeof(T));
return new_ptr;
}
void pop() {
ASSERT_DEBUG(cursor > 0);
cursor -= 1;
}
bool has_space(size_t size) { return cursor + size <= capacity; }
};
template <typename T = u8> using Temporary_Storage = Pool<T>;
/** Allocates 'size' bytes using thread local allocator
*/
void *tl_alloc(size_t size);
/** Reallocates deleting `ptr` as a result
*/
void *tl_realloc(void *ptr, size_t oldsize, size_t newsize);
void tl_free(void *ptr);
/** Allocates 'size' bytes using thread local temporal storage
*/
void *tl_alloc_tmp(size_t size);
/** Record the current state of thread local temporal storage
*/
void tl_alloc_tmp_enter();
/** Restore the previous state of thread local temporal storage
*/
void tl_alloc_tmp_exit();
struct string_ref {
const char *ptr;
size_t len;
string_ref substr(size_t offset, size_t new_len) { return string_ref{ptr + offset, new_len}; }
};
static inline i32 str_match(char const *cur, char const *patt) {
i32 i = 0;
while (true) {
if (cur[i] == '\0' || patt[i] == '\0') return i;
if (cur[i] == patt[i]) {
i++;
} else {
return -1;
}
}
}
static inline i32 str_find(char const *cur, size_t maxlen, char c) {
size_t i = 0;
while (true) {
if (i == maxlen) return -1;
if (cur[i] == '\0') return -1;
if (cur[i] == c) {
return (i32)i;
}
i++;
}
}
// for printf
#define STRF(str) (i32) str.len, str.ptr
static inline bool operator==(string_ref a, string_ref b) {
if (a.ptr == NULL || b.ptr == NULL) return false;
return a.len != b.len ? false : strncmp(a.ptr, b.ptr, a.len) == 0 ? true : false;
}
static inline uint64_t hash_of(uint64_t u) {
uint64_t v = u * 3935559000370003845 + 2691343689449507681;
v ^= v >> 21;
v ^= v << 37;
v ^= v >> 4;
v *= 4768777513237032717;
v ^= v << 20;
v ^= v >> 41;
v ^= v << 5;
return v;
}
template <typename T> static uint64_t hash_of(T *ptr) { return hash_of((size_t)ptr); }
static inline uint64_t hash_of(string_ref a) {
uint64_t hash = 5381;
for (size_t i = 0; i < a.len; i++) {
hash =
//(hash << 6) + (hash << 16) - hash + a.ptr[i];
((hash << 5) + hash) + a.ptr[i];
}
return hash;
}
/** String view of a static string
*/
static inline string_ref stref_s(char const *static_string) {
if (static_string == NULL || static_string[0] == '\0') return string_ref{NULL, 0};
ASSERT_DEBUG(static_string != NULL);
string_ref out;
out.ptr = static_string;
out.len = strlen(static_string);
ASSERT_DEBUG(out.len != 0);
return out;
}
/** String view of a temporal string
Uses thread local temporal storage
*/
static inline string_ref stref_tmp_copy(string_ref a) {
string_ref out;
out.len = a.len;
ASSERT_DEBUG(out.len != 0);
char *ptr = (char *)tl_alloc_tmp(out.len);
memcpy(ptr, a.ptr, out.len);
out.ptr = (char const *)ptr;
return out;
}
/** String view of a temporal string
Uses thread local temporal storage
*/
static inline string_ref stref_tmp(char const *tmp_string) {
ASSERT_DEBUG(tmp_string != NULL);
string_ref out;
out.len = strlen(tmp_string);
ASSERT_DEBUG(out.len != 0);
char *ptr = (char *)tl_alloc_tmp(out.len);
memcpy(ptr, tmp_string, out.len);
out.ptr = (char const *)ptr;
return out;
}
static inline string_ref stref_concat(string_ref a, string_ref b) {
string_ref out;
out.len = a.len + b.len;
ASSERT_DEBUG(out.len != 0);
char *ptr = (char *)tl_alloc_tmp(out.len);
memcpy(ptr, a.ptr, a.len);
memcpy(ptr + a.len, b.ptr, b.len);
out.ptr = (char const *)ptr;
return out;
}
static inline char const *stref_to_tmp_cstr(string_ref a) {
ASSERT_DEBUG(a.ptr != NULL);
char *ptr = (char *)tl_alloc_tmp(a.len + 1);
memcpy(ptr, a.ptr, a.len);
ptr[a.len] = '\0';
return ptr;
}
static inline int32_t stref_find(string_ref a, string_ref b, size_t start = 0) {
size_t cursor = 0;
for (size_t i = start; i < a.len; i++) {
if (a.ptr[i] == b.ptr[cursor]) {
cursor += 1;
} else {
i -= cursor;
cursor = 0;
}
if (cursor == b.len) return (int32_t)(i - (cursor - 1));
}
return -1;
}
static inline int32_t stref_find_last(string_ref a, string_ref b, size_t start = 0) {
int32_t last_pos = -1;
int32_t cursor = stref_find(a, b, start);
while (cursor >= 0) {
last_pos = cursor;
if ((size_t)cursor + 1 < a.len) cursor = stref_find_last(a, b, (size_t)(cursor + 1));
}
return last_pos;
}
#if __linux__
static inline void make_dir_recursive(string_ref path) {
TMP_STORAGE_SCOPE;
if (path.ptr[path.len - 1] == '/') path.len -= 1;
int32_t sep = stref_find_last(path, stref_s("/"));
if (sep >= 0) {
make_dir_recursive(path.substr(0, sep));
}
mkdir(stref_to_tmp_cstr(path), 0777);
}
#endif
static inline void dump_file(char const *path, void const *data, size_t size) {
FILE *file = fopen(path, "wb");
ASSERT_ALWAYS(file);
fwrite(data, 1, size, file);
fclose(file);
}
static inline char *read_file_tmp(char const *filename) {
FILE *text_file = fopen(filename, "rb");
if (text_file == NULL)
return NULL;
fseek(text_file, 0, SEEK_END);
long fsize = ftell(text_file);
fseek(text_file, 0, SEEK_SET);
size_t size = (size_t)fsize;
char * data = (char *)tl_alloc_tmp((size_t)fsize + 1);
fread(data, 1, (size_t)fsize, text_file);
data[size] = '\0';
fclose(text_file);
return data;
}
static inline void ATTR_USED write_image_2d_i32_ppm(const char *file_name, void *data,
uint32_t pitch, uint32_t width,
uint32_t height) {
FILE *file = fopen(file_name, "wb");
ASSERT_ALWAYS(file);
fprintf(file, "P6\n");
fprintf(file, "%d %d\n", width, height);
fprintf(file, "255\n");
ito(height) {
jto(width) {
uint32_t pixel = *(uint32_t *)(void *)(((uint8_t *)data) + i * pitch + j * 4);
uint8_t r = ((pixel >> 0) & 0xff);
uint8_t g = ((pixel >> 8) & 0xff);
uint8_t b = ((pixel >> 16) & 0xff);
uint8_t a = ((pixel >> 24) & 0xff);
if (a == 0) {
r = ((i & 1) ^ (j & 1)) * 127;
g = ((i & 1) ^ (j & 1)) * 127;
b = ((i & 1) ^ (j & 1)) * 127;
}
fputc(r, file);
fputc(g, file);
fputc(b, file);
}
}
fclose(file);
}
static inline void ATTR_USED write_image_2d_i24_ppm(const char *file_name, void *data,
uint32_t pitch, uint32_t width,
uint32_t height) {
FILE *file = fopen(file_name, "wb");
ASSERT_ALWAYS(file);
fprintf(file, "P6\n");
fprintf(file, "%d %d\n", width, height);
fprintf(file, "255\n");
ito(height) {
jto(width) {
uint8_t r = *(uint8_t *)(void *)(((uint8_t *)data) + i * pitch + j * 3 + 0);
uint8_t g = *(uint8_t *)(void *)(((uint8_t *)data) + i * pitch + j * 3 + 1);
uint8_t b = *(uint8_t *)(void *)(((uint8_t *)data) + i * pitch + j * 3 + 2);
fputc(r, file);
fputc(g, file);
fputc(b, file);
}
}
fclose(file);
}
static inline void ATTR_USED write_image_2d_i8_ppm(const char *file_name, void *data,
uint32_t pitch, uint32_t width,
uint32_t height) {
FILE *file = fopen(file_name, "wb");
ASSERT_ALWAYS(file);
fprintf(file, "P6\n");
fprintf(file, "%d %d\n", width, height);
fprintf(file, "255\n");
ito(height) {
jto(width) {
uint8_t r = *(uint8_t *)(void *)(((uint8_t *)data) + i * pitch + j);
fputc(r, file);
fputc(r, file);
fputc(r, file);
}
}
fclose(file);
}
struct Allocator {
virtual void * alloc(size_t) = 0;
virtual void * realloc(void *, size_t old_size, size_t new_size) = 0;
virtual void free(void *) = 0;
static Allocator *get_default() {
struct _Allocator : public Allocator {
virtual void *alloc(size_t size) override { return tl_alloc(size); }
virtual void *realloc(void *ptr, size_t old_size, size_t new_size) override {
return tl_realloc(ptr, old_size, new_size);
}
virtual void free(void *ptr) override { tl_free(ptr); }
};
static _Allocator alloc;
return &alloc;
}
};
struct Default_Allocator {
static void *alloc(size_t size) { return tl_alloc(size); }
static void *realloc(void *ptr, size_t old_size, size_t new_size) {
return tl_realloc(ptr, old_size, new_size);
}
static void free(void *ptr) { tl_free(ptr); }
};
template <typename T, size_t grow_k = 0x100, typename Allcator_t = Default_Allocator> //
struct Array {
T * ptr;
size_t size;
size_t capacity;
void init(uint32_t capacity = 0) {
if (capacity != 0)
ptr = (T *)Allcator_t::alloc(sizeof(T) * capacity);
else
ptr = NULL;
size = 0;
this->capacity = capacity;
}
u32 get_size() { return this->size; }
u32 has_items() { return get_size() != 0; }
void release() {
if (ptr != NULL) {
Allcator_t::free(ptr);
}
memset(this, 0, sizeof(*this));
}
void resize(size_t new_size) {
if (new_size > capacity) {
uint64_t new_capacity = new_size;
ptr = (T *)Allcator_t::realloc(ptr, sizeof(T) * capacity, sizeof(T) * new_capacity);
capacity = new_capacity;
}
ASSERT_DEBUG(ptr != NULL);
size = new_size;
}
void reset() { size = 0; }
void memzero() {
if (capacity > 0) {
memset(ptr, 0, sizeof(T) * capacity);
}
}
void push(T elem) {
if (size + 1 > capacity) {
uint64_t new_capacity = capacity + grow_k;
ptr = (T *)Allcator_t::realloc(ptr, sizeof(T) * capacity, sizeof(T) * new_capacity);
capacity = new_capacity;
}
ASSERT_DEBUG(capacity >= size + 1);
ASSERT_DEBUG(ptr != NULL);
memcpy(ptr + size, &elem, sizeof(T));
size += 1;
}
T &back() {
ASSERT_DEBUG(size != 0);
return ptr[size - 1];
}
T pop() {
ASSERT_DEBUG(size != 0);
ASSERT_DEBUG(ptr != NULL);
T elem = ptr[size - 1];
if (size + grow_k < capacity) {
uint64_t new_capacity = capacity - grow_k;
ptr = (T *)Allcator_t::realloc(ptr, sizeof(T) * capacity, sizeof(T) * new_capacity);
capacity = new_capacity;
}
ASSERT_DEBUG(size != 0);
size -= 1;
if (size == 0) {
Allcator_t::free(ptr);
ptr = NULL;
capacity = 0;
}
return elem;
}
T &operator[](size_t i) {
ASSERT_DEBUG(i < size);
ASSERT_DEBUG(ptr != NULL);
return ptr[i];
}
};
template <typename T, u32 N, typename Allcator_t = Default_Allocator> //
struct SmallArray {
T local[N];
size_t size;
Array<T, N * 3, Allcator_t> array;
void init() {
memset(this, 0, sizeof(*this));
array.init();
}
void release() {
array.release();
memset(this, 0, sizeof(*this));
}
T &operator[](size_t i) {
if (i < N)
return local[i];
else
return array[i - N];
}
void push(T const &val) {
if (size < N) {
local[size++] = val;
} else {
array.push(val);
size++;
}
}
bool has(T elem) {
ito(size) {
if ((*this)[i] == elem) return true;
}
return false;
}
};
template <typename K, typename Allcator_t = Default_Allocator, size_t grow_k = 0x100,
size_t MAX_ATTEMPTS = 0x100>
struct Hash_Set {
struct Hash_Pair {
K key;
uint64_t hash;
};
using Array_t = Array<Hash_Pair, grow_k, Allcator_t>;
Array_t arr;
size_t item_count;
void release() {
arr.release();
item_count = 0;
}
void init() {
arr.init();
item_count = 0;
}
void reset() {
arr.memzero();
item_count = 0;
}
i32 find(K key) {
if (item_count == 0) return -1;
uint64_t key_hash = hash_of(key);
uint64_t hash = key_hash;
uint64_t size = arr.capacity;
if (size == 0) return -1;
uint32_t attempt_id = 0;
for (; attempt_id < MAX_ATTEMPTS; ++attempt_id) {
uint64_t id = hash % size;
if (hash != 0) {
if (arr.ptr[id].hash == key_hash && arr.ptr[id].key == key) {
return (i32)id;
}
}
hash = hash_of(hash);
}
return -1;
}
bool try_insert(K key) {
uint64_t key_hash = hash_of(key);
uint64_t hash = key_hash;
uint64_t size = arr.capacity;
if (size == 0) {
arr.resize(grow_k);
arr.memzero();
size = arr.capacity;
}
Hash_Pair pair;
pair.key = key;
pair.hash = key_hash;
for (uint32_t attempt_id = 0; attempt_id < MAX_ATTEMPTS; ++attempt_id) {
uint64_t id = hash % size;
if (hash != 0) {
if (arr.ptr[id].hash == 0) { // Empty slot
arr.ptr[id] = pair;
item_count += 1;
return true;
} else if (arr.ptr[id].hash == key_hash && arr.ptr[id].key == key) { // Override
arr.ptr[id] = pair;
return true;
} else { // collision
(void)0;
}
}
hash = hash_of(hash);
}
return false;
}
bool try_resize(size_t new_size) {
ASSERT_DEBUG(new_size > 0);
Array_t old_arr = arr;
size_t old_item_count = item_count;
{
Array_t new_arr;
new_arr.init();
ASSERT_DEBUG(new_size > 0);
new_arr.resize(new_size);
new_arr.memzero();
arr = new_arr;
item_count = 0;
}
uint32_t i = 0;
for (; i < old_arr.capacity; ++i) {
Hash_Pair pair = old_arr.ptr[i];
if (pair.hash != 0) {
bool suc = try_insert(pair.key);
if (!suc) {
arr.release();
arr = old_arr;
item_count = old_item_count;
return false;
}
}
}
old_arr.release();
return true;
}
void remove(K key) {
if (item_count == 0) return;
while (true) {
i32 id = find(key);
if (id > -1) {
ASSERT_DEBUG(item_count > 0);
arr.ptr[id].hash = 0u;
item_count -= 1;
if (item_count == 0) {
arr.release();
} else if (arr.size + grow_k < arr.capacity) {
try_resize(arr.capacity - grow_k);
}
} else {
break;
}
}
}
bool insert(K key) {
u32 iters = 0x10;
bool suc = false;
while (!(suc = try_insert(key))) {
u32 resize_iters = 6;
size_t new_size = arr.capacity + grow_k;
bool resize_suc = false;
size_t grow_rate = grow_k << 1;
while (!(resize_suc = try_resize(new_size))) {
if (resize_iters == 0) break;
new_size += grow_rate;
grow_rate = grow_rate << 1;
resize_iters -= 1;
}
(void)resize_suc;
ASSERT_DEBUG(resize_suc == true);
if (iters == 0) break;
iters -= 1;
}
ASSERT_DEBUG(suc == true);
return suc;
}
bool contains(K key) { return find(key) != -1; }
};
template <typename K, typename V> struct Map_Pair {
K key;
V value;
bool operator==(Map_Pair const &that) const { return this->key == that.key; }
};
template <typename K, typename V> u64 hash_of(Map_Pair<K, V> const &item) {
return hash_of(item.key);
}
template <typename K, typename V, typename Allcator_t = Default_Allocator, size_t grow_k = 0x100,
size_t MAX_ATTEMPTS = 0x20>
struct Hash_Table {
using Pair_t = Map_Pair<K, V>;
Hash_Set<Map_Pair<K, V>, Allcator_t, grow_k, MAX_ATTEMPTS> set;
void release() { set.release(); }
void init() { set.init(); }
i32 find(K key) { return set.find(Map_Pair<K, V>{ key, {}}); }
V get(K key) {
i32 id = set.find(Map_Pair<K, V>{ key, {}});
ASSERT_DEBUG(id >= 0);
return set.arr[id].key.value;
}
V *get_or_null(K key) {
if (set.item_count == 0) return 0;
i32 id = set.find(Map_Pair<K, V>{ key, {}});
if (id < 0) return 0;
return &set.arr[id].key.value;
}
void remove(K key) { return set.remove(Map_Pair<K, V>{ key, {}}); }
bool insert(K key, V value) { return set.insert(Map_Pair<K, V>{ key, value}); }
bool contains(K key) { return set.contains(Map_Pair<K, V>{ key, {}}); }
template <typename F> void iter(F f) {
ito(set.arr.size) {
auto &item = set.arr[i];
if (item.hash != 0) {
f(item.key);
}
}
}
template <typename F> void iter_values(F f) {
ito(set.arr.size) {
auto &item = set.arr[i];
if (item.hash != 0) {
f(item.key.value);
}
}
}
};
#endif
#ifdef UTILS_IMPL
#ifndef UTILS_IMPL_H
#define UTILS_IMPL_H
#include <string.h>
struct Thread_Local {
Temporary_Storage<> temporal_storage;
bool initialized = false;
~Thread_Local() { temporal_storage.release(); }
};
// TODO(aschrein): Change to __thread?
thread_local Thread_Local g_tl{};
Thread_Local *get_tl() {
if (g_tl.initialized == false) {
g_tl.initialized = true;
g_tl.temporal_storage = Temporary_Storage<>::create(1 << 24);
}
return &g_tl;
}
void *tl_alloc_tmp(size_t size) { return get_tl()->temporal_storage.alloc(size); }
void tl_alloc_tmp_enter() { get_tl()->temporal_storage.enter_scope(); }
void tl_alloc_tmp_exit() { get_tl()->temporal_storage.exit_scope(); }
void *tl_alloc(size_t size) { return malloc(size); }
void *tl_realloc(void *ptr, size_t oldsize, size_t newsize) {
if (oldsize == newsize) return ptr;
size_t min_size = oldsize < newsize ? oldsize : newsize;
void * new_ptr = NULL;
if (newsize != 0) new_ptr = malloc(newsize);
if (min_size != 0) {
memcpy(new_ptr, ptr, min_size);
}
if (ptr != NULL) free(ptr);
return new_ptr;
}
void tl_free(void *ptr) { free(ptr); }
#endif
#endif
| [
"antonschrein@gmail.com"
] | antonschrein@gmail.com |
f58e21bed3b586eb4b821d2e54a7f6f61441e3a2 | 42765e7b506e71280e708659032072ad4243a9aa | /atcoder167/B.cpp | 4c8fd62c749768eee88e732bc05953c0e2089d6e | [] | no_license | sparshsinha123/competetive-programming | 0160f6c54da5f1f0d7b47953ff49574645476cd9 | ff7b647a766b6481696cf79e8b704e9ecb7d9ddb | refs/heads/master | 2023-06-01T21:55:22.281696 | 2021-06-14T16:51:52 | 2021-06-14T16:51:52 | 261,093,077 | 0 | 1 | null | 2021-05-31T07:46:32 | 2020-05-04T06:02:12 | C++ | UTF-8 | C++ | false | false | 2,586 | cpp | #pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define IOS { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define ll long long
#define umapii unordered_map <int,int>
#define umapll unordered_map<ll,ll>
#define mapll map<ll,ll>
#define mapii map<int,int>
#define pi pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define eb emplace_back
#define F first
#define S second
#define vs vector<string>
#define vi vector<int>
#define vll vector<ll>
#define vpi vector<pi>
#define vpll vector<pll>
#define vvi vector<vi>
#define vvll vector<vll>
#define endl '\n'
#define all(v) (v).begin(),(v).end()
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define MP(a,b) make_pair(a,b)
#define debug(x) cerr<< #x << " : " << x << endl;
#define debuga(A,N) cerr<< #A <<" : [";for(int i = 0; i<N;i++) cerr<<A[i]<<" "; cerr<<"]\n";
#define debuga2(A,N,M) cerr<< #A << " : \n"; for(int i=0;i<N;i++){cerr<<"[";for(int j=0;j<M;++j) cerr<<A[i][j]<<" ";cerr<<"]\n";}
#define debugp(p) cerr<< #p <<" : "<<"("<<(p).first<<","<<(p).second<<")\n";
#define debugv(v) cerr<< #v <<" : "<<"[";for(int i = 0; i< (v).size(); i++) cerr<<v[i]<<" "; cerr<<"]\n";
#define debugv2(v) cerr<< #v << " : \n"; for(int i=0;i<v.size();i++){cerr<<"[";for(int j=0;j<(v[i].size());++j) cerr<<v[i][j]<<" ";cerr<<"]\n";}
#define debugs(m) cerr<< #m <<" : [ "; for(auto itr = m.begin(); itr!=m.end();itr++) cerr<<*itr<<" "; cerr<<"]\n";
#define debugm(m) cerr<< #m <<" : [ "; for(auto itr = m.begin();itr!=m.end(); itr++) cerr<<"("<<itr->first<<","<<itr->second<<") ";cerr<<"]\n";
/* ordered set:
tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>
member functions :
1. order_of_key(k) : number of elements strictly lesser than k
2. find_by_order(k) : k-th element in the set
*/
ll modexp(ll x, ll ex , ll md) {
ll ans = 1ll;
while (ex > 0) {
if (ex & 1ll) ans = (ans * x) % md;
ex >>= 1ll;
x = (x * x) % md;
}
return ans;
}
const int inf = 1e9 + 7;
int main(){
IOS;
ll a , b , c , k;
cin >> a >> b >> c >> k;
if(k <= a){
cout << k << endl;
return 0;
}
if(k <= (a + b)){
cout << a << endl;
} else{
ll d = (k - (a + b));
cout << (a - d) << endl;
}
#ifdef LOCAL
cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
#endif
// g++ -DLOCAL -std=c++17 f.cpp
}
| [
"sparsh5008@gmail.com"
] | sparsh5008@gmail.com |
f8888eb4bbea7396e92ae6af4ef8fc146d07e97e | 3edc8e0b47cb3b5bc19738b196b9fe0c79e31a23 | /detect/src/ofApp.cpp | 1c8cd5bb7de9a229de7a63c03b9ab96a8e0259c9 | [] | no_license | 5c0tt411en/interactiveMedia | 5c25f113fc2eb3fc604b8181c6831e058600afc9 | eae3b470f9cb404f778dcd0ebc1a0f05e7d67b5f | refs/heads/master | 2020-12-21T19:51:19.543248 | 2016-07-02T05:50:44 | 2016-07-02T05:50:44 | 59,989,700 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,021 | cpp | #include "ofApp.h"
void ofApp::setup(){
ofSetFrameRate(30);
ofShowCursor();
gui.setup();
gui.add(cam_id.setup("select kinect", false));
gui.add(upside_down.setup("upside down", false));
gui.add(grid.setup("grid", false));
gui.add(test.setup("test", false));
gui.add(window_id.setup("window id", 0, 0, 3));
gui.add(near.setup("near", 255, 40, 255));
gui.add(far.setup("far", 100, 40, 255));
gui.add(min_radius.setup("min_radius", 1800 , 200,12000));
gui.add(max_radius.setup("max_radius", 12000, 200,12000));
gui.add(angle.setup("kinect angle", 0, -30, 30));
gui.add(thresh.setup("contour thresh", 255, 0, 255));
gui.add(split.setup("split", 65, 30, 100));
gui.setPosition((MARGIN - 1 + 0.825) * k.width / 2 , (MARGIN - 1) * k.height / 4);
k.listDevices();
k.init();
k.open(k.nextAvailableId());
kimage.allocate(k.width, k.height, OF_IMAGE_COLOR);
dimage.allocate(k.width, k.height, OF_IMAGE_GRAYSCALE);
fimage.allocate(k.width, k.height, OF_IMAGE_GRAYSCALE);
ofSetWindowShape(MARGIN * 2.2 * k.width / 2, MARGIN * k.height / 2);
cout << "kinect.width, kinect.height: " << k.width << "," << k.height << endl;
float offsetx = (MARGIN - 1) * k.width / 4;
float offsety = (MARGIN - 1) * k.height / 4;
left_top.set(offsetx, offsety);
right_bottom.set(offsetx + (k.width / 2), offsety + (k.height / 2));
}
void ofApp::update(){
if(test){
ofxOscMessage _msg;
_msg.setAddress("/pos");
int num = 3;
_msg.addIntArg((num + 1) * (num + 1));
for(int i = 0; i <= num; i++) {
for(int j = 0; j <= num; j++){
float width = 2 * (right_bottom.x - left_top.x);
float height = 2 * (right_bottom.y - left_top.y);
float kratio = float(k.width) / k.height;
float ratio = width / height;
float offsetx = 2 * (left_top.x - ((MARGIN - 1) * k.width / 4));
float offsety = 2 * (left_top.y - ((MARGIN - 1) * k.height / 4));
float x = (i * k.width / num) - offsetx;
float y = (j * k.height / num) - offsety;
float sendx = (y / height) / ratio + (window_id / ratio);
float sendy = (k.width - x) / k.width;
if ( sendx < window_id / ratio || sendx > ( window_id + 1 ) / ratio )
continue;
_msg.addFloatArg(sendx);
_msg.addFloatArg(sendy);
}
}
ofxOscSender _sender;
_sender.setup(SELF, OSC_SEND_PORT);
_sender.sendMessage(_msg);
}
if(!k.isConnected())
return;
if( int(cam_id) != k.getDeviceId() ){
k.close();
k.open(int(cam_id));
}
k.setCameraTiltAngle(angle);
k.update();
if(k.isFrameNew()){
kimage.setFromPixels(k.getPixels(), k.width, k.height, OF_IMAGE_COLOR);
dimage.setFromPixels(k.getDepthPixels(), k.width, k.height, OF_IMAGE_GRAYSCALE);
if(upside_down){
kimage.rotate90(2);
dimage.rotate90(2);
}
unsigned char * pix = dimage.getPixels();
int numPixels = dimage.getWidth() * dimage.getHeight();
for(int i = 0; i < numPixels; i++)
pix[i] = (pix[i] < near && pix[i] > far)? 255: 0;
if(grid)
for(int i = 0; i < numPixels; i++)
if((i / k.width % split == 0) || (i % k.width % split == 0) )
pix[i] = 0;
fimage.setFromPixels(pix, k.width,k.height, OF_IMAGE_GRAYSCALE);
ofxCvGrayscaleImage gray;
gray.allocate(k.width, k.height);
gray.setFromPixels(fimage.getPixels(), k.width, k.height);
cntr.findContours(gray, min_radius, max_radius, 18, true, true);
}
ofxOscMessage msg;
msg.setAddress("/pos");
msg.addIntArg(cntr.nBlobs );
float width = 2 * (right_bottom.x - left_top.x);
float height = 2 * (right_bottom.y - left_top.y);
float ratio = width / height;
float offsetx = 2 * (left_top.x - ((MARGIN - 1) * k.width / 4));
float offsety = 2 * (left_top.y - ((MARGIN - 1) * k.height / 4));
for(int i = 0; i < cntr.nBlobs; i++) {
ofxCvBlob blob = cntr.blobs.at(i);
ofPoint pos = blob.boundingRect.getCenter();
float x = pos.x - offsetx;
float y = pos.y - offsety;
float sendx = (y / height) / ratio + (window_id / ratio);
float sendy = (k.width - x) / k.width;
// if ( sendx < window_id / ratio || sendx > ( window_id + 1 ) / ratio )
// continue;
msg.addFloatArg(sendx);
msg.addFloatArg(sendy);
}
ofxOscSender self;
self.setup(SELF, OSC_SEND_PORT);
self.sendMessage(msg);
}
void ofApp::draw(){
ofPushMatrix();
{
ofScale(.5, .5);
ofPushMatrix();
ofTranslate(0, (MARGIN - 1) * k.height / 2);
ofTranslate((MARGIN - 1) * k.width / 2, 0);
// kimage.draw(0, 0, k.width, k.height);
// ofTranslate( 2 * (MARGIN - 1) * k.width / 2, 0);
dimage.draw(0, 0, k.width, k.height);
ofTranslate( 3 * (MARGIN - 1) * k.width / 2, 0);
fimage.draw(k.width, 0, k.width, k.height);
cntr.draw(k.width, 0, k.width, k.height);
ofPushStyle();
ofPushMatrix();
{
ofSetColor(255, 0, 0, 100);
ofTranslate(2 * k.width, 0);
for(int i = 0 ; i < cntr.nBlobs; i++){
ofxCvBlob blob = cntr.blobs.at(i);
ofCircle(blob.boundingRect.getCenter(), 5);
}
}
ofPopMatrix();
ofPopStyle();
ofPopMatrix();
}
ofPopMatrix();
ofPushMatrix();
ofPushStyle();
ofSetColor(255, 255, 255, 100);
ofRect(left_top, right_bottom.x - left_top.x, right_bottom.y - left_top.y);
ofSetColor(255, 255, 0);
ofCircle(left_top, 5);
ofSetColor(255, 0, 255);
ofCircle(right_bottom, 5);
ofSetColor(0, 255, 255, 255);
ofCircle((left_top + right_bottom ) / 2, 10);
ofPopStyle();
ofPopMatrix();
gui.draw();
}
void ofApp::keyPressed(int key){
if(key == 'l'){
left_top.set(mouseX, mouseY);
} else if(key == 'r'){
right_bottom.set(mouseX, mouseY);
} else if(key == 'c'){
ofVec2f center = (left_top + right_bottom ) / 2;
ofVec2f mouse(mouseX, mouseY);
ofVec2f diff = mouse - center;
left_top = left_top + diff;
right_bottom = right_bottom + diff;
}
}
void ofApp::keyReleased(int key){
}
void ofApp::mouseMoved(int x, int y ){
}
void ofApp::mouseDragged(int x, int y, int button) {
}
void ofApp::mousePressed(int x, int y, int button){
}
void ofApp::mouseReleased(int x, int y, int button){
}
void ofApp::windowResized(int w, int h){
}
void ofApp::gotMessage(ofMessage msg){
}
void ofApp::dragEvent(ofDragInfo dragInfo){
}
| [
"5c0tt.411en@gmail.com"
] | 5c0tt.411en@gmail.com |
e198549795cf72bbddcbc43da6e23eedb335fde6 | 66862c422fda8b0de8c4a6f9d24eced028805283 | /slambook2/3rdparty/opencv-3.3.0/modules/video/test/test_ecc.cpp | b1e951a68838110a7a0d8eafe89114e951319503 | [
"BSD-3-Clause",
"MIT"
] | permissive | zhh2005757/slambook2_in_Docker | 57ed4af958b730e6f767cd202717e28144107cdb | f0e71327d196cdad3b3c10d96eacdf95240d528b | refs/heads/main | 2023-09-01T03:26:37.542232 | 2021-10-27T11:45:47 | 2021-10-27T11:45:47 | 416,666,234 | 17 | 6 | MIT | 2021-10-13T09:51:00 | 2021-10-13T09:12:15 | null | UTF-8 | C++ | false | false | 14,072 | cpp | /*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "test_precomp.hpp"
using namespace cv;
using namespace std;
class CV_ECC_BaseTest : public cvtest::BaseTest
{
public:
CV_ECC_BaseTest();
protected:
double computeRMS(const Mat& mat1, const Mat& mat2);
bool isMapCorrect(const Mat& mat);
double MAX_RMS_ECC;//upper bound for RMS error
int ntests;//number of tests per motion type
int ECC_iterations;//number of iterations for ECC
double ECC_epsilon; //we choose a negative value, so that
// ECC_iterations are always executed
};
CV_ECC_BaseTest::CV_ECC_BaseTest()
{
MAX_RMS_ECC=0.1;
ntests = 3;
ECC_iterations = 50;
ECC_epsilon = -1; //-> negative value means that ECC_Iterations will be executed
}
bool CV_ECC_BaseTest::isMapCorrect(const Mat& map)
{
bool tr = true;
float mapVal;
for(int i =0; i<map.rows; i++)
for(int j=0; j<map.cols; j++){
mapVal = map.at<float>(i, j);
tr = tr & (!cvIsNaN(mapVal) && (fabs(mapVal) < 1e9));
}
return tr;
}
double CV_ECC_BaseTest::computeRMS(const Mat& mat1, const Mat& mat2){
CV_Assert(mat1.rows == mat2.rows);
CV_Assert(mat1.cols == mat2.cols);
Mat errorMat;
subtract(mat1, mat2, errorMat);
return sqrt(errorMat.dot(errorMat)/(mat1.rows*mat1.cols));
}
class CV_ECC_Test_Translation : public CV_ECC_BaseTest
{
public:
CV_ECC_Test_Translation();
protected:
void run(int);
bool testTranslation(int);
};
CV_ECC_Test_Translation::CV_ECC_Test_Translation(){}
bool CV_ECC_Test_Translation::testTranslation(int from)
{
Mat img = imread( string(ts->get_data_path()) + "shared/fruits.png", 0);
if (img.empty())
{
ts->printf( ts->LOG, "test image can not be read");
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_TEST_DATA);
return false;
}
Mat testImg;
resize(img, testImg, Size(216, 216));
cv::RNG rng = ts->get_rng();
int progress=0;
for (int k=from; k<ntests; k++){
ts->update_context( this, k, true );
progress = update_progress(progress, k, ntests, 0);
Mat translationGround = (Mat_<float>(2,3) << 1, 0, (rng.uniform(10.f, 20.f)),
0, 1, (rng.uniform(10.f, 20.f)));
Mat warpedImage;
warpAffine(testImg, warpedImage, translationGround,
Size(200,200), INTER_LINEAR + WARP_INVERSE_MAP);
Mat mapTranslation = (Mat_<float>(2,3) << 1, 0, 0, 0, 1, 0);
findTransformECC(warpedImage, testImg, mapTranslation, 0,
TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, ECC_iterations, ECC_epsilon));
if (!isMapCorrect(mapTranslation)){
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_OUTPUT);
return false;
}
if (computeRMS(mapTranslation, translationGround)>MAX_RMS_ECC){
ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
ts->printf( ts->LOG, "RMS = %f",
computeRMS(mapTranslation, translationGround));
return false;
}
}
return true;
}
void CV_ECC_Test_Translation::run(int from)
{
if (!testTranslation(from))
return;
ts->set_failed_test_info(cvtest::TS::OK);
}
class CV_ECC_Test_Euclidean : public CV_ECC_BaseTest
{
public:
CV_ECC_Test_Euclidean();
protected:
void run(int);
bool testEuclidean(int);
};
CV_ECC_Test_Euclidean::CV_ECC_Test_Euclidean() { }
bool CV_ECC_Test_Euclidean::testEuclidean(int from)
{
Mat img = imread( string(ts->get_data_path()) + "shared/fruits.png", 0);
if (img.empty())
{
ts->printf( ts->LOG, "test image can not be read");
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_TEST_DATA);
return false;
}
Mat testImg;
resize(img, testImg, Size(216, 216));
cv::RNG rng = ts->get_rng();
int progress = 0;
for (int k=from; k<ntests; k++){
ts->update_context( this, k, true );
progress = update_progress(progress, k, ntests, 0);
double angle = CV_PI/30 + CV_PI*rng.uniform((double)-2.f, (double)2.f)/180;
Mat euclideanGround = (Mat_<float>(2,3) << cos(angle), -sin(angle), (rng.uniform(10.f, 20.f)),
sin(angle), cos(angle), (rng.uniform(10.f, 20.f)));
Mat warpedImage;
warpAffine(testImg, warpedImage, euclideanGround,
Size(200,200), INTER_LINEAR + WARP_INVERSE_MAP);
Mat mapEuclidean = (Mat_<float>(2,3) << 1, 0, 0, 0, 1, 0);
findTransformECC(warpedImage, testImg, mapEuclidean, 1,
TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, ECC_iterations, ECC_epsilon));
if (!isMapCorrect(mapEuclidean)){
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_OUTPUT);
return false;
}
if (computeRMS(mapEuclidean, euclideanGround)>MAX_RMS_ECC){
ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
ts->printf( ts->LOG, "RMS = %f",
computeRMS(mapEuclidean, euclideanGround));
return false;
}
}
return true;
}
void CV_ECC_Test_Euclidean::run(int from)
{
if (!testEuclidean(from))
return;
ts->set_failed_test_info(cvtest::TS::OK);
}
class CV_ECC_Test_Affine : public CV_ECC_BaseTest
{
public:
CV_ECC_Test_Affine();
protected:
void run(int);
bool testAffine(int);
};
CV_ECC_Test_Affine::CV_ECC_Test_Affine(){}
bool CV_ECC_Test_Affine::testAffine(int from)
{
Mat img = imread( string(ts->get_data_path()) + "shared/fruits.png", 0);
if (img.empty())
{
ts->printf( ts->LOG, "test image can not be read");
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_TEST_DATA);
return false;
}
Mat testImg;
resize(img, testImg, Size(216, 216));
cv::RNG rng = ts->get_rng();
int progress = 0;
for (int k=from; k<ntests; k++){
ts->update_context( this, k, true );
progress = update_progress(progress, k, ntests, 0);
Mat affineGround = (Mat_<float>(2,3) << (1-rng.uniform(-0.05f, 0.05f)),
(rng.uniform(-0.03f, 0.03f)), (rng.uniform(10.f, 20.f)),
(rng.uniform(-0.03f, 0.03f)), (1-rng.uniform(-0.05f, 0.05f)),
(rng.uniform(10.f, 20.f)));
Mat warpedImage;
warpAffine(testImg, warpedImage, affineGround,
Size(200,200), INTER_LINEAR + WARP_INVERSE_MAP);
Mat mapAffine = (Mat_<float>(2,3) << 1, 0, 0, 0, 1, 0);
findTransformECC(warpedImage, testImg, mapAffine, 2,
TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, ECC_iterations, ECC_epsilon));
if (!isMapCorrect(mapAffine)){
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_OUTPUT);
return false;
}
if (computeRMS(mapAffine, affineGround)>MAX_RMS_ECC){
ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
ts->printf( ts->LOG, "RMS = %f",
computeRMS(mapAffine, affineGround));
return false;
}
}
return true;
}
void CV_ECC_Test_Affine::run(int from)
{
if (!testAffine(from))
return;
ts->set_failed_test_info(cvtest::TS::OK);
}
class CV_ECC_Test_Homography : public CV_ECC_BaseTest
{
public:
CV_ECC_Test_Homography();
protected:
void run(int);
bool testHomography(int);
};
CV_ECC_Test_Homography::CV_ECC_Test_Homography(){}
bool CV_ECC_Test_Homography::testHomography(int from)
{
Mat img = imread( string(ts->get_data_path()) + "shared/fruits.png", 0);
if (img.empty())
{
ts->printf( ts->LOG, "test image can not be read");
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_TEST_DATA);
return false;
}
Mat testImg;
resize(img, testImg, Size(216, 216));
cv::RNG rng = ts->get_rng();
int progress = 0;
for (int k=from; k<ntests; k++){
ts->update_context( this, k, true );
progress = update_progress(progress, k, ntests, 0);
Mat homoGround = (Mat_<float>(3,3) << (1-rng.uniform(-0.05f, 0.05f)),
(rng.uniform(-0.03f, 0.03f)), (rng.uniform(10.f, 20.f)),
(rng.uniform(-0.03f, 0.03f)), (1-rng.uniform(-0.05f, 0.05f)),(rng.uniform(10.f, 20.f)),
(rng.uniform(0.0001f, 0.0003f)), (rng.uniform(0.0001f, 0.0003f)), 1.f);
Mat warpedImage;
warpPerspective(testImg, warpedImage, homoGround,
Size(200,200), INTER_LINEAR + WARP_INVERSE_MAP);
Mat mapHomography = Mat::eye(3, 3, CV_32F);
findTransformECC(warpedImage, testImg, mapHomography, 3,
TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, ECC_iterations, ECC_epsilon));
if (!isMapCorrect(mapHomography)){
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_OUTPUT);
return false;
}
if (computeRMS(mapHomography, homoGround)>MAX_RMS_ECC){
ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
ts->printf( ts->LOG, "RMS = %f",
computeRMS(mapHomography, homoGround));
return false;
}
}
return true;
}
void CV_ECC_Test_Homography::run(int from)
{
if (!testHomography(from))
return;
ts->set_failed_test_info(cvtest::TS::OK);
}
class CV_ECC_Test_Mask : public CV_ECC_BaseTest
{
public:
CV_ECC_Test_Mask();
protected:
void run(int);
bool testMask(int);
};
CV_ECC_Test_Mask::CV_ECC_Test_Mask(){}
bool CV_ECC_Test_Mask::testMask(int from)
{
Mat img = imread( string(ts->get_data_path()) + "shared/fruits.png", 0);
if (img.empty())
{
ts->printf( ts->LOG, "test image can not be read");
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_TEST_DATA);
return false;
}
Mat scaledImage;
resize(img, scaledImage, Size(216, 216));
Mat_<float> testImg;
scaledImage.convertTo(testImg, testImg.type());
cv::RNG rng = ts->get_rng();
int progress=0;
for (int k=from; k<ntests; k++){
ts->update_context( this, k, true );
progress = update_progress(progress, k, ntests, 0);
Mat translationGround = (Mat_<float>(2,3) << 1, 0, (rng.uniform(10.f, 20.f)),
0, 1, (rng.uniform(10.f, 20.f)));
Mat warpedImage;
warpAffine(testImg, warpedImage, translationGround,
Size(200,200), INTER_LINEAR + WARP_INVERSE_MAP);
Mat mapTranslation = (Mat_<float>(2,3) << 1, 0, 0, 0, 1, 0);
Mat_<unsigned char> mask = Mat_<unsigned char>::ones(testImg.rows, testImg.cols);
for (int i=testImg.rows*2/3; i<testImg.rows; i++) {
for (int j=testImg.cols*2/3; j<testImg.cols; j++) {
testImg(i, j) = 0;
mask(i, j) = 0;
}
}
findTransformECC(warpedImage, testImg, mapTranslation, 0,
TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, ECC_iterations, ECC_epsilon), mask);
if (!isMapCorrect(mapTranslation)){
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_OUTPUT);
return false;
}
if (computeRMS(mapTranslation, translationGround)>MAX_RMS_ECC){
ts->set_failed_test_info(cvtest::TS::FAIL_BAD_ACCURACY);
ts->printf( ts->LOG, "RMS = %f",
computeRMS(mapTranslation, translationGround));
return false;
}
}
return true;
}
void CV_ECC_Test_Mask::run(int from)
{
if (!testMask(from))
return;
ts->set_failed_test_info(cvtest::TS::OK);
}
TEST(Video_ECC_Translation, accuracy) { CV_ECC_Test_Translation test; test.safe_run();}
TEST(Video_ECC_Euclidean, accuracy) { CV_ECC_Test_Euclidean test; test.safe_run(); }
TEST(Video_ECC_Affine, accuracy) { CV_ECC_Test_Affine test; test.safe_run(); }
TEST(Video_ECC_Homography, accuracy) { CV_ECC_Test_Homography test; test.safe_run(); }
TEST(Video_ECC_Mask, accuracy) { CV_ECC_Test_Mask test; test.safe_run(); }
| [
"594353397@qq.com"
] | 594353397@qq.com |
37160253f59233b5f884dbee5ec5f0f37a624bce | 7a83d4d418495f5c1df0bbf335780f65aedb8af8 | /EditableMesh.h | fe030a8a7fd03a0631d78e794de1d56a571b077a | [] | no_license | jaschmid/MeshTools | aac8d9c3677ce999ff8cede4ca0819e8a00ac5eb | 11f169723adb1563b2001ddf7021b7d93dc30de1 | refs/heads/master | 2021-01-01T18:48:08.506040 | 2011-08-11T07:47:31 | 2011-08-11T07:47:31 | 2,189,831 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 58,736 | h | /********************************************************/
/* FILE: EditableMesh.h */
/* DESCRIPTION: Defines an Editable Mesh Class */
/* AUTHOR: Jan Schmid (jaschmid@eml.cc) */
/********************************************************/
#ifndef __EDITABLE_MESH_H__
#define __EDITABLE_MESH_H__
#ifdef _DEBUG
#define HASSERT(x) assert(x)
#else
#define HASSERT(x) (x)
#endif
#include "types.h"
#include <tuple>
#include <list>
#include <vector>
#include <array>
#include <boost/pool/object_pool.hpp>
namespace HAGE {
namespace _EditableMeshInternal {
/*****************************************************************/
/* template class that implements method to retrieve vertex data */
/*****************************************************************/
template<class _VertexType,class _Final> class _CEditableMesh_GetVertexData
{
public:
_VertexType& GetVertexData(const typename _Final::Vertex& vertex)
{
return ((_Final*)this)->getInternal(vertex)->data.contents;
}
const _VertexType& GetVertexData(const typename _Final::Vertex& vertex) const
{
return ((_Final*)this)->getInternal(vertex)->data.contents;
}
};
template<class _Final> class _CEditableMesh_GetVertexData<void,_Final>
{
};
/***************************************************************/
/* template class that implements method to retrieve edge data */
/***************************************************************/
template<class _EdgeType,class _Final> class _CEditableMesh_GetEdgeData
{
public:
_EdgeType& GetEdgeData(const typename _Final::Edge& edge)
{
return ((_Final*)this)->getInternal(edge)->data.contents;
}
const _EdgeType& GetEdgeData(const typename _Final::Edge& edge) const
{
return ((_Final*)this)->getInternal(edge)->data.contents;
}
};
/***************************************************************/
/* template class that implements method to retrieve face data */
/***************************************************************/
template<class _Final> class _CEditableMesh_GetEdgeData<void,_Final>
{
};
template<class _FaceType,class _Final> class _CEditableMesh_GetFaceData
{
public:
_FaceType& GetFaceData(const typename _Final::Face& face)
{
return ((_Final*)this)->getInternal(face)->data.contents;
}
const _FaceType& GetFaceData(const typename _Final::Face& face) const
{
return ((_Final*)this)->getInternal(face)->data.contents;
}
};
template<class _Final> class _CEditableMesh_GetFaceData<void,_Final>
{
};
/****************************/
/* Editable Mesh Base Class */
/****************************/
template<class _VertexType, class _FaceType, class _EdgeType,class _Final> class _CEditableMeshBase
{
public:
// Types
typedef _VertexType VertexType;
typedef _FaceType FaceType;
typedef _EdgeType EdgeType;
typedef _CEditableMeshBase<_VertexType, _FaceType, _EdgeType, _Final> BaseType;
typedef _Final ThisType;
typedef u64 IndexType;
static const int PolySize = 3;
typedef enum _RAW_INDEX_FORMAT
{
RAW_INDEX_TRIANGLE_LIST = 0,
RAW_INDEX_TRIANGLE_STRIP = 1,
RAW_INDEX_TRIANGLE_FAN = 2
} RAW_INDEX_FORMAT;
_CEditableMeshBase() : _unusedEdges(0),_unusedVertices(0),_unusedFaces(0),_edges_pool(sizeof(_HE_edge_pair)),_faces_pool(sizeof(_HE_face)),_vertices_pool(sizeof(_HE_vert)) {}
private:
template<class _internal,class _data> class _InternalConvert
{
public:
operator const _data&() const
{
return ((_internal*)(this))->internal_data->data.contents;
}
template<class _target> operator const _target() const
{
return (const _target)((_internal*)(this))->internal_data->data.contents;
}
_data* operator ->() const
{
return &((_internal*)(this))->internal_data->data.contents;
}
};
template<class _internal> class _InternalConvert<_internal,void>
{
public:
};
class _HE_edge;
class _HE_edge_pair;
class _HE_vert;
class _HE_face;
public:
typedef class _Edge : public _InternalConvert<_Edge,EdgeType>
{
private:
_HE_edge_pair* internal_data;
_Edge(_HE_edge_pair* val) : internal_data(val) {}
public:
_Edge() : internal_data(nullptr) {}
IndexType Index() const
{
return internal_data->index;
}
bool operator == (const _Edge& e) const
{
return internal_data == e.internal_data;
}
bool operator != (const _Edge& e) const
{
return internal_data != e.internal_data;
}
friend class BaseType;
} Edge;
typedef class _Face : public _InternalConvert<_Face,FaceType>
{
private:
_HE_face* internal_data;
_Face(_HE_face* val) : internal_data(val) {}
public:
_Face() : internal_data(nullptr) {}
IndexType Index() const
{
return internal_data->index;
}
bool operator == (const _Face& e) const
{
return internal_data == e.internal_data;
}
bool operator != (const _Face& e) const
{
return internal_data != e.internal_data;
}
friend class BaseType;
} Face;
typedef class _Vertex : public _InternalConvert<_Vertex,VertexType>
{
private:
_HE_vert* internal_data;
_Vertex(_HE_vert* val) : internal_data(val) {}
public:
_Vertex() : internal_data(nullptr) {}
IndexType Index() const
{
return internal_data->index;
}
bool operator == (const _Vertex& e) const
{
return internal_data == e.internal_data;
}
bool operator != (const _Vertex& e) const
{
return internal_data != e.internal_data;
}
friend class BaseType;
} Vertex;
typedef std::array<Face,2> FacePair;
typedef std::array<Vertex,2> VertexPair;
typedef std::array<Vertex,PolySize> VertexTriple;
typedef std::array<Edge,PolySize> EdgeTriple;
typedef std::tuple<Vertex,Edge,Face> ElementTriple;
static const Edge nullEdge;
static const Vertex nullVertex;
static const Face nullFace;
// Methods
static FacePair MakePair(const Face& f1,const Face& f2)
{
FacePair fp = {{f1,f2}};
return fp;
}
static VertexPair MakePair(const Vertex& v1,const Vertex& v2)
{
VertexPair vp = {{v1,v2}};
return vp;
}
static EdgeTriple MakeTriple(const Edge& e1,const Edge& e2,const Edge& e3)
{
EdgeTriple et = {{e1,e2,e3}};
return et;
}
static VertexTriple MakeTriple(const Vertex& v1,const Vertex& v2,const Vertex& v3)
{
VertexTriple vt = {{v1,v2,v3}};
return vt;
}
IndexType GetNumFaces() const
{
return (IndexType)_faces.size() - _unusedFaces;
}
IndexType GetNumEdges() const
{
return (IndexType)_edges.size() - _unusedEdges;
}
IndexType GetNumVertices() const
{
return (IndexType)_vertices.size() - _unusedVertices;
}
IndexType GetNumFaceIndices() const
{
return (IndexType)_faces.size();
}
IndexType GetNumEdgeIndices() const
{
return (IndexType)_edges.size();
}
IndexType GetNumVertexIndices() const
{
return (IndexType)_vertices.size();
}
Vertex GetVertex(IndexType index) const { if(index >= GetNumVertexIndices()) return nullVertex; else return getExternal(_vertices[(size_t)index]);}
IndexType GetIndex(const Vertex& v) const { return getInternal(v)->index;}
Vertex GetVertex(const Vertex& _v, const Edge& _e) const
{
const HE_vert* v = getInternal(_v);
const HE_edge* e = getInternal(_e);
if(e->end_vertex == v)
return getExternal(e->pair_edge->end_vertex);
else if(e->pair_edge->end_vertex == v)
return getExternal(e->end_vertex);
else
return nullVertex;
}
Edge GetEdge(IndexType index) const { if(index >= GetNumEdgeIndices()) return nullEdge; else return getExternal(_edges[(size_t)index]);}
IndexType GetIndex(const Edge& e) const { return getInternal(e)->index;}
Edge GetEdge(const VertexPair& _v) const
{
const HE_vert* v1 = getInternal(_v[0]);
const HE_vert* v2 = getInternal(_v[1]);
if( !isValid(v1) || !isValid(v2))
return nullEdge;
const HE_edge* candidate = v1->edge;
//search ccw
do
{
if(candidate -> end_vertex == v2)
return getExternal(candidate);
candidate = candidate->pair_edge->getNextEdge();
}
while(candidate != v1->edge);
//we rotated a full circle
return nullEdge;
}
Edge GetEdge(const FacePair& _f) const
{
const HE_face* f1 = getInternal(_f[0]);
const HE_face* f2 = getInternal(_f[1]);
if( !isValid(f1) || !isValid(f2))
return nullEdge;
const HE_edge* candidate = f1->edge;
for(int i = 0; i < PolySize; ++i)
{
if(candidate->pair_edge->face == f2)
return getExternal(candidate);
candidate = candidate->getNextEdge();
}
return nullEdge;
}
Face GetFace(IndexType index) const { HASSERT(index < GetNumFaceIndices()); return getExternal(_faces[(size_t)index]);}
IndexType GetIndex(const Face& f) const { return getInternal(f)->index;}
Face GetFace(const VertexTriple& _v) const
{
static_HASSERT( PolySize == 3 , "function assumes PolySize == 3" );
const HE_vert* v1 = getInternal(_v[0]);
const HE_vert* v2 = getInternal(_v[1]);
const HE_vert* v3 = getInternal(_v[2]);
if( !isValid(v1) || !isValid(v2) || !isValid(v3))
return nullFace;
HE_edge* current = v1->edge;
do
{
//only if we have a face associated
if(current->end_vertex == v2)
{
if(current->getNextEdge()->end_vertex == v3)
return getExternal(current->face);
else
return nullFace;
}
current = current->pair_edge->getNextEdge();
}
while(current != v1->edge);
//did full circle
return nullFace;
}
Face GetFace(const EdgeTriple& _e) const
{
static_HASSERT( PolySize == 3 , "function assumes PolySize == 3" );
const HE_edge* e1 = getInternal(_e[0]);
const HE_edge* e2 = getInternal(_e[1]);
const HE_edge* e3 = getInternal(_e[2]);
if( !isValid(e1) || !isValid(e2) || !isValid(e3))
return nullFace;
//check this face
if( (e1->getNextEdge() == e2 && e1->getNextEdge()->getNextEdge() == e3) ||
(e1->getNextEdge() == e3 && e1->getNextEdge()->getNextEdge() == e2) )
{
return getExternal(e1->face);
}
e1 = e1->pair_edge;
//check opposite face
if( (e1->getNextEdge() == e2 && e1->getNextEdge()->getNextEdge() == e3) ||
(e1->getNextEdge() == e3 && e1->getNextEdge()->getNextEdge() == e2) )
{
return getExternal(e1->face);
}
//did full circle
return nullFace;
}
EdgeTriple GetFaceEdges(const Face& face) const
{
const HE_face* f = getInternal(face);
EdgeTriple result = {{nullEdge,nullEdge,nullEdge}};
if(!isValid(f))
return result;
const HE_edge* e= f->edge;
for(int i = 0; i < PolySize; ++i)
{
result[i] = getExternal(e);
e = e->getNextEdge();
}
return result;
}
VertexTriple GetFaceVertices(const Face& face) const
{
const HE_face* f = getInternal(face);
VertexTriple result = {{nullVertex,nullVertex,nullVertex}};
if(!isValid(f))
return result;
const HE_edge* e= f->edge;
for(int i = 0; i < PolySize; ++i)
{
result[i] = getExternal(e->end_vertex);
e = e->getNextEdge();
}
return result;
}
VertexPair GetEdgeVertices(const Edge& edge) const
{
const HE_edge* e = getInternal(edge);
VertexPair result = {{nullVertex,nullVertex}};
if(!isValid(e))
return result;
result[0] = getExternal(e->end_vertex);
result[1] = getExternal(e->pair_edge->end_vertex);
return result;
}
VertexPair GetEdgeOpposingVertices(const Edge& edge) const
{
const HE_edge* e = getInternal(edge);
VertexPair result = {{nullVertex,nullVertex}};
if(!isValid(e))
return result;
if(e->face)
result[0] = getExternal(e->getNextEdge()->end_vertex);
if(e->pair_edge->face)
result[1] = getExternal(e->pair_edge->getNextEdge()->end_vertex);
return result;
}
FacePair GetEdgeFaces(const Edge& edge) const
{
const HE_edge* e = getInternal(edge);
FacePair result = {{nullFace,nullFace}};
if(!isValid(e))
return result;
result[0] = getExternal(e->face);
result[1] = getExternal(e->pair_edge->face);
return result;
}
Edge GetFirstVertexEdge(const Vertex& vertex) const { return GetNextVertexEdge(vertex,nullEdge); }
Face GetFirstVertexFace(const Vertex& vertex) const { return GetNextVertexFace(vertex,nullFace); }
ElementTriple GetFirstVertexElementTriple(const Vertex& vertex) const { return GetNextVertexElementTriple(vertex,ElementTriple(nullVertex,nullEdge,nullFace)); }
Edge GetNextVertexEdge(const Vertex& vertex,const Edge& previous_edge) const
{
const HE_vert* v = getInternal(vertex);
const HE_edge* e = getInternal(previous_edge);
if(!isValid(v) || (v->edge == nullptr) )
return nullEdge;
if(!isValid(e))
return getExternal(v->edge);
// we might get the wrong one
if(e->end_vertex != v)
e = e->pair_edge;
HASSERT(e->end_vertex == v);
// return next ccw
if(e->getNextEdge() == v->edge)
return nullEdge;
else
return getExternal(e->getNextEdge());
}
ElementTriple GetNextVertexElementTriple(const Vertex& vertex,const ElementTriple& previous_triple) const
{
const HE_vert* v = getInternal(vertex);
const HE_edge* e = getInternal(std::get<1>(previous_triple));
if(!isValid(v) || (v->edge == nullptr) )
return ElementTriple(nullVertex,nullEdge,nullFace);
if(!isValid(e))
return ElementTriple(getExternal(v->edge->end_vertex),getExternal(v->edge),getExternal(v->edge->face));
// we might get the wrong one
if(e->end_vertex != v)
e = e->pair_edge;
HASSERT(e->end_vertex == v);
// return next ccw
if(e->getNextEdge() == v->edge)
return ElementTriple(nullVertex,nullEdge,nullFace);
else
return ElementTriple(getExternal(e->getNextEdge()->end_vertex),getExternal(e->getNextEdge()),getExternal(e->getNextEdge()->face));
}
Face GetNextVertexFace(const Vertex& vertex,const Face& previous_face) const
{
const HE_vert* v = getInternal(vertex);
const HE_face* f = getInternal(previous_face);
if(!isValid(v) || (v->edge == nullptr) )
return nullFace;
//depending if inside or outside
const HE_face* first_face = (v->edge->face) ? (v->edge->face) : (v->edge->pair_edge->face);
if(!isValid(f))
return getExternal(first_face);
// find edge with v as end
HE_edge* e = f->edge;
for(int i = 0; i<3;i++)
{
if(e->end_vertex == v)
break;
e = e->getNextEdge();
}
//end vertex has to be v now or previous_face was not a face around v
HASSERT(e->end_vertex ==v);
// return next ccw
e = e->getNextEdge()->pair_edge;
//make sure it's not outside
if(e->face)
{
if(e->face ==first_face)
return nullFace;
else
return getExternal(e->face);
}
else
{
if(e->getNextEdge()->pair_edge->face == first_face)
return nullFace;
else
return getExternal(e->getNextEdge()->pair_edge->face);
}
}
void InvalidateFace(const Face& face)
{
HE_face* f = getInternal(face);
if(!isValid(f))
return;
HE_edge* e[PolySize];
HE_edge* cur = f->edge;
for(int i = 0 ; i<PolySize;++i)
{
e[i] = cur;
cur->face = nullptr;
cur = cur->getNextEdge();
}
HASSERT(cur = f->edge);
f->edge = nullptr;
internalRemove(f);
//check for degenerate edges
for(int i = 0 ; i < PolySize ; ++i)
removeDegenerateEdge(e[i]);
}
void InvalidateEdge(const Edge& Edge)
{
FacePair p = GetEdgeFaces(Edge);
InvalidateFace(p[0]);
InvalidateFace(p[1]);
}
void InvalidateVertex(const Vertex& v)
{
HE_vertex* _v = getInternal(v);
if(_v->face == nullptr)
{
//orphaned vertex
internalRemove(v);
return;
}
Face f=GetFirstVertexFace(v);
do
InvalidateFace(f);
while((f =GetFirstVertexFace(v)) != nullFace);
}
bool IsValidVertexMerge(const VertexPair& vpair)
{
if(vpair[0] == vpair[1])
return false;
HE_vert* v1 = getInternal(vpair[0]),* v2 = getInternal(vpair[1]);
//try new test function
_edgeAdjectencyData data;
if(!findMergeEdgesEx(v1,v2,data))
return false;
return true;
}
Vertex MergeVertex(const VertexPair& vpair)
{
if(vpair[0] == vpair[1])
return nullVertex;
HE_vert* v1 = getInternal(vpair[0]),* v2 = getInternal(vpair[1]);
//try new test function
_edgeAdjectencyData data;
if(!findMergeEdgesEx(v1,v2,data))
return nullVertex;
bool bEdge = false;
HE_edge* v1_next=data.v0_next,*v1_prev=data.v0_prev;
HE_edge* v2_next=data.v1_next,*v2_prev=data.v1_prev;
if(data.edge)
{
HE_edge* s = data.edge;
InvalidateEdge(getExternal(s));
bEdge = true;
if(v1_prev)
HASSERT(v1_prev->getNextEdge() == v1_next);
else
HASSERT(v1->edge == nullptr);
if(v2_prev)
HASSERT(v2_prev->getNextEdge() == v2_next);
else
HASSERT(v2->edge == nullptr);
}
else
{
//if we have exclusive edges, fix them
if(v1_prev && v2_prev)
{
if(v1_next->end_vertex == v2_prev->pair_edge->end_vertex && v1_next->getNextEdge() != v2_prev)
{
if(!twistEdgeConnect(v1_next,v2_prev))
return nullVertex;
HASSERT(getPrevEdge(v2_prev) == v1_next);
}
if(v2_next->end_vertex == v1_prev->pair_edge->end_vertex && v2_next->getNextEdge() != v1_prev)
{
if(!twistEdgeConnect(v2_next,v1_prev))
return nullVertex;
HASSERT(getPrevEdge(v1_prev) == v2_next);
}
if(v2_prev->getNextEdge() != v2_next)
{
if(!twistEdgeConnect(v2_prev,v2_next))
return nullVertex;
}
if(v1_prev->getNextEdge() != v1_next)
{
if(!twistEdgeConnect(v1_prev,v1_next))
return nullVertex;
}
HASSERT(getPrevEdge(v1_next) == v1_prev);
HASSERT(getPrevEdge(v2_next) == v2_prev);
}
}
//we're now certain so we can start changing stuff
if(v1->edge)
{
HE_edge* cur = v1->edge;
do
{
cur->pair_edge->end_vertex = v2;
cur = cur->pair_edge->getNextEdge();
}
while(cur != v1->edge);
}
if(v1_next && v2_next)
{
if(v1_next->getNextEdge() == v2_prev)
mergeDoubleEdges(v1_next,v2_prev);
else
v2_prev->setNextEdge(v1_next);
if(v2_next->getNextEdge() == v1_prev)
mergeDoubleEdges(v2_next,v1_prev);
else
v1_prev->setNextEdge(v2_next);
}
else if(!v2->edge)
v2->edge = v1->edge;
internalRemove(v1);
return getExternal(v2);
}
void DebugValidateMesh() const
{
const HE_face* f=nullptr;
const HE_edge* e =nullptr;
u32 nEdges = 0;
for(size_t i = 0; i<_faces.size();++i)
if(f = _faces[i])
{
e = f->edge;
HASSERT(e);
for(int ie=0;ie<PolySize;++ie)
{
e=e->getNextEdge();
HASSERT(e->end_vertex);
HASSERT(e->pair_edge->pair_edge ==e);
HASSERT(e->getNextEdge()->pair_edge->end_vertex == e->end_vertex);
HASSERT(e->face == f);
const HE_edge* s = e;
const HE_edge* ps = getPrevEdge(s);
const HE_edge* psp = getPrevEdge(s->pair_edge);
HASSERT(ps->getNextEdge() == s);
HASSERT(getPrevEdge(s->getNextEdge()) == s);
HASSERT(e->end_vertex->edge);
HASSERT(_vertices[(size_t)e->end_vertex->index]);
HASSERT(s->getNextEdge()->getNextEdge()->end_vertex != s->end_vertex);
HASSERT(ps->end_vertex == s->pair_edge->end_vertex);
HASSERT(psp->end_vertex == s->end_vertex);
++nEdges;
}
HASSERT(e==f->edge);
}
//rest of edges must be outer
HE_edge_pair* p;
e = nullptr;
for(size_t i = 0; i<_edges.size();++i)
if(p = _edges[i])
for(int ie=0;ie<2;ie++)
if(((e = &p->edges[ie])!=nullptr) && (e->face == nullptr))
{
nEdges ++;
const HE_edge* s = e;
const HE_edge* ps = getPrevEdge(s);
const HE_edge* psp = getPrevEdge(s->pair_edge);
HASSERT(s->end_vertex);
HASSERT(ps->getNextEdge() == s);
HASSERT(getPrevEdge(s->getNextEdge()) == s);
HASSERT(e->end_vertex->edge);
HASSERT(_vertices[(size_t)e->end_vertex->index]);
HASSERT(s->pair_edge->face);
HASSERT(!s->face);
HASSERT(s->getNextEdge()->getNextEdge()->end_vertex != s->end_vertex);
HASSERT(ps->end_vertex == s->pair_edge->end_vertex);
HASSERT(psp->end_vertex == s->end_vertex);
s = s->pair_edge->getNextEdge();
while(s!=e)
{
HASSERT(s->end_vertex != e->end_vertex);
s = s->pair_edge->getNextEdge();
}
/* takes too long
for(size_t i2 = 0; i2<_edges.size();++i2)
if( _edges[i2] && _edges[i2] != s)
HASSERT(! ( _edges[i2]->end_vertex == e->end_vertex && _edges[i2]->pair_edge->end_vertex == e->pair_edge->end_vertex) );
*/
}
HASSERT(nEdges == GetNumEdges()*2);
//chec edge loops
for(size_t i = 0; i<_edges.size();++i)
if(p = _edges[i])
for(int ie=0;ie<2;ie++)
{
e = &p->edges[ie];
const HE_edge* s = e->pair_edge->end_vertex->edge;
bool bFound = false;
do
{
if(s==e)
bFound=true;
s = s->pair_edge->getNextEdge();
}
while(s!=e->pair_edge->end_vertex->edge);
HASSERT(bFound);
}
//check vertices
const HE_vert* v = nullptr;
for(size_t i = 0; i<_vertices.size();++i)
if((v = _vertices[i]) && v->edge)
{
e = v->edge;
do
{
HASSERT(e->pair_edge->end_vertex == v);
e = e->pair_edge->getNextEdge();
}
while(e != v->edge);
}
}
bool FlipEdge(const Edge& edge)
{
HE_edge* e = getInternal(edge);
if(!isValid(e))
return false;
if( !e->face || !e->pair_edge->face )
return false;
if( getEdge(e->getNextEdge()->end_vertex,e->pair_edge->getNextEdge()->end_vertex) )
return false;
HE_edge* e_next = e->getNextEdge()->getNextEdge();
HE_edge* ep_next = e->pair_edge->getNextEdge()->getNextEdge();
e->face->edge = e;
e->getNextEdge()->face = e->pair_edge->face;
e->pair_edge->face->edge = e->pair_edge;
e->pair_edge->getNextEdge()->face = e->face;
e->getNextEdge()->getNextEdge()->setNextEdge(e->pair_edge->getNextEdge());
e->pair_edge->getNextEdge()->getNextEdge()->setNextEdge(e->getNextEdge());
e->getNextEdge()->setNextEdge(e->pair_edge);
e->pair_edge->getNextEdge()->setNextEdge(e);
if(e->end_vertex->edge == e->pair_edge)
e->end_vertex->edge = e->getNextEdge();
if(e->pair_edge->end_vertex->edge == e)
e->pair_edge->end_vertex->edge = e->pair_edge->getNextEdge();
e->setNextEdge(e_next);
e->pair_edge->setNextEdge(ep_next);
e->end_vertex = e_next->pair_edge->end_vertex;
e->pair_edge->end_vertex = ep_next->pair_edge->end_vertex;
return true;
}
Vertex SplitEdge(const Edge& edge)
{
HE_edge* e = getInternal(edge);
if(!isValid(e))
return nullVertex;
HE_edge* pair_prev = getPrevEdge(e->pair_edge);
//first naively split the edge creating 2 4-gons
HE_vert* v = internalAllocVert();
HE_edge* e2 = internalAllocEdge();
e2->setNextEdge(e->getNextEdge());
e2->end_vertex = e->end_vertex;
e2->pair_edge->setNextEdge(e->pair_edge);
e2->pair_edge->end_vertex = v;
e->setNextEdge(e2);
pair_prev->setNextEdge(e2->pair_edge);
e->end_vertex->edge = e2->pair_edge;
e->end_vertex = v;
v->edge = e2;
//check if we have faces to split
if(e->face)
{
e->face->edge = e;
HE_edge* e_side = internalAllocEdge();
HE_face* f_side = internalAllocFace();
f_side->edge = e2;
e2->face = f_side;
e_side->face = e->face;
e_side->pair_edge->face = f_side;
e2->getNextEdge()->face = f_side;
e_side->setNextEdge(e2->getNextEdge()->getNextEdge());
e_side->pair_edge->setNextEdge(e2);
e_side->end_vertex = e2->getNextEdge()->end_vertex;
e_side->pair_edge->end_vertex = e->end_vertex;
e2->getNextEdge()->setNextEdge(e_side->pair_edge);
e->setNextEdge(e_side);
}
else
e2->face = nullptr;
if(e->pair_edge->face)
{
e->pair_edge->face->edge = e->pair_edge;
HE_edge* e_side = internalAllocEdge();
HE_face* f_side = internalAllocFace();
f_side->edge = e2->pair_edge;
e2->pair_edge->face = f_side;
e_side->face = f_side;
e_side->pair_edge->face = e->pair_edge->face;
e->pair_edge->getNextEdge()->getNextEdge()->face = f_side;
e_side->setNextEdge(e->pair_edge->getNextEdge()->getNextEdge());
e_side->pair_edge->setNextEdge(e->pair_edge);
e_side->end_vertex = e->pair_edge->getNextEdge()->end_vertex;
e_side->pair_edge->end_vertex = e->end_vertex;
e->pair_edge->getNextEdge()->setNextEdge(e_side->pair_edge);
e2->pair_edge->setNextEdge(e_side);
}
else
e2->pair_edge->face = nullptr;
return getExternal(v);
}
Face InsertFace(const VertexTriple& vertices)
{
// find if we're re-using any old edges
HE_vert* v[PolySize];
HE_edge* e[PolySize];
_edgeAdjectencyData adj_data[PolySize];
memset(adj_data,0,sizeof(_edgeAdjectencyData)*PolySize);
for(int i = 0 ; i < PolySize; ++i)
v[i] = getInternal(vertices[i]);
for(int i = 0; i<PolySize; ++i)
{
e[i] = getEdge(v[i],v[(i+1)%PolySize]);
if(e[i] && e[i]->face)
return nullFace;
}
for(int i = 0; i<PolySize; ++i)
{
if(e[i])
{
if(e[(i+1)%PolySize])
{
if(e[i]->getNextEdge() != e[(i+1)%PolySize] && !twistEdgeConnect(e[i],e[(i+1)%PolySize]))
return false;
adj_data[i].v1_next = e[(i+1)%PolySize];
adj_data[i].v1_prev = getPrevEdge(e[i]->pair_edge);
adj_data[(i+1)%PolySize].v0_next = e[(i+1)%PolySize]->pair_edge->getNextEdge();
}
else
{
adj_data[i].v1_next = nullptr;
adj_data[i].v1_prev = getPrevEdge(e[i]->pair_edge);
adj_data[(i+1)%PolySize].v0_next = e[i]->getNextEdge();
}
adj_data[(i+1)%PolySize].v0_prev = e[i];
adj_data[i].edge = e[i];
}
else
{
if(e[(i+1)%PolySize])
{
adj_data[i].v1_next = e[(i+1)%PolySize];
adj_data[i].v1_prev = getPrevEdge(e[(i+1)%PolySize]);
adj_data[(i+1)%PolySize].v0_next = e[(i+1)%PolySize]->pair_edge->getNextEdge();
adj_data[(i+1)%PolySize].v0_prev = nullptr;
}
else
{
if(v[(i+1)%PolySize]->edge)
{
adj_data[i].v1_prev = getNextFreeInner(v[(i+1)%PolySize]->edge->pair_edge);
if(adj_data[i].v1_prev== nullptr)
return false;
adj_data[i].v1_next = nullptr;
adj_data[(i+1)%PolySize].v0_next = adj_data[i].v1_prev->getNextEdge();
adj_data[(i+1)%PolySize].v0_prev = nullptr;
}
else
{
adj_data[i].v1_prev = nullptr;
adj_data[i].v1_next = nullptr;
adj_data[(i+1)%PolySize].v0_next = nullptr;
adj_data[(i+1)%PolySize].v0_prev = nullptr;
}
}
adj_data[i].edge = nullptr;
}
}
//assuming everything is good now, create edges
for(int i = 0; i<PolySize; ++i)
if(!adj_data[i].edge)
{
HE_edge* e_new = internalAllocEdge();
e[i] = e_new;
adj_data[i].edge = e_new;
if(!v[i]->edge)
v[i]->edge = e[i];
e[i]->end_vertex = v[(i+1)%PolySize];
e[i]->face = nullptr;
e[i]->pair_edge->face = nullptr;
e[i]->pair_edge->end_vertex = v[i];
if(!adj_data[(i-1+PolySize)%PolySize].v1_next)
adj_data[(i-1+PolySize)%PolySize].v1_next = e[i];
if(!adj_data[(i-1+PolySize)%PolySize].v1_prev)
adj_data[(i-1+PolySize)%PolySize].v1_prev = e[i]->pair_edge;
if(!adj_data[(i+1)%PolySize].v0_next)
adj_data[(i+1)%PolySize].v0_next = e[i]->pair_edge;
if(!adj_data[(i+1)%PolySize].v0_prev)
adj_data[(i+1)%PolySize].v0_prev = e[i];
}
for(int i = 0; i<PolySize; ++i)
{
adj_data[i].v0_prev->setNextEdge(e[i]);
e[i]->setNextEdge(adj_data[i].v1_next);
adj_data[i].v1_prev->setNextEdge(e[i]->pair_edge);
e[i]->pair_edge->setNextEdge(adj_data[i].v0_next);
}
HE_face* f = internalAllocFace();
f->edge = e[0];
for(int i = 0 ; i < PolySize; ++i)
{
HASSERT(e[i]->face == nullptr);
e[i]->face = f;
HASSERT(e[i]->getNextEdge() == e[(i+1)%PolySize]);
HASSERT(adj_data[i].v0_prev->getNextEdge() == adj_data[i].edge);
HASSERT(adj_data[i].edge->getNextEdge() == adj_data[i].v1_next);
HASSERT(adj_data[i].v1_prev->getNextEdge() == adj_data[i].edge->pair_edge);
HASSERT(adj_data[i].edge->pair_edge->getNextEdge() == adj_data[i].v0_next);
}
return getExternal(f);
}
Vertex InsertVertex()
{
HE_vert* vertex = internalAllocVert();
vertex->edge = nullptr;
return getExternal(vertex);
}
void Compact()
{
IndexType w=0;
//compact edges
for(size_t r = 0 ; r<_edges.size();++r)
if(_edges[(size_t)r])
{
_edges[(size_t)w] = _edges[r];
_edges[(size_t)w]->index = (IndexType)w;
++w;
}
_edges.resize((size_t)w);
_unusedEdges = 0;
//compact faces
w=0;
for(size_t r = 0 ; r<_faces.size();++r)
if(_faces[(size_t)r])
{
_faces[(size_t)w] = _faces[r];
_faces[(size_t)w]->index = (IndexType)w;
++w;
}
_faces.resize((size_t)w);
_unusedFaces = 0;
//compact vertices
w=0;
for(size_t r = 0 ; r<_vertices.size();++r)
if(_vertices[r])
{
_vertices[(size_t)w] = _vertices[r];
_vertices[(size_t)w]->index = (IndexType)w;
++w;
}
_vertices.resize((size_t)w);
_unusedVertices = 0;
}
template<RAW_INDEX_FORMAT _format,class _index_type> void ImportRawIndexData(const size_t& nPrimitives,const _index_type* pData)
{
IndexType newVerticesBegin = GetNumVertexIndices();
IndexType newFacesBegin = GetNumFaceIndices();
IndexType newEdgesBegin = GetNumEdgeIndices();
//figure out how many vertices we'll need
IndexType nNewVertices = 0;
typedef rawFormatReader<_format,_index_type> reader_type;
reader_type reader;
for(size_t i = 0; i<nPrimitives; i++)
{
reader_type::Primitive result = reader(i,pData);
for(auto e = result.begin();e!=result.end();++e)
if(*e >= nNewVertices)
nNewVertices = *e+1;
}
// we're gonna allocate alot
_vertices.reserve(newVerticesBegin + nNewVertices);
_faces.reserve(newFacesBegin + nPrimitives);
_edges.reserve(newEdgesBegin + 2*nPrimitives); // just a guess, no way to know this
for(int i = 0 ; i <nNewVertices;++i)
internalAllocVert()->edge = nullptr;
//vertices should be there now, create the faces
for(int i = 0 ; i <nPrimitives; ++i)
{
reader_type::Primitive result = reader(i,pData);
Face f = InsertFace(MakeTriple(
GetVertex(result[0] + newVerticesBegin),
GetVertex(result[1] + newVerticesBegin),
GetVertex(result[2] + newVerticesBegin)
));
// something went wrong
//HASSERT(f!=nullFace);
}
}
void ImportMesh(const _CEditableMeshBase<_VertexType,_FaceType,_EdgeType,_Final>& mesh)
{
IndexType newVerticesBegin = GetNumVertexIndices();
IndexType newFacesBegin = GetNumFaceIndices();
IndexType newEdgesBegin = GetNumEdgeIndices();
//figure out how many vertices we'll need
const IndexType nNewVerts = mesh.GetNumVertexIndices();
const IndexType nNewFaces = mesh.GetNumFaceIndices();
const IndexType nNewEdges = mesh.GetNumEdgeIndices();
// resize vectors
_vertices.resize(newVerticesBegin + nNewVerts);
_faces.resize(newFacesBegin + nNewFaces);
_edges.resize(newEdgesBegin + nNewEdges);
//allocate new items
for(IndexType i = 0; i < nNewVerts; ++i)
{
_vertices[newVerticesBegin +i] = (HE_vert*)_vertices_pool.malloc();
memcpy(_vertices[newVerticesBegin +i],mesh._vertices[i],sizeof(HE_vert));
_vertices[newVerticesBegin +i]->index = newVerticesBegin +i;
}
for(IndexType i = 0; i < nNewFaces; ++i)
{
_faces[newFacesBegin +i] = (HE_face*)_faces_pool.malloc();
memcpy(_faces[newFacesBegin +i],mesh._faces[i],sizeof(HE_face));
_faces[newFacesBegin +i]->index = newFacesBegin +i;
}
for(IndexType i = 0; i < nNewEdges; ++i)
{
_edges[newEdgesBegin +i] = (HE_edge_pair*)_edges_pool.malloc();
memcpy(_edges[newEdgesBegin +i],mesh._edges[i],sizeof(HE_edge_pair));
_edges[newEdgesBegin +i]->index = newEdgesBegin +i;
}
//fix links
for(IndexType i = 0; i < nNewVerts; ++i)
{
HE_vert& v = *_vertices[newVerticesBegin +i];
if(v.edge)
v.edge = getLocalEdge(v.edge,newEdgesBegin);
}
for(IndexType i = 0; i < nNewFaces; ++i)
{
HE_face& f = *_faces[newFacesBegin +i];
f.edge = getLocalEdge(f.edge,newEdgesBegin);
}
for(IndexType i = 0; i < nNewEdges; ++i)
{
HE_edge_pair& p = *_edges[newEdgesBegin +i];
for(int ie = 0; ie < 2; ++ie)
{
HE_edge& e = p.edges[ie];
if(e.face)
e.face = getLocalFace(e.face,newFacesBegin);
e.end_vertex = getLocalVertex(e.end_vertex,newVerticesBegin);
e.setNextEdge(getLocalEdge(e.getNextEdge(),newEdgesBegin));
e.pair_edge = getLocalEdge(e.pair_edge,newEdgesBegin);
}
}
}
private:
template<int _format,class _index_type> class rawFormatReader {
public:
typedef std::array<_index_type,3> Primitive;
inline Primitive operator() (const size_t& ith,const _index_type* pData)
{
static_HASSERT(0,"Unknown Index Format");
}
};
template<class _index_type> class rawFormatReader<0,_index_type> {
public:
typedef std::array<_index_type,3> Primitive;
inline Primitive operator() (const size_t& ith,const _index_type* pData)
{
Primitive res = {{pData[ith*3+0],pData[ith*3+1],pData[ith*3+2]}};
return res;
}
};
template<class _index_type> class rawFormatReader<1,_index_type> {
public:
typedef std::array<_index_type,3> Primitive;
inline Primitive operator() (const size_t& ith,const _index_type* pData)
{
static_HASSERT(0,"Not yet Implemented");
}
};
template<class _index_type> class rawFormatReader<2,_index_type> {
public:
typedef std::array<_index_type,3> Primitive;
inline Primitive operator() (const size_t& ith,const _index_type* pData)
{
static_HASSERT(0,"Not yet Implemented");
}
};
template<class _contents> class voidContainer
{
public:
_contents contents;
};
template<> class voidContainer<void>
{
};
struct _HE_edge;
struct _HE_vert;
struct _HE_face;
typedef struct _HE_edge
{
_HE_vert* end_vertex; //end vertex (null for invalidated)
_HE_edge* pair_edge; //the paired HALF edge
_HE_face* face; //bordering face (null for border)
inline void setNextEdge(_HE_edge* e)
{
next_edge = e;
e->prev_edge = this;
}
inline _HE_edge* getPrevEdge()
{
return prev_edge;
}
inline _HE_edge* getNextEdge()
{
return next_edge;
}
inline const _HE_edge* getPrevEdge() const
{
return prev_edge;
}
inline const _HE_edge* getNextEdge() const
{
return next_edge;
}
private:
_HE_edge* next_edge; //next HALF edge around the face if inside, on the circumference if outside
_HE_edge* prev_edge; //previous HALF edge around the face if inside, on the circumference if outside
} HE_edge;
typedef struct _HE_edge_pair
{
HE_edge edges[2];
IndexType index;
voidContainer<EdgeType> data;
} HE_edge_pair;
typedef struct _HE_vert
{
_HE_edge* edge;
IndexType index;
voidContainer<VertexType> data;
} HE_vert;
typedef struct _HE_face
{
_HE_edge* edge;
IndexType index;
voidContainer<FaceType> data;
} HE_face;
// private members
std::vector<HE_edge_pair*> _edges;
boost::pool<> _edges_pool;
IndexType _unusedEdges;
std::vector<HE_vert*> _vertices;
boost::pool<> _vertices_pool;
IndexType _unusedVertices;
std::vector<HE_face*> _faces;
boost::pool<> _faces_pool;
IndexType _unusedFaces;
//private functions
struct _edgeAdjectencyData
{
HE_edge* v0_prev;
HE_edge* v0_next;
HE_edge* v1_prev;
HE_edge* v1_next;
HE_edge* edge;
};
HE_edge* getNextFreeInner(HE_edge* e)
{
HE_edge* s = e;
do
{
s = s->getNextEdge()->pair_edge;
if(s->face == nullptr)
return s;
}
while(s!=e);
return nullptr;
}
HE_edge* getLocalEdge(const HE_edge* remote,IndexType offset)
{
const HE_edge_pair* pair = getPair(remote);
if(remote == &pair->edges[0])
return &_edges[pair->index + offset]->edges[0];
else if(remote == &pair->edges[1])
return &_edges[pair->index + offset]->edges[1];
else
{
HASSERT(!"Broken Edge pair link");
return nullptr;
}
}
HE_vert* getLocalVertex(const HE_vert* remote,IndexType offset)
{
return _vertices[remote->index + offset];
}
HE_face* getLocalFace(const HE_face* remote,IndexType offset)
{
return _faces[remote->index + offset];
}
bool findMergeEdgesEx_withEdge(HE_vert* v0,HE_vert* v1,_edgeAdjectencyData& data_out)
{
//we can set all the data out, we're basically just checking for legality
data_out.v0_prev = getPrevEdge(data_out.edge);
data_out.v0_next = data_out.edge->pair_edge->getNextEdge();
data_out.v1_prev = getPrevEdge(data_out.edge->pair_edge);
data_out.v1_next = data_out.edge->getNextEdge();
HE_edge* removed_v0_prev[2] = {nullptr,nullptr};
HE_edge* removed_v1_prev[2] = {nullptr,nullptr};
//might point to edges that will be removed so fix them
if(data_out.v0_next->pair_edge == data_out.v0_prev)
{
data_out.v0_next = nullptr;
data_out.v0_prev = nullptr;
}
else
{
if(!data_out.v0_next->pair_edge->face)
{
if(data_out.v0_next->pair_edge->getNextEdge()->pair_edge == data_out.v0_prev)
{
data_out.v0_next = nullptr;
data_out.v0_prev = nullptr;
}
else
{
removed_v0_prev[0] = data_out.v0_next->pair_edge;
data_out.v0_next = data_out.v0_next->pair_edge->getNextEdge();
}
}
if(data_out.v0_prev && !data_out.v0_prev->pair_edge->face)
{
removed_v0_prev[1] = data_out.v0_prev;
data_out.v0_prev = getPrevEdge(data_out.v0_prev->pair_edge);
}
}
if(data_out.v1_next->pair_edge == data_out.v1_prev)
{
data_out.v1_next = nullptr;
data_out.v1_prev = nullptr;
}
else
{
if(!data_out.v1_next->pair_edge->face)
{
if(data_out.v1_next->pair_edge->getNextEdge()->pair_edge == data_out.v1_prev)
{
data_out.v1_next = nullptr;
data_out.v1_prev = nullptr;
}
else
{
removed_v1_prev[0] = data_out.v1_next->pair_edge;
data_out.v1_next = data_out.v1_next->pair_edge->getNextEdge();
}
}
if(data_out.v1_prev && !data_out.v1_prev->pair_edge->face)
{
removed_v1_prev[1] = data_out.v1_prev;
data_out.v1_prev = getPrevEdge(data_out.v1_prev->pair_edge);
}
}
if(!data_out.v0_prev || !data_out.v1_prev)
return true;//nothing to check
// loop over all combinations of v0/v1 prevs
HE_edge* v0_prev = v0->edge->pair_edge;
do
{
if( v0_prev->pair_edge == data_out.edge )
continue;//ignore connecting edge
if(v0_prev == removed_v0_prev[0])
continue;//this edge will be removed if connecting edge disappears
if(v0_prev == removed_v0_prev[1])
continue;//this edge will be removed if connecting edge disappears
HE_edge* v1_prev = v1->edge->pair_edge;
do
{
if(v1_prev == data_out.edge)
continue;//ignore connecting edge
if(v1_prev == removed_v1_prev[0])
continue;//this edge will be removed if connecting edge disappears
if(v1_prev == removed_v1_prev[1])
continue;//this edge will be removed if connecting edge disappears
if(v1_prev->pair_edge->end_vertex == v0_prev->pair_edge->end_vertex)
{
//since we skip removed edges just check if these match
if(
(v0_prev == data_out.v0_prev && v1_prev->pair_edge == data_out.v1_next)
||
(v0_prev->pair_edge == data_out.v0_next && v1_prev == data_out.v1_prev)
)
continue;
return false;
}
}
while( (v1_prev = v1_prev->getNextEdge()->pair_edge) != v1->edge->pair_edge);
}
while( (v0_prev = v0_prev->getNextEdge()->pair_edge) != v0->edge->pair_edge);
return true;
}
bool findMergeEdgesEx_withoutEdge(HE_vert* v0,HE_vert* v1,_edgeAdjectencyData& data_out)
{
bool b12Fixed = false;
bool b21Fixed = false;
data_out.edge = nullptr;
data_out.v0_prev = nullptr;
data_out.v0_next = nullptr;
data_out.v1_prev = nullptr;
data_out.v1_next = nullptr;
// loop over all combinations of v0/v1 prevs
HE_edge* v0_prev = v0->edge->pair_edge;
do
{
v0_prev = v0_prev->getNextEdge()->pair_edge;
HE_edge* v1_prev = v1->edge->pair_edge;
do
{
v1_prev = v1_prev->getNextEdge()->pair_edge;
if(v1_prev->pair_edge->end_vertex == v0_prev->pair_edge->end_vertex)
{
//connecting pair
if(!v0_prev->face)
{
if(v1_prev->pair_edge->face)
return false; //misaligned face sides
if(b21Fixed)
return false;//too many connections
b21Fixed = true;
data_out.v0_prev = v0_prev;
data_out.v1_next = v1_prev->pair_edge;
if(! b12Fixed)
{
data_out.v0_next = data_out.v0_prev->getNextEdge();
data_out.v1_prev = getPrevEdge(data_out.v1_next);
}
}
else if(!v1_prev->face)
{
if(v0_prev->pair_edge->face)
return false; //misaligned face sides
if(b12Fixed)
return false;//too many connections
b12Fixed = true;
data_out.v1_prev = v1_prev;
data_out.v0_next = v0_prev->pair_edge;
if(! b21Fixed)
{
data_out.v1_next = data_out.v1_prev->getNextEdge();
data_out.v0_prev = getPrevEdge(data_out.v0_next);
}
}
else
return false; //connection of two edges with faces? fail
}
if(!data_out.v1_prev && !v1_prev->face)
{
//try to find open edges if we have no connection at all yet
data_out.v1_prev = v1_prev;
data_out.v1_next = v1_prev->getNextEdge();
}
}
while(v1_prev != v1->edge->pair_edge);
if(!data_out.v0_prev && !v0_prev->face)
{
//try to find open edges if we have no connection at all yet
data_out.v0_prev = v0_prev;
data_out.v0_next = v0_prev->getNextEdge();
}
}
while(v0_prev != v0->edge->pair_edge);
if(!data_out.v0_prev || !data_out.v1_prev)
return false;
return true;
}
bool findMergeEdgesEx(HE_vert* v0,HE_vert* v1,_edgeAdjectencyData& data_out)
{
if(!v0->edge || !v1->edge)
{
//trivial case
data_out.edge = nullptr;
data_out.v0_prev = nullptr;
data_out.v0_next = nullptr;
data_out.v1_prev = nullptr;
data_out.v1_next = nullptr;
return true;
}
//trivial cases done
data_out.edge = getEdge(v0,v1);
if(data_out.edge)
return findMergeEdgesEx_withEdge(v0,v1,data_out);
else
return findMergeEdgesEx_withoutEdge(v0,v1,data_out);
}
bool findMergeEdges(HE_edge*& v1_prev,HE_vert* v1,HE_edge*& v1_next,HE_edge*& v2_prev,HE_vert* v2,HE_edge*& v2_next)
{
//bool bExclusiveBorder = false;
if(v2->edge && v1->edge)
{
// 2 edges
bool b12Fixed = false;
bool b21Fixed = false;
bool bOpenL1 = false;
bool bOpenL2 = false;
//find open border on v2
HE_edge* cur = v2->edge;
do
{
if(!cur->pair_edge->face)
bOpenL1 = true;
else
bOpenL1 = false;
HE_edge* prop_v2_prev = cur->pair_edge;
HE_edge* prop_v2_next = bOpenL1?prop_v2_prev->getNextEdge():nullptr;
//find open edges at v1
HE_edge* cur_v1 = v1->edge;
do
{
if(!cur_v1->pair_edge->face)
bOpenL2 = true;
else
bOpenL2 = false;
HE_edge* prop_v1_prev = cur_v1->pair_edge;
HE_edge* prop_v1_next = bOpenL2?prop_v1_prev->getNextEdge():nullptr;
//check if they share vertex, if so they must be chosen
if(bOpenL1 && bOpenL2)
{
if(prop_v1_prev->pair_edge->end_vertex == prop_v2_next->end_vertex)
{
if(b21Fixed)
return false;
b21Fixed = true;
v2_next = prop_v2_next;
v1_prev = prop_v1_prev;
if(!b12Fixed)
{
v1_next = prop_v1_next;
v2_prev = prop_v2_prev;
}
}
if(prop_v2_prev->pair_edge->end_vertex == prop_v1_next->end_vertex)
{
if(b12Fixed)
return false;
b12Fixed = true;
v1_next = prop_v1_next;
v2_prev = prop_v2_prev;
if(!b21Fixed)
{
v2_next = prop_v2_next;
v1_prev = prop_v1_prev;
}
}
if(!b12Fixed && !v1_next)
v1_next = prop_v1_next;
if(!b21Fixed && !v1_prev)
v1_prev = prop_v1_prev;
}
else if(!bOpenL1 && !bOpenL2 && prop_v1_prev->pair_edge->end_vertex == prop_v2_prev->pair_edge->end_vertex)
return false;//if a vertex is shared among non open edges it would degenerate
cur_v1 = cur_v1->pair_edge->getNextEdge();
}
while(cur_v1 != v1->edge);
if( bOpenL1 && !b21Fixed && !v2_next)
v2_next = prop_v2_next;
if( bOpenL1 && !b12Fixed && !v2_prev)
v2_prev = prop_v2_prev;
if(bOpenL1)
{
HASSERT(v1_prev);
HASSERT(v1_next);
HASSERT(v2_prev);
HASSERT(v2_next);
}
cur = cur->pair_edge->getNextEdge();
}
while(cur != v2->edge);
if(!v2_next || !v1_next)
return false; // full
if(!(b21Fixed&&b12Fixed))
{
HASSERT(v2_prev->getNextEdge() == v2_next);
HASSERT(v1_prev->getNextEdge() == v1_next);
}
}
else if(v2->edge)
{
//1 edges, find first and take it
HE_edge* cur = v2->edge;
do
{
if(!cur->pair_edge->face)
{
v1_prev = nullptr;
v1_next = nullptr;
v2_prev = cur->pair_edge;
v2_next = v2_prev->getNextEdge();
return true;
}
cur = cur->pair_edge->getNextEdge();
}
while(cur != v2->edge);
}
else if(v1->edge)
{
//1 edges, find first and take it
HE_edge* cur = v1->edge;
do
{
if(!cur->pair_edge->face)
{
v1_prev = cur->pair_edge;
v1_next = v1_prev->getNextEdge();
v2_prev = nullptr;
v2_next = nullptr;
return true;
}
cur = cur->pair_edge->getNextEdge();
}
while(cur != v1->edge);
}
else
{
// no edges
v1_prev = nullptr;
v1_next = nullptr;
v2_prev = nullptr;
v2_next = nullptr;
return true;
}
return true;
}
bool twistEdgeConnect(HE_edge* i,HE_edge* o)
{
HE_edge* freeInner = getNextFreeInner(o->pair_edge);
HE_edge* p = getPrevEdge(o);
if(freeInner == i)
return false; // not connectable
HASSERT(freeInner->end_vertex == i->end_vertex);
HASSERT(p->end_vertex == i->end_vertex);
HASSERT(freeInner->face == nullptr);
HASSERT(p->face == nullptr);
HE_edge* buffer =freeInner->getNextEdge();
freeInner->setNextEdge(i->getNextEdge());
i->setNextEdge(o);
p->setNextEdge(buffer);
return true;
}
void printInnerLoop(HE_edge* e)
{
HE_edge* s = e;
std::cerr << "printing inner loop for" << e->index <<"\n";
do
{
std::cerr << "\t" <<s->index << "("<<s->pair_edge->end_vertex->index <<"-"<<s->end_vertex->index <<")\n";
s = s->pair_edge->getNextEdge();
}
while(s!=e);
}
HE_edge* loopFind(HE_edge* e,HE_vert* v,HE_vert* v_stop = nullptr)
{
HE_edge* cur = e;
do
{
if(cur->end_vertex == v)
return cur;
if(v_stop && cur->end_vertex == v_stop)
return nullptr;
cur=cur->getNextEdge();
}
while(e!=cur);
return nullptr;
}
void mergeDoubleEdges(HE_edge* e1,HE_edge* e2)
{
HASSERT(e1->getNextEdge() == e2);
{
HASSERT(e1->face == nullptr);
HASSERT(e2->face == nullptr);
HASSERT(e1->pair_edge->face);
HASSERT(e2->pair_edge->face);
//will remove e2 and e2->pair
HE_edge* e2_prev_pair = getPrevEdge(e2->pair_edge);
e2_prev_pair->setNextEdge(e1);
e1->setNextEdge(e2->pair_edge->getNextEdge());
e1->end_vertex = e2->pair_edge->end_vertex;
e1->face = e2->pair_edge->face;
if(e2->pair_edge->face->edge == e2->pair_edge)
e2->pair_edge->face->edge = e1;
if(e2->end_vertex->edge == e2->pair_edge)
e2->end_vertex->edge = e1;
if(e2->pair_edge->end_vertex->edge == e2)
e2->pair_edge->end_vertex->edge = e1->pair_edge;
//std::cerr << "\te" << e1->index << " + e" << e2->index <<" = e"<<e1->index<<"\n";
internalRemove(e2);
}
}
bool checkDegenerateEdge(HE_vert* v0,HE_vert* v1,_edgeAdjectencyData& data)
{
if(v0->edge)
{
HE_edge* prev = nullptr;
HE_edge* cur = v0->edge->pair_edge;
HE_edge* match = nullptr;
do
{
if(!cur->face && !prev && ((data.v0_prev)?(data.v0_prev == cur):true))
prev=cur;
if( cur->pair_edge->end_vertex == v1)
match = cur->pair_edge;
cur = cur->getNextEdge()->pair_edge;
}
while(cur->pair_edge != v0->edge);
if(!prev)
return false; //vertex is full
if(match)
{
if(!match->face)
{
data.edge = match;
return true; // edge already exists
}
else
return false;
}
if(data.v0_prev)
HASSERT(data.v0_prev == prev);
data.v0_prev = prev;
data.v0_next = prev->getNextEdge();
}
if(v1->edge && !data.v1_prev)
{
HE_edge* prev = v1->edge->pair_edge;
while(prev->face)
{
prev = prev->getNextEdge()->pair_edge;
if(prev->pair_edge == v1->edge)
return false; //vertex is full
}
data.v1_prev = prev;
data.v1_next = prev->getNextEdge();
}
return true;
}
HE_edge* getEdge(HE_vert* v1,HE_vert* v2)
{
HE_edge* candidate = v1->edge;
if(!candidate)
return nullptr;
//search ccw
do
{
if(candidate -> end_vertex == v2)
return candidate;
candidate = candidate->pair_edge->getNextEdge();
}
while(candidate != v1->edge);
//we rotated a full circle
return nullptr;
}
HE_edge* insertDegenerateEdge(HE_vert* v0,HE_vert* v1,const _edgeAdjectencyData& data)
{
if(data.edge)
{
return data.edge;
}
HE_edge* edge = internalAllocEdge();
//make it looping
edge->setNextEdge(data.v1_next?data.v1_next:edge->pair_edge);
edge->end_vertex = v1;
edge->face = nullptr;
edge->pair_edge->setNextEdge(data.v0_next?data.v0_next:edge);
edge->pair_edge->end_vertex = v0;
edge->pair_edge->face = nullptr;
if(data.v0_prev)
data.v0_prev->setNextEdge(edge);
if(data.v1_prev)
data.v1_prev->setNextEdge(edge->pair_edge);
if(v0->edge == nullptr)
v0->edge = edge;
if(v1->edge == nullptr)
v1->edge = edge->pair_edge;
return edge;
}
bool removeDegenerateEdge(HE_edge* e)
{
if(e->face != nullptr || e->pair_edge->face != nullptr)
return false;
//find source of e
//find source of e-pair
HE_edge* pe = getPrevEdge(e);
HE_edge* pep = getPrevEdge(e->pair_edge);
pe->setNextEdge(e->pair_edge->getNextEdge());
pep->setNextEdge(e->getNextEdge());
if(e->end_vertex->edge == e->pair_edge)
{
//fix e-end_vertex
if(e->getNextEdge() == e->pair_edge)
e->end_vertex->edge = nullptr;//internalRemove(e->end_vertex); // can't fix, remove orphaned vertex
else
e->end_vertex->edge = e->getNextEdge();
HASSERT(e->end_vertex->edge != e);
HASSERT(e->end_vertex->edge != e->pair_edge);
}
if(e->pair_edge->end_vertex->edge == e)
{
//fix pair-end_vertex
if(e->pair_edge->getNextEdge() == e)
e->pair_edge->end_vertex->edge = nullptr;//internalRemove(e->pair_edge->end_vertex); // can't fix, remove orphaned vertex
else
e->pair_edge->end_vertex->edge = e->pair_edge->getNextEdge();
HASSERT(e->pair_edge->end_vertex->edge != e);
HASSERT(e->pair_edge->end_vertex->edge != e->pair_edge);
}
internalRemove(e);
return true;
}
inline static HE_edge_pair* getPair(HE_edge* e)
{
if( e->pair_edge < e)
return reinterpret_cast<HE_edge_pair*>(e->pair_edge);
else
return reinterpret_cast<HE_edge_pair*>(e);
}
inline static const HE_edge_pair* getPair(const HE_edge* e)
{
if( e->pair_edge < e)
return reinterpret_cast<const HE_edge_pair*>(e->pair_edge);
else
return reinterpret_cast<const HE_edge_pair*>(e);
}
inline void internalRemove(HE_edge_pair* e)
{
_unusedEdges++;
_edges[(size_t)e->index] = nullptr;
_edges_pool.free(e);
}
inline void internalRemove(HE_edge* e)
{
internalRemove(getPair(e));
}
inline void internalRemove(HE_face* f)
{
_unusedFaces++;
_faces[(size_t)f->index] = nullptr;
_faces_pool.free(f);
}
inline void internalRemove(HE_vert* v)
{
_unusedVertices++;
_vertices[(size_t)v->index] = nullptr;
_vertices_pool.free(v);
}
inline HE_edge* internalAllocEdge()
{
HE_edge_pair* e= (HE_edge_pair*)_edges_pool.malloc();
e->edges[0].pair_edge = &e->edges[1];
e->edges[1].pair_edge = &e->edges[0];
e->index = _edges.size();
_edges.push_back(e);
return &e->edges[0];
}
inline HE_face* internalAllocFace()
{
HE_face* f = (HE_face*)_faces_pool.malloc();
f->index = _faces.size();
_faces.push_back(f);
return f;
}
inline HE_vert* internalAllocVert()
{
HE_vert* v = (HE_vert*)_vertices_pool.malloc();
v->index = _vertices.size();
_vertices.push_back(v);
return v;
}
inline const HE_edge* getInternal(const Edge& e) const
{
return (const HE_edge*)&e.internal_data->edges[0];
}
inline const HE_vert* getInternal(const Vertex& v) const
{
return (const HE_vert*)v.internal_data;
}
inline const HE_face* getInternal(const Face& f) const
{
return (const HE_face*)f.internal_data;
}
inline HE_edge* getInternal(const Edge& e)
{
return ((HE_edge*)&e.internal_data->edges[0]);
}
inline HE_vert* getInternal(const Vertex& v)
{
return ((HE_vert*)v.internal_data);
}
inline HE_face* getInternal(const Face& f)
{
return ((HE_face*)f.internal_data);
}
inline Edge getExternal(const HE_edge_pair* e) const
{
return Edge(const_cast<HE_edge_pair*>(e));
}
inline Edge getExternal(const HE_edge* e) const
{
return Edge(getPair(const_cast<HE_edge*>(e)));
}
inline Vertex getExternal(const HE_vert* v) const
{
return Vertex(const_cast<HE_vert*>(v));
}
inline Face getExternal(const HE_face* f) const
{
return Face(const_cast<HE_face*>(f));
}
inline static const HE_edge* getPrevEdge(const HE_edge* e)
{/*
if(e->face)
{
const HE_edge* res = e;
for(int i = 0; i<PolySize-1;++i)
res = res->getNextEdge();
HASSERT(res->getNextEdge() == e);
HASSERT(res == e->getPrevEdge());
return res;
}
else
{
HE_edge* res = e->pair_edge;
while(res->getNextEdge() != e)
res = res->getNextEdge()->pair_edge;
HASSERT(res == e->getPrevEdge());
return res;
}*/
return e->getPrevEdge();
}
inline static HE_edge* getPrevEdge(HE_edge* e)
{/*
if(e->face)
{
HE_edge* res = e;
for(int i = 0; i<PolySize-1;++i)
res = res->getNextEdge();
HASSERT(res->getNextEdge() == e);
HASSERT(res == e->getPrevEdge());
return res;
}
else
{
HE_edge* res = e->pair_edge;
while(res->getNextEdge() != e)
res = res->getNextEdge()->pair_edge;
HASSERT(res == e->getPrevEdge());
return res;
}*/
return e->getPrevEdge();
}
// for an item to be valid it must be:
// not null
// not invalidated
// inside our vectors
// point to the beginning of an element
#ifndef EDITABLE_MESH_SKIP_VALIDATION
inline bool isValid(const HE_face* f) const
{
return
(f!=nullptr) &&
(f->edge!=nullptr) &&
(f->index < _faces.size()) &&
(f == _faces[(size_t)f->index]);
}
inline bool isValid(const HE_edge* h) const
{
const HE_edge_pair* p = h?getPair(h):nullptr;
return
(p!=nullptr) &&
(h->end_vertex!=nullptr) &&
(p->index < _edges.size()) &&
(p == _edges[(size_t)p->index]);
}
inline bool isValid(const HE_vert* v,bool ignore_invalidated = false) const
{
return
(v!=nullptr) &&
(v->edge!=nullptr || ignore_invalidated) &&
(v->index < _vertices.size()) &&
(v == _vertices[(size_t)v->index]);
}
#else // SKIP VALIDATION
inline static bool isValid(const HE_face* f)
{
return true;
}
inline static bool isValid(const HE_edge* e)
{
return true;
}
inline static bool isValid(const HE_vert* v)
{
return true;
}
#endif
friend class _EditableMeshInternal::_CEditableMesh_GetFaceData< _FaceType, _EditableMeshInternal::_CEditableMeshBase<_VertexType,_FaceType,_EdgeType, _Final > >;
friend class _EditableMeshInternal::_CEditableMesh_GetEdgeData< _EdgeType, _EditableMeshInternal::_CEditableMeshBase<_VertexType,_FaceType,_EdgeType, _Final > >;
friend class _EditableMeshInternal::_CEditableMesh_GetVertexData< _VertexType, _EditableMeshInternal::_CEditableMeshBase<_VertexType,_FaceType,_EdgeType, _Final > >;
};
template<class _1, class _2, class _3, class _4> const typename _CEditableMeshBase<_1,_2,_3,_4>::Edge _CEditableMeshBase<_1,_2,_3,_4>::nullEdge = typename _CEditableMeshBase<_1,_2,_3,_4>::Edge(nullptr);
template<class _1, class _2, class _3, class _4> const typename _CEditableMeshBase<_1,_2,_3,_4>::Vertex _CEditableMeshBase<_1,_2,_3,_4>::nullVertex = typename _CEditableMeshBase<_1,_2,_3,_4>::Vertex(nullptr);
template<class _1, class _2, class _3, class _4> const typename _CEditableMeshBase<_1,_2,_3,_4>::Face _CEditableMeshBase<_1,_2,_3,_4>::nullFace = typename _CEditableMeshBase<_1,_2,_3,_4>::Face(nullptr);
}
template<class _VertexType = Vector3<>, class _FaceType = void, class _EdgeType = void> class CEditableMesh :
public _EditableMeshInternal::_CEditableMesh_GetFaceData< _FaceType, _EditableMeshInternal::_CEditableMeshBase<_VertexType,_FaceType,_EdgeType, CEditableMesh<_VertexType,_FaceType,_EdgeType> > >,
public _EditableMeshInternal::_CEditableMesh_GetEdgeData< _EdgeType, _EditableMeshInternal::_CEditableMeshBase<_VertexType,_FaceType,_EdgeType, CEditableMesh<_VertexType,_FaceType,_EdgeType> > >,
public _EditableMeshInternal::_CEditableMesh_GetVertexData< _VertexType, _EditableMeshInternal::_CEditableMeshBase<_VertexType,_FaceType,_EdgeType, CEditableMesh<_VertexType,_FaceType,_EdgeType> > >,
public _EditableMeshInternal::_CEditableMeshBase<_VertexType,_FaceType,_EdgeType, CEditableMesh<_VertexType,_FaceType,_EdgeType> >
{
};
}
#endif | [
"jaschmid@eml.cc"
] | jaschmid@eml.cc |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.