blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
264
content_id
stringlengths
40
40
detected_licenses
sequencelengths
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
sequencelengths
1
1
author_id
stringlengths
0
158
4a9a7a0035fa53c532398bcd83baaa7c84ba0303
746cca27630433425b38062d0899beb60732a4b7
/WebPage.ino
961e3cc6f4023cb3dfbfbaacc6098d3b9c3b87a6
[]
no_license
SalomonSandrock/Arduino
fd11ccf161d1648230fdb21bc2a810cb537c8b93
5e5eed2331a7bb0c84d9023485b0abf677b187b7
refs/heads/master
2021-01-10T15:39:01.249754
2015-12-07T13:12:42
2015-12-07T13:12:42
46,700,575
0
1
null
2015-11-23T11:16:32
2015-11-23T06:18:43
Arduino
UTF-8
C++
false
false
4,867
ino
void StartConversation2(EthernetClient client){ if (client) { // got client? boolean currentLineIsBlank = true; while (client.connected()) { if (client.available()) { // client data available to read char c = client.read(); // read 1 byte (character) from client HTTP_req += c; // save the HTTP request 1 char at a time // last line of client request is blank and ends with \n // respond to client only after last line received if (c == '\n' && currentLineIsBlank) { // send a standard http response header client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println("Connection: keep-alive"); client.println(); // AJAX request for switch state if (HTTP_req.indexOf("ajax_switch") > -1) { // read switch state and analog input GetAjaxData(client); } else { // HTTP request for web page // send web page - contains JavaScript with AJAX calls client.println("<!DOCTYPE html>"); client.println("<html>"); client.println("<head>"); client.println("<title>Arduino Web Page</title>"); client.println("<script>"); client.println("function GetAjaxData() {"); client.println( "nocache = \"&nocache=\" + Math.random() * 1000000;"); client.println("var request = new XMLHttpRequest();"); client.println("request.onreadystatechange = function() {"); client.println("if (this.readyState == 4) {"); client.println("if (this.status == 200) {"); client.println("if (this.responseText != null) {"); client.println("document.getElementById(\"sw_an_data\")\ .innerHTML = this.responseText;"); client.println("}}}}"); client.println( "request.open(\"GET\", \"ajax_switch\" + nocache, true);"); client.println("request.send(null);"); client.println("setTimeout('GetAjaxData()', 1000);"); client.println("}"); client.println("</script>"); client.println("</head>"); client.println("<body onload=\"GetAjaxData()\">"); client.println("<h1>Arduino AJAX Input</h1>"); client.println("<div id=\"sw_an_data\">Switch state: Not requested...</p>"); client.println("</div>"); client.println("</body>"); client.println("</html>"); } // display received HTTP request on serial port Serial.print(HTTP_req); HTTP_req = ""; // finished with request, empty string break; } // every line of text received from the client ends with \r\n if (c == '\n') { // last character on line of received text // starting new line with next character read currentLineIsBlank = true; } else if (c != '\r') { // a text character was received from client currentLineIsBlank = false; } } // end if (client.available()) } // end while (client.connected()) delay(1); // give the web browser time to receive the data client.stop(); // close the connection } // end if (client) } // send the state of the switch to the web browser void GetAjaxData(EthernetClient cl) { float t = dht.readTemperature(); //Temperatur auslesen float h = dht.readHumidity(); //Luftfeuchte auslesen if (lightState) { cl.println("<p>Lightstate: ON</p>"); } else { cl.println("<p>Lightstate: OFF</p>"); } cl.print("<p><h2>Temperature: <font color=indigo>"); cl.print(t, 2); cl.println(" &deg C <font color=indigo>"); cl.println("</font></h2></p>"); cl.print("<p><h2>Humidity = <font color=indigo>"); cl.print(h, 2); cl.print(" % <font color=indigo>"); cl.println("</font></h2></p>"); }
6ddf470ab8a2126504e771c9898053250010d81a
acaa3b0d3a7cd56f8772a1f73992a2c3e16ba2fc
/flawdetector/src/devicearg/impl_enumerablearg.cpp
790b6eb2023d45f06ef511ef054140f78bbaf7d4
[]
no_license
chouqiji/flawdetector_new
e4701093c272663c8cb8047320f77982cac7e3d8
5d960f75f5a79c3540e548224a9e14d6d667b53e
refs/heads/master
2020-04-12T18:05:41.386567
2018-10-31T09:04:01
2018-10-31T09:04:01
162,668,998
0
0
null
null
null
null
UTF-8
C++
false
false
1,328
cpp
#include "devicearg/private/impl_enumerablearg.h" namespace DeviceArg { template <typename T> ConcreteEnumerableArg<T>::ConcreteEnumerableArg(EnumerableInitList<T> &&arg) : mArg{std::forward<decltype(mArg)>(arg)} { translateList(mArg.list); } template<> void ConcreteEnumerableArg<QString>::translateList(const QList<QString>& newList) { mTranslatedList.clear(); mTranslatedList.reserve(newList.size()); for(const auto& e : newList) mTranslatedList<<QObject::tr(e.toLatin1()); } template<> QVariant ConcreteEnumerableArg<QString>::translateValue(const qint32& value) const { return mTranslatedList.at(value); } template<> QVariantList ConcreteEnumerableArg<QString>::list() const { QVariantList ret; ret.reserve(mTranslatedList.size()); for(const auto& e : mTranslatedList) ret<<e; return ret; } template <typename T> QSharedPointer<EnumerableArg<T>> makeArg(const QString &name, const QString &unit, EnumerableInitList<T> &&list) { auto p = QSharedPointer<ConcreteEnumerableArg<T>>::create(std::forward<decltype(list)>(list)); p->setName(name); p->setUnit(unit); return std::move(p); } template QSharedPointer<EnumerableArg<QString>> makeArg(const QString &name, const QString &unit, EnumerableInitList<QString> &&list); } // namespace DeviceArg
d705a0950ebe5b7ed57988a418de448cf1095ff5
bb01edaac9e544cf344caf10ecb0e4f757ae922c
/src/SkinUIRes++/stdafx.h
7e444afa10345662c9c24c44578ef964406e1f42
[]
no_license
weypro/Ice-Project-Manager
fc35efec2ec48e803abf93601aed5a369d463387
cfe3dd1b8bd68630fda803089913a119b18497c6
refs/heads/master
2020-03-30T04:26:23.684754
2018-10-01T11:59:36
2018-10-01T11:59:36
150,742,629
1
0
null
null
null
null
UTF-8
C++
false
false
976
h
#pragma once #if defined _M_IX86 #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") #elif defined _M_IA64 #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") #elif defined _M_X64 #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") #else #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") #endif #include "targetver.h" #include "Resource.h" #include "SkinUI.h" using namespace UI;
3f249ac4e52eaf7f4830f8a5352eddd23ab62123
f855ea48bd08d76e204d09cb9a66d00ec14f49a7
/Introduction to C++ STL/Live_class/Brute_force.cpp
b03f71708966abda8561fc3af236c62df738891a
[]
no_license
Akash-verma998/CPP
087b6bb3f59f1125863f950e05df932739dbffb9
789b522d1d137cb776a4d9e22e51fb417589b378
refs/heads/main
2023-02-15T22:22:36.299089
2021-01-18T06:59:04
2021-01-18T06:59:04
330,578,219
0
0
null
null
null
null
UTF-8
C++
false
false
246
cpp
#include<iostream> using namespace std; int main() { int a[]={1,2,4,5,6,8,10,12}; int n= sizeof(a)/sizeof(int); for(int i=0;i<n-5;i++) { for (int j=i+1;j<n-4;j++) { for(int k=j+1;k<) } } }
552c56082fa3e5df8d92ed53f796d3d0f7668387
8c90e0ffb2819653c566aa7894e73b2726fb3640
/dokushu/chapter7/list7-1.cpp
196709b3d37636c04739eec430dc918472243951
[]
no_license
Tetta8/CPP_test
f842390ad60a0aeb259240910d12d1b273ce58ed
a4692aae32bbc6bfce2af61567a9fa0575e47fe0
refs/heads/master
2021-01-04T17:20:09.526885
2020-09-17T05:09:19
2020-09-17T05:09:19
240,681,912
0
0
null
null
null
null
UTF-8
C++
false
false
494
cpp
#include <iostream> class Base{ protected: void protected_member(){ std::cout << "Base::protected_member()" << std::endl; } }; class Derived : public Base{ public: void member_test(); }; void Derived::member_test(){ protected_member(); } int main(){ Derived derived; // baseクラスの被保護メンバーの為、派生クラス以外からアクセスできない // derived.protected_member(); derived.member_test(); }
1132392c8a5ccecb307a27e19ff46a04f9a44916
95626140b639c93a5bc7d86c5ed7cead4d27372a
/algorithm And Data Structure/Graph/mst/11631 - Dark roads.cpp
31482a4b5e4770374d0ffba6c480f922fa74d49a
[]
no_license
asad-shuvo/ACM
059bed7f91261af385d1be189e544fe240da2ff2
2dea0ef7378d831097efdf4cae25fbc6f34b8064
refs/heads/master
2022-06-08T13:03:04.294916
2022-05-13T12:22:50
2022-05-13T12:22:50
211,629,208
0
0
null
null
null
null
UTF-8
C++
false
false
1,640
cpp
#include <bits/stdc++.h> using namespace std; #define ll long long int #define Mx 100005 #define mx 1005 /* ll status[mx]; void sieve(){ long long int i,j; for(i=2;i<=mx;i++) { status[i]=0; } for( i=2;i<=sqrt(mx);i++){ if(status[i]==0) { for(j=i*i;j<=mx;j+=i){ status[j]=1; } } } }*/ #define dd double #define sc scanf #define pr printf #define VI vector<int> #define VS vector<string> #define VC vector<char> #define VLL vector<long long int> #define FILE freopen("input.txt","rt",stdin); freopen("output.txt","w",stdout); #define p_b push_back #define mem(x,y) memset(x,y,sizeof(x)) #define F(i,a,b) for(i=a;i<=b;i++) #define sc1(a) scanf("%d",&a) #define sc2(a,b) scanf("%d%d",&a,&b) #define sc3(a,b,c) scanf("%d%d%d",&a,&b,&c) struct edge{ int u,v,w; bool operator < (const edge& p)const{ return w<p.w; } }; #define M 200005 vector<edge>e; ll par[M]; ll find(ll r) { return (par[r]==r) ? r:find(par[r]); } ll mst(ll n) { sort(e.begin(),e.end()); for(int i=0;i<n;i++)par[i]=i; int cnt=0,s=0; for(int i=0;i<(int)e.size();i++){ int u=find(e[i].u); int v=find(e[i].v); if(u!=v){ par[u]=v; cnt++; s+=e[i].w; if(cnt==n-1)break; } } return s; } int main() { ll i,n,m; while(sc("%lld%lld",&n,&m)&&n>0 && m>0){ ll sum=0; e.clear(); F(i,1,m){ ll u,v,w; sc("%lld%lld%lld",&u,&v,&w); sum+=w; edge get; get.u=u; get.v=v; get.w=w; e.p_b(get); } pr("%lld\n",sum-mst(n)); } }
faa5a9cef13c5f1ec79e8adca192eae2dbba9fba
389129460c5e453ac882f02fc601c239ba66cbc5
/Classes/LoadLayer.cpp
e8da0ad293a6b42d6c0318609e38a70fa2caed2e
[]
no_license
wangjunchi/pong
2eca1e771383920abf2a33c8af370344b5b6e7df
716de1a6ae86d14620cb0dfc34ea40beacbbc951
refs/heads/master
2020-03-07T14:12:39.666681
2018-04-02T12:49:16
2018-04-02T12:49:16
127,521,190
0
0
null
null
null
null
UTF-8
C++
false
false
357
cpp
#include "LoadLayer.h" bool LoadLayer::init() { Label *label = Label::createWithTTF("Loading......", "fonts/Marker Felt.ttf", 24); label->setPosition(Vec2(240, 180)); this->addChild(label); scheduleOnce(CC_SCHEDULE_SELECTOR(LoadLayer::onScheduleOnce), 1); return true; } void LoadLayer::onScheduleOnce(float dt) { tsm->goToOpenScene(); }
3204e6dbf0ab4ee7bf8524b0c949492f0408fcb8
e50d17a85e402935812b0de6802b1e2eebde4078
/third-party/thrift/src/thrift/compiler/test/fixtures/adapter/gen-cpp2/module_no_uri_types.tcc
4be0777a5f9c84047aad7ea6781f33b856a8396e
[ "MIT", "Apache-2.0", "Zend-2.0", "PHP-3.01" ]
permissive
PengChaoJay/hhvm
2aef5fb43a7d0a7a1dca9e0a0be0dd1d76905994
eb80592a45e22de5590ccb534065984041e1da70
refs/heads/master
2023-07-20T00:24:29.331183
2023-06-28T18:13:38
2023-06-28T18:13:38
361,938,182
0
0
null
null
null
null
UTF-8
C++
false
false
5,850
tcc
/** * Autogenerated by Thrift for thrift/compiler/test/fixtures/adapter/src/module_no_uri.thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @nocommit */ #pragma once #include "thrift/compiler/test/fixtures/adapter/gen-cpp2/module_no_uri_types.h" #include <thrift/lib/cpp2/gen/module_types_tcc.h> namespace apache { namespace thrift { namespace detail { template <> struct TccStructTraits<::cpp2::RefUnion> { static void translateFieldName( folly::StringPiece _fname, int16_t& fid, apache::thrift::protocol::TType& _ftype) noexcept; }; } // namespace detail } // namespace thrift } // namespace apache namespace cpp2 { template <class Protocol_> void RefUnion::readNoXfer(Protocol_* iprot) { apache::thrift::detail::ProtocolReaderStructReadState<Protocol_> _readState; _readState.fieldId = 0; _readState.readStructBegin(iprot); _readState.readFieldBegin(iprot); if (_readState.atStop()) { apache::thrift::clear(*this); } else { if (iprot->kUsesFieldNames()) { _readState.template fillFieldTraitsFromName<apache::thrift::detail::TccStructTraits<RefUnion>>(); } switch (_readState.fieldId) { case 1: { if (_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_STRING)) { this->set_field1(); auto ptr = ::apache::thrift::detail::make_mutable_smart_ptr<::std::shared_ptr<::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 1, ::std::string, RefUnion>>>(); if constexpr(::apache::thrift::adapt_detail::has_inplace_toThrift<::my::Adapter1, ::apache::thrift::adapt_detail::adapted_field_t<::my::Adapter1, 1, ::std::string, RefUnion>>::value) { ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::string, ::std::string>::readWithContext(*iprot, ::my::Adapter1::toThrift(*ptr), _readState); } else { ::std::string tvalue; ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::string, ::std::string>::readWithContext(*iprot, tvalue, _readState); *ptr = ::apache::thrift::adapt_detail::fromThriftField<::my::Adapter1, 1>(::std::move(tvalue), *this); } value_.field1 = std::move(ptr); } else { _readState.skip(iprot); } break; } default: { _readState.skip(iprot); break; } } _readState.readFieldEnd(iprot); _readState.readFieldBegin(iprot); if (UNLIKELY(!_readState.atStop())) { using apache::thrift::protocol::TProtocolException; TProtocolException::throwUnionMissingStop(); } } _readState.readStructEnd(iprot); } template <class Protocol_> uint32_t RefUnion::serializedSize(Protocol_ const* prot_) const { uint32_t xfer = 0; xfer += prot_->serializedStructSize("RefUnion"); switch(this->getType()) { case RefUnion::Type::field1: { xfer += prot_->serializedFieldSize("field1", apache::thrift::protocol::T_STRING, 1); if (value_.field1) { xfer += ::apache::thrift::adapt_detail::serializedSize<false, ::my::Adapter1>(*prot_, *value_.field1, [&] {return ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::string, ::std::string>::serializedSize<false>(*prot_, ::my::Adapter1::toThrift(*value_.field1));}); } break; } case RefUnion::Type::__EMPTY__:; } xfer += prot_->serializedSizeStop(); return xfer; } template <class Protocol_> uint32_t RefUnion::serializedSizeZC(Protocol_ const* prot_) const { uint32_t xfer = 0; xfer += prot_->serializedStructSize("RefUnion"); switch(this->getType()) { case RefUnion::Type::field1: { xfer += prot_->serializedFieldSize("field1", apache::thrift::protocol::T_STRING, 1); if (value_.field1) { xfer += ::apache::thrift::adapt_detail::serializedSize<false, ::my::Adapter1>(*prot_, *value_.field1, [&] {return ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::string, ::std::string>::serializedSize<false>(*prot_, ::my::Adapter1::toThrift(*value_.field1));}); } break; } case RefUnion::Type::__EMPTY__:; } xfer += prot_->serializedSizeStop(); return xfer; } template <class Protocol_> uint32_t RefUnion::write(Protocol_* prot_) const { uint32_t xfer = 0; xfer += prot_->writeStructBegin("RefUnion"); switch(this->getType()) { case RefUnion::Type::field1: { constexpr int16_t kPrevFieldId = 0; xfer += ::apache::thrift::detail::writeFieldBegin<apache::thrift::protocol::T_STRING, 1, kPrevFieldId>(*prot_, "field1", false); if (value_.field1) { xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::string, ::std::string>::write(*prot_, ::my::Adapter1::toThrift(*value_.field1)); } xfer += prot_->writeFieldEnd(); break; } case RefUnion::Type::__EMPTY__:; } xfer += prot_->writeFieldStop(); xfer += prot_->writeStructEnd(); return xfer; } extern template void RefUnion::readNoXfer<>(apache::thrift::BinaryProtocolReader*); extern template uint32_t RefUnion::write<>(apache::thrift::BinaryProtocolWriter*) const; extern template uint32_t RefUnion::serializedSize<>(apache::thrift::BinaryProtocolWriter const*) const; extern template uint32_t RefUnion::serializedSizeZC<>(apache::thrift::BinaryProtocolWriter const*) const; extern template void RefUnion::readNoXfer<>(apache::thrift::CompactProtocolReader*); extern template uint32_t RefUnion::write<>(apache::thrift::CompactProtocolWriter*) const; extern template uint32_t RefUnion::serializedSize<>(apache::thrift::CompactProtocolWriter const*) const; extern template uint32_t RefUnion::serializedSizeZC<>(apache::thrift::CompactProtocolWriter const*) const; } // cpp2
8e4d3541ed3244eb47b962b0306a796e1d86e900
42e48ab414670bfb28605884ff7f12cdac4ebd5f
/src/xzero/http/hpack/StaticTable-test.cc
675d2d255f675749c3fac98cf76a099d3316a78b
[ "MIT" ]
permissive
tempbottle/x0
45dc6fa088e3eae4632343ef861e3897aada8002
f61ae5824990c2d40ba76ec69f76f66be8bd0466
refs/heads/master
2020-12-25T15:51:45.065572
2016-01-18T17:17:02
2016-01-18T17:17:02
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,520
cc
// This file is part of the "x0" project, http://github.com/christianparpart/x0> // (c) 2009-2016 Christian Parpart <[email protected]> // // Licensed under the MIT License (the "License"); you may not use this // file except in compliance with the License. You may obtain a copy of // the License at: http://opensource.org/licenses/MIT #include <xzero/http/hpack/StaticTable.h> #include <gtest/gtest.h> using xzero::http::hpack::StaticTable; TEST(hpack_StaticTable, find_field_name_only) { size_t index; bool nameValueMatch; bool match = StaticTable::find(":path", "/custom", &index, &nameValueMatch); EXPECT_TRUE(match); EXPECT_EQ(4, index); EXPECT_FALSE(nameValueMatch); } TEST(hpack_StaticTable, find_field_fully) { size_t index; bool nameValueMatch; bool match = StaticTable::find(":path", "/", &index, &nameValueMatch); EXPECT_TRUE(match); EXPECT_EQ(3, index); EXPECT_TRUE(nameValueMatch); } TEST(hpack_StaticTable, find_field_nothing) { size_t index; bool nameValueMatch; bool match = StaticTable::find("not", "found", &index, &nameValueMatch); EXPECT_FALSE(match); } TEST(hpack_StaticTable, find_them_all_binary_search_test) { // make sure we find them all, just to unit-test our binary search size_t index; bool nameValueMatch; for (size_t i = 0; i < StaticTable::length(); i++) { bool match = StaticTable::find(StaticTable::at(i), &index, &nameValueMatch); ASSERT_EQ(index, i); ASSERT_EQ(true, nameValueMatch); ASSERT_EQ(true, match); } }
ffd96490d22e0c3941a8444fe477d7c5cbd9eb5a
18b903d0a1c055d90cfa44dc81fad21bd482b262
/Minigin/source/utils.h
3c3590d3fb92454f5f87043324112c66aad92246
[]
no_license
minoarno/BubbleBobbleEngine
5e07e7be9af7a4600da1e1a26a4c653e63bf9355
1e21e1ae22d69a0ca425d82ddd3b3c8265bdf017
refs/heads/master
2021-03-12T05:16:33.629483
2021-02-26T13:11:00
2021-02-26T13:11:00
246,592,311
0
0
null
2020-08-25T23:39:46
2020-03-11T14:23:45
C++
UTF-8
C++
false
false
4,116
h
#pragma once #include "vector2f.h" #include <vector> #include <deque> #include <ios> #include "ColliderIncludes.h" namespace MidestinyEngine { const float g_Pi{ 3.1415926535f }; #pragma region OpenGLDrawFunctionality void SetColor( const Color4f& color ); void DrawPoint( float x, float y, float pointSize = 1.0f ); void DrawPoint( const Point2f& p, float pointSize = 1.0f ); void DrawPoints( Point2f *pVertices, int nrVertices, float pointSize = 1.0f ); void DrawLine( float x1, float y1, float x2, float y2, float lineWidth = 1.0f ); void DrawLine( const Point2f& p1, const Point2f& p2, float lineWidth = 1.0f ); void DrawCross(const Rectf& boundaries, float lineWidth); void DrawRect(float left, float bottom, float width, float height, float lineWidth = 1.0f); void DrawRect(const Point2f& bottomLeft, float width, float height, float lineWidth = 1.0f); void DrawRect(const Rectf& rect, float lineWidth = 1.0f); void FillRect(float left, float bottom, float width, float height); void FillRect(const Point2f& bottomLeft, float width, float height); void FillRect(const Rectf& rect); void DrawEllipse(float centerX, float centerY, float radX, float radY, float lineWidth = 1.0f); void DrawEllipse(const Point2f& center, float radX, float radY, float lineWidth = 1.0f); void DrawEllipse(const Ellipsef& ellipse , float lineWidth = 1.0f ); void FillEllipse( float centerX, float centerY, float radX, float radY ); void FillEllipse(const Ellipsef& ellipse ); void FillEllipse(const Point2f& center, float radX, float radY); void DrawArc( float centerX, float centerY, float radX, float radY, float fromAngle, float tillAngle, float lineWidth = 1.0f ); void DrawArc( const Point2f& center, float radX, float radY, float fromAngle, float tillAngle, float lineWidth = 1.0f ); void FillArc( float centerX, float centerY, float radX, float radY, float fromAngle, float tillAngle ); void FillArc( const Point2f& center, float radX, float radY, float fromAngle, float tillAngle ); void DrawPolygon( const std::vector<Point2f>& vertices, bool closed = true, float lineWidth = 1.0f ); void DrawPolygon( const Point2f *pVertices, size_t nrVertices, bool closed = true, float lineWidth = 1.0f ); void FillPolygon( const std::vector<Point2f>& vertices); void FillPolygon( const Point2f *pVertices, size_t nrVertices); #pragma endregion OpenGLDrawFunctionality #pragma region CollisionFunctionality struct HitInfo { float lambda{}; Point2f intersectPoint{}; Vector2f normal{}; }; bool IsPointInRect(const Point2f& p, const Rectf& r); bool IsPointInCircle(const Point2f& p, const Circlef& c); bool IsPointInPolygon( const Point2f& p, const std::vector<Point2f>& vertices ); bool IsPointInPolygon( const Point2f& p, const Point2f* vertices, size_t nrVertices ); bool IsOverlapping( const Point2f& a, const Point2f& b, const Circlef& c ); bool IsOverlapping( const Point2f& a, const Point2f& b, const Rectf& r ); bool IsOverlapping(const Rectf & r1, const Rectf & r2); bool IsOverlapping( const Rectf& r, const Circlef& c ); bool IsOverlapping( const Circlef& c1, const Circlef& c2 ); bool IsOverlapping( const std::vector<Point2f>& vertices, const Circlef& c ); bool IsOverlapping( const Point2f* vertices, size_t nrVertices, const Circlef& c ); bool Raycast( const Point2f* vertices, const size_t nrVertices, const Point2f& rayP1, const Point2f& rayP2, HitInfo& hitInfo ); bool Raycast( const std::vector<Point2f>& vertices, const Point2f& rayP1, const Point2f& rayP2, HitInfo& hitInfo ); bool IntersectLineSegments(const Point2f& p1, const Point2f& p2, const Point2f& q1, const Point2f& q2, float& outLambda1, float& outLambda2, float epsilon = 1e-6); float DistPointLineSegment(const Point2f& p, const Point2f& a, const Point2f& b); bool IsPointOnLineSegment(const Point2f& p, const Point2f& a, const Point2f& b); #pragma endregion CollisionFunctionality int Random(int min, int max); Point2f ToPoint2f(const std::string& point2fStr); bool CheckStream(std::istream& inputStream); float Round2Dec(float value); glm::vec3 MakeVec3(const b2Vec2& vec); }
a7d2beeaefb06d189598abd60bbccc326d041205
06e6367d65684637e0b770540e60703fd23ebd54
/src/QtGSL/Precision/vcomplex.cpp
aa4e44f8427af23a623e21d4a6afae2691ce9c0a
[ "MIT" ]
permissive
Vladimir-Lin/QtGSL
820e5403eed3205bb171e3f649049e615a89d9b0
e5c9ebb3344edf6197c94cae7f3613e33e9125b7
refs/heads/main
2023-06-08T17:46:20.595005
2021-06-16T06:29:12
2021-06-16T06:29:12
377,393,918
0
0
null
null
null
null
UTF-8
C++
false
false
10,816
cpp
#include "qtgsl.h" vcomplex:: vcomplex (void) { } vcomplex:: vcomplex ( double X , double Y ) : x ( X ) , y ( Y ) { } vcomplex:: vcomplex(const vcomplex & complex) { x = complex.x ; y = complex.y ; } vcomplex::~vcomplex (void) { } double vcomplex::real(void) { return x ; } double vcomplex::imaginary(void) { return y ; } double vcomplex::argument(void) { gsl_complex z ; z.dat[0] = x ; z.dat[1] = y ; return ::gsl_complex_arg(z) ; } double vcomplex::magnitude(void) { gsl_complex z ; z.dat[0] = x ; z.dat[1] = y ; return ::gsl_complex_abs(z) ; } double vcomplex::squared(void) { gsl_complex z ; z.dat[0] = x ; z.dat[1] = y ; return ::gsl_complex_abs2(z) ; } double vcomplex::logabs(void) { gsl_complex z ; z.dat[0] = x ; z.dat[1] = y ; return ::gsl_complex_logabs(z) ; } vcomplex & vcomplex::operator = (vcomplex & complex) { x = complex.x ; y = complex.y ; return ME ; } vcomplex & vcomplex::operator += (vcomplex & complex) { gsl_complex z ; gsl_complex w ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; w.dat[0] = complex.x ; w.dat[1] = complex.y ; r = ::gsl_complex_add(z,w) ; x = r.dat[0] ; y = r.dat[1] ; return ME ; } vcomplex & vcomplex::operator -= (vcomplex & complex) { gsl_complex z ; gsl_complex w ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; w.dat[0] = complex.x ; w.dat[1] = complex.y ; r = ::gsl_complex_sub(z,w) ; x = r.dat[0] ; y = r.dat[1] ; return ME ; } vcomplex & vcomplex::operator *= (vcomplex & complex) { gsl_complex z ; gsl_complex w ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; w.dat[0] = complex.x ; w.dat[1] = complex.y ; r = ::gsl_complex_mul(z,w) ; x = r.dat[0] ; y = r.dat[1] ; return ME ; } vcomplex & vcomplex::operator /= (vcomplex & complex) { gsl_complex z ; gsl_complex w ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; w.dat[0] = complex.x ; w.dat[1] = complex.y ; r = ::gsl_complex_div(z,w) ; x = r.dat[0] ; y = r.dat[1] ; return ME ; } vcomplex & vcomplex::rectangular (double X,double Y) { x = X ; y = Y ; return ME ; } vcomplex & vcomplex::polar(double r,double theta) { gsl_complex z ; z = ::gsl_complex_polar ( r , theta ) ; x = z.dat[0] ; y = z.dat[1] ; return ME ; } vcomplex & vcomplex::conjugate(void) { y = -y ; return ME ; } vcomplex & vcomplex::inverse(void) { gsl_complex z ; gsl_complex i ; z.dat[0] = x ; z.dat[1] = y ; i = ::gsl_complex_inverse(z) ; x = i.dat[0] ; y = i.dat[1] ; return ME ; } vcomplex & vcomplex::negative(void) { x = -x ; y = -y ; return ME ; } void vcomplex::sin(vcomplex & value) { gsl_complex z ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; r = ::gsl_complex_sin(z) ; value.x = r.dat[0] ; value.y = r.dat[1] ; } void vcomplex::cos(vcomplex & value) { gsl_complex z ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; r = ::gsl_complex_cos(z) ; value.x = r.dat[0] ; value.y = r.dat[1] ; } void vcomplex::tan(vcomplex & value) { gsl_complex z ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; r = ::gsl_complex_tan(z) ; value.x = r.dat[0] ; value.y = r.dat[1] ; } void vcomplex::sec(vcomplex & value) { gsl_complex z ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; r = ::gsl_complex_sec(z) ; value.x = r.dat[0] ; value.y = r.dat[1] ; } void vcomplex::csc(vcomplex & value) { gsl_complex z ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; r = ::gsl_complex_csc(z) ; value.x = r.dat[0] ; value.y = r.dat[1] ; } void vcomplex::cot(vcomplex & value) { gsl_complex z ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; r = ::gsl_complex_cot(z) ; value.x = r.dat[0] ; value.y = r.dat[1] ; } void vcomplex::arcsin(vcomplex & value) { gsl_complex z ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; r = ::gsl_complex_arcsin(z) ; value.x = r.dat[0] ; value.y = r.dat[1] ; } void vcomplex::arccos(vcomplex & value) { gsl_complex z ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; r = ::gsl_complex_arccos(z) ; value.x = r.dat[0] ; value.y = r.dat[1] ; } void vcomplex::arctan(vcomplex & value) { gsl_complex z ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; r = ::gsl_complex_arctan(z) ; value.x = r.dat[0] ; value.y = r.dat[1] ; } void vcomplex::arcsec(vcomplex & value) { gsl_complex z ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; r = ::gsl_complex_arcsec(z) ; value.x = r.dat[0] ; value.y = r.dat[1] ; } void vcomplex::arccsc(vcomplex & value) { gsl_complex z ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; r = ::gsl_complex_arccsc(z) ; value.x = r.dat[0] ; value.y = r.dat[1] ; } void vcomplex::arccot(vcomplex & value) { gsl_complex z ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; r = ::gsl_complex_arccot(z) ; value.x = r.dat[0] ; value.y = r.dat[1] ; } void vcomplex::sinh(vcomplex & value) { gsl_complex z ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; r = ::gsl_complex_sinh(z) ; value.x = r.dat[0] ; value.y = r.dat[1] ; } void vcomplex::cosh(vcomplex & value) { gsl_complex z ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; r = ::gsl_complex_cosh(z) ; value.x = r.dat[0] ; value.y = r.dat[1] ; } void vcomplex::tanh(vcomplex & value) { gsl_complex z ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; r = ::gsl_complex_tanh(z) ; value.x = r.dat[0] ; value.y = r.dat[1] ; } void vcomplex::sech(vcomplex & value) { gsl_complex z ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; r = ::gsl_complex_sech(z) ; value.x = r.dat[0] ; value.y = r.dat[1] ; } void vcomplex::csch(vcomplex & value) { gsl_complex z ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; r = ::gsl_complex_csch(z) ; value.x = r.dat[0] ; value.y = r.dat[1] ; } void vcomplex::coth(vcomplex & value) { gsl_complex z ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; r = ::gsl_complex_coth(z) ; value.x = r.dat[0] ; value.y = r.dat[1] ; } void vcomplex::arcsinh(vcomplex & value) { gsl_complex z ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; r = ::gsl_complex_arcsinh(z) ; value.x = r.dat[0] ; value.y = r.dat[1] ; } void vcomplex::arccosh(vcomplex & value) { gsl_complex z ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; r = ::gsl_complex_arccosh(z) ; value.x = r.dat[0] ; value.y = r.dat[1] ; } void vcomplex::arctanh(vcomplex & value) { gsl_complex z ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; r = ::gsl_complex_arctanh(z) ; value.x = r.dat[0] ; value.y = r.dat[1] ; } void vcomplex::arcsech(vcomplex & value) { gsl_complex z ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; r = ::gsl_complex_arcsech(z) ; value.x = r.dat[0] ; value.y = r.dat[1] ; } void vcomplex::arccsch(vcomplex & value) { gsl_complex z ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; r = ::gsl_complex_arccsch(z) ; value.x = r.dat[0] ; value.y = r.dat[1] ; } void vcomplex::arccoth(vcomplex & value) { gsl_complex z ; gsl_complex r ; z.dat[0] = x ; z.dat[1] = y ; r = ::gsl_complex_arccoth(z) ; value.x = r.dat[0] ; value.y = r.dat[1] ; } int N::Math::toByteArray(const vcomplexes & complexes,QByteArray & body) { int total = complexes.count() ; body.resize(total*sizeof(gsl_complex)) ; gsl_complex * z = (gsl_complex *)body.data() ; for (int i=0;i<total;i++) { z[i].dat[0] = complexes[i].x ; z[i].dat[1] = complexes[i].y ; } ; return body.size() ; } int N::Math::toComplexes(const QByteArray & body,vcomplexes & complexes) { int total = body.size() / sizeof(gsl_complex) ; complexes.clear() ; gsl_complex * z = (gsl_complex *)body.data() ; for (int i=0;i<total;i++) { vcomplex v(z[i].dat[0],z[i].dat[1]) ; complexes << v ; } ; return complexes.count() ; }
73c0e2f8581a02b1abdea70e14723ab58cae79f5
fbbe424559f64e9a94116a07eaaa555a01b0a7bb
/Sklearn_scipy_numpy/source/scipy/weave/scxx/number.h
acbad4d8f6d30e59c4409a78e48777899f40384d
[ "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
permissive
ryfeus/lambda-packs
6544adb4dec19b8e71d75c24d8ed789b785b0369
cabf6e4f1970dc14302f87414f170de19944bac2
refs/heads/master
2022-12-07T16:18:52.475504
2022-11-29T13:35:35
2022-11-29T13:35:35
71,386,735
1,283
263
MIT
2022-11-26T05:02:14
2016-10-19T18:22:39
Python
UTF-8
C++
false
false
5,147
h
/******************************************** copyright 1999 McMillan Enterprises, Inc. www.mcmillan-inc.com modified for weave by eric jones *********************************************/ #if !defined(NUMBER_H_INCLUDED_) #define NUMBER_H_INCLUDED_ #include "object.h" #include "sequence.h" namespace py { class number : public object { public: number() : object() {}; number(int i) : object(i) {}; number(long i) : object(i) {}; number(unsigned long i) : object(i) {}; number(double d) : object(d) {} number(std::complex<double>& d) : object(d) {}; number(const number& other) : object(other) {}; number(PyObject* obj) : object(obj) { _violentTypeCheck(); }; virtual ~number() {}; virtual number& operator=(const number& other) { grab_ref(other); return *this; }; /*virtual*/ number& operator=(const object& other) { grab_ref(other); _violentTypeCheck(); return *this; }; virtual void _violentTypeCheck() { if (!PyNumber_Check(_obj)) { grab_ref(0); fail(PyExc_TypeError, "Not a number"); } }; //PyNumber_Absolute number abs() const { PyObject* rslt = PyNumber_Absolute(_obj); if (rslt==0) fail(PyExc_TypeError, "failed to get absolute value"); return lose_ref(rslt); }; //PyNumber_Add number operator+(const number& rhs) const { PyObject* rslt = PyNumber_Add(_obj, rhs); if (rslt==0) fail(PyExc_TypeError, "Improper rhs for +"); return lose_ref(rslt); }; //PyNumber_And number operator&(const number& rhs) const { PyObject* rslt = PyNumber_And(_obj, rhs); if (rslt==0) fail(PyExc_TypeError, "Improper rhs for &"); return lose_ref(rslt); }; //PyNumber_Coerce //PyNumber_Divide number operator/(const number& rhs) const { PyObject* rslt = PyNumber_Divide(_obj, rhs); if (rslt==0) fail(PyExc_TypeError, "Improper rhs for /"); return lose_ref(rslt); }; //PyNumber_Divmod sequence divmod(const number& rhs) const { PyObject* rslt = PyNumber_Divmod(_obj, rhs); if (rslt==0) fail(PyExc_TypeError, "Improper rhs for divmod"); return lose_ref(rslt); }; //PyNumber_Float operator double () const { PyObject* F = PyNumber_Float(_obj); if (F==0) fail(PyExc_TypeError, "Cannot convert to double"); double r = PyFloat_AS_DOUBLE(F); Py_DECREF(F); return r; }; operator float () const { double rslt = (double) *this; //if (rslt > INT_MAX) // fail(PyExc_TypeError, "Cannot convert to a float"); return (float) rslt; }; //PyNumber_Int operator long () const { PyObject* Int = PyNumber_Int(_obj); if (Int==0) fail(PyExc_TypeError, "Cannot convert to long"); long r = PyInt_AS_LONG(Int); Py_DECREF(Int); return r; }; operator int () const { long rslt = (long) *this; if (rslt > INT_MAX) fail(PyExc_TypeError, "Cannot convert to an int"); return (int) rslt; }; //PyNumber_Invert number operator~ () const { PyObject* rslt = PyNumber_Invert(_obj); if (rslt==0) fail(PyExc_TypeError, "Improper type for ~"); return lose_ref(rslt); }; //PyNumber_Long //PyNumber_Lshift number operator<<(const number& rhs) const { PyObject* rslt = PyNumber_Lshift(_obj, rhs); if (rslt==0) fail(PyExc_TypeError, "Improper rhs for <<"); return lose_ref(rslt); }; //PyNumber_Multiply number operator*(const number& rhs) const { PyObject* rslt = PyNumber_Multiply(_obj, rhs); if (rslt==0) fail(PyExc_TypeError, "Improper rhs for *"); return lose_ref(rslt); }; //PyNumber_Negative number operator- () const { PyObject* rslt = PyNumber_Negative(_obj); if (rslt==0) fail(PyExc_TypeError, "Improper type for unary -"); return lose_ref(rslt); }; //PyNumber_Or number operator|(const number& rhs) const { PyObject* rslt = PyNumber_Or(_obj, rhs); if (rslt==0) fail(PyExc_TypeError, "Improper rhs for |"); return lose_ref(rslt); }; //PyNumber_Positive number operator+ () const { PyObject* rslt = PyNumber_Positive(_obj); if (rslt==0) fail(PyExc_TypeError, "Improper type for unary +"); return lose_ref(rslt); }; //PyNumber_Remainder number operator%(const number& rhs) const { PyObject* rslt = PyNumber_Remainder(_obj, rhs); if (rslt==0) fail(PyExc_TypeError, "Improper rhs for %"); return lose_ref(rslt); }; //PyNumber_Rshift number operator>>(const number& rhs) const { PyObject* rslt = PyNumber_Rshift(_obj, rhs); if (rslt==0) fail(PyExc_TypeError, "Improper rhs for >>"); return lose_ref(rslt); }; //PyNumber_Subtract number operator-(const number& rhs) const { PyObject* rslt = PyNumber_Subtract(_obj, rhs); if (rslt==0) fail(PyExc_TypeError, "Improper rhs for -"); return lose_ref(rslt); }; //PyNumber_Xor number operator^(const number& rhs) const { PyObject* rslt = PyNumber_Xor(_obj, rhs); if (rslt==0) fail(PyExc_TypeError, "Improper rhs for ^"); return lose_ref(rslt); }; }; } // namespace py #endif //NUMBER_H_INCLUDED_
b71d561c9cf571936dcca75b9cd2683330e8ce4a
a94f689196fc0a40bbd97052ec5edb9668f4f250
/RX/other/test_ac/irSend.cpp
e3c33af014f33d67a41cdb429e70fec621382706
[]
no_license
troywiipongwii/Open-Source-RKS
59c0ed2311c75a7bc384557522d4edee1f085562
29c2022ef7864ac68b49cd0d1d837eb2d43ff816
refs/heads/master
2020-05-22T00:25:27.938863
2019-04-08T06:12:47
2019-04-08T06:12:47
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,300
cpp
#include "IRremote.h" #include "IRremoteInt.h" //+============================================================================= void IRsend::sendRaw (const unsigned int buf[], unsigned int len, unsigned int hz) { // Set IR carrier frequency enableIROut(hz); for (unsigned int i = 0; i < len; i++) { if (i & 1) space(buf[i]) ; else mark (buf[i]) ; } space(0); // Always end with the LED off } //+============================================================================= // Sends an IR mark for the specified number of microseconds. // The mark output is modulated at the PWM frequency. // void IRsend::mark (unsigned int time) { TIMER_ENABLE_PWM; // Enable pin 3 PWM output if (time > 0) custom_delay_usec(time); } //+============================================================================= // Leave pin off for time (given in microseconds) // Sends an IR space for the specified number of microseconds. // A space is no output, so the PWM output is disabled. // void IRsend::space (unsigned int time) { TIMER_DISABLE_PWM; // Disable pin 3 PWM output //digitalWrite(TIMER_PWM_PIN, HIGH); if (time > 0) IRsend::custom_delay_usec(time); } //+============================================================================= // Enables IR output. The khz value controls the modulation frequency in kilohertz. // The IR output will be on pin 3 (OC2B). // This routine is designed for 36-40KHz; if you use it for other values, it's up to you // to make sure it gives reasonable results. (Watch out for overflow / underflow / rounding.) // TIMER2 is used in phase-correct PWM mode, with OCR2A controlling the frequency and OCR2B // controlling the duty cycle. // There is no prescaling, so the output frequency is 16MHz / (2 * OCR2A) // To turn the output on and off, we leave the PWM running, but connect and disconnect the output pin. // A few hours staring at the ATmega documentation and this will all make sense. // See my Secrets of Arduino PWM at http://arcfn.com/2009/07/secrets-of-arduino-pwm.html for details. // void IRsend::enableIROut (int khz) { // FIXME: implement ESP32 support, see IR_TIMER_USE_ESP32 in boarddefs.h #ifndef ESP32 // Disable the Timer2 Interrupt (which is used for receiving IR) TIMER_DISABLE_INTR; //Timer2 Overflow Interrupt pinMode(TIMER_PWM_PIN, OUTPUT); digitalWrite(TIMER_PWM_PIN, LOW); // When not sending PWM, we want it low // COM2A = 00: disconnect OC2A // COM2B = 00: disconnect OC2B; to send signal set to 10: OC2B non-inverted // WGM2 = 101: phase-correct PWM with OCRA as top // CS2 = 000: no prescaling // The top value for the timer. The modulation frequency will be SYSCLOCK / 2 / OCR2A. TIMER_CONFIG_KHZ(khz); #endif } //+============================================================================= // Custom delay function that circumvents Arduino's delayMicroseconds limit void IRsend::custom_delay_usec(unsigned long uSecs) { if (uSecs > 4) { unsigned long start = micros(); unsigned long endMicros = start + uSecs - 4; if (endMicros < start) { // Check if overflow while ( micros() > start ) {} // wait until overflow } while ( micros() < endMicros ) {} // normal wait } //else { // __asm__("nop\n\t"); // must have or compiler optimizes out //} }
8124eac1d2d900582129f5f172a39e63f5974088
4ab805399e6b121b7afe14e198c58ee3a5258251
/HighAndLow/stdafx.cpp
b07f6fbe8199f32cf46a39927cdbb2dce83e6e46
[]
no_license
tera1074/HighAndLow
a25e2b544d433ded9768e78cbd9a61af3f8716db
0926b322852a1a3e0d6df945c66456a63ec0141e
refs/heads/master
2022-11-13T10:37:24.966497
2020-07-07T16:51:00
2020-07-07T16:51:00
277,323,375
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
377
cpp
// stdafx.cpp : 標準インクルード HighAndLow.pch のみを // 含むソース ファイルは、プリコンパイル済みヘッダーになります。 // stdafx.obj にはプリコンパイル済み型情報が含まれます。 #include "stdafx.h" // TODO: このファイルではなく、STDAFX.H で必要な // 追加ヘッダーを参照してください。
e0f180591642b4eb673d8cccc3956d8c61527c33
7446fede2d71cdb7c578fe60a894645e70791953
/src/rpcblockchain.cpp
382df3ad5e313e8da24c3f45e5a204324cd056d9
[ "MIT" ]
permissive
ondori-project/rstr
23522833c6e28e03122d40ba663c0024677d05c9
9b3a2ef39ab0f72e8efffee257b2eccc00054b38
refs/heads/master
2021-07-12T18:03:23.480909
2019-02-25T17:51:46
2019-02-25T17:51:46
149,688,410
2
3
MIT
2019-02-14T02:19:49
2018-09-21T00:44:03
C++
UTF-8
C++
false
false
37,137
cpp
// Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers // Copyright (c) 2015-2018 The PIVX developers // Copyright (c) 2015-2018 The RSTR developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "base58.h" #include "checkpoints.h" #include "clientversion.h" #include "main.h" #include "rpcserver.h" #include "sync.h" #include "txdb.h" #include "util.h" #include "utilmoneystr.h" #include "accumulatormap.h" #include <stdint.h> #include <univalue.h> using namespace std; extern void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry); void ScriptPubKeyToJSON(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex); double GetDifficulty(const CBlockIndex* blockindex) { // Floating point number that is a multiple of the minimum difficulty, // minimum difficulty = 1.0. if (blockindex == NULL) { if (chainActive.Tip() == NULL) return 1.0; else blockindex = chainActive.Tip(); } int nShift = (blockindex->nBits >> 24) & 0xff; double dDiff = (double)0x0000ffff / (double)(blockindex->nBits & 0x00ffffff); while (nShift < 29) { dDiff *= 256.0; nShift++; } while (nShift > 29) { dDiff /= 256.0; nShift--; } return dDiff; } UniValue blockheaderToJSON(const CBlockIndex* blockindex) { UniValue result(UniValue::VOBJ); result.push_back(Pair("hash", blockindex->GetBlockHash().GetHex())); int confirmations = -1; // Only report confirmations if the block is on the main chain if (chainActive.Contains(blockindex)) confirmations = chainActive.Height() - blockindex->nHeight + 1; result.push_back(Pair("confirmations", confirmations)); result.push_back(Pair("height", blockindex->nHeight)); result.push_back(Pair("version", blockindex->nVersion)); result.push_back(Pair("merkleroot", blockindex->hashMerkleRoot.GetHex())); result.push_back(Pair("time", (int64_t)blockindex->nTime)); result.push_back(Pair("nonce", (uint64_t)blockindex->nNonce)); result.push_back(Pair("bits", strprintf("%08x", blockindex->nBits))); result.push_back(Pair("difficulty", GetDifficulty(blockindex))); result.push_back(Pair("chainwork", blockindex->nChainWork.GetHex())); result.push_back(Pair("acc_checkpoint", blockindex->nAccumulatorCheckpoint.GetHex())); if (blockindex->pprev) result.push_back(Pair("previousblockhash", blockindex->pprev->GetBlockHash().GetHex())); CBlockIndex *pnext = chainActive.Next(blockindex); if (pnext) result.push_back(Pair("nextblockhash", pnext->GetBlockHash().GetHex())); return result; } UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool txDetails = false) { UniValue result(UniValue::VOBJ); result.push_back(Pair("hash", block.GetHash().GetHex())); int confirmations = -1; // Only report confirmations if the block is on the main chain if (chainActive.Contains(blockindex)) confirmations = chainActive.Height() - blockindex->nHeight + 1; result.push_back(Pair("confirmations", confirmations)); result.push_back(Pair("size", (int)::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION))); result.push_back(Pair("height", blockindex->nHeight)); result.push_back(Pair("version", block.nVersion)); result.push_back(Pair("merkleroot", block.hashMerkleRoot.GetHex())); result.push_back(Pair("acc_checkpoint", block.nAccumulatorCheckpoint.GetHex())); UniValue txs(UniValue::VARR); BOOST_FOREACH (const CTransaction& tx, block.vtx) { if (txDetails) { UniValue objTx(UniValue::VOBJ); TxToJSON(tx, uint256(0), objTx); txs.push_back(objTx); } else txs.push_back(tx.GetHash().GetHex()); } result.push_back(Pair("tx", txs)); result.push_back(Pair("time", block.GetBlockTime())); result.push_back(Pair("nonce", (uint64_t)block.nNonce)); result.push_back(Pair("bits", strprintf("%08x", block.nBits))); result.push_back(Pair("difficulty", GetDifficulty(blockindex))); result.push_back(Pair("chainwork", blockindex->nChainWork.GetHex())); if (blockindex->pprev) result.push_back(Pair("previousblockhash", blockindex->pprev->GetBlockHash().GetHex())); CBlockIndex* pnext = chainActive.Next(blockindex); if (pnext) result.push_back(Pair("nextblockhash", pnext->GetBlockHash().GetHex())); result.push_back(Pair("moneysupply",ValueFromAmount(blockindex->nMoneySupply))); UniValue zrstObj(UniValue::VOBJ); for (auto denom : libzerocoin::zerocoinDenomList) { zrstObj.push_back(Pair(to_string(denom), ValueFromAmount(blockindex->mapZerocoinSupply.at(denom) * (denom*COIN)))); } zrstObj.push_back(Pair("total", ValueFromAmount(blockindex->GetZerocoinSupply()))); result.push_back(Pair("zRSTsupply", zrstObj)); return result; } UniValue getblockcount(const UniValue& params, bool fHelp) { if (fHelp || params.size() != 0) throw runtime_error( "getblockcount\n" "\nReturns the number of blocks in the longest block chain.\n" "\nResult:\n" "n (numeric) The current block count\n" "\nExamples:\n" + HelpExampleCli("getblockcount", "") + HelpExampleRpc("getblockcount", "")); LOCK(cs_main); return chainActive.Height(); } UniValue getbestblockhash(const UniValue& params, bool fHelp) { if (fHelp || params.size() != 0) throw runtime_error( "getbestblockhash\n" "\nReturns the hash of the best (tip) block in the longest block chain.\n" "\nResult\n" "\"hex\" (string) the block hash hex encoded\n" "\nExamples\n" + HelpExampleCli("getbestblockhash", "") + HelpExampleRpc("getbestblockhash", "")); LOCK(cs_main); return chainActive.Tip()->GetBlockHash().GetHex(); } UniValue getdifficulty(const UniValue& params, bool fHelp) { if (fHelp || params.size() != 0) throw runtime_error( "getdifficulty\n" "\nReturns the proof-of-work difficulty as a multiple of the minimum difficulty.\n" "\nResult:\n" "n.nnn (numeric) the proof-of-work difficulty as a multiple of the minimum difficulty.\n" "\nExamples:\n" + HelpExampleCli("getdifficulty", "") + HelpExampleRpc("getdifficulty", "")); LOCK(cs_main); return GetDifficulty(); } UniValue mempoolToJSON(bool fVerbose = false) { if (fVerbose) { LOCK(mempool.cs); UniValue o(UniValue::VOBJ); BOOST_FOREACH (const PAIRTYPE(uint256, CTxMemPoolEntry) & entry, mempool.mapTx) { const uint256& hash = entry.first; const CTxMemPoolEntry& e = entry.second; UniValue info(UniValue::VOBJ); info.push_back(Pair("size", (int)e.GetTxSize())); info.push_back(Pair("fee", ValueFromAmount(e.GetFee()))); info.push_back(Pair("time", e.GetTime())); info.push_back(Pair("height", (int)e.GetHeight())); info.push_back(Pair("startingpriority", e.GetPriority(e.GetHeight()))); info.push_back(Pair("currentpriority", e.GetPriority(chainActive.Height()))); const CTransaction& tx = e.GetTx(); set<string> setDepends; BOOST_FOREACH (const CTxIn& txin, tx.vin) { if (mempool.exists(txin.prevout.hash)) setDepends.insert(txin.prevout.hash.ToString()); } UniValue depends(UniValue::VARR); BOOST_FOREACH(const string& dep, setDepends) { depends.push_back(dep); } info.push_back(Pair("depends", depends)); o.push_back(Pair(hash.ToString(), info)); } return o; } else { vector<uint256> vtxid; mempool.queryHashes(vtxid); UniValue a(UniValue::VARR); BOOST_FOREACH (const uint256& hash, vtxid) a.push_back(hash.ToString()); return a; } } UniValue getrawmempool(const UniValue& params, bool fHelp) { if (fHelp || params.size() > 1) throw runtime_error( "getrawmempool ( verbose )\n" "\nReturns all transaction ids in memory pool as a json array of string transaction ids.\n" "\nArguments:\n" "1. verbose (boolean, optional, default=false) true for a json object, false for array of transaction ids\n" "\nResult: (for verbose = false):\n" "[ (json array of string)\n" " \"transactionid\" (string) The transaction id\n" " ,...\n" "]\n" "\nResult: (for verbose = true):\n" "{ (json object)\n" " \"transactionid\" : { (json object)\n" " \"size\" : n, (numeric) transaction size in bytes\n" " \"fee\" : n, (numeric) transaction fee in rstr\n" " \"time\" : n, (numeric) local time transaction entered pool in seconds since 1 Jan 1970 GMT\n" " \"height\" : n, (numeric) block height when transaction entered pool\n" " \"startingpriority\" : n, (numeric) priority when transaction entered pool\n" " \"currentpriority\" : n, (numeric) transaction priority now\n" " \"depends\" : [ (array) unconfirmed transactions used as inputs for this transaction\n" " \"transactionid\", (string) parent transaction id\n" " ... ]\n" " }, ...\n" "]\n" "\nExamples\n" + HelpExampleCli("getrawmempool", "true") + HelpExampleRpc("getrawmempool", "true")); LOCK(cs_main); bool fVerbose = false; if (params.size() > 0) fVerbose = params[0].get_bool(); return mempoolToJSON(fVerbose); } UniValue getblockhash(const UniValue& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( "getblockhash index\n" "\nReturns hash of block in best-block-chain at index provided.\n" "\nArguments:\n" "1. index (numeric, required) The block index\n" "\nResult:\n" "\"hash\" (string) The block hash\n" "\nExamples:\n" + HelpExampleCli("getblockhash", "1000") + HelpExampleRpc("getblockhash", "1000")); LOCK(cs_main); int nHeight = params[0].get_int(); if (nHeight < 0 || nHeight > chainActive.Height()) throw JSONRPCError(RPC_INVALID_PARAMETER, "Block height out of range"); CBlockIndex* pblockindex = chainActive[nHeight]; return pblockindex->GetBlockHash().GetHex(); } UniValue getblock(const UniValue& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) throw runtime_error( "getblock \"hash\" ( verbose )\n" "\nIf verbose is false, returns a string that is serialized, hex-encoded data for block 'hash'.\n" "If verbose is true, returns an Object with information about block <hash>.\n" "\nArguments:\n" "1. \"hash\" (string, required) The block hash\n" "2. verbose (boolean, optional, default=true) true for a json object, false for the hex encoded data\n" "\nResult (for verbose = true):\n" "{\n" " \"hash\" : \"hash\", (string) the block hash (same as provided)\n" " \"confirmations\" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain\n" " \"size\" : n, (numeric) The block size\n" " \"height\" : n, (numeric) The block height or index\n" " \"version\" : n, (numeric) The block version\n" " \"merkleroot\" : \"xxxx\", (string) The merkle root\n" " \"tx\" : [ (array of string) The transaction ids\n" " \"transactionid\" (string) The transaction id\n" " ,...\n" " ],\n" " \"time\" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n" " \"nonce\" : n, (numeric) The nonce\n" " \"bits\" : \"1d00ffff\", (string) The bits\n" " \"difficulty\" : x.xxx, (numeric) The difficulty\n" " \"previousblockhash\" : \"hash\", (string) The hash of the previous block\n" " \"nextblockhash\" : \"hash\" (string) The hash of the next block\n" " \"moneysupply\" : \"supply\" (numeric) The money supply when this block was added to the blockchain\n" " \"zRSTsupply\" :\n" " {\n" " \"1\" : n, (numeric) supply of 1 zRST denomination\n" " \"5\" : n, (numeric) supply of 5 zRST denomination\n" " \"10\" : n, (numeric) supply of 10 zRST denomination\n" " \"50\" : n, (numeric) supply of 50 zRST denomination\n" " \"100\" : n, (numeric) supply of 100 zRST denomination\n" " \"500\" : n, (numeric) supply of 500 zRST denomination\n" " \"1000\" : n, (numeric) supply of 1000 zRST denomination\n" " \"5000\" : n, (numeric) supply of 5000 zRST denomination\n" " \"total\" : n, (numeric) The total supply of all zRST denominations\n" " }\n" "}\n" "\nResult (for verbose=false):\n" "\"data\" (string) A string that is serialized, hex-encoded data for block 'hash'.\n" "\nExamples:\n" + HelpExampleCli("getblock", "\"00000000000fd08c2fb661d2fcb0d49abb3a91e5f27082ce64feed3b4dede2e2\"") + HelpExampleRpc("getblock", "\"00000000000fd08c2fb661d2fcb0d49abb3a91e5f27082ce64feed3b4dede2e2\"")); LOCK(cs_main); std::string strHash = params[0].get_str(); uint256 hash(strHash); bool fVerbose = true; if (params.size() > 1) fVerbose = params[1].get_bool(); if (mapBlockIndex.count(hash) == 0) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); CBlock block; CBlockIndex* pblockindex = mapBlockIndex[hash]; if (!ReadBlockFromDisk(block, pblockindex)) throw JSONRPCError(RPC_INTERNAL_ERROR, "Can't read block from disk"); if (!fVerbose) { CDataStream ssBlock(SER_NETWORK, PROTOCOL_VERSION); ssBlock << block; std::string strHex = HexStr(ssBlock.begin(), ssBlock.end()); return strHex; } return blockToJSON(block, pblockindex); } UniValue getblockheader(const UniValue& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) throw runtime_error( "getblockheader \"hash\" ( verbose )\n" "\nIf verbose is false, returns a string that is serialized, hex-encoded data for block 'hash' header.\n" "If verbose is true, returns an Object with information about block <hash> header.\n" "\nArguments:\n" "1. \"hash\" (string, required) The block hash\n" "2. verbose (boolean, optional, default=true) true for a json object, false for the hex encoded data\n" "\nResult (for verbose = true):\n" "{\n" " \"version\" : n, (numeric) The block version\n" " \"previousblockhash\" : \"hash\", (string) The hash of the previous block\n" " \"merkleroot\" : \"xxxx\", (string) The merkle root\n" " \"time\" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n" " \"bits\" : \"1d00ffff\", (string) The bits\n" " \"nonce\" : n, (numeric) The nonce\n" "}\n" "\nResult (for verbose=false):\n" "\"data\" (string) A string that is serialized, hex-encoded data for block 'hash' header.\n" "\nExamples:\n" + HelpExampleCli("getblockheader", "\"00000000000fd08c2fb661d2fcb0d49abb3a91e5f27082ce64feed3b4dede2e2\"") + HelpExampleRpc("getblockheader", "\"00000000000fd08c2fb661d2fcb0d49abb3a91e5f27082ce64feed3b4dede2e2\"")); std::string strHash = params[0].get_str(); uint256 hash(strHash); bool fVerbose = true; if (params.size() > 1) fVerbose = params[1].get_bool(); if (mapBlockIndex.count(hash) == 0) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); CBlockIndex* pblockindex = mapBlockIndex[hash]; if (!fVerbose) { CDataStream ssBlock(SER_NETWORK, PROTOCOL_VERSION); ssBlock << pblockindex->GetBlockHeader(); std::string strHex = HexStr(ssBlock.begin(), ssBlock.end()); return strHex; } return blockheaderToJSON(pblockindex); } UniValue gettxoutsetinfo(const UniValue& params, bool fHelp) { if (fHelp || params.size() != 0) throw runtime_error( "gettxoutsetinfo\n" "\nReturns statistics about the unspent transaction output set.\n" "Note this call may take some time.\n" "\nResult:\n" "{\n" " \"height\":n, (numeric) The current block height (index)\n" " \"bestblock\": \"hex\", (string) the best block hash hex\n" " \"transactions\": n, (numeric) The number of transactions\n" " \"txouts\": n, (numeric) The number of output transactions\n" " \"bytes_serialized\": n, (numeric) The serialized size\n" " \"hash_serialized\": \"hash\", (string) The serialized hash\n" " \"total_amount\": x.xxx (numeric) The total amount\n" "}\n" "\nExamples:\n" + HelpExampleCli("gettxoutsetinfo", "") + HelpExampleRpc("gettxoutsetinfo", "")); LOCK(cs_main); UniValue ret(UniValue::VOBJ); CCoinsStats stats; FlushStateToDisk(); if (pcoinsTip->GetStats(stats)) { ret.push_back(Pair("height", (int64_t)stats.nHeight)); ret.push_back(Pair("bestblock", stats.hashBlock.GetHex())); ret.push_back(Pair("transactions", (int64_t)stats.nTransactions)); ret.push_back(Pair("txouts", (int64_t)stats.nTransactionOutputs)); ret.push_back(Pair("bytes_serialized", (int64_t)stats.nSerializedSize)); ret.push_back(Pair("hash_serialized", stats.hashSerialized.GetHex())); ret.push_back(Pair("total_amount", ValueFromAmount(stats.nTotalAmount))); } return ret; } UniValue gettxout(const UniValue& params, bool fHelp) { if (fHelp || params.size() < 2 || params.size() > 3) throw runtime_error( "gettxout \"txid\" n ( includemempool )\n" "\nReturns details about an unspent transaction output.\n" "\nArguments:\n" "1. \"txid\" (string, required) The transaction id\n" "2. n (numeric, required) vout value\n" "3. includemempool (boolean, optional) Whether to included the mem pool\n" "\nResult:\n" "{\n" " \"bestblock\" : \"hash\", (string) the block hash\n" " \"confirmations\" : n, (numeric) The number of confirmations\n" " \"value\" : x.xxx, (numeric) The transaction value in btc\n" " \"scriptPubKey\" : { (json object)\n" " \"asm\" : \"code\", (string) \n" " \"hex\" : \"hex\", (string) \n" " \"reqSigs\" : n, (numeric) Number of required signatures\n" " \"type\" : \"pubkeyhash\", (string) The type, eg pubkeyhash\n" " \"addresses\" : [ (array of string) array of rstr addresses\n" " \"rstraddress\" (string) rstr address\n" " ,...\n" " ]\n" " },\n" " \"version\" : n, (numeric) The version\n" " \"coinbase\" : true|false (boolean) Coinbase or not\n" "}\n" "\nExamples:\n" "\nGet unspent transactions\n" + HelpExampleCli("listunspent", "") + "\nView the details\n" + HelpExampleCli("gettxout", "\"txid\" 1") + "\nAs a json rpc call\n" + HelpExampleRpc("gettxout", "\"txid\", 1")); LOCK(cs_main); UniValue ret(UniValue::VOBJ); std::string strHash = params[0].get_str(); uint256 hash(strHash); int n = params[1].get_int(); bool fMempool = true; if (params.size() > 2) fMempool = params[2].get_bool(); CCoins coins; if (fMempool) { LOCK(mempool.cs); CCoinsViewMemPool view(pcoinsTip, mempool); if (!view.GetCoins(hash, coins)) return NullUniValue; mempool.pruneSpent(hash, coins); // TODO: this should be done by the CCoinsViewMemPool } else { if (!pcoinsTip->GetCoins(hash, coins)) return NullUniValue; } if (n < 0 || (unsigned int)n >= coins.vout.size() || coins.vout[n].IsNull()) return NullUniValue; BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock()); CBlockIndex* pindex = it->second; ret.push_back(Pair("bestblock", pindex->GetBlockHash().GetHex())); if ((unsigned int)coins.nHeight == MEMPOOL_HEIGHT) ret.push_back(Pair("confirmations", 0)); else ret.push_back(Pair("confirmations", pindex->nHeight - coins.nHeight + 1)); ret.push_back(Pair("value", ValueFromAmount(coins.vout[n].nValue))); UniValue o(UniValue::VOBJ); ScriptPubKeyToJSON(coins.vout[n].scriptPubKey, o, true); ret.push_back(Pair("scriptPubKey", o)); ret.push_back(Pair("version", coins.nVersion)); ret.push_back(Pair("coinbase", coins.fCoinBase)); return ret; } UniValue verifychain(const UniValue& params, bool fHelp) { if (fHelp || params.size() > 2) throw runtime_error( "verifychain ( numblocks )\n" "\nVerifies blockchain database.\n" "\nArguments:\n" "1. numblocks (numeric, optional, default=288, 0=all) The number of blocks to check.\n" "\nResult:\n" "true|false (boolean) Verified or not\n" "\nExamples:\n" + HelpExampleCli("verifychain", "") + HelpExampleRpc("verifychain", "")); LOCK(cs_main); int nCheckLevel = 4; int nCheckDepth = GetArg("-checkblocks", 288); if (params.size() > 0) nCheckDepth = params[1].get_int(); fVerifyingBlocks = true; bool fVerified = CVerifyDB().VerifyDB(pcoinsTip, nCheckLevel, nCheckDepth); fVerifyingBlocks = false; return fVerified; } UniValue getblockchaininfo(const UniValue& params, bool fHelp) { if (fHelp || params.size() != 0) throw runtime_error( "getblockchaininfo\n" "Returns an object containing various state info regarding block chain processing.\n" "\nResult:\n" "{\n" " \"chain\": \"xxxx\", (string) current network name as defined in BIP70 (main, test, regtest)\n" " \"blocks\": xxxxxx, (numeric) the current number of blocks processed in the server\n" " \"headers\": xxxxxx, (numeric) the current number of headers we have validated\n" " \"bestblockhash\": \"...\", (string) the hash of the currently best block\n" " \"difficulty\": xxxxxx, (numeric) the current difficulty\n" " \"verificationprogress\": xxxx, (numeric) estimate of verification progress [0..1]\n" " \"chainwork\": \"xxxx\" (string) total amount of work in active chain, in hexadecimal\n" "}\n" "\nExamples:\n" + HelpExampleCli("getblockchaininfo", "") + HelpExampleRpc("getblockchaininfo", "")); LOCK(cs_main); UniValue obj(UniValue::VOBJ); obj.push_back(Pair("chain", Params().NetworkIDString())); obj.push_back(Pair("blocks", (int)chainActive.Height())); obj.push_back(Pair("headers", pindexBestHeader ? pindexBestHeader->nHeight : -1)); obj.push_back(Pair("bestblockhash", chainActive.Tip()->GetBlockHash().GetHex())); obj.push_back(Pair("difficulty", (double)GetDifficulty())); obj.push_back(Pair("verificationprogress", Checkpoints::GuessVerificationProgress(chainActive.Tip()))); obj.push_back(Pair("chainwork", chainActive.Tip()->nChainWork.GetHex())); return obj; } /** Comparison function for sorting the getchaintips heads. */ struct CompareBlocksByHeight { bool operator()(const CBlockIndex* a, const CBlockIndex* b) const { /* Make sure that unequal blocks with the same height do not compare equal. Use the pointers themselves to make a distinction. */ if (a->nHeight != b->nHeight) return (a->nHeight > b->nHeight); return a < b; } }; UniValue getchaintips(const UniValue& params, bool fHelp) { if (fHelp || params.size() != 0) throw runtime_error( "getchaintips\n" "Return information about all known tips in the block tree," " including the main chain as well as orphaned branches.\n" "\nResult:\n" "[\n" " {\n" " \"height\": xxxx, (numeric) height of the chain tip\n" " \"hash\": \"xxxx\", (string) block hash of the tip\n" " \"branchlen\": 0 (numeric) zero for main chain\n" " \"status\": \"active\" (string) \"active\" for the main chain\n" " },\n" " {\n" " \"height\": xxxx,\n" " \"hash\": \"xxxx\",\n" " \"branchlen\": 1 (numeric) length of branch connecting the tip to the main chain\n" " \"status\": \"xxxx\" (string) status of the chain (active, valid-fork, valid-headers, headers-only, invalid)\n" " }\n" "]\n" "Possible values for status:\n" "1. \"invalid\" This branch contains at least one invalid block\n" "2. \"headers-only\" Not all blocks for this branch are available, but the headers are valid\n" "3. \"valid-headers\" All blocks are available for this branch, but they were never fully validated\n" "4. \"valid-fork\" This branch is not part of the active chain, but is fully validated\n" "5. \"active\" This is the tip of the active main chain, which is certainly valid\n" "\nExamples:\n" + HelpExampleCli("getchaintips", "") + HelpExampleRpc("getchaintips", "")); LOCK(cs_main); /* Build up a list of chain tips. We start with the list of all known blocks, and successively remove blocks that appear as pprev of another block. */ std::set<const CBlockIndex*, CompareBlocksByHeight> setTips; BOOST_FOREACH (const PAIRTYPE(const uint256, CBlockIndex*) & item, mapBlockIndex) setTips.insert(item.second); BOOST_FOREACH (const PAIRTYPE(const uint256, CBlockIndex*) & item, mapBlockIndex) { const CBlockIndex* pprev = item.second->pprev; if (pprev) setTips.erase(pprev); } // Always report the currently active tip. setTips.insert(chainActive.Tip()); /* Construct the output array. */ UniValue res(UniValue::VARR); BOOST_FOREACH (const CBlockIndex* block, setTips) { UniValue obj(UniValue::VOBJ); obj.push_back(Pair("height", block->nHeight)); obj.push_back(Pair("hash", block->phashBlock->GetHex())); const int branchLen = block->nHeight - chainActive.FindFork(block)->nHeight; obj.push_back(Pair("branchlen", branchLen)); string status; if (chainActive.Contains(block)) { // This block is part of the currently active chain. status = "active"; } else if (block->nStatus & BLOCK_FAILED_MASK) { // This block or one of its ancestors is invalid. status = "invalid"; } else if (block->nChainTx == 0) { // This block cannot be connected because full block data for it or one of its parents is missing. status = "headers-only"; } else if (block->IsValid(BLOCK_VALID_SCRIPTS)) { // This block is fully validated, but no longer part of the active chain. It was probably the active block once, but was reorganized. status = "valid-fork"; } else if (block->IsValid(BLOCK_VALID_TREE)) { // The headers for this block are valid, but it has not been validated. It was probably never part of the most-work chain. status = "valid-headers"; } else { // No clue. status = "unknown"; } obj.push_back(Pair("status", status)); res.push_back(obj); } return res; } UniValue getfeeinfo(const UniValue& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( "getfeeinfo blocks\n" "\nReturns details of transaction fees over the last n blocks.\n" "\nArguments:\n" "1. blocks (int, required) the number of blocks to get transaction data from\n" "\nResult:\n" "{\n" " \"txcount\": xxxxx (numeric) Current tx count\n" " \"txbytes\": xxxxx (numeric) Sum of all tx sizes\n" " \"ttlfee\": xxxxx (numeric) Sum of all fees\n" " \"feeperkb\": xxxxx (numeric) Average fee per kb over the block range\n" " \"rec_highpriorityfee_perkb\": xxxxx (numeric) Recommended fee per kb to use for a high priority tx\n" "}\n" "\nExamples:\n" + HelpExampleCli("getfeeinfo", "5") + HelpExampleRpc("getfeeinfo", "5")); LOCK(cs_main); int nBlocks = params[0].get_int(); int nBestHeight = chainActive.Height(); int nStartHeight = nBestHeight - nBlocks; if (nBlocks < 0 || nStartHeight <= 0) throw JSONRPCError(RPC_INVALID_PARAMETER, "invalid start height"); CAmount nFees = 0; int64_t nBytes = 0; int64_t nTotal = 0; for (int i = nStartHeight; i <= nBestHeight; i++) { CBlockIndex* pindex = chainActive[i]; CBlock block; if (!ReadBlockFromDisk(block, pindex)) throw JSONRPCError(RPC_DATABASE_ERROR, "failed to read block from disk"); CAmount nValueIn = 0; CAmount nValueOut = 0; for (const CTransaction& tx : block.vtx) { if (tx.IsCoinBase() || tx.IsCoinStake()) continue; for (unsigned int j = 0; j < tx.vin.size(); j++) { if (tx.vin[j].scriptSig.IsZerocoinSpend()) { nValueIn += tx.vin[j].nSequence * COIN; continue; } COutPoint prevout = tx.vin[j].prevout; CTransaction txPrev; uint256 hashBlock; if(!GetTransaction(prevout.hash, txPrev, hashBlock, true)) throw JSONRPCError(RPC_DATABASE_ERROR, "failed to read tx from disk"); nValueIn += txPrev.vout[prevout.n].nValue; } for (unsigned int j = 0; j < tx.vout.size(); j++) { nValueOut += tx.vout[j].nValue; } nFees += nValueIn - nValueOut; nBytes += tx.GetSerializeSize(SER_NETWORK, CLIENT_VERSION); nTotal++; } pindex = chainActive.Next(pindex); if (!pindex) break; } UniValue ret(UniValue::VOBJ); CFeeRate nFeeRate = CFeeRate(nFees, nBytes); ret.push_back(Pair("txcount", (int64_t)nTotal)); ret.push_back(Pair("txbytes", (int64_t)nBytes)); ret.push_back(Pair("ttlfee", FormatMoney(nFees))); ret.push_back(Pair("feeperkb", FormatMoney(nFeeRate.GetFeePerK()))); ret.push_back(Pair("rec_highpriorityfee_perkb", FormatMoney(nFeeRate.GetFeePerK() + 1000))); return ret; } UniValue mempoolInfoToJSON() { UniValue ret(UniValue::VOBJ); ret.push_back(Pair("size", (int64_t) mempool.size())); ret.push_back(Pair("bytes", (int64_t) mempool.GetTotalTxSize())); //ret.push_back(Pair("usage", (int64_t) mempool.DynamicMemoryUsage())); return ret; } UniValue getmempoolinfo(const UniValue& params, bool fHelp) { if (fHelp || params.size() != 0) throw runtime_error( "getmempoolinfo\n" "\nReturns details on the active state of the TX memory pool.\n" "\nResult:\n" "{\n" " \"size\": xxxxx (numeric) Current tx count\n" " \"bytes\": xxxxx (numeric) Sum of all tx sizes\n" "}\n" "\nExamples:\n" + HelpExampleCli("getmempoolinfo", "") + HelpExampleRpc("getmempoolinfo", "")); return mempoolInfoToJSON(); } UniValue invalidateblock(const UniValue& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( "invalidateblock \"hash\"\n" "\nPermanently marks a block as invalid, as if it violated a consensus rule.\n" "\nArguments:\n" "1. hash (string, required) the hash of the block to mark as invalid\n" "\nExamples:\n" + HelpExampleCli("invalidateblock", "\"blockhash\"") + HelpExampleRpc("invalidateblock", "\"blockhash\"")); std::string strHash = params[0].get_str(); uint256 hash(strHash); CValidationState state; { LOCK(cs_main); if (mapBlockIndex.count(hash) == 0) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); CBlockIndex* pblockindex = mapBlockIndex[hash]; InvalidateBlock(state, pblockindex); } if (state.IsValid()) { ActivateBestChain(state); } if (!state.IsValid()) { throw JSONRPCError(RPC_DATABASE_ERROR, state.GetRejectReason()); } return NullUniValue; } UniValue reconsiderblock(const UniValue& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( "reconsiderblock \"hash\"\n" "\nRemoves invalidity status of a block and its descendants, reconsider them for activation.\n" "This can be used to undo the effects of invalidateblock.\n" "\nArguments:\n" "1. hash (string, required) the hash of the block to reconsider\n" "\nExamples:\n" + HelpExampleCli("reconsiderblock", "\"blockhash\"") + HelpExampleRpc("reconsiderblock", "\"blockhash\"")); std::string strHash = params[0].get_str(); uint256 hash(strHash); CValidationState state; { LOCK(cs_main); if (mapBlockIndex.count(hash) == 0) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); CBlockIndex* pblockindex = mapBlockIndex[hash]; ReconsiderBlock(state, pblockindex); } if (state.IsValid()) { ActivateBestChain(state); } if (!state.IsValid()) { throw JSONRPCError(RPC_DATABASE_ERROR, state.GetRejectReason()); } return NullUniValue; } UniValue findserial(const UniValue& params, bool fHelp) { if(fHelp || params.size() != 1) throw runtime_error( "findserial \"serial\"\n" "\nSearches the zerocoin database for a zerocoin spend transaction that contains the specified serial\n" "\nArguments:\n" "1. serial (string, required) the serial of a zerocoin spend to search for.\n" "\nResult:\n" "{\n" " \"success\": true|false (boolean) Whether the serial was found\n" " \"txid\": \"xxx\" (string) The transaction that contains the spent serial\n" "}\n" "\nExamples:\n" + HelpExampleCli("findserial", "\"serial\"") + HelpExampleRpc("findserial", "\"serial\"")); std::string strSerial = params[0].get_str(); CBigNum bnSerial = 0; bnSerial.SetHex(strSerial); if (!bnSerial) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid serial"); uint256 txid = 0; bool fSuccess = zerocoinDB->ReadCoinSpend(bnSerial, txid); UniValue ret(UniValue::VOBJ); ret.push_back(Pair("success", fSuccess)); ret.push_back(Pair("txid", txid.GetHex())); return ret; }
65ca982daef1c1e83a7e877675d23e6f37884f1c
8cba725e212665aa5109a28486b35414bdd69611
/Asteroid.h
8039e1c92cd18b8ff7a117a368b6283775d8faf6
[]
no_license
seungmu0715/ProjectAsteroids
53fbed80994a07f915562979542975055f16ee06
b5b706cf1555409344723a9a59dafa1850b0b22b
refs/heads/master
2020-12-24T18:42:02.460127
2016-04-21T05:56:03
2016-04-21T05:56:03
56,375,953
0
0
null
null
null
null
UTF-8
C++
false
false
774
h
#pragma once #include "Util.h" #include "Sprite.h" class Asteroid { private: Sprite* m_Sprite; int m_Type; int m_PosX, m_PosY; float m_DeltaX, m_DeltaY; float m_Size; float m_Radius; float m_Speed; bool m_IsDying; bool m_IsDead; int m_Frame; float m_Rotation; public: void Initialize(Sprite * sprite, int type, int fromX, int fromY, int toX, int toY, float size); void Update(DWORD delta); void Render(); int GetType() { return m_Type; }; int GetX() { return m_PosX; }; int GetY() { return m_PosY; }; float GetRadius() { return m_Radius; }; bool IsDying() { return m_IsDying; }; bool IsDead() { return m_IsDead; }; void SetDead(); void ActivateWarpDrive() { m_Speed = 0.5f; }; void DeactivateWarpDrive() { m_Speed = 1.0f; }; };
e6c6a04370ab129732814ee0e376fa433669302e
98b35b7df1e77846b52d42811e4bf22ac1f39121
/src/test/script_P2SH_tests.cpp
9fee500d9db512d3ebda692555786f89e02a2872
[ "MIT" ]
permissive
Saci-de-bani/firelynxcoin
58c9f9a4dc8b9d626c80986d8fe25926e0a90e2c
0810289c9b26b320b4633579e862c6ac416e9d9f
refs/heads/master
2020-03-22T20:40:24.703875
2018-07-12T02:27:37
2018-07-12T02:27:37
140,621,038
0
0
null
null
null
null
UTF-8
C++
false
false
14,118
cpp
// Copyright (c) 2012-2015 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "key.h" #include "keystore.h" #include "validation.h" #include "policy/policy.h" #include "script/script.h" #include "script/script_error.h" #include "script/sign.h" #include "test/test_firelynxcoin.h" #ifdef ENABLE_WALLET #include "wallet/wallet_ismine.h" #endif #include <vector> #include <boost/test/unit_test.hpp> using namespace std; // Helpers: static std::vector<unsigned char> Serialize(const CScript& s) { std::vector<unsigned char> sSerialized(s.begin(), s.end()); return sSerialized; } static bool Verify(const CScript& scriptSig, const CScript& scriptPubKey, bool fStrict, ScriptError& err) { // Create dummy to/from transactions: CMutableTransaction txFrom; txFrom.vout.resize(1); txFrom.vout[0].scriptPubKey = scriptPubKey; CMutableTransaction txTo; txTo.vin.resize(1); txTo.vout.resize(1); txTo.vin[0].prevout.n = 0; txTo.vin[0].prevout.hash = txFrom.GetHash(); txTo.vin[0].scriptSig = scriptSig; txTo.vout[0].nValue = 1; return VerifyScript(scriptSig, scriptPubKey, fStrict ? SCRIPT_VERIFY_P2SH : SCRIPT_VERIFY_NONE, MutableTransactionSignatureChecker(&txTo, 0), &err); } BOOST_FIXTURE_TEST_SUITE(script_P2SH_tests, BasicTestingSetup) BOOST_AUTO_TEST_CASE(sign) { LOCK(cs_main); // Pay-to-script-hash looks like this: // scriptSig: <sig> <sig...> <serialized_script> // scriptPubKey: HASH160 <hash> EQUAL // Test SignSignature() (and therefore the version of Solver() that signs transactions) CBasicKeyStore keystore; CKey key[4]; for (int i = 0; i < 4; i++) { key[i].MakeNewKey(true); keystore.AddKey(key[i]); } // 8 Scripts: checking all combinations of // different keys, straight/P2SH, pubkey/pubkeyhash CScript standardScripts[4]; standardScripts[0] << ToByteVector(key[0].GetPubKey()) << OP_CHECKSIG; standardScripts[1] = GetScriptForDestination(key[1].GetPubKey().GetID()); standardScripts[2] << ToByteVector(key[1].GetPubKey()) << OP_CHECKSIG; standardScripts[3] = GetScriptForDestination(key[2].GetPubKey().GetID()); CScript evalScripts[4]; for (int i = 0; i < 4; i++) { keystore.AddCScript(standardScripts[i]); evalScripts[i] = GetScriptForDestination(CScriptID(standardScripts[i])); } CMutableTransaction txFrom; // Funding transaction: string reason; txFrom.vout.resize(8); for (int i = 0; i < 4; i++) { txFrom.vout[i].scriptPubKey = evalScripts[i]; txFrom.vout[i].nValue = COIN; txFrom.vout[i+4].scriptPubKey = standardScripts[i]; txFrom.vout[i+4].nValue = COIN; } BOOST_CHECK(IsStandardTx(txFrom, reason)); CMutableTransaction txTo[8]; // Spending transactions for (int i = 0; i < 8; i++) { txTo[i].vin.resize(1); txTo[i].vout.resize(1); txTo[i].vin[0].prevout.n = i; txTo[i].vin[0].prevout.hash = txFrom.GetHash(); txTo[i].vout[0].nValue = 1; #ifdef ENABLE_WALLET BOOST_CHECK_MESSAGE(IsMine(keystore, txFrom.vout[i].scriptPubKey), strprintf("IsMine %d", i)); #endif } for (int i = 0; i < 8; i++) { BOOST_CHECK_MESSAGE(SignSignature(keystore, txFrom, txTo[i], 0), strprintf("SignSignature %d", i)); } // All of the above should be OK, and the txTos have valid signatures // Check to make sure signature verification fails if we use the wrong ScriptSig: for (int i = 0; i < 8; i++) for (int j = 0; j < 8; j++) { CScript sigSave = txTo[i].vin[0].scriptSig; txTo[i].vin[0].scriptSig = txTo[j].vin[0].scriptSig; bool sigOK = CScriptCheck(CCoins(txFrom, 0), txTo[i], 0, SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC, false)(); if (i == j) BOOST_CHECK_MESSAGE(sigOK, strprintf("VerifySignature %d %d", i, j)); else BOOST_CHECK_MESSAGE(!sigOK, strprintf("VerifySignature %d %d", i, j)); txTo[i].vin[0].scriptSig = sigSave; } } BOOST_AUTO_TEST_CASE(norecurse) { ScriptError err; // Make sure only the outer pay-to-script-hash does the // extra-validation thing: CScript invalidAsScript; invalidAsScript << OP_INVALIDOPCODE << OP_INVALIDOPCODE; CScript p2sh = GetScriptForDestination(CScriptID(invalidAsScript)); CScript scriptSig; scriptSig << Serialize(invalidAsScript); // Should not verify, because it will try to execute OP_INVALIDOPCODE BOOST_CHECK(!Verify(scriptSig, p2sh, true, err)); BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_BAD_OPCODE, ScriptErrorString(err)); // Try to recur, and verification should succeed because // the inner HASH160 <> EQUAL should only check the hash: CScript p2sh2 = GetScriptForDestination(CScriptID(p2sh)); CScript scriptSig2; scriptSig2 << Serialize(invalidAsScript) << Serialize(p2sh); BOOST_CHECK(Verify(scriptSig2, p2sh2, true, err)); BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err)); } BOOST_AUTO_TEST_CASE(set) { LOCK(cs_main); // Test the CScript::Set* methods CBasicKeyStore keystore; CKey key[4]; std::vector<CPubKey> keys; for (int i = 0; i < 4; i++) { key[i].MakeNewKey(true); keystore.AddKey(key[i]); keys.push_back(key[i].GetPubKey()); } CScript inner[4]; inner[0] = GetScriptForDestination(key[0].GetPubKey().GetID()); inner[1] = GetScriptForMultisig(2, std::vector<CPubKey>(keys.begin(), keys.begin()+2)); inner[2] = GetScriptForMultisig(1, std::vector<CPubKey>(keys.begin(), keys.begin()+2)); inner[3] = GetScriptForMultisig(2, std::vector<CPubKey>(keys.begin(), keys.begin()+3)); CScript outer[4]; for (int i = 0; i < 4; i++) { outer[i] = GetScriptForDestination(CScriptID(inner[i])); keystore.AddCScript(inner[i]); } CMutableTransaction txFrom; // Funding transaction: string reason; txFrom.vout.resize(4); for (int i = 0; i < 4; i++) { txFrom.vout[i].scriptPubKey = outer[i]; txFrom.vout[i].nValue = CENT; } BOOST_CHECK(IsStandardTx(txFrom, reason)); CMutableTransaction txTo[4]; // Spending transactions for (int i = 0; i < 4; i++) { txTo[i].vin.resize(1); txTo[i].vout.resize(1); txTo[i].vin[0].prevout.n = i; txTo[i].vin[0].prevout.hash = txFrom.GetHash(); txTo[i].vout[0].nValue = 1*CENT; txTo[i].vout[0].scriptPubKey = inner[i]; #ifdef ENABLE_WALLET BOOST_CHECK_MESSAGE(IsMine(keystore, txFrom.vout[i].scriptPubKey), strprintf("IsMine %d", i)); #endif } for (int i = 0; i < 4; i++) { BOOST_CHECK_MESSAGE(SignSignature(keystore, txFrom, txTo[i], 0), strprintf("SignSignature %d", i)); BOOST_CHECK_MESSAGE(IsStandardTx(txTo[i], reason), strprintf("txTo[%d].IsStandard", i)); } } BOOST_AUTO_TEST_CASE(is) { // Test CScript::IsPayToScriptHash() uint160 dummy; CScript p2sh; p2sh << OP_HASH160 << ToByteVector(dummy) << OP_EQUAL; BOOST_CHECK(p2sh.IsPayToScriptHash()); // Not considered pay-to-script-hash if using one of the OP_PUSHDATA opcodes: static const unsigned char direct[] = { OP_HASH160, 20, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, OP_EQUAL }; BOOST_CHECK(CScript(direct, direct+sizeof(direct)).IsPayToScriptHash()); static const unsigned char pushdata1[] = { OP_HASH160, OP_PUSHDATA1, 20, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, OP_EQUAL }; BOOST_CHECK(!CScript(pushdata1, pushdata1+sizeof(pushdata1)).IsPayToScriptHash()); static const unsigned char pushdata2[] = { OP_HASH160, OP_PUSHDATA2, 20,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, OP_EQUAL }; BOOST_CHECK(!CScript(pushdata2, pushdata2+sizeof(pushdata2)).IsPayToScriptHash()); static const unsigned char pushdata4[] = { OP_HASH160, OP_PUSHDATA4, 20,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, OP_EQUAL }; BOOST_CHECK(!CScript(pushdata4, pushdata4+sizeof(pushdata4)).IsPayToScriptHash()); CScript not_p2sh; BOOST_CHECK(!not_p2sh.IsPayToScriptHash()); not_p2sh.clear(); not_p2sh << OP_HASH160 << ToByteVector(dummy) << ToByteVector(dummy) << OP_EQUAL; BOOST_CHECK(!not_p2sh.IsPayToScriptHash()); not_p2sh.clear(); not_p2sh << OP_NOP << ToByteVector(dummy) << OP_EQUAL; BOOST_CHECK(!not_p2sh.IsPayToScriptHash()); not_p2sh.clear(); not_p2sh << OP_HASH160 << ToByteVector(dummy) << OP_CHECKSIG; BOOST_CHECK(!not_p2sh.IsPayToScriptHash()); } BOOST_AUTO_TEST_CASE(switchover) { // Test switch over code CScript notValid; ScriptError err; notValid << OP_11 << OP_12 << OP_EQUALVERIFY; CScript scriptSig; scriptSig << Serialize(notValid); CScript fund = GetScriptForDestination(CScriptID(notValid)); // Validation should succeed under old rules (hash is correct): BOOST_CHECK(Verify(scriptSig, fund, false, err)); BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err)); // Fail under new: BOOST_CHECK(!Verify(scriptSig, fund, true, err)); BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_EQUALVERIFY, ScriptErrorString(err)); } BOOST_AUTO_TEST_CASE(AreInputsStandard) { LOCK(cs_main); CCoinsView coinsDummy; CCoinsViewCache coins(&coinsDummy); CBasicKeyStore keystore; CKey key[6]; vector<CPubKey> keys; for (int i = 0; i < 6; i++) { key[i].MakeNewKey(true); keystore.AddKey(key[i]); } for (int i = 0; i < 3; i++) keys.push_back(key[i].GetPubKey()); CMutableTransaction txFrom; txFrom.vout.resize(7); // First three are standard: CScript pay1 = GetScriptForDestination(key[0].GetPubKey().GetID()); keystore.AddCScript(pay1); CScript pay1of3 = GetScriptForMultisig(1, keys); txFrom.vout[0].scriptPubKey = GetScriptForDestination(CScriptID(pay1)); // P2SH (OP_CHECKSIG) txFrom.vout[0].nValue = 1000; txFrom.vout[1].scriptPubKey = pay1; // ordinary OP_CHECKSIG txFrom.vout[1].nValue = 2000; txFrom.vout[2].scriptPubKey = pay1of3; // ordinary OP_CHECKMULTISIG txFrom.vout[2].nValue = 3000; // vout[3] is complicated 1-of-3 AND 2-of-3 // ... that is OK if wrapped in P2SH: CScript oneAndTwo; oneAndTwo << OP_1 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << ToByteVector(key[2].GetPubKey()); oneAndTwo << OP_3 << OP_CHECKMULTISIGVERIFY; oneAndTwo << OP_2 << ToByteVector(key[3].GetPubKey()) << ToByteVector(key[4].GetPubKey()) << ToByteVector(key[5].GetPubKey()); oneAndTwo << OP_3 << OP_CHECKMULTISIG; keystore.AddCScript(oneAndTwo); txFrom.vout[3].scriptPubKey = GetScriptForDestination(CScriptID(oneAndTwo)); txFrom.vout[3].nValue = 4000; // vout[4] is max sigops: CScript fifteenSigops; fifteenSigops << OP_1; for (unsigned i = 0; i < MAX_P2SH_SIGOPS; i++) fifteenSigops << ToByteVector(key[i%3].GetPubKey()); fifteenSigops << OP_15 << OP_CHECKMULTISIG; keystore.AddCScript(fifteenSigops); txFrom.vout[4].scriptPubKey = GetScriptForDestination(CScriptID(fifteenSigops)); txFrom.vout[4].nValue = 5000; // vout[5/6] are non-standard because they exceed MAX_P2SH_SIGOPS CScript sixteenSigops; sixteenSigops << OP_16 << OP_CHECKMULTISIG; keystore.AddCScript(sixteenSigops); txFrom.vout[5].scriptPubKey = GetScriptForDestination(CScriptID(fifteenSigops)); txFrom.vout[5].nValue = 5000; CScript twentySigops; twentySigops << OP_CHECKMULTISIG; keystore.AddCScript(twentySigops); txFrom.vout[6].scriptPubKey = GetScriptForDestination(CScriptID(twentySigops)); txFrom.vout[6].nValue = 6000; coins.ModifyCoins(txFrom.GetHash())->FromTx(txFrom, 0); CMutableTransaction txTo; txTo.vout.resize(1); txTo.vout[0].scriptPubKey = GetScriptForDestination(key[1].GetPubKey().GetID()); txTo.vin.resize(5); for (int i = 0; i < 5; i++) { txTo.vin[i].prevout.n = i; txTo.vin[i].prevout.hash = txFrom.GetHash(); } BOOST_CHECK(SignSignature(keystore, txFrom, txTo, 0)); BOOST_CHECK(SignSignature(keystore, txFrom, txTo, 1)); BOOST_CHECK(SignSignature(keystore, txFrom, txTo, 2)); // SignSignature doesn't know how to sign these. We're // not testing validating signatures, so just create // dummy signatures that DO include the correct P2SH scripts: txTo.vin[3].scriptSig << OP_11 << OP_11 << vector<unsigned char>(oneAndTwo.begin(), oneAndTwo.end()); txTo.vin[4].scriptSig << vector<unsigned char>(fifteenSigops.begin(), fifteenSigops.end()); BOOST_CHECK(::AreInputsStandard(txTo, coins)); // 22 P2SH sigops for all inputs (1 for vin[0], 6 for vin[3], 15 for vin[4] BOOST_CHECK_EQUAL(GetP2SHSigOpCount(txTo, coins), 22U); CMutableTransaction txToNonStd1; txToNonStd1.vout.resize(1); txToNonStd1.vout[0].scriptPubKey = GetScriptForDestination(key[1].GetPubKey().GetID()); txToNonStd1.vout[0].nValue = 1000; txToNonStd1.vin.resize(1); txToNonStd1.vin[0].prevout.n = 5; txToNonStd1.vin[0].prevout.hash = txFrom.GetHash(); txToNonStd1.vin[0].scriptSig << vector<unsigned char>(sixteenSigops.begin(), sixteenSigops.end()); BOOST_CHECK(!::AreInputsStandard(txToNonStd1, coins)); BOOST_CHECK_EQUAL(GetP2SHSigOpCount(txToNonStd1, coins), 16U); CMutableTransaction txToNonStd2; txToNonStd2.vout.resize(1); txToNonStd2.vout[0].scriptPubKey = GetScriptForDestination(key[1].GetPubKey().GetID()); txToNonStd2.vout[0].nValue = 1000; txToNonStd2.vin.resize(1); txToNonStd2.vin[0].prevout.n = 6; txToNonStd2.vin[0].prevout.hash = txFrom.GetHash(); txToNonStd2.vin[0].scriptSig << vector<unsigned char>(twentySigops.begin(), twentySigops.end()); BOOST_CHECK(!::AreInputsStandard(txToNonStd2, coins)); BOOST_CHECK_EQUAL(GetP2SHSigOpCount(txToNonStd2, coins), 20U); } BOOST_AUTO_TEST_SUITE_END()
8c2863cc3a18da52c15036852167a85dc65d96a0
ad9df9df768a1f28d3049026e7bdc37ac78f9f2a
/Chilkat/CertChain.h
87f0897fbf22f3a2c787eebb38ef3d13cc42d790
[]
no_license
gencer/Chilkat-for-Universal-Windows-Platform-UWP-VS2015
bd402183f0e275307e25496ba90c93a75f4ced7d
f28778dd5dfc2f78a4515672b96a8c6c6578611e
refs/heads/master
2021-01-12T10:48:35.998727
2017-08-09T15:16:30
2017-08-09T15:16:30
72,678,446
0
0
null
2016-11-02T20:26:53
2016-11-02T20:26:52
null
UTF-8
C++
false
false
1,630
h
// This header is generated for Chilkat v9.5.0 #pragma once class CkCertChainW; #if !defined(CK_SFX_INCLUDED) #define CK_SFX_INCLUDED #endif #include "chilkatClassDecls.h" using namespace Platform; using namespace Windows::Foundation; using namespace concurrency; namespace Chilkat { ref class Cert; ref class TrustedRoots; ref class JsonObject; public ref class CertChain sealed { #include "friendDecls.h" private: CkCertChainW *m_impl; public: virtual ~CertChain(void); CertChain(void); //CertChain(Platform::IntPtr p); //Platform::IntPtr ImplObj(void); // ---------------------- // Properties // ---------------------- property Platform::String ^DebugLogFilePath { Platform::String ^get(); void set(Platform::String ^); } property Platform::String ^LastErrorHtml { Platform::String ^get(); } property Platform::String ^LastErrorText { Platform::String ^get(); } property Platform::String ^LastErrorXml { Platform::String ^get(); } property Boolean LastMethodSuccess { Boolean get(); void set(Boolean); } property int32 NumCerts { int32 get(); } property int32 NumExpiredCerts { int32 get(); } property Boolean ReachesRoot { Boolean get(); } property Boolean VerboseLogging { Boolean get(); void set(Boolean); } property Platform::String ^Version { Platform::String ^get(); } // ---------------------- // Methods // ---------------------- Cert ^GetCert(int index); Boolean IsRootTrusted(Chilkat::TrustedRoots ^trustedRoots); Boolean LoadX5C(Chilkat::JsonObject ^jwk); Boolean VerifyCertSignatures(void); }; }
bd08e4c5548cdbe8be476c79138c67a4ae1527da
a651158743ba286a54816435e25eb62d2f0bc80c
/lab07/People/CAdvancedStudent.h
f6355cfc2d1cb600fb22de8e4386761c586dfe0f
[]
no_license
fedjakova-anastasija/OOP
60c64b641e032bec01a80d9fe8be6ae936fb9232
576800c105bb94dd96cf90139ab4a5495aa1f688
refs/heads/master
2021-05-03T09:20:42.596158
2018-05-30T08:22:32
2018-05-30T08:22:32
120,574,037
0
0
null
null
null
null
UTF-8
C++
false
false
458
h
#pragma once #include "CStudentImpl.h" #include "IAdvancedStudent.h" class CAdvancedStudent : public CStudentImpl<IAdvancedStudent> { public: CAdvancedStudent(const std::string& name, const std::string& surname, const std::string& middleName, const std::string& address, const std::string& universityName, size_t studentTicketNumber, std::string dissertationTopic); std::string GetDissertationTopic() const; private: std::string m_dissertationTopic; };
6d78fc7a48e797728deba732d7a04f2e0abffd8d
55540f3e86f1d5d86ef6b5d295a63518e274efe3
/toolchain/riscv/MSYS/riscv64-unknown-elf/include/c++/10.2.0/bits/stl_function.h
77f8ccb051a2ad430bf0f1bfc78e8a5aae423c26
[ "Apache-2.0" ]
permissive
bouffalolab/bl_iot_sdk
bc5eaf036b70f8c65dd389439062b169f8d09daa
b90664de0bd4c1897a9f1f5d9e360a9631d38b34
refs/heads/master
2023-08-31T03:38:03.369853
2023-08-16T08:50:33
2023-08-18T09:13:27
307,347,250
244
101
Apache-2.0
2023-08-28T06:29:02
2020-10-26T11:16:30
C
UTF-8
C++
false
false
42,293
h
// Functor implementations -*- C++ -*- // Copyright (C) 2001-2020 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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, or (at your option) // any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /* * * Copyright (c) 1994 * Hewlett-Packard Company * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Hewlett-Packard Company makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * * * Copyright (c) 1996-1998 * Silicon Graphics Computer Systems, Inc. * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. Silicon Graphics makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. */ /** @file bits/stl_function.h * This is an internal header file, included by other library headers. * Do not attempt to use it directly. @headername{functional} */ #ifndef _STL_FUNCTION_H #define _STL_FUNCTION_H 1 #if __cplusplus > 201103L #include <bits/move.h> #endif namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION // 20.3.1 base classes /** @defgroup functors Function Objects * @ingroup utilities * * Function objects, or @e functors, are objects with an @c operator() * defined and accessible. They can be passed as arguments to algorithm * templates and used in place of a function pointer. Not only is the * resulting expressiveness of the library increased, but the generated * code can be more efficient than what you might write by hand. When we * refer to @a functors, then, generally we include function pointers in * the description as well. * * Often, functors are only created as temporaries passed to algorithm * calls, rather than being created as named variables. * * Two examples taken from the standard itself follow. To perform a * by-element addition of two vectors @c a and @c b containing @c double, * and put the result in @c a, use * \code * transform (a.begin(), a.end(), b.begin(), a.begin(), plus<double>()); * \endcode * To negate every element in @c a, use * \code * transform(a.begin(), a.end(), a.begin(), negate<double>()); * \endcode * The addition and negation functions will be inlined directly. * * The standard functors are derived from structs named @c unary_function * and @c binary_function. These two classes contain nothing but typedefs, * to aid in generic (template) programming. If you write your own * functors, you might consider doing the same. * * @{ */ /** * This is one of the @link functors functor base classes@endlink. */ template<typename _Arg, typename _Result> struct unary_function { /// @c argument_type is the type of the argument typedef _Arg argument_type; /// @c result_type is the return type typedef _Result result_type; }; /** * This is one of the @link functors functor base classes@endlink. */ template<typename _Arg1, typename _Arg2, typename _Result> struct binary_function { /// @c first_argument_type is the type of the first argument typedef _Arg1 first_argument_type; /// @c second_argument_type is the type of the second argument typedef _Arg2 second_argument_type; /// @c result_type is the return type typedef _Result result_type; }; /** @} */ // 20.3.2 arithmetic /** @defgroup arithmetic_functors Arithmetic Classes * @ingroup functors * * Because basic math often needs to be done during an algorithm, * the library provides functors for those operations. See the * documentation for @link functors the base classes@endlink * for examples of their use. * * @{ */ #if __cplusplus > 201103L struct __is_transparent; // undefined template<typename _Tp = void> struct plus; template<typename _Tp = void> struct minus; template<typename _Tp = void> struct multiplies; template<typename _Tp = void> struct divides; template<typename _Tp = void> struct modulus; template<typename _Tp = void> struct negate; #endif /// One of the @link arithmetic_functors math functors@endlink. template<typename _Tp> struct plus : public binary_function<_Tp, _Tp, _Tp> { _GLIBCXX14_CONSTEXPR _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x + __y; } }; /// One of the @link arithmetic_functors math functors@endlink. template<typename _Tp> struct minus : public binary_function<_Tp, _Tp, _Tp> { _GLIBCXX14_CONSTEXPR _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x - __y; } }; /// One of the @link arithmetic_functors math functors@endlink. template<typename _Tp> struct multiplies : public binary_function<_Tp, _Tp, _Tp> { _GLIBCXX14_CONSTEXPR _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x * __y; } }; /// One of the @link arithmetic_functors math functors@endlink. template<typename _Tp> struct divides : public binary_function<_Tp, _Tp, _Tp> { _GLIBCXX14_CONSTEXPR _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x / __y; } }; /// One of the @link arithmetic_functors math functors@endlink. template<typename _Tp> struct modulus : public binary_function<_Tp, _Tp, _Tp> { _GLIBCXX14_CONSTEXPR _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x % __y; } }; /// One of the @link arithmetic_functors math functors@endlink. template<typename _Tp> struct negate : public unary_function<_Tp, _Tp> { _GLIBCXX14_CONSTEXPR _Tp operator()(const _Tp& __x) const { return -__x; } }; #if __cplusplus > 201103L #define __cpp_lib_transparent_operators 201510 template<> struct plus<void> { template <typename _Tp, typename _Up> _GLIBCXX14_CONSTEXPR auto operator()(_Tp&& __t, _Up&& __u) const noexcept(noexcept(std::forward<_Tp>(__t) + std::forward<_Up>(__u))) -> decltype(std::forward<_Tp>(__t) + std::forward<_Up>(__u)) { return std::forward<_Tp>(__t) + std::forward<_Up>(__u); } typedef __is_transparent is_transparent; }; /// One of the @link arithmetic_functors math functors@endlink. template<> struct minus<void> { template <typename _Tp, typename _Up> _GLIBCXX14_CONSTEXPR auto operator()(_Tp&& __t, _Up&& __u) const noexcept(noexcept(std::forward<_Tp>(__t) - std::forward<_Up>(__u))) -> decltype(std::forward<_Tp>(__t) - std::forward<_Up>(__u)) { return std::forward<_Tp>(__t) - std::forward<_Up>(__u); } typedef __is_transparent is_transparent; }; /// One of the @link arithmetic_functors math functors@endlink. template<> struct multiplies<void> { template <typename _Tp, typename _Up> _GLIBCXX14_CONSTEXPR auto operator()(_Tp&& __t, _Up&& __u) const noexcept(noexcept(std::forward<_Tp>(__t) * std::forward<_Up>(__u))) -> decltype(std::forward<_Tp>(__t) * std::forward<_Up>(__u)) { return std::forward<_Tp>(__t) * std::forward<_Up>(__u); } typedef __is_transparent is_transparent; }; /// One of the @link arithmetic_functors math functors@endlink. template<> struct divides<void> { template <typename _Tp, typename _Up> _GLIBCXX14_CONSTEXPR auto operator()(_Tp&& __t, _Up&& __u) const noexcept(noexcept(std::forward<_Tp>(__t) / std::forward<_Up>(__u))) -> decltype(std::forward<_Tp>(__t) / std::forward<_Up>(__u)) { return std::forward<_Tp>(__t) / std::forward<_Up>(__u); } typedef __is_transparent is_transparent; }; /// One of the @link arithmetic_functors math functors@endlink. template<> struct modulus<void> { template <typename _Tp, typename _Up> _GLIBCXX14_CONSTEXPR auto operator()(_Tp&& __t, _Up&& __u) const noexcept(noexcept(std::forward<_Tp>(__t) % std::forward<_Up>(__u))) -> decltype(std::forward<_Tp>(__t) % std::forward<_Up>(__u)) { return std::forward<_Tp>(__t) % std::forward<_Up>(__u); } typedef __is_transparent is_transparent; }; /// One of the @link arithmetic_functors math functors@endlink. template<> struct negate<void> { template <typename _Tp> _GLIBCXX14_CONSTEXPR auto operator()(_Tp&& __t) const noexcept(noexcept(-std::forward<_Tp>(__t))) -> decltype(-std::forward<_Tp>(__t)) { return -std::forward<_Tp>(__t); } typedef __is_transparent is_transparent; }; #endif /** @} */ // 20.3.3 comparisons /** @defgroup comparison_functors Comparison Classes * @ingroup functors * * The library provides six wrapper functors for all the basic comparisons * in C++, like @c <. * * @{ */ #if __cplusplus > 201103L template<typename _Tp = void> struct equal_to; template<typename _Tp = void> struct not_equal_to; template<typename _Tp = void> struct greater; template<typename _Tp = void> struct less; template<typename _Tp = void> struct greater_equal; template<typename _Tp = void> struct less_equal; #endif /// One of the @link comparison_functors comparison functors@endlink. template<typename _Tp> struct equal_to : public binary_function<_Tp, _Tp, bool> { _GLIBCXX14_CONSTEXPR bool operator()(const _Tp& __x, const _Tp& __y) const { return __x == __y; } }; /// One of the @link comparison_functors comparison functors@endlink. template<typename _Tp> struct not_equal_to : public binary_function<_Tp, _Tp, bool> { _GLIBCXX14_CONSTEXPR bool operator()(const _Tp& __x, const _Tp& __y) const { return __x != __y; } }; /// One of the @link comparison_functors comparison functors@endlink. template<typename _Tp> struct greater : public binary_function<_Tp, _Tp, bool> { _GLIBCXX14_CONSTEXPR bool operator()(const _Tp& __x, const _Tp& __y) const { return __x > __y; } }; /// One of the @link comparison_functors comparison functors@endlink. template<typename _Tp> struct less : public binary_function<_Tp, _Tp, bool> { _GLIBCXX14_CONSTEXPR bool operator()(const _Tp& __x, const _Tp& __y) const { return __x < __y; } }; /// One of the @link comparison_functors comparison functors@endlink. template<typename _Tp> struct greater_equal : public binary_function<_Tp, _Tp, bool> { _GLIBCXX14_CONSTEXPR bool operator()(const _Tp& __x, const _Tp& __y) const { return __x >= __y; } }; /// One of the @link comparison_functors comparison functors@endlink. template<typename _Tp> struct less_equal : public binary_function<_Tp, _Tp, bool> { _GLIBCXX14_CONSTEXPR bool operator()(const _Tp& __x, const _Tp& __y) const { return __x <= __y; } }; // Partial specialization of std::greater for pointers. template<typename _Tp> struct greater<_Tp*> : public binary_function<_Tp*, _Tp*, bool> { _GLIBCXX14_CONSTEXPR bool operator()(_Tp* __x, _Tp* __y) const _GLIBCXX_NOTHROW { #if __cplusplus >= 201402L #ifdef _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED if (__builtin_is_constant_evaluated()) #else if (__builtin_constant_p(__x > __y)) #endif return __x > __y; #endif return (__UINTPTR_TYPE__)__x > (__UINTPTR_TYPE__)__y; } }; // Partial specialization of std::less for pointers. template<typename _Tp> struct less<_Tp*> : public binary_function<_Tp*, _Tp*, bool> { _GLIBCXX14_CONSTEXPR bool operator()(_Tp* __x, _Tp* __y) const _GLIBCXX_NOTHROW { #if __cplusplus >= 201402L #ifdef _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED if (__builtin_is_constant_evaluated()) #else if (__builtin_constant_p(__x < __y)) #endif return __x < __y; #endif return (__UINTPTR_TYPE__)__x < (__UINTPTR_TYPE__)__y; } }; // Partial specialization of std::greater_equal for pointers. template<typename _Tp> struct greater_equal<_Tp*> : public binary_function<_Tp*, _Tp*, bool> { _GLIBCXX14_CONSTEXPR bool operator()(_Tp* __x, _Tp* __y) const _GLIBCXX_NOTHROW { #if __cplusplus >= 201402L #ifdef _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED if (__builtin_is_constant_evaluated()) #else if (__builtin_constant_p(__x >= __y)) #endif return __x >= __y; #endif return (__UINTPTR_TYPE__)__x >= (__UINTPTR_TYPE__)__y; } }; // Partial specialization of std::less_equal for pointers. template<typename _Tp> struct less_equal<_Tp*> : public binary_function<_Tp*, _Tp*, bool> { _GLIBCXX14_CONSTEXPR bool operator()(_Tp* __x, _Tp* __y) const _GLIBCXX_NOTHROW { #if __cplusplus >= 201402L #ifdef _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED if (__builtin_is_constant_evaluated()) #else if (__builtin_constant_p(__x <= __y)) #endif return __x <= __y; #endif return (__UINTPTR_TYPE__)__x <= (__UINTPTR_TYPE__)__y; } }; #if __cplusplus >= 201402L /// One of the @link comparison_functors comparison functors@endlink. template<> struct equal_to<void> { template <typename _Tp, typename _Up> constexpr auto operator()(_Tp&& __t, _Up&& __u) const noexcept(noexcept(std::forward<_Tp>(__t) == std::forward<_Up>(__u))) -> decltype(std::forward<_Tp>(__t) == std::forward<_Up>(__u)) { return std::forward<_Tp>(__t) == std::forward<_Up>(__u); } typedef __is_transparent is_transparent; }; /// One of the @link comparison_functors comparison functors@endlink. template<> struct not_equal_to<void> { template <typename _Tp, typename _Up> constexpr auto operator()(_Tp&& __t, _Up&& __u) const noexcept(noexcept(std::forward<_Tp>(__t) != std::forward<_Up>(__u))) -> decltype(std::forward<_Tp>(__t) != std::forward<_Up>(__u)) { return std::forward<_Tp>(__t) != std::forward<_Up>(__u); } typedef __is_transparent is_transparent; }; /// One of the @link comparison_functors comparison functors@endlink. template<> struct greater<void> { template <typename _Tp, typename _Up> constexpr auto operator()(_Tp&& __t, _Up&& __u) const noexcept(noexcept(std::forward<_Tp>(__t) > std::forward<_Up>(__u))) -> decltype(std::forward<_Tp>(__t) > std::forward<_Up>(__u)) { return _S_cmp(std::forward<_Tp>(__t), std::forward<_Up>(__u), __ptr_cmp<_Tp, _Up>{}); } template<typename _Tp, typename _Up> constexpr bool operator()(_Tp* __t, _Up* __u) const noexcept { return greater<common_type_t<_Tp*, _Up*>>{}(__t, __u); } typedef __is_transparent is_transparent; private: template <typename _Tp, typename _Up> static constexpr decltype(auto) _S_cmp(_Tp&& __t, _Up&& __u, false_type) { return std::forward<_Tp>(__t) > std::forward<_Up>(__u); } template <typename _Tp, typename _Up> static constexpr bool _S_cmp(_Tp&& __t, _Up&& __u, true_type) noexcept { return greater<const volatile void*>{}( static_cast<const volatile void*>(std::forward<_Tp>(__t)), static_cast<const volatile void*>(std::forward<_Up>(__u))); } // True if there is no viable operator> member function. template<typename _Tp, typename _Up, typename = void> struct __not_overloaded2 : true_type { }; // False if we can call T.operator>(U) template<typename _Tp, typename _Up> struct __not_overloaded2<_Tp, _Up, __void_t< decltype(std::declval<_Tp>().operator>(std::declval<_Up>()))>> : false_type { }; // True if there is no overloaded operator> for these operands. template<typename _Tp, typename _Up, typename = void> struct __not_overloaded : __not_overloaded2<_Tp, _Up> { }; // False if we can call operator>(T,U) template<typename _Tp, typename _Up> struct __not_overloaded<_Tp, _Up, __void_t< decltype(operator>(std::declval<_Tp>(), std::declval<_Up>()))>> : false_type { }; template<typename _Tp, typename _Up> using __ptr_cmp = __and_<__not_overloaded<_Tp, _Up>, is_convertible<_Tp, const volatile void*>, is_convertible<_Up, const volatile void*>>; }; /// One of the @link comparison_functors comparison functors@endlink. template<> struct less<void> { template <typename _Tp, typename _Up> constexpr auto operator()(_Tp&& __t, _Up&& __u) const noexcept(noexcept(std::forward<_Tp>(__t) < std::forward<_Up>(__u))) -> decltype(std::forward<_Tp>(__t) < std::forward<_Up>(__u)) { return _S_cmp(std::forward<_Tp>(__t), std::forward<_Up>(__u), __ptr_cmp<_Tp, _Up>{}); } template<typename _Tp, typename _Up> constexpr bool operator()(_Tp* __t, _Up* __u) const noexcept { return less<common_type_t<_Tp*, _Up*>>{}(__t, __u); } typedef __is_transparent is_transparent; private: template <typename _Tp, typename _Up> static constexpr decltype(auto) _S_cmp(_Tp&& __t, _Up&& __u, false_type) { return std::forward<_Tp>(__t) < std::forward<_Up>(__u); } template <typename _Tp, typename _Up> static constexpr bool _S_cmp(_Tp&& __t, _Up&& __u, true_type) noexcept { return less<const volatile void*>{}( static_cast<const volatile void*>(std::forward<_Tp>(__t)), static_cast<const volatile void*>(std::forward<_Up>(__u))); } // True if there is no viable operator< member function. template<typename _Tp, typename _Up, typename = void> struct __not_overloaded2 : true_type { }; // False if we can call T.operator<(U) template<typename _Tp, typename _Up> struct __not_overloaded2<_Tp, _Up, __void_t< decltype(std::declval<_Tp>().operator<(std::declval<_Up>()))>> : false_type { }; // True if there is no overloaded operator< for these operands. template<typename _Tp, typename _Up, typename = void> struct __not_overloaded : __not_overloaded2<_Tp, _Up> { }; // False if we can call operator<(T,U) template<typename _Tp, typename _Up> struct __not_overloaded<_Tp, _Up, __void_t< decltype(operator<(std::declval<_Tp>(), std::declval<_Up>()))>> : false_type { }; template<typename _Tp, typename _Up> using __ptr_cmp = __and_<__not_overloaded<_Tp, _Up>, is_convertible<_Tp, const volatile void*>, is_convertible<_Up, const volatile void*>>; }; /// One of the @link comparison_functors comparison functors@endlink. template<> struct greater_equal<void> { template <typename _Tp, typename _Up> constexpr auto operator()(_Tp&& __t, _Up&& __u) const noexcept(noexcept(std::forward<_Tp>(__t) >= std::forward<_Up>(__u))) -> decltype(std::forward<_Tp>(__t) >= std::forward<_Up>(__u)) { return _S_cmp(std::forward<_Tp>(__t), std::forward<_Up>(__u), __ptr_cmp<_Tp, _Up>{}); } template<typename _Tp, typename _Up> constexpr bool operator()(_Tp* __t, _Up* __u) const noexcept { return greater_equal<common_type_t<_Tp*, _Up*>>{}(__t, __u); } typedef __is_transparent is_transparent; private: template <typename _Tp, typename _Up> static constexpr decltype(auto) _S_cmp(_Tp&& __t, _Up&& __u, false_type) { return std::forward<_Tp>(__t) >= std::forward<_Up>(__u); } template <typename _Tp, typename _Up> static constexpr bool _S_cmp(_Tp&& __t, _Up&& __u, true_type) noexcept { return greater_equal<const volatile void*>{}( static_cast<const volatile void*>(std::forward<_Tp>(__t)), static_cast<const volatile void*>(std::forward<_Up>(__u))); } // True if there is no viable operator>= member function. template<typename _Tp, typename _Up, typename = void> struct __not_overloaded2 : true_type { }; // False if we can call T.operator>=(U) template<typename _Tp, typename _Up> struct __not_overloaded2<_Tp, _Up, __void_t< decltype(std::declval<_Tp>().operator>=(std::declval<_Up>()))>> : false_type { }; // True if there is no overloaded operator>= for these operands. template<typename _Tp, typename _Up, typename = void> struct __not_overloaded : __not_overloaded2<_Tp, _Up> { }; // False if we can call operator>=(T,U) template<typename _Tp, typename _Up> struct __not_overloaded<_Tp, _Up, __void_t< decltype(operator>=(std::declval<_Tp>(), std::declval<_Up>()))>> : false_type { }; template<typename _Tp, typename _Up> using __ptr_cmp = __and_<__not_overloaded<_Tp, _Up>, is_convertible<_Tp, const volatile void*>, is_convertible<_Up, const volatile void*>>; }; /// One of the @link comparison_functors comparison functors@endlink. template<> struct less_equal<void> { template <typename _Tp, typename _Up> constexpr auto operator()(_Tp&& __t, _Up&& __u) const noexcept(noexcept(std::forward<_Tp>(__t) <= std::forward<_Up>(__u))) -> decltype(std::forward<_Tp>(__t) <= std::forward<_Up>(__u)) { return _S_cmp(std::forward<_Tp>(__t), std::forward<_Up>(__u), __ptr_cmp<_Tp, _Up>{}); } template<typename _Tp, typename _Up> constexpr bool operator()(_Tp* __t, _Up* __u) const noexcept { return less_equal<common_type_t<_Tp*, _Up*>>{}(__t, __u); } typedef __is_transparent is_transparent; private: template <typename _Tp, typename _Up> static constexpr decltype(auto) _S_cmp(_Tp&& __t, _Up&& __u, false_type) { return std::forward<_Tp>(__t) <= std::forward<_Up>(__u); } template <typename _Tp, typename _Up> static constexpr bool _S_cmp(_Tp&& __t, _Up&& __u, true_type) noexcept { return less_equal<const volatile void*>{}( static_cast<const volatile void*>(std::forward<_Tp>(__t)), static_cast<const volatile void*>(std::forward<_Up>(__u))); } // True if there is no viable operator<= member function. template<typename _Tp, typename _Up, typename = void> struct __not_overloaded2 : true_type { }; // False if we can call T.operator<=(U) template<typename _Tp, typename _Up> struct __not_overloaded2<_Tp, _Up, __void_t< decltype(std::declval<_Tp>().operator<=(std::declval<_Up>()))>> : false_type { }; // True if there is no overloaded operator<= for these operands. template<typename _Tp, typename _Up, typename = void> struct __not_overloaded : __not_overloaded2<_Tp, _Up> { }; // False if we can call operator<=(T,U) template<typename _Tp, typename _Up> struct __not_overloaded<_Tp, _Up, __void_t< decltype(operator<=(std::declval<_Tp>(), std::declval<_Up>()))>> : false_type { }; template<typename _Tp, typename _Up> using __ptr_cmp = __and_<__not_overloaded<_Tp, _Up>, is_convertible<_Tp, const volatile void*>, is_convertible<_Up, const volatile void*>>; }; #endif // C++14 /** @} */ // 20.3.4 logical operations /** @defgroup logical_functors Boolean Operations Classes * @ingroup functors * * Here are wrapper functors for Boolean operations: @c &&, @c ||, * and @c !. * * @{ */ #if __cplusplus > 201103L template<typename _Tp = void> struct logical_and; template<typename _Tp = void> struct logical_or; template<typename _Tp = void> struct logical_not; #endif /// One of the @link logical_functors Boolean operations functors@endlink. template<typename _Tp> struct logical_and : public binary_function<_Tp, _Tp, bool> { _GLIBCXX14_CONSTEXPR bool operator()(const _Tp& __x, const _Tp& __y) const { return __x && __y; } }; /// One of the @link logical_functors Boolean operations functors@endlink. template<typename _Tp> struct logical_or : public binary_function<_Tp, _Tp, bool> { _GLIBCXX14_CONSTEXPR bool operator()(const _Tp& __x, const _Tp& __y) const { return __x || __y; } }; /// One of the @link logical_functors Boolean operations functors@endlink. template<typename _Tp> struct logical_not : public unary_function<_Tp, bool> { _GLIBCXX14_CONSTEXPR bool operator()(const _Tp& __x) const { return !__x; } }; #if __cplusplus > 201103L /// One of the @link logical_functors Boolean operations functors@endlink. template<> struct logical_and<void> { template <typename _Tp, typename _Up> _GLIBCXX14_CONSTEXPR auto operator()(_Tp&& __t, _Up&& __u) const noexcept(noexcept(std::forward<_Tp>(__t) && std::forward<_Up>(__u))) -> decltype(std::forward<_Tp>(__t) && std::forward<_Up>(__u)) { return std::forward<_Tp>(__t) && std::forward<_Up>(__u); } typedef __is_transparent is_transparent; }; /// One of the @link logical_functors Boolean operations functors@endlink. template<> struct logical_or<void> { template <typename _Tp, typename _Up> _GLIBCXX14_CONSTEXPR auto operator()(_Tp&& __t, _Up&& __u) const noexcept(noexcept(std::forward<_Tp>(__t) || std::forward<_Up>(__u))) -> decltype(std::forward<_Tp>(__t) || std::forward<_Up>(__u)) { return std::forward<_Tp>(__t) || std::forward<_Up>(__u); } typedef __is_transparent is_transparent; }; /// One of the @link logical_functors Boolean operations functors@endlink. template<> struct logical_not<void> { template <typename _Tp> _GLIBCXX14_CONSTEXPR auto operator()(_Tp&& __t) const noexcept(noexcept(!std::forward<_Tp>(__t))) -> decltype(!std::forward<_Tp>(__t)) { return !std::forward<_Tp>(__t); } typedef __is_transparent is_transparent; }; #endif /** @} */ #if __cplusplus > 201103L template<typename _Tp = void> struct bit_and; template<typename _Tp = void> struct bit_or; template<typename _Tp = void> struct bit_xor; template<typename _Tp = void> struct bit_not; #endif // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 660. Missing Bitwise Operations. template<typename _Tp> struct bit_and : public binary_function<_Tp, _Tp, _Tp> { _GLIBCXX14_CONSTEXPR _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x & __y; } }; template<typename _Tp> struct bit_or : public binary_function<_Tp, _Tp, _Tp> { _GLIBCXX14_CONSTEXPR _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x | __y; } }; template<typename _Tp> struct bit_xor : public binary_function<_Tp, _Tp, _Tp> { _GLIBCXX14_CONSTEXPR _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x ^ __y; } }; template<typename _Tp> struct bit_not : public unary_function<_Tp, _Tp> { _GLIBCXX14_CONSTEXPR _Tp operator()(const _Tp& __x) const { return ~__x; } }; #if __cplusplus > 201103L template <> struct bit_and<void> { template <typename _Tp, typename _Up> _GLIBCXX14_CONSTEXPR auto operator()(_Tp&& __t, _Up&& __u) const noexcept(noexcept(std::forward<_Tp>(__t) & std::forward<_Up>(__u))) -> decltype(std::forward<_Tp>(__t) & std::forward<_Up>(__u)) { return std::forward<_Tp>(__t) & std::forward<_Up>(__u); } typedef __is_transparent is_transparent; }; template <> struct bit_or<void> { template <typename _Tp, typename _Up> _GLIBCXX14_CONSTEXPR auto operator()(_Tp&& __t, _Up&& __u) const noexcept(noexcept(std::forward<_Tp>(__t) | std::forward<_Up>(__u))) -> decltype(std::forward<_Tp>(__t) | std::forward<_Up>(__u)) { return std::forward<_Tp>(__t) | std::forward<_Up>(__u); } typedef __is_transparent is_transparent; }; template <> struct bit_xor<void> { template <typename _Tp, typename _Up> _GLIBCXX14_CONSTEXPR auto operator()(_Tp&& __t, _Up&& __u) const noexcept(noexcept(std::forward<_Tp>(__t) ^ std::forward<_Up>(__u))) -> decltype(std::forward<_Tp>(__t) ^ std::forward<_Up>(__u)) { return std::forward<_Tp>(__t) ^ std::forward<_Up>(__u); } typedef __is_transparent is_transparent; }; template <> struct bit_not<void> { template <typename _Tp> _GLIBCXX14_CONSTEXPR auto operator()(_Tp&& __t) const noexcept(noexcept(~std::forward<_Tp>(__t))) -> decltype(~std::forward<_Tp>(__t)) { return ~std::forward<_Tp>(__t); } typedef __is_transparent is_transparent; }; #endif // 20.3.5 negators /** @defgroup negators Negators * @ingroup functors * * The functions @c not1 and @c not2 each take a predicate functor * and return an instance of @c unary_negate or * @c binary_negate, respectively. These classes are functors whose * @c operator() performs the stored predicate function and then returns * the negation of the result. * * For example, given a vector of integers and a trivial predicate, * \code * struct IntGreaterThanThree * : public std::unary_function<int, bool> * { * bool operator() (int x) { return x > 3; } * }; * * std::find_if (v.begin(), v.end(), not1(IntGreaterThanThree())); * \endcode * The call to @c find_if will locate the first index (i) of @c v for which * <code>!(v[i] > 3)</code> is true. * * The not1/unary_negate combination works on predicates taking a single * argument. The not2/binary_negate combination works on predicates which * take two arguments. * * @{ */ /// One of the @link negators negation functors@endlink. template<typename _Predicate> class unary_negate : public unary_function<typename _Predicate::argument_type, bool> { protected: _Predicate _M_pred; public: _GLIBCXX14_CONSTEXPR explicit unary_negate(const _Predicate& __x) : _M_pred(__x) { } _GLIBCXX14_CONSTEXPR bool operator()(const typename _Predicate::argument_type& __x) const { return !_M_pred(__x); } }; /// One of the @link negators negation functors@endlink. template<typename _Predicate> _GLIBCXX14_CONSTEXPR inline unary_negate<_Predicate> not1(const _Predicate& __pred) { return unary_negate<_Predicate>(__pred); } /// One of the @link negators negation functors@endlink. template<typename _Predicate> class binary_negate : public binary_function<typename _Predicate::first_argument_type, typename _Predicate::second_argument_type, bool> { protected: _Predicate _M_pred; public: _GLIBCXX14_CONSTEXPR explicit binary_negate(const _Predicate& __x) : _M_pred(__x) { } _GLIBCXX14_CONSTEXPR bool operator()(const typename _Predicate::first_argument_type& __x, const typename _Predicate::second_argument_type& __y) const { return !_M_pred(__x, __y); } }; /// One of the @link negators negation functors@endlink. template<typename _Predicate> _GLIBCXX14_CONSTEXPR inline binary_negate<_Predicate> not2(const _Predicate& __pred) { return binary_negate<_Predicate>(__pred); } /** @} */ // 20.3.7 adaptors pointers functions /** @defgroup pointer_adaptors Adaptors for pointers to functions * @ingroup functors * * The advantage of function objects over pointers to functions is that * the objects in the standard library declare nested typedefs describing * their argument and result types with uniform names (e.g., @c result_type * from the base classes @c unary_function and @c binary_function). * Sometimes those typedefs are required, not just optional. * * Adaptors are provided to turn pointers to unary (single-argument) and * binary (double-argument) functions into function objects. The * long-winded functor @c pointer_to_unary_function is constructed with a * function pointer @c f, and its @c operator() called with argument @c x * returns @c f(x). The functor @c pointer_to_binary_function does the same * thing, but with a double-argument @c f and @c operator(). * * The function @c ptr_fun takes a pointer-to-function @c f and constructs * an instance of the appropriate functor. * * @{ */ /// One of the @link pointer_adaptors adaptors for function pointers@endlink. template<typename _Arg, typename _Result> class pointer_to_unary_function : public unary_function<_Arg, _Result> { protected: _Result (*_M_ptr)(_Arg); public: pointer_to_unary_function() { } explicit pointer_to_unary_function(_Result (*__x)(_Arg)) : _M_ptr(__x) { } _Result operator()(_Arg __x) const { return _M_ptr(__x); } }; /// One of the @link pointer_adaptors adaptors for function pointers@endlink. template<typename _Arg, typename _Result> inline pointer_to_unary_function<_Arg, _Result> ptr_fun(_Result (*__x)(_Arg)) { return pointer_to_unary_function<_Arg, _Result>(__x); } /// One of the @link pointer_adaptors adaptors for function pointers@endlink. template<typename _Arg1, typename _Arg2, typename _Result> class pointer_to_binary_function : public binary_function<_Arg1, _Arg2, _Result> { protected: _Result (*_M_ptr)(_Arg1, _Arg2); public: pointer_to_binary_function() { } explicit pointer_to_binary_function(_Result (*__x)(_Arg1, _Arg2)) : _M_ptr(__x) { } _Result operator()(_Arg1 __x, _Arg2 __y) const { return _M_ptr(__x, __y); } }; /// One of the @link pointer_adaptors adaptors for function pointers@endlink. template<typename _Arg1, typename _Arg2, typename _Result> inline pointer_to_binary_function<_Arg1, _Arg2, _Result> ptr_fun(_Result (*__x)(_Arg1, _Arg2)) { return pointer_to_binary_function<_Arg1, _Arg2, _Result>(__x); } /** @} */ template<typename _Tp> struct _Identity : public unary_function<_Tp, _Tp> { _Tp& operator()(_Tp& __x) const { return __x; } const _Tp& operator()(const _Tp& __x) const { return __x; } }; // Partial specialization, avoids confusing errors in e.g. std::set<const T>. template<typename _Tp> struct _Identity<const _Tp> : _Identity<_Tp> { }; template<typename _Pair> struct _Select1st : public unary_function<_Pair, typename _Pair::first_type> { typename _Pair::first_type& operator()(_Pair& __x) const { return __x.first; } const typename _Pair::first_type& operator()(const _Pair& __x) const { return __x.first; } #if __cplusplus >= 201103L template<typename _Pair2> typename _Pair2::first_type& operator()(_Pair2& __x) const { return __x.first; } template<typename _Pair2> const typename _Pair2::first_type& operator()(const _Pair2& __x) const { return __x.first; } #endif }; template<typename _Pair> struct _Select2nd : public unary_function<_Pair, typename _Pair::second_type> { typename _Pair::second_type& operator()(_Pair& __x) const { return __x.second; } const typename _Pair::second_type& operator()(const _Pair& __x) const { return __x.second; } }; // 20.3.8 adaptors pointers members /** @defgroup memory_adaptors Adaptors for pointers to members * @ingroup functors * * There are a total of 8 = 2^3 function objects in this family. * (1) Member functions taking no arguments vs member functions taking * one argument. * (2) Call through pointer vs call through reference. * (3) Const vs non-const member function. * * All of this complexity is in the function objects themselves. You can * ignore it by using the helper function mem_fun and mem_fun_ref, * which create whichever type of adaptor is appropriate. * * @{ */ /// One of the @link memory_adaptors adaptors for member /// pointers@endlink. template<typename _Ret, typename _Tp> class mem_fun_t : public unary_function<_Tp*, _Ret> { public: explicit mem_fun_t(_Ret (_Tp::*__pf)()) : _M_f(__pf) { } _Ret operator()(_Tp* __p) const { return (__p->*_M_f)(); } private: _Ret (_Tp::*_M_f)(); }; /// One of the @link memory_adaptors adaptors for member /// pointers@endlink. template<typename _Ret, typename _Tp> class const_mem_fun_t : public unary_function<const _Tp*, _Ret> { public: explicit const_mem_fun_t(_Ret (_Tp::*__pf)() const) : _M_f(__pf) { } _Ret operator()(const _Tp* __p) const { return (__p->*_M_f)(); } private: _Ret (_Tp::*_M_f)() const; }; /// One of the @link memory_adaptors adaptors for member /// pointers@endlink. template<typename _Ret, typename _Tp> class mem_fun_ref_t : public unary_function<_Tp, _Ret> { public: explicit mem_fun_ref_t(_Ret (_Tp::*__pf)()) : _M_f(__pf) { } _Ret operator()(_Tp& __r) const { return (__r.*_M_f)(); } private: _Ret (_Tp::*_M_f)(); }; /// One of the @link memory_adaptors adaptors for member /// pointers@endlink. template<typename _Ret, typename _Tp> class const_mem_fun_ref_t : public unary_function<_Tp, _Ret> { public: explicit const_mem_fun_ref_t(_Ret (_Tp::*__pf)() const) : _M_f(__pf) { } _Ret operator()(const _Tp& __r) const { return (__r.*_M_f)(); } private: _Ret (_Tp::*_M_f)() const; }; /// One of the @link memory_adaptors adaptors for member /// pointers@endlink. template<typename _Ret, typename _Tp, typename _Arg> class mem_fun1_t : public binary_function<_Tp*, _Arg, _Ret> { public: explicit mem_fun1_t(_Ret (_Tp::*__pf)(_Arg)) : _M_f(__pf) { } _Ret operator()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); } private: _Ret (_Tp::*_M_f)(_Arg); }; /// One of the @link memory_adaptors adaptors for member /// pointers@endlink. template<typename _Ret, typename _Tp, typename _Arg> class const_mem_fun1_t : public binary_function<const _Tp*, _Arg, _Ret> { public: explicit const_mem_fun1_t(_Ret (_Tp::*__pf)(_Arg) const) : _M_f(__pf) { } _Ret operator()(const _Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); } private: _Ret (_Tp::*_M_f)(_Arg) const; }; /// One of the @link memory_adaptors adaptors for member /// pointers@endlink. template<typename _Ret, typename _Tp, typename _Arg> class mem_fun1_ref_t : public binary_function<_Tp, _Arg, _Ret> { public: explicit mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg)) : _M_f(__pf) { } _Ret operator()(_Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); } private: _Ret (_Tp::*_M_f)(_Arg); }; /// One of the @link memory_adaptors adaptors for member /// pointers@endlink. template<typename _Ret, typename _Tp, typename _Arg> class const_mem_fun1_ref_t : public binary_function<_Tp, _Arg, _Ret> { public: explicit const_mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg) const) : _M_f(__pf) { } _Ret operator()(const _Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); } private: _Ret (_Tp::*_M_f)(_Arg) const; }; // Mem_fun adaptor helper functions. There are only two: // mem_fun and mem_fun_ref. template<typename _Ret, typename _Tp> inline mem_fun_t<_Ret, _Tp> mem_fun(_Ret (_Tp::*__f)()) { return mem_fun_t<_Ret, _Tp>(__f); } template<typename _Ret, typename _Tp> inline const_mem_fun_t<_Ret, _Tp> mem_fun(_Ret (_Tp::*__f)() const) { return const_mem_fun_t<_Ret, _Tp>(__f); } template<typename _Ret, typename _Tp> inline mem_fun_ref_t<_Ret, _Tp> mem_fun_ref(_Ret (_Tp::*__f)()) { return mem_fun_ref_t<_Ret, _Tp>(__f); } template<typename _Ret, typename _Tp> inline const_mem_fun_ref_t<_Ret, _Tp> mem_fun_ref(_Ret (_Tp::*__f)() const) { return const_mem_fun_ref_t<_Ret, _Tp>(__f); } template<typename _Ret, typename _Tp, typename _Arg> inline mem_fun1_t<_Ret, _Tp, _Arg> mem_fun(_Ret (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Ret, _Tp, _Arg>(__f); } template<typename _Ret, typename _Tp, typename _Arg> inline const_mem_fun1_t<_Ret, _Tp, _Arg> mem_fun(_Ret (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); } template<typename _Ret, typename _Tp, typename _Arg> inline mem_fun1_ref_t<_Ret, _Tp, _Arg> mem_fun_ref(_Ret (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); } template<typename _Ret, typename _Tp, typename _Arg> inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg> mem_fun_ref(_Ret (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); } /** @} */ _GLIBCXX_END_NAMESPACE_VERSION } // namespace #if (__cplusplus < 201103L) || _GLIBCXX_USE_DEPRECATED # include <backward/binders.h> #endif #endif /* _STL_FUNCTION_H */
f39a271109f320be38fa8a0f6fcc96879b4f58cc
08b8cf38e1936e8cec27f84af0d3727321cec9c4
/data/crawl/tar/hunk_73.cpp
09129f072af31ab4e4e4122044c5441abf428c69
[]
no_license
ccdxc/logSurvey
eaf28e9c2d6307140b17986d5c05106d1fd8e943
6b80226e1667c1e0760ab39160893ee19b0e9fb1
refs/heads/master
2022-01-07T21:31:55.446839
2018-04-21T14:12:43
2018-04-21T14:12:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,630
cpp
-/* A more useful interface to strtol. - Copyright 1995, 1996, 1998, 1999, 2001 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#ifndef XSTRTOL_H_ -# define XSTRTOL_H_ 1 - -# if HAVE_INTTYPES_H -# include <inttypes.h> /* for uintmax_t */ -# endif - -# ifndef PARAMS -# if defined PROTOTYPES || (defined __STDC__ && __STDC__) -# define PARAMS(Args) Args -# else -# define PARAMS(Args) () -# endif -# endif - -# ifndef _STRTOL_ERROR -enum strtol_error - { - LONGINT_OK, LONGINT_INVALID, LONGINT_INVALID_SUFFIX_CHAR, LONGINT_OVERFLOW - }; -typedef enum strtol_error strtol_error; -# endif - -# define _DECLARE_XSTRTOL(name, type) \ - strtol_error \ - name PARAMS ((const char *s, char **ptr, int base, \ - type *val, const char *valid_suffixes)); -_DECLARE_XSTRTOL (xstrtol, long int) -_DECLARE_XSTRTOL (xstrtoul, unsigned long int) -_DECLARE_XSTRTOL (xstrtoimax, intmax_t) -_DECLARE_XSTRTOL (xstrtoumax, uintmax_t) - -# define _STRTOL_ERROR(Exit_code, Str, Argument_type_string, Err) \ - do \ - { \ - switch ((Err)) \ - { \ - case LONGINT_OK: \ - abort (); \ - \ - case LONGINT_INVALID: \ - error ((Exit_code), 0, "invalid %s `%s'", \ - (Argument_type_string), (Str)); \ - break; \ - \ - case LONGINT_INVALID_SUFFIX_CHAR: \ - error ((Exit_code), 0, "invalid character following %s in `%s'", \ - (Argument_type_string), (Str)); \ - break; \ - \ - case LONGINT_OVERFLOW: \ - error ((Exit_code), 0, "%s `%s' too large", \ - (Argument_type_string), (Str)); \ - break; \ - } \ - } \ - while (0) - -# define STRTOL_FATAL_ERROR(Str, Argument_type_string, Err) \ - _STRTOL_ERROR (2, Str, Argument_type_string, Err) - -# define STRTOL_FAIL_WARN(Str, Argument_type_string, Err) \ - _STRTOL_ERROR (0, Str, Argument_type_string, Err) - -#endif /* not XSTRTOL_H_ */
bc7e16618f27853ddd0eced03cc9cc671266e654
5a075cc56820038a97d225b9f4a17a003021fa78
/vj-stl-2-g.cpp
34b8eb0eeb1df28d7436f9801365ebb6efa5dfdc
[]
no_license
nahid0335/Problem-solving
e5f1fc9d70c10992655c8dceceec6eb89da953c0
89c1e94048b9f8fb7259294b8f5a3176723041e7
refs/heads/master
2020-11-26T07:02:56.944184
2019-12-19T09:33:58
2019-12-19T09:33:58
228,997,106
1
0
null
null
null
null
UTF-8
C++
false
false
1,568
cpp
#include<cstdio> #include<sstream> #include<cstdlib> #include<cctype> #include<cmath> #include<algorithm> #include<set> #include<queue> #include<deque> #include<stack> #include<list> #include<iostream> #include<fstream> #include<numeric> #include<string> #include<vector> #include<cstring> #include<map> #include<iterator> #include<functional> using namespace std; #define ll long long int #define du double #define read freopen("input.txt","r",stdin) #define write freopen("output.txt","w",stdout) #define fi(j,k,n) for(j=k;j<n;j++) #define fd(j,k,n) for(j=k;j<n;j--) #define vc(a) vector<a> #define pb push_back #define mset(a) memset(a,0,sizeof(a)) #define pr(a,s) pair<a,s> #define st(a) sort(a.begin(),a.end()) #define mp(a,b) make_pair(a,b) int ar[30050]; ll n; int main() { read; write; ll t,i=0; cin>>t; while(i<t) { i++; ll j,ma=0,tp,area=0; cin>>n; stack<int>s; fi(j,0,n) cin>>ar[j]; j=0; while(j<n) { if(s.empty()||(ar[j]>=ar[s.top()])) { s.push(j); j++; } else { tp=s.top(); s.pop(); area=ar[tp]*(s.empty()?j:j-s.top()-1); ma=max(ma,area); } } while(!s.empty()) { tp=s.top(); s.pop(); area=ar[tp]*(s.empty()?j:j-s.top()-1); ma=max(ma,area); } cout<<"Case "<<i<<": "<<ma<<endl; } return 0; }
879ebbca27ceb77618fa3838404577a0724d2670
559fe0fedd992606878c0ba2b44bdabd9023e07f
/src/KeyBinding.hpp
6cd1b92f3ba5064a70f446ea04e0aacf5a25cba6
[]
no_license
izzyfoxdev/SFML-Book-Exercises
59c76a92bc2c5a62fa67748c997e3e0e28e51182
23eed05d6bd1d92e67b2f8501aba24f016db9a5a
refs/heads/master
2021-01-02T22:54:04.678800
2014-02-12T05:25:32
2014-02-12T05:25:32
null
0
0
null
null
null
null
UTF-8
C++
false
false
882
hpp
#ifndef KEYBINDING_HPP #define KEYBINDING_HPP #include <map> #include <vector> #include <SFML/Window/Keyboard.hpp> namespace PlayerAction { enum Type { MoveLeft, MoveRight, MoveUp, MoveDown, Fire, LaunchMissile, Count }; } bool isRealtimeAction(PlayerAction::Type action); class KeyBinding { public: typedef PlayerAction::Type Action; private: std::map<sf::Keyboard::Key, Action> mKeyMap; public: explicit KeyBinding(int controlPreconfiguration); void assignKey(Action action, sf::Keyboard::Key key); sf::Keyboard::Key getAssignedKey(Action action) const; bool checkAction(sf::Keyboard::Key key, Action& out) const; std::vector<Action> getRealtimeActions() const; private: void initializeActions(); }; #endif // KEYBINDING_HPP
78f2fb5ba1ca6398efa9f15c9cfde095e17f50fe
1ec4cd6d8ec531459f9caf2b2dec16e0ca76d356
/source/android/s3eFirebase_platform.cpp
34e4153be5f7f2c6dfd7f6793c11ecb7c69d50e4
[]
no_license
BAADGames/s3eFirebase
eddc1a573578f54b06b1f37a3f1bf852ee036a01
55ac6a5bb69fcb75ce8a8a745e2a47c4ed77db92
refs/heads/master
2021-01-19T03:43:01.205082
2016-10-07T13:57:56
2016-10-07T13:57:56
70,251,003
1
0
null
null
null
null
UTF-8
C++
false
false
1,911
cpp
/* * android-specific implementation of the s3eFirebase extension. * Add any platform-specific functionality here. */ /* * NOTE: This file was originally written by the extension builder, but will not * be overwritten (unless --force is specified) and is intended to be modified. */ #include "s3eFirebase_internal.h" #include "s3eEdk.h" #include "s3eEdk_android.h" #include <jni.h> #include "IwDebug.h" static jobject g_Obj; static jmethodID g_s3eFirebaseInitialize; s3eResult s3eFirebaseInit_platform() { // Get the environment from the pointer JNIEnv* env = s3eEdkJNIGetEnv(); jobject obj = NULL; jmethodID cons = NULL; // Get the extension class jclass cls = s3eEdkAndroidFindClass("s3eFirebase"); if (!cls) goto fail; // Get its constructor cons = env->GetMethodID(cls, "<init>", "()V"); if (!cons) goto fail; // Construct the java class obj = env->NewObject(cls, cons); if (!obj) goto fail; // Get all the extension methods g_s3eFirebaseInitialize = env->GetMethodID(cls, "s3eFirebaseInitialize", "()V"); if (!g_s3eFirebaseInitialize) goto fail; g_Obj = env->NewGlobalRef(obj); env->DeleteLocalRef(obj); env->DeleteGlobalRef(cls); // Add any platform-specific initialisation code here return S3E_RESULT_SUCCESS; fail: jthrowable exc = env->ExceptionOccurred(); if (exc) { env->ExceptionDescribe(); env->ExceptionClear(); } env->DeleteLocalRef(obj); env->DeleteGlobalRef(cls); return S3E_RESULT_ERROR; } void s3eFirebaseTerminate_platform() { // Add any platform-specific termination code here JNIEnv* env = s3eEdkJNIGetEnv(); env->DeleteGlobalRef(g_Obj); g_Obj = NULL; } void s3eFirebaseInitialize_platform() { JNIEnv* env = s3eEdkJNIGetEnv(); env->CallVoidMethod(g_Obj, g_s3eFirebaseInitialize); }
8d3e066491d7291b55089d8fd863f4e8b1c98b9b
2f1a092537d8650cacbd274a3bd600e87a627e90
/thrift/compiler/test/ast_visitor_test.cc
beaf8fc2354ce6a722e4b1349aa0727a84d210bf
[ "Apache-2.0" ]
permissive
ConnectionMaster/fbthrift
3aa7d095c00b04030fddbabffbf09a5adca29d42
d5d0fa3f72ee0eb4c7b955e9e04a25052678d740
refs/heads/master
2023-04-10T17:49:05.409858
2021-08-03T02:32:49
2021-08-03T02:33:57
187,603,239
1
1
Apache-2.0
2023-04-03T23:15:28
2019-05-20T08:49:29
C++
UTF-8
C++
false
false
16,643
cc
/* * Copyright (c) Facebook, Inc. and its affiliates. * * 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 <thrift/compiler/ast/ast_visitor.h> #include <memory> #include <folly/portability/GMock.h> #include <folly/portability/GTest.h> #include <thrift/compiler/ast/t_base_type.h> #include <thrift/compiler/ast/t_type.h> namespace apache::thrift::compiler { namespace { // A helper class for keeping track of visitation expectations. class MockAstVisitor { public: MOCK_METHOD(void, visit_interface, (const t_interface*)); MOCK_METHOD(void, visit_structured_definition, (const t_structured*)); MOCK_METHOD(void, visit_definition, (const t_named*)); MOCK_METHOD(void, visit_container, (const t_container*)); MOCK_METHOD(void, visit_type_instantiation, (const t_templated_type*)); MOCK_METHOD(void, visit_program, (const t_program*)); MOCK_METHOD(void, visit_service, (const t_service*)); MOCK_METHOD(void, visit_interaction, (const t_interaction*)); MOCK_METHOD(void, visit_function, (const t_function*)); MOCK_METHOD(void, visit_throws, (const t_throws*)); MOCK_METHOD(void, visit_struct, (const t_struct*)); MOCK_METHOD(void, visit_union, (const t_union*)); MOCK_METHOD(void, visit_exception, (const t_exception*)); MOCK_METHOD(void, visit_field, (const t_field*)); MOCK_METHOD(void, visit_enum, (const t_enum*)); MOCK_METHOD(void, visit_enum_value, (const t_enum_value*)); MOCK_METHOD(void, visit_const, (const t_const*)); MOCK_METHOD(void, visit_typedef, (const t_typedef*)); MOCK_METHOD(void, visit_set, (const t_set*)); MOCK_METHOD(void, visit_list, (const t_list*)); MOCK_METHOD(void, visit_map, (const t_map*)); MOCK_METHOD(void, visit_sink, (const t_sink*)); MOCK_METHOD(void, visit_stream_response, (const t_stream_response*)); // Registers with all ast_visitor registration functions. template <typename V> void addTo(V& visitor) { visitor.add_interface_visitor( [this](const t_interface& node) { visit_interface(&node); }); visitor.add_structured_definition_visitor([this](const t_structured& node) { visit_structured_definition(&node); }); visitor.add_definition_visitor( [this](const t_named& node) { visit_definition(&node); }); visitor.add_container_visitor( [this](const t_container& node) { visit_container(&node); }); visitor.add_type_instantiation_visitor( [this](const t_templated_type& node) { visit_type_instantiation(&node); }); visitor.add_program_visitor( [this](const t_program& node) { visit_program(&node); }); visitor.add_service_visitor( [this](const t_service& node) { visit_service(&node); }); visitor.add_interaction_visitor( [this](const t_interaction& node) { visit_interaction(&node); }); visitor.add_function_visitor( [this](const t_function& node) { visit_function(&node); }); visitor.add_throws_visitor( [this](const t_throws& node) { visit_throws(&node); }); visitor.add_struct_visitor( [this](const t_struct& node) { visit_struct(&node); }); visitor.add_union_visitor( [this](const t_union& node) { visit_union(&node); }); visitor.add_exception_visitor( [this](const t_exception& node) { visit_exception(&node); }); visitor.add_field_visitor( [this](const t_field& node) { visit_field(&node); }); visitor.add_enum_visitor([this](const t_enum& node) { visit_enum(&node); }); visitor.add_enum_value_visitor( [this](const t_enum_value& node) { visit_enum_value(&node); }); visitor.add_const_visitor( [this](const t_const& node) { visit_const(&node); }); visitor.add_typedef_visitor( [this](const t_typedef& node) { visit_typedef(&node); }); visitor.add_set_visitor([this](const t_set& node) { visit_set(&node); }); visitor.add_list_visitor([this](const t_list& node) { visit_list(&node); }); visitor.add_map_visitor([this](const t_map& node) { visit_map(&node); }); visitor.add_sink_visitor([this](const t_sink& node) { visit_sink(&node); }); visitor.add_stream_response_visitor([this](const t_stream_response& node) { visit_stream_response(&node); }); } }; // A visitor for all node types, that forwards to the type-specific // MockAstVisitor functions. class OverloadedVisitor { public: explicit OverloadedVisitor(MockAstVisitor* mock) : mock_(mock) {} void operator()(const t_interaction& node) { mock_->visit_interaction(&node); } void operator()(const t_service& node) { mock_->visit_service(&node); } void operator()(const t_program& node) { mock_->visit_program(&node); } void operator()(const t_function& node) { mock_->visit_function(&node); } void operator()(const t_throws& node) { mock_->visit_throws(&node); } public: AstVisitorTest() noexcept : program_("path/to/program.thrift"), overload_visitor_(&overload_mock_) {} void SetUp() override { // Register mock_ to verify add_* function -> nodes visited // relationship. // Register overload_visitor_ with each multi-node visitor function to // verify the correct overloads are used. visitor_.add_interface_visitor(overload_visitor_); visitor_.add_structured_definition_visitor(overload_visitor_); visitor_.add_definition_visitor(overload_visitor_); visitor_.add_container_visitor(overload_visitor_); visitor_.add_type_instantiation_visitor(overload_visitor_); // Add baseline expectations. EXPECT_CALL(this->mock_, visit_program(&this->program_)); } void TearDown() override { visitor_(program_); } protected: ::testing::StrictMock<MockAstVisitor> mock_; ::testing::StrictMock<MockAstVisitor> overload_mock_; t_program program_; t_scope scope_; private: V visitor_; OverloadedVisitor overload_visitor_; }; using AstVisitorTypes = ::testing::Types<ast_visitor, const_ast_visitor>; TYPED_TEST_SUITE(AstVisitorTest, AstVisitorTypes); TYPED_TEST(AstVisitorTest, EmptyProgram) {} TYPED_TEST(AstVisitorTest, Interaction) { auto interaction = std::make_unique<t_interaction>(&this->program_, "Interaction"); auto func1 = std::make_unique<t_function>( &t_base_type::t_void(), "function1", std::make_unique<t_paramlist>(&this->program_)); func1->set_exceptions(std::make_unique<t_throws>()); auto func2 = std::make_unique<t_function>( &t_base_type::t_void(), "function2", std::make_unique<t_paramlist>(&this->program_)); EXPECT_CALL(this->mock_, visit_function(func1.get())); EXPECT_CALL(this->mock_, visit_throws(func1->exceptions())); EXPECT_CALL(this->mock_, visit_function(func2.get())); // Matches: definition. EXPECT_CALL(this->mock_, visit_definition(func1.get())); EXPECT_CALL(this->mock_, visit_definition(func2.get())); EXPECT_CALL(this->overload_mock_, visit_function(func1.get())); EXPECT_CALL(this->overload_mock_, visit_function(func2.get())); interaction->add_function(std::move(func1)); interaction->add_function(std::move(func2)); EXPECT_CALL(this->mock_, visit_interaction(interaction.get())); // Matches: interface, definition. EXPECT_CALL(this->mock_, visit_interface(interaction.get())); EXPECT_CALL(this->mock_, visit_definition(interaction.get())); EXPECT_CALL(this->overload_mock_, visit_interaction(interaction.get())) .Times(2); this->program_.add_interaction(std::move(interaction)); } TYPED_TEST(AstVisitorTest, Service) { auto service = std::make_unique<t_service>(&this->program_, "Service"); auto func1 = std::make_unique<t_function>( &t_base_type::t_void(), "function1", std::make_unique<t_paramlist>(&this->program_)); func1->set_exceptions(std::make_unique<t_throws>()); auto func2 = std::make_unique<t_function>( &t_base_type::t_void(), "function2", std::make_unique<t_paramlist>(&this->program_)); EXPECT_CALL(this->mock_, visit_function(func1.get())); EXPECT_CALL(this->mock_, visit_throws(func1->exceptions())); EXPECT_CALL(this->mock_, visit_function(func2.get())); // Matches: definition. EXPECT_CALL(this->mock_, visit_definition(func1.get())); EXPECT_CALL(this->mock_, visit_definition(func2.get())); EXPECT_CALL(this->overload_mock_, visit_function(func1.get())); EXPECT_CALL(this->overload_mock_, visit_function(func2.get())); service->add_function(std::move(func1)); service->add_function(std::move(func2)); EXPECT_CALL(this->mock_, visit_service(service.get())); // Matches: interface, definition. EXPECT_CALL(this->mock_, visit_interface(service.get())); EXPECT_CALL(this->mock_, visit_definition(service.get())); EXPECT_CALL(this->overload_mock_, visit_service(service.get())).Times(2); this->program_.add_service(std::move(service)); } TYPED_TEST(AstVisitorTest, Struct) { auto tstruct = std::make_unique<t_struct>(&this->program_, "Struct"); auto field = std::make_unique<t_field>(&t_base_type::t_i32(), "struct_field", 1); EXPECT_CALL(this->mock_, visit_field(field.get())); // Matches: definition. EXPECT_CALL(this->mock_, visit_definition(field.get())); EXPECT_CALL(this->overload_mock_, visit_field(field.get())); tstruct->append(std::move(field)); EXPECT_CALL(this->mock_, visit_struct(tstruct.get())); // Matches: structured_definition, definition. EXPECT_CALL(this->mock_, visit_structured_definition(tstruct.get())); EXPECT_CALL(this->mock_, visit_definition(tstruct.get())); EXPECT_CALL(this->overload_mock_, visit_struct(tstruct.get())).Times(2); this->program_.add_struct(std::move(tstruct)); } TYPED_TEST(AstVisitorTest, Union) { auto tunion = std::make_unique<t_union>(&this->program_, "Union"); auto field = std::make_unique<t_field>(&t_base_type::t_i32(), "union_field", 1); EXPECT_CALL(this->mock_, visit_field(field.get())); // Matches: definition. EXPECT_CALL(this->mock_, visit_definition(field.get())); EXPECT_CALL(this->overload_mock_, visit_field(field.get())); tunion->append(std::move(field)); EXPECT_CALL(this->mock_, visit_union(tunion.get())); // Matches: structured_definition, definition. EXPECT_CALL(this->mock_, visit_structured_definition(tunion.get())); EXPECT_CALL(this->mock_, visit_definition(tunion.get())); EXPECT_CALL(this->overload_mock_, visit_union(tunion.get())).Times(2); this->program_.add_struct(std::move(tunion)); } TYPED_TEST(AstVisitorTest, Exception) { auto except = std::make_unique<t_exception>(&this->program_, "Exception"); auto field = std::make_unique<t_field>(&t_base_type::t_i32(), "exception_field", 1); EXPECT_CALL(this->mock_, visit_field(field.get())); // Matches: definition. EXPECT_CALL(this->mock_, visit_definition(field.get())); EXPECT_CALL(this->overload_mock_, visit_field(field.get())); except->append(std::move(field)); EXPECT_CALL(this->mock_, visit_exception(except.get())); // Matches: structured_definition, definition. EXPECT_CALL(this->mock_, visit_structured_definition(except.get())); EXPECT_CALL(this->mock_, visit_definition(except.get())); EXPECT_CALL(this->overload_mock_, visit_exception(except.get())).Times(2); this->program_.add_exception(std::move(except)); } TYPED_TEST(AstVisitorTest, Enum) { auto tenum = std::make_unique<t_enum>(&this->program_, "Enum"); auto tenum_value = std::make_unique<t_enum_value>("EnumValue"); EXPECT_CALL(this->mock_, visit_enum_value(tenum_value.get())); // Matches: definition. EXPECT_CALL(this->mock_, visit_definition(tenum_value.get())); EXPECT_CALL(this->overload_mock_, visit_enum_value(tenum_value.get())); tenum->append(std::move(tenum_value)); EXPECT_CALL(this->mock_, visit_enum(tenum.get())); // Matches: definition. EXPECT_CALL(this->mock_, visit_definition(tenum.get())); EXPECT_CALL(this->overload_mock_, visit_enum(tenum.get())); this->program_.add_enum(std::move(tenum)); } TYPED_TEST(AstVisitorTest, Const) { auto tconst = std::make_unique<t_const>( &this->program_, &t_base_type::t_i32(), "Const", nullptr); EXPECT_CALL(this->mock_, visit_const(tconst.get())); // Matches: definition. EXPECT_CALL(this->mock_, visit_definition(tconst.get())); EXPECT_CALL(this->overload_mock_, visit_const(tconst.get())); this->program_.add_const(std::move(tconst)); } TYPED_TEST(AstVisitorTest, Typedef) { auto ttypedef = std::make_unique<t_typedef>( &this->program_, &t_base_type::t_i32(), "Typedef", nullptr); EXPECT_CALL(this->mock_, visit_typedef(ttypedef.get())); // Matches: definition. EXPECT_CALL(this->mock_, visit_definition(ttypedef.get())); EXPECT_CALL(this->overload_mock_, visit_typedef(ttypedef.get())); this->program_.add_typedef(std::move(ttypedef)); } TYPED_TEST(AstVisitorTest, Set) { auto set = std::make_unique<t_set>(&t_base_type::t_i32()); EXPECT_CALL(this->mock_, visit_set(set.get())); // Matches: container, type_instantiation. EXPECT_CALL(this->mock_, visit_container(set.get())); EXPECT_CALL(this->mock_, visit_type_instantiation(set.get())); EXPECT_CALL(this->overload_mock_, visit_set(set.get())).Times(2); this->program_.add_type_instantiation(std::move(set)); } TYPED_TEST(AstVisitorTest, List) { auto list = std::make_unique<t_list>(&t_base_type::t_i32()); EXPECT_CALL(this->mock_, visit_list(list.get())); // Matches: container, type_instantiation. EXPECT_CALL(this->mock_, visit_container(list.get())); EXPECT_CALL(this->mock_, visit_type_instantiation(list.get())); EXPECT_CALL(this->overload_mock_, visit_list(list.get())).Times(2); this->program_.add_type_instantiation(std::move(list)); } TYPED_TEST(AstVisitorTest, Map) { auto map = std::make_unique<t_map>(&t_base_type::t_i32(), &t_base_type::t_i32()); EXPECT_CALL(this->mock_, visit_map(map.get())); // Matches: container, type_instantiation. EXPECT_CALL(this->mock_, visit_container(map.get())); EXPECT_CALL(this->mock_, visit_type_instantiation(map.get())); EXPECT_CALL(this->overload_mock_, visit_map(map.get())).Times(2); this->program_.add_type_instantiation(std::move(map)); } TYPED_TEST(AstVisitorTest, Sink) { auto sink1 = std::make_unique<t_sink>( t_type_ref{&t_base_type::t_i32()}, t_type_ref{&t_base_type::t_i32()}); sink1->set_sink_exceptions(std::make_unique<t_throws>()); auto sink2 = std::make_unique<t_sink>( t_type_ref{&t_base_type::t_i32()}, t_type_ref{&t_base_type::t_i32()}); sink2->set_final_response_exceptions(std::make_unique<t_throws>()); EXPECT_CALL(this->mock_, visit_sink(sink1.get())); EXPECT_CALL(this->mock_, visit_throws(sink1->sink_exceptions())); EXPECT_CALL(this->mock_, visit_sink(sink2.get())); EXPECT_CALL(this->mock_, visit_throws(sink2->final_response_exceptions())); // Matches: type_instantiation. EXPECT_CALL(this->mock_, visit_type_instantiation(sink1.get())); EXPECT_CALL(this->mock_, visit_type_instantiation(sink2.get())); EXPECT_CALL(this->overload_mock_, visit_sink(sink1.get())); EXPECT_CALL(this->overload_mock_, visit_sink(sink2.get())); this->program_.add_type_instantiation(std::move(sink1)); this->program_.add_type_instantiation(std::move(sink2)); } TYPED_TEST(AstVisitorTest, StreamResponse) { auto stream1 = std::make_unique<t_stream_response>(t_type_ref{&t_base_type::t_i32()}); stream1->set_exceptions(std::make_unique<t_throws>()); auto stream2 = std::make_unique<t_stream_response>(t_type_ref{&t_base_type::t_i32()}); EXPECT_CALL(this->mock_, visit_stream_response(stream1.get())); EXPECT_CALL(this->mock_, visit_stream_response(stream2.get())); EXPECT_CALL(this->mock_, visit_throws(stream1->exceptions())); // Matches: type_instantiation. EXPECT_CALL(this->mock_, visit_type_instantiation(stream1.get())); EXPECT_CALL(this->mock_, visit_type_instantiation(stream2.get())); EXPECT_CALL(this->overload_mock_, visit_stream_response(stream1.get())); EXPECT_CALL(this->overload_mock_, visit_stream_response(stream2.get())); this->program_.add_type_instantiation(std::move(stream1)); this->program_.add_type_instantiation(std::move(stream2)); } } // namespace } // namespace apache::thrift::compiler
69624a34ea64f8a485d44d2e3eb02a83421f5ad5
c3f715589f5d83e3ba92baaa309414eb253ca962
/C++/round-5/1201-1300/1281-1300/1286.h
daef25933593d58409ca44164da3c36aa1a44280
[]
no_license
kophy/Leetcode
4b22272de78c213c4ad42c488df6cffa3b8ba785
7763dc71fd2f34b28d5e006a1824ca7157cec224
refs/heads/master
2021-06-11T05:06:41.144210
2021-03-09T08:25:15
2021-03-09T08:25:15
62,117,739
13
1
null
null
null
null
UTF-8
C++
false
false
1,143
h
class CombinationIterator { public: CombinationIterator(string characters, int combinationLength) { characters_ = characters; current_ = characters.substr(0, combinationLength); length_ = combinationLength; } string next() { string result = current_; int i = length_ - 1; for (; i >= 0; --i) { // Find the first i that current_[i:] can be updated. char c = current_[i]; int position = find(characters_.begin(), characters_.end(), c) - characters_.begin(); if (characters_.size() - position >= length_ - i + 1) { for (int j = 0; j < length_ - i; ++j) { current_[i + j] = characters_[position + j + 1]; } break; } } if (i < 0) { current_ = ""; } return result; } bool hasNext() { return (current_ != ""); } private: string characters_; string current_; int length_; }; /** * Your CombinationIterator object will be instantiated and called as such: * CombinationIterator* obj = new CombinationIterator(characters, * combinationLength); string param_1 = obj->next(); bool param_2 = * obj->hasNext(); */
c1320e4609e78a7ee2352f5ef95d5d9d5e40c55f
6d361f38d894cca178cf0d494430a75aa9c9bc3d
/Square.cpp
2d144ab392d1122fa5f10b2637a5acb1147aa68a
[]
no_license
Gumisia/Obj_cpp
0c86d153a31370715d181f68d31ce98d9356b036
2c52fabeb1656e950db6789c72b0d1bab0620a13
refs/heads/master
2020-04-10T12:57:39.758772
2018-12-09T12:19:15
2018-12-09T12:19:15
161,036,140
0
0
null
null
null
null
UTF-8
C++
false
false
386
cpp
// // Created by admin on 02/12/2018. // #include <cmath> #include "pch.h" #include "Square.h" Square::Square() { length = 1; } Square::Square(int length) { this->length = length; // (*this).length=length; } //Square::~Square() //{ // //} // //void Square::print() { // std::cout << x << std::endl; //} double Square::diagonal() { return length * std::sqrt(2); }
8d12f1c6f41aa15b8cfc22d7be3bcb54dc6be269
16de6285eec8a387669fb9f820affce99a6b515b
/Assignment 1/ImageRenderer.cxx
1cb4ec15a1bed745164d5bc93070374d79fae899
[]
no_license
jdthorne/cpsc453
c507fb28d8586c802533721fe555b32d1c9d18d9
0395e9a1eb035765e4b2a2325912c2a35ca2359d
refs/heads/master
2020-04-09T22:11:15.256855
2012-11-26T21:20:51
2012-11-26T21:20:51
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,523
cxx
// System // Project #include <ImageRenderer.h> ImageRenderer::ImageRenderer() { // Generate the texture names - this seems to be slow, so only do it on // construction. glGenTextures(2, textureNames_); } ImageRenderer::~ImageRenderer() { } /** ****************************************************************************** * * Setting images * ****************************************************************************** */ void ImageRenderer::setOriginalImage(Image original) { createTexture(0, original); } void ImageRenderer::setFilteredImage(Image filtered) { createTexture(1, filtered); } /** ****************************************************************************** * * Resizing * ****************************************************************************** */ void ImageRenderer::handleSizeChanged(int width, int height) { width_ = width; height_ = height; } /** ****************************************************************************** * * Creating textures in OpenGL * ****************************************************************************** */ void ImageRenderer::createTexture(int id, Image& image) { // Remember the size so we can center the image later imageWidth_[id] = image.width(); imageHeight_[id] = image.height(); // Tell OpenGL which texture we want glBindTexture(GL_TEXTURE_2D, textureNames_[id]); // Tell OpenGL how to handle the texture (repeat on edges, use // nearest-neighbour interpolation) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); // Set the magnification and minification filters to nearest-neighbour glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); // Actually push the texture to OpenGL (yay GLUT making it easy!) gluBuild2DMipmaps(GL_TEXTURE_2D, 3, image.width(), image.height(), GL_RGB, GL_UNSIGNED_BYTE, image.data() ); } /** ****************************************************************************** * * Render the actual images * ****************************************************************************** */ void ImageRenderer::render() { // Tell OpenGL we're using textures glEnable(GL_TEXTURE_2D); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); // Render the two images at x = 1/4 and x = 3/4 renderImage(0, width_ * 0.25, height_ * 0.5); renderImage(1, width_ * 0.75, height_ * 0.5); // Turn textures off so we don't screw up anything that happens next glDisable(GL_TEXTURE_2D); } void ImageRenderer::renderImage(int id, int xCenter, int yCenter) { // Figure out the offsets from the center int dx = imageWidth_[id] / 2; int dy = imageHeight_[id] / 2; // Tell OpenGL which texture we want glBindTexture(GL_TEXTURE_2D, textureNames_[id]); // Tell OpenGL we're drawing quads, and in white (so it doesn't tint our display) glBegin(GL_QUADS); glColor4f(1, 1, 1, 1); // Give OpenGL the four coordinates glTexCoord2f(0, 0); glVertex3f(xCenter - dx, yCenter - dy, 0); glTexCoord2f(1, 0); glVertex3f(xCenter + dx, yCenter - dy, 0); glTexCoord2f(1, 1); glVertex3f(xCenter + dx, yCenter + dy, 0); glTexCoord2f(0, 1); glVertex3f(xCenter - dx, yCenter + dy, 0); // Tell OpenGL we're done glEnd(); }
8a89a6f2921d12f9a4903d63ca3f16265628df5a
88e378f925bbd8dddd271e19a51477a5201c32eb
/GRMFixes/ZenGin/Gothic_II_Classic/API/oMagFrontier.h
58f6f63be467858681b480e240d7c9d4e0eeb129
[ "MIT" ]
permissive
ThielHater/GRMFixes_Union
d71dcc71f77082feaf4036785acc32255fbeaaa9
4cfff09b5e7b1ecdbc13d903d44727eab52703ff
refs/heads/master
2022-11-26T21:41:37.680547
2022-11-06T16:30:08
2022-11-06T16:30:08
240,788,948
0
1
null
null
null
null
UTF-8
C++
false
false
1,478
h
// Supported with union (c) 2018 Union team #ifndef __OMAG_FRONTIER_H__VER2__ #define __OMAG_FRONTIER_H__VER2__ namespace Gothic_II_Classic { class oCMagFrontier { public: oCVisualFX* warningFX; oCVisualFX* shootFX; oCNpc* npc; unsigned char isWarning : 1; unsigned char isShooting : 1; void oCMagFrontier_OnInit() zCall( 0x00472580 ); oCMagFrontier() zInit( oCMagFrontier_OnInit() ); ~oCMagFrontier() zCall( 0x004725A0 ); void SetNPC( oCNpc* ) zCall( 0x00472610 ); void DoCheck() zCall( 0x00472620 ); float GetDistanceNewWorld( zVEC3 const&, float&, zVEC3& ) zCall( 0x00472D40 ); float GetDistanceDragonIsland( zVEC3 const&, float&, zVEC3& ) zCall( 0x00473280 ); void StartLightningAtPos( zVEC3&, zVEC3& ) zCall( 0x004733B0 ); void DoWarningFX( int ) zCall( 0x00473910 ); void DisposeWarningFX() zCall( 0x00473AD0 ); void DoShootFX( zVEC3 const& ) zCall( 0x00473B10 ); void DisposeShootFX() zCall( 0x00473E00 ); }; } // namespace Gothic_II_Classic #endif // __OMAG_FRONTIER_H__VER2__
d24b341b435899ac717a880b8fc13b0a154e9a3e
5a104d32ef504a2b99a22f4f1eb05d4ded4fc79f
/ouzel/math/AABB3.cpp
d13f6582e9f3176cc961d07920f49d50838f4d10
[ "BSD-2-Clause", "BSD-3-Clause" ]
permissive
slagusev/ouzel
f0f06b6ff717129c5cad4ac83e2254d524953bd1
439531a9771ee5eae9632422480731aea7817dd0
refs/heads/master
2020-05-23T07:51:36.443702
2017-01-30T19:27:47
2017-01-30T19:27:47
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,624
cpp
// Copyright (C) 2017 Elviss Strazdins // This file is part of the Ouzel engine. #include <algorithm> #include "AABB3.h" #include "AABB2.h" namespace ouzel { AABB3::AABB3(const AABB2& box): min(box.min), max(box.max) { } AABB3& AABB3::operator=(const AABB2& box) { min = box.min; max = box.max; return *this; } void AABB3::getCorners(Vector3* dst) const { // Near face, specified counter-clockwise looking towards the origin from the positive z-axis. // Left-bottom-front. dst[0].set(min.v[0], min.v[1], min.v[2]); // Right-bottom-front. dst[1].set(max.v[0], min.v[1], min.v[2]); // Right-top-front. dst[2].set(max.v[0], max.v[1], min.v[2]); // Left-top-front. dst[3].set(min.v[0], max.v[1], min.v[2]); // Left-bottom-back. dst[0].set(min.v[0], min.v[1], max.v[2]); // Right-bottom-back. dst[1].set(max.v[0], min.v[1], max.v[2]); // Right-top-back. dst[2].set(max.v[0], max.v[1], max.v[2]); // Left-top-back. dst[3].set(min.v[0], max.v[1], max.v[2]); } void AABB3::merge(const AABB3& box) { // Calculate the new minimum point. min.v[0] = std::min(min.v[0], box.min.v[0]); min.v[1] = std::min(min.v[1], box.min.v[1]); min.v[2] = std::min(min.v[2], box.min.v[2]); // Calculate the new maximum point. max.v[0] = std::max(max.v[0], box.max.v[0]); max.v[1] = std::max(max.v[1], box.max.v[1]); max.v[2] = std::max(max.v[1], box.max.v[2]); } }
a38a0d457ecc310e5742af5ec2801d94162749c4
56660dffc9ac18e665110537f86addda83834216
/Section9/Practice/IfElseStatement/main.cpp
338d3cbfd501790822e26940900cbbc88cfff8aa
[]
no_license
BishopOC/CPPUdemyCourse
cbd229738963403aec5ca95c061592716f826371
361289a06bf967880be96a46310450bed506ac3b
refs/heads/master
2022-07-19T14:56:07.248993
2020-05-22T00:44:37
2020-05-22T00:44:37
263,152,862
0
0
null
null
null
null
UTF-8
C++
false
false
565
cpp
#include <iostream> using namespace std; int main(){ int num{0}; const int target{10}; cout << "Enter a number" << endl; cin >> num; if(num >= target){ cout << "The number you enter is greater than " << target << endl; int diff{num - target}; cout << num << " is " << diff << " greater than " << target << endl; } else { cout << "The number you entered is less than " << target << endl; int diff{target - num}; cout << "The number you enter is " << diff << " less than " << target << endl; } cout << endl; return 0; }
5b3704bdbb91a24ee2ee6997b8fa95369f287f5a
5456502f97627278cbd6e16d002d50f1de3da7bb
/chrome/browser/chromeos/policy/restore_on_startup_browsertest_chromeos.cc
5d261c791a93acc839bfd60ef1df3dfd567ad82e
[ "BSD-3-Clause" ]
permissive
TrellixVulnTeam/Chromium_7C66
72d108a413909eb3bd36c73a6c2f98de1573b6e5
c8649ab2a0f5a747369ed50351209a42f59672ee
refs/heads/master
2023-03-16T12:51:40.231959
2017-12-20T10:38:26
2017-12-20T10:38:26
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,048
cc
// Copyright 2015 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 <memory> #include <utility> #include "base/macros.h" #include "base/values.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chromeos/policy/login_policy_test_base.h" #include "chrome/browser/prefs/session_startup_pref.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "components/policy/policy_constants.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/web_contents.h" #include "content/public/test/test_utils.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" namespace policy { namespace { const char kStartUpURL1[] = "chrome://chrome/"; const char kStartUpURL2[] = "chrome://version/"; } // Verifies that the |kRestoreOnStartup| and |kRestoreOnStartupURLs| policies // are honored on Chrome OS. class RestoreOnStartupTestChromeOS : public LoginPolicyTestBase { public: RestoreOnStartupTestChromeOS(); // LoginPolicyTestBase: void GetMandatoryPoliciesValue(base::DictionaryValue* policy) const override; void LogInAndVerifyStartUpURLs(); private: DISALLOW_COPY_AND_ASSIGN(RestoreOnStartupTestChromeOS); }; RestoreOnStartupTestChromeOS::RestoreOnStartupTestChromeOS() { } void RestoreOnStartupTestChromeOS::GetMandatoryPoliciesValue( base::DictionaryValue* policy) const { policy->SetInteger(key::kRestoreOnStartup, SessionStartupPref::kPrefValueURLs); std::unique_ptr<base::ListValue> urls(new base::ListValue); urls->AppendString(kStartUpURL1); urls->AppendString(kStartUpURL2); policy->Set(key::kRestoreOnStartupURLs, std::move(urls)); } void RestoreOnStartupTestChromeOS::LogInAndVerifyStartUpURLs() { LogIn(kAccountId, kAccountPassword); const BrowserList* const browser_list = BrowserList::GetInstance(); ASSERT_EQ(1U, browser_list->size()); const Browser* const browser = browser_list->get(0); ASSERT_TRUE(browser); const TabStripModel* tabs = browser->tab_strip_model(); ASSERT_TRUE(tabs); ASSERT_EQ(2, tabs->count()); EXPECT_EQ(GURL(kStartUpURL1), tabs->GetWebContentsAt(0)->GetURL()); EXPECT_EQ(GURL(kStartUpURL2), tabs->GetWebContentsAt(1)->GetURL()); } // Verify that the policies are honored on a new user's login. IN_PROC_BROWSER_TEST_F(RestoreOnStartupTestChromeOS, PRE_LogInAndVerify) { SkipToLoginScreen(); LogInAndVerifyStartUpURLs(); } // Verify that the policies are honored on an existing user's login. IN_PROC_BROWSER_TEST_F(RestoreOnStartupTestChromeOS, LogInAndVerify) { content::WindowedNotificationObserver( chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, content::NotificationService::AllSources()).Wait(); LogInAndVerifyStartUpURLs(); } } // namespace policy
3a3690e3fd44f2ff29761f7171c4fcb802e06837
879dc5681a36a3df9ae5a7244fa2d9af6bd346d7
/PTG/boole_31_34.cpp
eee2e114d520a172dab3e529e7383821bd42b11b
[ "BSD-3-Clause" ]
permissive
gachet/booledeusto
9defdba424a64dc7cf7ccd3938d412e3e797552b
fdc110a9add4a5946fabc2055a533593932a2003
refs/heads/master
2022-01-18T21:27:26.810810
2014-01-30T15:20:23
2014-01-30T15:20:23
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,400
cpp
// Do not edit. This file is machine generated by the Resource DLL Wizard. //--------------------------------------------------------------------------- #define PACKAGE __declspec(package) #define USERC(FileName) extern PACKAGE _Dummy #define USERES(FileName) extern PACKAGE _Dummy #define USEFORMRES(FileName, FormName, AncestorName) extern PACKAGE _Dummy #pragma hdrstop int _turboFloat; //--------------------------------------------------------------------------- /*ITE*/ /*LCID:00000C0A:00000816*/ /**/ /*ITE*/ /*DFMFileType*/ /*src\Boole2\Unit16.dfm*/ /*ITE*/ /*RCFileType*/ /*exe\boole_DRC.rc*/ /*ITE*/ /*RCFileType*/ /*src\res\mensajes.rc*/ //--------------------------------------------------------------------------- #pragma resource "src\Boole1\app.dfm" #pragma resource "src\Boole1\calc.dfm" #pragma resource "src\Boole1\uKarnaugh.dfm" #pragma resource "src\Boole1\ExpBool.dfm" #pragma resource "src\Boole1\FormasN.dfm" #pragma resource "src\Boole1\FormSimp.dfm" #pragma resource "src\Boole1\Main.dfm" #pragma resource "src\Boole1\NandNor.dfm" #pragma resource "src\Boole1\NuevoSC.dfm" #pragma resource "src\Boole1\SCCompac.dfm" #pragma resource "src\Boole1\TVComple.dfm" #pragma resource "src\Boole1\TVManual.dfm" #pragma resource "src\Boole2\FCalculando.dfm" #pragma resource "src\Boole2\ayuda.dfm" #pragma resource "src\Boole2\uLog.dfm" #pragma resource "src\Boole2\Unit15.dfm" #pragma resource "src\Boole2\Unit11.dfm" #pragma resource "src\Boole2\Unit12.dfm" #pragma resource "src\Boole2\Unit13.dfm" #pragma resource "src\Boole2\Unit14.dfm" #pragma resource "src\Boole2\Unit10.dfm" #pragma resource "src\Boole2\V_Boole2.dfm" #pragma resource "src\Boole2\Unit2.dfm" #pragma resource "src\Boole2\Unit3.dfm" #pragma resource "src\Boole2\Unit4.dfm" #pragma resource "src\Boole2\Unit5.dfm" #pragma resource "src\Boole2\Unit6.dfm" #pragma resource "src\Boole2\Unit8.dfm" #pragma resource "src\Boole2\Unit9.dfm" #pragma resource "src\Boole2\uSimulacion.dfm" USEFORMRES("src\Boole2\Unit16.dfm", TForm); #pragma resource "src\Boole2\Unit16.dfm" #pragma resource "src\Circuito\V_Imprimir.dfm" #pragma resource "src\Circuito\V_Circuito.dfm" #pragma resource "src\Comun\uTextoAsoc.dfm" USERC("exe\boole_DRC.rc"); USERC("src\res\mensajes.rc"); //--------------------------------------------------------------------------- #define DllEntryPoint
4e3c23151c827bab98c78945a750db127d43c718
6b550d3d0b182bcddda1f0a175d6b6cd07b60fb3
/logdevice/common/libevent/LibEventCompatibility.cpp
0a0e1ab786805031f1848cc7e13bbf0f776aeee4
[ "BSD-3-Clause" ]
permissive
Rachelmorrell/LogDevice
5bd04f7ab0bdf9cc6e5b2da4a4b51210cdc9a4c8
3a8d800033fada47d878b64533afdf41dc79e057
refs/heads/master
2021-06-24T09:10:20.240011
2020-04-21T14:10:52
2020-04-21T14:13:09
157,563,026
1
0
NOASSERTION
2020-04-21T19:20:55
2018-11-14T14:43:33
C++
UTF-8
C++
false
false
6,733
cpp
/** * Copyright (c) 2017-present, Facebook, Inc. and its affiliates. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ #include "logdevice/common/libevent/LibEventCompatibility.h" #include "logdevice/common/debug.h" namespace facebook { namespace logdevice { // utility methods namespace { static EvBase::EvBaseType getType(IEvBase* base) { EvBase* specific_base = dynamic_cast<EvBase*>(base); EvBase::EvBaseType base_type = EvBase::UNKNOWN; if (specific_base) { base_type = specific_base->getType(); } else if (dynamic_cast<EvBaseWithFolly*>(base)) { base_type = EvBase::FOLLY_EVENTBASE; } else if (dynamic_cast<EvBaseLegacy*>(base)) { base_type = EvBase::LEGACY_EVENTBASE; } else { ld_check(false); } return base_type; } } // namespace // EvBase methods void EvBase::selectEvBase(EvBaseType base_type) { ld_check(!curr_selection_); ld_check(base_type_ == UNKNOWN); ld_check_in(base_type, ({LEGACY_EVENTBASE, FOLLY_EVENTBASE})); base_type_ = base_type; if (base_type_ == LEGACY_EVENTBASE) { curr_selection_ = &ev_base_legacy_; } else if (base_type == FOLLY_EVENTBASE) { curr_selection_ = &ev_base_with_folly_; } } EvBase::Status EvBase::init(int num_priorities) { return curr_selection_->init(num_priorities); } EvBase::Status EvBase::free() { return curr_selection_->free(); } void EvBase::runInEventBaseThread(EventCallback fn) { if (base_type_ == LEGACY_EVENTBASE || base_type_ == UNKNOWN) { ld_assert(false); return; } curr_selection_->runInEventBaseThread(std::move(fn)); } EvBase::Status EvBase::loop() { return curr_selection_->loop(); } EvBase::Status EvBase::loopOnce() { return curr_selection_->loopOnce(); } EvBase::Status EvBase::terminateLoop() { return curr_selection_->terminateLoop(); } event_base* EvBase::getRawBaseDEPRECATED() { return curr_selection_->getRawBaseDEPRECATED(); } folly::EventBase* EvBase::getEventBase() { return curr_selection_->getEventBase(); } void EvBase::attachTimeoutManager( folly::AsyncTimeout* obj, folly::TimeoutManager::InternalEnum internal) { curr_selection_->attachTimeoutManager(obj, internal); } void EvBase::detachTimeoutManager(folly::AsyncTimeout* obj) { curr_selection_->detachTimeoutManager(obj); } bool EvBase::scheduleTimeout(folly::AsyncTimeout* obj, folly::TimeoutManager::timeout_type timeout) { return curr_selection_->scheduleTimeout(obj, timeout); } void EvBase::cancelTimeout(folly::AsyncTimeout* obj) { curr_selection_->cancelTimeout(obj); } void EvBase::bumpHandlingTime() { curr_selection_->bumpHandlingTime(); } bool EvBase::isInTimeoutManagerThread() { return running_base_ == curr_selection_; } // Event methods Event::Event(IEvBase::EventCallback callback, IEvBase::Events events, int fd, IEvBase* base) { auto base_type = getType(base); switch (base_type) { case EvBase::LEGACY_EVENTBASE: event_legacy_ = std::make_unique<EventLegacy>(std::move(callback), events, fd, base); break; case EvBase::FOLLY_EVENTBASE: event_folly_ = std::make_unique<EventWithFolly>( std::move(callback), events, fd, base); break; case EvBase::UNKNOWN: ld_check(false); break; } } // EvTimer methods EvTimer::EvTimer(IEvBase* base) { auto base_type = getType(base); switch (base_type) { case EvBase::LEGACY_EVENTBASE: evtimer_legacy_ = std::make_unique<EvTimerLegacy>(base); break; case EvBase::FOLLY_EVENTBASE: evtimer_folly_ = std::make_unique<EvTimerWithFolly>(base); break; case EvBase::UNKNOWN: ld_check(false); break; } } void EvTimer::attachTimeoutManager(folly::TimeoutManager* tm) { if (evtimer_legacy_) { evtimer_legacy_->attachTimeoutManager(tm); } else if (evtimer_folly_) { evtimer_folly_->attachTimeoutManager(tm); } else { ld_check(false); } } void EvTimer::attachCallback(folly::Func callback) { if (evtimer_legacy_) { evtimer_legacy_->attachCallback(std::move(callback)); } else if (evtimer_folly_) { evtimer_folly_->attachCallback(std::move(callback)); } else { ld_check(false); } } void EvTimer::timeoutExpired() noexcept { if (evtimer_legacy_) { evtimer_legacy_->timeoutExpired(); } else if (evtimer_folly_) { evtimer_folly_->timeoutExpired(); } else { ld_check(false); } } struct event* FOLLY_NULLABLE EvTimer::getEvent() { if (evtimer_legacy_) { return evtimer_legacy_->getEvent(); } if (evtimer_folly_) { return evtimer_folly_->getEvent()->getEvent(); } ld_check(false); return nullptr; } bool EvTimer::scheduleTimeout(uint32_t ms) { if (evtimer_legacy_) { return evtimer_legacy_->scheduleTimeout(ms); } if (evtimer_folly_) { return evtimer_folly_->scheduleTimeout(ms); } ld_check(false); return false; } bool EvTimer::scheduleTimeout(folly::TimeoutManager::timeout_type timeout) { if (evtimer_legacy_) { return evtimer_legacy_->scheduleTimeout(timeout); } if (evtimer_folly_) { return evtimer_folly_->scheduleTimeout(timeout); } ld_check(false); return false; } void EvTimer::cancelTimeout() { if (evtimer_legacy_) { evtimer_legacy_->cancelTimeout(); } else if (evtimer_folly_) { evtimer_folly_->cancelTimeout(); } else { ld_check(false); } } bool EvTimer::isScheduled() const { if (evtimer_legacy_) { return evtimer_legacy_->isScheduled(); } if (evtimer_folly_) { return evtimer_folly_->isScheduled(); } ld_check(false); return false; } int EvTimer::setPriority(int pri) { if (evtimer_legacy_) { return evtimer_legacy_->setPriority(pri); } if (evtimer_folly_) { return evtimer_folly_->setPriority(pri); } ld_check(false); return -1; } void EvTimer::activate(int res, short ncalls) { if (evtimer_legacy_) { evtimer_legacy_->activate(res, ncalls); } else if (evtimer_folly_) { evtimer_folly_->activate(res, ncalls); } else { ld_check(false); } } const timeval* FOLLY_NULLABLE EvTimer::getCommonTimeout(std::chrono::microseconds timeout) { auto base = EvBase::getRunningBase(); if (!base) { return nullptr; } EvBase::EvBaseType base_type = getType(base); switch (base_type) { case EvBase::LEGACY_EVENTBASE: return EvTimerLegacy::getCommonTimeout(timeout); case EvBase::FOLLY_EVENTBASE: return EvTimerWithFolly::getCommonTimeout(timeout); case EvBase::UNKNOWN: ld_check(false); break; } ld_check(false); return nullptr; } }} // namespace facebook::logdevice
21ff19c5b5af9b596c5192878471fa066c3b7050
d730f406b31589d9e2ac2a1c54b6898f6fc79e50
/SimpleStereoVO/SimpleStereoVO/g2o_types.h
544211ebde4015d705b31188b4a1d6e51681bd07
[]
no_license
mitsurukato24/SimpleStereoVO
1ec2c1d05af2c3ec12d54ba71de099eab290d7b4
ce2cd5b9b15534d353b677b731108861694b0b4d
refs/heads/main
2023-04-01T11:30:15.791558
2021-04-15T07:30:36
2021-04-15T07:30:36
338,977,128
2
0
null
null
null
null
UTF-8
C++
false
false
4,395
h
#pragma once #include "common_include.h" #include <g2o/core/base_binary_edge.h> #include <g2o/core/base_unary_edge.h> #include <g2o/core/base_vertex.h> #include <g2o/core/block_solver.h> #include <g2o/core/optimization_algorithm_gauss_newton.h> #include <g2o/core/optimization_algorithm_levenberg.h> #include <g2o/core/robust_kernel_impl.h> #include <g2o/core/solver.h> #include <g2o/core/sparse_optimizer.h> #include <g2o/solvers/csparse/linear_solver_csparse.h> #include <g2o/solvers/dense/linear_solver_dense.h> namespace simple_vo { class VertexPose : public g2o::BaseVertex<6, SE3> { public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW; virtual void setToOriginImpl() override { _estimate = SE3(); } // left multiplication on SE3 virtual void oplusImpl(const double *update) override { Vec6 update_eigen; update_eigen << update[0], update[1], update[2], update[3], update[4], update[5]; _estimate = SE3::exp(update_eigen) * _estimate; } virtual bool read(std::istream &in) override { return true; } virtual bool write(std::ostream &out) const override { return true; } }; /// 路标顶点 class VertexXYZ : public g2o::BaseVertex<3, Vec3> { public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW; virtual void setToOriginImpl() override { _estimate = Vec3::Zero(); } virtual void oplusImpl(const double *update) override { _estimate[0] += update[0]; _estimate[1] += update[1]; _estimate[2] += update[2]; } virtual bool read(std::istream &in) override { return true; } virtual bool write(std::ostream &out) const override { return true; } }; class EdgeProjectionPoseOnly : public g2o::BaseUnaryEdge<2, Vec2, VertexPose> { public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW; EdgeProjectionPoseOnly(const Vec3 &pos, const Mat33 &K) : _pos3d(pos), _K(K) {} virtual void computeError() override { const VertexPose *v = static_cast<VertexPose *>(_vertices[0]); SE3 T = v->estimate(); Vec3 pos_pixel = _K * (T * _pos3d); pos_pixel /= pos_pixel[2]; _error = _measurement - pos_pixel.head<2>(); } virtual void linearizeOplus() override { const VertexPose *v = static_cast<VertexPose *>(_vertices[0]); SE3 T = v->estimate(); Vec3 pos_cam = T * _pos3d; double fx = _K(0, 0); double fy = _K(1, 1); double X = pos_cam[0]; double Y = pos_cam[1]; double Z = pos_cam[2]; double Zinv = 1.0 / (Z + 1e-18); double Zinv2 = Zinv * Zinv; _jacobianOplusXi << -fx * Zinv, 0, fx * X * Zinv2, fx * X * Y * Zinv2, -fx - fx * X * X * Zinv2, fx * Y * Zinv, 0, -fy * Zinv, fy * Y * Zinv2, fy + fy * Y * Y * Zinv2, -fy * X * Y * Zinv2, -fy * X * Zinv; } virtual bool read(std::istream &in) override { return true; } virtual bool write(std::ostream &out) const override { return true; } private: Vec3 _pos3d; Mat33 _K; }; class EdgeProjection : public g2o::BaseBinaryEdge<2, Vec2, VertexPose, VertexXYZ> { public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW; EdgeProjection(const Mat33 &K, const SE3 &cam_ext) : _K(K) { _cam_ext = cam_ext; } virtual void computeError() override { const VertexPose *v0 = static_cast<VertexPose *>(_vertices[0]); const VertexXYZ *v1 = static_cast<VertexXYZ *>(_vertices[1]); SE3 T = v0->estimate(); Vec3 pos_pixel = _K * (_cam_ext * (T * v1->estimate())); pos_pixel /= pos_pixel[2]; _error = _measurement - pos_pixel.head<2>(); } virtual void linearizeOplus() override { const VertexPose *v0 = static_cast<VertexPose *>(_vertices[0]); const VertexXYZ *v1 = static_cast<VertexXYZ *>(_vertices[1]); SE3 T = v0->estimate(); Vec3 pw = v1->estimate(); Vec3 pos_cam = _cam_ext * T * pw; double fx = _K(0, 0); double fy = _K(1, 1); double X = pos_cam[0]; double Y = pos_cam[1]; double Z = pos_cam[2]; double Zinv = 1.0 / (Z + 1e-18); double Zinv2 = Zinv * Zinv; _jacobianOplusXi << -fx * Zinv, 0, fx * X * Zinv2, fx * X * Y * Zinv2, -fx - fx * X * X * Zinv2, fx * Y * Zinv, 0, -fy * Zinv, fy * Y * Zinv2, fy + fy * Y * Y * Zinv2, -fy * X * Y * Zinv2, -fy * X * Zinv; _jacobianOplusXj = _jacobianOplusXi.block<2, 3>(0, 0) * _cam_ext.rotationMatrix() * T.rotationMatrix(); } virtual bool read(std::istream &in) override { return true; } virtual bool write(std::ostream &out) const override { return true; } private: Mat33 _K; SE3 _cam_ext; }; }
8e814a1896ea3b04ac870c907dc01a9cb6438109
b9606c302edeb76b52ab22bdccd596d9f7a94209
/modules/task_2/sadikov_a_simple_method/simple_method.cpp
18e37853b2df1ce3f75740ad6daabf154fae1a6c
[]
no_license
DrXlor/pp_2019_autumn
31f68a32f2fc334f4ce534161fb32c8cb70baf1c
e01960c714ad1e86d68cbf3be551741106dc908d
refs/heads/master
2020-09-20T11:56:11.773825
2019-11-26T09:00:15
2019-11-26T09:00:15
224,469,332
2
0
null
2019-11-27T16:11:27
2019-11-27T16:11:26
null
UTF-8
C++
false
false
4,220
cpp
// Copyright 2019 Sadikov Artem #include <mpi.h> #include <vector> #include <random> #include <ctime> #include <cmath> #include "../../../modules/task_2/sadikov_a_simple_method/simple_method.h" std::vector<double> get_rand_matrix(int size) { if (size < 2) throw "ERR"; std::mt19937 gen; gen.seed(static_cast<double>(time(NULL))); std::vector<double> matrix(size * (size + 1)); for (int i = 0; i < size * (size + 1); i++) { matrix[i] = gen() % 20; } return matrix; } bool is_equal(std::vector<double> x, std::vector<double> y) { for (int i = 0; i < static_cast<int>(x.size()); i++) { if (!(std::fabs(x[i] - y[i]) < 1e-4)) return false; } return true; } std::vector<double> solve_simple(std::vector<double> delta_a, std::vector<double> x, double error, int size, int rank, int row_count, int size_proc) { std::vector<double> x_old(size); std::vector<double> temp(size); std::vector<int> sendcounts(size_proc); std::vector<int> displs(size_proc); // std::vector<double> val(size); int core; double norm = 0, val; MPI_Scan(&row_count, &core, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); core -= row_count; MPI_Allgather(&row_count, 1, MPI_INT, &sendcounts[0], 1, MPI_INT, MPI_COMM_WORLD); displs[0] = 0; for (int i = 1; i < size_proc; i++) { displs[i] = displs[i - 1] + sendcounts[i - 1]; } do { x_old = x; double sum; for (int i = 0; i < row_count; i++) { sum = 0.0; for (int j = 0; j < i + core; j++) { sum += delta_a[i * (size + 1) + j] * x_old[j]; } for (int j = 1 + core + i; j < size; j++) { sum += delta_a[i * (size + 1) + j] * x_old[j]; } x[i + core] = static_cast<double>(delta_a[i * (size + 1) + size] - sum) / static_cast<double>(delta_a[i * (size + 1) + i + core]); } MPI_Allgatherv(&x[0] + core, row_count, MPI_DOUBLE, &temp[0], &sendcounts[0], &displs[0], MPI_DOUBLE, MPI_COMM_WORLD); x = temp; norm = 0; if (rank == 0) { for (int i = 0; i < size; i++) { val = fabs(x[i] - x_old[i]); if (norm < val) norm = val; } } MPI_Bcast(&norm, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); } while (error < norm); return x; } std::vector<double> get_res(std::vector<double> matrix, int size, double error) { // std::cout << static_cast<int>(matrix.size()) << '\n'; if (size * (size + 1) != static_cast<int>(matrix.size())) throw "WRONG"; std::vector<double> MATRIX(size); int size_proc, rank, m_size; MPI_Comm_size(MPI_COMM_WORLD, &size_proc); MPI_Comm_rank(MPI_COMM_WORLD, &rank); int row_count, SIZE, eps; if (rank == 0) { m_size = size; eps = error; MATRIX = std::vector<double>(size * (size + 1)); for (int i = 0; i < size * (size + 1); i++) { MATRIX[i] = matrix[i]; } } MPI_Bcast(&m_size, 1, MPI_INT, 0, MPI_COMM_WORLD); MPI_Bcast(&eps, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); std::vector<double> x(m_size); MPI_Bcast(&x[0], m_size, MPI_DOUBLE, 0, MPI_COMM_WORLD); row_count = (m_size / size_proc) + ((m_size % size_proc) > rank ? 1 : 0); SIZE = (m_size + 1) * row_count; std::vector<int> sendcounts(size_proc); MPI_Gather(&SIZE, 1, MPI_INT, &sendcounts[0], 1, MPI_INT, 0, MPI_COMM_WORLD); std::vector<int> displs(size_proc); displs[0] = 0; for (int i = 1; i < size_proc; i++) { displs[i] = displs[i - 1] + sendcounts[i - 1]; } std::vector<double> delta_a((m_size + 1) * row_count + (row_count > 0 ? 0 : 1)); MPI_Scatterv(&MATRIX[0], &sendcounts[0], &displs[0], MPI_DOUBLE, &delta_a[0], SIZE, MPI_DOUBLE, 0, MPI_COMM_WORLD); x = solve_simple(delta_a, x, error, size, rank, row_count, size_proc); return x; }
9f4120c6d32ae4f30f1b75a6d8a0308f6b19e6cf
7f625e7aa6c037b387dc5b2d760b8218680f9933
/qframeconverter.h
4ac7b9b1a5e11fe49e4f65b006cc5b7c10f224f4
[ "BSD-2-Clause" ]
permissive
Kolkir/stereocam
bca4222ad7a52a28409a6ec119c76094e0486e9e
b5fa852c9bf5751c98871284d1523a652028749d
refs/heads/master
2021-05-04T10:11:51.445628
2016-12-27T20:56:03
2016-12-27T20:56:03
48,955,225
0
0
null
null
null
null
UTF-8
C++
false
false
698
h
#ifndef QFRAMECONVERTER_H #define QFRAMECONVERTER_H #include "framesource.h" #include <QObject> #include <qbasictimer.h> #include <opencv2/opencv.hpp> class QFrameConverter : public QObject { Q_OBJECT public: explicit QFrameConverter(QObject *parent = 0); explicit QFrameConverter(FrameSource& frameSOurce, QObject *parent = 0); void timerEvent(QTimerEvent * ev) override; Q_SIGNAL void imageReady(const QImage &); void stop(); void pause(bool val); void setFrameSource(FrameSource& frameSource); private: FrameSource* frameSource; QBasicTimer timer; cv::Mat frame; bool stopTimer; bool pauseProcessing; }; #endif // QFRAMECONVERTER_H
85c7fd1bfb66519f284633a6036cb33af5d34185
2db4f36dec08a6dfc427e2f264536d3425ef2bad
/qt_property_browser/src/qtgroupboxpropertybrowser.h
78b4a9b1013d93d46d332399e83334c0b0b5a7b7
[ "Apache-2.0" ]
permissive
ros-industrial-consortium/CAD-to-ROS
991a13932dabcc54b8e6da57c984db923a98b15c
1c5128e48f83f640d99d5e9cde7ccefc56bcf413
refs/heads/m1_merge_candidate_v2
2021-06-04T03:51:46.137937
2020-07-07T09:40:57
2020-07-07T09:40:57
49,906,461
12
10
Apache-2.0
2020-07-07T09:40:59
2016-01-18T21:27:48
C++
UTF-8
C++
false
false
2,909
h
/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Solutions component. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "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 Digia Plc and its Subsidiary(-ies) 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." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QTGROUPBOXPROPERTYBROWSER_H #define QTGROUPBOXPROPERTYBROWSER_H #include "qtpropertybrowser.h" #if QT_VERSION >= 0x040400 QT_BEGIN_NAMESPACE #endif class QtGroupBoxPropertyBrowserPrivate; class QT_QTPROPERTYBROWSER_EXPORT QtGroupBoxPropertyBrowser : public QtAbstractPropertyBrowser { Q_OBJECT public: QtGroupBoxPropertyBrowser(QWidget *parent = 0); ~QtGroupBoxPropertyBrowser(); protected: virtual void itemInserted(QtBrowserItem *item, QtBrowserItem *afterItem); virtual void itemRemoved(QtBrowserItem *item); virtual void itemChanged(QtBrowserItem *item); private: QtGroupBoxPropertyBrowserPrivate *d_ptr; Q_DECLARE_PRIVATE(QtGroupBoxPropertyBrowser) Q_DISABLE_COPY(QtGroupBoxPropertyBrowser) Q_PRIVATE_SLOT(d_func(), void slotUpdate()) Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed()) }; #if QT_VERSION >= 0x040400 QT_END_NAMESPACE #endif #endif
6fa6f21edade2b870de1d1e7e9e8bf8467d3e26e
c18ecd8ab305e21c3e6b8870105ad987113cfda5
/hdu/2084.cpp
e1e5078e873d86c7d5c010dbb5d60d386b010f7b
[]
no_license
stmatengss/ICPC_practice_code
4db71e5c54129901794d4d0df6a04ebd73818759
c09f95495d8b57eb6fa2602f0bd66bd30c8e4a0c
refs/heads/master
2021-01-12T05:58:59.350393
2016-12-24T04:35:19
2016-12-24T04:35:19
77,265,840
0
0
null
null
null
null
UTF-8
C++
false
false
1,211
cpp
////////////////////System Comment//////////////////// ////Welcome to Hangzhou Dianzi University Online Judge ////http://acm.hdu.edu.cn ////////////////////////////////////////////////////// ////Username: stmatengss ////Nickname: Stmatengss ////Run ID: ////Submit time: 2015-10-06 15:21:47 ////Compiler: Visual C++ ////////////////////////////////////////////////////// ////Problem ID: 2084 ////Problem Title: ////Run result: Accept ////Run time:234MS ////Run memory:1848KB //////////////////System Comment End////////////////// #include <iostream> #include <cstring> #include <algorithm> using namespace std; int dp[104][104]; int num[104][104]; int n; int dfs(int x,int y) { if(x==n) { return num[x][y]; } if(dp[x][y]) return dp[x][y]; return dp[x][y]=max(dfs(x+1,y),dfs(x+1,y+1))+num[x][y]; } int main() { int i,j; int t; cin>>t; while(t--) { cin>>n; memset(dp,0,sizeof(dp)); for(i=1;i<=n;i++) { for(j=1;j<=i;j++) cin>>num[i][j]; } cout<<dfs(1,1)<<endl; } // cout << "Hello world!" << endl; return 0; }
a7ac92c56f63e8e01badd7d7fed8c691bf132b65
db90fc85e14efc29bf969dd738e50981e4a879ee
/player_abstract.cpp
52420958da9fa35f880895c800f9cb6d4fbb46fb
[]
no_license
ChrisQWu/Stellar_Draft
b4cac6290b190086cbbeb4ab0d906c620819e3b3
8c9ac02267ee4bac812566ddd1fcbfaa63c1532b
refs/heads/master
2020-09-11T10:32:46.254124
2019-11-25T20:12:01
2019-11-25T20:12:01
222,036,442
0
0
null
null
null
null
UTF-8
C++
false
false
30
cpp
#include "player_abstract.h"
1e3b7a3d11ccc3645252942feda59ed6e09f8e84
5715f2b26a4b5f63aff783d8496a5247f8cc649e
/include/disruptor/sequence.hpp
3185bd916cae8f93ed9d7293ed07e976074851b5
[]
no_license
shangmacun/disruptor_cpp
011597dd273c3ea30c5f1c5ac427bfb99b9f6fc8
be28661bb6bdb6ee9878557dd62937e31a1de0c1
refs/heads/master
2021-01-20T01:50:20.488880
2014-11-14T07:31:22
2014-11-14T07:31:22
null
0
0
null
null
null
null
UTF-8
C++
false
false
497
hpp
#pragma once #include <atomic> class sequence { public: sequence(); void set( int64_t ); int64_t get() const; private: int64_t _val; }; inline sequence::sequence() { set( -1 ); } inline int64_t sequence::get() const { std::atomic_thread_fence( std::memory_order::memory_order_acquire ); return _val; } inline void sequence::set( int64_t n ) { std::atomic_thread_fence( std::memory_order::memory_order_release ); _val = n; }
0d84d4fa126a8d8d270709120ed5e5ed5a277ce2
d99fc93689445f7c5070b9efb1ecd3761fb835bc
/easy/id_173.cpp
4b0a890e16d7764c1372d6a99cb9185ea1f46625
[]
no_license
LS-01/HZOJ
044a67acdabad13279cf1169a6592481ce5e002c
a049d56534c51d5f679e39e65e1b5752f7dec438
refs/heads/master
2023-06-06T23:03:48.218068
2021-07-05T06:28:57
2021-07-05T06:28:57
295,476,895
0
0
null
null
null
null
UTF-8
C++
false
false
813
cpp
/************************************************************************* > File Name: id_173.cpp > Author: ls > Mail: > Created Time: Mon 12 Oct 2020 06:48:09 PM CST ************************************************************************/ #include <iostream> using namespace std; int main() { string s; int c_cou = 0, n_cou = 0, s_cou = 0, o_cou = 0; getline(cin, s); int i = 0; while (s[i] != '\0') { if ((s[i] >= 'a' && s[i] <= 'z') || (s[i] >= 'A' && s[i] <= 'Z')) { c_cou++; } else if (s[i] >= '0' && s[i] <= '9') { n_cou++; } else if (s[i] == ' ') { s_cou++; } else { o_cou++; } i++; } cout << c_cou << " " << n_cou << " " << s_cou << " " << o_cou << endl; return 0; }
4cdc64d933c1656260024b95e78138b3a89fc44c
6e5c1aa6ef54598e95ba8cb00e244703fe63bcfa
/aws-cpp-sdk-codestar-notifications/source/CodeStarNotificationsClient.cpp
34d5da876123125330eccef0c1197387e6363016
[ "Apache-2.0", "MIT", "JSON" ]
permissive
cosu/aws-sdk-cpp
d6a677a2ff8f16a28c2a68f30cadfec57bc9dd63
50adfe2b3a2429a65d51a408a091157dc322241f
refs/heads/master
2022-11-29T13:49:40.264464
2020-08-05T09:28:47
2020-08-05T15:54:06
285,240,910
0
0
Apache-2.0
2020-08-05T09:24:28
2020-08-05T09:24:27
null
UTF-8
C++
false
false
23,342
cpp
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/core/utils/Outcome.h> #include <aws/core/auth/AWSAuthSigner.h> #include <aws/core/client/CoreErrors.h> #include <aws/core/client/RetryStrategy.h> #include <aws/core/http/HttpClient.h> #include <aws/core/http/HttpResponse.h> #include <aws/core/http/HttpClientFactory.h> #include <aws/core/auth/AWSCredentialsProviderChain.h> #include <aws/core/utils/json/JsonSerializer.h> #include <aws/core/utils/memory/stl/AWSStringStream.h> #include <aws/core/utils/threading/Executor.h> #include <aws/core/utils/DNS.h> #include <aws/core/utils/logging/LogMacros.h> #include <aws/codestar-notifications/CodeStarNotificationsClient.h> #include <aws/codestar-notifications/CodeStarNotificationsEndpoint.h> #include <aws/codestar-notifications/CodeStarNotificationsErrorMarshaller.h> #include <aws/codestar-notifications/model/CreateNotificationRuleRequest.h> #include <aws/codestar-notifications/model/DeleteNotificationRuleRequest.h> #include <aws/codestar-notifications/model/DeleteTargetRequest.h> #include <aws/codestar-notifications/model/DescribeNotificationRuleRequest.h> #include <aws/codestar-notifications/model/ListEventTypesRequest.h> #include <aws/codestar-notifications/model/ListNotificationRulesRequest.h> #include <aws/codestar-notifications/model/ListTagsForResourceRequest.h> #include <aws/codestar-notifications/model/ListTargetsRequest.h> #include <aws/codestar-notifications/model/SubscribeRequest.h> #include <aws/codestar-notifications/model/TagResourceRequest.h> #include <aws/codestar-notifications/model/UnsubscribeRequest.h> #include <aws/codestar-notifications/model/UntagResourceRequest.h> #include <aws/codestar-notifications/model/UpdateNotificationRuleRequest.h> using namespace Aws; using namespace Aws::Auth; using namespace Aws::Client; using namespace Aws::CodeStarNotifications; using namespace Aws::CodeStarNotifications::Model; using namespace Aws::Http; using namespace Aws::Utils::Json; static const char* SERVICE_NAME = "codestar-notifications"; static const char* ALLOCATION_TAG = "CodeStarNotificationsClient"; CodeStarNotificationsClient::CodeStarNotificationsClient(const Client::ClientConfiguration& clientConfiguration) : BASECLASS(clientConfiguration, Aws::MakeShared<AWSAuthV4Signer>(ALLOCATION_TAG, Aws::MakeShared<DefaultAWSCredentialsProviderChain>(ALLOCATION_TAG), SERVICE_NAME, Aws::Region::ComputeSignerRegion(clientConfiguration.region)), Aws::MakeShared<CodeStarNotificationsErrorMarshaller>(ALLOCATION_TAG)), m_executor(clientConfiguration.executor) { init(clientConfiguration); } CodeStarNotificationsClient::CodeStarNotificationsClient(const AWSCredentials& credentials, const Client::ClientConfiguration& clientConfiguration) : BASECLASS(clientConfiguration, Aws::MakeShared<AWSAuthV4Signer>(ALLOCATION_TAG, Aws::MakeShared<SimpleAWSCredentialsProvider>(ALLOCATION_TAG, credentials), SERVICE_NAME, Aws::Region::ComputeSignerRegion(clientConfiguration.region)), Aws::MakeShared<CodeStarNotificationsErrorMarshaller>(ALLOCATION_TAG)), m_executor(clientConfiguration.executor) { init(clientConfiguration); } CodeStarNotificationsClient::CodeStarNotificationsClient(const std::shared_ptr<AWSCredentialsProvider>& credentialsProvider, const Client::ClientConfiguration& clientConfiguration) : BASECLASS(clientConfiguration, Aws::MakeShared<AWSAuthV4Signer>(ALLOCATION_TAG, credentialsProvider, SERVICE_NAME, Aws::Region::ComputeSignerRegion(clientConfiguration.region)), Aws::MakeShared<CodeStarNotificationsErrorMarshaller>(ALLOCATION_TAG)), m_executor(clientConfiguration.executor) { init(clientConfiguration); } CodeStarNotificationsClient::~CodeStarNotificationsClient() { } void CodeStarNotificationsClient::init(const ClientConfiguration& config) { m_configScheme = SchemeMapper::ToString(config.scheme); if (config.endpointOverride.empty()) { m_uri = m_configScheme + "://" + CodeStarNotificationsEndpoint::ForRegion(config.region, config.useDualStack); } else { OverrideEndpoint(config.endpointOverride); } } void CodeStarNotificationsClient::OverrideEndpoint(const Aws::String& endpoint) { if (endpoint.compare(0, 7, "http://") == 0 || endpoint.compare(0, 8, "https://") == 0) { m_uri = endpoint; } else { m_uri = m_configScheme + "://" + endpoint; } } CreateNotificationRuleOutcome CodeStarNotificationsClient::CreateNotificationRule(const CreateNotificationRuleRequest& request) const { Aws::Http::URI uri = m_uri; Aws::StringStream ss; ss << "/createNotificationRule"; uri.SetPath(uri.GetPath() + ss.str()); return CreateNotificationRuleOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER)); } CreateNotificationRuleOutcomeCallable CodeStarNotificationsClient::CreateNotificationRuleCallable(const CreateNotificationRuleRequest& request) const { auto task = Aws::MakeShared< std::packaged_task< CreateNotificationRuleOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->CreateNotificationRule(request); } ); auto packagedFunction = [task]() { (*task)(); }; m_executor->Submit(packagedFunction); return task->get_future(); } void CodeStarNotificationsClient::CreateNotificationRuleAsync(const CreateNotificationRuleRequest& request, const CreateNotificationRuleResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const { m_executor->Submit( [this, request, handler, context](){ this->CreateNotificationRuleAsyncHelper( request, handler, context ); } ); } void CodeStarNotificationsClient::CreateNotificationRuleAsyncHelper(const CreateNotificationRuleRequest& request, const CreateNotificationRuleResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const { handler(this, request, CreateNotificationRule(request), context); } DeleteNotificationRuleOutcome CodeStarNotificationsClient::DeleteNotificationRule(const DeleteNotificationRuleRequest& request) const { Aws::Http::URI uri = m_uri; Aws::StringStream ss; ss << "/deleteNotificationRule"; uri.SetPath(uri.GetPath() + ss.str()); return DeleteNotificationRuleOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER)); } DeleteNotificationRuleOutcomeCallable CodeStarNotificationsClient::DeleteNotificationRuleCallable(const DeleteNotificationRuleRequest& request) const { auto task = Aws::MakeShared< std::packaged_task< DeleteNotificationRuleOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->DeleteNotificationRule(request); } ); auto packagedFunction = [task]() { (*task)(); }; m_executor->Submit(packagedFunction); return task->get_future(); } void CodeStarNotificationsClient::DeleteNotificationRuleAsync(const DeleteNotificationRuleRequest& request, const DeleteNotificationRuleResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const { m_executor->Submit( [this, request, handler, context](){ this->DeleteNotificationRuleAsyncHelper( request, handler, context ); } ); } void CodeStarNotificationsClient::DeleteNotificationRuleAsyncHelper(const DeleteNotificationRuleRequest& request, const DeleteNotificationRuleResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const { handler(this, request, DeleteNotificationRule(request), context); } DeleteTargetOutcome CodeStarNotificationsClient::DeleteTarget(const DeleteTargetRequest& request) const { Aws::Http::URI uri = m_uri; Aws::StringStream ss; ss << "/deleteTarget"; uri.SetPath(uri.GetPath() + ss.str()); return DeleteTargetOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER)); } DeleteTargetOutcomeCallable CodeStarNotificationsClient::DeleteTargetCallable(const DeleteTargetRequest& request) const { auto task = Aws::MakeShared< std::packaged_task< DeleteTargetOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->DeleteTarget(request); } ); auto packagedFunction = [task]() { (*task)(); }; m_executor->Submit(packagedFunction); return task->get_future(); } void CodeStarNotificationsClient::DeleteTargetAsync(const DeleteTargetRequest& request, const DeleteTargetResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const { m_executor->Submit( [this, request, handler, context](){ this->DeleteTargetAsyncHelper( request, handler, context ); } ); } void CodeStarNotificationsClient::DeleteTargetAsyncHelper(const DeleteTargetRequest& request, const DeleteTargetResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const { handler(this, request, DeleteTarget(request), context); } DescribeNotificationRuleOutcome CodeStarNotificationsClient::DescribeNotificationRule(const DescribeNotificationRuleRequest& request) const { Aws::Http::URI uri = m_uri; Aws::StringStream ss; ss << "/describeNotificationRule"; uri.SetPath(uri.GetPath() + ss.str()); return DescribeNotificationRuleOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER)); } DescribeNotificationRuleOutcomeCallable CodeStarNotificationsClient::DescribeNotificationRuleCallable(const DescribeNotificationRuleRequest& request) const { auto task = Aws::MakeShared< std::packaged_task< DescribeNotificationRuleOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->DescribeNotificationRule(request); } ); auto packagedFunction = [task]() { (*task)(); }; m_executor->Submit(packagedFunction); return task->get_future(); } void CodeStarNotificationsClient::DescribeNotificationRuleAsync(const DescribeNotificationRuleRequest& request, const DescribeNotificationRuleResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const { m_executor->Submit( [this, request, handler, context](){ this->DescribeNotificationRuleAsyncHelper( request, handler, context ); } ); } void CodeStarNotificationsClient::DescribeNotificationRuleAsyncHelper(const DescribeNotificationRuleRequest& request, const DescribeNotificationRuleResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const { handler(this, request, DescribeNotificationRule(request), context); } ListEventTypesOutcome CodeStarNotificationsClient::ListEventTypes(const ListEventTypesRequest& request) const { Aws::Http::URI uri = m_uri; Aws::StringStream ss; ss << "/listEventTypes"; uri.SetPath(uri.GetPath() + ss.str()); return ListEventTypesOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER)); } ListEventTypesOutcomeCallable CodeStarNotificationsClient::ListEventTypesCallable(const ListEventTypesRequest& request) const { auto task = Aws::MakeShared< std::packaged_task< ListEventTypesOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->ListEventTypes(request); } ); auto packagedFunction = [task]() { (*task)(); }; m_executor->Submit(packagedFunction); return task->get_future(); } void CodeStarNotificationsClient::ListEventTypesAsync(const ListEventTypesRequest& request, const ListEventTypesResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const { m_executor->Submit( [this, request, handler, context](){ this->ListEventTypesAsyncHelper( request, handler, context ); } ); } void CodeStarNotificationsClient::ListEventTypesAsyncHelper(const ListEventTypesRequest& request, const ListEventTypesResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const { handler(this, request, ListEventTypes(request), context); } ListNotificationRulesOutcome CodeStarNotificationsClient::ListNotificationRules(const ListNotificationRulesRequest& request) const { Aws::Http::URI uri = m_uri; Aws::StringStream ss; ss << "/listNotificationRules"; uri.SetPath(uri.GetPath() + ss.str()); return ListNotificationRulesOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER)); } ListNotificationRulesOutcomeCallable CodeStarNotificationsClient::ListNotificationRulesCallable(const ListNotificationRulesRequest& request) const { auto task = Aws::MakeShared< std::packaged_task< ListNotificationRulesOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->ListNotificationRules(request); } ); auto packagedFunction = [task]() { (*task)(); }; m_executor->Submit(packagedFunction); return task->get_future(); } void CodeStarNotificationsClient::ListNotificationRulesAsync(const ListNotificationRulesRequest& request, const ListNotificationRulesResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const { m_executor->Submit( [this, request, handler, context](){ this->ListNotificationRulesAsyncHelper( request, handler, context ); } ); } void CodeStarNotificationsClient::ListNotificationRulesAsyncHelper(const ListNotificationRulesRequest& request, const ListNotificationRulesResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const { handler(this, request, ListNotificationRules(request), context); } ListTagsForResourceOutcome CodeStarNotificationsClient::ListTagsForResource(const ListTagsForResourceRequest& request) const { Aws::Http::URI uri = m_uri; Aws::StringStream ss; ss << "/listTagsForResource"; uri.SetPath(uri.GetPath() + ss.str()); return ListTagsForResourceOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER)); } ListTagsForResourceOutcomeCallable CodeStarNotificationsClient::ListTagsForResourceCallable(const ListTagsForResourceRequest& request) const { auto task = Aws::MakeShared< std::packaged_task< ListTagsForResourceOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->ListTagsForResource(request); } ); auto packagedFunction = [task]() { (*task)(); }; m_executor->Submit(packagedFunction); return task->get_future(); } void CodeStarNotificationsClient::ListTagsForResourceAsync(const ListTagsForResourceRequest& request, const ListTagsForResourceResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const { m_executor->Submit( [this, request, handler, context](){ this->ListTagsForResourceAsyncHelper( request, handler, context ); } ); } void CodeStarNotificationsClient::ListTagsForResourceAsyncHelper(const ListTagsForResourceRequest& request, const ListTagsForResourceResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const { handler(this, request, ListTagsForResource(request), context); } ListTargetsOutcome CodeStarNotificationsClient::ListTargets(const ListTargetsRequest& request) const { Aws::Http::URI uri = m_uri; Aws::StringStream ss; ss << "/listTargets"; uri.SetPath(uri.GetPath() + ss.str()); return ListTargetsOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER)); } ListTargetsOutcomeCallable CodeStarNotificationsClient::ListTargetsCallable(const ListTargetsRequest& request) const { auto task = Aws::MakeShared< std::packaged_task< ListTargetsOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->ListTargets(request); } ); auto packagedFunction = [task]() { (*task)(); }; m_executor->Submit(packagedFunction); return task->get_future(); } void CodeStarNotificationsClient::ListTargetsAsync(const ListTargetsRequest& request, const ListTargetsResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const { m_executor->Submit( [this, request, handler, context](){ this->ListTargetsAsyncHelper( request, handler, context ); } ); } void CodeStarNotificationsClient::ListTargetsAsyncHelper(const ListTargetsRequest& request, const ListTargetsResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const { handler(this, request, ListTargets(request), context); } SubscribeOutcome CodeStarNotificationsClient::Subscribe(const SubscribeRequest& request) const { Aws::Http::URI uri = m_uri; Aws::StringStream ss; ss << "/subscribe"; uri.SetPath(uri.GetPath() + ss.str()); return SubscribeOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER)); } SubscribeOutcomeCallable CodeStarNotificationsClient::SubscribeCallable(const SubscribeRequest& request) const { auto task = Aws::MakeShared< std::packaged_task< SubscribeOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->Subscribe(request); } ); auto packagedFunction = [task]() { (*task)(); }; m_executor->Submit(packagedFunction); return task->get_future(); } void CodeStarNotificationsClient::SubscribeAsync(const SubscribeRequest& request, const SubscribeResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const { m_executor->Submit( [this, request, handler, context](){ this->SubscribeAsyncHelper( request, handler, context ); } ); } void CodeStarNotificationsClient::SubscribeAsyncHelper(const SubscribeRequest& request, const SubscribeResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const { handler(this, request, Subscribe(request), context); } TagResourceOutcome CodeStarNotificationsClient::TagResource(const TagResourceRequest& request) const { Aws::Http::URI uri = m_uri; Aws::StringStream ss; ss << "/tagResource"; uri.SetPath(uri.GetPath() + ss.str()); return TagResourceOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER)); } TagResourceOutcomeCallable CodeStarNotificationsClient::TagResourceCallable(const TagResourceRequest& request) const { auto task = Aws::MakeShared< std::packaged_task< TagResourceOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->TagResource(request); } ); auto packagedFunction = [task]() { (*task)(); }; m_executor->Submit(packagedFunction); return task->get_future(); } void CodeStarNotificationsClient::TagResourceAsync(const TagResourceRequest& request, const TagResourceResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const { m_executor->Submit( [this, request, handler, context](){ this->TagResourceAsyncHelper( request, handler, context ); } ); } void CodeStarNotificationsClient::TagResourceAsyncHelper(const TagResourceRequest& request, const TagResourceResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const { handler(this, request, TagResource(request), context); } UnsubscribeOutcome CodeStarNotificationsClient::Unsubscribe(const UnsubscribeRequest& request) const { Aws::Http::URI uri = m_uri; Aws::StringStream ss; ss << "/unsubscribe"; uri.SetPath(uri.GetPath() + ss.str()); return UnsubscribeOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER)); } UnsubscribeOutcomeCallable CodeStarNotificationsClient::UnsubscribeCallable(const UnsubscribeRequest& request) const { auto task = Aws::MakeShared< std::packaged_task< UnsubscribeOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->Unsubscribe(request); } ); auto packagedFunction = [task]() { (*task)(); }; m_executor->Submit(packagedFunction); return task->get_future(); } void CodeStarNotificationsClient::UnsubscribeAsync(const UnsubscribeRequest& request, const UnsubscribeResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const { m_executor->Submit( [this, request, handler, context](){ this->UnsubscribeAsyncHelper( request, handler, context ); } ); } void CodeStarNotificationsClient::UnsubscribeAsyncHelper(const UnsubscribeRequest& request, const UnsubscribeResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const { handler(this, request, Unsubscribe(request), context); } UntagResourceOutcome CodeStarNotificationsClient::UntagResource(const UntagResourceRequest& request) const { Aws::Http::URI uri = m_uri; Aws::StringStream ss; ss << "/untagResource"; uri.SetPath(uri.GetPath() + ss.str()); return UntagResourceOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER)); } UntagResourceOutcomeCallable CodeStarNotificationsClient::UntagResourceCallable(const UntagResourceRequest& request) const { auto task = Aws::MakeShared< std::packaged_task< UntagResourceOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->UntagResource(request); } ); auto packagedFunction = [task]() { (*task)(); }; m_executor->Submit(packagedFunction); return task->get_future(); } void CodeStarNotificationsClient::UntagResourceAsync(const UntagResourceRequest& request, const UntagResourceResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const { m_executor->Submit( [this, request, handler, context](){ this->UntagResourceAsyncHelper( request, handler, context ); } ); } void CodeStarNotificationsClient::UntagResourceAsyncHelper(const UntagResourceRequest& request, const UntagResourceResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const { handler(this, request, UntagResource(request), context); } UpdateNotificationRuleOutcome CodeStarNotificationsClient::UpdateNotificationRule(const UpdateNotificationRuleRequest& request) const { Aws::Http::URI uri = m_uri; Aws::StringStream ss; ss << "/updateNotificationRule"; uri.SetPath(uri.GetPath() + ss.str()); return UpdateNotificationRuleOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER)); } UpdateNotificationRuleOutcomeCallable CodeStarNotificationsClient::UpdateNotificationRuleCallable(const UpdateNotificationRuleRequest& request) const { auto task = Aws::MakeShared< std::packaged_task< UpdateNotificationRuleOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->UpdateNotificationRule(request); } ); auto packagedFunction = [task]() { (*task)(); }; m_executor->Submit(packagedFunction); return task->get_future(); } void CodeStarNotificationsClient::UpdateNotificationRuleAsync(const UpdateNotificationRuleRequest& request, const UpdateNotificationRuleResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const { m_executor->Submit( [this, request, handler, context](){ this->UpdateNotificationRuleAsyncHelper( request, handler, context ); } ); } void CodeStarNotificationsClient::UpdateNotificationRuleAsyncHelper(const UpdateNotificationRuleRequest& request, const UpdateNotificationRuleResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const { handler(this, request, UpdateNotificationRule(request), context); }
2005f5a7145032044fb6da6e23cb8a114bb9e3f4
7f81118aa9cdb71774c0591bf04d8b8ce25298f4
/obscurer/include/NXRunAction.hh
4b54b443e8cf28f46c1f033114a7c112756a0028
[ "BSD-2-Clause" ]
permissive
maxwell-herrmann/geant4-simple-examples
571688ea47fb13f879e3b9682e3bd12995ec5ce5
0052d40fdc05baef05b4a6873c03d0d54885ad40
refs/heads/master
2022-09-14T02:09:49.571155
2020-05-29T18:26:29
2020-05-29T18:26:29
267,653,466
0
0
BSD-2-Clause
2020-05-28T17:30:03
2020-05-28T17:30:03
null
UTF-8
C++
false
false
335
hh
#ifndef NXRunAction_h #define NXRunAction_h 1 #include "G4UserRunAction.hh" #include "globals.hh" class G4Run; class NXRunAction : public G4UserRunAction { public: NXRunAction(); ~NXRunAction(); public: void BeginOfRunAction(const G4Run*); void EndOfRunAction(const G4Run*); }; #endif
caaf1e0ccbe96cd546533bf4b2a83e4a23255de3
b08511bd276b5a07752f1b62d90fb873dc9d17c9
/test/pair.cpp
1b04065b1c238680e60a214d66c16b7fabbccec9
[ "BSL-1.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
zussel/hana
46d6f756585c6c69ebf177901d1f0673f8fa440a
2098e4b1a9484d304868b59169750922489b38ad
refs/heads/master
2020-12-25T06:43:22.842700
2015-09-04T15:01:27
2015-09-04T15:01:27
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,626
cpp
/* @copyright Louis Dionne 2015 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ #include <boost/hana.hpp> #include <boost/hana/pair.hpp> #include <boost/hana/assert.hpp> #include <boost/hana/tuple.hpp> #include <laws/base.hpp> #include <laws/comparable.hpp> #include <laws/foldable.hpp> #include <laws/orderable.hpp> #include <laws/product.hpp> using namespace boost::hana; using test::ct_eq; using test::ct_ord; struct NoDefault { explicit NoDefault(int) { } NoDefault() = delete; }; int main() { ////////////////////////////////////////////////////////////////////////// // Creation ////////////////////////////////////////////////////////////////////////// { // Implicit and explicit construction { constexpr pair<int, char> p1{1, '2'}; (void)p1; constexpr pair<int, char> p2 = {1, '2'}; (void)p2; } // default constructibility { struct default_constr { default_constr() = default; default_constr(default_constr const&) = delete; default_constr(default_constr &&) = delete; }; constexpr pair<default_constr, default_constr> p; (void)p; } // pair with non default-constructible elements { struct no_default { no_default() = delete; constexpr no_default(int) { } }; constexpr pair<no_default, no_default> p{1, 1}; (void)p; } // pair with non-constexpr default-constructible elements { struct non_constexpr { non_constexpr() { } }; pair<non_constexpr, non_constexpr> p; (void)p; } // Make sure we do not instantiate wrong constructors when copying { pair<test::trap_construct, int> expr{}; auto implicit_copy = expr; (void)implicit_copy; decltype(expr) explicit_copy(expr); (void)explicit_copy; } // Make sure the storage of a pair is compressed { struct empty { }; static_assert(sizeof(pair<empty, int>) == sizeof(int), ""); static_assert(sizeof(pair<int, empty>) == sizeof(int), ""); } // Make sure we can put non default-constructible elements in a pair. { pair<NoDefault, NoDefault> p{1, 2}; (void)p; } } auto eq_elems = make<tuple_tag>(ct_eq<3>{}, ct_eq<4>{}); auto eqs = make<tuple_tag>( make_pair(ct_eq<3>{}, ct_eq<3>{}) , make_pair(ct_eq<3>{}, ct_eq<4>{}) , make_pair(ct_eq<4>{}, ct_eq<3>{}) , make_pair(ct_eq<4>{}, ct_eq<4>{}) ); auto ords = make<tuple_tag>( make_pair(ct_ord<3>{}, ct_ord<3>{}) , make_pair(ct_ord<3>{}, ct_ord<4>{}) , make_pair(ct_ord<4>{}, ct_ord<3>{}) , make_pair(ct_ord<4>{}, ct_ord<4>{}) ); ////////////////////////////////////////////////////////////////////////// // make_pair ////////////////////////////////////////////////////////////////////////// BOOST_HANA_CONSTANT_CHECK(equal( make<pair_tag>(ct_eq<1>{}, ct_eq<2>{}), make_pair(ct_eq<1>{}, ct_eq<2>{}) )); ////////////////////////////////////////////////////////////////////////// // Comparable ////////////////////////////////////////////////////////////////////////// { BOOST_HANA_CONSTANT_CHECK( make_pair(ct_eq<1>{}, ct_eq<2>{}) == make_pair(ct_eq<1>{}, ct_eq<2>{}) ); BOOST_HANA_CONSTANT_CHECK( make_pair(ct_eq<1>{}, ct_eq<3>{}) != make_pair(ct_eq<1>{}, ct_eq<2>{}) ); test::TestComparable<pair_tag>{eqs}; } ////////////////////////////////////////////////////////////////////////// // Orderable ////////////////////////////////////////////////////////////////////////// { BOOST_HANA_CONSTANT_CHECK( make_pair(ct_ord<1>{}, ct_ord<2>{}) < make_pair(ct_ord<3>{}, ct_ord<2>{}) ); BOOST_HANA_CONSTANT_CHECK( make_pair(ct_ord<1>{}, ct_ord<2>{}) <= make_pair(ct_ord<3>{}, ct_ord<2>{}) ); BOOST_HANA_CONSTANT_CHECK( make_pair(ct_ord<3>{}, ct_ord<2>{}) >= make_pair(ct_ord<1>{}, ct_ord<2>{}) ); BOOST_HANA_CONSTANT_CHECK( make_pair(ct_ord<3>{}, ct_ord<2>{}) > make_pair(ct_ord<1>{}, ct_ord<2>{}) ); test::TestOrderable<pair_tag>{ords}; } ////////////////////////////////////////////////////////////////////////// // Foldable ////////////////////////////////////////////////////////////////////////// test::TestFoldable<pair_tag>{eqs}; ////////////////////////////////////////////////////////////////////////// // Product ////////////////////////////////////////////////////////////////////////// { // first { BOOST_HANA_CONSTANT_CHECK(equal( first(make_pair(ct_eq<1>{}, ct_eq<2>{})), ct_eq<1>{} )); } // second { BOOST_HANA_CONSTANT_CHECK(equal( second(make_pair(ct_eq<1>{}, ct_eq<2>{})), ct_eq<2>{} )); } // make { constexpr pair<int, char> p = make<pair_tag>(1, 'x'); static_assert(first(p) == 1, ""); static_assert(second(p) == 'x', ""); } // laws test::TestProduct<pair_tag>{eq_elems}; } }
65dad9947d1e7b5553e184b631e2d8362673827d
ebbfa162f63661c6d89bc99053248d60f6100e3c
/src/Module/Utils/TimedTask.h
595e29b08e04bc382deeb2f0e8c2c29bb846fa3b
[]
no_license
leafletC/DeviceMonitor
02da60fb8fbc50cbbb73b4aead3f46700ed02600
f0b8f4ea8469c8fd3051cfc94cb9c2ab6cd9b32c
refs/heads/master
2023-01-23T06:18:30.709470
2020-12-04T03:53:53
2020-12-04T03:53:53
318,396,619
0
0
null
null
null
null
UTF-8
C++
false
false
860
h
#pragma once #include <chrono> #include <functional> using namespace std; using namespace chrono; class TimedTask { public: using Fn = function<void(void)>; using TimeDuration = seconds; using TimePoint = time_point<steady_clock, TimeDuration>; struct Option { Fn fn; uint32_t taskId; TimePoint timePoint; TimeDuration timeDuration; }; TimedTask(uint32_t taskId, Fn fn, const TimePoint &timePoint); TimedTask(uint32_t taskId, Fn fn, const TimeDuration &timeDuration); TimedTask(uint32_t taskId, Fn fn, const TimePoint &timePoint, const TimeDuration &timeDuration); void run(); void setTimePoint(const TimePoint &timePoint); void setTimeDuration(const TimeDuration &timeDuration); uint32_t getTaskId(); private: bool isPermit(); void reflesh(); Option option; };
cbacd6c69f24d8a70c067ad0c58251d79cd23a4f
aadb6699a9f810e71f45291cdd47c57c37d9b601
/src/change.h
70cfb6207fb3a56b268622a12b92b0e899c99291
[ "MIT" ]
permissive
janreerink/CarND-Path-Planning-Project
cdb8f6b3ae5564f52dec5f103d28654e3688e256
ef9d3f19603cdde3096c5f4bd25ab4f1679c619a
refs/heads/master
2021-04-27T00:18:14.204307
2018-03-18T18:55:03
2018-03-18T18:55:03
123,790,212
0
0
MIT
2018-03-04T13:17:17
2018-03-04T13:17:17
null
UTF-8
C++
false
false
543
h
#ifndef CHANGE_H #define CHANGE_H #include <list> #include <vector> #include <algorithm> using namespace std; //check other lanes for faster progress and whether save to switch, if so, return best lane id double consider_change(int lane, vector<vector<double>> sensor_fusion, double current_speed, double car_s, int prev_size, double same_lane_dist); // identify lane changes by other vehicles, return true if found bool find_lane_change(int lane, vector<vector<double>> sensor_fusion, int prev_size, double car_s); #endif /* CHANGE_H*/
74b22052e6c2f69ab384dac0077f45230768c851
3d9b6d4bbad9c71c02513435df5c879bf0bb4009
/src/mqtt-gateway-with-temp.ino
dea30af7e0dc05c13be50a81e67319959dd7f9f3
[ "MIT" ]
permissive
Minimad-Diver/mqtt-433mhz-gateway-homie
809ffcd3484bff938e8c7267b7d1f35aa040b241
ba0c4de56a973c14c50372c7c77b0595932be19c
refs/heads/master
2020-03-30T03:49:54.227618
2017-09-20T20:17:59
2017-09-20T20:17:59
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,024
ino
#include <Adafruit_BMP085_U.h> #include <Adafruit_Sensor.h> #include <Homie.h> #include <RCSwitch.h> #include <Wire.h> // temp sensor Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10085); unsigned long lastTemperatureSent = 0; const int DEFAULT_TEMPERATURE_INTERVAL = 10; const double DEFAULT_TEMPERATURE_OFFSET = 0; // homie nodes & settings HomieNode temperatureNode("temperature", "temperature"); HomieNode rfSwitchNode("MQTTto433", "switch"); HomieNode rfReceiverNode("433toMQTT", "switch"); HomieSetting<long> temperatureIntervalSetting("temperatureInterval", "The temperature interval in seconds"); HomieSetting<double> temperatureOffsetSetting("temperatureOffset", "The temperature offset in degrees"); HomieSetting<const char *> channelMappingSetting("channels", "Mapping of 433MHz signals to mqtt channel."); // RF Switch RCSwitch mySwitch = RCSwitch(); void setupHandler() { temperatureNode.setProperty("unit").send("c"); } void loopHandler() { if (millis() - lastTemperatureSent >= temperatureIntervalSetting.get() * 1000UL || lastTemperatureSent == 0) { float temperature = 0; sensors_event_t event; bmp.getEvent(&event); if (event.pressure) { Serial << "Pressure: " << event.pressure << " hPa" << endl; bmp.getTemperature(&temperature); Serial << "Temperature: " << temperature << " °C" << endl; temperature += temperatureOffsetSetting.get(); Serial << "Temperature (after offset): " << temperature << " °C" << endl; } else { Serial << "Sensor error" << endl; } temperatureNode.setProperty("degrees").send(String(temperature)); lastTemperatureSent = millis(); } if (mySwitch.available()) { long data = mySwitch.getReceivedValue(); mySwitch.resetAvailable(); Serial << "Receiving 433Mhz > MQTT signal: " << data << endl; String currentCode = String(data); String channelId = getChannelByCode(currentCode); Serial << "Code: " << currentCode << " matched to channel " << channelId << endl; rfReceiverNode.setProperty("channel-" + channelId).send(currentCode); } } String getChannelByCode(const String &currentCode) { String mappingConfig = channelMappingSetting.get(); String mapping = ""; String codes = ""; int lastIndex = 0; int lastCodeIndex = 0; for (int i = 0; i < mappingConfig.length(); i++) { if (mappingConfig.substring(i, i + 1) == ";") { mapping = mappingConfig.substring(lastIndex, i); // Serial << "mapping: " << mapping << endl; codes = mapping.substring(mapping.indexOf(':') + 2, mapping.length() - 1); for (int j = 0; j < codes.length(); j++) { if (codes.substring(j, j + 1) == ",") { if (currentCode.indexOf(codes.substring(lastCodeIndex, j)) > -1) { return mapping.substring(0, mapping.indexOf(':')); ; } codes = codes.substring(j + 1, codes.length()); } } if (currentCode.indexOf(codes) > -1) { return mapping.substring(0, mapping.indexOf(':')); ; } lastIndex = i + 1; } } return "0"; } bool rfSwitchOnHandler(const HomieRange &range, const String &value) { long int data = 0; int pulseLength = 350; if (value.indexOf(',') > 0) { pulseLength = atoi(value.substring(0, value.indexOf(',')).c_str()); data = atoi(value.substring(value.indexOf(',') + 1).c_str()); } else { data = atoi(value.c_str()); } Serial << "Receiving MQTT > 433Mhz signal: " << pulseLength << ":" << data << endl; mySwitch.setPulseLength(pulseLength); mySwitch.send(data, 24); rfSwitchNode.setProperty("on").send(String(data)); return true; } void setup() { Serial.begin(115200); Serial << endl << endl; // init BMP sensor if (!bmp.begin()) { Serial << "Ooops, no BMP085 detected ... Check your wiring or I2C ADDR!" << endl; while (1) ; } // init RF library mySwitch.enableTransmit(D0); // RF Transmitter is connected to Pin D2 mySwitch.setRepeatTransmit(20); // increase transmit repeat to avoid lost of rf sendings mySwitch.enableReceive(D5); // Receiver on pin D3 // init Homie Homie_setFirmware("mqtt-gateway-livingroom", "1.0.0"); Homie.setSetupFunction(setupHandler).setLoopFunction(loopHandler); Homie.disableResetTrigger(); rfSwitchNode.advertise("on").settable(rfSwitchOnHandler); rfReceiverNode.advertise("channel-0"); temperatureNode.advertise("unit"); temperatureNode.advertise("degrees"); temperatureIntervalSetting.setDefaultValue(DEFAULT_TEMPERATURE_INTERVAL); temperatureOffsetSetting.setDefaultValue(DEFAULT_TEMPERATURE_OFFSET); Homie.setup(); } void loop() { Homie.loop(); }
ac3824c5c291351e0d600a9cca747cf6cc89252f
03b4238a38fe335a782fe278ad07d8f506018292
/Quest.h
a65b1697acfeafc3d5cfcf59e245c6839211bd40
[]
no_license
KarolDrach/RPG
4710880edf0456191355f82648773f17bcd95109
4636e5bb51dd559fb925730f8b28bb2332b30888
refs/heads/master
2021-01-20T03:03:38.761797
2017-05-22T11:16:11
2017-05-22T11:16:11
84,219,493
0
0
null
null
null
null
UTF-8
C++
false
false
603
h
#pragma once #include "Globaldefs.h" #include <vector> extern class Objective; using namespace std; class Quest { protected: string name; vector<Objective*> objectives_list; vector<Objective*>::iterator quest_state; public: Quest() {} vector<Objective*>::iterator GetQuestState() { return quest_state; } OBJECTIVE_ID GetQuestStateID(); vector<Objective*> GetObjectivesList() { return objectives_list; } virtual void CheckRaiseQuestState(); virtual void ShowDescription() = 0; virtual ~Quest() {} }; class KillRats : public Quest { public: virtual void ShowDescription(); KillRats(); };
9e5272183708fd1f41d99bb7a0d9918031630f0f
dd1dea719b12c68e64950b6be673144f582a7860
/main.cpp
49d194394b119de64cd6d35c4907e3ee983e7302
[]
no_license
miracle173/sieve
90d835093706c413a801a09d9f78d26059d7c0c0
baf4fa3c78fc225557133eb732790841e2aaa37c
refs/heads/master
2023-04-20T09:01:50.179606
2021-05-01T12:29:01
2021-05-01T12:29:01
361,194,334
0
0
null
null
null
null
UTF-8
C++
false
false
12,633
cpp
/* if a positive integer number n has a prime divisor p>=sqrt(n), then n=p*q and p and q are uniquely defined and (p,q)=1 and q<=sqrt(n). More general: if n is a positive integer number then there is a prime p such that n=(p^e)*q1*q2, such that (p,q1)=(p,q2)=(q1,q2)=1 and q1<=sqrt(n), q2<=sqrt(n). p,e,q1,q2 are not uniquely defined. this program calculates and stores such factors q1,q2,p^e, for every n between sqrt(limit) and limit */ #include <iostream> #include <cmath> #include <cassert> #include <numeric> #include <vector> //#include <limits> constexpr int limit = 1'000'000; int sqrtlimit; int sieve[limit]={0}; int smallfactor1[limit]={0}; int primepowerfactor[limit]={0}; int smallfactor2[limit]={0}; class nthfunclist { static constexpr int _default_limit = 1'000'000; public: nthfunclist(): nthfunclist(_default_limit) {} explicit nthfunclist(int lim): limit{lim}, sqrtlimit{int(1+std::sqrt(limit))}, primefactor{lim}, smallfactor1{lim}, primepowerfactor{lim}, smallfactor2{lim} { init_sieve(); split_factors(); } int get_prime_factor(int number){ return sieve[number]; } bool is_prime(int number){ return sieve[number]==number; } private: int limit = _default_limit; int sqrtlimit; std::vector<int> primefactor; std::vector<int> smallfactor1; std::vector<int> primepowerfactor; std::vector<int> smallfactor2; constexpr auto init_sieve() -> void { /* initializes the array sieve sieve[n]==n if n is a prime or n==1 or n==0, otherwise sieve[n] is largest prime factor of n that is smaller than sqrtkimit */ sqrtlimit=int(std::sqrt(limit))+1; for (int n=0;n<limit;n++){ sieve[n]=n; } for (int n=2;n<=sqrtlimit;n++){ if (sieve[n]==n){ for (int i=n;i<limit;i+=n){ sieve[i]=n; } } } } constexpr auto split_factors() -> void { /* uses the initialized array sieve sets the arrays smallfactor1, smalfactor2, primepowerfactor splits a number in three, pairwise relativly prime factors where the first and the third are smaller than sqrtlimit and the second is a prime power */ enum State { continue_first_factor, in_second_factor, continue_third_factor }; for (int n=sqrtlimit; n<limit; n++){ int current_prod=1; int quotient=n; int last_prime=0; int prime_exponent=0; int first_factor=1; int second_factor=1; int third_factor=1; int prime_power=1; int p=1; State state=continue_first_factor; while(sieve[quotient]>1){ p=sieve[quotient]; quotient/=p; /* if last prime power was found, put it to first factor and restart calculating the next prime power */ if (p!=last_prime){ switch (state) { case continue_first_factor: first_factor*=prime_power; break; case in_second_factor: second_factor=prime_power; current_prod=1; state=continue_third_factor; break; case continue_third_factor: third_factor*=prime_power; break; default: assert(0); break; } last_prime=p; prime_power=p; } else { prime_power*=p; } if (state==continue_first_factor){ current_prod*=p; if (current_prod>sqrtlimit){ state=in_second_factor; } } /* process the last prime power */ if (quotient==1){ switch (state) { case continue_first_factor: first_factor*=prime_power; break; case in_second_factor: second_factor=prime_power; current_prod=1; state=continue_third_factor; break; case continue_third_factor: third_factor*=prime_power; break; default: assert(0); break; } } } smallfactor1[n]=first_factor; primepowerfactor[n]=second_factor; smallfactor2[n]=third_factor; } } }; void init_sieve(){ /* initializes the array sieve sieve[n]==n if n is a prime or n==1 or n==0, otherwise sieve[n] is largest prime factor of n that is smaller than sqrtkimit */ sqrtlimit=int(std::sqrt(limit))+1; for (int n=0;n<limit;n++){ sieve[n]=n; } for (int n=2;n<=sqrtlimit;n++){ if (sieve[n]==n){ for (int i=n;i<limit;i+=n){ sieve[i]=n; } } } } void split_factors(){ /* uses the initialized array sieve sets the arrays smallfactor1, smalfactor2, primepowerfactor splits a number in three, pairwise relativly prime factors where the first and the third are smaller than sqrtlimit and the second is a prime power */ enum State { continue_first_factor, in_second_factor, continue_third_factor }; for (int n=sqrtlimit; n<limit; n++){ int current_prod=1; int quotient=n; int last_prime=0; int prime_exponent=0; int first_factor=1; int second_factor=1; int third_factor=1; int prime_power=1; int p; State state=continue_first_factor; while(sieve[quotient]>1){ p=sieve[quotient]; quotient/=p; /* if last prime power was found, put it to first factor and restart calculating the next prime power */ if (p!=last_prime){ switch (state) { case continue_first_factor: first_factor*=prime_power; break; case in_second_factor: second_factor=prime_power; current_prod=1; state=continue_third_factor; break; case continue_third_factor: third_factor*=prime_power; break; default: assert(0); break; } last_prime=p; prime_power=p; } else { prime_power*=p; } if (state==continue_first_factor){ current_prod*=p; if (current_prod>sqrtlimit){ state=in_second_factor; } } /* process the last prime power */ if (quotient==1){ switch (state) { case continue_first_factor: first_factor*=prime_power; break; case in_second_factor: second_factor=prime_power; current_prod=1; state=continue_third_factor; break; case continue_third_factor: third_factor*=prime_power; break; default: assert(0); break; } } } smallfactor1[n]=first_factor; primepowerfactor[n]=second_factor; smallfactor2[n]=third_factor; } } int powermod(int base, int exponent, int modulus){ long int prod=1; long int base2=base; int exponent2=exponent; // invariant: // (base2**exponent2)*prod==(base**exponent) (mod modulus) while(exponent2>0){ if (exponent2%2==1){ prod*=base2; prod%=modulus; exponent2-=1; } else { exponent2/=2; int last_base2=base2; base2*=base2; base2%=modulus; } } return prod; } int get_prime_factor(int number){ return sieve[number]; } int get_smallfactor1(int number){ return smallfactor1[number]; } int get_primepowerfactor(int number){ return primepowerfactor[number]; } int get_smallfactor2(int number){ return smallfactor2[number]; } bool is_prime(int number){ return sieve[number]==number; } int get_order(int element, int exponent, int modulus){ //assert(powermod(element,exponent,modulus)==1); int remaining_primes=exponent; int tentative=exponent; int last_power_1=true; int last_prime=0; if (element%modulus==0){ return 0; } while(remaining_primes>1){ int primefactor=get_prime_factor(remaining_primes); remaining_primes/=primefactor; if (!(primefactor==last_prime && !last_power_1)) { last_prime=primefactor; if (powermod(element,tentative/primefactor,modulus)==1) { last_power_1=true; tentative/=primefactor; } else { last_power_1=false; } } } return tentative; } int totient(int number){ int product=1; int remaining_primes=number; int last_prime=0; while (remaining_primes>1){ int primefactor=get_prime_factor(remaining_primes); if (primefactor==last_prime){ product*=primefactor; } else { product*=(primefactor-1); } last_prime=primefactor; remaining_primes/=primefactor; } return product; } int ord7(int number){ return get_order(7,totient(number),number); } int main() { int range = 30; init_sieve(); split_factors(); // some sample output std::cout<<"limit "<<limit<<'\n' <<"sqrtlimit "<<sqrtlimit<<'\n' <<'\n' <<"max int "<<std::numeric_limits<int>::max()<<"\n" <<"max long int "<<std::numeric_limits<long int>::max()<<"\n\n" <<"print some prime factorization"<<'\n'; for (int n=limit-range;n<limit; n++){ int m=n; std::cout << m << " = " ; bool first=true; while (m>1){ if (first){ first=false; } else { std::cout << " * "; } //std::cout <<sieve[m]; //m=m/sieve[m]; std::cout <<get_prime_factor(m); m=m/get_prime_factor(m); } std::cout <<std::endl; } std::cout<<"\nsmallfactor * primepower * smallfactor\n" <<"\tthe second factor is a prime power\n" <<"\t'!' at the end prime power exponent > 1\n"; for (int n=limit-range;n<limit; n++){ std::cout<<n<<" = "<<get_smallfactor1(n)<<" * "<<get_primepowerfactor(n)<<" * "<<get_smallfactor2(n); //if (get_prime_factor(primepowerfactor[n])!=primepowerfactor[n]){ if (!is_prime(get_primepowerfactor(n))){ std::cout<<" !"; } std::cout<<std::endl; } for (int n=limit-range; n<limit; n++){ int x = 7; int e=n-1; std::cout<< x<<"^"<<e<<" = "<<powermod(x,e,n)<<" (mod "<<n<<")"<<"\n"; } int m=11; for (int e=1;e<m; e++){ std::cout<<"ord("<<e<<", "<<m<<") = "<<get_order(e,10,m)<<"\n"; } m=100; for (int e=1;e<m; e++){ std::cout<<"totient("<<e<<") = "<<totient(e)<<"\n"; } for (int e=1;e<m; e++){ std::cout<<"ord7("<<e<<") = "<<ord7(e)<<"\n"; } int s=0; for (int e=1;e<limit; e++){ s+=ord7(e); } std::cout<<s<<"\n"; }
[ "" ]
7f4e46cc2b08e51d8ec9e77c8ba8ade1b9808bfa
bd7ee2907ca45fa10ebc664d51803c4ab4f2749f
/first_app/first_app/main.cpp
fada2fb8f318f5175d3d0d2b4449f4220ec923a7
[]
no_license
ssdsp/LOGL
a2366882cccde6b5f55b9756aa25fa100ae5c23c
463c21334539d1bb6e8bc26b4120682677eaee36
refs/heads/master
2020-04-21T23:19:43.820561
2019-04-19T05:41:27
2019-04-19T05:41:27
169,943,637
0
0
null
null
null
null
UTF-8
C++
false
false
1,792
cpp
// testing this out #include <glad/glad.h> #include <GLFW/glfw3.h> #include <iostream> void framebuffer_size_callback(GLFWwindow* window, int width, int height); void processInput(GLFWwindow* window); int main() { // Initiate GLFW and set version info glfwInit(); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Initiate the window object and associate it with the current context GLFWwindow* window = glfwCreateWindow(800, 600, "LearnOpenGL", NULL, NULL); if (window == NULL) { std::cout << "Failed to create GLFW window" << std::endl; glfwTerminate(); return -1; } glfwMakeContextCurrent(window); // Load the location of the OpenGL functions into GLAD if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) { std::cout << "Failed to initialize GLAD" << std::endl; return -1; } // Set the size of the current viewport and set a callback to handle change in sizes. glViewport(0, 0, 800, 600); glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); // Loop for running the program while (!glfwWindowShouldClose(window)) { processInput(window); // Set the window to a certain color after clearing it. glClearColor(0.2f, 0.3f, 0.3f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); glfwSwapBuffers(window); glfwPollEvents(); } glfwTerminate(); return 0; } // Callback function to adjust the size of the viewport when the window's size is changed void framebuffer_size_callback(GLFWwindow* window, int width, int height) { glViewport(0, 0, width, height); } // Input processing function void processInput(GLFWwindow* window) { if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) glfwSetWindowShouldClose(window, true); }
0f39d725dcb62411d5fa23e7c4b1a3b226d19724
3ece86f59c1595fcde5d819fe950bd05d21fb44a
/3.4.2binary_search.cpp
fc2989acf744f79405e0d0b0bd1b1d7a99efa3de
[]
no_license
Na-Nazhou/CPP-Primer
a6c1e77180a164d8ff7438fb1aef3fc33f4373ce
3967a738a771b3630869c643d36e6b3e331884f5
refs/heads/master
2020-04-02T08:55:52.737233
2018-12-11T05:48:44
2018-12-11T05:48:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
627
cpp
// text must be sorted // beg and end will denote the range we're searching auto beg = text.begin(), end = text.end(); auto mid = text.begin() + (end - beg)/2; // original midpoint // while there are still elements to look at and we haven't yet found sought while (mid != end && *mid != sought) { if (sought < *mid) { // is the element we want in the first half? end = mid; // if so, adjust the range to ignore the second half } else {// the element we want is in the second half beg = mid + 1; // start looking with the element just after mid mid = beg + (end - beg)/2; // new midpoint } }
b198f98025708f2f35b007686438a5281b448657
cee75861467875ca889e03f2781aa2893650df32
/Linked List/rotateDLLByNNodes.cpp
1233029a1f8ba52b040498be2171fa47772cb2c4
[]
no_license
rutuja-patil923/Data-Structures-and-Algorithms
ad9be7494d34e62843873e2f15f288d4cfc074c7
9259b7ac5ab593253de163660a5e6834c4d3191b
refs/heads/master
2023-06-04T04:31:26.143670
2021-06-19T06:53:59
2021-06-19T06:53:59
343,661,178
3
0
null
null
null
null
UTF-8
C++
false
false
652
cpp
// Question Link : https://www.geeksforgeeks.org/rotate-doubly-linked-list-n-nodes/ // ************************************************************************************************* Node* rotate(Node* head,int N) { Node* tail=head; // traversing to end of list while(tail->next) tail=tail->next; Node* current=head; // traversing to new head for(int i=1;i<=N;i++) current=current->next; Node* prevNode=current->prev; // current node will become new head current->prev=NULL; // old head will be attached to end tail->next=head; head->prev=tail; // last node's next should be null prevNode->next=NULL; return current; }
0303ee929ecb4a14658d84d63efe60df6f8f7be3
deb70741d4f9eee29c018de6f2b2b9b9fa773499
/Assignment 4.0/Framework/parser.h
8beddb7635e80b3c7eddf01344ce6a33f641b330
[]
no_license
Scentefy/Assignment-One-GP
90a16770e71784791b2a0ccf8858b7bbd2919f22
21d221f8401288d25c3cf274a4acd1b625a8da76
refs/heads/master
2021-01-18T03:31:49.471383
2018-06-16T12:14:48
2018-06-16T12:14:48
66,792,604
0
0
null
null
null
null
UTF-8
C++
false
false
601
h
// COMP710 GP 2D Framework #ifndef __PARSER_H__ #define __PARSER_H__ #include "rapidjson/document.h" #pragma warning (disable : 4996) using namespace std; using namespace rapidjson; class Parser { //Member Methods: public: static Parser& GetInstance(); ~Parser(); void loadInFile(string file); protected: private: Parser(); Parser(const Parser& parser); Parser& operator=(const Parser& parser); //Member Data: public: const char* json; string stringValue; Document document; protected: static Parser* sm_pInstance; private: }; #endif //__PARSER_H__ string readFile(string file);
874f49a1928e8325ea3b783d33fa0dc93ddce058
99209e2a06ff8bd48528f885f57fe8eacc0665d4
/Legacy/cpp/3_MoreOOPinCPP/2_EncapsulationAndProtectedAccess/a-TheProtectedKeyword/src/student.h
c76f88756d94acf3a985c2b7f87e27f33f5500a9
[]
no_license
pbraga88/study
6fac30990059b481c97e558b143b068eca92bc42
fcc1fb7e0d11e264dadb7296ab201fad9a9b0140
refs/heads/master
2023-08-17T04:25:40.506116
2023-08-15T10:53:37
2023-08-15T10:53:37
155,830,216
0
0
null
null
null
null
UTF-8
C++
false
false
160
h
#pragma once #include "person.h" class Student: public Person { public: Student(); ~Student(); void setAge(int); int getAge(); void SayHello(); };
d99ed7ff5d6916237fa58d019d3a6412c09b0405
f81124e4a52878ceeb3e4b85afca44431ce68af2
/re20_2/processor20/30/p
4a3765cfcfa3718c982ab3a0488d27fd2bff309f
[]
no_license
chaseguy15/coe-of2
7f47a72987638e60fd7491ee1310ee6a153a5c10
dc09e8d5f172489eaa32610e08e1ee7fc665068c
refs/heads/master
2023-03-29T16:59:14.421456
2021-04-06T23:26:52
2021-04-06T23:26:52
355,040,336
0
1
null
null
null
null
UTF-8
C++
false
false
9,092
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 7 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "30"; object p; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 -2 0 0 0 0]; internalField nonuniform List<scalar> 392 ( -0.313862 -0.314397 -0.316451 -0.315466 -0.317464 -0.317062 -0.318979 -0.319179 -0.320988 -0.321807 -0.323483 -0.324935 -0.326454 -0.32855 -0.329889 -0.330936 -0.332642 -0.333777 -0.334636 -0.337195 -0.338106 -0.338757 -0.339125 -0.342198 -0.342864 -0.343286 -0.343444 -0.347637 -0.348037 -0.348211 -0.34814 -0.347862 -0.353501 -0.353615 -0.353521 -0.353202 -0.352678 -0.359584 -0.359203 -0.35862 -0.35783 -0.356834 -0.365932 -0.365246 -0.364379 -0.363307 -0.362029 -0.371635 -0.370468 -0.369097 -0.367519 -0.365737 -0.376873 -0.375186 -0.373293 -0.371198 -0.368904 -0.381561 -0.379337 -0.376916 -0.374301 -0.385637 -0.382877 -0.379929 -0.376792 -0.389067 -0.385776 -0.382304 -0.378652 -0.391828 -0.388014 -0.384031 -0.379879 -0.39391 -0.389592 -0.385119 -0.380489 -0.395321 -0.390527 -0.385594 -0.38052 -0.396088 -0.390857 -0.385508 -0.380041 -0.396256 -0.390639 -0.384936 -0.379153 -0.395884 -0.389946 -0.38397 -0.377979 -0.388853 -0.382702 -0.376629 -0.387417 -0.381187 -0.375151 -0.369439 -0.385641 -0.3794 -0.373478 -0.368031 -0.377181 -0.371327 -0.365856 -0.374176 -0.368037 -0.362142 -0.358548 -0.362917 -0.358016 -0.354356 -0.357072 -0.351556 -0.357072 -0.351556 -0.362917 -0.358016 -0.354356 -0.374176 -0.368037 -0.362142 -0.358548 -0.37718 -0.371327 -0.365856 -0.385641 -0.3794 -0.373478 -0.368031 -0.387417 -0.381187 -0.375151 -0.369439 -0.395035 -0.388853 -0.382702 -0.376629 -0.395884 -0.389946 -0.38397 -0.377979 -0.396256 -0.390639 -0.384936 -0.379153 -0.396088 -0.390857 -0.385508 -0.380041 -0.395321 -0.390527 -0.385594 -0.38052 -0.39391 -0.389592 -0.385119 -0.380488 -0.391828 -0.388014 -0.384031 -0.379879 -0.389067 -0.385776 -0.382304 -0.378652 -0.385637 -0.382877 -0.379928 -0.376792 -0.381561 -0.379337 -0.376916 -0.374301 -0.376873 -0.375186 -0.373293 -0.371198 -0.368904 -0.371635 -0.370468 -0.369097 -0.367519 -0.365737 -0.365932 -0.365246 -0.364379 -0.363307 -0.362029 -0.359584 -0.359203 -0.35862 -0.35783 -0.356834 -0.353501 -0.353614 -0.353521 -0.353202 -0.352678 -0.347637 -0.348037 -0.348211 -0.34814 -0.347862 -0.342198 -0.342864 -0.343286 -0.343444 -0.337195 -0.338106 -0.338757 -0.339125 -0.332642 -0.333777 -0.334636 -0.32855 -0.329889 -0.330936 -0.324935 -0.326454 -0.321807 -0.323483 -0.319179 -0.320988 -0.317062 -0.318979 -0.315466 -0.317464 -0.314397 -0.316451 -0.313862 -0.0244054 -0.0232023 -0.0221816 -0.0213362 -0.0206603 -0.0201487 -0.0198011 -0.0196012 -0.305573 -0.307042 -0.281373 -0.259898 -0.238524 -0.217886 -0.19861 -0.180787 -0.164476 -0.14964 -0.136196 -0.124038 -0.113053 -0.103131 -0.0941638 -0.0860555 -0.0787175 -0.0720709 -0.0660461 -0.0605813 -0.0556224 -0.0511217 -0.0470373 -0.0433323 -0.0399745 -0.0369352 -0.0341894 -0.0317151 -0.0294929 -0.0275057 -0.0257386 -0.0241787 -0.0228148 -0.0216371 -0.0206374 -0.0198089 -0.0191459 -0.0186433 -0.0183009 -0.018102 -0.302877 -0.301864 -0.275766 -0.253803 -0.232373 -0.211879 -0.192875 -0.17539 -0.159436 -0.144951 -0.131835 -0.119979 -0.109269 -0.0995925 -0.0908473 -0.0829381 -0.0757793 -0.0692942 -0.0634151 -0.0580819 -0.0532419 -0.0488487 -0.0448615 -0.0412443 -0.0379657 -0.0349978 -0.0323162 -0.0298993 -0.0277284 -0.0257867 -0.0240599 -0.302877 -0.301864 -0.275766 -0.253803 -0.232373 -0.211879 -0.192875 -0.17539 -0.159436 -0.144951 -0.131835 -0.119979 -0.109269 -0.0995925 -0.0908473 -0.0829381 -0.0757793 -0.0692942 -0.063415 -0.0580819 -0.0532419 -0.0488487 -0.0448615 -0.0412443 -0.0379657 -0.0349978 -0.0323162 -0.0298993 -0.0277284 -0.0257867 -0.0240599 -0.0225352 -0.0212016 -0.0200498 -0.0190717 -0.0182606 -0.0176111 -0.0171181 -0.0167814 -0.0165843 -0.305573 -0.307042 -0.281373 -0.259898 -0.238524 -0.217886 -0.19861 -0.180787 -0.164476 -0.14964 -0.136196 -0.124038 -0.113053 -0.103131 -0.0941638 -0.0860555 -0.0787175 -0.0720709 -0.0660461 -0.0605813 -0.0556224 -0.0511217 -0.0470373 -0.0433323 -0.0399745 -0.0369352 -0.0341894 -0.0317151 -0.0294929 -0.0275057 -0.0257386 -0.0241787 -0.0228148 -0.0216371 -0.0206374 -0.0198089 -0.0191458 -0.0186433 -0.0183009 -0.018102 ) ; boundaryField { inlet { type zeroGradient; } outlet { type fixedValue; value nonuniform 0(); } cylinder { type zeroGradient; } top { type symmetryPlane; } bottom { type symmetryPlane; } defaultFaces { type empty; } procBoundary20to19 { type processor; value nonuniform List<scalar> 169 ( -0.359777 -0.359777 -0.366453 -0.372647 -0.372647 -0.378358 -0.378358 -0.383579 -0.383579 -0.388205 -0.388205 -0.392177 -0.392177 -0.39547 -0.39547 -0.398069 -0.398069 -0.399973 -0.399973 -0.4012 -0.4012 -0.401782 -0.401782 -0.401769 -0.401769 -0.401214 -0.395035 -0.395035 -0.393762 -0.393762 -0.392086 -0.392086 -0.389954 -0.383427 -0.383427 -0.380548 -0.380548 -0.376607 -0.369727 -0.369727 -0.363231 -0.363231 -0.355748 -0.348556 -0.355748 -0.348556 -0.363231 -0.363231 -0.376606 -0.369727 -0.369727 -0.380548 -0.380548 -0.389954 -0.383427 -0.383427 -0.392086 -0.392086 -0.400168 -0.393762 -0.393762 -0.401214 -0.401214 -0.401769 -0.401769 -0.401782 -0.401782 -0.4012 -0.4012 -0.399973 -0.399973 -0.398069 -0.398069 -0.39547 -0.39547 -0.392177 -0.392177 -0.388205 -0.388205 -0.383579 -0.383579 -0.378358 -0.378358 -0.372647 -0.372647 -0.366453 -0.359777 -0.359777 -0.0225352 -0.0212016 -0.0200498 -0.0190717 -0.0182606 -0.0176111 -0.0171181 -0.0167814 -0.0165843 -0.300455 -0.296686 -0.270212 -0.247768 -0.226275 -0.205923 -0.187179 -0.170018 -0.154407 -0.140259 -0.127464 -0.115903 -0.105461 -0.0960283 -0.087503 -0.079792 -0.072812 -0.0664885 -0.0607552 -0.055554 -0.0508333 -0.0465481 -0.0426585 -0.0391297 -0.0359307 -0.0330347 -0.0304177 -0.0280588 -0.0259397 -0.0240441 -0.0225352 -0.022358 -0.300455 -0.296686 -0.270212 -0.247768 -0.226275 -0.205923 -0.187179 -0.170018 -0.154407 -0.140259 -0.127464 -0.115903 -0.105461 -0.0960283 -0.0875029 -0.079792 -0.072812 -0.0664884 -0.0607552 -0.055554 -0.0508333 -0.0465481 -0.0426585 -0.0391297 -0.0359307 -0.0330347 -0.0304177 -0.0280588 -0.0259397 -0.0240441 -0.022358 -0.0208689 -0.0195663 -0.0184409 -0.017485 -0.0166919 -0.0160563 -0.0155736 -0.0152432 -0.0150487 ) ; } procBoundary20to21 { type processor; value nonuniform List<scalar> 189 ( -0.315943 -0.315943 -0.318156 -0.319119 -0.320559 -0.322469 -0.324842 -0.327668 -0.327668 -0.331669 -0.335196 -0.335196 -0.339286 -0.343394 -0.343394 -0.347379 -0.351947 -0.351947 -0.35563 -0.360544 -0.360544 -0.363752 -0.363752 -0.366411 -0.37149 -0.37149 -0.373467 -0.373467 -0.37482 -0.37482 -0.375555 -0.375555 -0.375696 -0.375696 -0.375298 -0.375298 -0.374451 -0.374451 -0.373298 -0.373298 -0.372006 -0.372006 -0.370708 -0.370708 -0.365068 -0.364245 -0.364245 -0.36311 -0.36311 -0.360834 -0.360834 -0.358579 -0.356957 -0.356957 -0.356957 -0.360834 -0.356957 -0.358579 -0.360834 -0.36311 -0.36311 -0.364245 -0.370707 -0.364245 -0.365068 -0.370707 -0.372006 -0.372006 -0.373298 -0.373298 -0.374451 -0.374451 -0.375298 -0.375298 -0.375696 -0.375696 -0.375555 -0.375555 -0.37482 -0.37482 -0.373467 -0.373467 -0.37149 -0.37149 -0.366411 -0.363752 -0.363752 -0.360544 -0.360544 -0.35563 -0.351947 -0.351947 -0.347379 -0.343394 -0.343394 -0.339286 -0.335196 -0.335196 -0.331668 -0.327668 -0.327668 -0.324842 -0.322469 -0.320559 -0.319119 -0.318156 -0.315943 -0.315943 -0.0259729 -0.024745 -0.0237038 -0.0228421 -0.0221539 -0.0216339 -0.0212817 -0.0210816 -0.308711 -0.312274 -0.287102 -0.266099 -0.244764 -0.223971 -0.204405 -0.186225 -0.169538 -0.154336 -0.14055 -0.12808 -0.116816 -0.106643 -0.0974526 -0.089144 -0.0816263 -0.0748183 -0.0686479 -0.0630518 -0.0579744 -0.0533665 -0.0491854 -0.0453931 -0.0419565 -0.0388463 -0.0360369 -0.0335057 -0.0312326 -0.0292004 -0.0273937 -0.0257992 -0.0257992 -0.308711 -0.312274 -0.287102 -0.266098 -0.244764 -0.223971 -0.204405 -0.186225 -0.169538 -0.154336 -0.14055 -0.12808 -0.116816 -0.106643 -0.0974526 -0.089144 -0.0816263 -0.0748183 -0.0686479 -0.0630518 -0.0579743 -0.0533665 -0.0491853 -0.0453931 -0.0419565 -0.0388463 -0.0360369 -0.0335057 -0.0312326 -0.0292004 -0.0273937 -0.0257992 -0.0244054 -0.0232023 -0.0221816 -0.0213361 -0.0206602 -0.0201487 -0.0198011 -0.0196012 ) ; } } // ************************************************************************* //
04a1f61dbd0ce546f1828bc48c48052c864f2dcf
faf2c4bacbefe6f4caef15dba2b19f5d89669443
/Unity/Library/Il2cppBuildCache/Android/armeabi-v7a/il2cppOutput/UnityEngine.PhysicsModule.cpp
a7913035e53ab66a30658374ada01ad596e70f50
[]
no_license
VirendraVerma1/Image-to-PDF-Converter
450fdd67ad8cac1d53fd6f47d281b8fe9c89bbb2
c9af97100b9dd452dce278fd740fe53fb126fe51
refs/heads/master
2023-07-15T18:30:52.704228
2021-08-22T03:22:40
2021-08-22T03:22:40
289,734,363
0
0
null
null
null
null
UTF-8
C++
false
false
157,402
cpp
#include "pch-cpp.hpp" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <limits> #include <stdint.h> // System.Char[] struct CharU5BU5D_t7B7FC5BC8091AA3B9CB0B29CDD80B5EE9254AA34; // UnityEngine.ContactPoint[] struct ContactPointU5BU5D_t1ACD262B1EA44CD48E2039381DE96847F203E62B; // System.Object[] struct ObjectU5BU5D_tC1F4EE0DB0B7300255F5FD4AF64FE4C585CF5ADE; // UnityEngine.RaycastHit[] struct RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09; // UnityEngine.CharacterController struct CharacterController_tCCF68621C784CCB3391E0C66FE134F6F93DD6C2E; // UnityEngine.Collider struct Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02; // UnityEngine.Object struct Object_tF2F3778131EFF286AF62B7B013A170F95A91571A; // UnityEngine.Rigidbody struct Rigidbody_t101F2E2F9F16E765A77429B2DE4527D2047A887A; // System.String struct String_t; // System.Void struct Void_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5; IL2CPP_EXTERN_C RuntimeClass* Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02_il2cpp_TypeInfo_var; IL2CPP_EXTERN_C RuntimeClass* Int32_tFDE5F8CD43D10453F6A2E0C77FE48C6CC7009046_il2cpp_TypeInfo_var; IL2CPP_EXTERN_C RuntimeClass* ObjectU5BU5D_tC1F4EE0DB0B7300255F5FD4AF64FE4C585CF5ADE_il2cpp_TypeInfo_var; IL2CPP_EXTERN_C RuntimeClass* Object_tF2F3778131EFF286AF62B7B013A170F95A91571A_il2cpp_TypeInfo_var; IL2CPP_EXTERN_C RuntimeClass* PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678_il2cpp_TypeInfo_var; IL2CPP_EXTERN_C RuntimeClass* RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09_il2cpp_TypeInfo_var; IL2CPP_EXTERN_C String_t* _stringLiteral21ACE806CE655297BC379B3AD17E97F0A68B6AEC; struct ContactPoint_tC179732A8E0014F5EFF5977ED1ADF12CF14A9017 ; struct ContactPointU5BU5D_t1ACD262B1EA44CD48E2039381DE96847F203E62B; struct ObjectU5BU5D_tC1F4EE0DB0B7300255F5FD4AF64FE4C585CF5ADE; struct RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09; IL2CPP_EXTERN_C_BEGIN IL2CPP_EXTERN_C_END #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // <Module> struct U3CModuleU3E_tC43E3828CD23D91917D996FCE04516C5EF9F6DD6 { public: public: }; // System.Object struct Il2CppArrayBounds; // System.Array // UnityEngine.Physics struct Physics_tED41E76FFDD034FA1B46162C3D283C36814DA0A4 : public RuntimeObject { public: public: }; // System.String struct String_t : public RuntimeObject { public: // System.Int32 System.String::m_stringLength int32_t ___m_stringLength_0; // System.Char System.String::m_firstChar Il2CppChar ___m_firstChar_1; public: inline static int32_t get_offset_of_m_stringLength_0() { return static_cast<int32_t>(offsetof(String_t, ___m_stringLength_0)); } inline int32_t get_m_stringLength_0() const { return ___m_stringLength_0; } inline int32_t* get_address_of_m_stringLength_0() { return &___m_stringLength_0; } inline void set_m_stringLength_0(int32_t value) { ___m_stringLength_0 = value; } inline static int32_t get_offset_of_m_firstChar_1() { return static_cast<int32_t>(offsetof(String_t, ___m_firstChar_1)); } inline Il2CppChar get_m_firstChar_1() const { return ___m_firstChar_1; } inline Il2CppChar* get_address_of_m_firstChar_1() { return &___m_firstChar_1; } inline void set_m_firstChar_1(Il2CppChar value) { ___m_firstChar_1 = value; } }; struct String_t_StaticFields { public: // System.String System.String::Empty String_t* ___Empty_5; public: inline static int32_t get_offset_of_Empty_5() { return static_cast<int32_t>(offsetof(String_t_StaticFields, ___Empty_5)); } inline String_t* get_Empty_5() const { return ___Empty_5; } inline String_t** get_address_of_Empty_5() { return &___Empty_5; } inline void set_Empty_5(String_t* value) { ___Empty_5 = value; Il2CppCodeGenWriteBarrier((void**)(&___Empty_5), (void*)value); } }; // System.ValueType struct ValueType_tDBF999C1B75C48C68621878250DBF6CDBCF51E52 : public RuntimeObject { public: public: }; // Native definition for P/Invoke marshalling of System.ValueType struct ValueType_tDBF999C1B75C48C68621878250DBF6CDBCF51E52_marshaled_pinvoke { }; // Native definition for COM marshalling of System.ValueType struct ValueType_tDBF999C1B75C48C68621878250DBF6CDBCF51E52_marshaled_com { }; // System.Boolean struct Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37 { public: // System.Boolean System.Boolean::m_value bool ___m_value_0; public: inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37, ___m_value_0)); } inline bool get_m_value_0() const { return ___m_value_0; } inline bool* get_address_of_m_value_0() { return &___m_value_0; } inline void set_m_value_0(bool value) { ___m_value_0 = value; } }; struct Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_StaticFields { public: // System.String System.Boolean::TrueString String_t* ___TrueString_5; // System.String System.Boolean::FalseString String_t* ___FalseString_6; public: inline static int32_t get_offset_of_TrueString_5() { return static_cast<int32_t>(offsetof(Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_StaticFields, ___TrueString_5)); } inline String_t* get_TrueString_5() const { return ___TrueString_5; } inline String_t** get_address_of_TrueString_5() { return &___TrueString_5; } inline void set_TrueString_5(String_t* value) { ___TrueString_5 = value; Il2CppCodeGenWriteBarrier((void**)(&___TrueString_5), (void*)value); } inline static int32_t get_offset_of_FalseString_6() { return static_cast<int32_t>(offsetof(Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_StaticFields, ___FalseString_6)); } inline String_t* get_FalseString_6() const { return ___FalseString_6; } inline String_t** get_address_of_FalseString_6() { return &___FalseString_6; } inline void set_FalseString_6(String_t* value) { ___FalseString_6 = value; Il2CppCodeGenWriteBarrier((void**)(&___FalseString_6), (void*)value); } }; // System.Enum struct Enum_t23B90B40F60E677A8025267341651C94AE079CDA : public ValueType_tDBF999C1B75C48C68621878250DBF6CDBCF51E52 { public: public: }; struct Enum_t23B90B40F60E677A8025267341651C94AE079CDA_StaticFields { public: // System.Char[] System.Enum::enumSeperatorCharArray CharU5BU5D_t7B7FC5BC8091AA3B9CB0B29CDD80B5EE9254AA34* ___enumSeperatorCharArray_0; public: inline static int32_t get_offset_of_enumSeperatorCharArray_0() { return static_cast<int32_t>(offsetof(Enum_t23B90B40F60E677A8025267341651C94AE079CDA_StaticFields, ___enumSeperatorCharArray_0)); } inline CharU5BU5D_t7B7FC5BC8091AA3B9CB0B29CDD80B5EE9254AA34* get_enumSeperatorCharArray_0() const { return ___enumSeperatorCharArray_0; } inline CharU5BU5D_t7B7FC5BC8091AA3B9CB0B29CDD80B5EE9254AA34** get_address_of_enumSeperatorCharArray_0() { return &___enumSeperatorCharArray_0; } inline void set_enumSeperatorCharArray_0(CharU5BU5D_t7B7FC5BC8091AA3B9CB0B29CDD80B5EE9254AA34* value) { ___enumSeperatorCharArray_0 = value; Il2CppCodeGenWriteBarrier((void**)(&___enumSeperatorCharArray_0), (void*)value); } }; // Native definition for P/Invoke marshalling of System.Enum struct Enum_t23B90B40F60E677A8025267341651C94AE079CDA_marshaled_pinvoke { }; // Native definition for COM marshalling of System.Enum struct Enum_t23B90B40F60E677A8025267341651C94AE079CDA_marshaled_com { }; // System.Int32 struct Int32_tFDE5F8CD43D10453F6A2E0C77FE48C6CC7009046 { public: // System.Int32 System.Int32::m_value int32_t ___m_value_0; public: inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(Int32_tFDE5F8CD43D10453F6A2E0C77FE48C6CC7009046, ___m_value_0)); } inline int32_t get_m_value_0() const { return ___m_value_0; } inline int32_t* get_address_of_m_value_0() { return &___m_value_0; } inline void set_m_value_0(int32_t value) { ___m_value_0 = value; } }; // 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; } }; // UnityEngine.PhysicsScene struct PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 { public: // System.Int32 UnityEngine.PhysicsScene::m_Handle int32_t ___m_Handle_0; public: inline static int32_t get_offset_of_m_Handle_0() { return static_cast<int32_t>(offsetof(PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678, ___m_Handle_0)); } inline int32_t get_m_Handle_0() const { return ___m_Handle_0; } inline int32_t* get_address_of_m_Handle_0() { return &___m_Handle_0; } inline void set_m_Handle_0(int32_t value) { ___m_Handle_0 = value; } }; // System.Single struct Single_tE07797BA3C98D4CA9B5A19413C19A76688AB899E { public: // System.Single System.Single::m_value float ___m_value_0; public: inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(Single_tE07797BA3C98D4CA9B5A19413C19A76688AB899E, ___m_value_0)); } inline float get_m_value_0() const { return ___m_value_0; } inline float* get_address_of_m_value_0() { return &___m_value_0; } inline void set_m_value_0(float value) { ___m_value_0 = value; } }; // UnityEngine.Vector2 struct Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 { 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_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9, ___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_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9, ___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_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9_StaticFields { public: // UnityEngine.Vector2 UnityEngine.Vector2::zeroVector Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 ___zeroVector_2; // UnityEngine.Vector2 UnityEngine.Vector2::oneVector Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 ___oneVector_3; // UnityEngine.Vector2 UnityEngine.Vector2::upVector Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 ___upVector_4; // UnityEngine.Vector2 UnityEngine.Vector2::downVector Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 ___downVector_5; // UnityEngine.Vector2 UnityEngine.Vector2::leftVector Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 ___leftVector_6; // UnityEngine.Vector2 UnityEngine.Vector2::rightVector Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 ___rightVector_7; // UnityEngine.Vector2 UnityEngine.Vector2::positiveInfinityVector Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 ___positiveInfinityVector_8; // UnityEngine.Vector2 UnityEngine.Vector2::negativeInfinityVector Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 ___negativeInfinityVector_9; public: inline static int32_t get_offset_of_zeroVector_2() { return static_cast<int32_t>(offsetof(Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9_StaticFields, ___zeroVector_2)); } inline Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 get_zeroVector_2() const { return ___zeroVector_2; } inline Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 * get_address_of_zeroVector_2() { return &___zeroVector_2; } inline void set_zeroVector_2(Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 value) { ___zeroVector_2 = value; } inline static int32_t get_offset_of_oneVector_3() { return static_cast<int32_t>(offsetof(Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9_StaticFields, ___oneVector_3)); } inline Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 get_oneVector_3() const { return ___oneVector_3; } inline Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 * get_address_of_oneVector_3() { return &___oneVector_3; } inline void set_oneVector_3(Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 value) { ___oneVector_3 = value; } inline static int32_t get_offset_of_upVector_4() { return static_cast<int32_t>(offsetof(Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9_StaticFields, ___upVector_4)); } inline Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 get_upVector_4() const { return ___upVector_4; } inline Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 * get_address_of_upVector_4() { return &___upVector_4; } inline void set_upVector_4(Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 value) { ___upVector_4 = value; } inline static int32_t get_offset_of_downVector_5() { return static_cast<int32_t>(offsetof(Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9_StaticFields, ___downVector_5)); } inline Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 get_downVector_5() const { return ___downVector_5; } inline Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 * get_address_of_downVector_5() { return &___downVector_5; } inline void set_downVector_5(Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 value) { ___downVector_5 = value; } inline static int32_t get_offset_of_leftVector_6() { return static_cast<int32_t>(offsetof(Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9_StaticFields, ___leftVector_6)); } inline Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 get_leftVector_6() const { return ___leftVector_6; } inline Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 * get_address_of_leftVector_6() { return &___leftVector_6; } inline void set_leftVector_6(Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 value) { ___leftVector_6 = value; } inline static int32_t get_offset_of_rightVector_7() { return static_cast<int32_t>(offsetof(Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9_StaticFields, ___rightVector_7)); } inline Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 get_rightVector_7() const { return ___rightVector_7; } inline Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 * get_address_of_rightVector_7() { return &___rightVector_7; } inline void set_rightVector_7(Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 value) { ___rightVector_7 = value; } inline static int32_t get_offset_of_positiveInfinityVector_8() { return static_cast<int32_t>(offsetof(Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9_StaticFields, ___positiveInfinityVector_8)); } inline Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 get_positiveInfinityVector_8() const { return ___positiveInfinityVector_8; } inline Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 * get_address_of_positiveInfinityVector_8() { return &___positiveInfinityVector_8; } inline void set_positiveInfinityVector_8(Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 value) { ___positiveInfinityVector_8 = value; } inline static int32_t get_offset_of_negativeInfinityVector_9() { return static_cast<int32_t>(offsetof(Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9_StaticFields, ___negativeInfinityVector_9)); } inline Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 get_negativeInfinityVector_9() const { return ___negativeInfinityVector_9; } inline Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 * get_address_of_negativeInfinityVector_9() { return &___negativeInfinityVector_9; } inline void set_negativeInfinityVector_9(Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 value) { ___negativeInfinityVector_9 = value; } }; // UnityEngine.Vector3 struct Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E { public: // System.Single UnityEngine.Vector3::x float ___x_2; // System.Single UnityEngine.Vector3::y float ___y_3; // System.Single UnityEngine.Vector3::z float ___z_4; public: inline static int32_t get_offset_of_x_2() { return static_cast<int32_t>(offsetof(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E, ___x_2)); } inline float get_x_2() const { return ___x_2; } inline float* get_address_of_x_2() { return &___x_2; } inline void set_x_2(float value) { ___x_2 = value; } inline static int32_t get_offset_of_y_3() { return static_cast<int32_t>(offsetof(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E, ___y_3)); } inline float get_y_3() const { return ___y_3; } inline float* get_address_of_y_3() { return &___y_3; } inline void set_y_3(float value) { ___y_3 = value; } inline static int32_t get_offset_of_z_4() { return static_cast<int32_t>(offsetof(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E, ___z_4)); } inline float get_z_4() const { return ___z_4; } inline float* get_address_of_z_4() { return &___z_4; } inline void set_z_4(float value) { ___z_4 = value; } }; struct Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E_StaticFields { public: // UnityEngine.Vector3 UnityEngine.Vector3::zeroVector Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___zeroVector_5; // UnityEngine.Vector3 UnityEngine.Vector3::oneVector Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___oneVector_6; // UnityEngine.Vector3 UnityEngine.Vector3::upVector Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___upVector_7; // UnityEngine.Vector3 UnityEngine.Vector3::downVector Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___downVector_8; // UnityEngine.Vector3 UnityEngine.Vector3::leftVector Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___leftVector_9; // UnityEngine.Vector3 UnityEngine.Vector3::rightVector Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___rightVector_10; // UnityEngine.Vector3 UnityEngine.Vector3::forwardVector Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___forwardVector_11; // UnityEngine.Vector3 UnityEngine.Vector3::backVector Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___backVector_12; // UnityEngine.Vector3 UnityEngine.Vector3::positiveInfinityVector Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___positiveInfinityVector_13; // UnityEngine.Vector3 UnityEngine.Vector3::negativeInfinityVector Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___negativeInfinityVector_14; public: inline static int32_t get_offset_of_zeroVector_5() { return static_cast<int32_t>(offsetof(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E_StaticFields, ___zeroVector_5)); } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E get_zeroVector_5() const { return ___zeroVector_5; } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * get_address_of_zeroVector_5() { return &___zeroVector_5; } inline void set_zeroVector_5(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E value) { ___zeroVector_5 = value; } inline static int32_t get_offset_of_oneVector_6() { return static_cast<int32_t>(offsetof(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E_StaticFields, ___oneVector_6)); } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E get_oneVector_6() const { return ___oneVector_6; } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * get_address_of_oneVector_6() { return &___oneVector_6; } inline void set_oneVector_6(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E value) { ___oneVector_6 = value; } inline static int32_t get_offset_of_upVector_7() { return static_cast<int32_t>(offsetof(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E_StaticFields, ___upVector_7)); } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E get_upVector_7() const { return ___upVector_7; } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * get_address_of_upVector_7() { return &___upVector_7; } inline void set_upVector_7(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E value) { ___upVector_7 = value; } inline static int32_t get_offset_of_downVector_8() { return static_cast<int32_t>(offsetof(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E_StaticFields, ___downVector_8)); } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E get_downVector_8() const { return ___downVector_8; } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * get_address_of_downVector_8() { return &___downVector_8; } inline void set_downVector_8(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E value) { ___downVector_8 = value; } inline static int32_t get_offset_of_leftVector_9() { return static_cast<int32_t>(offsetof(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E_StaticFields, ___leftVector_9)); } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E get_leftVector_9() const { return ___leftVector_9; } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * get_address_of_leftVector_9() { return &___leftVector_9; } inline void set_leftVector_9(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E value) { ___leftVector_9 = value; } inline static int32_t get_offset_of_rightVector_10() { return static_cast<int32_t>(offsetof(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E_StaticFields, ___rightVector_10)); } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E get_rightVector_10() const { return ___rightVector_10; } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * get_address_of_rightVector_10() { return &___rightVector_10; } inline void set_rightVector_10(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E value) { ___rightVector_10 = value; } inline static int32_t get_offset_of_forwardVector_11() { return static_cast<int32_t>(offsetof(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E_StaticFields, ___forwardVector_11)); } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E get_forwardVector_11() const { return ___forwardVector_11; } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * get_address_of_forwardVector_11() { return &___forwardVector_11; } inline void set_forwardVector_11(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E value) { ___forwardVector_11 = value; } inline static int32_t get_offset_of_backVector_12() { return static_cast<int32_t>(offsetof(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E_StaticFields, ___backVector_12)); } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E get_backVector_12() const { return ___backVector_12; } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * get_address_of_backVector_12() { return &___backVector_12; } inline void set_backVector_12(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E value) { ___backVector_12 = value; } inline static int32_t get_offset_of_positiveInfinityVector_13() { return static_cast<int32_t>(offsetof(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E_StaticFields, ___positiveInfinityVector_13)); } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E get_positiveInfinityVector_13() const { return ___positiveInfinityVector_13; } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * get_address_of_positiveInfinityVector_13() { return &___positiveInfinityVector_13; } inline void set_positiveInfinityVector_13(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E value) { ___positiveInfinityVector_13 = value; } inline static int32_t get_offset_of_negativeInfinityVector_14() { return static_cast<int32_t>(offsetof(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E_StaticFields, ___negativeInfinityVector_14)); } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E get_negativeInfinityVector_14() const { return ___negativeInfinityVector_14; } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * get_address_of_negativeInfinityVector_14() { return &___negativeInfinityVector_14; } inline void set_negativeInfinityVector_14(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E value) { ___negativeInfinityVector_14 = value; } }; // System.Void struct Void_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5 { public: union { struct { }; uint8_t Void_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5__padding[1]; }; public: }; // UnityEngine.Collision struct Collision_tDC11F9B3834FD25DEB8C7DD1C51B635D240BBBF0 : public RuntimeObject { public: // UnityEngine.Vector3 UnityEngine.Collision::m_Impulse Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___m_Impulse_0; // UnityEngine.Vector3 UnityEngine.Collision::m_RelativeVelocity Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___m_RelativeVelocity_1; // UnityEngine.Rigidbody UnityEngine.Collision::m_Rigidbody Rigidbody_t101F2E2F9F16E765A77429B2DE4527D2047A887A * ___m_Rigidbody_2; // UnityEngine.Collider UnityEngine.Collision::m_Collider Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02 * ___m_Collider_3; // System.Int32 UnityEngine.Collision::m_ContactCount int32_t ___m_ContactCount_4; // UnityEngine.ContactPoint[] UnityEngine.Collision::m_ReusedContacts ContactPointU5BU5D_t1ACD262B1EA44CD48E2039381DE96847F203E62B* ___m_ReusedContacts_5; // UnityEngine.ContactPoint[] UnityEngine.Collision::m_LegacyContacts ContactPointU5BU5D_t1ACD262B1EA44CD48E2039381DE96847F203E62B* ___m_LegacyContacts_6; public: inline static int32_t get_offset_of_m_Impulse_0() { return static_cast<int32_t>(offsetof(Collision_tDC11F9B3834FD25DEB8C7DD1C51B635D240BBBF0, ___m_Impulse_0)); } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E get_m_Impulse_0() const { return ___m_Impulse_0; } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * get_address_of_m_Impulse_0() { return &___m_Impulse_0; } inline void set_m_Impulse_0(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E value) { ___m_Impulse_0 = value; } inline static int32_t get_offset_of_m_RelativeVelocity_1() { return static_cast<int32_t>(offsetof(Collision_tDC11F9B3834FD25DEB8C7DD1C51B635D240BBBF0, ___m_RelativeVelocity_1)); } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E get_m_RelativeVelocity_1() const { return ___m_RelativeVelocity_1; } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * get_address_of_m_RelativeVelocity_1() { return &___m_RelativeVelocity_1; } inline void set_m_RelativeVelocity_1(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E value) { ___m_RelativeVelocity_1 = value; } inline static int32_t get_offset_of_m_Rigidbody_2() { return static_cast<int32_t>(offsetof(Collision_tDC11F9B3834FD25DEB8C7DD1C51B635D240BBBF0, ___m_Rigidbody_2)); } inline Rigidbody_t101F2E2F9F16E765A77429B2DE4527D2047A887A * get_m_Rigidbody_2() const { return ___m_Rigidbody_2; } inline Rigidbody_t101F2E2F9F16E765A77429B2DE4527D2047A887A ** get_address_of_m_Rigidbody_2() { return &___m_Rigidbody_2; } inline void set_m_Rigidbody_2(Rigidbody_t101F2E2F9F16E765A77429B2DE4527D2047A887A * value) { ___m_Rigidbody_2 = value; Il2CppCodeGenWriteBarrier((void**)(&___m_Rigidbody_2), (void*)value); } inline static int32_t get_offset_of_m_Collider_3() { return static_cast<int32_t>(offsetof(Collision_tDC11F9B3834FD25DEB8C7DD1C51B635D240BBBF0, ___m_Collider_3)); } inline Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02 * get_m_Collider_3() const { return ___m_Collider_3; } inline Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02 ** get_address_of_m_Collider_3() { return &___m_Collider_3; } inline void set_m_Collider_3(Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02 * value) { ___m_Collider_3 = value; Il2CppCodeGenWriteBarrier((void**)(&___m_Collider_3), (void*)value); } inline static int32_t get_offset_of_m_ContactCount_4() { return static_cast<int32_t>(offsetof(Collision_tDC11F9B3834FD25DEB8C7DD1C51B635D240BBBF0, ___m_ContactCount_4)); } inline int32_t get_m_ContactCount_4() const { return ___m_ContactCount_4; } inline int32_t* get_address_of_m_ContactCount_4() { return &___m_ContactCount_4; } inline void set_m_ContactCount_4(int32_t value) { ___m_ContactCount_4 = value; } inline static int32_t get_offset_of_m_ReusedContacts_5() { return static_cast<int32_t>(offsetof(Collision_tDC11F9B3834FD25DEB8C7DD1C51B635D240BBBF0, ___m_ReusedContacts_5)); } inline ContactPointU5BU5D_t1ACD262B1EA44CD48E2039381DE96847F203E62B* get_m_ReusedContacts_5() const { return ___m_ReusedContacts_5; } inline ContactPointU5BU5D_t1ACD262B1EA44CD48E2039381DE96847F203E62B** get_address_of_m_ReusedContacts_5() { return &___m_ReusedContacts_5; } inline void set_m_ReusedContacts_5(ContactPointU5BU5D_t1ACD262B1EA44CD48E2039381DE96847F203E62B* value) { ___m_ReusedContacts_5 = value; Il2CppCodeGenWriteBarrier((void**)(&___m_ReusedContacts_5), (void*)value); } inline static int32_t get_offset_of_m_LegacyContacts_6() { return static_cast<int32_t>(offsetof(Collision_tDC11F9B3834FD25DEB8C7DD1C51B635D240BBBF0, ___m_LegacyContacts_6)); } inline ContactPointU5BU5D_t1ACD262B1EA44CD48E2039381DE96847F203E62B* get_m_LegacyContacts_6() const { return ___m_LegacyContacts_6; } inline ContactPointU5BU5D_t1ACD262B1EA44CD48E2039381DE96847F203E62B** get_address_of_m_LegacyContacts_6() { return &___m_LegacyContacts_6; } inline void set_m_LegacyContacts_6(ContactPointU5BU5D_t1ACD262B1EA44CD48E2039381DE96847F203E62B* value) { ___m_LegacyContacts_6 = value; Il2CppCodeGenWriteBarrier((void**)(&___m_LegacyContacts_6), (void*)value); } }; // Native definition for P/Invoke marshalling of UnityEngine.Collision struct Collision_tDC11F9B3834FD25DEB8C7DD1C51B635D240BBBF0_marshaled_pinvoke { Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___m_Impulse_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___m_RelativeVelocity_1; Rigidbody_t101F2E2F9F16E765A77429B2DE4527D2047A887A * ___m_Rigidbody_2; Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02 * ___m_Collider_3; int32_t ___m_ContactCount_4; ContactPoint_tC179732A8E0014F5EFF5977ED1ADF12CF14A9017 * ___m_ReusedContacts_5; ContactPoint_tC179732A8E0014F5EFF5977ED1ADF12CF14A9017 * ___m_LegacyContacts_6; }; // Native definition for COM marshalling of UnityEngine.Collision struct Collision_tDC11F9B3834FD25DEB8C7DD1C51B635D240BBBF0_marshaled_com { Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___m_Impulse_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___m_RelativeVelocity_1; Rigidbody_t101F2E2F9F16E765A77429B2DE4527D2047A887A * ___m_Rigidbody_2; Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02 * ___m_Collider_3; int32_t ___m_ContactCount_4; ContactPoint_tC179732A8E0014F5EFF5977ED1ADF12CF14A9017 * ___m_ReusedContacts_5; ContactPoint_tC179732A8E0014F5EFF5977ED1ADF12CF14A9017 * ___m_LegacyContacts_6; }; // UnityEngine.ContactPoint struct ContactPoint_tC179732A8E0014F5EFF5977ED1ADF12CF14A9017 { public: // UnityEngine.Vector3 UnityEngine.ContactPoint::m_Point Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___m_Point_0; // UnityEngine.Vector3 UnityEngine.ContactPoint::m_Normal Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___m_Normal_1; // System.Int32 UnityEngine.ContactPoint::m_ThisColliderInstanceID int32_t ___m_ThisColliderInstanceID_2; // System.Int32 UnityEngine.ContactPoint::m_OtherColliderInstanceID int32_t ___m_OtherColliderInstanceID_3; // System.Single UnityEngine.ContactPoint::m_Separation float ___m_Separation_4; public: inline static int32_t get_offset_of_m_Point_0() { return static_cast<int32_t>(offsetof(ContactPoint_tC179732A8E0014F5EFF5977ED1ADF12CF14A9017, ___m_Point_0)); } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E get_m_Point_0() const { return ___m_Point_0; } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * get_address_of_m_Point_0() { return &___m_Point_0; } inline void set_m_Point_0(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E value) { ___m_Point_0 = value; } inline static int32_t get_offset_of_m_Normal_1() { return static_cast<int32_t>(offsetof(ContactPoint_tC179732A8E0014F5EFF5977ED1ADF12CF14A9017, ___m_Normal_1)); } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E get_m_Normal_1() const { return ___m_Normal_1; } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * get_address_of_m_Normal_1() { return &___m_Normal_1; } inline void set_m_Normal_1(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E value) { ___m_Normal_1 = value; } inline static int32_t get_offset_of_m_ThisColliderInstanceID_2() { return static_cast<int32_t>(offsetof(ContactPoint_tC179732A8E0014F5EFF5977ED1ADF12CF14A9017, ___m_ThisColliderInstanceID_2)); } inline int32_t get_m_ThisColliderInstanceID_2() const { return ___m_ThisColliderInstanceID_2; } inline int32_t* get_address_of_m_ThisColliderInstanceID_2() { return &___m_ThisColliderInstanceID_2; } inline void set_m_ThisColliderInstanceID_2(int32_t value) { ___m_ThisColliderInstanceID_2 = value; } inline static int32_t get_offset_of_m_OtherColliderInstanceID_3() { return static_cast<int32_t>(offsetof(ContactPoint_tC179732A8E0014F5EFF5977ED1ADF12CF14A9017, ___m_OtherColliderInstanceID_3)); } inline int32_t get_m_OtherColliderInstanceID_3() const { return ___m_OtherColliderInstanceID_3; } inline int32_t* get_address_of_m_OtherColliderInstanceID_3() { return &___m_OtherColliderInstanceID_3; } inline void set_m_OtherColliderInstanceID_3(int32_t value) { ___m_OtherColliderInstanceID_3 = value; } inline static int32_t get_offset_of_m_Separation_4() { return static_cast<int32_t>(offsetof(ContactPoint_tC179732A8E0014F5EFF5977ED1ADF12CF14A9017, ___m_Separation_4)); } inline float get_m_Separation_4() const { return ___m_Separation_4; } inline float* get_address_of_m_Separation_4() { return &___m_Separation_4; } inline void set_m_Separation_4(float value) { ___m_Separation_4 = value; } }; // UnityEngine.ControllerColliderHit struct ControllerColliderHit_t483E787AA2D92263EC1F899BCF1FFC3F2B96D550 : public RuntimeObject { public: // UnityEngine.CharacterController UnityEngine.ControllerColliderHit::m_Controller CharacterController_tCCF68621C784CCB3391E0C66FE134F6F93DD6C2E * ___m_Controller_0; // UnityEngine.Collider UnityEngine.ControllerColliderHit::m_Collider Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02 * ___m_Collider_1; // UnityEngine.Vector3 UnityEngine.ControllerColliderHit::m_Point Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___m_Point_2; // UnityEngine.Vector3 UnityEngine.ControllerColliderHit::m_Normal Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___m_Normal_3; // UnityEngine.Vector3 UnityEngine.ControllerColliderHit::m_MoveDirection Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___m_MoveDirection_4; // System.Single UnityEngine.ControllerColliderHit::m_MoveLength float ___m_MoveLength_5; // System.Int32 UnityEngine.ControllerColliderHit::m_Push int32_t ___m_Push_6; public: inline static int32_t get_offset_of_m_Controller_0() { return static_cast<int32_t>(offsetof(ControllerColliderHit_t483E787AA2D92263EC1F899BCF1FFC3F2B96D550, ___m_Controller_0)); } inline CharacterController_tCCF68621C784CCB3391E0C66FE134F6F93DD6C2E * get_m_Controller_0() const { return ___m_Controller_0; } inline CharacterController_tCCF68621C784CCB3391E0C66FE134F6F93DD6C2E ** get_address_of_m_Controller_0() { return &___m_Controller_0; } inline void set_m_Controller_0(CharacterController_tCCF68621C784CCB3391E0C66FE134F6F93DD6C2E * value) { ___m_Controller_0 = value; Il2CppCodeGenWriteBarrier((void**)(&___m_Controller_0), (void*)value); } inline static int32_t get_offset_of_m_Collider_1() { return static_cast<int32_t>(offsetof(ControllerColliderHit_t483E787AA2D92263EC1F899BCF1FFC3F2B96D550, ___m_Collider_1)); } inline Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02 * get_m_Collider_1() const { return ___m_Collider_1; } inline Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02 ** get_address_of_m_Collider_1() { return &___m_Collider_1; } inline void set_m_Collider_1(Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02 * value) { ___m_Collider_1 = value; Il2CppCodeGenWriteBarrier((void**)(&___m_Collider_1), (void*)value); } inline static int32_t get_offset_of_m_Point_2() { return static_cast<int32_t>(offsetof(ControllerColliderHit_t483E787AA2D92263EC1F899BCF1FFC3F2B96D550, ___m_Point_2)); } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E get_m_Point_2() const { return ___m_Point_2; } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * get_address_of_m_Point_2() { return &___m_Point_2; } inline void set_m_Point_2(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E value) { ___m_Point_2 = value; } inline static int32_t get_offset_of_m_Normal_3() { return static_cast<int32_t>(offsetof(ControllerColliderHit_t483E787AA2D92263EC1F899BCF1FFC3F2B96D550, ___m_Normal_3)); } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E get_m_Normal_3() const { return ___m_Normal_3; } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * get_address_of_m_Normal_3() { return &___m_Normal_3; } inline void set_m_Normal_3(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E value) { ___m_Normal_3 = value; } inline static int32_t get_offset_of_m_MoveDirection_4() { return static_cast<int32_t>(offsetof(ControllerColliderHit_t483E787AA2D92263EC1F899BCF1FFC3F2B96D550, ___m_MoveDirection_4)); } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E get_m_MoveDirection_4() const { return ___m_MoveDirection_4; } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * get_address_of_m_MoveDirection_4() { return &___m_MoveDirection_4; } inline void set_m_MoveDirection_4(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E value) { ___m_MoveDirection_4 = value; } inline static int32_t get_offset_of_m_MoveLength_5() { return static_cast<int32_t>(offsetof(ControllerColliderHit_t483E787AA2D92263EC1F899BCF1FFC3F2B96D550, ___m_MoveLength_5)); } inline float get_m_MoveLength_5() const { return ___m_MoveLength_5; } inline float* get_address_of_m_MoveLength_5() { return &___m_MoveLength_5; } inline void set_m_MoveLength_5(float value) { ___m_MoveLength_5 = value; } inline static int32_t get_offset_of_m_Push_6() { return static_cast<int32_t>(offsetof(ControllerColliderHit_t483E787AA2D92263EC1F899BCF1FFC3F2B96D550, ___m_Push_6)); } inline int32_t get_m_Push_6() const { return ___m_Push_6; } inline int32_t* get_address_of_m_Push_6() { return &___m_Push_6; } inline void set_m_Push_6(int32_t value) { ___m_Push_6 = value; } }; // Native definition for P/Invoke marshalling of UnityEngine.ControllerColliderHit struct ControllerColliderHit_t483E787AA2D92263EC1F899BCF1FFC3F2B96D550_marshaled_pinvoke { CharacterController_tCCF68621C784CCB3391E0C66FE134F6F93DD6C2E * ___m_Controller_0; Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02 * ___m_Collider_1; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___m_Point_2; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___m_Normal_3; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___m_MoveDirection_4; float ___m_MoveLength_5; int32_t ___m_Push_6; }; // Native definition for COM marshalling of UnityEngine.ControllerColliderHit struct ControllerColliderHit_t483E787AA2D92263EC1F899BCF1FFC3F2B96D550_marshaled_com { CharacterController_tCCF68621C784CCB3391E0C66FE134F6F93DD6C2E * ___m_Controller_0; Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02 * ___m_Collider_1; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___m_Point_2; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___m_Normal_3; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___m_MoveDirection_4; float ___m_MoveLength_5; int32_t ___m_Push_6; }; // UnityEngine.Object struct Object_tF2F3778131EFF286AF62B7B013A170F95A91571A : 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_tF2F3778131EFF286AF62B7B013A170F95A91571A, ___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_tF2F3778131EFF286AF62B7B013A170F95A91571A_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_tF2F3778131EFF286AF62B7B013A170F95A91571A_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; } }; // Native definition for P/Invoke marshalling of UnityEngine.Object struct Object_tF2F3778131EFF286AF62B7B013A170F95A91571A_marshaled_pinvoke { intptr_t ___m_CachedPtr_0; }; // Native definition for COM marshalling of UnityEngine.Object struct Object_tF2F3778131EFF286AF62B7B013A170F95A91571A_marshaled_com { intptr_t ___m_CachedPtr_0; }; // UnityEngine.QueryTriggerInteraction struct QueryTriggerInteraction_t9B82FB8CCAF559F47B6B8C0ECE197515ABFA96B0 { public: // System.Int32 UnityEngine.QueryTriggerInteraction::value__ int32_t ___value___2; public: inline static int32_t get_offset_of_value___2() { return static_cast<int32_t>(offsetof(QueryTriggerInteraction_t9B82FB8CCAF559F47B6B8C0ECE197515ABFA96B0, ___value___2)); } inline int32_t get_value___2() const { return ___value___2; } inline int32_t* get_address_of_value___2() { return &___value___2; } inline void set_value___2(int32_t value) { ___value___2 = value; } }; // UnityEngine.Ray struct Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 { public: // UnityEngine.Vector3 UnityEngine.Ray::m_Origin Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___m_Origin_0; // UnityEngine.Vector3 UnityEngine.Ray::m_Direction Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___m_Direction_1; public: inline static int32_t get_offset_of_m_Origin_0() { return static_cast<int32_t>(offsetof(Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6, ___m_Origin_0)); } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E get_m_Origin_0() const { return ___m_Origin_0; } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * get_address_of_m_Origin_0() { return &___m_Origin_0; } inline void set_m_Origin_0(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E value) { ___m_Origin_0 = value; } inline static int32_t get_offset_of_m_Direction_1() { return static_cast<int32_t>(offsetof(Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6, ___m_Direction_1)); } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E get_m_Direction_1() const { return ___m_Direction_1; } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * get_address_of_m_Direction_1() { return &___m_Direction_1; } inline void set_m_Direction_1(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E value) { ___m_Direction_1 = value; } }; // UnityEngine.RaycastHit struct RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 { public: // UnityEngine.Vector3 UnityEngine.RaycastHit::m_Point Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___m_Point_0; // UnityEngine.Vector3 UnityEngine.RaycastHit::m_Normal Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___m_Normal_1; // System.UInt32 UnityEngine.RaycastHit::m_FaceID uint32_t ___m_FaceID_2; // System.Single UnityEngine.RaycastHit::m_Distance float ___m_Distance_3; // UnityEngine.Vector2 UnityEngine.RaycastHit::m_UV Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 ___m_UV_4; // System.Int32 UnityEngine.RaycastHit::m_Collider int32_t ___m_Collider_5; public: inline static int32_t get_offset_of_m_Point_0() { return static_cast<int32_t>(offsetof(RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89, ___m_Point_0)); } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E get_m_Point_0() const { return ___m_Point_0; } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * get_address_of_m_Point_0() { return &___m_Point_0; } inline void set_m_Point_0(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E value) { ___m_Point_0 = value; } inline static int32_t get_offset_of_m_Normal_1() { return static_cast<int32_t>(offsetof(RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89, ___m_Normal_1)); } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E get_m_Normal_1() const { return ___m_Normal_1; } inline Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * get_address_of_m_Normal_1() { return &___m_Normal_1; } inline void set_m_Normal_1(Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E value) { ___m_Normal_1 = value; } inline static int32_t get_offset_of_m_FaceID_2() { return static_cast<int32_t>(offsetof(RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89, ___m_FaceID_2)); } inline uint32_t get_m_FaceID_2() const { return ___m_FaceID_2; } inline uint32_t* get_address_of_m_FaceID_2() { return &___m_FaceID_2; } inline void set_m_FaceID_2(uint32_t value) { ___m_FaceID_2 = value; } inline static int32_t get_offset_of_m_Distance_3() { return static_cast<int32_t>(offsetof(RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89, ___m_Distance_3)); } inline float get_m_Distance_3() const { return ___m_Distance_3; } inline float* get_address_of_m_Distance_3() { return &___m_Distance_3; } inline void set_m_Distance_3(float value) { ___m_Distance_3 = value; } inline static int32_t get_offset_of_m_UV_4() { return static_cast<int32_t>(offsetof(RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89, ___m_UV_4)); } inline Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 get_m_UV_4() const { return ___m_UV_4; } inline Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 * get_address_of_m_UV_4() { return &___m_UV_4; } inline void set_m_UV_4(Vector2_tBB32F2736AEC229A7BFBCE18197EC0F6AC7EC2D9 value) { ___m_UV_4 = value; } inline static int32_t get_offset_of_m_Collider_5() { return static_cast<int32_t>(offsetof(RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89, ___m_Collider_5)); } inline int32_t get_m_Collider_5() const { return ___m_Collider_5; } inline int32_t* get_address_of_m_Collider_5() { return &___m_Collider_5; } inline void set_m_Collider_5(int32_t value) { ___m_Collider_5 = value; } }; // UnityEngine.Component struct Component_t62FBC8D2420DA4BE9037AFE430740F6B3EECA684 : public Object_tF2F3778131EFF286AF62B7B013A170F95A91571A { public: public: }; // UnityEngine.Collider struct Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02 : public Component_t62FBC8D2420DA4BE9037AFE430740F6B3EECA684 { public: public: }; // UnityEngine.Rigidbody struct Rigidbody_t101F2E2F9F16E765A77429B2DE4527D2047A887A : public Component_t62FBC8D2420DA4BE9037AFE430740F6B3EECA684 { public: public: }; // UnityEngine.BoxCollider struct BoxCollider_tA530691AC1A3C9FE6428F68F98588FCB1BF9AAA5 : public Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02 { public: public: }; // UnityEngine.CapsuleCollider struct CapsuleCollider_t89745329298279F4827FE29C54CC2F8A28654635 : public Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02 { public: public: }; // UnityEngine.CharacterController struct CharacterController_tCCF68621C784CCB3391E0C66FE134F6F93DD6C2E : public Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02 { public: public: }; // UnityEngine.MeshCollider struct MeshCollider_t1983F4E7E53D8C6B65FE21A8B4E2345A84D57E98 : public Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02 { public: public: }; // UnityEngine.SphereCollider struct SphereCollider_t51A338502EEE6FA563248E3C0BF38D333077DC3A : public Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif // UnityEngine.ContactPoint[] struct ContactPointU5BU5D_t1ACD262B1EA44CD48E2039381DE96847F203E62B : public RuntimeArray { public: ALIGN_FIELD (8) ContactPoint_tC179732A8E0014F5EFF5977ED1ADF12CF14A9017 m_Items[1]; public: inline ContactPoint_tC179732A8E0014F5EFF5977ED1ADF12CF14A9017 GetAt(il2cpp_array_size_t index) const { IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length); return m_Items[index]; } inline ContactPoint_tC179732A8E0014F5EFF5977ED1ADF12CF14A9017 * 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, ContactPoint_tC179732A8E0014F5EFF5977ED1ADF12CF14A9017 value) { IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length); m_Items[index] = value; } inline ContactPoint_tC179732A8E0014F5EFF5977ED1ADF12CF14A9017 GetAtUnchecked(il2cpp_array_size_t index) const { return m_Items[index]; } inline ContactPoint_tC179732A8E0014F5EFF5977ED1ADF12CF14A9017 * GetAddressAtUnchecked(il2cpp_array_size_t index) { return m_Items + index; } inline void SetAtUnchecked(il2cpp_array_size_t index, ContactPoint_tC179732A8E0014F5EFF5977ED1ADF12CF14A9017 value) { m_Items[index] = value; } }; // UnityEngine.RaycastHit[] struct RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09 : public RuntimeArray { public: ALIGN_FIELD (8) RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 m_Items[1]; public: inline RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 GetAt(il2cpp_array_size_t index) const { IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length); return m_Items[index]; } inline RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * 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, RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 value) { IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length); m_Items[index] = value; } inline RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 GetAtUnchecked(il2cpp_array_size_t index) const { return m_Items[index]; } inline RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * GetAddressAtUnchecked(il2cpp_array_size_t index) { return m_Items + index; } inline void SetAtUnchecked(il2cpp_array_size_t index, RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 value) { m_Items[index] = value; } }; // System.Object[] struct ObjectU5BU5D_tC1F4EE0DB0B7300255F5FD4AF64FE4C585CF5ADE : public RuntimeArray { public: ALIGN_FIELD (8) RuntimeObject * m_Items[1]; public: inline RuntimeObject * GetAt(il2cpp_array_size_t index) const { IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length); return m_Items[index]; } inline RuntimeObject ** GetAddressAt(il2cpp_array_size_t index) { IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length); return m_Items + index; } inline void SetAt(il2cpp_array_size_t index, RuntimeObject * value) { IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length); m_Items[index] = value; Il2CppCodeGenWriteBarrier((void**)m_Items + index, (void*)value); } inline RuntimeObject * GetAtUnchecked(il2cpp_array_size_t index) const { return m_Items[index]; } inline RuntimeObject ** GetAddressAtUnchecked(il2cpp_array_size_t index) { return m_Items + index; } inline void SetAtUnchecked(il2cpp_array_size_t index, RuntimeObject * value) { m_Items[index] = value; Il2CppCodeGenWriteBarrier((void**)m_Items + index, (void*)value); } }; // System.Void UnityEngine.Physics::get_defaultPhysicsScene_Injected(UnityEngine.PhysicsScene&) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void Physics_get_defaultPhysicsScene_Injected_m0B71068269B3C8499A258BBCAEA7E3D9D020BADA (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * ___ret0, const RuntimeMethod* method); // UnityEngine.PhysicsScene UnityEngine.Physics::get_defaultPhysicsScene() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 Physics_get_defaultPhysicsScene_mA6361488FBAC110DA8397E5E4CB473EBF4191010 (const RuntimeMethod* method); // System.Boolean UnityEngine.PhysicsScene::Raycast(UnityEngine.Vector3,UnityEngine.Vector3,System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool PhysicsScene_Raycast_m8C3E61EB7C3DB8AAC6FEB098D815062BEF821187 (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * __this, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, float ___maxDistance2, int32_t ___layerMask3, int32_t ___queryTriggerInteraction4, const RuntimeMethod* method); // System.Boolean UnityEngine.PhysicsScene::Raycast(UnityEngine.Vector3,UnityEngine.Vector3,UnityEngine.RaycastHit&,System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool PhysicsScene_Raycast_mFC0D59C4439EE9DA6E8AA5F6891915132D587208 (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * __this, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * ___hitInfo2, float ___maxDistance3, int32_t ___layerMask4, int32_t ___queryTriggerInteraction5, const RuntimeMethod* method); // UnityEngine.Vector3 UnityEngine.Ray::get_origin() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E Ray_get_origin_m0C1B2BFF99CDF5231AC29AC031C161F55B53C1D0 (Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 * __this, const RuntimeMethod* method); // UnityEngine.Vector3 UnityEngine.Ray::get_direction() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E Ray_get_direction_m2B31F86F19B64474A901B28D3808011AE7A13EFC (Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 * __this, const RuntimeMethod* method); // System.Boolean UnityEngine.Physics::Raycast(UnityEngine.Vector3,UnityEngine.Vector3,UnityEngine.RaycastHit&,System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool Physics_Raycast_m2EA572B4613E1BD7DBAA299511CFD2DBA179A163 (Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * ___hitInfo2, float ___maxDistance3, int32_t ___layerMask4, int32_t ___queryTriggerInteraction5, const RuntimeMethod* method); // UnityEngine.RaycastHit[] UnityEngine.Physics::Internal_RaycastAll_Injected(UnityEngine.PhysicsScene&,UnityEngine.Ray&,System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* Physics_Internal_RaycastAll_Injected_mD4C3E8762D9FCEE654CE0415E636EB7DBEC92A5B (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * ___physicsScene0, Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 * ___ray1, float ___maxDistance2, int32_t ___mask3, int32_t ___queryTriggerInteraction4, const RuntimeMethod* method); // System.Single UnityEngine.Vector3::get_magnitude() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR float Vector3_get_magnitude_mDDD40612220D8104E77E993E18A101A69A944991 (Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * __this, const RuntimeMethod* method); // UnityEngine.Vector3 UnityEngine.Vector3::op_Division(UnityEngine.Vector3,System.Single) IL2CPP_MANAGED_FORCE_INLINE IL2CPP_METHOD_ATTR Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E Vector3_op_Division_mE5ACBFB168FED529587457A83BA98B7DB32E2A05_inline (Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___a0, float ___d1, const RuntimeMethod* method); // System.Void UnityEngine.Ray::.ctor(UnityEngine.Vector3,UnityEngine.Vector3) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void Ray__ctor_m75B1F651FF47EE6B887105101B7DA61CBF41F83C (Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 * __this, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, const RuntimeMethod* method); // UnityEngine.RaycastHit[] UnityEngine.Physics::Internal_RaycastAll(UnityEngine.PhysicsScene,UnityEngine.Ray,System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* Physics_Internal_RaycastAll_m39EE7CF896F9D8BA58CC623F14E4DB0641480523 (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 ___physicsScene0, Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 ___ray1, float ___maxDistance2, int32_t ___mask3, int32_t ___queryTriggerInteraction4, const RuntimeMethod* method); // UnityEngine.RaycastHit[] UnityEngine.Physics::RaycastAll(UnityEngine.Vector3,UnityEngine.Vector3,System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* Physics_RaycastAll_m5103E7C60CC66BAFA6534D1736138A92EB1EF2B8 (Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, float ___maxDistance2, int32_t ___layerMask3, int32_t ___queryTriggerInteraction4, const RuntimeMethod* method); // System.Int32 UnityEngine.PhysicsScene::Raycast(UnityEngine.Vector3,UnityEngine.Vector3,UnityEngine.RaycastHit[],System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR int32_t PhysicsScene_Raycast_m95CAB68EB9165E3AB2A4D441F7DF9767AD4B7F73 (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * __this, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* ___raycastHits2, float ___maxDistance3, int32_t ___layerMask4, int32_t ___queryTriggerInteraction5, const RuntimeMethod* method); // System.String UnityEngine.UnityString::Format(System.String,System.Object[]) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR String_t* UnityString_Format_m7A07C068ED408DD06F634070770FB55F13AA4EC9 (String_t* ___fmt0, ObjectU5BU5D_tC1F4EE0DB0B7300255F5FD4AF64FE4C585CF5ADE* ___args1, const RuntimeMethod* method); // System.String UnityEngine.PhysicsScene::ToString() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR String_t* PhysicsScene_ToString_mBB6D0AC1E3E2EDC34CB4A7A34485B24B6271903F (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * __this, const RuntimeMethod* method); // System.Int32 UnityEngine.PhysicsScene::GetHashCode() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR int32_t PhysicsScene_GetHashCode_m5344CC6CCCB1CA6EBB149775EE028089DD74B8A2 (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * __this, const RuntimeMethod* method); // System.Boolean UnityEngine.PhysicsScene::Equals(System.Object) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool PhysicsScene_Equals_m2645ABB96C598F197F734EB712494795928CBCEC (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * __this, RuntimeObject * ___other0, const RuntimeMethod* method); // System.Boolean UnityEngine.PhysicsScene::Equals(UnityEngine.PhysicsScene) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool PhysicsScene_Equals_m8C948B86D105177D519A3608816CDC698C8686B8 (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * __this, PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 ___other0, const RuntimeMethod* method); // System.Boolean UnityEngine.PhysicsScene::Internal_RaycastTest(UnityEngine.PhysicsScene,UnityEngine.Ray,System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool PhysicsScene_Internal_RaycastTest_m6715CAD8D0330195269AA7FCCD91613BC564E3EB (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 ___physicsScene0, Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 ___ray1, float ___maxDistance2, int32_t ___layerMask3, int32_t ___queryTriggerInteraction4, const RuntimeMethod* method); // System.Boolean UnityEngine.PhysicsScene::Internal_RaycastTest_Injected(UnityEngine.PhysicsScene&,UnityEngine.Ray&,System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool PhysicsScene_Internal_RaycastTest_Injected_m956474EFEA507F82ABE0BCB75DDB3CC8EFF4D12B (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * ___physicsScene0, Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 * ___ray1, float ___maxDistance2, int32_t ___layerMask3, int32_t ___queryTriggerInteraction4, const RuntimeMethod* method); // System.Boolean UnityEngine.PhysicsScene::Internal_Raycast(UnityEngine.PhysicsScene,UnityEngine.Ray,System.Single,UnityEngine.RaycastHit&,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool PhysicsScene_Internal_Raycast_m1E630AA11805114B090FC50741AEF64D677AF2C7 (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 ___physicsScene0, Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 ___ray1, float ___maxDistance2, RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * ___hit3, int32_t ___layerMask4, int32_t ___queryTriggerInteraction5, const RuntimeMethod* method); // System.Boolean UnityEngine.PhysicsScene::Internal_Raycast_Injected(UnityEngine.PhysicsScene&,UnityEngine.Ray&,System.Single,UnityEngine.RaycastHit&,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool PhysicsScene_Internal_Raycast_Injected_m8868E0BF89F8C42D11F42F94F9CF767647433BB1 (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * ___physicsScene0, Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 * ___ray1, float ___maxDistance2, RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * ___hit3, int32_t ___layerMask4, int32_t ___queryTriggerInteraction5, const RuntimeMethod* method); // UnityEngine.Vector3 UnityEngine.Vector3::get_normalized() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E Vector3_get_normalized_m2FA6DF38F97BDA4CCBDAE12B9FE913A241DAC8D5 (Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * __this, const RuntimeMethod* method); // System.Int32 UnityEngine.PhysicsScene::Internal_RaycastNonAlloc(UnityEngine.PhysicsScene,UnityEngine.Ray,UnityEngine.RaycastHit[],System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR int32_t PhysicsScene_Internal_RaycastNonAlloc_mE7833EE5F1082431A4C2D29362F5DCDEFBF6D2BD (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 ___physicsScene0, Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 ___ray1, RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* ___raycastHits2, float ___maxDistance3, int32_t ___mask4, int32_t ___queryTriggerInteraction5, const RuntimeMethod* method); // System.Int32 UnityEngine.PhysicsScene::Internal_RaycastNonAlloc_Injected(UnityEngine.PhysicsScene&,UnityEngine.Ray&,UnityEngine.RaycastHit[],System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR int32_t PhysicsScene_Internal_RaycastNonAlloc_Injected_m59FB44C18E62D21E9320F30229C0AA9F9B971211 (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * ___physicsScene0, Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 * ___ray1, RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* ___raycastHits2, float ___maxDistance3, int32_t ___mask4, int32_t ___queryTriggerInteraction5, const RuntimeMethod* method); // UnityEngine.Object UnityEngine.Object::FindObjectFromInstanceID(System.Int32) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR Object_tF2F3778131EFF286AF62B7B013A170F95A91571A * Object_FindObjectFromInstanceID_m0AD731D3F583CBBDC7DC0E08B38F742B447FA44A (int32_t ___instanceID0, const RuntimeMethod* method); // UnityEngine.Collider UnityEngine.RaycastHit::get_collider() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02 * RaycastHit_get_collider_m13A3DE16FBC631E0A1F987E0B22CE70AF8AB539E (RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * __this, const RuntimeMethod* method); // UnityEngine.Vector3 UnityEngine.RaycastHit::get_point() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E RaycastHit_get_point_m32F7282CBB2E13393A33BAD046BDA218E48DD21E (RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * __this, const RuntimeMethod* method); // UnityEngine.Vector3 UnityEngine.RaycastHit::get_normal() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E RaycastHit_get_normal_m2C813B25BAECD87FD9E9CB294278B291F4CC6674 (RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * __this, const RuntimeMethod* method); // System.Single UnityEngine.RaycastHit::get_distance() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR float RaycastHit_get_distance_m85FCA98D7957C3BF1D449CA1B48C116CCD6226FA (RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * __this, const RuntimeMethod* method); // System.Void UnityEngine.Rigidbody::set_velocity_Injected(UnityEngine.Vector3&) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void Rigidbody_set_velocity_Injected_mBFBC7681B33942F69A5CD908941D399777F66ADD (Rigidbody_t101F2E2F9F16E765A77429B2DE4527D2047A887A * __this, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * ___value0, const RuntimeMethod* method); // System.Void UnityEngine.Vector3::.ctor(System.Single,System.Single,System.Single) IL2CPP_MANAGED_FORCE_INLINE IL2CPP_METHOD_ATTR void Vector3__ctor_m57495F692C6CE1CEF278CAD9A98221165D37E636_inline (Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * __this, float ___x0, float ___y1, float ___z2, const RuntimeMethod* method); #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif #ifdef __clang__ #pragma clang diagnostic pop #endif #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif #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 #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 // Conversion methods for marshalling of: UnityEngine.Collision IL2CPP_EXTERN_C void Collision_tDC11F9B3834FD25DEB8C7DD1C51B635D240BBBF0_marshal_pinvoke(const Collision_tDC11F9B3834FD25DEB8C7DD1C51B635D240BBBF0& unmarshaled, Collision_tDC11F9B3834FD25DEB8C7DD1C51B635D240BBBF0_marshaled_pinvoke& marshaled) { Exception_t* ___m_Rigidbody_2Exception = il2cpp_codegen_get_marshal_directive_exception("Cannot marshal field 'm_Rigidbody' of type 'Collision': Reference type field marshaling is not supported."); IL2CPP_RAISE_MANAGED_EXCEPTION(___m_Rigidbody_2Exception, NULL); } IL2CPP_EXTERN_C void Collision_tDC11F9B3834FD25DEB8C7DD1C51B635D240BBBF0_marshal_pinvoke_back(const Collision_tDC11F9B3834FD25DEB8C7DD1C51B635D240BBBF0_marshaled_pinvoke& marshaled, Collision_tDC11F9B3834FD25DEB8C7DD1C51B635D240BBBF0& unmarshaled) { Exception_t* ___m_Rigidbody_2Exception = il2cpp_codegen_get_marshal_directive_exception("Cannot marshal field 'm_Rigidbody' of type 'Collision': Reference type field marshaling is not supported."); IL2CPP_RAISE_MANAGED_EXCEPTION(___m_Rigidbody_2Exception, NULL); } // Conversion method for clean up from marshalling of: UnityEngine.Collision IL2CPP_EXTERN_C void Collision_tDC11F9B3834FD25DEB8C7DD1C51B635D240BBBF0_marshal_pinvoke_cleanup(Collision_tDC11F9B3834FD25DEB8C7DD1C51B635D240BBBF0_marshaled_pinvoke& marshaled) { } // Conversion methods for marshalling of: UnityEngine.Collision IL2CPP_EXTERN_C void Collision_tDC11F9B3834FD25DEB8C7DD1C51B635D240BBBF0_marshal_com(const Collision_tDC11F9B3834FD25DEB8C7DD1C51B635D240BBBF0& unmarshaled, Collision_tDC11F9B3834FD25DEB8C7DD1C51B635D240BBBF0_marshaled_com& marshaled) { Exception_t* ___m_Rigidbody_2Exception = il2cpp_codegen_get_marshal_directive_exception("Cannot marshal field 'm_Rigidbody' of type 'Collision': Reference type field marshaling is not supported."); IL2CPP_RAISE_MANAGED_EXCEPTION(___m_Rigidbody_2Exception, NULL); } IL2CPP_EXTERN_C void Collision_tDC11F9B3834FD25DEB8C7DD1C51B635D240BBBF0_marshal_com_back(const Collision_tDC11F9B3834FD25DEB8C7DD1C51B635D240BBBF0_marshaled_com& marshaled, Collision_tDC11F9B3834FD25DEB8C7DD1C51B635D240BBBF0& unmarshaled) { Exception_t* ___m_Rigidbody_2Exception = il2cpp_codegen_get_marshal_directive_exception("Cannot marshal field 'm_Rigidbody' of type 'Collision': Reference type field marshaling is not supported."); IL2CPP_RAISE_MANAGED_EXCEPTION(___m_Rigidbody_2Exception, NULL); } // Conversion method for clean up from marshalling of: UnityEngine.Collision IL2CPP_EXTERN_C void Collision_tDC11F9B3834FD25DEB8C7DD1C51B635D240BBBF0_marshal_com_cleanup(Collision_tDC11F9B3834FD25DEB8C7DD1C51B635D240BBBF0_marshaled_com& marshaled) { } #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 // Conversion methods for marshalling of: UnityEngine.ControllerColliderHit IL2CPP_EXTERN_C void ControllerColliderHit_t483E787AA2D92263EC1F899BCF1FFC3F2B96D550_marshal_pinvoke(const ControllerColliderHit_t483E787AA2D92263EC1F899BCF1FFC3F2B96D550& unmarshaled, ControllerColliderHit_t483E787AA2D92263EC1F899BCF1FFC3F2B96D550_marshaled_pinvoke& marshaled) { Exception_t* ___m_Controller_0Exception = il2cpp_codegen_get_marshal_directive_exception("Cannot marshal field 'm_Controller' of type 'ControllerColliderHit': Reference type field marshaling is not supported."); IL2CPP_RAISE_MANAGED_EXCEPTION(___m_Controller_0Exception, NULL); } IL2CPP_EXTERN_C void ControllerColliderHit_t483E787AA2D92263EC1F899BCF1FFC3F2B96D550_marshal_pinvoke_back(const ControllerColliderHit_t483E787AA2D92263EC1F899BCF1FFC3F2B96D550_marshaled_pinvoke& marshaled, ControllerColliderHit_t483E787AA2D92263EC1F899BCF1FFC3F2B96D550& unmarshaled) { Exception_t* ___m_Controller_0Exception = il2cpp_codegen_get_marshal_directive_exception("Cannot marshal field 'm_Controller' of type 'ControllerColliderHit': Reference type field marshaling is not supported."); IL2CPP_RAISE_MANAGED_EXCEPTION(___m_Controller_0Exception, NULL); } // Conversion method for clean up from marshalling of: UnityEngine.ControllerColliderHit IL2CPP_EXTERN_C void ControllerColliderHit_t483E787AA2D92263EC1F899BCF1FFC3F2B96D550_marshal_pinvoke_cleanup(ControllerColliderHit_t483E787AA2D92263EC1F899BCF1FFC3F2B96D550_marshaled_pinvoke& marshaled) { } // Conversion methods for marshalling of: UnityEngine.ControllerColliderHit IL2CPP_EXTERN_C void ControllerColliderHit_t483E787AA2D92263EC1F899BCF1FFC3F2B96D550_marshal_com(const ControllerColliderHit_t483E787AA2D92263EC1F899BCF1FFC3F2B96D550& unmarshaled, ControllerColliderHit_t483E787AA2D92263EC1F899BCF1FFC3F2B96D550_marshaled_com& marshaled) { Exception_t* ___m_Controller_0Exception = il2cpp_codegen_get_marshal_directive_exception("Cannot marshal field 'm_Controller' of type 'ControllerColliderHit': Reference type field marshaling is not supported."); IL2CPP_RAISE_MANAGED_EXCEPTION(___m_Controller_0Exception, NULL); } IL2CPP_EXTERN_C void ControllerColliderHit_t483E787AA2D92263EC1F899BCF1FFC3F2B96D550_marshal_com_back(const ControllerColliderHit_t483E787AA2D92263EC1F899BCF1FFC3F2B96D550_marshaled_com& marshaled, ControllerColliderHit_t483E787AA2D92263EC1F899BCF1FFC3F2B96D550& unmarshaled) { Exception_t* ___m_Controller_0Exception = il2cpp_codegen_get_marshal_directive_exception("Cannot marshal field 'm_Controller' of type 'ControllerColliderHit': Reference type field marshaling is not supported."); IL2CPP_RAISE_MANAGED_EXCEPTION(___m_Controller_0Exception, NULL); } // Conversion method for clean up from marshalling of: UnityEngine.ControllerColliderHit IL2CPP_EXTERN_C void ControllerColliderHit_t483E787AA2D92263EC1F899BCF1FFC3F2B96D550_marshal_com_cleanup(ControllerColliderHit_t483E787AA2D92263EC1F899BCF1FFC3F2B96D550_marshaled_com& marshaled) { } #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 // UnityEngine.PhysicsScene UnityEngine.Physics::get_defaultPhysicsScene() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 Physics_get_defaultPhysicsScene_mA6361488FBAC110DA8397E5E4CB473EBF4191010 (const RuntimeMethod* method) { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 V_0; memset((&V_0), 0, sizeof(V_0)); { Physics_get_defaultPhysicsScene_Injected_m0B71068269B3C8499A258BBCAEA7E3D9D020BADA((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&V_0), /*hidden argument*/NULL); PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_0 = V_0; return L_0; } } // System.Boolean UnityEngine.Physics::Raycast(UnityEngine.Vector3,UnityEngine.Vector3,System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool Physics_Raycast_m9DE0EEA1CF8DEF7D06216225F19E2958D341F7BA (Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, float ___maxDistance2, int32_t ___layerMask3, int32_t ___queryTriggerInteraction4, const RuntimeMethod* method) { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 V_0; memset((&V_0), 0, sizeof(V_0)); bool V_1 = false; { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_0; L_0 = Physics_get_defaultPhysicsScene_mA6361488FBAC110DA8397E5E4CB473EBF4191010(/*hidden argument*/NULL); V_0 = L_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1 = ___origin0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_2 = ___direction1; float L_3 = ___maxDistance2; int32_t L_4 = ___layerMask3; int32_t L_5 = ___queryTriggerInteraction4; bool L_6; L_6 = PhysicsScene_Raycast_m8C3E61EB7C3DB8AAC6FEB098D815062BEF821187((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&V_0), L_1, L_2, L_3, L_4, L_5, /*hidden argument*/NULL); V_1 = L_6; goto IL_0017; } IL_0017: { bool L_7 = V_1; return L_7; } } // System.Boolean UnityEngine.Physics::Raycast(UnityEngine.Vector3,UnityEngine.Vector3,System.Single,System.Int32) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool Physics_Raycast_m09F21E13465121A73F19C07FC5F5314CF15ACD15 (Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, float ___maxDistance2, int32_t ___layerMask3, const RuntimeMethod* method) { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 V_0; memset((&V_0), 0, sizeof(V_0)); bool V_1 = false; { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_0; L_0 = Physics_get_defaultPhysicsScene_mA6361488FBAC110DA8397E5E4CB473EBF4191010(/*hidden argument*/NULL); V_0 = L_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1 = ___origin0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_2 = ___direction1; float L_3 = ___maxDistance2; int32_t L_4 = ___layerMask3; bool L_5; L_5 = PhysicsScene_Raycast_m8C3E61EB7C3DB8AAC6FEB098D815062BEF821187((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&V_0), L_1, L_2, L_3, L_4, 0, /*hidden argument*/NULL); V_1 = L_5; goto IL_0016; } IL_0016: { bool L_6 = V_1; return L_6; } } // System.Boolean UnityEngine.Physics::Raycast(UnityEngine.Vector3,UnityEngine.Vector3,System.Single) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool Physics_Raycast_m284670765E1627E43B7B0F5EC811A688EE595091 (Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, float ___maxDistance2, const RuntimeMethod* method) { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 V_0; memset((&V_0), 0, sizeof(V_0)); bool V_1 = false; { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_0; L_0 = Physics_get_defaultPhysicsScene_mA6361488FBAC110DA8397E5E4CB473EBF4191010(/*hidden argument*/NULL); V_0 = L_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1 = ___origin0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_2 = ___direction1; float L_3 = ___maxDistance2; bool L_4; L_4 = PhysicsScene_Raycast_m8C3E61EB7C3DB8AAC6FEB098D815062BEF821187((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&V_0), L_1, L_2, L_3, ((int32_t)-5), 0, /*hidden argument*/NULL); V_1 = L_4; goto IL_0017; } IL_0017: { bool L_5 = V_1; return L_5; } } // System.Boolean UnityEngine.Physics::Raycast(UnityEngine.Vector3,UnityEngine.Vector3) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool Physics_Raycast_mDA2EB8C7692308A7178222D31CBA4C7A1C7DC915 (Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, const RuntimeMethod* method) { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 V_0; memset((&V_0), 0, sizeof(V_0)); bool V_1 = false; { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_0; L_0 = Physics_get_defaultPhysicsScene_mA6361488FBAC110DA8397E5E4CB473EBF4191010(/*hidden argument*/NULL); V_0 = L_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1 = ___origin0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_2 = ___direction1; bool L_3; L_3 = PhysicsScene_Raycast_m8C3E61EB7C3DB8AAC6FEB098D815062BEF821187((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&V_0), L_1, L_2, (std::numeric_limits<float>::infinity()), ((int32_t)-5), 0, /*hidden argument*/NULL); V_1 = L_3; goto IL_001b; } IL_001b: { bool L_4 = V_1; return L_4; } } // System.Boolean UnityEngine.Physics::Raycast(UnityEngine.Vector3,UnityEngine.Vector3,UnityEngine.RaycastHit&,System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool Physics_Raycast_m2EA572B4613E1BD7DBAA299511CFD2DBA179A163 (Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * ___hitInfo2, float ___maxDistance3, int32_t ___layerMask4, int32_t ___queryTriggerInteraction5, const RuntimeMethod* method) { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 V_0; memset((&V_0), 0, sizeof(V_0)); bool V_1 = false; { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_0; L_0 = Physics_get_defaultPhysicsScene_mA6361488FBAC110DA8397E5E4CB473EBF4191010(/*hidden argument*/NULL); V_0 = L_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1 = ___origin0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_2 = ___direction1; RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * L_3 = ___hitInfo2; float L_4 = ___maxDistance3; int32_t L_5 = ___layerMask4; int32_t L_6 = ___queryTriggerInteraction5; bool L_7; L_7 = PhysicsScene_Raycast_mFC0D59C4439EE9DA6E8AA5F6891915132D587208((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&V_0), L_1, L_2, (RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 *)L_3, L_4, L_5, L_6, /*hidden argument*/NULL); V_1 = L_7; goto IL_0019; } IL_0019: { bool L_8 = V_1; return L_8; } } // System.Boolean UnityEngine.Physics::Raycast(UnityEngine.Vector3,UnityEngine.Vector3,UnityEngine.RaycastHit&,System.Single,System.Int32) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool Physics_Raycast_mCBD5F7D498C246713EDDBB446E97205DA206C49C (Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * ___hitInfo2, float ___maxDistance3, int32_t ___layerMask4, const RuntimeMethod* method) { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 V_0; memset((&V_0), 0, sizeof(V_0)); bool V_1 = false; { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_0; L_0 = Physics_get_defaultPhysicsScene_mA6361488FBAC110DA8397E5E4CB473EBF4191010(/*hidden argument*/NULL); V_0 = L_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1 = ___origin0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_2 = ___direction1; RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * L_3 = ___hitInfo2; float L_4 = ___maxDistance3; int32_t L_5 = ___layerMask4; bool L_6; L_6 = PhysicsScene_Raycast_mFC0D59C4439EE9DA6E8AA5F6891915132D587208((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&V_0), L_1, L_2, (RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 *)L_3, L_4, L_5, 0, /*hidden argument*/NULL); V_1 = L_6; goto IL_0018; } IL_0018: { bool L_7 = V_1; return L_7; } } // System.Boolean UnityEngine.Physics::Raycast(UnityEngine.Vector3,UnityEngine.Vector3,UnityEngine.RaycastHit&,System.Single) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool Physics_Raycast_m18E12C65F127D1AA50D196623F04F81CB138FD12 (Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * ___hitInfo2, float ___maxDistance3, const RuntimeMethod* method) { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 V_0; memset((&V_0), 0, sizeof(V_0)); bool V_1 = false; { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_0; L_0 = Physics_get_defaultPhysicsScene_mA6361488FBAC110DA8397E5E4CB473EBF4191010(/*hidden argument*/NULL); V_0 = L_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1 = ___origin0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_2 = ___direction1; RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * L_3 = ___hitInfo2; float L_4 = ___maxDistance3; bool L_5; L_5 = PhysicsScene_Raycast_mFC0D59C4439EE9DA6E8AA5F6891915132D587208((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&V_0), L_1, L_2, (RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 *)L_3, L_4, ((int32_t)-5), 0, /*hidden argument*/NULL); V_1 = L_5; goto IL_0018; } IL_0018: { bool L_6 = V_1; return L_6; } } // System.Boolean UnityEngine.Physics::Raycast(UnityEngine.Vector3,UnityEngine.Vector3,UnityEngine.RaycastHit&) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool Physics_Raycast_mE84D30EEFE59DA28DA172342068F092A35B2BE4A (Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * ___hitInfo2, const RuntimeMethod* method) { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 V_0; memset((&V_0), 0, sizeof(V_0)); bool V_1 = false; { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_0; L_0 = Physics_get_defaultPhysicsScene_mA6361488FBAC110DA8397E5E4CB473EBF4191010(/*hidden argument*/NULL); V_0 = L_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1 = ___origin0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_2 = ___direction1; RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * L_3 = ___hitInfo2; bool L_4; L_4 = PhysicsScene_Raycast_mFC0D59C4439EE9DA6E8AA5F6891915132D587208((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&V_0), L_1, L_2, (RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 *)L_3, (std::numeric_limits<float>::infinity()), ((int32_t)-5), 0, /*hidden argument*/NULL); V_1 = L_4; goto IL_001c; } IL_001c: { bool L_5 = V_1; return L_5; } } // System.Boolean UnityEngine.Physics::Raycast(UnityEngine.Ray,System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool Physics_Raycast_m77560CCAA49DC821E51FDDD1570B921D7704646F (Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 ___ray0, float ___maxDistance1, int32_t ___layerMask2, int32_t ___queryTriggerInteraction3, const RuntimeMethod* method) { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 V_0; memset((&V_0), 0, sizeof(V_0)); bool V_1 = false; { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_0; L_0 = Physics_get_defaultPhysicsScene_mA6361488FBAC110DA8397E5E4CB473EBF4191010(/*hidden argument*/NULL); V_0 = L_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1; L_1 = Ray_get_origin_m0C1B2BFF99CDF5231AC29AC031C161F55B53C1D0((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_2; L_2 = Ray_get_direction_m2B31F86F19B64474A901B28D3808011AE7A13EFC((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); float L_3 = ___maxDistance1; int32_t L_4 = ___layerMask2; int32_t L_5 = ___queryTriggerInteraction3; bool L_6; L_6 = PhysicsScene_Raycast_m8C3E61EB7C3DB8AAC6FEB098D815062BEF821187((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&V_0), L_1, L_2, L_3, L_4, L_5, /*hidden argument*/NULL); V_1 = L_6; goto IL_0022; } IL_0022: { bool L_7 = V_1; return L_7; } } // System.Boolean UnityEngine.Physics::Raycast(UnityEngine.Ray,System.Single,System.Int32) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool Physics_Raycast_mFDC4B8E7979495E3C22D0E3CEA4BCAB271EEC25A (Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 ___ray0, float ___maxDistance1, int32_t ___layerMask2, const RuntimeMethod* method) { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 V_0; memset((&V_0), 0, sizeof(V_0)); bool V_1 = false; { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_0; L_0 = Physics_get_defaultPhysicsScene_mA6361488FBAC110DA8397E5E4CB473EBF4191010(/*hidden argument*/NULL); V_0 = L_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1; L_1 = Ray_get_origin_m0C1B2BFF99CDF5231AC29AC031C161F55B53C1D0((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_2; L_2 = Ray_get_direction_m2B31F86F19B64474A901B28D3808011AE7A13EFC((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); float L_3 = ___maxDistance1; int32_t L_4 = ___layerMask2; bool L_5; L_5 = PhysicsScene_Raycast_m8C3E61EB7C3DB8AAC6FEB098D815062BEF821187((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&V_0), L_1, L_2, L_3, L_4, 0, /*hidden argument*/NULL); V_1 = L_5; goto IL_0022; } IL_0022: { bool L_6 = V_1; return L_6; } } // System.Boolean UnityEngine.Physics::Raycast(UnityEngine.Ray,System.Single) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool Physics_Raycast_mD7A711D3A790AC505F7229A4FFFA2E389008176B (Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 ___ray0, float ___maxDistance1, const RuntimeMethod* method) { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 V_0; memset((&V_0), 0, sizeof(V_0)); bool V_1 = false; { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_0; L_0 = Physics_get_defaultPhysicsScene_mA6361488FBAC110DA8397E5E4CB473EBF4191010(/*hidden argument*/NULL); V_0 = L_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1; L_1 = Ray_get_origin_m0C1B2BFF99CDF5231AC29AC031C161F55B53C1D0((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_2; L_2 = Ray_get_direction_m2B31F86F19B64474A901B28D3808011AE7A13EFC((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); float L_3 = ___maxDistance1; bool L_4; L_4 = PhysicsScene_Raycast_m8C3E61EB7C3DB8AAC6FEB098D815062BEF821187((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&V_0), L_1, L_2, L_3, ((int32_t)-5), 0, /*hidden argument*/NULL); V_1 = L_4; goto IL_0023; } IL_0023: { bool L_5 = V_1; return L_5; } } // System.Boolean UnityEngine.Physics::Raycast(UnityEngine.Ray) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool Physics_Raycast_m111AFC36A136A67BE4776670E356E99A82010BFE (Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 ___ray0, const RuntimeMethod* method) { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 V_0; memset((&V_0), 0, sizeof(V_0)); bool V_1 = false; { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_0; L_0 = Physics_get_defaultPhysicsScene_mA6361488FBAC110DA8397E5E4CB473EBF4191010(/*hidden argument*/NULL); V_0 = L_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1; L_1 = Ray_get_origin_m0C1B2BFF99CDF5231AC29AC031C161F55B53C1D0((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_2; L_2 = Ray_get_direction_m2B31F86F19B64474A901B28D3808011AE7A13EFC((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); bool L_3; L_3 = PhysicsScene_Raycast_m8C3E61EB7C3DB8AAC6FEB098D815062BEF821187((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&V_0), L_1, L_2, (std::numeric_limits<float>::infinity()), ((int32_t)-5), 0, /*hidden argument*/NULL); V_1 = L_3; goto IL_0027; } IL_0027: { bool L_4 = V_1; return L_4; } } // System.Boolean UnityEngine.Physics::Raycast(UnityEngine.Ray,UnityEngine.RaycastHit&,System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool Physics_Raycast_mCA3F2DD1DC08199AAD8466BB857318CD454AC774 (Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 ___ray0, RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * ___hitInfo1, float ___maxDistance2, int32_t ___layerMask3, int32_t ___queryTriggerInteraction4, const RuntimeMethod* method) { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 V_0; memset((&V_0), 0, sizeof(V_0)); bool V_1 = false; { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_0; L_0 = Physics_get_defaultPhysicsScene_mA6361488FBAC110DA8397E5E4CB473EBF4191010(/*hidden argument*/NULL); V_0 = L_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1; L_1 = Ray_get_origin_m0C1B2BFF99CDF5231AC29AC031C161F55B53C1D0((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_2; L_2 = Ray_get_direction_m2B31F86F19B64474A901B28D3808011AE7A13EFC((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * L_3 = ___hitInfo1; float L_4 = ___maxDistance2; int32_t L_5 = ___layerMask3; int32_t L_6 = ___queryTriggerInteraction4; bool L_7; L_7 = PhysicsScene_Raycast_mFC0D59C4439EE9DA6E8AA5F6891915132D587208((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&V_0), L_1, L_2, (RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 *)L_3, L_4, L_5, L_6, /*hidden argument*/NULL); V_1 = L_7; goto IL_0024; } IL_0024: { bool L_8 = V_1; return L_8; } } // System.Boolean UnityEngine.Physics::Raycast(UnityEngine.Ray,UnityEngine.RaycastHit&,System.Single,System.Int32) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool Physics_Raycast_m46E12070D6996F4C8C91D49ADC27C74AC1D6A3D8 (Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 ___ray0, RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * ___hitInfo1, float ___maxDistance2, int32_t ___layerMask3, const RuntimeMethod* method) { bool V_0 = false; { Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_0; L_0 = Ray_get_origin_m0C1B2BFF99CDF5231AC29AC031C161F55B53C1D0((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1; L_1 = Ray_get_direction_m2B31F86F19B64474A901B28D3808011AE7A13EFC((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * L_2 = ___hitInfo1; float L_3 = ___maxDistance2; int32_t L_4 = ___layerMask3; bool L_5; L_5 = Physics_Raycast_m2EA572B4613E1BD7DBAA299511CFD2DBA179A163(L_0, L_1, (RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 *)L_2, L_3, L_4, 0, /*hidden argument*/NULL); V_0 = L_5; goto IL_001b; } IL_001b: { bool L_6 = V_0; return L_6; } } // System.Boolean UnityEngine.Physics::Raycast(UnityEngine.Ray,UnityEngine.RaycastHit&,System.Single) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool Physics_Raycast_mA64F8C30681E3A6A8F2B7EDE592FE7BBC0D354F4 (Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 ___ray0, RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * ___hitInfo1, float ___maxDistance2, const RuntimeMethod* method) { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 V_0; memset((&V_0), 0, sizeof(V_0)); bool V_1 = false; { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_0; L_0 = Physics_get_defaultPhysicsScene_mA6361488FBAC110DA8397E5E4CB473EBF4191010(/*hidden argument*/NULL); V_0 = L_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1; L_1 = Ray_get_origin_m0C1B2BFF99CDF5231AC29AC031C161F55B53C1D0((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_2; L_2 = Ray_get_direction_m2B31F86F19B64474A901B28D3808011AE7A13EFC((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * L_3 = ___hitInfo1; float L_4 = ___maxDistance2; bool L_5; L_5 = PhysicsScene_Raycast_mFC0D59C4439EE9DA6E8AA5F6891915132D587208((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&V_0), L_1, L_2, (RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 *)L_3, L_4, ((int32_t)-5), 0, /*hidden argument*/NULL); V_1 = L_5; goto IL_0024; } IL_0024: { bool L_6 = V_1; return L_6; } } // System.Boolean UnityEngine.Physics::Raycast(UnityEngine.Ray,UnityEngine.RaycastHit&) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool Physics_Raycast_m80EC8EEDA0ABA8B01838BA9054834CD1A381916E (Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 ___ray0, RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * ___hitInfo1, const RuntimeMethod* method) { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 V_0; memset((&V_0), 0, sizeof(V_0)); bool V_1 = false; { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_0; L_0 = Physics_get_defaultPhysicsScene_mA6361488FBAC110DA8397E5E4CB473EBF4191010(/*hidden argument*/NULL); V_0 = L_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1; L_1 = Ray_get_origin_m0C1B2BFF99CDF5231AC29AC031C161F55B53C1D0((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_2; L_2 = Ray_get_direction_m2B31F86F19B64474A901B28D3808011AE7A13EFC((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * L_3 = ___hitInfo1; bool L_4; L_4 = PhysicsScene_Raycast_mFC0D59C4439EE9DA6E8AA5F6891915132D587208((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&V_0), L_1, L_2, (RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 *)L_3, (std::numeric_limits<float>::infinity()), ((int32_t)-5), 0, /*hidden argument*/NULL); V_1 = L_4; goto IL_0028; } IL_0028: { bool L_5 = V_1; return L_5; } } // UnityEngine.RaycastHit[] UnityEngine.Physics::Internal_RaycastAll(UnityEngine.PhysicsScene,UnityEngine.Ray,System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* Physics_Internal_RaycastAll_m39EE7CF896F9D8BA58CC623F14E4DB0641480523 (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 ___physicsScene0, Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 ___ray1, float ___maxDistance2, int32_t ___mask3, int32_t ___queryTriggerInteraction4, const RuntimeMethod* method) { { float L_0 = ___maxDistance2; int32_t L_1 = ___mask3; int32_t L_2 = ___queryTriggerInteraction4; RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_3; L_3 = Physics_Internal_RaycastAll_Injected_mD4C3E8762D9FCEE654CE0415E636EB7DBEC92A5B((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&___physicsScene0), (Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray1), L_0, L_1, L_2, /*hidden argument*/NULL); return L_3; } } // UnityEngine.RaycastHit[] UnityEngine.Physics::RaycastAll(UnityEngine.Vector3,UnityEngine.Vector3,System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* Physics_RaycastAll_m5103E7C60CC66BAFA6534D1736138A92EB1EF2B8 (Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, float ___maxDistance2, int32_t ___layerMask3, int32_t ___queryTriggerInteraction4, const RuntimeMethod* method) { static bool s_Il2CppMethodInitialized; if (!s_Il2CppMethodInitialized) { il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09_il2cpp_TypeInfo_var); s_Il2CppMethodInitialized = true; } float V_0 = 0.0f; bool V_1 = false; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E V_2; memset((&V_2), 0, sizeof(V_2)); Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 V_3; memset((&V_3), 0, sizeof(V_3)); RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* V_4 = NULL; { float L_0; L_0 = Vector3_get_magnitude_mDDD40612220D8104E77E993E18A101A69A944991((Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E *)(&___direction1), /*hidden argument*/NULL); V_0 = L_0; float L_1 = V_0; V_1 = (bool)((((float)L_1) > ((float)(1.40129846E-45f)))? 1 : 0); bool L_2 = V_1; if (!L_2) { goto IL_003a; } } { Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_3 = ___direction1; float L_4 = V_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_5; L_5 = Vector3_op_Division_mE5ACBFB168FED529587457A83BA98B7DB32E2A05_inline(L_3, L_4, /*hidden argument*/NULL); V_2 = L_5; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_6 = ___origin0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_7 = V_2; Ray__ctor_m75B1F651FF47EE6B887105101B7DA61CBF41F83C((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&V_3), L_6, L_7, /*hidden argument*/NULL); PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_8; L_8 = Physics_get_defaultPhysicsScene_mA6361488FBAC110DA8397E5E4CB473EBF4191010(/*hidden argument*/NULL); Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 L_9 = V_3; float L_10 = ___maxDistance2; int32_t L_11 = ___layerMask3; int32_t L_12 = ___queryTriggerInteraction4; RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_13; L_13 = Physics_Internal_RaycastAll_m39EE7CF896F9D8BA58CC623F14E4DB0641480523(L_8, L_9, L_10, L_11, L_12, /*hidden argument*/NULL); V_4 = L_13; goto IL_0045; } IL_003a: { RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_14 = (RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09*)(RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09*)SZArrayNew(RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09_il2cpp_TypeInfo_var, (uint32_t)0); V_4 = L_14; goto IL_0045; } IL_0045: { RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_15 = V_4; return L_15; } } // UnityEngine.RaycastHit[] UnityEngine.Physics::RaycastAll(UnityEngine.Vector3,UnityEngine.Vector3,System.Single,System.Int32) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* Physics_RaycastAll_m2C977C8B022672F42B5E18F40B529C0A74B7E471 (Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, float ___maxDistance2, int32_t ___layerMask3, const RuntimeMethod* method) { RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* V_0 = NULL; { Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_0 = ___origin0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1 = ___direction1; float L_2 = ___maxDistance2; int32_t L_3 = ___layerMask3; RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_4; L_4 = Physics_RaycastAll_m5103E7C60CC66BAFA6534D1736138A92EB1EF2B8(L_0, L_1, L_2, L_3, 0, /*hidden argument*/NULL); V_0 = L_4; goto IL_000e; } IL_000e: { RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_5 = V_0; return L_5; } } // UnityEngine.RaycastHit[] UnityEngine.Physics::RaycastAll(UnityEngine.Vector3,UnityEngine.Vector3,System.Single) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* Physics_RaycastAll_m2BBC8D2731B38EE0B704A5C6A09D0F8BBA074A4D (Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, float ___maxDistance2, const RuntimeMethod* method) { RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* V_0 = NULL; { Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_0 = ___origin0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1 = ___direction1; float L_2 = ___maxDistance2; RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_3; L_3 = Physics_RaycastAll_m5103E7C60CC66BAFA6534D1736138A92EB1EF2B8(L_0, L_1, L_2, ((int32_t)-5), 0, /*hidden argument*/NULL); V_0 = L_3; goto IL_000f; } IL_000f: { RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_4 = V_0; return L_4; } } // UnityEngine.RaycastHit[] UnityEngine.Physics::RaycastAll(UnityEngine.Vector3,UnityEngine.Vector3) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* Physics_RaycastAll_m83F28CB671653C07995FB1BCDC561121DE3D9CA6 (Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, const RuntimeMethod* method) { RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* V_0 = NULL; { Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_0 = ___origin0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1 = ___direction1; RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_2; L_2 = Physics_RaycastAll_m5103E7C60CC66BAFA6534D1736138A92EB1EF2B8(L_0, L_1, (std::numeric_limits<float>::infinity()), ((int32_t)-5), 0, /*hidden argument*/NULL); V_0 = L_2; goto IL_0013; } IL_0013: { RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_3 = V_0; return L_3; } } // UnityEngine.RaycastHit[] UnityEngine.Physics::RaycastAll(UnityEngine.Ray,System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* Physics_RaycastAll_m55EB4478198ED6EF838500257FA3BE1A871D3605 (Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 ___ray0, float ___maxDistance1, int32_t ___layerMask2, int32_t ___queryTriggerInteraction3, const RuntimeMethod* method) { RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* V_0 = NULL; { Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_0; L_0 = Ray_get_origin_m0C1B2BFF99CDF5231AC29AC031C161F55B53C1D0((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1; L_1 = Ray_get_direction_m2B31F86F19B64474A901B28D3808011AE7A13EFC((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); float L_2 = ___maxDistance1; int32_t L_3 = ___layerMask2; int32_t L_4 = ___queryTriggerInteraction3; RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_5; L_5 = Physics_RaycastAll_m5103E7C60CC66BAFA6534D1736138A92EB1EF2B8(L_0, L_1, L_2, L_3, L_4, /*hidden argument*/NULL); V_0 = L_5; goto IL_001a; } IL_001a: { RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_6 = V_0; return L_6; } } // UnityEngine.RaycastHit[] UnityEngine.Physics::RaycastAll(UnityEngine.Ray,System.Single,System.Int32) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* Physics_RaycastAll_mA24B9B922C98C5D18397FAE55C04AEAFDD47F029 (Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 ___ray0, float ___maxDistance1, int32_t ___layerMask2, const RuntimeMethod* method) { RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* V_0 = NULL; { Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_0; L_0 = Ray_get_origin_m0C1B2BFF99CDF5231AC29AC031C161F55B53C1D0((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1; L_1 = Ray_get_direction_m2B31F86F19B64474A901B28D3808011AE7A13EFC((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); float L_2 = ___maxDistance1; int32_t L_3 = ___layerMask2; RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_4; L_4 = Physics_RaycastAll_m5103E7C60CC66BAFA6534D1736138A92EB1EF2B8(L_0, L_1, L_2, L_3, 0, /*hidden argument*/NULL); V_0 = L_4; goto IL_001a; } IL_001a: { RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_5 = V_0; return L_5; } } // UnityEngine.RaycastHit[] UnityEngine.Physics::RaycastAll(UnityEngine.Ray,System.Single) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* Physics_RaycastAll_m72947571EFB0EFB34E48340AA2EC0C8030D27C50 (Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 ___ray0, float ___maxDistance1, const RuntimeMethod* method) { RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* V_0 = NULL; { Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_0; L_0 = Ray_get_origin_m0C1B2BFF99CDF5231AC29AC031C161F55B53C1D0((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1; L_1 = Ray_get_direction_m2B31F86F19B64474A901B28D3808011AE7A13EFC((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); float L_2 = ___maxDistance1; RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_3; L_3 = Physics_RaycastAll_m5103E7C60CC66BAFA6534D1736138A92EB1EF2B8(L_0, L_1, L_2, ((int32_t)-5), 0, /*hidden argument*/NULL); V_0 = L_3; goto IL_001b; } IL_001b: { RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_4 = V_0; return L_4; } } // UnityEngine.RaycastHit[] UnityEngine.Physics::RaycastAll(UnityEngine.Ray) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* Physics_RaycastAll_m529EE59D6D03E4CFAECE4016C8CC4181BEC2D26D (Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 ___ray0, const RuntimeMethod* method) { RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* V_0 = NULL; { Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_0; L_0 = Ray_get_origin_m0C1B2BFF99CDF5231AC29AC031C161F55B53C1D0((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1; L_1 = Ray_get_direction_m2B31F86F19B64474A901B28D3808011AE7A13EFC((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_2; L_2 = Physics_RaycastAll_m5103E7C60CC66BAFA6534D1736138A92EB1EF2B8(L_0, L_1, (std::numeric_limits<float>::infinity()), ((int32_t)-5), 0, /*hidden argument*/NULL); V_0 = L_2; goto IL_001f; } IL_001f: { RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_3 = V_0; return L_3; } } // System.Int32 UnityEngine.Physics::RaycastNonAlloc(UnityEngine.Ray,UnityEngine.RaycastHit[],System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR int32_t Physics_RaycastNonAlloc_m7C81125AD7D5891EBC3AB48C6DED7B60F53DF099 (Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 ___ray0, RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* ___results1, float ___maxDistance2, int32_t ___layerMask3, int32_t ___queryTriggerInteraction4, const RuntimeMethod* method) { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 V_0; memset((&V_0), 0, sizeof(V_0)); int32_t V_1 = 0; { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_0; L_0 = Physics_get_defaultPhysicsScene_mA6361488FBAC110DA8397E5E4CB473EBF4191010(/*hidden argument*/NULL); V_0 = L_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1; L_1 = Ray_get_origin_m0C1B2BFF99CDF5231AC29AC031C161F55B53C1D0((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_2; L_2 = Ray_get_direction_m2B31F86F19B64474A901B28D3808011AE7A13EFC((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_3 = ___results1; float L_4 = ___maxDistance2; int32_t L_5 = ___layerMask3; int32_t L_6 = ___queryTriggerInteraction4; int32_t L_7; L_7 = PhysicsScene_Raycast_m95CAB68EB9165E3AB2A4D441F7DF9767AD4B7F73((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&V_0), L_1, L_2, L_3, L_4, L_5, L_6, /*hidden argument*/NULL); V_1 = L_7; goto IL_0024; } IL_0024: { int32_t L_8 = V_1; return L_8; } } // System.Int32 UnityEngine.Physics::RaycastNonAlloc(UnityEngine.Ray,UnityEngine.RaycastHit[],System.Single,System.Int32) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR int32_t Physics_RaycastNonAlloc_m8F62EE5A33E81A02E4983A171023B7BC4AC700CA (Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 ___ray0, RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* ___results1, float ___maxDistance2, int32_t ___layerMask3, const RuntimeMethod* method) { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 V_0; memset((&V_0), 0, sizeof(V_0)); int32_t V_1 = 0; { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_0; L_0 = Physics_get_defaultPhysicsScene_mA6361488FBAC110DA8397E5E4CB473EBF4191010(/*hidden argument*/NULL); V_0 = L_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1; L_1 = Ray_get_origin_m0C1B2BFF99CDF5231AC29AC031C161F55B53C1D0((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_2; L_2 = Ray_get_direction_m2B31F86F19B64474A901B28D3808011AE7A13EFC((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_3 = ___results1; float L_4 = ___maxDistance2; int32_t L_5 = ___layerMask3; int32_t L_6; L_6 = PhysicsScene_Raycast_m95CAB68EB9165E3AB2A4D441F7DF9767AD4B7F73((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&V_0), L_1, L_2, L_3, L_4, L_5, 0, /*hidden argument*/NULL); V_1 = L_6; goto IL_0023; } IL_0023: { int32_t L_7 = V_1; return L_7; } } // System.Int32 UnityEngine.Physics::RaycastNonAlloc(UnityEngine.Ray,UnityEngine.RaycastHit[],System.Single) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR int32_t Physics_RaycastNonAlloc_m41BB7BB8755B09700C10F59A29C3541D45AB9CCD (Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 ___ray0, RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* ___results1, float ___maxDistance2, const RuntimeMethod* method) { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 V_0; memset((&V_0), 0, sizeof(V_0)); int32_t V_1 = 0; { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_0; L_0 = Physics_get_defaultPhysicsScene_mA6361488FBAC110DA8397E5E4CB473EBF4191010(/*hidden argument*/NULL); V_0 = L_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1; L_1 = Ray_get_origin_m0C1B2BFF99CDF5231AC29AC031C161F55B53C1D0((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_2; L_2 = Ray_get_direction_m2B31F86F19B64474A901B28D3808011AE7A13EFC((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_3 = ___results1; float L_4 = ___maxDistance2; int32_t L_5; L_5 = PhysicsScene_Raycast_m95CAB68EB9165E3AB2A4D441F7DF9767AD4B7F73((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&V_0), L_1, L_2, L_3, L_4, ((int32_t)-5), 0, /*hidden argument*/NULL); V_1 = L_5; goto IL_0024; } IL_0024: { int32_t L_6 = V_1; return L_6; } } // System.Int32 UnityEngine.Physics::RaycastNonAlloc(UnityEngine.Ray,UnityEngine.RaycastHit[]) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR int32_t Physics_RaycastNonAlloc_mBC5BE514E55B8D98A8F4752DED6850E02EE8AD98 (Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 ___ray0, RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* ___results1, const RuntimeMethod* method) { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 V_0; memset((&V_0), 0, sizeof(V_0)); int32_t V_1 = 0; { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_0; L_0 = Physics_get_defaultPhysicsScene_mA6361488FBAC110DA8397E5E4CB473EBF4191010(/*hidden argument*/NULL); V_0 = L_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1; L_1 = Ray_get_origin_m0C1B2BFF99CDF5231AC29AC031C161F55B53C1D0((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_2; L_2 = Ray_get_direction_m2B31F86F19B64474A901B28D3808011AE7A13EFC((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray0), /*hidden argument*/NULL); RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_3 = ___results1; int32_t L_4; L_4 = PhysicsScene_Raycast_m95CAB68EB9165E3AB2A4D441F7DF9767AD4B7F73((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&V_0), L_1, L_2, L_3, (std::numeric_limits<float>::infinity()), ((int32_t)-5), 0, /*hidden argument*/NULL); V_1 = L_4; goto IL_0028; } IL_0028: { int32_t L_5 = V_1; return L_5; } } // System.Int32 UnityEngine.Physics::RaycastNonAlloc(UnityEngine.Vector3,UnityEngine.Vector3,UnityEngine.RaycastHit[],System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR int32_t Physics_RaycastNonAlloc_m2C90D14E472DE7929EFD54FDA7BC512D3FBDE4ED (Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* ___results2, float ___maxDistance3, int32_t ___layerMask4, int32_t ___queryTriggerInteraction5, const RuntimeMethod* method) { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 V_0; memset((&V_0), 0, sizeof(V_0)); int32_t V_1 = 0; { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_0; L_0 = Physics_get_defaultPhysicsScene_mA6361488FBAC110DA8397E5E4CB473EBF4191010(/*hidden argument*/NULL); V_0 = L_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1 = ___origin0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_2 = ___direction1; RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_3 = ___results2; float L_4 = ___maxDistance3; int32_t L_5 = ___layerMask4; int32_t L_6 = ___queryTriggerInteraction5; int32_t L_7; L_7 = PhysicsScene_Raycast_m95CAB68EB9165E3AB2A4D441F7DF9767AD4B7F73((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&V_0), L_1, L_2, L_3, L_4, L_5, L_6, /*hidden argument*/NULL); V_1 = L_7; goto IL_0019; } IL_0019: { int32_t L_8 = V_1; return L_8; } } // System.Int32 UnityEngine.Physics::RaycastNonAlloc(UnityEngine.Vector3,UnityEngine.Vector3,UnityEngine.RaycastHit[],System.Single,System.Int32) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR int32_t Physics_RaycastNonAlloc_m316F597067055C9F923F57CC68D68FF917C3B4D1 (Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* ___results2, float ___maxDistance3, int32_t ___layerMask4, const RuntimeMethod* method) { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 V_0; memset((&V_0), 0, sizeof(V_0)); int32_t V_1 = 0; { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_0; L_0 = Physics_get_defaultPhysicsScene_mA6361488FBAC110DA8397E5E4CB473EBF4191010(/*hidden argument*/NULL); V_0 = L_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1 = ___origin0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_2 = ___direction1; RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_3 = ___results2; float L_4 = ___maxDistance3; int32_t L_5 = ___layerMask4; int32_t L_6; L_6 = PhysicsScene_Raycast_m95CAB68EB9165E3AB2A4D441F7DF9767AD4B7F73((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&V_0), L_1, L_2, L_3, L_4, L_5, 0, /*hidden argument*/NULL); V_1 = L_6; goto IL_0018; } IL_0018: { int32_t L_7 = V_1; return L_7; } } // System.Int32 UnityEngine.Physics::RaycastNonAlloc(UnityEngine.Vector3,UnityEngine.Vector3,UnityEngine.RaycastHit[],System.Single) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR int32_t Physics_RaycastNonAlloc_m1B8F31BF41F756F561F6AC3A2E0736F2BC9C4DB4 (Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* ___results2, float ___maxDistance3, const RuntimeMethod* method) { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 V_0; memset((&V_0), 0, sizeof(V_0)); int32_t V_1 = 0; { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_0; L_0 = Physics_get_defaultPhysicsScene_mA6361488FBAC110DA8397E5E4CB473EBF4191010(/*hidden argument*/NULL); V_0 = L_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1 = ___origin0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_2 = ___direction1; RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_3 = ___results2; float L_4 = ___maxDistance3; int32_t L_5; L_5 = PhysicsScene_Raycast_m95CAB68EB9165E3AB2A4D441F7DF9767AD4B7F73((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&V_0), L_1, L_2, L_3, L_4, ((int32_t)-5), 0, /*hidden argument*/NULL); V_1 = L_5; goto IL_0018; } IL_0018: { int32_t L_6 = V_1; return L_6; } } // System.Int32 UnityEngine.Physics::RaycastNonAlloc(UnityEngine.Vector3,UnityEngine.Vector3,UnityEngine.RaycastHit[]) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR int32_t Physics_RaycastNonAlloc_m9076DDE1A65F87DB3D2824DAD4E5B8B534159F1F (Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* ___results2, const RuntimeMethod* method) { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 V_0; memset((&V_0), 0, sizeof(V_0)); int32_t V_1 = 0; { PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_0; L_0 = Physics_get_defaultPhysicsScene_mA6361488FBAC110DA8397E5E4CB473EBF4191010(/*hidden argument*/NULL); V_0 = L_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1 = ___origin0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_2 = ___direction1; RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_3 = ___results2; int32_t L_4; L_4 = PhysicsScene_Raycast_m95CAB68EB9165E3AB2A4D441F7DF9767AD4B7F73((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&V_0), L_1, L_2, L_3, (std::numeric_limits<float>::infinity()), ((int32_t)-5), 0, /*hidden argument*/NULL); V_1 = L_4; goto IL_001c; } IL_001c: { int32_t L_5 = V_1; return L_5; } } // System.Void UnityEngine.Physics::get_defaultPhysicsScene_Injected(UnityEngine.PhysicsScene&) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void Physics_get_defaultPhysicsScene_Injected_m0B71068269B3C8499A258BBCAEA7E3D9D020BADA (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * ___ret0, const RuntimeMethod* method) { typedef void (*Physics_get_defaultPhysicsScene_Injected_m0B71068269B3C8499A258BBCAEA7E3D9D020BADA_ftn) (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *); static Physics_get_defaultPhysicsScene_Injected_m0B71068269B3C8499A258BBCAEA7E3D9D020BADA_ftn _il2cpp_icall_func; if (!_il2cpp_icall_func) _il2cpp_icall_func = (Physics_get_defaultPhysicsScene_Injected_m0B71068269B3C8499A258BBCAEA7E3D9D020BADA_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.Physics::get_defaultPhysicsScene_Injected(UnityEngine.PhysicsScene&)"); _il2cpp_icall_func(___ret0); } // UnityEngine.RaycastHit[] UnityEngine.Physics::Internal_RaycastAll_Injected(UnityEngine.PhysicsScene&,UnityEngine.Ray&,System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* Physics_Internal_RaycastAll_Injected_mD4C3E8762D9FCEE654CE0415E636EB7DBEC92A5B (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * ___physicsScene0, Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 * ___ray1, float ___maxDistance2, int32_t ___mask3, int32_t ___queryTriggerInteraction4, const RuntimeMethod* method) { typedef RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* (*Physics_Internal_RaycastAll_Injected_mD4C3E8762D9FCEE654CE0415E636EB7DBEC92A5B_ftn) (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *, Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *, float, int32_t, int32_t); static Physics_Internal_RaycastAll_Injected_mD4C3E8762D9FCEE654CE0415E636EB7DBEC92A5B_ftn _il2cpp_icall_func; if (!_il2cpp_icall_func) _il2cpp_icall_func = (Physics_Internal_RaycastAll_Injected_mD4C3E8762D9FCEE654CE0415E636EB7DBEC92A5B_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.Physics::Internal_RaycastAll_Injected(UnityEngine.PhysicsScene&,UnityEngine.Ray&,System.Single,System.Int32,UnityEngine.QueryTriggerInteraction)"); RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* icallRetVal = _il2cpp_icall_func(___physicsScene0, ___ray1, ___maxDistance2, ___mask3, ___queryTriggerInteraction4); return icallRetVal; } #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.String UnityEngine.PhysicsScene::ToString() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR String_t* PhysicsScene_ToString_mBB6D0AC1E3E2EDC34CB4A7A34485B24B6271903F (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * __this, const RuntimeMethod* method) { static bool s_Il2CppMethodInitialized; if (!s_Il2CppMethodInitialized) { il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&Int32_tFDE5F8CD43D10453F6A2E0C77FE48C6CC7009046_il2cpp_TypeInfo_var); il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&ObjectU5BU5D_tC1F4EE0DB0B7300255F5FD4AF64FE4C585CF5ADE_il2cpp_TypeInfo_var); il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&_stringLiteral21ACE806CE655297BC379B3AD17E97F0A68B6AEC); s_Il2CppMethodInitialized = true; } String_t* V_0 = NULL; { ObjectU5BU5D_tC1F4EE0DB0B7300255F5FD4AF64FE4C585CF5ADE* L_0 = (ObjectU5BU5D_tC1F4EE0DB0B7300255F5FD4AF64FE4C585CF5ADE*)(ObjectU5BU5D_tC1F4EE0DB0B7300255F5FD4AF64FE4C585CF5ADE*)SZArrayNew(ObjectU5BU5D_tC1F4EE0DB0B7300255F5FD4AF64FE4C585CF5ADE_il2cpp_TypeInfo_var, (uint32_t)1); ObjectU5BU5D_tC1F4EE0DB0B7300255F5FD4AF64FE4C585CF5ADE* L_1 = L_0; int32_t L_2 = __this->get_m_Handle_0(); int32_t L_3 = L_2; RuntimeObject * L_4 = Box(Int32_tFDE5F8CD43D10453F6A2E0C77FE48C6CC7009046_il2cpp_TypeInfo_var, &L_3); NullCheck(L_1); ArrayElementTypeCheck (L_1, L_4); (L_1)->SetAt(static_cast<il2cpp_array_size_t>(0), (RuntimeObject *)L_4); String_t* L_5; L_5 = UnityString_Format_m7A07C068ED408DD06F634070770FB55F13AA4EC9(_stringLiteral21ACE806CE655297BC379B3AD17E97F0A68B6AEC, L_1, /*hidden argument*/NULL); V_0 = L_5; goto IL_0022; } IL_0022: { String_t* L_6 = V_0; return L_6; } } IL2CPP_EXTERN_C String_t* PhysicsScene_ToString_mBB6D0AC1E3E2EDC34CB4A7A34485B24B6271903F_AdjustorThunk (RuntimeObject * __this, const RuntimeMethod* method) { int32_t _offset = 1; PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * _thisAdjusted = reinterpret_cast<PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *>(__this + _offset); String_t* _returnValue; _returnValue = PhysicsScene_ToString_mBB6D0AC1E3E2EDC34CB4A7A34485B24B6271903F(_thisAdjusted, method); return _returnValue; } // System.Int32 UnityEngine.PhysicsScene::GetHashCode() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR int32_t PhysicsScene_GetHashCode_m5344CC6CCCB1CA6EBB149775EE028089DD74B8A2 (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * __this, const RuntimeMethod* method) { int32_t V_0 = 0; { int32_t L_0 = __this->get_m_Handle_0(); V_0 = L_0; goto IL_000a; } IL_000a: { int32_t L_1 = V_0; return L_1; } } IL2CPP_EXTERN_C int32_t PhysicsScene_GetHashCode_m5344CC6CCCB1CA6EBB149775EE028089DD74B8A2_AdjustorThunk (RuntimeObject * __this, const RuntimeMethod* method) { int32_t _offset = 1; PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * _thisAdjusted = reinterpret_cast<PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *>(__this + _offset); int32_t _returnValue; _returnValue = PhysicsScene_GetHashCode_m5344CC6CCCB1CA6EBB149775EE028089DD74B8A2(_thisAdjusted, method); return _returnValue; } // System.Boolean UnityEngine.PhysicsScene::Equals(System.Object) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool PhysicsScene_Equals_m2645ABB96C598F197F734EB712494795928CBCEC (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * __this, RuntimeObject * ___other0, const RuntimeMethod* method) { static bool s_Il2CppMethodInitialized; if (!s_Il2CppMethodInitialized) { il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678_il2cpp_TypeInfo_var); s_Il2CppMethodInitialized = true; } PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 V_0; memset((&V_0), 0, sizeof(V_0)); bool V_1 = false; bool V_2 = false; { RuntimeObject * L_0 = ___other0; V_1 = (bool)((((int32_t)((!(((RuntimeObject*)(RuntimeObject *)((RuntimeObject *)IsInstSealed((RuntimeObject*)L_0, PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678_il2cpp_TypeInfo_var))) <= ((RuntimeObject*)(RuntimeObject *)NULL)))? 1 : 0)) == ((int32_t)0))? 1 : 0); bool L_1 = V_1; if (!L_1) { goto IL_0015; } } { V_2 = (bool)0; goto IL_002d; } IL_0015: { RuntimeObject * L_2 = ___other0; V_0 = ((*(PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)UnBox(L_2, PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678_il2cpp_TypeInfo_var)))); int32_t L_3 = __this->get_m_Handle_0(); PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_4 = V_0; int32_t L_5 = L_4.get_m_Handle_0(); V_2 = (bool)((((int32_t)L_3) == ((int32_t)L_5))? 1 : 0); goto IL_002d; } IL_002d: { bool L_6 = V_2; return L_6; } } IL2CPP_EXTERN_C bool PhysicsScene_Equals_m2645ABB96C598F197F734EB712494795928CBCEC_AdjustorThunk (RuntimeObject * __this, RuntimeObject * ___other0, const RuntimeMethod* method) { int32_t _offset = 1; PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * _thisAdjusted = reinterpret_cast<PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *>(__this + _offset); bool _returnValue; _returnValue = PhysicsScene_Equals_m2645ABB96C598F197F734EB712494795928CBCEC(_thisAdjusted, ___other0, method); return _returnValue; } // System.Boolean UnityEngine.PhysicsScene::Equals(UnityEngine.PhysicsScene) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool PhysicsScene_Equals_m8C948B86D105177D519A3608816CDC698C8686B8 (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * __this, PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 ___other0, const RuntimeMethod* method) { bool V_0 = false; { int32_t L_0 = __this->get_m_Handle_0(); PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_1 = ___other0; int32_t L_2 = L_1.get_m_Handle_0(); V_0 = (bool)((((int32_t)L_0) == ((int32_t)L_2))? 1 : 0); goto IL_0012; } IL_0012: { bool L_3 = V_0; return L_3; } } IL2CPP_EXTERN_C bool PhysicsScene_Equals_m8C948B86D105177D519A3608816CDC698C8686B8_AdjustorThunk (RuntimeObject * __this, PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 ___other0, const RuntimeMethod* method) { int32_t _offset = 1; PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * _thisAdjusted = reinterpret_cast<PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *>(__this + _offset); bool _returnValue; _returnValue = PhysicsScene_Equals_m8C948B86D105177D519A3608816CDC698C8686B8(_thisAdjusted, ___other0, method); return _returnValue; } // System.Boolean UnityEngine.PhysicsScene::Raycast(UnityEngine.Vector3,UnityEngine.Vector3,System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool PhysicsScene_Raycast_m8C3E61EB7C3DB8AAC6FEB098D815062BEF821187 (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * __this, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, float ___maxDistance2, int32_t ___layerMask3, int32_t ___queryTriggerInteraction4, const RuntimeMethod* method) { float V_0 = 0.0f; bool V_1 = false; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E V_2; memset((&V_2), 0, sizeof(V_2)); Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 V_3; memset((&V_3), 0, sizeof(V_3)); bool V_4 = false; { float L_0; L_0 = Vector3_get_magnitude_mDDD40612220D8104E77E993E18A101A69A944991((Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E *)(&___direction1), /*hidden argument*/NULL); V_0 = L_0; float L_1 = V_0; V_1 = (bool)((((float)L_1) > ((float)(1.40129846E-45f)))? 1 : 0); bool L_2 = V_1; if (!L_2) { goto IL_003c; } } { Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_3 = ___direction1; float L_4 = V_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_5; L_5 = Vector3_op_Division_mE5ACBFB168FED529587457A83BA98B7DB32E2A05_inline(L_3, L_4, /*hidden argument*/NULL); V_2 = L_5; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_6 = ___origin0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_7 = V_2; Ray__ctor_m75B1F651FF47EE6B887105101B7DA61CBF41F83C((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&V_3), L_6, L_7, /*hidden argument*/NULL); PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_8 = (*(PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)__this); Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 L_9 = V_3; float L_10 = ___maxDistance2; int32_t L_11 = ___layerMask3; int32_t L_12 = ___queryTriggerInteraction4; bool L_13; L_13 = PhysicsScene_Internal_RaycastTest_m6715CAD8D0330195269AA7FCCD91613BC564E3EB(L_8, L_9, L_10, L_11, L_12, /*hidden argument*/NULL); V_4 = L_13; goto IL_0041; } IL_003c: { V_4 = (bool)0; goto IL_0041; } IL_0041: { bool L_14 = V_4; return L_14; } } IL2CPP_EXTERN_C bool PhysicsScene_Raycast_m8C3E61EB7C3DB8AAC6FEB098D815062BEF821187_AdjustorThunk (RuntimeObject * __this, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, float ___maxDistance2, int32_t ___layerMask3, int32_t ___queryTriggerInteraction4, const RuntimeMethod* method) { int32_t _offset = 1; PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * _thisAdjusted = reinterpret_cast<PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *>(__this + _offset); bool _returnValue; _returnValue = PhysicsScene_Raycast_m8C3E61EB7C3DB8AAC6FEB098D815062BEF821187(_thisAdjusted, ___origin0, ___direction1, ___maxDistance2, ___layerMask3, ___queryTriggerInteraction4, method); return _returnValue; } // System.Boolean UnityEngine.PhysicsScene::Internal_RaycastTest(UnityEngine.PhysicsScene,UnityEngine.Ray,System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool PhysicsScene_Internal_RaycastTest_m6715CAD8D0330195269AA7FCCD91613BC564E3EB (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 ___physicsScene0, Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 ___ray1, float ___maxDistance2, int32_t ___layerMask3, int32_t ___queryTriggerInteraction4, const RuntimeMethod* method) { { float L_0 = ___maxDistance2; int32_t L_1 = ___layerMask3; int32_t L_2 = ___queryTriggerInteraction4; bool L_3; L_3 = PhysicsScene_Internal_RaycastTest_Injected_m956474EFEA507F82ABE0BCB75DDB3CC8EFF4D12B((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&___physicsScene0), (Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray1), L_0, L_1, L_2, /*hidden argument*/NULL); return L_3; } } // System.Boolean UnityEngine.PhysicsScene::Raycast(UnityEngine.Vector3,UnityEngine.Vector3,UnityEngine.RaycastHit&,System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool PhysicsScene_Raycast_mFC0D59C4439EE9DA6E8AA5F6891915132D587208 (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * __this, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * ___hitInfo2, float ___maxDistance3, int32_t ___layerMask4, int32_t ___queryTriggerInteraction5, const RuntimeMethod* method) { float V_0 = 0.0f; bool V_1 = false; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E V_2; memset((&V_2), 0, sizeof(V_2)); Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 V_3; memset((&V_3), 0, sizeof(V_3)); bool V_4 = false; { RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * L_0 = ___hitInfo2; il2cpp_codegen_initobj(L_0, sizeof(RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 )); float L_1; L_1 = Vector3_get_magnitude_mDDD40612220D8104E77E993E18A101A69A944991((Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E *)(&___direction1), /*hidden argument*/NULL); V_0 = L_1; float L_2 = V_0; V_1 = (bool)((((float)L_2) > ((float)(1.40129846E-45f)))? 1 : 0); bool L_3 = V_1; if (!L_3) { goto IL_0045; } } { Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_4 = ___direction1; float L_5 = V_0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_6; L_6 = Vector3_op_Division_mE5ACBFB168FED529587457A83BA98B7DB32E2A05_inline(L_4, L_5, /*hidden argument*/NULL); V_2 = L_6; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_7 = ___origin0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_8 = V_2; Ray__ctor_m75B1F651FF47EE6B887105101B7DA61CBF41F83C((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&V_3), L_7, L_8, /*hidden argument*/NULL); PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_9 = (*(PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)__this); Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 L_10 = V_3; float L_11 = ___maxDistance3; RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * L_12 = ___hitInfo2; int32_t L_13 = ___layerMask4; int32_t L_14 = ___queryTriggerInteraction5; bool L_15; L_15 = PhysicsScene_Internal_Raycast_m1E630AA11805114B090FC50741AEF64D677AF2C7(L_9, L_10, L_11, (RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 *)L_12, L_13, L_14, /*hidden argument*/NULL); V_4 = L_15; goto IL_004a; } IL_0045: { V_4 = (bool)0; goto IL_004a; } IL_004a: { bool L_16 = V_4; return L_16; } } IL2CPP_EXTERN_C bool PhysicsScene_Raycast_mFC0D59C4439EE9DA6E8AA5F6891915132D587208_AdjustorThunk (RuntimeObject * __this, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * ___hitInfo2, float ___maxDistance3, int32_t ___layerMask4, int32_t ___queryTriggerInteraction5, const RuntimeMethod* method) { int32_t _offset = 1; PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * _thisAdjusted = reinterpret_cast<PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *>(__this + _offset); bool _returnValue; _returnValue = PhysicsScene_Raycast_mFC0D59C4439EE9DA6E8AA5F6891915132D587208(_thisAdjusted, ___origin0, ___direction1, ___hitInfo2, ___maxDistance3, ___layerMask4, ___queryTriggerInteraction5, method); return _returnValue; } // System.Boolean UnityEngine.PhysicsScene::Internal_Raycast(UnityEngine.PhysicsScene,UnityEngine.Ray,System.Single,UnityEngine.RaycastHit&,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool PhysicsScene_Internal_Raycast_m1E630AA11805114B090FC50741AEF64D677AF2C7 (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 ___physicsScene0, Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 ___ray1, float ___maxDistance2, RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * ___hit3, int32_t ___layerMask4, int32_t ___queryTriggerInteraction5, const RuntimeMethod* method) { { float L_0 = ___maxDistance2; RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * L_1 = ___hit3; int32_t L_2 = ___layerMask4; int32_t L_3 = ___queryTriggerInteraction5; bool L_4; L_4 = PhysicsScene_Internal_Raycast_Injected_m8868E0BF89F8C42D11F42F94F9CF767647433BB1((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&___physicsScene0), (Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray1), L_0, (RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 *)L_1, L_2, L_3, /*hidden argument*/NULL); return L_4; } } // System.Int32 UnityEngine.PhysicsScene::Raycast(UnityEngine.Vector3,UnityEngine.Vector3,UnityEngine.RaycastHit[],System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR int32_t PhysicsScene_Raycast_m95CAB68EB9165E3AB2A4D441F7DF9767AD4B7F73 (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * __this, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* ___raycastHits2, float ___maxDistance3, int32_t ___layerMask4, int32_t ___queryTriggerInteraction5, const RuntimeMethod* method) { float V_0 = 0.0f; bool V_1 = false; Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 V_2; memset((&V_2), 0, sizeof(V_2)); int32_t V_3 = 0; { float L_0; L_0 = Vector3_get_magnitude_mDDD40612220D8104E77E993E18A101A69A944991((Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E *)(&___direction1), /*hidden argument*/NULL); V_0 = L_0; float L_1 = V_0; V_1 = (bool)((((float)L_1) > ((float)(1.40129846E-45f)))? 1 : 0); bool L_2 = V_1; if (!L_2) { goto IL_003b; } } { Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_3 = ___origin0; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_4; L_4 = Vector3_get_normalized_m2FA6DF38F97BDA4CCBDAE12B9FE913A241DAC8D5((Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E *)(&___direction1), /*hidden argument*/NULL); Ray__ctor_m75B1F651FF47EE6B887105101B7DA61CBF41F83C((Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&V_2), L_3, L_4, /*hidden argument*/NULL); PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 L_5 = (*(PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)__this); Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 L_6 = V_2; RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_7 = ___raycastHits2; float L_8 = ___maxDistance3; int32_t L_9 = ___layerMask4; int32_t L_10 = ___queryTriggerInteraction5; int32_t L_11; L_11 = PhysicsScene_Internal_RaycastNonAlloc_mE7833EE5F1082431A4C2D29362F5DCDEFBF6D2BD(L_5, L_6, L_7, L_8, L_9, L_10, /*hidden argument*/NULL); V_3 = L_11; goto IL_003f; } IL_003b: { V_3 = 0; goto IL_003f; } IL_003f: { int32_t L_12 = V_3; return L_12; } } IL2CPP_EXTERN_C int32_t PhysicsScene_Raycast_m95CAB68EB9165E3AB2A4D441F7DF9767AD4B7F73_AdjustorThunk (RuntimeObject * __this, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___origin0, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___direction1, RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* ___raycastHits2, float ___maxDistance3, int32_t ___layerMask4, int32_t ___queryTriggerInteraction5, const RuntimeMethod* method) { int32_t _offset = 1; PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * _thisAdjusted = reinterpret_cast<PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *>(__this + _offset); int32_t _returnValue; _returnValue = PhysicsScene_Raycast_m95CAB68EB9165E3AB2A4D441F7DF9767AD4B7F73(_thisAdjusted, ___origin0, ___direction1, ___raycastHits2, ___maxDistance3, ___layerMask4, ___queryTriggerInteraction5, method); return _returnValue; } // System.Int32 UnityEngine.PhysicsScene::Internal_RaycastNonAlloc(UnityEngine.PhysicsScene,UnityEngine.Ray,UnityEngine.RaycastHit[],System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR int32_t PhysicsScene_Internal_RaycastNonAlloc_mE7833EE5F1082431A4C2D29362F5DCDEFBF6D2BD (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 ___physicsScene0, Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 ___ray1, RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* ___raycastHits2, float ___maxDistance3, int32_t ___mask4, int32_t ___queryTriggerInteraction5, const RuntimeMethod* method) { { RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* L_0 = ___raycastHits2; float L_1 = ___maxDistance3; int32_t L_2 = ___mask4; int32_t L_3 = ___queryTriggerInteraction5; int32_t L_4; L_4 = PhysicsScene_Internal_RaycastNonAlloc_Injected_m59FB44C18E62D21E9320F30229C0AA9F9B971211((PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *)(&___physicsScene0), (Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *)(&___ray1), L_0, L_1, L_2, L_3, /*hidden argument*/NULL); return L_4; } } // System.Boolean UnityEngine.PhysicsScene::Internal_RaycastTest_Injected(UnityEngine.PhysicsScene&,UnityEngine.Ray&,System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool PhysicsScene_Internal_RaycastTest_Injected_m956474EFEA507F82ABE0BCB75DDB3CC8EFF4D12B (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * ___physicsScene0, Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 * ___ray1, float ___maxDistance2, int32_t ___layerMask3, int32_t ___queryTriggerInteraction4, const RuntimeMethod* method) { typedef bool (*PhysicsScene_Internal_RaycastTest_Injected_m956474EFEA507F82ABE0BCB75DDB3CC8EFF4D12B_ftn) (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *, Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *, float, int32_t, int32_t); static PhysicsScene_Internal_RaycastTest_Injected_m956474EFEA507F82ABE0BCB75DDB3CC8EFF4D12B_ftn _il2cpp_icall_func; if (!_il2cpp_icall_func) _il2cpp_icall_func = (PhysicsScene_Internal_RaycastTest_Injected_m956474EFEA507F82ABE0BCB75DDB3CC8EFF4D12B_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.PhysicsScene::Internal_RaycastTest_Injected(UnityEngine.PhysicsScene&,UnityEngine.Ray&,System.Single,System.Int32,UnityEngine.QueryTriggerInteraction)"); bool icallRetVal = _il2cpp_icall_func(___physicsScene0, ___ray1, ___maxDistance2, ___layerMask3, ___queryTriggerInteraction4); return icallRetVal; } // System.Boolean UnityEngine.PhysicsScene::Internal_Raycast_Injected(UnityEngine.PhysicsScene&,UnityEngine.Ray&,System.Single,UnityEngine.RaycastHit&,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR bool PhysicsScene_Internal_Raycast_Injected_m8868E0BF89F8C42D11F42F94F9CF767647433BB1 (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * ___physicsScene0, Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 * ___ray1, float ___maxDistance2, RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * ___hit3, int32_t ___layerMask4, int32_t ___queryTriggerInteraction5, const RuntimeMethod* method) { typedef bool (*PhysicsScene_Internal_Raycast_Injected_m8868E0BF89F8C42D11F42F94F9CF767647433BB1_ftn) (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *, Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *, float, RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 *, int32_t, int32_t); static PhysicsScene_Internal_Raycast_Injected_m8868E0BF89F8C42D11F42F94F9CF767647433BB1_ftn _il2cpp_icall_func; if (!_il2cpp_icall_func) _il2cpp_icall_func = (PhysicsScene_Internal_Raycast_Injected_m8868E0BF89F8C42D11F42F94F9CF767647433BB1_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.PhysicsScene::Internal_Raycast_Injected(UnityEngine.PhysicsScene&,UnityEngine.Ray&,System.Single,UnityEngine.RaycastHit&,System.Int32,UnityEngine.QueryTriggerInteraction)"); bool icallRetVal = _il2cpp_icall_func(___physicsScene0, ___ray1, ___maxDistance2, ___hit3, ___layerMask4, ___queryTriggerInteraction5); return icallRetVal; } // System.Int32 UnityEngine.PhysicsScene::Internal_RaycastNonAlloc_Injected(UnityEngine.PhysicsScene&,UnityEngine.Ray&,UnityEngine.RaycastHit[],System.Single,System.Int32,UnityEngine.QueryTriggerInteraction) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR int32_t PhysicsScene_Internal_RaycastNonAlloc_Injected_m59FB44C18E62D21E9320F30229C0AA9F9B971211 (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 * ___physicsScene0, Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 * ___ray1, RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09* ___raycastHits2, float ___maxDistance3, int32_t ___mask4, int32_t ___queryTriggerInteraction5, const RuntimeMethod* method) { typedef int32_t (*PhysicsScene_Internal_RaycastNonAlloc_Injected_m59FB44C18E62D21E9320F30229C0AA9F9B971211_ftn) (PhysicsScene_tEDFCAA935450E8EBB7732353D9AA264A5F711678 *, Ray_t2E9E67CC8B03EE6ED2BBF3D2C9C96DDF70E1D5E6 *, RaycastHitU5BU5D_t6778DB95346906446AAD3A1A36904F1846435A09*, float, int32_t, int32_t); static PhysicsScene_Internal_RaycastNonAlloc_Injected_m59FB44C18E62D21E9320F30229C0AA9F9B971211_ftn _il2cpp_icall_func; if (!_il2cpp_icall_func) _il2cpp_icall_func = (PhysicsScene_Internal_RaycastNonAlloc_Injected_m59FB44C18E62D21E9320F30229C0AA9F9B971211_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.PhysicsScene::Internal_RaycastNonAlloc_Injected(UnityEngine.PhysicsScene&,UnityEngine.Ray&,UnityEngine.RaycastHit[],System.Single,System.Int32,UnityEngine.QueryTriggerInteraction)"); int32_t icallRetVal = _il2cpp_icall_func(___physicsScene0, ___ray1, ___raycastHits2, ___maxDistance3, ___mask4, ___queryTriggerInteraction5); return icallRetVal; } #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 // UnityEngine.Collider UnityEngine.RaycastHit::get_collider() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02 * RaycastHit_get_collider_m13A3DE16FBC631E0A1F987E0B22CE70AF8AB539E (RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * __this, const RuntimeMethod* method) { static bool s_Il2CppMethodInitialized; if (!s_Il2CppMethodInitialized) { il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02_il2cpp_TypeInfo_var); il2cpp_codegen_initialize_runtime_metadata((uintptr_t*)&Object_tF2F3778131EFF286AF62B7B013A170F95A91571A_il2cpp_TypeInfo_var); s_Il2CppMethodInitialized = true; } Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02 * V_0 = NULL; { int32_t L_0 = __this->get_m_Collider_5(); IL2CPP_RUNTIME_CLASS_INIT(Object_tF2F3778131EFF286AF62B7B013A170F95A91571A_il2cpp_TypeInfo_var); Object_tF2F3778131EFF286AF62B7B013A170F95A91571A * L_1; L_1 = Object_FindObjectFromInstanceID_m0AD731D3F583CBBDC7DC0E08B38F742B447FA44A(L_0, /*hidden argument*/NULL); V_0 = ((Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02 *)IsInstClass((RuntimeObject*)L_1, Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02_il2cpp_TypeInfo_var)); goto IL_0014; } IL_0014: { Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02 * L_2 = V_0; return L_2; } } IL2CPP_EXTERN_C Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02 * RaycastHit_get_collider_m13A3DE16FBC631E0A1F987E0B22CE70AF8AB539E_AdjustorThunk (RuntimeObject * __this, const RuntimeMethod* method) { int32_t _offset = 1; RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * _thisAdjusted = reinterpret_cast<RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 *>(__this + _offset); Collider_t5E81E43C2ECA0209A7C4528E84A632712D192B02 * _returnValue; _returnValue = RaycastHit_get_collider_m13A3DE16FBC631E0A1F987E0B22CE70AF8AB539E(_thisAdjusted, method); return _returnValue; } // UnityEngine.Vector3 UnityEngine.RaycastHit::get_point() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E RaycastHit_get_point_m32F7282CBB2E13393A33BAD046BDA218E48DD21E (RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * __this, const RuntimeMethod* method) { Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E V_0; memset((&V_0), 0, sizeof(V_0)); { Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_0 = __this->get_m_Point_0(); V_0 = L_0; goto IL_000a; } IL_000a: { Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1 = V_0; return L_1; } } IL2CPP_EXTERN_C Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E RaycastHit_get_point_m32F7282CBB2E13393A33BAD046BDA218E48DD21E_AdjustorThunk (RuntimeObject * __this, const RuntimeMethod* method) { int32_t _offset = 1; RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * _thisAdjusted = reinterpret_cast<RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 *>(__this + _offset); Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E _returnValue; _returnValue = RaycastHit_get_point_m32F7282CBB2E13393A33BAD046BDA218E48DD21E(_thisAdjusted, method); return _returnValue; } // UnityEngine.Vector3 UnityEngine.RaycastHit::get_normal() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E RaycastHit_get_normal_m2C813B25BAECD87FD9E9CB294278B291F4CC6674 (RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * __this, const RuntimeMethod* method) { Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E V_0; memset((&V_0), 0, sizeof(V_0)); { Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_0 = __this->get_m_Normal_1(); V_0 = L_0; goto IL_000a; } IL_000a: { Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_1 = V_0; return L_1; } } IL2CPP_EXTERN_C Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E RaycastHit_get_normal_m2C813B25BAECD87FD9E9CB294278B291F4CC6674_AdjustorThunk (RuntimeObject * __this, const RuntimeMethod* method) { int32_t _offset = 1; RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * _thisAdjusted = reinterpret_cast<RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 *>(__this + _offset); Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E _returnValue; _returnValue = RaycastHit_get_normal_m2C813B25BAECD87FD9E9CB294278B291F4CC6674(_thisAdjusted, method); return _returnValue; } // System.Single UnityEngine.RaycastHit::get_distance() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR float RaycastHit_get_distance_m85FCA98D7957C3BF1D449CA1B48C116CCD6226FA (RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * __this, const RuntimeMethod* method) { float V_0 = 0.0f; { float L_0 = __this->get_m_Distance_3(); V_0 = L_0; goto IL_000a; } IL_000a: { float L_1 = V_0; return L_1; } } IL2CPP_EXTERN_C float RaycastHit_get_distance_m85FCA98D7957C3BF1D449CA1B48C116CCD6226FA_AdjustorThunk (RuntimeObject * __this, const RuntimeMethod* method) { int32_t _offset = 1; RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 * _thisAdjusted = reinterpret_cast<RaycastHit_t59E5AEC8FE13BFA2ACBB6FFBDB7585FFB7288F89 *>(__this + _offset); float _returnValue; _returnValue = RaycastHit_get_distance_m85FCA98D7957C3BF1D449CA1B48C116CCD6226FA(_thisAdjusted, method); return _returnValue; } #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.Rigidbody::set_velocity(UnityEngine.Vector3) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void Rigidbody_set_velocity_m8DC0988916EB38DFD7D4584830B41D79140BF18D (Rigidbody_t101F2E2F9F16E765A77429B2DE4527D2047A887A * __this, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___value0, const RuntimeMethod* method) { { Rigidbody_set_velocity_Injected_mBFBC7681B33942F69A5CD908941D399777F66ADD(__this, (Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E *)(&___value0), /*hidden argument*/NULL); return; } } // System.Void UnityEngine.Rigidbody::set_useGravity(System.Boolean) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void Rigidbody_set_useGravity_m1057292FB3199E87664F40B8BCBA7A7E64D1A096 (Rigidbody_t101F2E2F9F16E765A77429B2DE4527D2047A887A * __this, bool ___value0, const RuntimeMethod* method) { typedef void (*Rigidbody_set_useGravity_m1057292FB3199E87664F40B8BCBA7A7E64D1A096_ftn) (Rigidbody_t101F2E2F9F16E765A77429B2DE4527D2047A887A *, bool); static Rigidbody_set_useGravity_m1057292FB3199E87664F40B8BCBA7A7E64D1A096_ftn _il2cpp_icall_func; if (!_il2cpp_icall_func) _il2cpp_icall_func = (Rigidbody_set_useGravity_m1057292FB3199E87664F40B8BCBA7A7E64D1A096_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.Rigidbody::set_useGravity(System.Boolean)"); _il2cpp_icall_func(__this, ___value0); } // System.Void UnityEngine.Rigidbody::set_velocity_Injected(UnityEngine.Vector3&) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void Rigidbody_set_velocity_Injected_mBFBC7681B33942F69A5CD908941D399777F66ADD (Rigidbody_t101F2E2F9F16E765A77429B2DE4527D2047A887A * __this, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * ___value0, const RuntimeMethod* method) { typedef void (*Rigidbody_set_velocity_Injected_mBFBC7681B33942F69A5CD908941D399777F66ADD_ftn) (Rigidbody_t101F2E2F9F16E765A77429B2DE4527D2047A887A *, Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E *); static Rigidbody_set_velocity_Injected_mBFBC7681B33942F69A5CD908941D399777F66ADD_ftn _il2cpp_icall_func; if (!_il2cpp_icall_func) _il2cpp_icall_func = (Rigidbody_set_velocity_Injected_mBFBC7681B33942F69A5CD908941D399777F66ADD_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.Rigidbody::set_velocity_Injected(UnityEngine.Vector3&)"); _il2cpp_icall_func(__this, ___value0); } #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 IL2CPP_MANAGED_FORCE_INLINE IL2CPP_METHOD_ATTR Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E Vector3_op_Division_mE5ACBFB168FED529587457A83BA98B7DB32E2A05_inline (Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E ___a0, float ___d1, const RuntimeMethod* method) { Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E V_0; memset((&V_0), 0, sizeof(V_0)); { Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_0 = ___a0; float L_1 = L_0.get_x_2(); float L_2 = ___d1; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_3 = ___a0; float L_4 = L_3.get_y_3(); float L_5 = ___d1; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_6 = ___a0; float L_7 = L_6.get_z_4(); float L_8 = ___d1; Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_9; memset((&L_9), 0, sizeof(L_9)); Vector3__ctor_m57495F692C6CE1CEF278CAD9A98221165D37E636_inline((&L_9), ((float)((float)L_1/(float)L_2)), ((float)((float)L_4/(float)L_5)), ((float)((float)L_7/(float)L_8)), /*hidden argument*/NULL); V_0 = L_9; goto IL_0021; } IL_0021: { Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E L_10 = V_0; return L_10; } } IL2CPP_MANAGED_FORCE_INLINE IL2CPP_METHOD_ATTR void Vector3__ctor_m57495F692C6CE1CEF278CAD9A98221165D37E636_inline (Vector3_t65B972D6A585A0A5B63153CF1177A90D3C90D65E * __this, float ___x0, float ___y1, float ___z2, const RuntimeMethod* method) { { float L_0 = ___x0; __this->set_x_2(L_0); float L_1 = ___y1; __this->set_y_3(L_1); float L_2 = ___z2; __this->set_z_4(L_2); return; } }
d44bc1ded3ba5ac2ae100133e065e1e164c24ad0
fcc777b709d795c4116bad5415439e9faa532d39
/rongyu/homework1/file2/2017182013_1120_姝g‘_187.cpp
7e526103fbc686c2ece209ef9667e862082cf2b3
[]
no_license
demonsheart/C-
1dcaa2128ec8b20e047ae55dd33f66a359097910
f567b8ca4a4d3ccdf6d59e9fae5b5cea27ec85c1
refs/heads/master
2022-11-29T00:27:30.604843
2020-08-10T11:48:36
2020-08-10T11:48:36
283,923,861
1
0
null
null
null
null
UTF-8
C++
false
false
1,673
cpp
#include <bits/stdc++.h> using namespace std; class Animal { protected: string name; int age; public: Animal(string n="",int a=0):name(n),age(a){} virtual void speak()=0; }; class Tiger:public Animal { public: Tiger(string n,int a):Animal(n,a){} void speak() { cout<<"Hello,I am "<<name<<",AOOO."<<endl; } }; class Dog:public Animal { public: Dog(string n,int a):Animal(n,a){} void speak() { cout<<"Hello,I am "<<name<<",WangWang."<<endl; } }; class Duck:public Animal { public: Duck(string n,int a):Animal(n,a){} void speak() { cout<<"Hello,I am "<<name<<",GAGA."<<endl; } }; class Pig:public Animal { public: Pig(string n,int a):Animal(n,a){} void speak() { cout<<"Hello,I am "<<name<<",HENGHENG."<<endl; } }; int main() { //freopen("C:\\Users\\241\\Desktop\\c\\s.txt",stdin,"r"); int n; cin>>n; while(n--) { Animal *pv; string type; cin>>type; string name; int age; cin>>name>>age; if(type == "Tiger") { Tiger t(name ,age); pv = &t; pv->speak(); } else if(type == "Pig") { Pig p(name,age); pv = &p; pv->speak(); } else if(type == "Duck") { Duck d(name,age); pv = &d; pv->speak(); } else if(type == "Dog") { Dog d(name,age); pv = &d; pv->speak(); } else cout<<"There is no "<<type<<" in our Zoo."<<endl; } return 0; }
b6d035f1125b8b3e6bdc224959cdbb17d0cc9909
00253716f619d2f2c8c2d0a17bfee779acd570bd
/main/src/socket/tcp/tcp_socket.h
be5baef39aba14857a5e7e3835c070033c8e67fe
[]
no_license
RafaelGSS/vpn-router-cpp
4219e27314dfa05d6ddf2cf872496e17b5e501e3
6759f03b942087fe856acb464c7392230ec16158
refs/heads/master
2020-08-22T17:57:55.760388
2020-07-27T02:05:43
2020-07-27T02:05:43
216,452,359
1
1
null
null
null
null
UTF-8
C++
false
false
1,056
h
#pragma once #include <stdint.h> #include <wpp/net/ip/socket/socket_tcp.hpp> class tcp_socket : public wpp::net::ip::socket::tcp::socket_tcp { public: virtual void handler_accept( const std::shared_ptr<boost::asio::ip::tcp::socket>& client, const boost::system::error_code& error ) override; virtual void handler_recv( const std::shared_ptr<boost::asio::ip::tcp::socket>& client, const boost::system::error_code& error, size_t bytes_transferred, const std::string& buffer ) override; virtual void handler_send( const std::shared_ptr<boost::asio::ip::tcp::socket>& server, const boost::system::error_code& error, size_t bytes_transferred ) override; virtual void handler_connect( const std::shared_ptr<boost::asio::ip::tcp::socket>& server, const std::shared_ptr<boost::asio::ip::tcp::endpoint>& endpoint, const boost::system::error_code& error ) override; // If passed this_server_bind empty, will pick up local network = 0.0.0.0 tcp_socket( uint16_t port, std::string this_server_bind ); ~tcp_socket(); };
ee2053b97138aeb5e4245c6e0e579ed05a6e3a57
e374e8434fca1e7448b49c69842ef21935a6dbcf
/plotView/settingsWidget.cpp
d9dfdec397dc6b08682d49f60fab64db65bbed59
[ "MIT" ]
permissive
zhanxiangqian/plot
514ba9f65846cbca35716be329bd4b1ec0bb3ddc
d24cc22668a94ffac5720d9877579a54a225401a
refs/heads/master
2022-12-03T13:34:59.101280
2020-08-18T09:59:53
2020-08-18T09:59:53
287,489,573
0
0
null
null
null
null
UTF-8
C++
false
false
2,838
cpp
#include "settingsWidget.h" #include "QtGnuplotInstance.h" #include "QtGnuplotWidget.h" #include <QFileDialog> #include <QByteArray> #include <QMutex> //QStringList g_Commands; //QMutex g_Mutex; SettingsWidget::SettingsWidget(QWidget* parent) : QWidget(parent) { ui.setupUi(this); connect(ui.pushButtonOpen, &QPushButton::clicked, this, &SettingsWidget::onOpen); connect(ui.pushButtonPlot, &QPushButton::clicked, this, &SettingsWidget::onPlot); connect(ui.xAxis, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(onXAxisChanged(const QString&))); connect(ui.yAxis, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(onYAxisChanged(const QString&))); connect(ui.lineType, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(onLineTypeChanged(const QString&))); } void SettingsWidget::reset() { } void SettingsWidget::onOpen() { QString fileName = QFileDialog::getOpenFileName(this, tr("Open Image"), QDir::currentPath(), tr("Image Files (*.csv)")); m_fileName = fileName; ui.lineEditFileName->setText(m_fileName); QFile file(fileName); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return; while (!file.atEnd()) { QByteArray line = file.readLine(); QString firstLine(line);//only one line QStringList names = firstLine.split(","); ui.xAxis->clear(); ui.xAxis->addItems(names); ui.yAxis->clear(); ui.yAxis->addItems(names); ui.lineType->clear(); ui.lineType->addItems(QStringList() << "lines" << "points"); file.close(); break; } m_plotDone = false; } void SettingsWidget::setPlotWidget(QtGnuplotWidget* target) { m_target = target; connect(m_target, &QtGnuplotWidget::plotDone, this, &SettingsWidget::onPlotDone); } void SettingsWidget::onPlot() { //m_plotDone = false; QtGnuplotInstance& gp = (*QtGnuplotInstance::getInstance("")); QString plotCommand; plotCommand += "set datafile separator \",\"\n"; //QString plotCommand; plotCommand += QString("plot \"%1\" using \"%2\":\"%3\" with %4\n").arg(m_fileName).arg(m_xAxisName).arg(m_yAxisName).arg(m_lineType); gp << plotCommand.toLocal8Bit(); Q_EMIT plotAction(); } void SettingsWidget::onPlotDone() { if (!m_plotDone) { //m_target->activateWindow(); //m_target->raise(); //m_target->resize(m_target->size()); m_plotDone = true; //qDebug() << "plotDone"; } } void SettingsWidget::onLineTypeChanged(const QString& type) { m_lineType = type; } void SettingsWidget::onXAxisChanged(const QString& xAxis) { m_xAxisName = xAxis; } void SettingsWidget::onYAxisChanged(const QString& yAxis) { m_yAxisName = yAxis; } /*void WorkerThread::run() { while (1) { if (g_Commands.count()) { QtGnuplotInstance& gp = (*QtGnuplotInstance::getInstance("")); g_Mutex.lock(); gp << g_Commands.takeAt(0); g_Mutex.unlock(); } } QString result; emit resultReady(result); } */
86f80d04bc27bbc8d7e5fd03089bf71ddd8e779f
d5c88cd7ca639465fac7b57ad7555fe9015720bf
/Models/Node.h
1f6ed1f6acc0c5b258aa79340259418291a40a67
[]
no_license
codeWonderland/Apriori
30ddf76bd83f1f64159fddb218644efb6db58da0
a5117bf1083549d25691c406706917e8447a16a0
refs/heads/master
2021-05-06T08:10:28.053762
2018-01-30T21:30:17
2018-01-30T21:30:17
114,005,844
0
0
null
null
null
null
UTF-8
C++
false
false
1,237
h
/* *** Author: Adam DeCosta & Alice Easter * Last Update: Dec 8, 2017 * Class: CSI-281 * Filename: main.cpp * * Description: * Main Driver for Program, contains flow logic * * Certification of Authenticity: * I certify that this assignment is entirely my work. ******************************************************************/ #ifndef FA17_CSI281_DECOSTA_EASTER_NODE_H #define FA17_CSI281_DECOSTA_EASTER_NODE_H #include <iostream> #include <iomanip> #include <fstream> #include <string> #include <sstream> #include "../sortingFunction.h" template<typename R> struct Node { R mData; Node<R> *mNext; /* Pre: None * Post: This object is initialized using default values * Purpose: To initialize date object ********************************************************************/ Node() { mData = R(); mNext = nullptr; } /* Pre: None * Post: This object is initialized using specified data * Purpose: To intialize date object ********************************************************************/ explicit Node(R data) : mData(data), mNext(nullptr) { } }; #endif //FA17_CSI281_DECOSTA_EASTER_NODE_H
96c84176fc660f93604845125fc07437cb7f70a3
e5ec9a33aaca93a653df46e7d3c351ece1b4abc5
/SamplesZQCNN/SampleTextBoxes/SampleTextBoxes.cpp
11ee3f157b987f7ac46310a95847f87748f184c3
[ "MIT" ]
permissive
zuoqing1988/ZQCNN
0b0dbe79acf3094c252e6016dca0dbf37134ce37
9c89e94debaa9a241d2ac0cbc7d32c7bb8436490
refs/heads/master
2022-08-28T08:09:58.698706
2022-08-22T04:20:27
2022-08-22T04:20:27
132,091,868
2,152
487
MIT
2020-10-23T07:37:06
2018-05-04T05:30:54
Objective-C
UTF-8
C++
false
false
2,578
cpp
#include "ZQ_CNN_TextBoxes.h" #include <vector> #include <iostream> #include "opencv2/opencv.hpp" #include "ZQ_CNN_CompileConfig.h" #if ZQ_CNN_USE_BLAS_GEMM #include <openblas/cblas.h> #pragma comment(lib,"libopenblas.lib") #elif ZQ_CNN_USE_MKL_GEMM #include <mkl/mkl.h> #pragma comment(lib,"mklml.lib") #else #pragma comment(lib,"ZQ_GEMM.lib") #endif using namespace ZQ; using namespace std; using namespace cv; int main() { int thread_num = 4; #if ZQ_CNN_USE_BLAS_GEMM openblas_set_num_threads(thread_num); #elif ZQ_CNN_USE_MKL_GEMM mkl_set_num_threads(thread_num); #endif Mat img0 = cv::imread("data/0113.jpg", 1); if (img0.empty()) { cout << "empty image\n"; return EXIT_FAILURE; } //resize(img0, img0, Size(), 0.5, 0.5); ZQ_CNN_TextBoxes detector; if (!detector.Init("model/TextBoxes_icdar13.zqparams", "model/TextBoxes_icdar13.nchwbin", "detection_out")) { printf("failed to init detector!\n"); return false; } int out_iter = 1; int iters = 1; std::vector<ZQ_CNN_TextBoxes::BBox> output; const float kScoreThreshold = 0.5f; int H = img0.rows, W = img0.cols; std::vector<int> target_W, target_H; target_H.push_back(H); target_W.push_back(W); target_H.push_back(H*0.7); target_W.push_back(W*0.7); target_H.push_back(H*0.5); target_W.push_back(W*0.5); target_H.push_back(H*0.35); target_W.push_back(W*0.35); target_H.push_back(H*0.25); target_W.push_back(W*0.25); target_H.push_back(300); target_W.push_back(300); for (int out_it = 0; out_it < out_iter; out_it++) { double t1 = omp_get_wtime(); for (int it = 0; it < iters; it++) { if (!detector.Detect(output, img0.data, img0.cols, img0.rows, img0.step[0], kScoreThreshold, target_W, target_H, true)) { cout << "failed to run\n"; return EXIT_FAILURE; } } double t2 = omp_get_wtime(); printf("[%d] times cost %.3f s, 1 iter cost %.3f ms\n", iters, t2 - t1, 1000 * (t2 - t1) / iters); } const char* kClassNames[] = { "__background__", "text" }; // draw for (auto& bbox : output) { cv::Rect rect(bbox.col1, bbox.row1, bbox.col2 - bbox.col1 + 1, bbox.row2 - bbox.row1 + 1); cv::rectangle(img0, rect, cv::Scalar(0, 0, 255), 2); char buff[300]; #if defined(_WIN32) sprintf_s(buff, 300, "%s: %.2f", kClassNames[bbox.label], bbox.score); #else sprintf(buff, "%s: %.2f", kClassNames[bbox.label], bbox.score); #endif cv::putText(img0, buff, cv::Point(bbox.col1, bbox.row1), FONT_HERSHEY_PLAIN, 1, Scalar(0, 255, 0)); } cv::imwrite("./textboxes-result.jpg", img0); cv::imshow("ZQCNN-TextBoxes", img0); cv::waitKey(0); return EXIT_SUCCESS; }
74b39d9177d7e3efa379aa01f1492f48bf7eaa1f
6c4699de64796bde99b9781ce6bcbbde5be4f2a4
/External/opencv-2.4.6.1/modules/video/src/optflowgf.cpp
0f63bb47a504ad04477856011c27a1f062e0d564
[]
no_license
simonct/CoreAstro
3ea33aea2d9dd3ef1f0fbb990b4036c8ab8c6778
eafd0aea314c427da616e1707a49aaeaf5ea6991
refs/heads/master
2020-05-22T04:03:57.706741
2014-10-25T07:30:40
2014-10-25T07:30:40
5,735,802
3
0
null
null
null
null
UTF-8
C++
false
false
21,922
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 "precomp.hpp" // // 2D dense optical flow algorithm from the following paper: // Gunnar Farneback. "Two-Frame Motion Estimation Based on Polynomial Expansion". // Proceedings of the 13th Scandinavian Conference on Image Analysis, Gothenburg, Sweden // namespace cv { static void FarnebackPolyExp( const Mat& src, Mat& dst, int n, double sigma ) { int k, x, y; assert( src.type() == CV_32FC1 ); int width = src.cols; int height = src.rows; AutoBuffer<float> kbuf(n*6 + 3), _row((width + n*2)*3); float* g = kbuf + n; float* xg = g + n*2 + 1; float* xxg = xg + n*2 + 1; float *row = (float*)_row + n*3; if( sigma < FLT_EPSILON ) sigma = n*0.3; double s = 0.; for( x = -n; x <= n; x++ ) { g[x] = (float)std::exp(-x*x/(2*sigma*sigma)); s += g[x]; } s = 1./s; for( x = -n; x <= n; x++ ) { g[x] = (float)(g[x]*s); xg[x] = (float)(x*g[x]); xxg[x] = (float)(x*x*g[x]); } Mat_<double> G = Mat_<double>::zeros(6, 6); for( y = -n; y <= n; y++ ) for( x = -n; x <= n; x++ ) { G(0,0) += g[y]*g[x]; G(1,1) += g[y]*g[x]*x*x; G(3,3) += g[y]*g[x]*x*x*x*x; G(5,5) += g[y]*g[x]*x*x*y*y; } //G[0][0] = 1.; G(2,2) = G(0,3) = G(0,4) = G(3,0) = G(4,0) = G(1,1); G(4,4) = G(3,3); G(3,4) = G(4,3) = G(5,5); // invG: // [ x e e ] // [ y ] // [ y ] // [ e z ] // [ e z ] // [ u ] Mat_<double> invG = G.inv(DECOMP_CHOLESKY); double ig11 = invG(1,1), ig03 = invG(0,3), ig33 = invG(3,3), ig55 = invG(5,5); dst.create( height, width, CV_32FC(5)); for( y = 0; y < height; y++ ) { float g0 = g[0], g1, g2; float *srow0 = (float*)(src.data + src.step*y), *srow1 = 0; float *drow = (float*)(dst.data + dst.step*y); // vertical part of convolution for( x = 0; x < width; x++ ) { row[x*3] = srow0[x]*g0; row[x*3+1] = row[x*3+2] = 0.f; } for( k = 1; k <= n; k++ ) { g0 = g[k]; g1 = xg[k]; g2 = xxg[k]; srow0 = (float*)(src.data + src.step*std::max(y-k,0)); srow1 = (float*)(src.data + src.step*std::min(y+k,height-1)); for( x = 0; x < width; x++ ) { float p = srow0[x] + srow1[x]; float t0 = row[x*3] + g0*p; float t1 = row[x*3+1] + g1*(srow1[x] - srow0[x]); float t2 = row[x*3+2] + g2*p; row[x*3] = t0; row[x*3+1] = t1; row[x*3+2] = t2; } } // horizontal part of convolution for( x = 0; x < n*3; x++ ) { row[-1-x] = row[2-x]; row[width*3+x] = row[width*3+x-3]; } for( x = 0; x < width; x++ ) { g0 = g[0]; // r1 ~ 1, r2 ~ x, r3 ~ y, r4 ~ x^2, r5 ~ y^2, r6 ~ xy double b1 = row[x*3]*g0, b2 = 0, b3 = row[x*3+1]*g0, b4 = 0, b5 = row[x*3+2]*g0, b6 = 0; for( k = 1; k <= n; k++ ) { double tg = row[(x+k)*3] + row[(x-k)*3]; g0 = g[k]; b1 += tg*g0; b4 += tg*xxg[k]; b2 += (row[(x+k)*3] - row[(x-k)*3])*xg[k]; b3 += (row[(x+k)*3+1] + row[(x-k)*3+1])*g0; b6 += (row[(x+k)*3+1] - row[(x-k)*3+1])*xg[k]; b5 += (row[(x+k)*3+2] + row[(x-k)*3+2])*g0; } // do not store r1 drow[x*5+1] = (float)(b2*ig11); drow[x*5] = (float)(b3*ig11); drow[x*5+3] = (float)(b1*ig03 + b4*ig33); drow[x*5+2] = (float)(b1*ig03 + b5*ig33); drow[x*5+4] = (float)(b6*ig55); } } row -= n*3; } /*static void FarnebackPolyExpPyr( const Mat& src0, Vector<Mat>& pyr, int maxlevel, int n, double sigma ) { Vector<Mat> imgpyr; buildPyramid( src0, imgpyr, maxlevel ); for( int i = 0; i <= maxlevel; i++ ) FarnebackPolyExp( imgpyr[i], pyr[i], n, sigma ); }*/ static void FarnebackUpdateMatrices( const Mat& _R0, const Mat& _R1, const Mat& _flow, Mat& matM, int _y0, int _y1 ) { const int BORDER = 5; static const float border[BORDER] = {0.14f, 0.14f, 0.4472f, 0.4472f, 0.4472f}; int x, y, width = _flow.cols, height = _flow.rows; const float* R1 = (float*)_R1.data; size_t step1 = _R1.step/sizeof(R1[0]); matM.create(height, width, CV_32FC(5)); for( y = _y0; y < _y1; y++ ) { const float* flow = (float*)(_flow.data + y*_flow.step); const float* R0 = (float*)(_R0.data + y*_R0.step); float* M = (float*)(matM.data + y*matM.step); for( x = 0; x < width; x++ ) { float dx = flow[x*2], dy = flow[x*2+1]; float fx = x + dx, fy = y + dy; #if 1 int x1 = cvFloor(fx), y1 = cvFloor(fy); const float* ptr = R1 + y1*step1 + x1*5; float r2, r3, r4, r5, r6; fx -= x1; fy -= y1; if( (unsigned)x1 < (unsigned)(width-1) && (unsigned)y1 < (unsigned)(height-1) ) { float a00 = (1.f-fx)*(1.f-fy), a01 = fx*(1.f-fy), a10 = (1.f-fx)*fy, a11 = fx*fy; r2 = a00*ptr[0] + a01*ptr[5] + a10*ptr[step1] + a11*ptr[step1+5]; r3 = a00*ptr[1] + a01*ptr[6] + a10*ptr[step1+1] + a11*ptr[step1+6]; r4 = a00*ptr[2] + a01*ptr[7] + a10*ptr[step1+2] + a11*ptr[step1+7]; r5 = a00*ptr[3] + a01*ptr[8] + a10*ptr[step1+3] + a11*ptr[step1+8]; r6 = a00*ptr[4] + a01*ptr[9] + a10*ptr[step1+4] + a11*ptr[step1+9]; r4 = (R0[x*5+2] + r4)*0.5f; r5 = (R0[x*5+3] + r5)*0.5f; r6 = (R0[x*5+4] + r6)*0.25f; } #else int x1 = cvRound(fx), y1 = cvRound(fy); const float* ptr = R1 + y1*step1 + x1*5; float r2, r3, r4, r5, r6; if( (unsigned)x1 < (unsigned)width && (unsigned)y1 < (unsigned)height ) { r2 = ptr[0]; r3 = ptr[1]; r4 = (R0[x*5+2] + ptr[2])*0.5f; r5 = (R0[x*5+3] + ptr[3])*0.5f; r6 = (R0[x*5+4] + ptr[4])*0.25f; } #endif else { r2 = r3 = 0.f; r4 = R0[x*5+2]; r5 = R0[x*5+3]; r6 = R0[x*5+4]*0.5f; } r2 = (R0[x*5] - r2)*0.5f; r3 = (R0[x*5+1] - r3)*0.5f; r2 += r4*dy + r6*dx; r3 += r6*dy + r5*dx; if( (unsigned)(x - BORDER) >= (unsigned)(width - BORDER*2) || (unsigned)(y - BORDER) >= (unsigned)(height - BORDER*2)) { float scale = (x < BORDER ? border[x] : 1.f)* (x >= width - BORDER ? border[width - x - 1] : 1.f)* (y < BORDER ? border[y] : 1.f)* (y >= height - BORDER ? border[height - y - 1] : 1.f); r2 *= scale; r3 *= scale; r4 *= scale; r5 *= scale; r6 *= scale; } M[x*5] = r4*r4 + r6*r6; // G(1,1) M[x*5+1] = (r4 + r5)*r6; // G(1,2)=G(2,1) M[x*5+2] = r5*r5 + r6*r6; // G(2,2) M[x*5+3] = r4*r2 + r6*r3; // h(1) M[x*5+4] = r6*r2 + r5*r3; // h(2) } } } static void FarnebackUpdateFlow_Blur( const Mat& _R0, const Mat& _R1, Mat& _flow, Mat& matM, int block_size, bool update_matrices ) { int x, y, width = _flow.cols, height = _flow.rows; int m = block_size/2; int y0 = 0, y1; int min_update_stripe = std::max((1 << 10)/width, block_size); double scale = 1./(block_size*block_size); AutoBuffer<double> _vsum((width+m*2+2)*5); double* vsum = _vsum + (m+1)*5; // init vsum const float* srow0 = (const float*)matM.data; for( x = 0; x < width*5; x++ ) vsum[x] = srow0[x]*(m+2); for( y = 1; y < m; y++ ) { srow0 = (float*)(matM.data + matM.step*std::min(y,height-1)); for( x = 0; x < width*5; x++ ) vsum[x] += srow0[x]; } // compute blur(G)*flow=blur(h) for( y = 0; y < height; y++ ) { double g11, g12, g22, h1, h2; float* flow = (float*)(_flow.data + _flow.step*y); srow0 = (const float*)(matM.data + matM.step*std::max(y-m-1,0)); const float* srow1 = (const float*)(matM.data + matM.step*std::min(y+m,height-1)); // vertical blur for( x = 0; x < width*5; x++ ) vsum[x] += srow1[x] - srow0[x]; // update borders for( x = 0; x < (m+1)*5; x++ ) { vsum[-1-x] = vsum[4-x]; vsum[width*5+x] = vsum[width*5+x-5]; } // init g** and h* g11 = vsum[0]*(m+2); g12 = vsum[1]*(m+2); g22 = vsum[2]*(m+2); h1 = vsum[3]*(m+2); h2 = vsum[4]*(m+2); for( x = 1; x < m; x++ ) { g11 += vsum[x*5]; g12 += vsum[x*5+1]; g22 += vsum[x*5+2]; h1 += vsum[x*5+3]; h2 += vsum[x*5+4]; } // horizontal blur for( x = 0; x < width; x++ ) { g11 += vsum[(x+m)*5] - vsum[(x-m)*5 - 5]; g12 += vsum[(x+m)*5 + 1] - vsum[(x-m)*5 - 4]; g22 += vsum[(x+m)*5 + 2] - vsum[(x-m)*5 - 3]; h1 += vsum[(x+m)*5 + 3] - vsum[(x-m)*5 - 2]; h2 += vsum[(x+m)*5 + 4] - vsum[(x-m)*5 - 1]; double g11_ = g11*scale; double g12_ = g12*scale; double g22_ = g22*scale; double h1_ = h1*scale; double h2_ = h2*scale; double idet = 1./(g11_*g22_ - g12_*g12_+1e-3); flow[x*2] = (float)((g11_*h2_-g12_*h1_)*idet); flow[x*2+1] = (float)((g22_*h1_-g12_*h2_)*idet); } y1 = y == height - 1 ? height : y - block_size; if( update_matrices && (y1 == height || y1 >= y0 + min_update_stripe) ) { FarnebackUpdateMatrices( _R0, _R1, _flow, matM, y0, y1 ); y0 = y1; } } } static void FarnebackUpdateFlow_GaussianBlur( const Mat& _R0, const Mat& _R1, Mat& _flow, Mat& matM, int block_size, bool update_matrices ) { int x, y, i, width = _flow.cols, height = _flow.rows; int m = block_size/2; int y0 = 0, y1; int min_update_stripe = std::max((1 << 10)/width, block_size); double sigma = m*0.3, s = 1; AutoBuffer<float> _vsum((width+m*2+2)*5 + 16), _hsum(width*5 + 16); AutoBuffer<float, 4096> _kernel((m+1)*5 + 16); AutoBuffer<float*, 1024> _srow(m*2+1); float *vsum = alignPtr((float*)_vsum + (m+1)*5, 16), *hsum = alignPtr((float*)_hsum, 16); float* kernel = (float*)_kernel; const float** srow = (const float**)&_srow[0]; kernel[0] = (float)s; for( i = 1; i <= m; i++ ) { float t = (float)std::exp(-i*i/(2*sigma*sigma) ); kernel[i] = t; s += t*2; } s = 1./s; for( i = 0; i <= m; i++ ) kernel[i] = (float)(kernel[i]*s); #if CV_SSE2 float* simd_kernel = alignPtr(kernel + m+1, 16); volatile bool useSIMD = checkHardwareSupport(CV_CPU_SSE); if( useSIMD ) { for( i = 0; i <= m; i++ ) _mm_store_ps(simd_kernel + i*4, _mm_set1_ps(kernel[i])); } #endif // compute blur(G)*flow=blur(h) for( y = 0; y < height; y++ ) { double g11, g12, g22, h1, h2; float* flow = (float*)(_flow.data + _flow.step*y); // vertical blur for( i = 0; i <= m; i++ ) { srow[m-i] = (const float*)(matM.data + matM.step*std::max(y-i,0)); srow[m+i] = (const float*)(matM.data + matM.step*std::min(y+i,height-1)); } x = 0; #if CV_SSE2 if( useSIMD ) { for( ; x <= width*5 - 16; x += 16 ) { const float *sptr0 = srow[m], *sptr1; __m128 g4 = _mm_load_ps(simd_kernel); __m128 s0, s1, s2, s3; s0 = _mm_mul_ps(_mm_loadu_ps(sptr0 + x), g4); s1 = _mm_mul_ps(_mm_loadu_ps(sptr0 + x + 4), g4); s2 = _mm_mul_ps(_mm_loadu_ps(sptr0 + x + 8), g4); s3 = _mm_mul_ps(_mm_loadu_ps(sptr0 + x + 12), g4); for( i = 1; i <= m; i++ ) { __m128 x0, x1; sptr0 = srow[m+i], sptr1 = srow[m-i]; g4 = _mm_load_ps(simd_kernel + i*4); x0 = _mm_add_ps(_mm_loadu_ps(sptr0 + x), _mm_loadu_ps(sptr1 + x)); x1 = _mm_add_ps(_mm_loadu_ps(sptr0 + x + 4), _mm_loadu_ps(sptr1 + x + 4)); s0 = _mm_add_ps(s0, _mm_mul_ps(x0, g4)); s1 = _mm_add_ps(s1, _mm_mul_ps(x1, g4)); x0 = _mm_add_ps(_mm_loadu_ps(sptr0 + x + 8), _mm_loadu_ps(sptr1 + x + 8)); x1 = _mm_add_ps(_mm_loadu_ps(sptr0 + x + 12), _mm_loadu_ps(sptr1 + x + 12)); s2 = _mm_add_ps(s2, _mm_mul_ps(x0, g4)); s3 = _mm_add_ps(s3, _mm_mul_ps(x1, g4)); } _mm_store_ps(vsum + x, s0); _mm_store_ps(vsum + x + 4, s1); _mm_store_ps(vsum + x + 8, s2); _mm_store_ps(vsum + x + 12, s3); } for( ; x <= width*5 - 4; x += 4 ) { const float *sptr0 = srow[m], *sptr1; __m128 g4 = _mm_load_ps(simd_kernel); __m128 s0 = _mm_mul_ps(_mm_loadu_ps(sptr0 + x), g4); for( i = 1; i <= m; i++ ) { sptr0 = srow[m+i], sptr1 = srow[m-i]; g4 = _mm_load_ps(simd_kernel + i*4); __m128 x0 = _mm_add_ps(_mm_loadu_ps(sptr0 + x), _mm_loadu_ps(sptr1 + x)); s0 = _mm_add_ps(s0, _mm_mul_ps(x0, g4)); } _mm_store_ps(vsum + x, s0); } } #endif for( ; x < width*5; x++ ) { float s0 = srow[m][x]*kernel[0]; for( i = 1; i <= m; i++ ) s0 += (srow[m+i][x] + srow[m-i][x])*kernel[i]; vsum[x] = s0; } // update borders for( x = 0; x < m*5; x++ ) { vsum[-1-x] = vsum[4-x]; vsum[width*5+x] = vsum[width*5+x-5]; } // horizontal blur x = 0; #if CV_SSE2 if( useSIMD ) { for( ; x <= width*5 - 8; x += 8 ) { __m128 g4 = _mm_load_ps(simd_kernel); __m128 s0 = _mm_mul_ps(_mm_loadu_ps(vsum + x), g4); __m128 s1 = _mm_mul_ps(_mm_loadu_ps(vsum + x + 4), g4); for( i = 1; i <= m; i++ ) { g4 = _mm_load_ps(simd_kernel + i*4); __m128 x0 = _mm_add_ps(_mm_loadu_ps(vsum + x - i*5), _mm_loadu_ps(vsum + x + i*5)); __m128 x1 = _mm_add_ps(_mm_loadu_ps(vsum + x - i*5 + 4), _mm_loadu_ps(vsum + x + i*5 + 4)); s0 = _mm_add_ps(s0, _mm_mul_ps(x0, g4)); s1 = _mm_add_ps(s1, _mm_mul_ps(x1, g4)); } _mm_store_ps(hsum + x, s0); _mm_store_ps(hsum + x + 4, s1); } } #endif for( ; x < width*5; x++ ) { float sum = vsum[x]*kernel[0]; for( i = 1; i <= m; i++ ) sum += kernel[i]*(vsum[x - i*5] + vsum[x + i*5]); hsum[x] = sum; } for( x = 0; x < width; x++ ) { g11 = hsum[x*5]; g12 = hsum[x*5+1]; g22 = hsum[x*5+2]; h1 = hsum[x*5+3]; h2 = hsum[x*5+4]; double idet = 1./(g11*g22 - g12*g12 + 1e-3); flow[x*2] = (float)((g11*h2-g12*h1)*idet); flow[x*2+1] = (float)((g22*h1-g12*h2)*idet); } y1 = y == height - 1 ? height : y - block_size; if( update_matrices && (y1 == height || y1 >= y0 + min_update_stripe) ) { FarnebackUpdateMatrices( _R0, _R1, _flow, matM, y0, y1 ); y0 = y1; } } } } void cv::calcOpticalFlowFarneback( InputArray _prev0, InputArray _next0, OutputArray _flow0, double pyr_scale, int levels, int winsize, int iterations, int poly_n, double poly_sigma, int flags ) { Mat prev0 = _prev0.getMat(), next0 = _next0.getMat(); const int min_size = 32; const Mat* img[2] = { &prev0, &next0 }; int i, k; double scale; Mat prevFlow, flow, fimg; CV_Assert( prev0.size() == next0.size() && prev0.channels() == next0.channels() && prev0.channels() == 1 && pyr_scale < 1 ); _flow0.create( prev0.size(), CV_32FC2 ); Mat flow0 = _flow0.getMat(); for( k = 0, scale = 1; k < levels; k++ ) { scale *= pyr_scale; if( prev0.cols*scale < min_size || prev0.rows*scale < min_size ) break; } levels = k; for( k = levels; k >= 0; k-- ) { for( i = 0, scale = 1; i < k; i++ ) scale *= pyr_scale; double sigma = (1./scale-1)*0.5; int smooth_sz = cvRound(sigma*5)|1; smooth_sz = std::max(smooth_sz, 3); int width = cvRound(prev0.cols*scale); int height = cvRound(prev0.rows*scale); if( k > 0 ) flow.create( height, width, CV_32FC2 ); else flow = flow0; if( !prevFlow.data ) { if( flags & OPTFLOW_USE_INITIAL_FLOW ) { resize( flow0, flow, Size(width, height), 0, 0, INTER_AREA ); flow *= scale; } else flow = Mat::zeros( height, width, CV_32FC2 ); } else { resize( prevFlow, flow, Size(width, height), 0, 0, INTER_LINEAR ); flow *= 1./pyr_scale; } Mat R[2], I, M; for( i = 0; i < 2; i++ ) { img[i]->convertTo(fimg, CV_32F); GaussianBlur(fimg, fimg, Size(smooth_sz, smooth_sz), sigma, sigma); resize( fimg, I, Size(width, height), CV_INTER_LINEAR ); FarnebackPolyExp( I, R[i], poly_n, poly_sigma ); } FarnebackUpdateMatrices( R[0], R[1], flow, M, 0, flow.rows ); for( i = 0; i < iterations; i++ ) { if( flags & OPTFLOW_FARNEBACK_GAUSSIAN ) FarnebackUpdateFlow_GaussianBlur( R[0], R[1], flow, M, winsize, i < iterations - 1 ); else FarnebackUpdateFlow_Blur( R[0], R[1], flow, M, winsize, i < iterations - 1 ); } prevFlow = flow; } } CV_IMPL void cvCalcOpticalFlowFarneback( const CvArr* _prev, const CvArr* _next, CvArr* _flow, double pyr_scale, int levels, int winsize, int iterations, int poly_n, double poly_sigma, int flags ) { cv::Mat prev = cv::cvarrToMat(_prev), next = cv::cvarrToMat(_next); cv::Mat flow = cv::cvarrToMat(_flow); CV_Assert( flow.size() == prev.size() && flow.type() == CV_32FC2 ); cv::calcOpticalFlowFarneback( prev, next, flow, pyr_scale, levels, winsize, iterations, poly_n, poly_sigma, flags ); }
74fbc4fb34faf5e16b4a3ba39d23abe79b4e44dc
6dccf26de3b8b9b874802c26bb3261ef64d2f450
/src/utils/config.hpp
cc9e821e4b6cb257d846e8e842e9816140e10da0
[ "BSD-2-Clause" ]
permissive
panjia1983/channel_backward
f8f97ca38f4159ae6a12e155030667468d2cc6ba
dc43f9c243ac44267b2196d740613d226c261162
refs/heads/master
2020-05-29T15:54:18.121542
2014-04-02T20:24:51
2014-04-02T20:24:51
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,717
hpp
#pragma once #include <vector> #include <string> #include <iostream> #include <boost/program_options.hpp> #include <boost/shared_ptr.hpp> #include "utils/stl_to_string.hpp" namespace po = boost::program_options; namespace util { struct ParameterBase { std::string m_name; std::string m_desc; ParameterBase(const std::string& name, const std::string& desc) : m_name(name), m_desc(desc) {} virtual void addToBoost(po::options_description&) = 0; virtual ~ParameterBase() {} }; typedef boost::shared_ptr<ParameterBase> ParameterBasePtr; template <typename T> struct ParameterVec : ParameterBase { std::vector<T>* m_value; ParameterVec(std::string name, std::vector<T>* value, std::string desc) : ParameterBase(name, desc), m_value(value) {} void addToBoost(po::options_description& od) { od.add_options()(m_name.c_str(), po::value(m_value)->default_value(*m_value, Str(*m_value))->multitoken(), m_desc.c_str()); } }; template <typename T> struct Parameter : ParameterBase { T* m_value; Parameter(std::string name, T* value, std::string desc) : ParameterBase(name, desc), m_value(value) {} void addToBoost(po::options_description& od) { od.add_options()(m_name.c_str(), po::value(m_value)->default_value(*m_value, Str(*m_value)), m_desc.c_str()); } }; struct Config { std::vector< ParameterBasePtr > params; void add(ParameterBase* param) {params.push_back(ParameterBasePtr(param));} }; struct CommandParser { std::vector<Config> configs; void addGroup(const Config& config) { configs.push_back(config); } CommandParser(const Config& config) { addGroup(config); } void read(int argc, char* argv[], bool allow_unregistered=false); }; }
[ "jia@rll6.(none)" ]
jia@rll6.(none)
e755fb9d639da02d117d68ce439f01740be9299b
60dd6073a3284e24092620e430fd05be3157f48e
/tiago_public_ws/devel/include/tf_lookup/TfStreamResult.h
1e64a8ec08b563cd30952a5232637bf66ef08839
[]
no_license
SakshayMahna/Programming-Robots-with-ROS
e94d4ec5973f76d49c81406f0de43795bb673c1e
203d97463d07722fbe73bdc007d930b2ae3905f1
refs/heads/master
2020-07-11T07:28:00.547774
2019-10-19T08:05:26
2019-10-19T08:05:26
204,474,383
0
0
null
null
null
null
UTF-8
C++
false
false
5,987
h
// Generated by gencpp from file tf_lookup/TfStreamResult.msg // DO NOT EDIT! #ifndef TF_LOOKUP_MESSAGE_TFSTREAMRESULT_H #define TF_LOOKUP_MESSAGE_TFSTREAMRESULT_H #include <string> #include <vector> #include <map> #include <ros/types.h> #include <ros/serialization.h> #include <ros/builtin_message_traits.h> #include <ros/message_operations.h> namespace tf_lookup { template <class ContainerAllocator> struct TfStreamResult_ { typedef TfStreamResult_<ContainerAllocator> Type; TfStreamResult_() : subscription_id() , topic() { } TfStreamResult_(const ContainerAllocator& _alloc) : subscription_id(_alloc) , topic(_alloc) { (void)_alloc; } typedef std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other > _subscription_id_type; _subscription_id_type subscription_id; typedef std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other > _topic_type; _topic_type topic; typedef boost::shared_ptr< ::tf_lookup::TfStreamResult_<ContainerAllocator> > Ptr; typedef boost::shared_ptr< ::tf_lookup::TfStreamResult_<ContainerAllocator> const> ConstPtr; }; // struct TfStreamResult_ typedef ::tf_lookup::TfStreamResult_<std::allocator<void> > TfStreamResult; typedef boost::shared_ptr< ::tf_lookup::TfStreamResult > TfStreamResultPtr; typedef boost::shared_ptr< ::tf_lookup::TfStreamResult const> TfStreamResultConstPtr; // constants requiring out of line definition template<typename ContainerAllocator> std::ostream& operator<<(std::ostream& s, const ::tf_lookup::TfStreamResult_<ContainerAllocator> & v) { ros::message_operations::Printer< ::tf_lookup::TfStreamResult_<ContainerAllocator> >::stream(s, "", v); return s; } } // namespace tf_lookup namespace ros { namespace message_traits { // BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': False} // {'std_msgs': ['/opt/ros/kinetic/share/std_msgs/cmake/../msg'], 'actionlib_msgs': ['/opt/ros/kinetic/share/actionlib_msgs/cmake/../msg'], 'geometry_msgs': ['/opt/ros/kinetic/share/geometry_msgs/cmake/../msg'], 'tf_lookup': ['/media/root/BuntuDrive/Programming-Robots-with-ROS/tiago_public_ws/devel/share/tf_lookup/msg', '/media/root/BuntuDrive/Programming-Robots-with-ROS/tiago_public_ws/src/tf_lookup/msg']} // !!!!!!!!!!! ['__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_parsed_fields', 'constants', 'fields', 'full_name', 'has_header', 'header_present', 'names', 'package', 'parsed_fields', 'short_name', 'text', 'types'] template <class ContainerAllocator> struct IsFixedSize< ::tf_lookup::TfStreamResult_<ContainerAllocator> > : FalseType { }; template <class ContainerAllocator> struct IsFixedSize< ::tf_lookup::TfStreamResult_<ContainerAllocator> const> : FalseType { }; template <class ContainerAllocator> struct IsMessage< ::tf_lookup::TfStreamResult_<ContainerAllocator> > : TrueType { }; template <class ContainerAllocator> struct IsMessage< ::tf_lookup::TfStreamResult_<ContainerAllocator> const> : TrueType { }; template <class ContainerAllocator> struct HasHeader< ::tf_lookup::TfStreamResult_<ContainerAllocator> > : FalseType { }; template <class ContainerAllocator> struct HasHeader< ::tf_lookup::TfStreamResult_<ContainerAllocator> const> : FalseType { }; template<class ContainerAllocator> struct MD5Sum< ::tf_lookup::TfStreamResult_<ContainerAllocator> > { static const char* value() { return "a8f3e325856c12da00435a78bf464739"; } static const char* value(const ::tf_lookup::TfStreamResult_<ContainerAllocator>&) { return value(); } static const uint64_t static_value1 = 0xa8f3e325856c12daULL; static const uint64_t static_value2 = 0x00435a78bf464739ULL; }; template<class ContainerAllocator> struct DataType< ::tf_lookup::TfStreamResult_<ContainerAllocator> > { static const char* value() { return "tf_lookup/TfStreamResult"; } static const char* value(const ::tf_lookup::TfStreamResult_<ContainerAllocator>&) { return value(); } }; template<class ContainerAllocator> struct Definition< ::tf_lookup::TfStreamResult_<ContainerAllocator> > { static const char* value() { return "# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======\n\ # Define the result\n\ string subscription_id\n\ string topic\n\ "; } static const char* value(const ::tf_lookup::TfStreamResult_<ContainerAllocator>&) { return value(); } }; } // namespace message_traits } // namespace ros namespace ros { namespace serialization { template<class ContainerAllocator> struct Serializer< ::tf_lookup::TfStreamResult_<ContainerAllocator> > { template<typename Stream, typename T> inline static void allInOne(Stream& stream, T m) { stream.next(m.subscription_id); stream.next(m.topic); } ROS_DECLARE_ALLINONE_SERIALIZER }; // struct TfStreamResult_ } // namespace serialization } // namespace ros namespace ros { namespace message_operations { template<class ContainerAllocator> struct Printer< ::tf_lookup::TfStreamResult_<ContainerAllocator> > { template<typename Stream> static void stream(Stream& s, const std::string& indent, const ::tf_lookup::TfStreamResult_<ContainerAllocator>& v) { s << indent << "subscription_id: "; Printer<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other > >::stream(s, indent + " ", v.subscription_id); s << indent << "topic: "; Printer<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other > >::stream(s, indent + " ", v.topic); } }; } // namespace message_operations } // namespace ros #endif // TF_LOOKUP_MESSAGE_TFSTREAMRESULT_H
02f6a9603123b3f8fa2b83e2a49641782f05cbd9
793c8848753f530aab28076a4077deac815af5ac
/src/dskphone/ui/t48/settingui/src/cdlganywherelocationlist.h
96bf85deafb5e5733c4428963ced5fb5aa107c92
[]
no_license
Parantido/sipphone
4c1b9b18a7a6e478514fe0aadb79335e734bc016
f402efb088bb42900867608cc9ccf15d9b946d7d
refs/heads/master
2021-09-10T20:12:36.553640
2018-03-30T12:44:13
2018-03-30T12:44:13
263,628,242
1
0
null
2020-05-13T12:49:19
2020-05-13T12:49:18
null
UTF-8
C++
false
false
2,430
h
#ifndef CDLGANYWHERELOCATIONLIST_H #define CDLGANYWHERELOCATIONLIST_H #include "broadsoft/bwcallcontrol/include/modbwcallcontrol.h" #include "broadsoft/anywhere/include/anywherecommon.h" #include "cdlgbasesubpage.h" class CDlgAnyWhereLocationList : public CDlgBaseSubPage { Q_OBJECT public: explicit CDlgAnyWhereLocationList(QWidget * parent = 0); ~CDlgAnyWhereLocationList(); static CBaseDialog * CreateInstance() { return new CDlgAnyWhereLocationList(); } public: //清除所有item void ClearPageData(); //设置页面内容 void SetLocationList(SAYWLocationArray & objList); //获取制定列的数据 bool getLocationData(SAYWLocation & propSet, int idx) const; //获取当前选中项的数据 bool GetSelectedLocationData(SAYWLocation & propSet) const; //删除制定号码的location void RemoveLocationItem(const yl::string & strPhoneNum); //////////基类纯虚函数 该界面未用/////////////// virtual bool LoadPageData(); virtual bool IsStatusChanged(); //////////////////////////////////////////////// //从V层读取当前界面的配置,通过C层保存 virtual bool SavePageData(); virtual void InitData(); // 设置小窗口数据 virtual void SetData(void * pData = NULL); //事件过滤器 virtual bool eventFilter(QObject * pObject, QEvent * pEvent); // 设置页面的SoftKey virtual bool GetSoftkeyData(CArraySoftKeyBarData & objWndData); // 设置子页面前的操作 virtual void BeforeSetSubPage(void * pData); // 窗口初始化完成后,需要额外的操作,比如一些阻塞或同步的动作 virtual void ExtraDialogInitData(); virtual void OnCustomBack(); // 用于自定义退出界面操作(只回退一个界面) virtual void ProcessMsgBoxCallBack(CMessageBoxBase * pMessageBox); protected: virtual void showEvent(QShowEvent * e); private: void OnEditAnyWhere(); //void OnDeleteAnyWhere(); void OnDeleteAllAnyWhere(); private: //设置数据 void SetListData(std::vector<SAYWLocation> & orderVector); virtual bool OnAction(const QString & strAction); private: QVector<QLabel *> m_vecLabel; std::vector<bool> m_vecbActiveChanged; std::vector<SAYWLocation> m_DataList; //当前账号ID int m_nAccountID; }; #endif // CDLGANYWHERELOCATIONLIST_H
0d62340d77eafb254c161e4653ab3b278c149a5a
79f3c7f0faa4685715b8fdc13b8dda7cf915e8d1
/STM32F1xx_CPP_FW - CPF - NewI2C_1.7 - NewQ/App/Src/main.cpp
02951ff1bb42a212f94f8c9304bac69732275145
[]
no_license
amitandgithub/STM32F1xx_CPP_FW
fc155c2f0772b1b282388b6c2e2d24ebe8daf946
b61816696109cb48d0eb4a0a0b9b1232881ea5c3
refs/heads/master
2023-02-11T16:55:30.247303
2020-12-26T16:56:47
2020-12-26T16:56:47
178,715,062
0
1
null
null
null
null
WINDOWS-1252
C++
false
false
7,923
cpp
/* Includes */ #include <stddef.h> #include <stdio.h> #include"Test.h" #define NEW_BOARD 1 #include "printf.h" //#include "System.h" void SystemClock_Config(void); void SystemClock_Config_LL(void); //static void LL_Init(void); void putc ( void* p, char c); //Micros = Millis*1000 + 1000 – SysTick->VAL/72 //if you are free to use 32 bit timer you can even do it without IRQ, just simply time= TIMx->CNT. uint32_t count; struct s { int i; unsigned u; char end[]; }; int main(void) { /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* Configure the system clock */ SystemClock_Config(); DWT->CTRL |= 1 ; // enable the counter while(1) { //BMP280_Test(); //I2c_Tests_AT24C128(); I2c_Slave_Tests(); // I2c_Full_EEPROM_POLL(); // ssd1306_test(); } } //void putc ( void* p, char c) //{ // //} /** * @brief System Clock Configuration * @retval None */ #if NEW_BOARD void SystemClock_Config(void) { RCC_OscInitTypeDef RCC_OscInitStruct; RCC_ClkInitTypeDef RCC_ClkInitStruct; /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV2; RCC_OscInitStruct.HSIState = RCC_HSI_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9; if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { //_Error_Handler(__FILE__, __LINE__); } /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) { //_Error_Handler(__FILE__, __LINE__); } /**Configure the Systick interrupt time */ HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000); /**Configure the Systick */ HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK); /* SysTick_IRQn interrupt configuration */ HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0); } #else void SystemClock_Config(void) { RCC_OscInitTypeDef RCC_OscInitStruct; RCC_ClkInitTypeDef RCC_ClkInitStruct; RCC_PeriphCLKInitTypeDef PeriphClkInit; /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1; RCC_OscInitStruct.HSIState = RCC_HSI_ON; RCC_OscInitStruct.LSIState = RCC_LSI_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9; if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { //_Error_Handler((char*)__FILE__, __LINE__); } /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) { //_Error_Handler((char*)__FILE__, __LINE__); } PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_RTC; PeriphClkInit.RTCClockSelection = RCC_RTCCLKSOURCE_LSI; if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) { //_Error_Handler((char*)__FILE__, __LINE__); } /**Configure the Systick interrupt time */ HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000); /**Configure the Systick */ HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK); /* SysTick_IRQn interrupt configuration */ HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0); } #endif #ifdef __cplusplus extern "C" { #endif void _Error_Handler(char *, int); #define Error_Handler() _Error_Handler(__FILE__, __LINE__) #ifdef __cplusplus } #endif //static void LL_Init(void) //{ // // LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_AFIO); // LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR); // // NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4); // // /* System interrupt init*/ // /* MemoryManagement_IRQn interrupt configuration */ // NVIC_SetPriority(MemoryManagement_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); // /* BusFault_IRQn interrupt configuration */ // NVIC_SetPriority(BusFault_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); // /* UsageFault_IRQn interrupt configuration */ // NVIC_SetPriority(UsageFault_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); // /* SVCall_IRQn interrupt configuration */ // NVIC_SetPriority(SVCall_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); // /* DebugMonitor_IRQn interrupt configuration */ // NVIC_SetPriority(DebugMonitor_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); // /* PendSV_IRQn interrupt configuration */ // NVIC_SetPriority(PendSV_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); // /* SysTick_IRQn interrupt configuration */ // NVIC_SetPriority(SysTick_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); // // /**NOJTAG: JTAG-DP Disabled and SW-DP Enabled // */ // LL_GPIO_AF_Remap_SWJ_NOJTAG(); // //} /** * @brief System Clock Configuration * @retval None */ void SystemClock_Config_LL(void) { LL_FLASH_SetLatency(LL_FLASH_LATENCY_2); if(LL_FLASH_GetLatency() != LL_FLASH_LATENCY_2) { //Error_Handler(); } LL_RCC_HSE_Enable(); /* Wait till HSE is ready */ while(LL_RCC_HSE_IsReady() != 1) { } LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSE_DIV_1, LL_RCC_PLL_MUL_9); LL_RCC_PLL_Enable(); /* Wait till PLL is ready */ while(LL_RCC_PLL_IsReady() != 1) { } LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1); LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_2); LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_1); LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL); /* Wait till System clock is ready */ while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL) { } LL_Init1msTick(72000000); LL_SYSTICK_SetClkSource(LL_SYSTICK_CLKSOURCE_HCLK); LL_SetSystemCoreClock(72000000); /* SysTick_IRQn interrupt configuration */ NVIC_SetPriority(SysTick_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0)); } /** * @brief This function is executed in case of error occurrence. * @param file: The file name as string. * @param line: The line in file as a number. * @retval None */ void _Error_Handler(char *file, int line) { /* USER CODE BEGIN Error_Handler_Debug */ /* User can add his own implementation to report the HAL error return state */ while(1) { } /* USER CODE END Error_Handler_Debug */ } #ifdef USE_FULL_ASSERT /** * @brief Reports the name of the source file and the source line number * where the assert_param error has occurred. * @param file: pointer to the source file name * @param line: assert_param error line source number * @retval None */ void assert_failed(uint8_t* file, uint32_t line) { /* USER CODE BEGIN 6 */ /* User can add his own implementation to report the file name and line number, tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ /* USER CODE END 6 */ } #endif /* USE_FULL_ASSERT */
127345c3ec9580ffab7ad7a4f6c42db3bfca1e8f
b8329e2790f754dfebd75c1b1bd6756ed74dd063
/avr/ami-arduino-cmake/sketches/esp8266-wind-speed/wind_speed.cpp
00cdd196ce19f8e5c5c08c31c85a94b8454d6cad
[]
no_license
amitesh-singh/amiduino
ebb7909fe354e29349e53258c51e5d99e5b24bef
32a4fcb4cd1c7237c4a7f409b2248875f947e77c
refs/heads/master
2023-08-22T17:57:49.041914
2023-08-20T15:33:58
2023-08-20T15:33:58
47,932,022
6
1
null
null
null
null
UTF-8
C++
false
false
3,600
cpp
#include <LiquidCrystal.h> #include "Arduino.h" LiquidCrystal lcd(2, 3, 4, 5, 6, 7); int errorLED = 11; //Using 123dcircuit circuit till i fix my esp01 adapter //TODO: test it on real hardware // http://api.openweathermap.org/data/2.5/weather?q=NewDelhi&&appid=1a702a15a2f46e405e61804cf67c0d30&units=metric String ssid = "Simulator Wifi"; // SSID to connect to String password = ""; // Our virtual wifi has no password (so dont do your banking stuff on this network) String host = "api.openweathermap.org"; // Open Weather Map API const int httpPort = 80; String uri = "/data/2.5/weather?q=NewDelhi&appid=1a702a15a2f46e405e61804cf67c0d30&units=metric"; // the setup routine runs once when you press reset: void setup() { // Setup LCD and put some information text on there lcd.begin(16,2); lcd.print("WindSpeedDelhi:"); lcd.setCursor(0,1); lcd.print("S: "); pinMode(errorLED, OUTPUT); // init our red error LED // Start our ESP8266 Serial Communication Serial.begin(115200); // Serial connection over USB to computer Serial.println("AT"); // Serial connection on Tx / Rx port to ESP8266 delay(10); // Wait a little for the ESP to respond if (!Serial.find("OK")) digitalWrite(errorLED, HIGH); // check if the ESP is running well // Connect to 123D Circuits Simulator Wifi Serial.println("AT+CWJAP=\"" + ssid + "\",\"" + password + "\""); delay(10); // Wait a little for the ESP to respond if (!Serial.find("OK")) digitalWrite(errorLED, HIGH); // check if the ESP is running well // Open TCP connection to the host: Serial.println("AT+CIPSTART=\"TCP\",\"" + host + "\"," + httpPort); delay(50); // Wait a little for the ESP to respond if (!Serial.find("OK")) digitalWrite(errorLED, HIGH); // check if the ESP is running well } // the loop routine runs over and over again forever: void loop() { // Construct our HTTP call String httpPacket = "GET " + uri + " HTTP/1.1\r\nHost: " + host + "\r\n\r\n"; int length = httpPacket.length(); // Send our message length Serial.print("AT+CIPSEND="); Serial.println(length); delay(10); // Wait a little for the ESP to respond if (!Serial.find(">")) digitalWrite(errorLED, HIGH); // check if the ESP is running well // Send our http request Serial.print(httpPacket); delay(10); // Wait a little for the ESP to respond if (!Serial.find("SEND OK\r\n")) digitalWrite(errorLED, HIGH); // check if the ESP is running well while(!Serial.available()) delay(5); // wait until we receive the response from the server if (Serial.find("\r\n\r\n")){ // search for a blank line which defines the end of the http header delay(5); unsigned int i = 0; //timeout counter String outputString = ""; while (!Serial.find("\"speed\":")){} // find the part we are interested in. while (i<60000) { // 1 minute timeout checker if(Serial.available()) { char c = Serial.read(); if(c==',') break; // break out of our loop because we got all we need outputString += c; // append to our output string i=0; // reset our timeout counter } i++; } lcd.setCursor(3,1); // set our LCD cursor to the correct position outputString += " Km/s "; lcd.print(outputString); // push our output string to the LCD } delay(10000); // wait 10 seconds before updating lcd.setCursor(3,1); lcd.print("Trying again..."); delay(2000); }
62fd2cefd2fd7086c6d7bf866d03f059659e63f4
79abf633d306bdc858a8f08292edc124285dd8a1
/src/qt/guiutil.cpp
a612cc89d7c5b766a0c22c059a87ea9e81d55e33
[ "MIT" ]
permissive
bumbacoin/KETOsis
59b73248fbda0850b02fd464d4d1d53fada634ba
e70fdf822c9ae7ecdc29d735ade9503692daf122
refs/heads/master
2020-04-18T02:05:24.466538
2019-01-29T06:22:00
2019-01-29T06:22:00
167,146,882
1
0
null
2019-01-23T08:33:59
2019-01-23T08:33:59
null
UTF-8
C++
false
false
16,487
cpp
#include <QApplication> #include "guiutil.h" #include "bitcoinaddressvalidator.h" #include "walletmodel.h" #include "bitcoinunits.h" #include "util.h" #include "init.h" #include <QDateTime> #include <QDoubleValidator> #include <QFont> #include <QLineEdit> #include <QUrl> #include <QTextDocument> // For Qt::escape #include <QAbstractItemView> #include <QClipboard> #include <QFileDialog> #include <QDesktopServices> #include <QThread> #include <boost/filesystem.hpp> #include <boost/filesystem/fstream.hpp> #ifdef WIN32 #ifdef _WIN32_WINNT #undef _WIN32_WINNT #endif #define _WIN32_WINNT 0x0501 #ifdef _WIN32_IE #undef _WIN32_IE #endif #define _WIN32_IE 0x0501 #define WIN32_LEAN_AND_MEAN 1 #ifndef NOMINMAX #define NOMINMAX #endif #include "shlwapi.h" #include "shlobj.h" #include "shellapi.h" #endif namespace GUIUtil { QString dateTimeStr(const QDateTime &date) { return date.date().toString(Qt::SystemLocaleShortDate) + QString(" ") + date.toString("hh:mm"); } QString dateTimeStr(qint64 nTime) { return dateTimeStr(QDateTime::fromTime_t((qint32)nTime)); } QFont bitcoinAddressFont() { QFont font("Monospace"); #if QT_VERSION >= 0x040800 font.setStyleHint(QFont::Monospace); #else font.setStyleHint(QFont::TypeWriter); #endif return font; } void setupAddressWidget(QLineEdit *widget, QWidget *parent) { widget->setMaxLength(BitcoinAddressValidator::MaxAddressLength); widget->setValidator(new BitcoinAddressValidator(parent)); widget->setFont(bitcoinAddressFont()); } void setupAmountWidget(QLineEdit *widget, QWidget *parent) { QDoubleValidator *amountValidator = new QDoubleValidator(parent); amountValidator->setDecimals(8); amountValidator->setBottom(0.0); widget->setValidator(amountValidator); widget->setAlignment(Qt::AlignRight|Qt::AlignVCenter); } bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out) { // NovaCoin: check prefix if(uri.scheme() != QString("KETOsis")) return false; SendCoinsRecipient rv; rv.address = uri.path(); rv.amount = 0; QList<QPair<QString, QString> > items = uri.queryItems(); for (QList<QPair<QString, QString> >::iterator i = items.begin(); i != items.end(); i++) { bool fShouldReturnFalse = false; if (i->first.startsWith("req-")) { i->first.remove(0, 4); fShouldReturnFalse = true; } if (i->first == "label") { rv.label = i->second; fShouldReturnFalse = false; } else if (i->first == "amount") { if(!i->second.isEmpty()) { if(!BitcoinUnits::parse(BitcoinUnits::BTC, i->second, &rv.amount)) { return false; } } fShouldReturnFalse = false; } if (fShouldReturnFalse) return false; } if(out) { *out = rv; } return true; } bool parseBitcoinURI(QString uri, SendCoinsRecipient *out) { // Convert KETOsis:// to KETOsis: // // Cannot handle this later, because bitcoin:// will cause Qt to see the part after // as host, // which will lower-case it (and thus invalidate the address). if(uri.startsWith("KETOsis://")) { uri.replace(0, 12, "KETOsis:"); } QUrl uriInstance(uri); return parseBitcoinURI(uriInstance, out); } QString HtmlEscape(const QString& str, bool fMultiLine) { QString escaped = Qt::escape(str); if(fMultiLine) { escaped = escaped.replace("\n", "<br>\n"); } return escaped; } QString HtmlEscape(const std::string& str, bool fMultiLine) { return HtmlEscape(QString::fromStdString(str), fMultiLine); } void copyEntryData(QAbstractItemView *view, int column, int role) { if(!view || !view->selectionModel()) return; QModelIndexList selection = view->selectionModel()->selectedRows(column); if(!selection.isEmpty()) { // Copy first item QApplication::clipboard()->setText(selection.at(0).data(role).toString()); } } QString getSaveFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedSuffixOut) { QString selectedFilter; QString myDir; if(dir.isEmpty()) // Default to user documents location { myDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation); } else { myDir = dir; } QString result = QFileDialog::getSaveFileName(parent, caption, myDir, filter, &selectedFilter); /* Extract first suffix from filter pattern "Description (*.foo)" or "Description (*.foo *.bar ...) */ QRegExp filter_re(".* \\(\\*\\.(.*)[ \\)]"); QString selectedSuffix; if(filter_re.exactMatch(selectedFilter)) { selectedSuffix = filter_re.cap(1); } /* Add suffix if needed */ QFileInfo info(result); if(!result.isEmpty()) { if(info.suffix().isEmpty() && !selectedSuffix.isEmpty()) { /* No suffix specified, add selected suffix */ if(!result.endsWith(".")) result.append("."); result.append(selectedSuffix); } } /* Return selected suffix if asked to */ if(selectedSuffixOut) { *selectedSuffixOut = selectedSuffix; } return result; } Qt::ConnectionType blockingGUIThreadConnection() { if(QThread::currentThread() != QCoreApplication::instance()->thread()) { return Qt::BlockingQueuedConnection; } else { return Qt::DirectConnection; } } bool checkPoint(const QPoint &p, const QWidget *w) { QWidget *atW = qApp->widgetAt(w->mapToGlobal(p)); if (!atW) return false; return atW->topLevelWidget() == w; } bool isObscured(QWidget *w) { return !(checkPoint(QPoint(0, 0), w) && checkPoint(QPoint(w->width() - 1, 0), w) && checkPoint(QPoint(0, w->height() - 1), w) && checkPoint(QPoint(w->width() - 1, w->height() - 1), w) && checkPoint(QPoint(w->width() / 2, w->height() / 2), w)); } void openDebugLogfile() { boost::filesystem::path pathDebug = GetDataDir() / "debug.log"; /* Open debug.log with the associated application */ if (boost::filesystem::exists(pathDebug)) QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromStdString(pathDebug.string()))); } ToolTipToRichTextFilter::ToolTipToRichTextFilter(int size_threshold, QObject *parent) : QObject(parent), size_threshold(size_threshold) { } bool ToolTipToRichTextFilter::eventFilter(QObject *obj, QEvent *evt) { if(evt->type() == QEvent::ToolTipChange) { QWidget *widget = static_cast<QWidget*>(obj); QString tooltip = widget->toolTip(); if(tooltip.size() > size_threshold && !tooltip.startsWith("<qt>") && !Qt::mightBeRichText(tooltip)) { // Prefix <qt/> to make sure Qt detects this as rich text // Escape the current message as HTML and replace \n by <br> tooltip = "<qt>" + HtmlEscape(tooltip, true) + "<qt/>"; widget->setToolTip(tooltip); return true; } } return QObject::eventFilter(obj, evt); } #ifdef WIN32 boost::filesystem::path static StartupShortcutPath() { return GetSpecialFolderPath(CSIDL_STARTUP) / "KETOsis.lnk"; } bool GetStartOnSystemStartup() { // check for Bitcoin.lnk return boost::filesystem::exists(StartupShortcutPath()); } bool SetStartOnSystemStartup(bool fAutoStart) { // If the shortcut exists already, remove it for updating boost::filesystem::remove(StartupShortcutPath()); if (fAutoStart) { CoInitialize(NULL); // Get a pointer to the IShellLink interface. IShellLink* psl = NULL; HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, reinterpret_cast<void**>(&psl)); if (SUCCEEDED(hres)) { // Get the current executable path TCHAR pszExePath[MAX_PATH]; GetModuleFileName(NULL, pszExePath, sizeof(pszExePath)); TCHAR pszArgs[5] = TEXT("-min"); // Set the path to the shortcut target psl->SetPath(pszExePath); PathRemoveFileSpec(pszExePath); psl->SetWorkingDirectory(pszExePath); psl->SetShowCmd(SW_SHOWMINNOACTIVE); psl->SetArguments(pszArgs); // Query IShellLink for the IPersistFile interface for // saving the shortcut in persistent storage. IPersistFile* ppf = NULL; hres = psl->QueryInterface(IID_IPersistFile, reinterpret_cast<void**>(&ppf)); if (SUCCEEDED(hres)) { WCHAR pwsz[MAX_PATH]; // Ensure that the string is ANSI. MultiByteToWideChar(CP_ACP, 0, StartupShortcutPath().string().c_str(), -1, pwsz, MAX_PATH); // Save the link by calling IPersistFile::Save. hres = ppf->Save(pwsz, TRUE); ppf->Release(); psl->Release(); CoUninitialize(); return true; } psl->Release(); } CoUninitialize(); return false; } return true; } #elif defined(Q_OS_LINUX) // Follow the Desktop Application Autostart Spec: // http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html boost::filesystem::path static GetAutostartDir() { namespace fs = boost::filesystem; char* pszConfigHome = getenv("XDG_CONFIG_HOME"); if (pszConfigHome) return fs::path(pszConfigHome) / "autostart"; char* pszHome = getenv("HOME"); if (pszHome) return fs::path(pszHome) / ".config" / "autostart"; return fs::path(); } boost::filesystem::path static GetAutostartFilePath() { return GetAutostartDir() / "KETOsis.desktop"; } bool GetStartOnSystemStartup() { boost::filesystem::ifstream optionFile(GetAutostartFilePath()); if (!optionFile.good()) return false; // Scan through file for "Hidden=true": std::string line; while (!optionFile.eof()) { getline(optionFile, line); if (line.find("Hidden") != std::string::npos && line.find("true") != std::string::npos) return false; } optionFile.close(); return true; } bool SetStartOnSystemStartup(bool fAutoStart) { if (!fAutoStart) boost::filesystem::remove(GetAutostartFilePath()); else { char pszExePath[MAX_PATH+1]; memset(pszExePath, 0, sizeof(pszExePath)); if (readlink("/proc/self/exe", pszExePath, sizeof(pszExePath)-1) == -1) return false; boost::filesystem::create_directories(GetAutostartDir()); boost::filesystem::ofstream optionFile(GetAutostartFilePath(), std::ios_base::out|std::ios_base::trunc); if (!optionFile.good()) return false; // Write a bitcoin.desktop file to the autostart directory: optionFile << "[Desktop Entry]\n"; optionFile << "Type=Application\n"; optionFile << "Name=KETOsis\n"; optionFile << "Exec=" << pszExePath << " -min\n"; optionFile << "Terminal=false\n"; optionFile << "Hidden=false\n"; optionFile.close(); } return true; } #else // TODO: OSX startup stuff; see: // https://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPSystemStartup/Articles/CustomLogin.html bool GetStartOnSystemStartup() { return false; } bool SetStartOnSystemStartup(bool fAutoStart) { return false; } #endif HelpMessageBox::HelpMessageBox(QWidget *parent) : QMessageBox(parent) { header = tr("KETOsis-Qt") + " " + tr("version") + " " + QString::fromStdString(FormatFullVersion()) + "\n\n" + tr("Usage:") + "\n" + " KETOsis-qt [" + tr("command-line options") + "] " + "\n"; coreOptions = QString::fromStdString(HelpMessage()); uiOptions = tr("UI options") + ":\n" + " -lang=<lang> " + tr("Set language, for example \"de_DE\" (default: system locale)") + "\n" + " -min " + tr("Start minimized") + "\n" + " -splash " + tr("Show splash screen on startup (default: 1)") + "\n"; setWindowTitle(tr("KETOsis-Qt")); setTextFormat(Qt::PlainText); // setMinimumWidth is ignored for QMessageBox so put in non-breaking spaces to make it wider. setText(header + QString(QChar(0x2003)).repeated(50)); setDetailedText(coreOptions + "\n" + uiOptions); } void HelpMessageBox::printToConsole() { // On other operating systems, the expected action is to print the message to the console. QString strUsage = header + "\n" + coreOptions + "\n" + uiOptions; fprintf(stdout, "%s", strUsage.toStdString().c_str()); } void HelpMessageBox::showOrPrint() { #if defined(WIN32) // On Windows, show a message box, as there is no stderr/stdout in windowed applications exec(); #else // On other operating systems, print help text to console printToConsole(); #endif } void SetBlackThemeQSS(QApplication& app) { app.setStyleSheet("QWidget { background: rgb(41,44,48); }" "QFrame { border: none; }" "QComboBox { color: rgb(255,255,255); }" "QComboBox QAbstractItemView::item { color: rgb(255,255,255); }" "QPushButton { background: rgb(68,81,98); color: rgb(222,222,222); }" "QDoubleSpinBox { background: rgb(63,67,72); color: rgb(255,255,255); border-color: rgb(194,194,194); }" "QLineEdit { background: rgb(63,67,72); color: rgb(255,255,255); border-color: rgb(194,194,194); }" "QTextEdit { background: rgb(63,67,72); color: rgb(255,255,255); }" "QPlainTextEdit { background: rgb(63,67,72); color: rgb(255,255,255); }" "QMenuBar { background: rgb(41,44,48); color: rgb(110,116,126); }" "QMenu { background: rgb(30,32,36); color: rgb(222,222,222); }" "QMenuBar::item { background-color: rgb(68,81,98); color: rgb(222,222,222);}" "QMenu::item:selected { background-color: rgb(135,146,160); }" "QMenuBar::item:selected { background-color: rgb(41,44,48); }" "QLabel { color: rgb(120,127,139); }" "QScrollBar { color: rgb(255,255,255); }" "QCheckBox { color: rgb(120,127,139); }" "QRadioButton { color: rgb(120,127,139); }" "QTabBar::tab { color: rgb(120,127,139); border: 1px solid rgb(78,79,83); border-bottom: none; padding: 5px; }" "QTabBar::tab:selected { background: rgb(41,44,48); }" "QTabBar::tab:!selected { background: rgb(24,26,30); margin-top: 2px; }" "QTabWidget::pane { border: 1px solid rgb(78,79,83); }" "QToolButton { background: rgb(30,32,36); color: rgb(116,122,134); border: none; border-left-color: rgb(30,32,36); border-left-style: solid; border-left-width: 6px; margin-top: 8px; margin-bottom: 8px; }" "QToolButton:checked { color: rgb(255,255,255); border: none; border-left-color: rgb(28,135,200); border-left-style: solid; border-left-width: 6px; }" "QProgressBar { color: rgb(149,148,148); border-color: rgb(255,255,255); border-width: 1px; border-style: solid; }" "QProgressBar::chunk { background: rgb(255,255,255); }" "QTreeView::item { background: rgb(41,44,48); color: rgb(212,213,213); }" "QTreeView::item:selected { background-color: rgb(59,124,220); }" "QTableView { background: rgb(66,71,78); color: rgb(212,213,213); gridline-color: rgb(157,160,165); }" "QHeaderView::section { background: rgb(29,34,39); color: rgb(255,255,255); }" "QToolBar { background: rgb(30,32,36); border: none; }"); } } // namespace GUIUtil
270d979427db292f020fba897155f9bf9b7f7cab
51cced907524ee0039cd0b129178caf939e56912
/media/libeffects/downmix/tests/downmixtest.cpp
71f83e5ce7e5757531a4a02a460b8f413cb6a9b4
[ "LicenseRef-scancode-unicode", "Apache-2.0" ]
permissive
crdroidandroid/android_frameworks_av
ea109b991a177220dbc597a43df01e919112f545
9f6a26f1e4cb02c6504d670f292a9b88ec6a7106
refs/heads/10.0
2023-08-31T06:58:55.034080
2022-01-23T08:25:07
2022-01-23T08:25:07
277,145,615
8
80
NOASSERTION
2023-09-13T07:10:14
2020-07-04T16:22:52
C++
UTF-8
C++
false
false
10,283
cpp
/* * Copyright (C) 2011 The Android Open Source Project * * 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 <inttypes.h> #include <stdlib.h> #include <string.h> #include <vector> #include <audio_effects/effect_downmix.h> #include <audio_utils/channels.h> #include <audio_utils/primitives.h> #include <log/log.h> #include <system/audio.h> #include "EffectDownmix.h" #define FRAME_LENGTH 256 #define MAX_NUM_CHANNELS 8 struct downmix_cntxt_s { effect_descriptor_t desc; effect_handle_t handle; effect_config_t config; int numFileChannels; int numProcessChannels; }; extern audio_effect_library_t AUDIO_EFFECT_LIBRARY_INFO_SYM; void printUsage() { printf("\nUsage:"); printf("\n downmixtest <input_file> <out_file> [options]\n"); printf("\nwhere,"); printf("\n <input_file> is the input file name"); printf("\n on which LVM effects are applied"); printf("\n <output_file> processed output file"); printf("\n and options are mentioned below"); printf("\n"); printf("\n -h"); printf("\n Prints this usage information"); printf("\n"); printf("\n -ch_fmt:<format_of_input_audio>"); printf("\n 0:AUDIO_CHANNEL_OUT_7POINT1(default)"); printf("\n 1:AUDIO_CHANNEL_OUT_5POINT1_SIDE"); printf("\n 2:AUDIO_CHANNEL_OUT_5POINT1_BACK"); printf("\n 3:AUDIO_CHANNEL_OUT_QUAD_SIDE"); printf("\n 4:AUDIO_CHANNEL_OUT_QUAD_BACK"); printf("\n"); printf("\n -fch:<file_channels> (1 through 8)"); printf("\n"); } int32_t DownmixDefaultConfig(effect_config_t *pConfig) { pConfig->inputCfg.accessMode = EFFECT_BUFFER_ACCESS_READ; pConfig->inputCfg.format = AUDIO_FORMAT_PCM_FLOAT; pConfig->inputCfg.channels = AUDIO_CHANNEL_OUT_7POINT1; pConfig->inputCfg.bufferProvider.getBuffer = nullptr; pConfig->inputCfg.bufferProvider.releaseBuffer = nullptr; pConfig->inputCfg.bufferProvider.cookie = nullptr; pConfig->inputCfg.mask = EFFECT_CONFIG_ALL; pConfig->inputCfg.samplingRate = 44100; pConfig->outputCfg.samplingRate = pConfig->inputCfg.samplingRate; // set a default value for the access mode, but should be overwritten by caller pConfig->outputCfg.accessMode = EFFECT_BUFFER_ACCESS_WRITE; pConfig->outputCfg.format = AUDIO_FORMAT_PCM_FLOAT; pConfig->outputCfg.channels = AUDIO_CHANNEL_OUT_STEREO; pConfig->outputCfg.bufferProvider.getBuffer = nullptr; pConfig->outputCfg.bufferProvider.releaseBuffer = nullptr; pConfig->outputCfg.bufferProvider.cookie = nullptr; pConfig->outputCfg.mask = EFFECT_CONFIG_ALL; return 0; } int32_t DownmixConfiureAndEnable(downmix_cntxt_s *pDescriptor) { effect_handle_t *effectHandle = &pDescriptor->handle; downmix_module_t *downmixEffectHandle = (downmix_module_t *)*effectHandle; const struct effect_interface_s *Downmix_api = downmixEffectHandle->itfe; int32_t err = 0; uint32_t replySize = (uint32_t)sizeof(err); err = (Downmix_api->command)(*effectHandle, EFFECT_CMD_SET_CONFIG, sizeof(effect_config_t), &(pDescriptor->config), &replySize, &err); if (err != 0) { ALOGE("Downmix command to configure returned an error %d", err); return err; } err = ((Downmix_api->command))(*effectHandle, EFFECT_CMD_ENABLE, 0, nullptr, &replySize, &err); if (err != 0) { ALOGE("Downmix command to enable effect returned an error %d", err); return err; } return 0; } int32_t DownmixExecute(downmix_cntxt_s *pDescriptor, FILE *finp, FILE *fout) { effect_handle_t *effectHandle = &pDescriptor->handle; downmix_module_t *downmixEffectHandle = (downmix_module_t *)*effectHandle; const struct effect_interface_s *Downmix_api = downmixEffectHandle->itfe; const int numFileChannels = pDescriptor->numFileChannels; const int numProcessChannels = pDescriptor->numProcessChannels; const int fileFrameSize = numFileChannels * sizeof(short); const unsigned int outputChannels = audio_channel_count_from_out_mask(AUDIO_CHANNEL_OUT_STEREO); std::vector<float> outFloat(FRAME_LENGTH * MAX_NUM_CHANNELS); std::vector<float> inFloat(FRAME_LENGTH * MAX_NUM_CHANNELS); audio_buffer_t inbuffer, outbuffer; inbuffer.f32 = inFloat.data(); outbuffer.f32 = outFloat.data(); inbuffer.frameCount = FRAME_LENGTH; outbuffer.frameCount = FRAME_LENGTH; audio_buffer_t *pinbuf, *poutbuf; pinbuf = &inbuffer; poutbuf = &outbuffer; int frameCounter = 0; std::vector<short> inS16(FRAME_LENGTH * MAX_NUM_CHANNELS); std::vector<short> outS16(FRAME_LENGTH * MAX_NUM_CHANNELS); while (fread(inS16.data(), fileFrameSize, FRAME_LENGTH, finp) == FRAME_LENGTH) { if (numFileChannels != numProcessChannels) { adjust_channels(inS16.data(), numFileChannels, inS16.data(), numProcessChannels, sizeof(short), FRAME_LENGTH * fileFrameSize); } memcpy_to_float_from_i16(inFloat.data(), inS16.data(), FRAME_LENGTH * numProcessChannels); const int32_t err = (Downmix_api->process)(*effectHandle, pinbuf, poutbuf); if (err != 0) { ALOGE("DownmixProcess returned an error %d", err); return -1; } memcpy_to_i16_from_float(outS16.data(), outFloat.data(), FRAME_LENGTH * outputChannels); fwrite(outS16.data(), sizeof(short), (FRAME_LENGTH * outputChannels), fout); frameCounter++; } printf("frameCounter: [%d]\n", frameCounter); return 0; } int32_t DowmixMainProcess(downmix_cntxt_s *pDescriptor, FILE *finp, FILE *fout) { effect_handle_t *effectHandle = &pDescriptor->handle; int32_t sessionId = 0, ioId = 0; const effect_uuid_t downmix_uuid = { 0x93f04452, 0xe4fe, 0x41cc, 0x91f9, {0xe4, 0x75, 0xb6, 0xd1, 0xd6, 0x9f}}; int32_t err = AUDIO_EFFECT_LIBRARY_INFO_SYM.create_effect( &downmix_uuid, sessionId, ioId, effectHandle); if (err != 0) { ALOGE("DownmixLib_Create returned an error %d", err); return -1; } // Passing the init config for time being. err = DownmixConfiureAndEnable(pDescriptor); if (err != 0) { ALOGE("DownmixConfigureAndEnable returned an error %d", err); return -1; } // execute call for downmix. err = DownmixExecute(pDescriptor, finp, fout); if (err != 0) { ALOGE("DownmixExecute returned an error %d", err); return -1; } // Release the library function. err = AUDIO_EFFECT_LIBRARY_INFO_SYM.release_effect(*effectHandle); if (err != 0) { ALOGE("DownmixRelease returned an error %d", err); return -1; } return 0; } int main(int argc, const char *argv[]) { int numFileChannels = 1, numProcessChannels = 8; downmix_cntxt_s descriptor = {}; DownmixDefaultConfig(&(descriptor.config)); const char *infile = nullptr; const char *outfile = nullptr; for (int i = 1; i < argc; i++) { printf("%s ", argv[i]); if (argv[i][0] != '-') { if (infile == nullptr) { infile = argv[i]; } else if (outfile == nullptr) { outfile = argv[i]; } else { printUsage(); return -1; } } else if (!strncmp(argv[i], "-fs:", 4)) { // Add a check for all the supported streams. const int samplingFreq = atoi(argv[i] + 4); if (samplingFreq != 8000 && samplingFreq != 11025 && samplingFreq != 12000 && samplingFreq != 16000 && samplingFreq != 22050 && samplingFreq != 24000 && samplingFreq != 32000 && samplingFreq != 44100 && samplingFreq != 48000 && samplingFreq != 88200 && samplingFreq != 96000 && samplingFreq != 176400 && samplingFreq != 192000) { printf("Unsupported Sampling Frequency : %d", samplingFreq); printUsage(); return -1; } descriptor.config.inputCfg.samplingRate = samplingFreq; descriptor.config.outputCfg.samplingRate = samplingFreq; } else if (!strncmp(argv[i], "-ch_fmt:", 8)) { const int format = atoi(argv[i] + 8); uint32_t *audioType = &descriptor.config.inputCfg.channels; switch (format) { case 0: *audioType = AUDIO_CHANNEL_OUT_7POINT1; break; case 1: *audioType = AUDIO_CHANNEL_OUT_5POINT1_SIDE; break; case 2: *audioType = AUDIO_CHANNEL_OUT_5POINT1_BACK; break; case 3: *audioType = AUDIO_CHANNEL_OUT_QUAD_SIDE; break; case 4: *audioType = AUDIO_CHANNEL_OUT_QUAD_BACK; break; default: *audioType = AUDIO_CHANNEL_OUT_7POINT1; break; } descriptor.numProcessChannels = audio_channel_count_from_out_mask(*audioType); } else if (!strncmp(argv[i], "-fch:", 5)) { const int fChannels = atoi(argv[i] + 5); if (fChannels > 8 || fChannels < 1) { printf("Unsupported number of file channels : %d", fChannels); printUsage(); return -1; } descriptor.numFileChannels = fChannels; } else if (!strncmp(argv[i], "-h", 2)) { printUsage(); return 0; } } if (/*infile == nullptr || */ outfile == nullptr) { printUsage(); return -1; } FILE *finp = fopen(infile, "rb"); if (finp == nullptr) { printf("Cannot open input file %s", infile); return -1; } FILE *fout = fopen(outfile, "wb"); if (fout == nullptr) { printf("Cannot open output file %s", outfile); fclose(finp); return -1; } const int err = DowmixMainProcess(&descriptor, finp, fout); // close input and output files. fclose(finp); fclose(fout); if (err != 0) { printf("Error: %d\n", err); } return err; }
aa250cff0a9bd57c567101782976b7f4e654d747
aaf95951bcad7aa36273a56f2a9b53e1a0fd7c96
/main programs/_2-svet/_2-svet.ino
842805f97b7e96e4bcc9b1fc0f87af28757a364d
[]
no_license
sergei-filippov/rbtrffc
99cacd98d2478d4fa81ac273a11d97e8b3ffdfc0
d7c18fa6859b96782c5e2e4c46490d31121dd8ff
refs/heads/master
2021-01-22T04:01:14.969713
2017-03-18T13:05:04
2017-03-18T13:05:04
81,489,847
0
0
null
2017-03-18T12:58:54
2017-02-09T20:02:58
null
UTF-8
C++
false
false
4,238
ino
#include <FlexiTimer2.h> #include <Servo.h> Servo servo; Servo servom; int distStop = 20; int dist, cm, svet, svet1, svet2, black, white, midLight, signalIr, stopLine; int servoRange = 1800 - 1050; // range of values of serva float rotation, svetRange; //rotation * // range of possible lighting int k = 1450; // rotation + int speed1 = 1620; // normal speed //---------------------------------------------------------------------------------------------------------//IRDA void flash() { if (Serial2.available()) { stopLine = analogRead(A6); signalIr = Serial2.read(); if (signalIr == 0 || signalIr == 1 || signalIr == 4 || signalIr == 3 || signalIr == 5) { //red //red+yellow // yellow // blinking green // pedestrian crossing speed1 = 1600; // starts moving slower if (stopLine <= midLight) { // car on a stop line // speed1 = 1500; // car stops } } } } //----------------------------------------------------------------------------------------------------------// BUZZ void buzz1sec() { for (int i = 0; i < 500; i++) { digitalWrite(10, HIGH); delay(1); digitalWrite(10, LOW); delay(1); } } //-----------------------------------------------------------------------------------------------------------// void setup() { //FlexiTimer2::set( 50, flash); //FlexiTimer2:: start(); servo.attach(14); //1050 - straight right 1800 - straight left delay(1000); servom.attach(15); delay(1000); //never delete Serial.begin(9600); Serial2.begin(115200); //irda !!!! // servo.write(120); pinMode(10, OUTPUT); // buzz pinMode(27, INPUT); // button pinMode(A9, INPUT); // stopLine pinMode(A8, INPUT); // svet // levo pinMode(A7, INPUT); // svet // pravo // pinMode(15, OUTPUT); // motor // pinMode(14, OUTPUT); // serva pinMode(A6, INPUT); // dist digitalWrite(27, HIGH); // pull-up for button //---------------------------------------------------------------------------------------------------------// while (true) { bool flag = 0; if (digitalRead(27) == LOW) { black = analogRead(A7); buzz1sec(); while (true) { if (digitalRead(27) == LOW) { white = analogRead(A7); buzz1sec(); delay(1000); //----------------------------// detecting white and black edge values at this very place flag = 1; break; } } if (flag == 1) { break; } } } midLight = (white + black) / 2; svetRange = white - black; rotation = servoRange / (2 * svetRange); Serial.println(white); Serial.println(black); Serial.print(2 * svetRange); Serial.print(" "); Serial.print(servoRange); Serial.print(" "); Serial.println(rotation); } //-----------------------------------------------------------------------------------------------// void loop() { servom.write(speed1); // speed things //-----------------------------------------------------------------------------//driving svet1 = analogRead(A7); // white-850; black - 220 svet2 = analogRead(A8); svet = svet1 - svet2; servo.write(1500 + (svet / 1.7)); //servo.write(1500+svet); /* Serial.print(svet1); Serial.print(" "); Serial.println(svet2);*/ // Serial.println(rotation); /* Serial.print(svet); Serial.print(" "); Serial.println(1500+(svet*rotation));*/ Serial.println((svet * rotation) + k); // servo.write(130); //delay(100); //-----------------------------------------------------------------// //-------------------------------------------------------------------------------// /*Serial.println(analogRead(A6)); Serial.println((5222 / (analogRead(A6) - 13)));*/ /* if ((5222 / (analogRead(A6) - 13)) <= distStop) { while (true) { servom.write(0); // stop in case of another car Serial.println(1000); } }*/ //-------------------------------------------------------------------------------------// }
115b2ad7b2eef9284802f100f61bcb0d9a8736c6
1eb11a127dfc595dcb9fc1a5754ad2056ea14b42
/Top_100_Liked/146-LRU_Cache.cpp
1ddf07c7f762e275dbd9807aed43a1f81a24579d
[ "MIT" ]
permissive
parkerhsu/LeetCode-Solution
ba6c2bb0d112cd1cc29d85e25559cbd5483fb888
5458b6bd2176246d4931aaf81faf8f69cae7b8ea
refs/heads/master
2023-01-11T08:34:21.691316
2020-06-04T12:50:50
2020-06-04T12:50:50
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,517
cpp
#include <bits/stdc++.h> using namespace std; /* * Info: 实现一个最近最少使用的缓存 * Key: 用双向链表list存储key,这样可以在O(1)的时间内实现插入删除操作, * 将每次更新的key都放到链表前面,当插入一个新元素并且容量满的时候, * 自动剔除尾部元素,关键是如何在O(1)时间内找到要更新的key,所以可以 * 维护一个map保存每个key在lru中的位置,当更新的时候,直接先剔除该key, * 再将该key插入到lru的头部即可! */ class LRUCache { private: int size; list<int> lru; unordered_map<int, list<int>::iterator> mp; unordered_map<int, int> kv; public: LRUCache(int capacity) { size = capacity; } int get(int key) { if (kv.count(key) == 0) return -1; update(key); return kv[key]; } void put(int key, int value) { if (kv.size() == size && kv.count(key) == 0) { evict(); } update(key); kv[key] = value; } void update(int key) { if (kv.count(key)) { lru.erase(mp[key]); } lru.push_front(key); mp[key] = lru.begin(); } void evict() { mp.erase(lru.back()); kv.erase(lru.back()); lru.pop_back(); } }; /** * Your LRUCache object will be instantiated and called as such: * LRUCache* obj = new LRUCache(capacity); * int param_1 = obj->get(key); * obj->put(key,value); */
08d4e6e2ec524ea1a102d805555eba3fcf24ae7a
5bd19434d1920e2128fab47360a2b3aef10f9ec4
/media/gpu/v4l2_slice_video_decode_accelerator.cc
774e7d549ec92d8ea14673c2f77a8bdaa569f98e
[]
no_license
lineCode/chromium_base_media
0c99da150760217d12c35a29bd17e2bd8ddcfb6b
6ce013cdf956ea8e3514aea9e97d68027f645bda
refs/heads/master
2021-02-27T22:38:57.012532
2019-02-07T06:50:28
2019-02-07T06:50:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
119,657
cc
// Copyright 2015 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 "media/gpu/v4l2_slice_video_decode_accelerator.h" #include <errno.h> #include <fcntl.h> #include <linux/videodev2.h> #include <poll.h> #include <string.h> #include <sys/eventfd.h> #include <sys/ioctl.h> #include <sys/mman.h> #include <memory> #include "base/bind.h" #include "base/bind_helpers.h" #include "base/callback.h" #include "base/callback_helpers.h" #include "base/command_line.h" #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/numerics/safe_conversions.h" #include "base/single_thread_task_runner.h" #include "base/strings/stringprintf.h" #include "base/threading/thread_task_runner_handle.h" #include "media/base/bind_to_current_loop.h" #include "media/base/media_switches.h" #include "media/gpu/shared_memory_region.h" #include "ui/gl/gl_context.h" #include "ui/gl/scoped_binders.h" #define LOGF(level) LOG(level) << __func__ << "(): " #define DLOGF(level) DLOG(level) << __func__ << "(): " #define DVLOGF(level) DVLOG(level) << __func__ << "(): " #define PLOGF(level) PLOG(level) << __func__ << "(): " #define NOTIFY_ERROR(x) \ do { \ LOGF(ERROR) << "Setting error state:" << x; \ SetErrorState(x); \ } while (0) #define IOCTL_OR_ERROR_RETURN_VALUE(type, arg, value, type_str) \ do { \ if (device_->Ioctl(type, arg) != 0) { \ PLOGF(ERROR) << "ioctl() failed: " << type_str; \ return value; \ } \ } while (0) #define IOCTL_OR_ERROR_RETURN(type, arg) \ IOCTL_OR_ERROR_RETURN_VALUE(type, arg, ((void)0), #type) #define IOCTL_OR_ERROR_RETURN_FALSE(type, arg) \ IOCTL_OR_ERROR_RETURN_VALUE(type, arg, false, #type) #define IOCTL_OR_LOG_ERROR(type, arg) \ do { \ if (device_->Ioctl(type, arg) != 0) \ PLOGF(ERROR) << "ioctl() failed: " << #type; \ } while (0) namespace media { // static const uint32_t V4L2SliceVideoDecodeAccelerator::supported_input_fourccs_[] = { V4L2_PIX_FMT_H264_SLICE, V4L2_PIX_FMT_VP8_FRAME, V4L2_PIX_FMT_VP9_FRAME, }; class V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface : public base::RefCounted<V4L2DecodeSurface> { public: using ReleaseCB = base::Callback<void(int)>; V4L2DecodeSurface(int32_t bitstream_id, int input_record, int output_record, const ReleaseCB& release_cb); // Mark the surface as decoded. This will also release all references, as // they are not needed anymore and execute the done callback, if not null. void SetDecoded(); bool decoded() const { return decoded_; } int32_t bitstream_id() const { return bitstream_id_; } int input_record() const { return input_record_; } int output_record() const { return output_record_; } uint32_t config_store() const { return config_store_; } gfx::Rect visible_rect() const { return visible_rect_; } void set_visible_rect(const gfx::Rect& visible_rect) { visible_rect_ = visible_rect; } // Take references to each reference surface and keep them until the // target surface is decoded. void SetReferenceSurfaces( const std::vector<scoped_refptr<V4L2DecodeSurface>>& ref_surfaces); // If provided via this method, |done_cb| callback will be executed after // decoding into this surface is finished. The callback is reset afterwards, // so it needs to be set again before each decode operation. void SetDecodeDoneCallback(const base::Closure& done_cb) { DCHECK(done_cb_.is_null()); done_cb_ = done_cb; } std::string ToString() const; private: friend class base::RefCounted<V4L2DecodeSurface>; ~V4L2DecodeSurface(); int32_t bitstream_id_; int input_record_; int output_record_; uint32_t config_store_; gfx::Rect visible_rect_; bool decoded_; ReleaseCB release_cb_; base::Closure done_cb_; std::vector<scoped_refptr<V4L2DecodeSurface>> reference_surfaces_; DISALLOW_COPY_AND_ASSIGN(V4L2DecodeSurface); }; V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface::V4L2DecodeSurface( int32_t bitstream_id, int input_record, int output_record, const ReleaseCB& release_cb) : bitstream_id_(bitstream_id), input_record_(input_record), output_record_(output_record), config_store_(input_record + 1), decoded_(false), release_cb_(release_cb) {} V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface::~V4L2DecodeSurface() { DVLOGF(5) << "Releasing output record id=" << output_record_; release_cb_.Run(output_record_); } void V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface::SetReferenceSurfaces( const std::vector<scoped_refptr<V4L2DecodeSurface>>& ref_surfaces) { DCHECK(reference_surfaces_.empty()); reference_surfaces_ = ref_surfaces; } void V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface::SetDecoded() { DCHECK(!decoded_); decoded_ = true; // We can now drop references to all reference surfaces for this surface // as we are done with decoding. reference_surfaces_.clear(); // And finally execute and drop the decode done callback, if set. if (!done_cb_.is_null()) base::ResetAndReturn(&done_cb_).Run(); } std::string V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface::ToString() const { std::string out; base::StringAppendF(&out, "Buffer %d -> %d. ", input_record_, output_record_); base::StringAppendF(&out, "Reference surfaces:"); for (const auto& ref : reference_surfaces_) { DCHECK_NE(ref->output_record(), output_record_); base::StringAppendF(&out, " %d", ref->output_record()); } return out; } V4L2SliceVideoDecodeAccelerator::InputRecord::InputRecord() : input_id(-1), address(nullptr), length(0), bytes_used(0), at_device(false) {} V4L2SliceVideoDecodeAccelerator::OutputRecord::OutputRecord() : at_device(false), at_client(false), picture_id(-1), texture_id(0), egl_image(EGL_NO_IMAGE_KHR), egl_sync(EGL_NO_SYNC_KHR), cleared(false) {} struct V4L2SliceVideoDecodeAccelerator::BitstreamBufferRef { BitstreamBufferRef( base::WeakPtr<VideoDecodeAccelerator::Client>& client, const scoped_refptr<base::SingleThreadTaskRunner>& client_task_runner, SharedMemoryRegion* shm, int32_t input_id); ~BitstreamBufferRef(); const base::WeakPtr<VideoDecodeAccelerator::Client> client; const scoped_refptr<base::SingleThreadTaskRunner> client_task_runner; const std::unique_ptr<SharedMemoryRegion> shm; off_t bytes_used; const int32_t input_id; }; V4L2SliceVideoDecodeAccelerator::BitstreamBufferRef::BitstreamBufferRef( base::WeakPtr<VideoDecodeAccelerator::Client>& client, const scoped_refptr<base::SingleThreadTaskRunner>& client_task_runner, SharedMemoryRegion* shm, int32_t input_id) : client(client), client_task_runner(client_task_runner), shm(shm), bytes_used(0), input_id(input_id) {} V4L2SliceVideoDecodeAccelerator::BitstreamBufferRef::~BitstreamBufferRef() { if (input_id >= 0) { DVLOGF(5) << "returning input_id: " << input_id; client_task_runner->PostTask( FROM_HERE, base::Bind(&VideoDecodeAccelerator::Client::NotifyEndOfBitstreamBuffer, client, input_id)); } } struct V4L2SliceVideoDecodeAccelerator::EGLSyncKHRRef { EGLSyncKHRRef(EGLDisplay egl_display, EGLSyncKHR egl_sync); ~EGLSyncKHRRef(); EGLDisplay const egl_display; EGLSyncKHR egl_sync; }; V4L2SliceVideoDecodeAccelerator::EGLSyncKHRRef::EGLSyncKHRRef( EGLDisplay egl_display, EGLSyncKHR egl_sync) : egl_display(egl_display), egl_sync(egl_sync) {} V4L2SliceVideoDecodeAccelerator::EGLSyncKHRRef::~EGLSyncKHRRef() { // We don't check for eglDestroySyncKHR failures, because if we get here // with a valid sync object, something went wrong and we are getting // destroyed anyway. if (egl_sync != EGL_NO_SYNC_KHR) eglDestroySyncKHR(egl_display, egl_sync); } V4L2SliceVideoDecodeAccelerator::PictureRecord::PictureRecord( bool cleared, const Picture& picture) : cleared(cleared), picture(picture) {} V4L2SliceVideoDecodeAccelerator::PictureRecord::~PictureRecord() {} class V4L2SliceVideoDecodeAccelerator::V4L2H264Accelerator : public H264Decoder::H264Accelerator { public: explicit V4L2H264Accelerator(V4L2SliceVideoDecodeAccelerator* v4l2_dec); ~V4L2H264Accelerator() override; // H264Decoder::H264Accelerator implementation. scoped_refptr<H264Picture> CreateH264Picture() override; bool SubmitFrameMetadata(const H264SPS* sps, const H264PPS* pps, const H264DPB& dpb, const H264Picture::Vector& ref_pic_listp0, const H264Picture::Vector& ref_pic_listb0, const H264Picture::Vector& ref_pic_listb1, const scoped_refptr<H264Picture>& pic) override; bool SubmitSlice(const H264PPS* pps, const H264SliceHeader* slice_hdr, const H264Picture::Vector& ref_pic_list0, const H264Picture::Vector& ref_pic_list1, const scoped_refptr<H264Picture>& pic, const uint8_t* data, size_t size) override; bool SubmitDecode(const scoped_refptr<H264Picture>& pic) override; bool OutputPicture(const scoped_refptr<H264Picture>& pic) override; void Reset() override; private: // Max size of reference list. static const size_t kDPBIndicesListSize = 32; void H264PictureListToDPBIndicesList(const H264Picture::Vector& src_pic_list, uint8_t dst_list[kDPBIndicesListSize]); void H264DPBToV4L2DPB( const H264DPB& dpb, std::vector<scoped_refptr<V4L2DecodeSurface>>* ref_surfaces); scoped_refptr<V4L2DecodeSurface> H264PictureToV4L2DecodeSurface( const scoped_refptr<H264Picture>& pic); size_t num_slices_; V4L2SliceVideoDecodeAccelerator* v4l2_dec_; // TODO(posciak): This should be queried from hardware once supported. static const size_t kMaxSlices = 16; struct v4l2_ctrl_h264_slice_param v4l2_slice_params_[kMaxSlices]; struct v4l2_ctrl_h264_decode_param v4l2_decode_param_; DISALLOW_COPY_AND_ASSIGN(V4L2H264Accelerator); }; class V4L2SliceVideoDecodeAccelerator::V4L2VP8Accelerator : public VP8Decoder::VP8Accelerator { public: explicit V4L2VP8Accelerator(V4L2SliceVideoDecodeAccelerator* v4l2_dec); ~V4L2VP8Accelerator() override; // VP8Decoder::VP8Accelerator implementation. scoped_refptr<VP8Picture> CreateVP8Picture() override; bool SubmitDecode(const scoped_refptr<VP8Picture>& pic, const Vp8FrameHeader* frame_hdr, const scoped_refptr<VP8Picture>& last_frame, const scoped_refptr<VP8Picture>& golden_frame, const scoped_refptr<VP8Picture>& alt_frame) override; bool OutputPicture(const scoped_refptr<VP8Picture>& pic) override; private: scoped_refptr<V4L2DecodeSurface> VP8PictureToV4L2DecodeSurface( const scoped_refptr<VP8Picture>& pic); V4L2SliceVideoDecodeAccelerator* v4l2_dec_; DISALLOW_COPY_AND_ASSIGN(V4L2VP8Accelerator); }; class V4L2SliceVideoDecodeAccelerator::V4L2VP9Accelerator : public VP9Decoder::VP9Accelerator { public: explicit V4L2VP9Accelerator(V4L2SliceVideoDecodeAccelerator* v4l2_dec); ~V4L2VP9Accelerator() override; // VP9Decoder::VP9Accelerator implementation. scoped_refptr<VP9Picture> CreateVP9Picture() override; bool SubmitDecode(const scoped_refptr<VP9Picture>& pic, const Vp9SegmentationParams& segm_params, const Vp9LoopFilterParams& lf_params, const std::vector<scoped_refptr<VP9Picture>>& ref_pictures, const base::Closure& done_cb) override; bool OutputPicture(const scoped_refptr<VP9Picture>& pic) override; bool GetFrameContext(const scoped_refptr<VP9Picture>& pic, Vp9FrameContext* frame_ctx) override; bool IsFrameContextRequired() const override { return device_needs_frame_context_; } private: scoped_refptr<V4L2DecodeSurface> VP9PictureToV4L2DecodeSurface( const scoped_refptr<VP9Picture>& pic); bool device_needs_frame_context_; V4L2SliceVideoDecodeAccelerator* v4l2_dec_; DISALLOW_COPY_AND_ASSIGN(V4L2VP9Accelerator); }; // Codec-specific subclasses of software decoder picture classes. // This allows us to keep decoders oblivious of our implementation details. class V4L2H264Picture : public H264Picture { public: explicit V4L2H264Picture( const scoped_refptr<V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface>& dec_surface); V4L2H264Picture* AsV4L2H264Picture() override { return this; } scoped_refptr<V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface> dec_surface() { return dec_surface_; } private: ~V4L2H264Picture() override; scoped_refptr<V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface> dec_surface_; DISALLOW_COPY_AND_ASSIGN(V4L2H264Picture); }; V4L2H264Picture::V4L2H264Picture( const scoped_refptr<V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface>& dec_surface) : dec_surface_(dec_surface) {} V4L2H264Picture::~V4L2H264Picture() {} class V4L2VP8Picture : public VP8Picture { public: explicit V4L2VP8Picture( const scoped_refptr<V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface>& dec_surface); V4L2VP8Picture* AsV4L2VP8Picture() override { return this; } scoped_refptr<V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface> dec_surface() { return dec_surface_; } private: ~V4L2VP8Picture() override; scoped_refptr<V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface> dec_surface_; DISALLOW_COPY_AND_ASSIGN(V4L2VP8Picture); }; V4L2VP8Picture::V4L2VP8Picture( const scoped_refptr<V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface>& dec_surface) : dec_surface_(dec_surface) {} V4L2VP8Picture::~V4L2VP8Picture() {} class V4L2VP9Picture : public VP9Picture { public: explicit V4L2VP9Picture( const scoped_refptr<V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface>& dec_surface); V4L2VP9Picture* AsV4L2VP9Picture() override { return this; } scoped_refptr<V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface> dec_surface() { return dec_surface_; } private: ~V4L2VP9Picture() override; scoped_refptr<V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface> dec_surface_; DISALLOW_COPY_AND_ASSIGN(V4L2VP9Picture); }; V4L2VP9Picture::V4L2VP9Picture( const scoped_refptr<V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface>& dec_surface) : dec_surface_(dec_surface) {} V4L2VP9Picture::~V4L2VP9Picture() {} V4L2SliceVideoDecodeAccelerator::V4L2SliceVideoDecodeAccelerator( const scoped_refptr<V4L2Device>& device, EGLDisplay egl_display, const GetGLContextCallback& get_gl_context_cb, const MakeGLContextCurrentCallback& make_context_current_cb) : input_planes_count_(0), output_planes_count_(0), child_task_runner_(base::ThreadTaskRunnerHandle::Get()), device_(device), decoder_thread_("V4L2SliceVideoDecodeAcceleratorThread"), device_poll_thread_("V4L2SliceVideoDecodeAcceleratorDevicePollThread"), input_streamon_(false), input_buffer_queued_count_(0), output_streamon_(false), output_buffer_queued_count_(0), video_profile_(VIDEO_CODEC_PROFILE_UNKNOWN), input_format_fourcc_(0), output_format_fourcc_(0), state_(kUninitialized), output_mode_(Config::OutputMode::ALLOCATE), decoder_flushing_(false), decoder_resetting_(false), surface_set_change_pending_(false), picture_clearing_count_(0), egl_display_(egl_display), get_gl_context_cb_(get_gl_context_cb), make_context_current_cb_(make_context_current_cb), weak_this_factory_(this) { weak_this_ = weak_this_factory_.GetWeakPtr(); } V4L2SliceVideoDecodeAccelerator::~V4L2SliceVideoDecodeAccelerator() { DVLOGF(2); DCHECK(child_task_runner_->BelongsToCurrentThread()); DCHECK(!decoder_thread_.IsRunning()); DCHECK(!device_poll_thread_.IsRunning()); DCHECK(input_buffer_map_.empty()); DCHECK(output_buffer_map_.empty()); } void V4L2SliceVideoDecodeAccelerator::NotifyError(Error error) { if (!child_task_runner_->BelongsToCurrentThread()) { child_task_runner_->PostTask( FROM_HERE, base::Bind(&V4L2SliceVideoDecodeAccelerator::NotifyError, weak_this_, error)); return; } if (client_) { client_->NotifyError(error); client_ptr_factory_.reset(); } } bool V4L2SliceVideoDecodeAccelerator::Initialize(const Config& config, Client* client) { DVLOGF(3) << "profile: " << config.profile; DCHECK(child_task_runner_->BelongsToCurrentThread()); DCHECK_EQ(state_, kUninitialized); if (config.is_encrypted()) { NOTREACHED() << "Encrypted streams are not supported for this VDA"; return false; } if (config.output_mode != Config::OutputMode::ALLOCATE && config.output_mode != Config::OutputMode::IMPORT) { NOTREACHED() << "Only ALLOCATE and IMPORT OutputModes are supported"; return false; } client_ptr_factory_.reset( new base::WeakPtrFactory<VideoDecodeAccelerator::Client>(client)); client_ = client_ptr_factory_->GetWeakPtr(); // If we haven't been set up to decode on separate thread via // TryToSetupDecodeOnSeparateThread(), use the main thread/client for // decode tasks. if (!decode_task_runner_) { decode_task_runner_ = child_task_runner_; DCHECK(!decode_client_); decode_client_ = client_; } if (egl_display_ == EGL_NO_DISPLAY) { LOGF(ERROR) << "could not get EGLDisplay"; return false; } // We need the context to be initialized to query extensions. if (!make_context_current_cb_.is_null()) { if (!make_context_current_cb_.Run()) { LOGF(ERROR) << "could not make context current"; return false; } if (!gl::g_driver_egl.ext.b_EGL_KHR_fence_sync) { LOGF(ERROR) << "context does not have EGL_KHR_fence_sync"; return false; } } else { DVLOGF(1) << "No GL callbacks provided, initializing without GL support"; } video_profile_ = config.profile; // TODO(posciak): This needs to be queried once supported. input_planes_count_ = 1; output_planes_count_ = 1; input_format_fourcc_ = V4L2Device::VideoCodecProfileToV4L2PixFmt(video_profile_, true); if (!device_->Open(V4L2Device::Type::kDecoder, input_format_fourcc_)) { DVLOGF(1) << "Failed to open device for profile: " << config.profile << " fourcc: " << std::hex << "0x" << input_format_fourcc_; return false; } if (video_profile_ >= H264PROFILE_MIN && video_profile_ <= H264PROFILE_MAX) { h264_accelerator_.reset(new V4L2H264Accelerator(this)); decoder_.reset(new H264Decoder(h264_accelerator_.get())); } else if (video_profile_ >= VP8PROFILE_MIN && video_profile_ <= VP8PROFILE_MAX) { vp8_accelerator_.reset(new V4L2VP8Accelerator(this)); decoder_.reset(new VP8Decoder(vp8_accelerator_.get())); } else if (video_profile_ >= VP9PROFILE_MIN && video_profile_ <= VP9PROFILE_MAX) { vp9_accelerator_.reset(new V4L2VP9Accelerator(this)); decoder_.reset(new VP9Decoder(vp9_accelerator_.get())); } else { NOTREACHED() << "Unsupported profile " << video_profile_; return false; } // Capabilities check. struct v4l2_capability caps; const __u32 kCapsRequired = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING; IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_QUERYCAP, &caps); if ((caps.capabilities & kCapsRequired) != kCapsRequired) { LOGF(ERROR) << "ioctl() failed: VIDIOC_QUERYCAP" << ", caps check failed: 0x" << std::hex << caps.capabilities; return false; } if (!SetupFormats()) return false; if (!decoder_thread_.Start()) { DLOGF(ERROR) << "device thread failed to start"; return false; } decoder_thread_task_runner_ = decoder_thread_.task_runner(); state_ = kInitialized; output_mode_ = config.output_mode; // InitializeTask will NOTIFY_ERROR on failure. decoder_thread_task_runner_->PostTask( FROM_HERE, base::Bind(&V4L2SliceVideoDecodeAccelerator::InitializeTask, base::Unretained(this))); DVLOGF(1) << "V4L2SliceVideoDecodeAccelerator initialized"; return true; } void V4L2SliceVideoDecodeAccelerator::InitializeTask() { DVLOGF(3); DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); DCHECK_EQ(state_, kInitialized); if (!CreateInputBuffers()) NOTIFY_ERROR(PLATFORM_FAILURE); // Output buffers will be created once decoder gives us information // about their size and required count. state_ = kDecoding; } void V4L2SliceVideoDecodeAccelerator::Destroy() { DVLOGF(3); DCHECK(child_task_runner_->BelongsToCurrentThread()); if (decoder_thread_.IsRunning()) { decoder_thread_task_runner_->PostTask( FROM_HERE, base::Bind(&V4L2SliceVideoDecodeAccelerator::DestroyTask, base::Unretained(this))); // Wait for tasks to finish/early-exit. decoder_thread_.Stop(); } delete this; DVLOGF(3) << "Destroyed"; } void V4L2SliceVideoDecodeAccelerator::DestroyTask() { DVLOGF(3); DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); state_ = kError; decoder_->Reset(); decoder_current_bitstream_buffer_.reset(); while (!decoder_input_queue_.empty()) decoder_input_queue_.pop(); // Stop streaming and the device_poll_thread_. StopDevicePoll(false); DestroyInputBuffers(); DestroyOutputs(false); DCHECK(surfaces_at_device_.empty()); DCHECK(surfaces_at_display_.empty()); DCHECK(decoder_display_queue_.empty()); } bool V4L2SliceVideoDecodeAccelerator::SetupFormats() { DCHECK_EQ(state_, kUninitialized); size_t input_size; gfx::Size max_resolution, min_resolution; device_->GetSupportedResolution(input_format_fourcc_, &min_resolution, &max_resolution); if (max_resolution.width() > 1920 && max_resolution.height() > 1088) input_size = kInputBufferMaxSizeFor4k; else input_size = kInputBufferMaxSizeFor1080p; struct v4l2_fmtdesc fmtdesc; memset(&fmtdesc, 0, sizeof(fmtdesc)); fmtdesc.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; bool is_format_supported = false; while (device_->Ioctl(VIDIOC_ENUM_FMT, &fmtdesc) == 0) { if (fmtdesc.pixelformat == input_format_fourcc_) { is_format_supported = true; break; } ++fmtdesc.index; } if (!is_format_supported) { DVLOGF(1) << "Input fourcc " << input_format_fourcc_ << " not supported by device."; return false; } struct v4l2_format format; memset(&format, 0, sizeof(format)); format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; format.fmt.pix_mp.pixelformat = input_format_fourcc_; format.fmt.pix_mp.plane_fmt[0].sizeimage = input_size; format.fmt.pix_mp.num_planes = input_planes_count_; IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_S_FMT, &format); // We have to set up the format for output, because the driver may not allow // changing it once we start streaming; whether it can support our chosen // output format or not may depend on the input format. memset(&fmtdesc, 0, sizeof(fmtdesc)); fmtdesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; output_format_fourcc_ = 0; while (device_->Ioctl(VIDIOC_ENUM_FMT, &fmtdesc) == 0) { if (device_->CanCreateEGLImageFrom(fmtdesc.pixelformat)) { output_format_fourcc_ = fmtdesc.pixelformat; break; } ++fmtdesc.index; } if (output_format_fourcc_ == 0) { LOGF(ERROR) << "Could not find a usable output format"; return false; } // Only set fourcc for output; resolution, etc., will come from the // driver once it extracts it from the stream. memset(&format, 0, sizeof(format)); format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; format.fmt.pix_mp.pixelformat = output_format_fourcc_; format.fmt.pix_mp.num_planes = output_planes_count_; IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_S_FMT, &format); return true; } bool V4L2SliceVideoDecodeAccelerator::CreateInputBuffers() { DVLOGF(3); DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); DCHECK(!input_streamon_); DCHECK(input_buffer_map_.empty()); struct v4l2_requestbuffers reqbufs; memset(&reqbufs, 0, sizeof(reqbufs)); reqbufs.count = kNumInputBuffers; reqbufs.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; reqbufs.memory = V4L2_MEMORY_MMAP; IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_REQBUFS, &reqbufs); if (reqbufs.count < kNumInputBuffers) { PLOGF(ERROR) << "Could not allocate enough output buffers"; return false; } input_buffer_map_.resize(reqbufs.count); for (size_t i = 0; i < input_buffer_map_.size(); ++i) { free_input_buffers_.push_back(i); // Query for the MEMORY_MMAP pointer. struct v4l2_plane planes[VIDEO_MAX_PLANES]; struct v4l2_buffer buffer; memset(&buffer, 0, sizeof(buffer)); memset(planes, 0, sizeof(planes)); buffer.index = i; buffer.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; buffer.memory = V4L2_MEMORY_MMAP; buffer.m.planes = planes; buffer.length = input_planes_count_; IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_QUERYBUF, &buffer); void* address = device_->Mmap(nullptr, buffer.m.planes[0].length, PROT_READ | PROT_WRITE, MAP_SHARED, buffer.m.planes[0].m.mem_offset); if (address == MAP_FAILED) { PLOGF(ERROR) << "mmap() failed"; return false; } input_buffer_map_[i].address = address; input_buffer_map_[i].length = buffer.m.planes[0].length; } return true; } bool V4L2SliceVideoDecodeAccelerator::CreateOutputBuffers() { DVLOGF(3); DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); DCHECK(!output_streamon_); DCHECK(output_buffer_map_.empty()); DCHECK(surfaces_at_display_.empty()); DCHECK(surfaces_at_device_.empty()); gfx::Size pic_size = decoder_->GetPicSize(); size_t num_pictures = decoder_->GetRequiredNumOfPictures(); DCHECK_GT(num_pictures, 0u); DCHECK(!pic_size.IsEmpty()); struct v4l2_format format; memset(&format, 0, sizeof(format)); format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; format.fmt.pix_mp.pixelformat = output_format_fourcc_; format.fmt.pix_mp.width = pic_size.width(); format.fmt.pix_mp.height = pic_size.height(); format.fmt.pix_mp.num_planes = input_planes_count_; if (device_->Ioctl(VIDIOC_S_FMT, &format) != 0) { PLOGF(ERROR) << "Failed setting format to: " << output_format_fourcc_; NOTIFY_ERROR(PLATFORM_FAILURE); return false; } coded_size_.SetSize(base::checked_cast<int>(format.fmt.pix_mp.width), base::checked_cast<int>(format.fmt.pix_mp.height)); DCHECK_EQ(coded_size_.width() % 16, 0); DCHECK_EQ(coded_size_.height() % 16, 0); if (!gfx::Rect(coded_size_).Contains(gfx::Rect(pic_size))) { LOGF(ERROR) << "Got invalid adjusted coded size: " << coded_size_.ToString(); return false; } DVLOGF(3) << "buffer_count=" << num_pictures << ", pic size=" << pic_size.ToString() << ", coded size=" << coded_size_.ToString(); // With ALLOCATE mode the client can sample it as RGB and doesn't need to // know the precise format. VideoPixelFormat pixel_format = (output_mode_ == Config::OutputMode::IMPORT) ? V4L2Device::V4L2PixFmtToVideoPixelFormat(output_format_fourcc_) : PIXEL_FORMAT_UNKNOWN; child_task_runner_->PostTask( FROM_HERE, base::Bind(&VideoDecodeAccelerator::Client::ProvidePictureBuffers, client_, num_pictures, pixel_format, 1, coded_size_, device_->GetTextureTarget())); // Go into kAwaitingPictureBuffers to prevent us from doing any more decoding // or event handling while we are waiting for AssignPictureBuffers(). Not // having Pictures available would not have prevented us from making decoding // progress entirely e.g. in the case of H.264 where we could further decode // non-slice NALUs and could even get another resolution change before we were // done with this one. After we get the buffers, we'll go back into kIdle and // kick off further event processing, and eventually go back into kDecoding // once no more events are pending (if any). state_ = kAwaitingPictureBuffers; return true; } void V4L2SliceVideoDecodeAccelerator::DestroyInputBuffers() { DVLOGF(3); DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread() || !decoder_thread_.IsRunning()); DCHECK(!input_streamon_); if (input_buffer_map_.empty()) return; for (auto& input_record : input_buffer_map_) { if (input_record.address != nullptr) device_->Munmap(input_record.address, input_record.length); } struct v4l2_requestbuffers reqbufs; memset(&reqbufs, 0, sizeof(reqbufs)); reqbufs.count = 0; reqbufs.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; reqbufs.memory = V4L2_MEMORY_MMAP; IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs); input_buffer_map_.clear(); free_input_buffers_.clear(); } void V4L2SliceVideoDecodeAccelerator::DismissPictures( const std::vector<int32_t>& picture_buffer_ids, base::WaitableEvent* done) { DVLOGF(3); DCHECK(child_task_runner_->BelongsToCurrentThread()); for (auto picture_buffer_id : picture_buffer_ids) { DVLOGF(1) << "dismissing PictureBuffer id=" << picture_buffer_id; client_->DismissPictureBuffer(picture_buffer_id); } done->Signal(); } void V4L2SliceVideoDecodeAccelerator::DevicePollTask(bool poll_device) { DVLOGF(4); DCHECK(device_poll_thread_.task_runner()->BelongsToCurrentThread()); bool event_pending; if (!device_->Poll(poll_device, &event_pending)) { NOTIFY_ERROR(PLATFORM_FAILURE); return; } // All processing should happen on ServiceDeviceTask(), since we shouldn't // touch encoder state from this thread. decoder_thread_task_runner_->PostTask( FROM_HERE, base::Bind(&V4L2SliceVideoDecodeAccelerator::ServiceDeviceTask, base::Unretained(this))); } void V4L2SliceVideoDecodeAccelerator::ServiceDeviceTask() { DVLOGF(4); DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); // ServiceDeviceTask() should only ever be scheduled from DevicePollTask(). Dequeue(); SchedulePollIfNeeded(); } void V4L2SliceVideoDecodeAccelerator::SchedulePollIfNeeded() { DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); if (!device_poll_thread_.IsRunning()) { DVLOGF(2) << "Device poll thread stopped, will not schedule poll"; return; } DCHECK(input_streamon_ || output_streamon_); if (input_buffer_queued_count_ + output_buffer_queued_count_ == 0) { DVLOGF(4) << "No buffers queued, will not schedule poll"; return; } DVLOGF(4) << "Scheduling device poll task"; device_poll_thread_.task_runner()->PostTask( FROM_HERE, base::Bind(&V4L2SliceVideoDecodeAccelerator::DevicePollTask, base::Unretained(this), true)); DVLOGF(2) << "buffer counts: " << "INPUT[" << decoder_input_queue_.size() << "]" << " => DEVICE[" << free_input_buffers_.size() << "+" << input_buffer_queued_count_ << "/" << input_buffer_map_.size() << "]->[" << free_output_buffers_.size() << "+" << output_buffer_queued_count_ << "/" << output_buffer_map_.size() << "]" << " => DISPLAYQ[" << decoder_display_queue_.size() << "]" << " => CLIENT[" << surfaces_at_display_.size() << "]"; } void V4L2SliceVideoDecodeAccelerator::Enqueue( const scoped_refptr<V4L2DecodeSurface>& dec_surface) { DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); const int old_inputs_queued = input_buffer_queued_count_; const int old_outputs_queued = output_buffer_queued_count_; if (!EnqueueInputRecord(dec_surface->input_record(), dec_surface->config_store())) { DVLOGF(1) << "Failed queueing an input buffer"; NOTIFY_ERROR(PLATFORM_FAILURE); return; } if (!EnqueueOutputRecord(dec_surface->output_record())) { DVLOGF(1) << "Failed queueing an output buffer"; NOTIFY_ERROR(PLATFORM_FAILURE); return; } bool inserted = surfaces_at_device_ .insert(std::make_pair(dec_surface->output_record(), dec_surface)) .second; DCHECK(inserted); if (old_inputs_queued == 0 && old_outputs_queued == 0) SchedulePollIfNeeded(); } void V4L2SliceVideoDecodeAccelerator::Dequeue() { DVLOGF(3); DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); struct v4l2_buffer dqbuf; struct v4l2_plane planes[VIDEO_MAX_PLANES]; while (input_buffer_queued_count_ > 0) { DCHECK(input_streamon_); memset(&dqbuf, 0, sizeof(dqbuf)); memset(&planes, 0, sizeof(planes)); dqbuf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; dqbuf.memory = V4L2_MEMORY_MMAP; dqbuf.m.planes = planes; dqbuf.length = input_planes_count_; if (device_->Ioctl(VIDIOC_DQBUF, &dqbuf) != 0) { if (errno == EAGAIN) { // EAGAIN if we're just out of buffers to dequeue. break; } PLOGF(ERROR) << "ioctl() failed: VIDIOC_DQBUF"; NOTIFY_ERROR(PLATFORM_FAILURE); return; } InputRecord& input_record = input_buffer_map_[dqbuf.index]; DCHECK(input_record.at_device); input_record.at_device = false; ReuseInputBuffer(dqbuf.index); input_buffer_queued_count_--; DVLOGF(4) << "Dequeued input=" << dqbuf.index << " count: " << input_buffer_queued_count_; } while (output_buffer_queued_count_ > 0) { DCHECK(output_streamon_); memset(&dqbuf, 0, sizeof(dqbuf)); memset(&planes, 0, sizeof(planes)); dqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; dqbuf.memory = (output_mode_ == Config::OutputMode::ALLOCATE ? V4L2_MEMORY_MMAP : V4L2_MEMORY_DMABUF); dqbuf.m.planes = planes; dqbuf.length = output_planes_count_; if (device_->Ioctl(VIDIOC_DQBUF, &dqbuf) != 0) { if (errno == EAGAIN) { // EAGAIN if we're just out of buffers to dequeue. break; } PLOGF(ERROR) << "ioctl() failed: VIDIOC_DQBUF"; NOTIFY_ERROR(PLATFORM_FAILURE); return; } OutputRecord& output_record = output_buffer_map_[dqbuf.index]; DCHECK(output_record.at_device); output_record.at_device = false; output_buffer_queued_count_--; DVLOGF(3) << "Dequeued output=" << dqbuf.index << " count " << output_buffer_queued_count_; V4L2DecodeSurfaceByOutputId::iterator it = surfaces_at_device_.find(dqbuf.index); if (it == surfaces_at_device_.end()) { DLOGF(ERROR) << "Got invalid surface from device."; NOTIFY_ERROR(PLATFORM_FAILURE); } it->second->SetDecoded(); surfaces_at_device_.erase(it); } // A frame was decoded, see if we can output it. TryOutputSurfaces(); ProcessPendingEventsIfNeeded(); ScheduleDecodeBufferTaskIfNeeded(); } void V4L2SliceVideoDecodeAccelerator::NewEventPending() { // Switch to event processing mode if we are decoding. Otherwise we are either // already in it, or we will potentially switch to it later, after finishing // other tasks. if (state_ == kDecoding) state_ = kIdle; ProcessPendingEventsIfNeeded(); } bool V4L2SliceVideoDecodeAccelerator::FinishEventProcessing() { DCHECK_EQ(state_, kIdle); state_ = kDecoding; ScheduleDecodeBufferTaskIfNeeded(); return true; } void V4L2SliceVideoDecodeAccelerator::ProcessPendingEventsIfNeeded() { DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); // Process pending events, if any, in the correct order. // We always first process the surface set change, as it is an internal // event from the decoder and interleaving it with external requests would // put the decoder in an undefined state. using ProcessFunc = bool (V4L2SliceVideoDecodeAccelerator::*)(); const ProcessFunc process_functions[] = { &V4L2SliceVideoDecodeAccelerator::FinishSurfaceSetChange, &V4L2SliceVideoDecodeAccelerator::FinishFlush, &V4L2SliceVideoDecodeAccelerator::FinishReset, &V4L2SliceVideoDecodeAccelerator::FinishEventProcessing, }; for (const auto& fn : process_functions) { if (state_ != kIdle) return; if (!(this->*fn)()) return; } } void V4L2SliceVideoDecodeAccelerator::ReuseInputBuffer(int index) { DVLOGF(4) << "Reusing input buffer, index=" << index; DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); DCHECK_LT(index, static_cast<int>(input_buffer_map_.size())); InputRecord& input_record = input_buffer_map_[index]; DCHECK(!input_record.at_device); input_record.input_id = -1; input_record.bytes_used = 0; DCHECK_EQ( std::count(free_input_buffers_.begin(), free_input_buffers_.end(), index), 0); free_input_buffers_.push_back(index); } void V4L2SliceVideoDecodeAccelerator::ReuseOutputBuffer(int index) { DVLOGF(4) << "Reusing output buffer, index=" << index; DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); DCHECK_LT(index, static_cast<int>(output_buffer_map_.size())); OutputRecord& output_record = output_buffer_map_[index]; DCHECK(!output_record.at_device); DCHECK(!output_record.at_client); DCHECK_EQ(std::count(free_output_buffers_.begin(), free_output_buffers_.end(), index), 0); free_output_buffers_.push_back(index); ScheduleDecodeBufferTaskIfNeeded(); } bool V4L2SliceVideoDecodeAccelerator::EnqueueInputRecord( int index, uint32_t config_store) { DVLOGF(3); DCHECK_LT(index, static_cast<int>(input_buffer_map_.size())); DCHECK_GT(config_store, 0u); // Enqueue an input (VIDEO_OUTPUT) buffer for an input video frame. InputRecord& input_record = input_buffer_map_[index]; DCHECK(!input_record.at_device); struct v4l2_buffer qbuf; struct v4l2_plane qbuf_planes[VIDEO_MAX_PLANES]; memset(&qbuf, 0, sizeof(qbuf)); memset(qbuf_planes, 0, sizeof(qbuf_planes)); qbuf.index = index; qbuf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; qbuf.memory = V4L2_MEMORY_MMAP; qbuf.m.planes = qbuf_planes; qbuf.m.planes[0].bytesused = input_record.bytes_used; qbuf.length = input_planes_count_; qbuf.config_store = config_store; IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_QBUF, &qbuf); input_record.at_device = true; input_buffer_queued_count_++; DVLOGF(4) << "Enqueued input=" << qbuf.index << " count: " << input_buffer_queued_count_; return true; } bool V4L2SliceVideoDecodeAccelerator::EnqueueOutputRecord(int index) { DVLOGF(3); DCHECK_LT(index, static_cast<int>(output_buffer_map_.size())); // Enqueue an output (VIDEO_CAPTURE) buffer. OutputRecord& output_record = output_buffer_map_[index]; DCHECK(!output_record.at_device); DCHECK(!output_record.at_client); DCHECK_NE(output_record.picture_id, -1); if (output_record.egl_sync != EGL_NO_SYNC_KHR) { // If we have to wait for completion, wait. Note that // free_output_buffers_ is a FIFO queue, so we always wait on the // buffer that has been in the queue the longest. if (eglClientWaitSyncKHR(egl_display_, output_record.egl_sync, 0, EGL_FOREVER_KHR) == EGL_FALSE) { // This will cause tearing, but is safe otherwise. DVLOGF(1) << "eglClientWaitSyncKHR failed!"; } if (eglDestroySyncKHR(egl_display_, output_record.egl_sync) != EGL_TRUE) { LOGF(ERROR) << "eglDestroySyncKHR failed!"; NOTIFY_ERROR(PLATFORM_FAILURE); return false; } output_record.egl_sync = EGL_NO_SYNC_KHR; } struct v4l2_buffer qbuf; struct v4l2_plane qbuf_planes[VIDEO_MAX_PLANES]; memset(&qbuf, 0, sizeof(qbuf)); memset(qbuf_planes, 0, sizeof(qbuf_planes)); qbuf.index = index; qbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; if (output_mode_ == Config::OutputMode::ALLOCATE) { qbuf.memory = V4L2_MEMORY_MMAP; } else { qbuf.memory = V4L2_MEMORY_DMABUF; DCHECK_EQ(output_planes_count_, output_record.dmabuf_fds.size()); for (size_t i = 0; i < output_record.dmabuf_fds.size(); ++i) { DCHECK(output_record.dmabuf_fds[i].is_valid()); qbuf_planes[i].m.fd = output_record.dmabuf_fds[i].get(); } } qbuf.m.planes = qbuf_planes; qbuf.length = output_planes_count_; IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_QBUF, &qbuf); output_record.at_device = true; output_buffer_queued_count_++; DVLOGF(4) << "Enqueued output=" << qbuf.index << " count: " << output_buffer_queued_count_; return true; } bool V4L2SliceVideoDecodeAccelerator::StartDevicePoll() { DVLOGF(3) << "Starting device poll"; DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); DCHECK(!device_poll_thread_.IsRunning()); // Start up the device poll thread and schedule its first DevicePollTask(). if (!device_poll_thread_.Start()) { DLOGF(ERROR) << "Device thread failed to start"; NOTIFY_ERROR(PLATFORM_FAILURE); return false; } if (!input_streamon_) { __u32 type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_STREAMON, &type); input_streamon_ = true; } if (!output_streamon_) { __u32 type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_STREAMON, &type); output_streamon_ = true; } device_poll_thread_.task_runner()->PostTask( FROM_HERE, base::Bind(&V4L2SliceVideoDecodeAccelerator::DevicePollTask, base::Unretained(this), true)); return true; } bool V4L2SliceVideoDecodeAccelerator::StopDevicePoll(bool keep_input_state) { DVLOGF(3) << "Stopping device poll"; if (decoder_thread_.IsRunning()) DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); // Signal the DevicePollTask() to stop, and stop the device poll thread. if (!device_->SetDevicePollInterrupt()) { PLOGF(ERROR) << "SetDevicePollInterrupt(): failed"; NOTIFY_ERROR(PLATFORM_FAILURE); return false; } device_poll_thread_.Stop(); DVLOGF(3) << "Device poll thread stopped"; // Clear the interrupt now, to be sure. if (!device_->ClearDevicePollInterrupt()) { NOTIFY_ERROR(PLATFORM_FAILURE); return false; } if (!keep_input_state) { if (input_streamon_) { __u32 type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_STREAMOFF, &type); } input_streamon_ = false; } if (output_streamon_) { __u32 type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_STREAMOFF, &type); } output_streamon_ = false; if (!keep_input_state) { for (size_t i = 0; i < input_buffer_map_.size(); ++i) { InputRecord& input_record = input_buffer_map_[i]; if (input_record.at_device) { input_record.at_device = false; ReuseInputBuffer(i); input_buffer_queued_count_--; } } DCHECK_EQ(input_buffer_queued_count_, 0); } // STREAMOFF makes the driver drop all buffers without decoding and DQBUFing, // so we mark them all as at_device = false and clear surfaces_at_device_. for (size_t i = 0; i < output_buffer_map_.size(); ++i) { OutputRecord& output_record = output_buffer_map_[i]; if (output_record.at_device) { output_record.at_device = false; output_buffer_queued_count_--; } } surfaces_at_device_.clear(); DCHECK_EQ(output_buffer_queued_count_, 0); // Drop all surfaces that were awaiting decode before being displayed, // since we've just cancelled all outstanding decodes. while (!decoder_display_queue_.empty()) decoder_display_queue_.pop(); DVLOGF(3) << "Device poll stopped"; return true; } void V4L2SliceVideoDecodeAccelerator::Decode( const BitstreamBuffer& bitstream_buffer) { DVLOGF(3) << "input_id=" << bitstream_buffer.id() << ", size=" << bitstream_buffer.size(); DCHECK(decode_task_runner_->BelongsToCurrentThread()); if (bitstream_buffer.id() < 0) { LOGF(ERROR) << "Invalid bitstream_buffer, id: " << bitstream_buffer.id(); if (base::SharedMemory::IsHandleValid(bitstream_buffer.handle())) base::SharedMemory::CloseHandle(bitstream_buffer.handle()); NOTIFY_ERROR(INVALID_ARGUMENT); return; } decoder_thread_task_runner_->PostTask( FROM_HERE, base::Bind(&V4L2SliceVideoDecodeAccelerator::DecodeTask, base::Unretained(this), bitstream_buffer)); } void V4L2SliceVideoDecodeAccelerator::DecodeTask( const BitstreamBuffer& bitstream_buffer) { DVLOGF(3) << "input_id=" << bitstream_buffer.id() << " size=" << bitstream_buffer.size(); DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); std::unique_ptr<BitstreamBufferRef> bitstream_record(new BitstreamBufferRef( decode_client_, decode_task_runner_, new SharedMemoryRegion(bitstream_buffer, true), bitstream_buffer.id())); // Skip empty buffer. if (bitstream_buffer.size() == 0) return; if (!bitstream_record->shm->Map()) { LOGF(ERROR) << "Could not map bitstream_buffer"; NOTIFY_ERROR(UNREADABLE_INPUT); return; } DVLOGF(3) << "mapped at=" << bitstream_record->shm->memory(); decoder_input_queue_.push( linked_ptr<BitstreamBufferRef>(bitstream_record.release())); ScheduleDecodeBufferTaskIfNeeded(); } bool V4L2SliceVideoDecodeAccelerator::TrySetNewBistreamBuffer() { DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); DCHECK(!decoder_current_bitstream_buffer_); if (decoder_input_queue_.empty()) return false; decoder_current_bitstream_buffer_.reset( decoder_input_queue_.front().release()); decoder_input_queue_.pop(); if (decoder_current_bitstream_buffer_->input_id == kFlushBufferId) { // This is a buffer we queued for ourselves to trigger flush at this time. InitiateFlush(); return false; } const uint8_t* const data = reinterpret_cast<const uint8_t*>( decoder_current_bitstream_buffer_->shm->memory()); const size_t data_size = decoder_current_bitstream_buffer_->shm->size(); decoder_->SetStream(data, data_size); return true; } void V4L2SliceVideoDecodeAccelerator::ScheduleDecodeBufferTaskIfNeeded() { DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); if (state_ == kDecoding) { decoder_thread_task_runner_->PostTask( FROM_HERE, base::Bind(&V4L2SliceVideoDecodeAccelerator::DecodeBufferTask, base::Unretained(this))); } } void V4L2SliceVideoDecodeAccelerator::DecodeBufferTask() { DVLOGF(3); DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); if (state_ != kDecoding) { DVLOGF(3) << "Early exit, not in kDecoding"; return; } while (true) { AcceleratedVideoDecoder::DecodeResult res; res = decoder_->Decode(); switch (res) { case AcceleratedVideoDecoder::kAllocateNewSurfaces: DVLOGF(2) << "Decoder requesting a new set of surfaces"; InitiateSurfaceSetChange(); return; case AcceleratedVideoDecoder::kRanOutOfStreamData: decoder_current_bitstream_buffer_.reset(); if (!TrySetNewBistreamBuffer()) return; break; case AcceleratedVideoDecoder::kRanOutOfSurfaces: // No more surfaces for the decoder, we'll come back once we have more. DVLOGF(4) << "Ran out of surfaces"; return; case AcceleratedVideoDecoder::kNeedContextUpdate: DVLOGF(4) << "Awaiting context update"; return; case AcceleratedVideoDecoder::kDecodeError: DVLOGF(1) << "Error decoding stream"; NOTIFY_ERROR(PLATFORM_FAILURE); return; } } } void V4L2SliceVideoDecodeAccelerator::InitiateSurfaceSetChange() { DVLOGF(2); DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); DCHECK_EQ(state_, kDecoding); DCHECK(!surface_set_change_pending_); surface_set_change_pending_ = true; NewEventPending(); } bool V4L2SliceVideoDecodeAccelerator::FinishSurfaceSetChange() { DVLOGF(2); DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); if (!surface_set_change_pending_) return true; if (!surfaces_at_device_.empty()) return false; DCHECK_EQ(state_, kIdle); DCHECK(decoder_display_queue_.empty()); // All output buffers should've been returned from decoder and device by now. // The only remaining owner of surfaces may be display (client), and we will // dismiss them when destroying output buffers below. DCHECK_EQ(free_output_buffers_.size() + surfaces_at_display_.size(), output_buffer_map_.size()); // Keep input queue running while we switch outputs. if (!StopDevicePoll(true)) { NOTIFY_ERROR(PLATFORM_FAILURE); return false; } // This will return only once all buffers are dismissed and destroyed. // This does not wait until they are displayed however, as display retains // references to the buffers bound to textures and will release them // after displaying. if (!DestroyOutputs(true)) { NOTIFY_ERROR(PLATFORM_FAILURE); return false; } if (!CreateOutputBuffers()) { NOTIFY_ERROR(PLATFORM_FAILURE); return false; } surface_set_change_pending_ = false; DVLOGF(3) << "Surface set change finished"; return true; } bool V4L2SliceVideoDecodeAccelerator::DestroyOutputs(bool dismiss) { DVLOGF(3); DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); std::vector<int32_t> picture_buffers_to_dismiss; if (output_buffer_map_.empty()) return true; for (const auto& output_record : output_buffer_map_) { DCHECK(!output_record.at_device); if (output_record.egl_sync != EGL_NO_SYNC_KHR) { if (eglDestroySyncKHR(egl_display_, output_record.egl_sync) != EGL_TRUE) DVLOGF(1) << "eglDestroySyncKHR failed."; } if (output_record.egl_image != EGL_NO_IMAGE_KHR) { child_task_runner_->PostTask( FROM_HERE, base::Bind(base::IgnoreResult(&V4L2Device::DestroyEGLImage), device_, egl_display_, output_record.egl_image)); } picture_buffers_to_dismiss.push_back(output_record.picture_id); } if (dismiss) { DVLOGF(2) << "Scheduling picture dismissal"; base::WaitableEvent done(base::WaitableEvent::ResetPolicy::AUTOMATIC, base::WaitableEvent::InitialState::NOT_SIGNALED); child_task_runner_->PostTask( FROM_HERE, base::Bind(&V4L2SliceVideoDecodeAccelerator::DismissPictures, weak_this_, picture_buffers_to_dismiss, &done)); done.Wait(); } // At this point client can't call ReusePictureBuffer on any of the pictures // anymore, so it's safe to destroy. return DestroyOutputBuffers(); } bool V4L2SliceVideoDecodeAccelerator::DestroyOutputBuffers() { DVLOGF(3); DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread() || !decoder_thread_.IsRunning()); DCHECK(!output_streamon_); DCHECK(surfaces_at_device_.empty()); DCHECK(decoder_display_queue_.empty()); DCHECK_EQ(surfaces_at_display_.size() + free_output_buffers_.size(), output_buffer_map_.size()); if (output_buffer_map_.empty()) return true; // It's ok to do this, client will retain references to textures, but we are // not interested in reusing the surfaces anymore. // This will prevent us from reusing old surfaces in case we have some // ReusePictureBuffer() pending on ChildThread already. It's ok to ignore // them, because we have already dismissed them (in DestroyOutputs()). for (const auto& surface_at_display : surfaces_at_display_) { size_t index = surface_at_display.second->output_record(); DCHECK_LT(index, output_buffer_map_.size()); OutputRecord& output_record = output_buffer_map_[index]; DCHECK(output_record.at_client); output_record.at_client = false; } surfaces_at_display_.clear(); DCHECK_EQ(free_output_buffers_.size(), output_buffer_map_.size()); free_output_buffers_.clear(); output_buffer_map_.clear(); struct v4l2_requestbuffers reqbufs; memset(&reqbufs, 0, sizeof(reqbufs)); reqbufs.count = 0; reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; reqbufs.memory = V4L2_MEMORY_MMAP; IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_REQBUFS, &reqbufs); return true; } void V4L2SliceVideoDecodeAccelerator::AssignPictureBuffers( const std::vector<PictureBuffer>& buffers) { DVLOGF(3); DCHECK(child_task_runner_->BelongsToCurrentThread()); decoder_thread_task_runner_->PostTask( FROM_HERE, base::Bind(&V4L2SliceVideoDecodeAccelerator::AssignPictureBuffersTask, base::Unretained(this), buffers)); } void V4L2SliceVideoDecodeAccelerator::AssignPictureBuffersTask( const std::vector<PictureBuffer>& buffers) { DVLOGF(3); DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); DCHECK_EQ(state_, kAwaitingPictureBuffers); const uint32_t req_buffer_count = decoder_->GetRequiredNumOfPictures(); if (buffers.size() < req_buffer_count) { DLOG(ERROR) << "Failed to provide requested picture buffers. " << "(Got " << buffers.size() << ", requested " << req_buffer_count << ")"; NOTIFY_ERROR(INVALID_ARGUMENT); return; } // Allocate the output buffers. struct v4l2_requestbuffers reqbufs; memset(&reqbufs, 0, sizeof(reqbufs)); reqbufs.count = buffers.size(); reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; reqbufs.memory = (output_mode_ == Config::OutputMode::ALLOCATE ? V4L2_MEMORY_MMAP : V4L2_MEMORY_DMABUF); IOCTL_OR_ERROR_RETURN(VIDIOC_REQBUFS, &reqbufs); if (reqbufs.count != buffers.size()) { DLOGF(ERROR) << "Could not allocate enough output buffers"; NOTIFY_ERROR(PLATFORM_FAILURE); return; } DCHECK(free_output_buffers_.empty()); DCHECK(output_buffer_map_.empty()); output_buffer_map_.resize(buffers.size()); for (size_t i = 0; i < output_buffer_map_.size(); ++i) { DCHECK(buffers[i].size() == coded_size_); OutputRecord& output_record = output_buffer_map_[i]; DCHECK(!output_record.at_device); DCHECK(!output_record.at_client); DCHECK_EQ(output_record.egl_image, EGL_NO_IMAGE_KHR); DCHECK_EQ(output_record.egl_sync, EGL_NO_SYNC_KHR); DCHECK_EQ(output_record.picture_id, -1); DCHECK(output_record.dmabuf_fds.empty()); DCHECK_EQ(output_record.cleared, false); output_record.picture_id = buffers[i].id(); output_record.texture_id = buffers[i].service_texture_ids().empty() ? 0 : buffers[i].service_texture_ids()[0]; // This will remain true until ImportBufferForPicture is called, either by // the client, or by ourselves, if we are allocating. output_record.at_client = true; if (output_mode_ == Config::OutputMode::ALLOCATE) { std::vector<base::ScopedFD> dmabuf_fds = device_->GetDmabufsForV4L2Buffer( i, output_planes_count_, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); if (dmabuf_fds.empty()) { NOTIFY_ERROR(PLATFORM_FAILURE); return; } auto passed_dmabuf_fds(base::WrapUnique( new std::vector<base::ScopedFD>(std::move(dmabuf_fds)))); ImportBufferForPictureTask(output_record.picture_id, std::move(passed_dmabuf_fds)); } // else we'll get triggered via ImportBufferForPicture() from client. DVLOGF(3) << "buffer[" << i << "]: picture_id=" << output_record.picture_id; } if (!StartDevicePoll()) { NOTIFY_ERROR(PLATFORM_FAILURE); return; } // Put us in kIdle to allow further event processing. // ProcessPendingEventsIfNeeded() will put us back into kDecoding after all // other pending events are processed successfully. state_ = kIdle; ProcessPendingEventsIfNeeded(); } void V4L2SliceVideoDecodeAccelerator::CreateEGLImageFor( size_t buffer_index, int32_t picture_buffer_id, std::unique_ptr<std::vector<base::ScopedFD>> passed_dmabuf_fds, GLuint texture_id, const gfx::Size& size, uint32_t fourcc) { DVLOGF(3) << "index=" << buffer_index; DCHECK(child_task_runner_->BelongsToCurrentThread()); DCHECK_NE(texture_id, 0u); if (get_gl_context_cb_.is_null() || make_context_current_cb_.is_null()) { DLOGF(ERROR) << "GL callbacks required for binding to EGLImages"; NOTIFY_ERROR(INVALID_ARGUMENT); return; } gl::GLContext* gl_context = get_gl_context_cb_.Run(); if (!gl_context || !make_context_current_cb_.Run()) { DLOGF(ERROR) << "No GL context"; NOTIFY_ERROR(PLATFORM_FAILURE); return; } gl::ScopedTextureBinder bind_restore(GL_TEXTURE_EXTERNAL_OES, 0); EGLImageKHR egl_image = device_->CreateEGLImage(egl_display_, gl_context->GetHandle(), texture_id, size, buffer_index, fourcc, *passed_dmabuf_fds); if (egl_image == EGL_NO_IMAGE_KHR) { LOGF(ERROR) << "Could not create EGLImageKHR," << " index=" << buffer_index << " texture_id=" << texture_id; NOTIFY_ERROR(PLATFORM_FAILURE); return; } decoder_thread_task_runner_->PostTask( FROM_HERE, base::Bind(&V4L2SliceVideoDecodeAccelerator::AssignEGLImage, base::Unretained(this), buffer_index, picture_buffer_id, egl_image, base::Passed(&passed_dmabuf_fds))); } void V4L2SliceVideoDecodeAccelerator::AssignEGLImage( size_t buffer_index, int32_t picture_buffer_id, EGLImageKHR egl_image, std::unique_ptr<std::vector<base::ScopedFD>> passed_dmabuf_fds) { DVLOGF(3) << "index=" << buffer_index; DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); // It's possible that while waiting for the EGLImages to be allocated and // assigned, we have already decoded more of the stream and saw another // resolution change. This is a normal situation, in such a case either there // is no output record with this index awaiting an EGLImage to be assigned to // it, or the record is already updated to use a newer PictureBuffer and is // awaiting an EGLImage associated with a different picture_buffer_id. If so, // just discard this image, we will get the one we are waiting for later. if (buffer_index >= output_buffer_map_.size() || output_buffer_map_[buffer_index].picture_id != picture_buffer_id) { DVLOGF(3) << "Picture set already changed, dropping EGLImage"; child_task_runner_->PostTask( FROM_HERE, base::Bind(base::IgnoreResult(&V4L2Device::DestroyEGLImage), device_, egl_display_, egl_image)); return; } OutputRecord& output_record = output_buffer_map_[buffer_index]; DCHECK_EQ(output_record.egl_image, EGL_NO_IMAGE_KHR); DCHECK_EQ(output_record.egl_sync, EGL_NO_SYNC_KHR); DCHECK(!output_record.at_client); DCHECK(!output_record.at_device); output_record.egl_image = egl_image; if (output_mode_ == Config::OutputMode::IMPORT) { DCHECK(output_record.dmabuf_fds.empty()); output_record.dmabuf_fds = std::move(*passed_dmabuf_fds); } DCHECK_EQ(std::count(free_output_buffers_.begin(), free_output_buffers_.end(), buffer_index), 0); free_output_buffers_.push_back(buffer_index); ScheduleDecodeBufferTaskIfNeeded(); } void V4L2SliceVideoDecodeAccelerator::ImportBufferForPicture( int32_t picture_buffer_id, const gfx::GpuMemoryBufferHandle& gpu_memory_buffer_handle) { DVLOGF(3) << "picture_buffer_id=" << picture_buffer_id; DCHECK(child_task_runner_->BelongsToCurrentThread()); auto passed_dmabuf_fds(base::WrapUnique(new std::vector<base::ScopedFD>())); #if defined(USE_OZONE) for (const auto& fd : gpu_memory_buffer_handle.native_pixmap_handle.fds) { DCHECK_NE(fd.fd, -1); passed_dmabuf_fds->push_back(base::ScopedFD(fd.fd)); } #endif if (output_mode_ != Config::OutputMode::IMPORT) { LOGF(ERROR) << "Cannot import in non-import mode"; NOTIFY_ERROR(INVALID_ARGUMENT); return; } decoder_thread_task_runner_->PostTask( FROM_HERE, base::Bind(&V4L2SliceVideoDecodeAccelerator::ImportBufferForPictureTask, base::Unretained(this), picture_buffer_id, base::Passed(&passed_dmabuf_fds))); } void V4L2SliceVideoDecodeAccelerator::ImportBufferForPictureTask( int32_t picture_buffer_id, std::unique_ptr<std::vector<base::ScopedFD>> passed_dmabuf_fds) { DVLOGF(3) << "picture_buffer_id=" << picture_buffer_id; DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); const auto iter = std::find_if(output_buffer_map_.begin(), output_buffer_map_.end(), [picture_buffer_id](const OutputRecord& output_record) { return output_record.picture_id == picture_buffer_id; }); if (iter == output_buffer_map_.end()) { // It's possible that we've already posted a DismissPictureBuffer for this // picture, but it has not yet executed when this ImportBufferForPicture was // posted to us by the client. In that case just ignore this (we've already // dismissed it and accounted for that). DVLOGF(3) << "got picture id=" << picture_buffer_id << " not in use (anymore?)."; return; } if (!iter->at_client) { LOGF(ERROR) << "Cannot import buffer that not owned by client"; NOTIFY_ERROR(INVALID_ARGUMENT); return; } size_t index = iter - output_buffer_map_.begin(); DCHECK_EQ(std::count(free_output_buffers_.begin(), free_output_buffers_.end(), index), 0); DCHECK(!iter->at_device); iter->at_client = false; if (iter->texture_id != 0) { if (iter->egl_image != EGL_NO_IMAGE_KHR) { child_task_runner_->PostTask( FROM_HERE, base::Bind(base::IgnoreResult(&V4L2Device::DestroyEGLImage), device_, egl_display_, iter->egl_image)); } child_task_runner_->PostTask( FROM_HERE, base::Bind(&V4L2SliceVideoDecodeAccelerator::CreateEGLImageFor, weak_this_, index, picture_buffer_id, base::Passed(&passed_dmabuf_fds), iter->texture_id, coded_size_, output_format_fourcc_)); } else { // No need for an EGLImage, start using this buffer now. DCHECK_EQ(output_planes_count_, passed_dmabuf_fds->size()); iter->dmabuf_fds.swap(*passed_dmabuf_fds); free_output_buffers_.push_back(index); ScheduleDecodeBufferTaskIfNeeded(); } } void V4L2SliceVideoDecodeAccelerator::ReusePictureBuffer( int32_t picture_buffer_id) { DCHECK(child_task_runner_->BelongsToCurrentThread()); DVLOGF(4) << "picture_buffer_id=" << picture_buffer_id; std::unique_ptr<EGLSyncKHRRef> egl_sync_ref; if (!make_context_current_cb_.is_null()) { if (!make_context_current_cb_.Run()) { LOGF(ERROR) << "could not make context current"; NOTIFY_ERROR(PLATFORM_FAILURE); return; } EGLSyncKHR egl_sync = eglCreateSyncKHR(egl_display_, EGL_SYNC_FENCE_KHR, NULL); if (egl_sync == EGL_NO_SYNC_KHR) { LOGF(ERROR) << "eglCreateSyncKHR() failed"; NOTIFY_ERROR(PLATFORM_FAILURE); return; } egl_sync_ref.reset(new EGLSyncKHRRef(egl_display_, egl_sync)); } decoder_thread_task_runner_->PostTask( FROM_HERE, base::Bind(&V4L2SliceVideoDecodeAccelerator::ReusePictureBufferTask, base::Unretained(this), picture_buffer_id, base::Passed(&egl_sync_ref))); } void V4L2SliceVideoDecodeAccelerator::ReusePictureBufferTask( int32_t picture_buffer_id, std::unique_ptr<EGLSyncKHRRef> egl_sync_ref) { DVLOGF(3) << "picture_buffer_id=" << picture_buffer_id; DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); V4L2DecodeSurfaceByPictureBufferId::iterator it = surfaces_at_display_.find(picture_buffer_id); if (it == surfaces_at_display_.end()) { // It's possible that we've already posted a DismissPictureBuffer for this // picture, but it has not yet executed when this ReusePictureBuffer was // posted to us by the client. In that case just ignore this (we've already // dismissed it and accounted for that) and let the sync object get // destroyed. DVLOGF(3) << "got picture id=" << picture_buffer_id << " not in use (anymore?)."; return; } OutputRecord& output_record = output_buffer_map_[it->second->output_record()]; if (output_record.at_device || !output_record.at_client) { DVLOGF(1) << "picture_buffer_id not reusable"; NOTIFY_ERROR(INVALID_ARGUMENT); return; } DCHECK_EQ(output_record.egl_sync, EGL_NO_SYNC_KHR); DCHECK(!output_record.at_device); output_record.at_client = false; if (egl_sync_ref) { output_record.egl_sync = egl_sync_ref->egl_sync; // Take ownership of the EGLSync. egl_sync_ref->egl_sync = EGL_NO_SYNC_KHR; } surfaces_at_display_.erase(it); } void V4L2SliceVideoDecodeAccelerator::Flush() { DVLOGF(3); DCHECK(child_task_runner_->BelongsToCurrentThread()); decoder_thread_task_runner_->PostTask( FROM_HERE, base::Bind(&V4L2SliceVideoDecodeAccelerator::FlushTask, base::Unretained(this))); } void V4L2SliceVideoDecodeAccelerator::FlushTask() { DVLOGF(3); DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); // Queue an empty buffer which - when reached - will trigger flush sequence. decoder_input_queue_.push( linked_ptr<BitstreamBufferRef>(new BitstreamBufferRef( decode_client_, decode_task_runner_, nullptr, kFlushBufferId))); ScheduleDecodeBufferTaskIfNeeded(); } void V4L2SliceVideoDecodeAccelerator::InitiateFlush() { DVLOGF(3); DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); // This will trigger output for all remaining surfaces in the decoder. // However, not all of them may be decoded yet (they would be queued // in hardware then). if (!decoder_->Flush()) { DVLOGF(1) << "Failed flushing the decoder."; NOTIFY_ERROR(PLATFORM_FAILURE); return; } // Put the decoder in an idle state, ready to resume. decoder_->Reset(); DCHECK(!decoder_flushing_); decoder_flushing_ = true; NewEventPending(); } bool V4L2SliceVideoDecodeAccelerator::FinishFlush() { DVLOGF(3); DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); if (!decoder_flushing_) return true; if (!surfaces_at_device_.empty()) return false; DCHECK_EQ(state_, kIdle); // At this point, all remaining surfaces are decoded and dequeued, and since // we have already scheduled output for them in InitiateFlush(), their // respective PictureReady calls have been posted (or they have been queued on // pending_picture_ready_). So at this time, once we SendPictureReady(), // we will have all remaining PictureReady() posted to the client and we // can post NotifyFlushDone(). DCHECK(decoder_display_queue_.empty()); // Decoder should have already returned all surfaces and all surfaces are // out of hardware. There can be no other owners of input buffers. DCHECK_EQ(free_input_buffers_.size(), input_buffer_map_.size()); SendPictureReady(); decoder_flushing_ = false; DVLOGF(3) << "Flush finished"; child_task_runner_->PostTask(FROM_HERE, base::Bind(&Client::NotifyFlushDone, client_)); return true; } void V4L2SliceVideoDecodeAccelerator::Reset() { DVLOGF(3); DCHECK(child_task_runner_->BelongsToCurrentThread()); decoder_thread_task_runner_->PostTask( FROM_HERE, base::Bind(&V4L2SliceVideoDecodeAccelerator::ResetTask, base::Unretained(this))); } void V4L2SliceVideoDecodeAccelerator::ResetTask() { DVLOGF(3); DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); if (decoder_resetting_) { // This is a bug in the client, multiple Reset()s before NotifyResetDone() // are not allowed. NOTREACHED() << "Client should not be requesting multiple Reset()s"; return; } // Put the decoder in an idle state, ready to resume. decoder_->Reset(); // Drop all remaining inputs. decoder_current_bitstream_buffer_.reset(); while (!decoder_input_queue_.empty()) decoder_input_queue_.pop(); decoder_resetting_ = true; NewEventPending(); } bool V4L2SliceVideoDecodeAccelerator::FinishReset() { DVLOGF(3); DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); if (!decoder_resetting_) return true; if (!surfaces_at_device_.empty()) return false; DCHECK_EQ(state_, kIdle); DCHECK(!decoder_flushing_); SendPictureReady(); // Drop any pending outputs. while (!decoder_display_queue_.empty()) decoder_display_queue_.pop(); // At this point we can have no input buffers in the decoder, because we // Reset()ed it in ResetTask(), and have not scheduled any new Decode()s // having been in kIdle since. We don't have any surfaces in the HW either - // we just checked that surfaces_at_device_.empty(), and inputs are tied // to surfaces. Since there can be no other owners of input buffers, we can // simply mark them all as available. DCHECK_EQ(input_buffer_queued_count_, 0); free_input_buffers_.clear(); for (size_t i = 0; i < input_buffer_map_.size(); ++i) { DCHECK(!input_buffer_map_[i].at_device); ReuseInputBuffer(i); } decoder_resetting_ = false; DVLOGF(3) << "Reset finished"; child_task_runner_->PostTask(FROM_HERE, base::Bind(&Client::NotifyResetDone, client_)); return true; } void V4L2SliceVideoDecodeAccelerator::SetErrorState(Error error) { // We can touch decoder_state_ only if this is the decoder thread or the // decoder thread isn't running. if (decoder_thread_.IsRunning() && !decoder_thread_task_runner_->BelongsToCurrentThread()) { decoder_thread_task_runner_->PostTask( FROM_HERE, base::Bind(&V4L2SliceVideoDecodeAccelerator::SetErrorState, base::Unretained(this), error)); return; } // Post NotifyError only if we are already initialized, as the API does // not allow doing so before that. if (state_ != kError && state_ != kUninitialized) NotifyError(error); state_ = kError; } V4L2SliceVideoDecodeAccelerator::V4L2H264Accelerator::V4L2H264Accelerator( V4L2SliceVideoDecodeAccelerator* v4l2_dec) : num_slices_(0), v4l2_dec_(v4l2_dec) { DCHECK(v4l2_dec_); } V4L2SliceVideoDecodeAccelerator::V4L2H264Accelerator::~V4L2H264Accelerator() {} scoped_refptr<H264Picture> V4L2SliceVideoDecodeAccelerator::V4L2H264Accelerator::CreateH264Picture() { scoped_refptr<V4L2DecodeSurface> dec_surface = v4l2_dec_->CreateSurface(); if (!dec_surface) return nullptr; return new V4L2H264Picture(dec_surface); } void V4L2SliceVideoDecodeAccelerator::V4L2H264Accelerator:: H264PictureListToDPBIndicesList(const H264Picture::Vector& src_pic_list, uint8_t dst_list[kDPBIndicesListSize]) { size_t i; for (i = 0; i < src_pic_list.size() && i < kDPBIndicesListSize; ++i) { const scoped_refptr<H264Picture>& pic = src_pic_list[i]; dst_list[i] = pic ? pic->dpb_position : VIDEO_MAX_FRAME; } while (i < kDPBIndicesListSize) dst_list[i++] = VIDEO_MAX_FRAME; } void V4L2SliceVideoDecodeAccelerator::V4L2H264Accelerator::H264DPBToV4L2DPB( const H264DPB& dpb, std::vector<scoped_refptr<V4L2DecodeSurface>>* ref_surfaces) { memset(v4l2_decode_param_.dpb, 0, sizeof(v4l2_decode_param_.dpb)); size_t i = 0; for (const auto& pic : dpb) { if (i >= arraysize(v4l2_decode_param_.dpb)) { DVLOGF(1) << "Invalid DPB size"; break; } int index = VIDEO_MAX_FRAME; if (!pic->nonexisting) { scoped_refptr<V4L2DecodeSurface> dec_surface = H264PictureToV4L2DecodeSurface(pic); index = dec_surface->output_record(); ref_surfaces->push_back(dec_surface); } struct v4l2_h264_dpb_entry& entry = v4l2_decode_param_.dpb[i++]; entry.buf_index = index; entry.frame_num = pic->frame_num; entry.pic_num = pic->pic_num; entry.top_field_order_cnt = pic->top_field_order_cnt; entry.bottom_field_order_cnt = pic->bottom_field_order_cnt; entry.flags = (pic->ref ? V4L2_H264_DPB_ENTRY_FLAG_ACTIVE : 0) | (pic->long_term ? V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM : 0); } } bool V4L2SliceVideoDecodeAccelerator::V4L2H264Accelerator::SubmitFrameMetadata( const H264SPS* sps, const H264PPS* pps, const H264DPB& dpb, const H264Picture::Vector& ref_pic_listp0, const H264Picture::Vector& ref_pic_listb0, const H264Picture::Vector& ref_pic_listb1, const scoped_refptr<H264Picture>& pic) { struct v4l2_ext_control ctrl; std::vector<struct v4l2_ext_control> ctrls; struct v4l2_ctrl_h264_sps v4l2_sps; memset(&v4l2_sps, 0, sizeof(v4l2_sps)); v4l2_sps.constraint_set_flags = (sps->constraint_set0_flag ? V4L2_H264_SPS_CONSTRAINT_SET0_FLAG : 0) | (sps->constraint_set1_flag ? V4L2_H264_SPS_CONSTRAINT_SET1_FLAG : 0) | (sps->constraint_set2_flag ? V4L2_H264_SPS_CONSTRAINT_SET2_FLAG : 0) | (sps->constraint_set3_flag ? V4L2_H264_SPS_CONSTRAINT_SET3_FLAG : 0) | (sps->constraint_set4_flag ? V4L2_H264_SPS_CONSTRAINT_SET4_FLAG : 0) | (sps->constraint_set5_flag ? V4L2_H264_SPS_CONSTRAINT_SET5_FLAG : 0); #define SPS_TO_V4L2SPS(a) v4l2_sps.a = sps->a SPS_TO_V4L2SPS(profile_idc); SPS_TO_V4L2SPS(level_idc); SPS_TO_V4L2SPS(seq_parameter_set_id); SPS_TO_V4L2SPS(chroma_format_idc); SPS_TO_V4L2SPS(bit_depth_luma_minus8); SPS_TO_V4L2SPS(bit_depth_chroma_minus8); SPS_TO_V4L2SPS(log2_max_frame_num_minus4); SPS_TO_V4L2SPS(pic_order_cnt_type); SPS_TO_V4L2SPS(log2_max_pic_order_cnt_lsb_minus4); SPS_TO_V4L2SPS(offset_for_non_ref_pic); SPS_TO_V4L2SPS(offset_for_top_to_bottom_field); SPS_TO_V4L2SPS(num_ref_frames_in_pic_order_cnt_cycle); static_assert(arraysize(v4l2_sps.offset_for_ref_frame) == arraysize(sps->offset_for_ref_frame), "offset_for_ref_frame arrays must be same size"); for (size_t i = 0; i < arraysize(v4l2_sps.offset_for_ref_frame); ++i) v4l2_sps.offset_for_ref_frame[i] = sps->offset_for_ref_frame[i]; SPS_TO_V4L2SPS(max_num_ref_frames); SPS_TO_V4L2SPS(pic_width_in_mbs_minus1); SPS_TO_V4L2SPS(pic_height_in_map_units_minus1); #undef SPS_TO_V4L2SPS #define SET_V4L2_SPS_FLAG_IF(cond, flag) \ v4l2_sps.flags |= ((sps->cond) ? (flag) : 0) SET_V4L2_SPS_FLAG_IF(separate_colour_plane_flag, V4L2_H264_SPS_FLAG_SEPARATE_COLOUR_PLANE); SET_V4L2_SPS_FLAG_IF(qpprime_y_zero_transform_bypass_flag, V4L2_H264_SPS_FLAG_QPPRIME_Y_ZERO_TRANSFORM_BYPASS); SET_V4L2_SPS_FLAG_IF(delta_pic_order_always_zero_flag, V4L2_H264_SPS_FLAG_DELTA_PIC_ORDER_ALWAYS_ZERO); SET_V4L2_SPS_FLAG_IF(gaps_in_frame_num_value_allowed_flag, V4L2_H264_SPS_FLAG_GAPS_IN_FRAME_NUM_VALUE_ALLOWED); SET_V4L2_SPS_FLAG_IF(frame_mbs_only_flag, V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY); SET_V4L2_SPS_FLAG_IF(mb_adaptive_frame_field_flag, V4L2_H264_SPS_FLAG_MB_ADAPTIVE_FRAME_FIELD); SET_V4L2_SPS_FLAG_IF(direct_8x8_inference_flag, V4L2_H264_SPS_FLAG_DIRECT_8X8_INFERENCE); #undef SET_V4L2_SPS_FLAG_IF memset(&ctrl, 0, sizeof(ctrl)); ctrl.id = V4L2_CID_MPEG_VIDEO_H264_SPS; ctrl.size = sizeof(v4l2_sps); ctrl.p_h264_sps = &v4l2_sps; ctrls.push_back(ctrl); struct v4l2_ctrl_h264_pps v4l2_pps; memset(&v4l2_pps, 0, sizeof(v4l2_pps)); #define PPS_TO_V4L2PPS(a) v4l2_pps.a = pps->a PPS_TO_V4L2PPS(pic_parameter_set_id); PPS_TO_V4L2PPS(seq_parameter_set_id); PPS_TO_V4L2PPS(num_slice_groups_minus1); PPS_TO_V4L2PPS(num_ref_idx_l0_default_active_minus1); PPS_TO_V4L2PPS(num_ref_idx_l1_default_active_minus1); PPS_TO_V4L2PPS(weighted_bipred_idc); PPS_TO_V4L2PPS(pic_init_qp_minus26); PPS_TO_V4L2PPS(pic_init_qs_minus26); PPS_TO_V4L2PPS(chroma_qp_index_offset); PPS_TO_V4L2PPS(second_chroma_qp_index_offset); #undef PPS_TO_V4L2PPS #define SET_V4L2_PPS_FLAG_IF(cond, flag) \ v4l2_pps.flags |= ((pps->cond) ? (flag) : 0) SET_V4L2_PPS_FLAG_IF(entropy_coding_mode_flag, V4L2_H264_PPS_FLAG_ENTROPY_CODING_MODE); SET_V4L2_PPS_FLAG_IF( bottom_field_pic_order_in_frame_present_flag, V4L2_H264_PPS_FLAG_BOTTOM_FIELD_PIC_ORDER_IN_FRAME_PRESENT); SET_V4L2_PPS_FLAG_IF(weighted_pred_flag, V4L2_H264_PPS_FLAG_WEIGHTED_PRED); SET_V4L2_PPS_FLAG_IF(deblocking_filter_control_present_flag, V4L2_H264_PPS_FLAG_DEBLOCKING_FILTER_CONTROL_PRESENT); SET_V4L2_PPS_FLAG_IF(constrained_intra_pred_flag, V4L2_H264_PPS_FLAG_CONSTRAINED_INTRA_PRED); SET_V4L2_PPS_FLAG_IF(redundant_pic_cnt_present_flag, V4L2_H264_PPS_FLAG_REDUNDANT_PIC_CNT_PRESENT); SET_V4L2_PPS_FLAG_IF(transform_8x8_mode_flag, V4L2_H264_PPS_FLAG_TRANSFORM_8X8_MODE); SET_V4L2_PPS_FLAG_IF(pic_scaling_matrix_present_flag, V4L2_H264_PPS_FLAG_PIC_SCALING_MATRIX_PRESENT); #undef SET_V4L2_PPS_FLAG_IF memset(&ctrl, 0, sizeof(ctrl)); ctrl.id = V4L2_CID_MPEG_VIDEO_H264_PPS; ctrl.size = sizeof(v4l2_pps); ctrl.p_h264_pps = &v4l2_pps; ctrls.push_back(ctrl); struct v4l2_ctrl_h264_scaling_matrix v4l2_scaling_matrix; memset(&v4l2_scaling_matrix, 0, sizeof(v4l2_scaling_matrix)); static_assert(arraysize(v4l2_scaling_matrix.scaling_list_4x4) <= arraysize(pps->scaling_list4x4) && arraysize(v4l2_scaling_matrix.scaling_list_4x4[0]) <= arraysize(pps->scaling_list4x4[0]) && arraysize(v4l2_scaling_matrix.scaling_list_8x8) <= arraysize(pps->scaling_list8x8) && arraysize(v4l2_scaling_matrix.scaling_list_8x8[0]) <= arraysize(pps->scaling_list8x8[0]), "scaling_lists must be of correct size"); static_assert(arraysize(v4l2_scaling_matrix.scaling_list_4x4) <= arraysize(sps->scaling_list4x4) && arraysize(v4l2_scaling_matrix.scaling_list_4x4[0]) <= arraysize(sps->scaling_list4x4[0]) && arraysize(v4l2_scaling_matrix.scaling_list_8x8) <= arraysize(sps->scaling_list8x8) && arraysize(v4l2_scaling_matrix.scaling_list_8x8[0]) <= arraysize(sps->scaling_list8x8[0]), "scaling_lists must be of correct size"); const auto* scaling_list4x4 = &sps->scaling_list4x4[0]; const auto* scaling_list8x8 = &sps->scaling_list8x8[0]; if (pps->pic_scaling_matrix_present_flag) { scaling_list4x4 = &pps->scaling_list4x4[0]; scaling_list8x8 = &pps->scaling_list8x8[0]; } for (size_t i = 0; i < arraysize(v4l2_scaling_matrix.scaling_list_4x4); ++i) { for (size_t j = 0; j < arraysize(v4l2_scaling_matrix.scaling_list_4x4[i]); ++j) { v4l2_scaling_matrix.scaling_list_4x4[i][j] = scaling_list4x4[i][j]; } } for (size_t i = 0; i < arraysize(v4l2_scaling_matrix.scaling_list_8x8); ++i) { for (size_t j = 0; j < arraysize(v4l2_scaling_matrix.scaling_list_8x8[i]); ++j) { v4l2_scaling_matrix.scaling_list_8x8[i][j] = scaling_list8x8[i][j]; } } memset(&ctrl, 0, sizeof(ctrl)); ctrl.id = V4L2_CID_MPEG_VIDEO_H264_SCALING_MATRIX; ctrl.size = sizeof(v4l2_scaling_matrix); ctrl.p_h264_scal_mtrx = &v4l2_scaling_matrix; ctrls.push_back(ctrl); scoped_refptr<V4L2DecodeSurface> dec_surface = H264PictureToV4L2DecodeSurface(pic); struct v4l2_ext_controls ext_ctrls; memset(&ext_ctrls, 0, sizeof(ext_ctrls)); ext_ctrls.count = ctrls.size(); ext_ctrls.controls = &ctrls[0]; ext_ctrls.config_store = dec_surface->config_store(); v4l2_dec_->SubmitExtControls(&ext_ctrls); H264PictureListToDPBIndicesList(ref_pic_listp0, v4l2_decode_param_.ref_pic_list_p0); H264PictureListToDPBIndicesList(ref_pic_listb0, v4l2_decode_param_.ref_pic_list_b0); H264PictureListToDPBIndicesList(ref_pic_listb1, v4l2_decode_param_.ref_pic_list_b1); std::vector<scoped_refptr<V4L2DecodeSurface>> ref_surfaces; H264DPBToV4L2DPB(dpb, &ref_surfaces); dec_surface->SetReferenceSurfaces(ref_surfaces); return true; } bool V4L2SliceVideoDecodeAccelerator::V4L2H264Accelerator::SubmitSlice( const H264PPS* pps, const H264SliceHeader* slice_hdr, const H264Picture::Vector& ref_pic_list0, const H264Picture::Vector& ref_pic_list1, const scoped_refptr<H264Picture>& pic, const uint8_t* data, size_t size) { if (num_slices_ == kMaxSlices) { LOGF(ERROR) << "Over limit of supported slices per frame"; return false; } struct v4l2_ctrl_h264_slice_param& v4l2_slice_param = v4l2_slice_params_[num_slices_++]; memset(&v4l2_slice_param, 0, sizeof(v4l2_slice_param)); v4l2_slice_param.size = size; #define SHDR_TO_V4L2SPARM(a) v4l2_slice_param.a = slice_hdr->a SHDR_TO_V4L2SPARM(header_bit_size); SHDR_TO_V4L2SPARM(first_mb_in_slice); SHDR_TO_V4L2SPARM(slice_type); SHDR_TO_V4L2SPARM(pic_parameter_set_id); SHDR_TO_V4L2SPARM(colour_plane_id); SHDR_TO_V4L2SPARM(frame_num); SHDR_TO_V4L2SPARM(idr_pic_id); SHDR_TO_V4L2SPARM(pic_order_cnt_lsb); SHDR_TO_V4L2SPARM(delta_pic_order_cnt_bottom); SHDR_TO_V4L2SPARM(delta_pic_order_cnt0); SHDR_TO_V4L2SPARM(delta_pic_order_cnt1); SHDR_TO_V4L2SPARM(redundant_pic_cnt); SHDR_TO_V4L2SPARM(dec_ref_pic_marking_bit_size); SHDR_TO_V4L2SPARM(cabac_init_idc); SHDR_TO_V4L2SPARM(slice_qp_delta); SHDR_TO_V4L2SPARM(slice_qs_delta); SHDR_TO_V4L2SPARM(disable_deblocking_filter_idc); SHDR_TO_V4L2SPARM(slice_alpha_c0_offset_div2); SHDR_TO_V4L2SPARM(slice_beta_offset_div2); SHDR_TO_V4L2SPARM(num_ref_idx_l0_active_minus1); SHDR_TO_V4L2SPARM(num_ref_idx_l1_active_minus1); SHDR_TO_V4L2SPARM(pic_order_cnt_bit_size); #undef SHDR_TO_V4L2SPARM #define SET_V4L2_SPARM_FLAG_IF(cond, flag) \ v4l2_slice_param.flags |= ((slice_hdr->cond) ? (flag) : 0) SET_V4L2_SPARM_FLAG_IF(field_pic_flag, V4L2_SLICE_FLAG_FIELD_PIC); SET_V4L2_SPARM_FLAG_IF(bottom_field_flag, V4L2_SLICE_FLAG_BOTTOM_FIELD); SET_V4L2_SPARM_FLAG_IF(direct_spatial_mv_pred_flag, V4L2_SLICE_FLAG_DIRECT_SPATIAL_MV_PRED); SET_V4L2_SPARM_FLAG_IF(sp_for_switch_flag, V4L2_SLICE_FLAG_SP_FOR_SWITCH); #undef SET_V4L2_SPARM_FLAG_IF struct v4l2_h264_pred_weight_table* pred_weight_table = &v4l2_slice_param.pred_weight_table; if (((slice_hdr->IsPSlice() || slice_hdr->IsSPSlice()) && pps->weighted_pred_flag) || (slice_hdr->IsBSlice() && pps->weighted_bipred_idc == 1)) { pred_weight_table->luma_log2_weight_denom = slice_hdr->luma_log2_weight_denom; pred_weight_table->chroma_log2_weight_denom = slice_hdr->chroma_log2_weight_denom; struct v4l2_h264_weight_factors* factorsl0 = &pred_weight_table->weight_factors[0]; for (int i = 0; i < 32; ++i) { factorsl0->luma_weight[i] = slice_hdr->pred_weight_table_l0.luma_weight[i]; factorsl0->luma_offset[i] = slice_hdr->pred_weight_table_l0.luma_offset[i]; for (int j = 0; j < 2; ++j) { factorsl0->chroma_weight[i][j] = slice_hdr->pred_weight_table_l0.chroma_weight[i][j]; factorsl0->chroma_offset[i][j] = slice_hdr->pred_weight_table_l0.chroma_offset[i][j]; } } if (slice_hdr->IsBSlice()) { struct v4l2_h264_weight_factors* factorsl1 = &pred_weight_table->weight_factors[1]; for (int i = 0; i < 32; ++i) { factorsl1->luma_weight[i] = slice_hdr->pred_weight_table_l1.luma_weight[i]; factorsl1->luma_offset[i] = slice_hdr->pred_weight_table_l1.luma_offset[i]; for (int j = 0; j < 2; ++j) { factorsl1->chroma_weight[i][j] = slice_hdr->pred_weight_table_l1.chroma_weight[i][j]; factorsl1->chroma_offset[i][j] = slice_hdr->pred_weight_table_l1.chroma_offset[i][j]; } } } } H264PictureListToDPBIndicesList(ref_pic_list0, v4l2_slice_param.ref_pic_list0); H264PictureListToDPBIndicesList(ref_pic_list1, v4l2_slice_param.ref_pic_list1); scoped_refptr<V4L2DecodeSurface> dec_surface = H264PictureToV4L2DecodeSurface(pic); v4l2_decode_param_.nal_ref_idc = slice_hdr->nal_ref_idc; // TODO(posciak): Don't add start code back here, but have it passed from // the parser. size_t data_copy_size = size + 3; std::unique_ptr<uint8_t[]> data_copy(new uint8_t[data_copy_size]); memset(data_copy.get(), 0, data_copy_size); data_copy[2] = 0x01; memcpy(data_copy.get() + 3, data, size); return v4l2_dec_->SubmitSlice(dec_surface->input_record(), data_copy.get(), data_copy_size); } bool V4L2SliceVideoDecodeAccelerator::SubmitSlice(int index, const uint8_t* data, size_t size) { DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); InputRecord& input_record = input_buffer_map_[index]; if (input_record.bytes_used + size > input_record.length) { DVLOGF(1) << "Input buffer too small"; return false; } memcpy(static_cast<uint8_t*>(input_record.address) + input_record.bytes_used, data, size); input_record.bytes_used += size; return true; } bool V4L2SliceVideoDecodeAccelerator::SubmitExtControls( struct v4l2_ext_controls* ext_ctrls) { DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); DCHECK_GT(ext_ctrls->config_store, 0u); IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_S_EXT_CTRLS, ext_ctrls); return true; } bool V4L2SliceVideoDecodeAccelerator::GetExtControls( struct v4l2_ext_controls* ext_ctrls) { DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); DCHECK_GT(ext_ctrls->config_store, 0u); IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_G_EXT_CTRLS, ext_ctrls); return true; } bool V4L2SliceVideoDecodeAccelerator::IsCtrlExposed(uint32_t ctrl_id) { struct v4l2_queryctrl query_ctrl; memset(&query_ctrl, 0, sizeof(query_ctrl)); query_ctrl.id = ctrl_id; return (device_->Ioctl(VIDIOC_QUERYCTRL, &query_ctrl) == 0); } bool V4L2SliceVideoDecodeAccelerator::V4L2H264Accelerator::SubmitDecode( const scoped_refptr<H264Picture>& pic) { scoped_refptr<V4L2DecodeSurface> dec_surface = H264PictureToV4L2DecodeSurface(pic); v4l2_decode_param_.num_slices = num_slices_; v4l2_decode_param_.idr_pic_flag = pic->idr; v4l2_decode_param_.top_field_order_cnt = pic->top_field_order_cnt; v4l2_decode_param_.bottom_field_order_cnt = pic->bottom_field_order_cnt; struct v4l2_ext_control ctrl; std::vector<struct v4l2_ext_control> ctrls; memset(&ctrl, 0, sizeof(ctrl)); ctrl.id = V4L2_CID_MPEG_VIDEO_H264_SLICE_PARAM; ctrl.size = sizeof(v4l2_slice_params_); ctrl.p_h264_slice_param = v4l2_slice_params_; ctrls.push_back(ctrl); memset(&ctrl, 0, sizeof(ctrl)); ctrl.id = V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAM; ctrl.size = sizeof(v4l2_decode_param_); ctrl.p_h264_decode_param = &v4l2_decode_param_; ctrls.push_back(ctrl); struct v4l2_ext_controls ext_ctrls; memset(&ext_ctrls, 0, sizeof(ext_ctrls)); ext_ctrls.count = ctrls.size(); ext_ctrls.controls = &ctrls[0]; ext_ctrls.config_store = dec_surface->config_store(); if (!v4l2_dec_->SubmitExtControls(&ext_ctrls)) return false; Reset(); v4l2_dec_->DecodeSurface(dec_surface); return true; } bool V4L2SliceVideoDecodeAccelerator::V4L2H264Accelerator::OutputPicture( const scoped_refptr<H264Picture>& pic) { scoped_refptr<V4L2DecodeSurface> dec_surface = H264PictureToV4L2DecodeSurface(pic); dec_surface->set_visible_rect(pic->visible_rect); v4l2_dec_->SurfaceReady(dec_surface); return true; } void V4L2SliceVideoDecodeAccelerator::V4L2H264Accelerator::Reset() { num_slices_ = 0; memset(&v4l2_decode_param_, 0, sizeof(v4l2_decode_param_)); memset(&v4l2_slice_params_, 0, sizeof(v4l2_slice_params_)); } scoped_refptr<V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface> V4L2SliceVideoDecodeAccelerator::V4L2H264Accelerator:: H264PictureToV4L2DecodeSurface(const scoped_refptr<H264Picture>& pic) { V4L2H264Picture* v4l2_pic = pic->AsV4L2H264Picture(); CHECK(v4l2_pic); return v4l2_pic->dec_surface(); } V4L2SliceVideoDecodeAccelerator::V4L2VP8Accelerator::V4L2VP8Accelerator( V4L2SliceVideoDecodeAccelerator* v4l2_dec) : v4l2_dec_(v4l2_dec) { DCHECK(v4l2_dec_); } V4L2SliceVideoDecodeAccelerator::V4L2VP8Accelerator::~V4L2VP8Accelerator() {} scoped_refptr<VP8Picture> V4L2SliceVideoDecodeAccelerator::V4L2VP8Accelerator::CreateVP8Picture() { scoped_refptr<V4L2DecodeSurface> dec_surface = v4l2_dec_->CreateSurface(); if (!dec_surface) return nullptr; return new V4L2VP8Picture(dec_surface); } #define ARRAY_MEMCPY_CHECKED(to, from) \ do { \ static_assert(sizeof(to) == sizeof(from), \ #from " and " #to " arrays must be of same size"); \ memcpy(to, from, sizeof(to)); \ } while (0) static void FillV4L2SegmentationHeader( const Vp8SegmentationHeader& vp8_sgmnt_hdr, struct v4l2_vp8_sgmnt_hdr* v4l2_sgmnt_hdr) { #define SET_V4L2_SGMNT_HDR_FLAG_IF(cond, flag) \ v4l2_sgmnt_hdr->flags |= ((vp8_sgmnt_hdr.cond) ? (flag) : 0) SET_V4L2_SGMNT_HDR_FLAG_IF(segmentation_enabled, V4L2_VP8_SEGMNT_HDR_FLAG_ENABLED); SET_V4L2_SGMNT_HDR_FLAG_IF(update_mb_segmentation_map, V4L2_VP8_SEGMNT_HDR_FLAG_UPDATE_MAP); SET_V4L2_SGMNT_HDR_FLAG_IF(update_segment_feature_data, V4L2_VP8_SEGMNT_HDR_FLAG_UPDATE_FEATURE_DATA); #undef SET_V4L2_SPARM_FLAG_IF v4l2_sgmnt_hdr->segment_feature_mode = vp8_sgmnt_hdr.segment_feature_mode; ARRAY_MEMCPY_CHECKED(v4l2_sgmnt_hdr->quant_update, vp8_sgmnt_hdr.quantizer_update_value); ARRAY_MEMCPY_CHECKED(v4l2_sgmnt_hdr->lf_update, vp8_sgmnt_hdr.lf_update_value); ARRAY_MEMCPY_CHECKED(v4l2_sgmnt_hdr->segment_probs, vp8_sgmnt_hdr.segment_prob); } static void FillV4L2LoopfilterHeader( const Vp8LoopFilterHeader& vp8_loopfilter_hdr, struct v4l2_vp8_loopfilter_hdr* v4l2_lf_hdr) { #define SET_V4L2_LF_HDR_FLAG_IF(cond, flag) \ v4l2_lf_hdr->flags |= ((vp8_loopfilter_hdr.cond) ? (flag) : 0) SET_V4L2_LF_HDR_FLAG_IF(loop_filter_adj_enable, V4L2_VP8_LF_HDR_ADJ_ENABLE); SET_V4L2_LF_HDR_FLAG_IF(mode_ref_lf_delta_update, V4L2_VP8_LF_HDR_DELTA_UPDATE); #undef SET_V4L2_SGMNT_HDR_FLAG_IF #define LF_HDR_TO_V4L2_LF_HDR(a) v4l2_lf_hdr->a = vp8_loopfilter_hdr.a; LF_HDR_TO_V4L2_LF_HDR(type); LF_HDR_TO_V4L2_LF_HDR(level); LF_HDR_TO_V4L2_LF_HDR(sharpness_level); #undef LF_HDR_TO_V4L2_LF_HDR ARRAY_MEMCPY_CHECKED(v4l2_lf_hdr->ref_frm_delta_magnitude, vp8_loopfilter_hdr.ref_frame_delta); ARRAY_MEMCPY_CHECKED(v4l2_lf_hdr->mb_mode_delta_magnitude, vp8_loopfilter_hdr.mb_mode_delta); } static void FillV4L2QuantizationHeader( const Vp8QuantizationHeader& vp8_quant_hdr, struct v4l2_vp8_quantization_hdr* v4l2_quant_hdr) { v4l2_quant_hdr->y_ac_qi = vp8_quant_hdr.y_ac_qi; v4l2_quant_hdr->y_dc_delta = vp8_quant_hdr.y_dc_delta; v4l2_quant_hdr->y2_dc_delta = vp8_quant_hdr.y2_dc_delta; v4l2_quant_hdr->y2_ac_delta = vp8_quant_hdr.y2_ac_delta; v4l2_quant_hdr->uv_dc_delta = vp8_quant_hdr.uv_dc_delta; v4l2_quant_hdr->uv_ac_delta = vp8_quant_hdr.uv_ac_delta; } static void FillV4L2Vp8EntropyHeader( const Vp8EntropyHeader& vp8_entropy_hdr, struct v4l2_vp8_entropy_hdr* v4l2_entropy_hdr) { ARRAY_MEMCPY_CHECKED(v4l2_entropy_hdr->coeff_probs, vp8_entropy_hdr.coeff_probs); ARRAY_MEMCPY_CHECKED(v4l2_entropy_hdr->y_mode_probs, vp8_entropy_hdr.y_mode_probs); ARRAY_MEMCPY_CHECKED(v4l2_entropy_hdr->uv_mode_probs, vp8_entropy_hdr.uv_mode_probs); ARRAY_MEMCPY_CHECKED(v4l2_entropy_hdr->mv_probs, vp8_entropy_hdr.mv_probs); } bool V4L2SliceVideoDecodeAccelerator::V4L2VP8Accelerator::SubmitDecode( const scoped_refptr<VP8Picture>& pic, const Vp8FrameHeader* frame_hdr, const scoped_refptr<VP8Picture>& last_frame, const scoped_refptr<VP8Picture>& golden_frame, const scoped_refptr<VP8Picture>& alt_frame) { struct v4l2_ctrl_vp8_frame_hdr v4l2_frame_hdr; memset(&v4l2_frame_hdr, 0, sizeof(v4l2_frame_hdr)); #define FHDR_TO_V4L2_FHDR(a) v4l2_frame_hdr.a = frame_hdr->a FHDR_TO_V4L2_FHDR(key_frame); FHDR_TO_V4L2_FHDR(version); FHDR_TO_V4L2_FHDR(width); FHDR_TO_V4L2_FHDR(horizontal_scale); FHDR_TO_V4L2_FHDR(height); FHDR_TO_V4L2_FHDR(vertical_scale); FHDR_TO_V4L2_FHDR(sign_bias_golden); FHDR_TO_V4L2_FHDR(sign_bias_alternate); FHDR_TO_V4L2_FHDR(prob_skip_false); FHDR_TO_V4L2_FHDR(prob_intra); FHDR_TO_V4L2_FHDR(prob_last); FHDR_TO_V4L2_FHDR(prob_gf); FHDR_TO_V4L2_FHDR(bool_dec_range); FHDR_TO_V4L2_FHDR(bool_dec_value); FHDR_TO_V4L2_FHDR(bool_dec_count); #undef FHDR_TO_V4L2_FHDR #define SET_V4L2_FRM_HDR_FLAG_IF(cond, flag) \ v4l2_frame_hdr.flags |= ((frame_hdr->cond) ? (flag) : 0) SET_V4L2_FRM_HDR_FLAG_IF(is_experimental, V4L2_VP8_FRAME_HDR_FLAG_EXPERIMENTAL); SET_V4L2_FRM_HDR_FLAG_IF(show_frame, V4L2_VP8_FRAME_HDR_FLAG_SHOW_FRAME); SET_V4L2_FRM_HDR_FLAG_IF(mb_no_skip_coeff, V4L2_VP8_FRAME_HDR_FLAG_MB_NO_SKIP_COEFF); #undef SET_V4L2_FRM_HDR_FLAG_IF FillV4L2SegmentationHeader(frame_hdr->segmentation_hdr, &v4l2_frame_hdr.sgmnt_hdr); FillV4L2LoopfilterHeader(frame_hdr->loopfilter_hdr, &v4l2_frame_hdr.lf_hdr); FillV4L2QuantizationHeader(frame_hdr->quantization_hdr, &v4l2_frame_hdr.quant_hdr); FillV4L2Vp8EntropyHeader(frame_hdr->entropy_hdr, &v4l2_frame_hdr.entropy_hdr); v4l2_frame_hdr.first_part_size = base::checked_cast<__u32>(frame_hdr->first_part_size); v4l2_frame_hdr.first_part_offset = base::checked_cast<__u32>(frame_hdr->first_part_offset); v4l2_frame_hdr.macroblock_bit_offset = base::checked_cast<__u32>(frame_hdr->macroblock_bit_offset); v4l2_frame_hdr.num_dct_parts = frame_hdr->num_of_dct_partitions; static_assert(arraysize(v4l2_frame_hdr.dct_part_sizes) == arraysize(frame_hdr->dct_partition_sizes), "DCT partition size arrays must have equal number of elements"); for (size_t i = 0; i < frame_hdr->num_of_dct_partitions && i < arraysize(v4l2_frame_hdr.dct_part_sizes); ++i) v4l2_frame_hdr.dct_part_sizes[i] = frame_hdr->dct_partition_sizes[i]; scoped_refptr<V4L2DecodeSurface> dec_surface = VP8PictureToV4L2DecodeSurface(pic); std::vector<scoped_refptr<V4L2DecodeSurface>> ref_surfaces; if (last_frame) { scoped_refptr<V4L2DecodeSurface> last_frame_surface = VP8PictureToV4L2DecodeSurface(last_frame); v4l2_frame_hdr.last_frame = last_frame_surface->output_record(); ref_surfaces.push_back(last_frame_surface); } else { v4l2_frame_hdr.last_frame = VIDEO_MAX_FRAME; } if (golden_frame) { scoped_refptr<V4L2DecodeSurface> golden_frame_surface = VP8PictureToV4L2DecodeSurface(golden_frame); v4l2_frame_hdr.golden_frame = golden_frame_surface->output_record(); ref_surfaces.push_back(golden_frame_surface); } else { v4l2_frame_hdr.golden_frame = VIDEO_MAX_FRAME; } if (alt_frame) { scoped_refptr<V4L2DecodeSurface> alt_frame_surface = VP8PictureToV4L2DecodeSurface(alt_frame); v4l2_frame_hdr.alt_frame = alt_frame_surface->output_record(); ref_surfaces.push_back(alt_frame_surface); } else { v4l2_frame_hdr.alt_frame = VIDEO_MAX_FRAME; } struct v4l2_ext_control ctrl; memset(&ctrl, 0, sizeof(ctrl)); ctrl.id = V4L2_CID_MPEG_VIDEO_VP8_FRAME_HDR; ctrl.size = sizeof(v4l2_frame_hdr); ctrl.p_vp8_frame_hdr = &v4l2_frame_hdr; struct v4l2_ext_controls ext_ctrls; memset(&ext_ctrls, 0, sizeof(ext_ctrls)); ext_ctrls.count = 1; ext_ctrls.controls = &ctrl; ext_ctrls.config_store = dec_surface->config_store(); if (!v4l2_dec_->SubmitExtControls(&ext_ctrls)) return false; dec_surface->SetReferenceSurfaces(ref_surfaces); if (!v4l2_dec_->SubmitSlice(dec_surface->input_record(), frame_hdr->data, frame_hdr->frame_size)) return false; v4l2_dec_->DecodeSurface(dec_surface); return true; } bool V4L2SliceVideoDecodeAccelerator::V4L2VP8Accelerator::OutputPicture( const scoped_refptr<VP8Picture>& pic) { scoped_refptr<V4L2DecodeSurface> dec_surface = VP8PictureToV4L2DecodeSurface(pic); dec_surface->set_visible_rect(pic->visible_rect); v4l2_dec_->SurfaceReady(dec_surface); return true; } scoped_refptr<V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface> V4L2SliceVideoDecodeAccelerator::V4L2VP8Accelerator:: VP8PictureToV4L2DecodeSurface(const scoped_refptr<VP8Picture>& pic) { V4L2VP8Picture* v4l2_pic = pic->AsV4L2VP8Picture(); CHECK(v4l2_pic); return v4l2_pic->dec_surface(); } V4L2SliceVideoDecodeAccelerator::V4L2VP9Accelerator::V4L2VP9Accelerator( V4L2SliceVideoDecodeAccelerator* v4l2_dec) : v4l2_dec_(v4l2_dec) { DCHECK(v4l2_dec_); device_needs_frame_context_ = v4l2_dec_->IsCtrlExposed(V4L2_CID_MPEG_VIDEO_VP9_ENTROPY); DVLOG_IF(1, device_needs_frame_context_) << "Device requires frame context parsing"; } V4L2SliceVideoDecodeAccelerator::V4L2VP9Accelerator::~V4L2VP9Accelerator() {} scoped_refptr<VP9Picture> V4L2SliceVideoDecodeAccelerator::V4L2VP9Accelerator::CreateVP9Picture() { scoped_refptr<V4L2DecodeSurface> dec_surface = v4l2_dec_->CreateSurface(); if (!dec_surface) return nullptr; return new V4L2VP9Picture(dec_surface); } static void FillV4L2VP9LoopFilterParams( const Vp9LoopFilterParams& vp9_lf_params, struct v4l2_vp9_loop_filter_params* v4l2_lf_params) { #define SET_LF_PARAMS_FLAG_IF(cond, flag) \ v4l2_lf_params->flags |= ((vp9_lf_params.cond) ? (flag) : 0) SET_LF_PARAMS_FLAG_IF(delta_enabled, V4L2_VP9_LOOP_FLTR_FLAG_DELTA_ENABLED); SET_LF_PARAMS_FLAG_IF(delta_update, V4L2_VP9_LOOP_FLTR_FLAG_DELTA_UPDATE); #undef SET_LF_PARAMS_FLAG_IF v4l2_lf_params->level = vp9_lf_params.level; v4l2_lf_params->sharpness = vp9_lf_params.sharpness; ARRAY_MEMCPY_CHECKED(v4l2_lf_params->deltas, vp9_lf_params.ref_deltas); ARRAY_MEMCPY_CHECKED(v4l2_lf_params->mode_deltas, vp9_lf_params.mode_deltas); ARRAY_MEMCPY_CHECKED(v4l2_lf_params->lvl_lookup, vp9_lf_params.lvl); } static void FillV4L2VP9QuantizationParams( const Vp9QuantizationParams& vp9_quant_params, struct v4l2_vp9_quantization_params* v4l2_q_params) { #define SET_Q_PARAMS_FLAG_IF(cond, flag) \ v4l2_q_params->flags |= ((vp9_quant_params.cond) ? (flag) : 0) SET_Q_PARAMS_FLAG_IF(IsLossless(), V4L2_VP9_QUANT_PARAMS_FLAG_LOSSLESS); #undef SET_Q_PARAMS_FLAG_IF #define Q_PARAMS_TO_V4L2_Q_PARAMS(a) v4l2_q_params->a = vp9_quant_params.a Q_PARAMS_TO_V4L2_Q_PARAMS(base_q_idx); Q_PARAMS_TO_V4L2_Q_PARAMS(delta_q_y_dc); Q_PARAMS_TO_V4L2_Q_PARAMS(delta_q_uv_dc); Q_PARAMS_TO_V4L2_Q_PARAMS(delta_q_uv_ac); #undef Q_PARAMS_TO_V4L2_Q_PARAMS } static void FillV4L2VP9SegmentationParams( const Vp9SegmentationParams& vp9_segm_params, struct v4l2_vp9_segmentation_params* v4l2_segm_params) { #define SET_SEG_PARAMS_FLAG_IF(cond, flag) \ v4l2_segm_params->flags |= ((vp9_segm_params.cond) ? (flag) : 0) SET_SEG_PARAMS_FLAG_IF(enabled, V4L2_VP9_SGMNT_PARAM_FLAG_ENABLED); SET_SEG_PARAMS_FLAG_IF(update_map, V4L2_VP9_SGMNT_PARAM_FLAG_UPDATE_MAP); SET_SEG_PARAMS_FLAG_IF(temporal_update, V4L2_VP9_SGMNT_PARAM_FLAG_TEMPORAL_UPDATE); SET_SEG_PARAMS_FLAG_IF(update_data, V4L2_VP9_SGMNT_PARAM_FLAG_UPDATE_DATA); SET_SEG_PARAMS_FLAG_IF(abs_or_delta_update, V4L2_VP9_SGMNT_PARAM_FLAG_ABS_OR_DELTA_UPDATE); #undef SET_SEG_PARAMS_FLAG_IF ARRAY_MEMCPY_CHECKED(v4l2_segm_params->tree_probs, vp9_segm_params.tree_probs); ARRAY_MEMCPY_CHECKED(v4l2_segm_params->pred_probs, vp9_segm_params.pred_probs); ARRAY_MEMCPY_CHECKED(v4l2_segm_params->feature_data, vp9_segm_params.feature_data); static_assert(arraysize(v4l2_segm_params->feature_enabled) == arraysize(vp9_segm_params.feature_enabled) && arraysize(v4l2_segm_params->feature_enabled[0]) == arraysize(vp9_segm_params.feature_enabled[0]), "feature_enabled arrays must be of same size"); for (size_t i = 0; i < arraysize(v4l2_segm_params->feature_enabled); ++i) { for (size_t j = 0; j < arraysize(v4l2_segm_params->feature_enabled[i]); ++j) { v4l2_segm_params->feature_enabled[i][j] = vp9_segm_params.feature_enabled[i][j]; } } } static void FillV4L2Vp9EntropyContext( const Vp9FrameContext& vp9_frame_ctx, struct v4l2_vp9_entropy_ctx* v4l2_entropy_ctx) { #define ARRAY_MEMCPY_CHECKED_FRM_CTX_TO_V4L2_ENTR(a) \ ARRAY_MEMCPY_CHECKED(v4l2_entropy_ctx->a, vp9_frame_ctx.a) ARRAY_MEMCPY_CHECKED_FRM_CTX_TO_V4L2_ENTR(tx_probs_8x8); ARRAY_MEMCPY_CHECKED_FRM_CTX_TO_V4L2_ENTR(tx_probs_16x16); ARRAY_MEMCPY_CHECKED_FRM_CTX_TO_V4L2_ENTR(tx_probs_32x32); ARRAY_MEMCPY_CHECKED_FRM_CTX_TO_V4L2_ENTR(coef_probs); ARRAY_MEMCPY_CHECKED_FRM_CTX_TO_V4L2_ENTR(skip_prob); ARRAY_MEMCPY_CHECKED_FRM_CTX_TO_V4L2_ENTR(inter_mode_probs); ARRAY_MEMCPY_CHECKED_FRM_CTX_TO_V4L2_ENTR(interp_filter_probs); ARRAY_MEMCPY_CHECKED_FRM_CTX_TO_V4L2_ENTR(is_inter_prob); ARRAY_MEMCPY_CHECKED_FRM_CTX_TO_V4L2_ENTR(comp_mode_prob); ARRAY_MEMCPY_CHECKED_FRM_CTX_TO_V4L2_ENTR(single_ref_prob); ARRAY_MEMCPY_CHECKED_FRM_CTX_TO_V4L2_ENTR(comp_ref_prob); ARRAY_MEMCPY_CHECKED_FRM_CTX_TO_V4L2_ENTR(y_mode_probs); ARRAY_MEMCPY_CHECKED_FRM_CTX_TO_V4L2_ENTR(uv_mode_probs); ARRAY_MEMCPY_CHECKED_FRM_CTX_TO_V4L2_ENTR(partition_probs); ARRAY_MEMCPY_CHECKED_FRM_CTX_TO_V4L2_ENTR(mv_joint_probs); ARRAY_MEMCPY_CHECKED_FRM_CTX_TO_V4L2_ENTR(mv_sign_prob); ARRAY_MEMCPY_CHECKED_FRM_CTX_TO_V4L2_ENTR(mv_class_probs); ARRAY_MEMCPY_CHECKED_FRM_CTX_TO_V4L2_ENTR(mv_class0_bit_prob); ARRAY_MEMCPY_CHECKED_FRM_CTX_TO_V4L2_ENTR(mv_bits_prob); ARRAY_MEMCPY_CHECKED_FRM_CTX_TO_V4L2_ENTR(mv_class0_fr_probs); ARRAY_MEMCPY_CHECKED_FRM_CTX_TO_V4L2_ENTR(mv_fr_probs); ARRAY_MEMCPY_CHECKED_FRM_CTX_TO_V4L2_ENTR(mv_class0_hp_prob); ARRAY_MEMCPY_CHECKED_FRM_CTX_TO_V4L2_ENTR(mv_hp_prob); #undef ARRAY_MEMCPY_CHECKED_FRM_CTX_TO_V4L2_ENTR } bool V4L2SliceVideoDecodeAccelerator::V4L2VP9Accelerator::SubmitDecode( const scoped_refptr<VP9Picture>& pic, const Vp9SegmentationParams& segm_params, const Vp9LoopFilterParams& lf_params, const std::vector<scoped_refptr<VP9Picture>>& ref_pictures, const base::Closure& done_cb) { const Vp9FrameHeader* frame_hdr = pic->frame_hdr.get(); DCHECK(frame_hdr); struct v4l2_ctrl_vp9_frame_hdr v4l2_frame_hdr; memset(&v4l2_frame_hdr, 0, sizeof(v4l2_frame_hdr)); #define FHDR_TO_V4L2_FHDR(a) v4l2_frame_hdr.a = frame_hdr->a FHDR_TO_V4L2_FHDR(profile); FHDR_TO_V4L2_FHDR(frame_type); FHDR_TO_V4L2_FHDR(bit_depth); FHDR_TO_V4L2_FHDR(color_range); FHDR_TO_V4L2_FHDR(subsampling_x); FHDR_TO_V4L2_FHDR(subsampling_y); FHDR_TO_V4L2_FHDR(frame_width); FHDR_TO_V4L2_FHDR(frame_height); FHDR_TO_V4L2_FHDR(render_width); FHDR_TO_V4L2_FHDR(render_height); FHDR_TO_V4L2_FHDR(reset_frame_context); FHDR_TO_V4L2_FHDR(interpolation_filter); FHDR_TO_V4L2_FHDR(frame_context_idx); FHDR_TO_V4L2_FHDR(tile_cols_log2); FHDR_TO_V4L2_FHDR(tile_rows_log2); FHDR_TO_V4L2_FHDR(header_size_in_bytes); #undef FHDR_TO_V4L2_FHDR v4l2_frame_hdr.color_space = static_cast<uint8_t>(frame_hdr->color_space); FillV4L2VP9QuantizationParams(frame_hdr->quant_params, &v4l2_frame_hdr.quant_params); #define SET_V4L2_FRM_HDR_FLAG_IF(cond, flag) \ v4l2_frame_hdr.flags |= ((frame_hdr->cond) ? (flag) : 0) SET_V4L2_FRM_HDR_FLAG_IF(show_frame, V4L2_VP9_FRAME_HDR_FLAG_SHOW_FRAME); SET_V4L2_FRM_HDR_FLAG_IF(error_resilient_mode, V4L2_VP9_FRAME_HDR_FLAG_ERR_RES); SET_V4L2_FRM_HDR_FLAG_IF(intra_only, V4L2_VP9_FRAME_HDR_FLAG_FRAME_INTRA); SET_V4L2_FRM_HDR_FLAG_IF(allow_high_precision_mv, V4L2_VP9_FRAME_HDR_ALLOW_HIGH_PREC_MV); SET_V4L2_FRM_HDR_FLAG_IF(refresh_frame_context, V4L2_VP9_FRAME_HDR_REFRESH_FRAME_CTX); SET_V4L2_FRM_HDR_FLAG_IF(frame_parallel_decoding_mode, V4L2_VP9_FRAME_HDR_PARALLEL_DEC_MODE); #undef SET_V4L2_FRM_HDR_FLAG_IF FillV4L2VP9LoopFilterParams(lf_params, &v4l2_frame_hdr.lf_params); FillV4L2VP9SegmentationParams(segm_params, &v4l2_frame_hdr.sgmnt_params); std::vector<struct v4l2_ext_control> ctrls; struct v4l2_ext_control ctrl; memset(&ctrl, 0, sizeof(ctrl)); ctrl.id = V4L2_CID_MPEG_VIDEO_VP9_FRAME_HDR; ctrl.size = sizeof(v4l2_frame_hdr); ctrl.p_vp9_frame_hdr = &v4l2_frame_hdr; ctrls.push_back(ctrl); struct v4l2_ctrl_vp9_decode_param v4l2_decode_param; memset(&v4l2_decode_param, 0, sizeof(v4l2_decode_param)); DCHECK_EQ(ref_pictures.size(), arraysize(v4l2_decode_param.ref_frames)); std::vector<scoped_refptr<V4L2DecodeSurface>> ref_surfaces; for (size_t i = 0; i < ref_pictures.size(); ++i) { if (ref_pictures[i]) { scoped_refptr<V4L2DecodeSurface> ref_surface = VP9PictureToV4L2DecodeSurface(ref_pictures[i]); v4l2_decode_param.ref_frames[i] = ref_surface->output_record(); ref_surfaces.push_back(ref_surface); } else { v4l2_decode_param.ref_frames[i] = VIDEO_MAX_FRAME; } } static_assert(arraysize(v4l2_decode_param.active_ref_frames) == arraysize(frame_hdr->ref_frame_idx), "active reference frame array sizes mismatch"); for (size_t i = 0; i < arraysize(frame_hdr->ref_frame_idx); ++i) { uint8_t idx = frame_hdr->ref_frame_idx[i]; if (idx >= ref_pictures.size()) return false; struct v4l2_vp9_reference_frame* v4l2_ref_frame = &v4l2_decode_param.active_ref_frames[i]; scoped_refptr<VP9Picture> ref_pic = ref_pictures[idx]; if (ref_pic) { scoped_refptr<V4L2DecodeSurface> ref_surface = VP9PictureToV4L2DecodeSurface(ref_pic); v4l2_ref_frame->buf_index = ref_surface->output_record(); #define REF_TO_V4L2_REF(a) v4l2_ref_frame->a = ref_pic->frame_hdr->a REF_TO_V4L2_REF(frame_width); REF_TO_V4L2_REF(frame_height); REF_TO_V4L2_REF(bit_depth); REF_TO_V4L2_REF(subsampling_x); REF_TO_V4L2_REF(subsampling_y); #undef REF_TO_V4L2_REF } else { v4l2_ref_frame->buf_index = VIDEO_MAX_FRAME; } } memset(&ctrl, 0, sizeof(ctrl)); ctrl.id = V4L2_CID_MPEG_VIDEO_VP9_DECODE_PARAM; ctrl.size = sizeof(v4l2_decode_param); ctrl.p_vp9_decode_param = &v4l2_decode_param; ctrls.push_back(ctrl); // Defined outside of the if() clause below as it must remain valid until // the call to SubmitExtControls(). struct v4l2_ctrl_vp9_entropy v4l2_entropy; if (device_needs_frame_context_) { memset(&v4l2_entropy, 0, sizeof(v4l2_entropy)); FillV4L2Vp9EntropyContext(frame_hdr->initial_frame_context, &v4l2_entropy.initial_entropy_ctx); FillV4L2Vp9EntropyContext(frame_hdr->frame_context, &v4l2_entropy.current_entropy_ctx); v4l2_entropy.tx_mode = frame_hdr->compressed_header.tx_mode; v4l2_entropy.reference_mode = frame_hdr->compressed_header.reference_mode; memset(&ctrl, 0, sizeof(ctrl)); ctrl.id = V4L2_CID_MPEG_VIDEO_VP9_ENTROPY; ctrl.size = sizeof(v4l2_entropy); ctrl.p_vp9_entropy = &v4l2_entropy; ctrls.push_back(ctrl); } scoped_refptr<V4L2DecodeSurface> dec_surface = VP9PictureToV4L2DecodeSurface(pic); struct v4l2_ext_controls ext_ctrls; memset(&ext_ctrls, 0, sizeof(ext_ctrls)); ext_ctrls.count = ctrls.size(); ext_ctrls.controls = &ctrls[0]; ext_ctrls.config_store = dec_surface->config_store(); if (!v4l2_dec_->SubmitExtControls(&ext_ctrls)) return false; dec_surface->SetReferenceSurfaces(ref_surfaces); dec_surface->SetDecodeDoneCallback(done_cb); if (!v4l2_dec_->SubmitSlice(dec_surface->input_record(), frame_hdr->data, frame_hdr->frame_size)) return false; v4l2_dec_->DecodeSurface(dec_surface); return true; } bool V4L2SliceVideoDecodeAccelerator::V4L2VP9Accelerator::OutputPicture( const scoped_refptr<VP9Picture>& pic) { scoped_refptr<V4L2DecodeSurface> dec_surface = VP9PictureToV4L2DecodeSurface(pic); dec_surface->set_visible_rect(pic->visible_rect); v4l2_dec_->SurfaceReady(dec_surface); return true; } static void FillVp9FrameContext(struct v4l2_vp9_entropy_ctx& v4l2_entropy_ctx, Vp9FrameContext* vp9_frame_ctx) { #define ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(a) \ ARRAY_MEMCPY_CHECKED(vp9_frame_ctx->a, v4l2_entropy_ctx.a) ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(tx_probs_8x8); ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(tx_probs_16x16); ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(tx_probs_32x32); ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(coef_probs); ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(skip_prob); ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(inter_mode_probs); ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(interp_filter_probs); ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(is_inter_prob); ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(comp_mode_prob); ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(single_ref_prob); ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(comp_ref_prob); ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(y_mode_probs); ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(uv_mode_probs); ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(partition_probs); ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(mv_joint_probs); ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(mv_sign_prob); ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(mv_class_probs); ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(mv_class0_bit_prob); ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(mv_bits_prob); ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(mv_class0_fr_probs); ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(mv_fr_probs); ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(mv_class0_hp_prob); ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(mv_hp_prob); #undef ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX } bool V4L2SliceVideoDecodeAccelerator::V4L2VP9Accelerator::GetFrameContext( const scoped_refptr<VP9Picture>& pic, Vp9FrameContext* frame_ctx) { struct v4l2_ctrl_vp9_entropy v4l2_entropy; memset(&v4l2_entropy, 0, sizeof(v4l2_entropy)); struct v4l2_ext_control ctrl; memset(&ctrl, 0, sizeof(ctrl)); ctrl.id = V4L2_CID_MPEG_VIDEO_VP9_ENTROPY; ctrl.size = sizeof(v4l2_entropy); ctrl.p_vp9_entropy = &v4l2_entropy; scoped_refptr<V4L2DecodeSurface> dec_surface = VP9PictureToV4L2DecodeSurface(pic); struct v4l2_ext_controls ext_ctrls; memset(&ext_ctrls, 0, sizeof(ext_ctrls)); ext_ctrls.count = 1; ext_ctrls.controls = &ctrl; ext_ctrls.config_store = dec_surface->config_store(); if (!v4l2_dec_->GetExtControls(&ext_ctrls)) return false; FillVp9FrameContext(v4l2_entropy.current_entropy_ctx, frame_ctx); return true; } scoped_refptr<V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface> V4L2SliceVideoDecodeAccelerator::V4L2VP9Accelerator:: VP9PictureToV4L2DecodeSurface(const scoped_refptr<VP9Picture>& pic) { V4L2VP9Picture* v4l2_pic = pic->AsV4L2VP9Picture(); CHECK(v4l2_pic); return v4l2_pic->dec_surface(); } void V4L2SliceVideoDecodeAccelerator::DecodeSurface( const scoped_refptr<V4L2DecodeSurface>& dec_surface) { DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); DVLOGF(3) << "Submitting decode for surface: " << dec_surface->ToString(); Enqueue(dec_surface); } void V4L2SliceVideoDecodeAccelerator::SurfaceReady( const scoped_refptr<V4L2DecodeSurface>& dec_surface) { DVLOGF(3); DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); decoder_display_queue_.push(dec_surface); TryOutputSurfaces(); } void V4L2SliceVideoDecodeAccelerator::TryOutputSurfaces() { while (!decoder_display_queue_.empty()) { scoped_refptr<V4L2DecodeSurface> dec_surface = decoder_display_queue_.front(); if (!dec_surface->decoded()) break; decoder_display_queue_.pop(); OutputSurface(dec_surface); } } void V4L2SliceVideoDecodeAccelerator::OutputSurface( const scoped_refptr<V4L2DecodeSurface>& dec_surface) { DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); OutputRecord& output_record = output_buffer_map_[dec_surface->output_record()]; bool inserted = surfaces_at_display_ .insert(std::make_pair(output_record.picture_id, dec_surface)) .second; DCHECK(inserted); DCHECK(!output_record.at_client); DCHECK(!output_record.at_device); DCHECK_NE(output_record.picture_id, -1); output_record.at_client = true; // TODO(hubbe): Insert correct color space. http://crbug.com/647725 Picture picture(output_record.picture_id, dec_surface->bitstream_id(), dec_surface->visible_rect(), gfx::ColorSpace(), false); DVLOGF(3) << dec_surface->ToString() << ", bitstream_id: " << picture.bitstream_buffer_id() << ", picture_id: " << picture.picture_buffer_id() << ", visible_rect: " << picture.visible_rect().ToString(); pending_picture_ready_.push(PictureRecord(output_record.cleared, picture)); SendPictureReady(); output_record.cleared = true; } scoped_refptr<V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface> V4L2SliceVideoDecodeAccelerator::CreateSurface() { DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); DCHECK_EQ(state_, kDecoding); if (free_input_buffers_.empty() || free_output_buffers_.empty()) return nullptr; int input = free_input_buffers_.front(); free_input_buffers_.pop_front(); int output = free_output_buffers_.front(); free_output_buffers_.pop_front(); InputRecord& input_record = input_buffer_map_[input]; DCHECK_EQ(input_record.bytes_used, 0u); DCHECK_EQ(input_record.input_id, -1); DCHECK(decoder_current_bitstream_buffer_ != nullptr); input_record.input_id = decoder_current_bitstream_buffer_->input_id; scoped_refptr<V4L2DecodeSurface> dec_surface = new V4L2DecodeSurface( decoder_current_bitstream_buffer_->input_id, input, output, base::Bind(&V4L2SliceVideoDecodeAccelerator::ReuseOutputBuffer, base::Unretained(this))); DVLOGF(4) << "Created surface " << input << " -> " << output; return dec_surface; } void V4L2SliceVideoDecodeAccelerator::SendPictureReady() { DVLOGF(3); DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); bool resetting_or_flushing = (decoder_resetting_ || decoder_flushing_); while (!pending_picture_ready_.empty()) { bool cleared = pending_picture_ready_.front().cleared; const Picture& picture = pending_picture_ready_.front().picture; if (cleared && picture_clearing_count_ == 0) { DVLOGF(4) << "Posting picture ready to decode task runner for: " << picture.picture_buffer_id(); // This picture is cleared. It can be posted to a thread different than // the main GPU thread to reduce latency. This should be the case after // all pictures are cleared at the beginning. decode_task_runner_->PostTask( FROM_HERE, base::Bind(&Client::PictureReady, decode_client_, picture)); pending_picture_ready_.pop(); } else if (!cleared || resetting_or_flushing) { DVLOGF(3) << "cleared=" << pending_picture_ready_.front().cleared << ", decoder_resetting_=" << decoder_resetting_ << ", decoder_flushing_=" << decoder_flushing_ << ", picture_clearing_count_=" << picture_clearing_count_; DVLOGF(4) << "Posting picture ready to GPU for: " << picture.picture_buffer_id(); // If the picture is not cleared, post it to the child thread because it // has to be cleared in the child thread. A picture only needs to be // cleared once. If the decoder is resetting or flushing, send all // pictures to ensure PictureReady arrive before reset or flush done. child_task_runner_->PostTaskAndReply( FROM_HERE, base::Bind(&Client::PictureReady, client_, picture), // Unretained is safe. If Client::PictureReady gets to run, |this| is // alive. Destroy() will wait the decode thread to finish. base::Bind(&V4L2SliceVideoDecodeAccelerator::PictureCleared, base::Unretained(this))); picture_clearing_count_++; pending_picture_ready_.pop(); } else { // This picture is cleared. But some pictures are about to be cleared on // the child thread. To preserve the order, do not send this until those // pictures are cleared. break; } } } void V4L2SliceVideoDecodeAccelerator::PictureCleared() { DVLOGF(3) << "clearing count=" << picture_clearing_count_; DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); DCHECK_GT(picture_clearing_count_, 0); picture_clearing_count_--; SendPictureReady(); } bool V4L2SliceVideoDecodeAccelerator::TryToSetupDecodeOnSeparateThread( const base::WeakPtr<Client>& decode_client, const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) { decode_client_ = decode_client; decode_task_runner_ = decode_task_runner; return true; } // static VideoDecodeAccelerator::SupportedProfiles V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { scoped_refptr<V4L2Device> device = V4L2Device::Create(); if (!device) return SupportedProfiles(); return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_), supported_input_fourccs_); } } // namespace media
cc61dd39a14ca2b774b830d571cf82ab8271a8f8
2562d3f590ac8dabfd1fa7eaa9ba9d76d55d44e0
/clang/dependencies/cryptopp/include/sm4.h
67f76052f87e6d214bb864ce4ddb2f812ea02dbb
[ "MIT" ]
permissive
msktenn/sandbox
63063cf16180798fb145dd6b3104d47f629f0d0e
3dc9453282537d32160cb4bdc6d31df33aa51304
refs/heads/master
2023-03-13T06:37:02.089987
2023-01-30T16:08:05
2023-01-30T16:08:05
147,120,817
0
0
MIT
2023-03-03T13:28:04
2018-09-02T20:50:39
C++
UTF-8
C++
false
false
3,977
h
// sm4.h - written and placed in the public domain by Jeffrey Walton and Han Lulu /// \file sm4.h /// \brief Classes for the SM4 block cipher /// \details SM4 is a block cipher designed by Xiaoyun Wang, et al. The block cipher is part of the /// Chinese State Cryptography Administration portfolio. The cipher was formely known as SMS4. /// \details SM4 encryption is accelerated on machines with AES-NI. Decryption is not acclerated because /// it is not profitable. Thanks to Markku-Juhani Olavi Saarinen for help and the code. /// \sa <A HREF="http://eprint.iacr.org/2008/329.pdf">SMS4 Encryption Algorithm for Wireless Networks</A>, /// <A HREF="http://github.com/guanzhi/GmSSL">Reference implementation using OpenSSL</A> and /// <A HREF="https://github.com/mjosaarinen/sm4ni">Markku-Juhani Olavi Saarinen GitHub</A>. /// \since Crypto++ 6.0 #ifndef CRYPTOPP_SM4_H #define CRYPTOPP_SM4_H #include "config.h" #include "seckey.h" #include "secblock.h" #if (CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X86) # ifndef CRYPTOPP_DISABLE_SM4_SIMD # define CRYPTOPP_SM4_ADVANCED_PROCESS_BLOCKS 1 # endif #endif NAMESPACE_BEGIN(CryptoPP) /// \brief SM4 block cipher information /// \since Crypto++ 6.0 struct SM4_Info : public FixedBlockSize<16>, FixedKeyLength<16> { static const std::string StaticAlgorithmName() { return "SM4"; } }; /// \brief Classes for the SM4 block cipher /// \details SM4 is a block cipher designed by Xiaoyun Wang, et al. The block cipher is part of the /// Chinese State Cryptography Administration portfolio. The cipher was formely known as SMS4. /// \sa <A HREF="http://eprint.iacr.org/2008/329.pdf">SMS4 Encryption Algorithm for Wireless Networks</A> /// \since Crypto++ 6.0 class CRYPTOPP_NO_VTABLE SM4 : public SM4_Info, public BlockCipherDocumentation { public: /// \brief SM4 block cipher transformation functions /// \details Provides implementation common to encryption and decryption /// \since Crypto++ 6.0 class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<SM4_Info> { protected: void UncheckedSetKey(const byte *userKey, unsigned int keyLength, const NameValuePairs &params); SecBlock<word32, AllocatorWithCleanup<word32> > m_rkeys; mutable SecBlock<word32, AllocatorWithCleanup<word32> > m_wspace; }; /// \brief Encryption transformation /// \details Enc provides implementation for encryption transformation. All key /// sizes are supported. /// \details SM4 encryption is accelerated on machines with AES-NI. Decryption is /// not acclerated because it is not profitable. Thanks to Markku-Juhani Olavi /// Saarinen. /// \since Crypto++ 6.0, AESNI encryption since Crypto++ 8.0 class CRYPTOPP_NO_VTABLE Enc : public Base { public: std::string AlgorithmProvider() const; protected: void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; #if CRYPTOPP_SM4_ADVANCED_PROCESS_BLOCKS size_t AdvancedProcessBlocks(const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const; #endif }; /// \brief Decryption transformation /// \details Dec provides implementation for decryption transformation. All key /// sizes are supported. /// \details SM4 encryption is accelerated on machines with AES-NI. Decryption is /// not acclerated because it is not profitable. Thanks to Markku-Juhani Olavi /// Saarinen. /// \since Crypto++ 6.0 class CRYPTOPP_NO_VTABLE Dec : public Base { protected: void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; }; typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption; typedef BlockCipherFinal<DECRYPTION, Dec> Decryption; }; NAMESPACE_END #endif // CRYPTOPP_SM4_H
bb0f7a44abac1ed63e848646ba5d343424da4c3a
cb438ea6c4a38cdfef86e8da77494c916a643f12
/PlaySketch/Box2D-new/Examples/TestBed/Tests/CollisionProcessing.h
a2b6bc2b0d156b17ba28a3dfda564b86d6d75780
[ "Zlib" ]
permissive
SummerTree/playsketch
d638d6bac9264b98a8ca407f0eecdc31f8f38202
3580de21b2fc3cc6cb6974f39892af6e602a6e9e
refs/heads/master
2020-12-31T02:02:28.057892
2013-01-28T14:05:45
2013-01-28T14:05:45
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,954
h
/* * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. */ #ifndef COLLISION_PROCESSING_H #define COLLISION_PROCESSING_H #include <algorithm> // This test shows collision processing and tests // deferred body destruction. class CollisionProcessing : public Test { public: CollisionProcessing() { // Ground body { b2PolygonDef sd; sd.SetAsBox(50.0f, 10.0f); sd.friction = 0.3f; b2BodyDef bd; bd.position.Set(0.0f, -10.0f); b2Body* ground = m_world->CreateBody(&bd); ground->CreateShape(&sd); } float32 xLo = -5.0f, xHi = 5.0f; float32 yLo = 2.0f, yHi = 35.0f; // Small triangle b2PolygonDef triangleShapeDef; triangleShapeDef.vertexCount = 3; triangleShapeDef.vertices[0].Set(-1.0f, 0.0f); triangleShapeDef.vertices[1].Set(1.0f, 0.0f); triangleShapeDef.vertices[2].Set(0.0f, 2.0f); triangleShapeDef.density = 1.0f; b2BodyDef triangleBodyDef; triangleBodyDef.position.Set(RandomFloat(xLo, xHi), RandomFloat(yLo, yHi)); b2Body* body1 = m_world->CreateBody(&triangleBodyDef); body1->CreateShape(&triangleShapeDef); body1->SetMassFromShapes(); // Large triangle (recycle definitions) triangleShapeDef.vertices[0] *= 2.0f; triangleShapeDef.vertices[1] *= 2.0f; triangleShapeDef.vertices[2] *= 2.0f; triangleBodyDef.position.Set(RandomFloat(xLo, xHi), RandomFloat(yLo, yHi)); b2Body* body2 = m_world->CreateBody(&triangleBodyDef); body2->CreateShape(&triangleShapeDef); body2->SetMassFromShapes(); // Small box b2PolygonDef boxShapeDef; boxShapeDef.SetAsBox(1.0f, 0.5f); boxShapeDef.density = 1.0f; b2BodyDef boxBodyDef; boxBodyDef.position.Set(RandomFloat(xLo, xHi), RandomFloat(yLo, yHi)); b2Body* body3 = m_world->CreateBody(&boxBodyDef); body3->CreateShape(&boxShapeDef); body3->SetMassFromShapes(); // Large box (recycle definitions) boxShapeDef.SetAsBox(2.0f, 1.0f); boxBodyDef.position.Set(RandomFloat(xLo, xHi), RandomFloat(yLo, yHi)); b2Body* body4 = m_world->CreateBody(&boxBodyDef); body4->CreateShape(&boxShapeDef); body4->SetMassFromShapes(); // Small circle b2CircleDef circleShapeDef; circleShapeDef.radius = 1.0f; circleShapeDef.density = 1.0f; b2BodyDef circleBodyDef; circleBodyDef.position.Set(RandomFloat(xLo, xHi), RandomFloat(yLo, yHi)); b2Body* body5 = m_world->CreateBody(&circleBodyDef); body5->CreateShape(&circleShapeDef); body5->SetMassFromShapes(); // Large circle circleShapeDef.radius *= 2.0f; circleBodyDef.position.Set(RandomFloat(xLo, xHi), RandomFloat(yLo, yHi)); b2Body* body6 = m_world->CreateBody(&circleBodyDef); body6->CreateShape(&circleShapeDef); body6->SetMassFromShapes(); } void Step(Settings* settings) { Test::Step(settings); // We are going to destroy some bodies according to contact // points. We must buffer the bodies that should be destroyed // because they may belong to multiple contact points. const int32 k_maxNuke = 6; b2Body* nuke[k_maxNuke]; int32 nukeCount = 0; // Traverse the contact results. Destroy bodies that // are touching heavier bodies. for (int32 i = 0; i < m_pointCount; ++i) { ContactPoint* point = m_points + i; b2Body* body1 = point->shape1->GetBody(); b2Body* body2 = point->shape2->GetBody(); float32 mass1 = body1->GetMass(); float32 mass2 = body2->GetMass(); if (mass1 > 0.0f && mass2 > 0.0f) { if (mass2 > mass1) { nuke[nukeCount++] = body1; } else { nuke[nukeCount++] = body2; } if (nukeCount == k_maxNuke) { break; } } } // Sort the nuke array to group duplicates. std::sort(nuke, nuke + nukeCount); // Destroy the bodies, skipping duplicates. int32 i = 0; while (i < nukeCount) { b2Body* b = nuke[i++]; while (i < nukeCount && nuke[i] == b) { ++i; } m_world->DestroyBody(b); } } static Test* Create() { return new CollisionProcessing; } }; #endif
7de106a5945f001a592cba6d33cf32ef22469a5d
5079c4be165e3373da4d9ec9b91f0add6739b1aa
/src/Object/SResource.h
40f17bdf34eb2b05077109b44be2854b88b5f7a9
[ "Zlib", "MIT", "Unlicense", "BSD-3-Clause", "BSD-2-Clause" ]
permissive
hamtol2/CSEngine
a1851c4922a6b768d4816aa2999d842a0e9910cf
3e169cbb6e886f29d50e7f4bc365cc6c6a332593
refs/heads/master
2023-08-31T14:07:19.354224
2021-10-12T13:31:50
2021-10-12T13:31:50
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,334
h
// // Created by ounols on 19. 6. 10. // #pragma once #include <string> #include "../Manager/AssetMgr.h" #include "../SObject.h" namespace CSE { class SResource : public SObject { public: SResource(); SResource(bool isRegister); SResource(const SResource* resource, bool isRegister); ~SResource() override; void SetName(std::string name); void SetID(std::string id); const char* GetName() const { return m_name.c_str(); } const char* GetID() const { return m_id.c_str(); } void LinkResource(AssetMgr::AssetReference* asset) { SetResource(asset, false); } void LinkResource(std::string name) { SetResource(name, false); } template <class T> static T* Create(std::string name, bool isForceCreate = false) { if (!isForceCreate) { SResource* res = GetResource(name); if (res != nullptr) return static_cast<T*>(res); } T* object = new T(); SResource* res = object; res->SetResource(name); return object; } template <class T> static T* Create(const AssetMgr::AssetReference* asset, bool isForceCreate = false) { if (asset == nullptr) return nullptr; if (!isForceCreate) { SResource* res = GetResource(asset->name); if (res != nullptr) return static_cast<T*>(res); } T* object = new T(); SResource* res = object; res->SetResource(asset); return object; } template <class T> static T* Get(std::string name) { SResource* res = GetResource(name); if (res != nullptr) return static_cast<T*>(res); return nullptr; } protected: virtual void Init(const AssetMgr::AssetReference* asset) = 0; private: void SetResource(std::string name, bool isInit = true); void SetResource(const AssetMgr::AssetReference* asset, bool isInit = true); static SResource* GetResource(std::string name); private: std::string m_name; std::string m_id; bool m_isInited = false; }; }
f061bd9dcd6cce1fd906e0f8fce97b8bc892b27b
4a5ff34d15f85e77bfb56462820a7f35c44de882
/Week_3/Valid_Parenthesis_String.cpp
6d42868030b0e51d680bb8d2ea7b89e0b75e7c7b
[]
no_license
master-fury/30-Day_LeetCoding_Challenge_2020
f82957d457dda5fd9ca36fa8a175cf87a0b41c93
2934b4172dfc7ead5ed8c3c6dbcdb1a34898249b
refs/heads/master
2022-05-29T21:51:25.681713
2020-05-01T17:31:21
2020-05-01T17:31:21
257,264,850
1
0
null
null
null
null
UTF-8
C++
false
false
541
cpp
class Solution { public: bool checkValidString(string s) { int balance=0; const int n=s.length(); for(int i=0;i<n;i++){ if(s[i]=='(' || s[i]=='*') balance++; else if(--balance==-1) return false; } balance=0; for(int i=n-1;i>=0;i--){ if(s[i]==')' || s[i]=='*') balance++; else if(--balance==-1) return false; } return true; } };
3e55259be4020264630fb89e70fa5e6ddaecf2b4
725d0a71ad9d385eacca64aa1b9ad52234238519
/include/Game/Orders/Strategy.hpp
186dc92e5b847581ef8799ac94b592badc3ef463
[]
no_license
ganzf/AgeOfLazies
42cd24f64e2503a545ec68725f9a46c0b12c859b
f92af05b2493961172b28376e2e01d2463004a19
refs/heads/master
2021-03-24T13:00:27.661347
2017-06-23T13:14:50
2017-06-23T13:14:50
94,310,589
0
0
null
null
null
null
UTF-8
C++
false
false
767
hpp
#ifndef STRATEGY_HPP_ # define STRATEGY_HPP_ # include <string> # include <unordered_map> # include <functional> # include "Predicat.hpp" namespace AoL { namespace Game { using Predicat = std::function<bool(Unit const &)>; using Action = std::function<bool(Unit const &)>; class Strategy { std::string stratName; Unit &parent; std::vector<std::pair<Predicat, Action>> options; public: Strategy(std::string const &stratName, Unit const &parent); virtual ~Strategy() = default; virtual bool apply() { for (auto const &p: this->options) { if (p.first(this->parent)) { p.second(this->parent); break ; } } } }; } } #endif /* !STRATEGY_HPP_ */
5e9c6e6f266100f1351e4ee089fec7f5cb58b4e5
4b05bd09341062cbc31978dff65518ec359b170e
/src/network/states/events/HeartBeatEvent.h
1d87864bfc6e5d5677acff72ea8630cddf15579e
[ "BSD-3-Clause" ]
permissive
zakrent/SDL-Net-MPGame
0da2a5475f4ce94f10de2bda7ba9511f25d70f16
4ff85e9843bbeac6c125c3a5501432d080fd7592
refs/heads/master
2021-08-19T10:29:04.016866
2017-11-25T21:55:08
2017-11-25T21:55:08
104,939,920
0
0
null
2017-11-12T16:32:51
2017-09-26T21:33:00
C++
UTF-8
C++
false
false
770
h
// // Created by zakrent on 11/17/17. // #ifndef GAME_MP_SERVER_HEARTBEATEVENT_H #define GAME_MP_SERVER_HEARTBEATEVENT_H #include <SDL_timer.h> #include "BaseEvent.h" namespace network{ struct HeartBeatEvent : public BaseEvent{ uint32 timeStamp; int serialize(char* buffer) override { int offset = 0; serializeUInt32(buffer+offset, eventType); offset += 4; serializeUInt32(buffer+offset, timeStamp); offset += 4; return offset; } HeartBeatEvent() : BaseEvent(1), timeStamp(SDL_GetTicks()){} HeartBeatEvent(char* data) : BaseEvent(unserializeUInt32(data)), timeStamp(unserializeUInt32(data+5)) {}; }; } #endif //GAME_MP_SERVER_HEARTBEATEVENT_H
ad0800617ec54aca5d8fd812dbc1b4bf6f6b2500
9d4c6ee41d527560c845f01cc882359303f546d1
/src/nvmesh/geometry/Bounds.h
1a6aff90097e244741c94825993436a0eeba30d8
[ "MIT" ]
permissive
JellyPixelGames/thekla_atlas
9c926271de0f9037c158fa8fad75576a2f983a63
b46d64eeea9840ecd701087afb1b5fb9768201b1
refs/heads/master
2021-08-30T02:43:22.719763
2017-12-15T19:35:03
2017-12-15T19:35:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
597
h
// This code is in the public domain -- Ignacio Castaño <[email protected]> #pragma once #ifndef NV_MESH_MESHBOUNDS_H #define NV_MESH_MESHBOUNDS_H #include <nvmath/Sphere.h> #include <nvmath/Box.h> #include <nvmesh/nvmesh.h> namespace nv { class BaseMesh; namespace HalfEdge { class Mesh; } // Bounding volumes computation. namespace MeshBounds { Box box(const BaseMesh * mesh); Box box(const HalfEdge::Mesh * mesh); Sphere sphere(const HalfEdge::Mesh * mesh); } } // nv namespace #endif // NV_MESH_MESHBOUNDS_H
bb7ba7c02f36a831c963291f147ee510c2d119dd
bf9f7ff7152a2a86b18396657729f88879724c3d
/XLEngine/Graphics/Win32/graphicsDeviceGL_Win32.cpp
8a227d658bc1435c00c0d8a48c8a1e2ce51a9ef9
[]
no_license
jcapellman/DarkXL.NET
cde7053146a5d15de8df8a32166b4b6ab4bf7d6a
f0a1639a0aeae9a09fd913f139c7bd9be3005bcd
refs/heads/master
2022-02-23T13:53:45.143307
2022-02-13T13:19:07
2022-02-13T13:19:07
134,160,605
2
0
null
null
null
null
UTF-8
C++
false
false
6,550
cpp
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers // Windows Header Files: #include "../../log.h" #include "graphicsDeviceGL_Win32.h" #include <windows.h> #include "../../Math/math.h" #include <GL/glew.h> #include <GL/wglew.h> #include <GL/gl.h> #include <GL/glu.h> //WGL Extension crap... fortunately only on Windows. typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC)(int interval); typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC)(void); static HGLRC m_hRC; static HDC m_hDC; static HWND m_hWnd; static WORD m_GammaRamp_Default[3][256]; static WORD m_GammaRamp[3][256]; bool wglExtensionSupported(const char *extension_name) { // this is pointer to function which returns pointer to string with list of all wgl extensions PFNWGLGETEXTENSIONSSTRINGEXTPROC _wglGetExtensionsStringEXT = NULL; // determine pointer to wglGetExtensionsStringEXT function _wglGetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)wglGetProcAddress("wglGetExtensionsStringEXT"); if (strstr(_wglGetExtensionsStringEXT(), extension_name) == NULL) { // string was not found return false; } // extension is supported return true; } GraphicsDeviceGL_Win32::GraphicsDeviceGL_Win32() { m_exclusiveFullscreen = false; m_initialized = false; } GraphicsDeviceGL_Win32::~GraphicsDeviceGL_Win32() { //Restore the gamma ramp. if ( m_exclusiveFullscreen ) { HDC hdc = GetDC(NULL); SetDeviceGammaRamp(hdc, m_GammaRamp_Default); } } void GraphicsDeviceGL_Win32::present() { HDC hdc = GetDC(m_hWnd); SwapBuffers( hdc ); ReleaseDC( m_hWnd, hdc ); //avoid buffering frames when vsync is enabled otherwise the input "lag" will be increased. if (m_vsyncEnabled) { glFinish(); } } void GraphicsDeviceGL_Win32::setWindowData(int nParam, void **param, GraphicsDeviceID deviceID, bool exclFullscreen/*=false*/) { if (m_initialized) { return; } m_exclusiveFullscreen = exclFullscreen; m_hWnd = (HWND)param[0]; HDC m_hDC = GetDC(m_hWnd); BYTE bits = 32; static PIXELFORMATDESCRIPTOR pfd= // pfd Tells Windows How We Want Things To Be { sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor 1, // Version Number PFD_DRAW_TO_WINDOW | // Format Must Support Window PFD_SUPPORT_OPENGL | // Format Must Support OpenGL PFD_DOUBLEBUFFER, // Must Support Double Buffering PFD_TYPE_RGBA, // Request An RGBA Format bits, // Select Our Color Depth 0, 0, 0, 0, 0, 0, // Color Bits Ignored 0, // No Alpha Buffer 0, // Shift Bit Ignored 0, // No Accumulation Buffer 0, 0, 0, 0, // Accumulation Bits Ignored 24, // 24Bit Z-Buffer (Depth Buffer) 8, // 8Bit Stencil Buffer 0, // No Auxiliary Buffer PFD_MAIN_PLANE, // Main Drawing Layer 0, // Reserved 0, 0, 0 // Layer Masks Ignored }; int PixelFormat; if ( !(PixelFormat=ChoosePixelFormat(m_hDC, &pfd)) ) // Did Windows find a matching Pixel Format? { return; } if ( !SetPixelFormat(m_hDC, PixelFormat, &pfd) ) // Are we able to set the Pixel Format? { return; } //TO-DO: create a proper (modern) context specific to the version of OpenGL trying the be used. m_hRC = wglCreateContext(m_hDC); if ( m_hRC == 0 ) { return; } if ( !wglMakeCurrent(m_hDC, m_hRC) ) // Try to activate the Rendering Context { return; } //Now enable or disable VSYNC based on settings. //If the extension can't be found then we're forced to use whatever the driver default is... //but this shouldn't happen. If it does, the engine will still run at least. :) if ( wglExtensionSupported("WGL_EXT_swap_control") ) { // Extension is supported, init pointer. // Save so that the swap interval can be changed later (to be implemented). wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT"); } m_adaptiveVsync = false; if ( wglExtensionSupported("EXT_swap_control_tear") ) { m_adaptiveVsync = true; } //Only setup the gamma ramp in fullscreen. if ( m_exclusiveFullscreen ) { //get the current gamma ramp so it can be restored on exit. GetDeviceGammaRamp(m_hDC, m_GammaRamp_Default); f32 fBrightness=1.0f, fContrast=1.0f, fGamma=1.0f; //apply brightness, contrast and gamma. f32 fIntensity = 0.0f; f32 fValue; const f32 fInc = 1.0f / 255.0f; for (int i=0; i<256; i++) { //apply contrast fValue = fContrast*(fIntensity - 0.5f) + 0.5f; //apply brightness fValue = fBrightness*fValue; //apply gamma fValue = powf(fValue, fGamma); //clamp. fValue = Math::saturate(fValue); int intValue = ((int)(fValue*255.0f)) << 8; m_GammaRamp[0][i] = intValue; m_GammaRamp[1][i] = intValue; m_GammaRamp[2][i] = intValue; fIntensity += fInc; } SetDeviceGammaRamp(m_hDC, m_GammaRamp); } } bool GraphicsDeviceGL_Win32::init() { if (m_initialized) { return true; } const GLubyte* glVersion = glGetString(GL_VERSION); const GLubyte* glExtensions = glGetString(GL_EXTENSIONS); //initialize GLEW for extension loading. const GLenum err = glewInit(); if (err != GLEW_OK) { LOG( LOG_ERROR, "GLEW failed to initialize, an OpenGL device cannot be created." ); return false; } LOG( LOG_MESSAGE, "glVersion: %s", (const char*)glVersion ); //check against the minimum version. if ( GLEW_VERSION_1_3 == GL_FALSE ) { LOG( LOG_ERROR, "OpenGL Version 1.3 is not supported. Aborting XL Engine startup." ); return false; } m_initialized = true; return true; } GraphicsDeviceID GraphicsDeviceGL_Win32::autodetect(int nParam, void **param) { GraphicsDeviceID devID = GDEV_OPENGL_1_3; setWindowData(nParam, param, GDEV_INVALID); if ( !init() ) { return GDEV_INVALID; } if ( GLEW_VERSION_3_2 == GL_TRUE ) { devID = GDEV_OPENGL_3_2; } else if ( GLEW_VERSION_2_0 == GL_TRUE ) { devID = GDEV_OPENGL_2_0; } //hack - this is here until the OpenGL 3.2 device is implemented. //remove as soon as the device is available! if (devID == GDEV_OPENGL_3_2) { devID = GDEV_OPENGL_2_0; } //end hack return devID; } void GraphicsDeviceGL_Win32::enableVSync(bool enable) { if (wglSwapIntervalEXT) { const s32 enableValue = m_adaptiveVsync ? -1 : 1; wglSwapIntervalEXT( enable ? enableValue : 0 ); } m_vsyncEnabled = enable; } bool GraphicsDeviceGL_Win32::queryExtension(const char* name) { return glewGetExtension(name)!=0; }
7cc047d13743881e371aa8f2aaef8aee2231db9a
99ca8cfd92f3e55f7d50f842fd6dd43989100cf1
/Dev/SourcesEditor/Gugu/Editor/Panel/Document/AnimSetPanel.cpp
cde329730f11a276842fb0fbefafa60dfafc605a
[ "Zlib" ]
permissive
Legulysse/gugu-engine
601b28f1837fc091794293a247b0dc8e20885dba
675ac39d8f7ff9a994852a2542245284a52fb78f
refs/heads/master
2023-09-06T06:27:55.291439
2023-09-03T15:41:07
2023-09-03T15:41:07
139,244,874
19
2
null
2018-07-26T22:50:09
2018-06-30T11:44:01
C++
UTF-8
C++
false
false
19,522
cpp
//////////////////////////////////////////////////////////////// // Header #include "Gugu/Common.h" #include "Gugu/Editor/Panel/Document/AnimSetPanel.h" //////////////////////////////////////////////////////////////// // Includes #include "Gugu/Editor/Editor.h" #include "Gugu/Editor/Core/ProjectSettings.h" #include "Gugu/Editor/Widget/RenderViewport.h" #include "Gugu/Editor/Modal/GenerateAnimationFramesDialog.h" #include "Gugu/Animation/ManagerAnimations.h" #include "Gugu/Animation/SpriteAnimation.h" #include "Gugu/Resources/ManagerResources.h" #include "Gugu/Resources/AnimSet.h" #include "Gugu/Resources/ImageSet.h" #include "Gugu/Resources/Texture.h" #include "Gugu/Element/2D/ElementSprite.h" #include "Gugu/System/SystemUtility.h" #include "Gugu/Math/MathUtility.h" #include "Gugu/External/ImGuiUtility.h" //////////////////////////////////////////////////////////////// // File Implementation namespace gugu { AnimSetPanel::AnimSetPanel(AnimSet* resource) : DocumentPanel(resource) , m_animSet(resource) , m_renderViewport(nullptr) , m_zoomFactor(1.f) , m_speedFactor(1.f) , m_autoPlay(true) , m_originFromAnimation(false) , m_moveFromAnimation(false) , m_flipH(false) , m_currentAnimation(nullptr) , m_currentFrame(nullptr) , m_defaultDuration(0.1f) , m_spriteAnimation(nullptr) , m_sprite(nullptr) { // Setup RenderViewport and Sprite. m_renderViewport = new RenderViewport(true); m_renderViewport->SetSize(Vector2u(500, 500)); // Setup animation m_sprite = m_renderViewport->GetRoot()->AddChild<ElementSprite>(); m_sprite->SetUnifiedPosition(UDim2::POSITION_CENTER); m_sprite->SetUnifiedOrigin(UDim2::POSITION_CENTER); m_spriteAnimation = GetAnimations()->AddAnimation(m_sprite); m_spriteAnimation->ChangeAnimSet(m_animSet); SelectAnimation(m_animSet->GetAnimation(0)); // Dependencies GetResources()->RegisterResourceListener(m_animSet, this, STD_BIND_3(&AnimSetPanel::OnResourceEvent, this)); } AnimSetPanel::~AnimSetPanel() { // Dependencies GetResources()->UnregisterResourceListeners(m_animSet, this); SafeDelete(m_renderViewport); } void AnimSetPanel::OnUndoRedo() { // TODO: keep animation and frame names, and try to restore selection. SelectAnimation(nullptr); } void AnimSetPanel::OnVisibilityChanged(bool visible) { m_spriteAnimation->SetAnimationPause(!m_autoPlay || !visible); } void AnimSetPanel::UpdatePanelImpl(const DeltaTime& dt) { // Toolbar. if (ImGui::SliderFloat("Zoom Factor", &m_zoomFactor, 0.f, 16.f)) { m_renderViewport->SetZoom(m_zoomFactor); } if (ImGui::SliderFloat("Speed Factor", &m_speedFactor, 0.1f, 10.f)) { m_spriteAnimation->SetAnimationSpeed(m_speedFactor); } if (ImGui::Checkbox("Play", &m_autoPlay)) { m_spriteAnimation->SetAnimationPause(!m_autoPlay); } ImGui::SameLine(); if (ImGui::Checkbox("Origin", &m_originFromAnimation)) { m_spriteAnimation->SetOriginFromAnimation(m_originFromAnimation); if (!m_originFromAnimation) { m_sprite->SetUnifiedOrigin(UDim2::POSITION_CENTER); } } ImGui::SameLine(); if (ImGui::Checkbox("Move", &m_moveFromAnimation)) { m_spriteAnimation->SetMoveFromAnimation(m_moveFromAnimation); if (!m_moveFromAnimation) { m_sprite->SetUnifiedPosition(UDim2::POSITION_CENTER); } } ImGui::SameLine(); if (ImGui::Checkbox("Flip H", &m_flipH)) { m_sprite->SetFlipH(m_flipH); } // Viewport. m_renderViewport->ImGuiBegin(); m_renderViewport->ImGuiEnd(); } void AnimSetPanel::UpdatePropertiesImpl(const DeltaTime& dt) { // AnimSet edition. ImageSet* mainImageSet = m_animSet->GetImageSet(); std::string mainImageSetID = !mainImageSet ? "" : mainImageSet->GetID(); if (ImGui::InputText("ImageSet", &mainImageSetID, ImGuiInputTextFlags_EnterReturnsTrue)) { ChangeMainImageSet(GetResources()->GetImageSet(mainImageSetID)); } ImGui::Spacing(); // Generators. ImGui::InputFloat("Default Duration", &m_defaultDuration); ImGui::BeginDisabled(m_currentAnimation == nullptr); if (ImGui::Button("Generate Animation Frames")) { OnGenerateAnimationFrames(); } ImGui::EndDisabled(); ImGui::Spacing(); // Frame edition if (m_currentFrame) { ImGui::BeginDisabled(m_animSet->GetImageSet() == nullptr); SubImage* frameSubImage = !m_animSet->GetImageSet() ? nullptr : m_currentFrame->GetSubImage(); std::string frameSubImageName = !frameSubImage ? "" : frameSubImage->GetName(); if (ImGui::InputText("SubImage", &frameSubImageName, ImGuiInputTextFlags_EnterReturnsTrue)) { m_currentFrame->SetSubImage(m_animSet->GetImageSet()->GetSubImage(frameSubImageName)); RaiseDirty(); } ImGui::EndDisabled(); Texture* frameTexture = m_currentFrame->GetTexture(); std::string frameTextureId = !frameTexture ? "" : frameTexture->GetID(); if (ImGui::InputText("Texture", &frameTextureId, ImGuiInputTextFlags_EnterReturnsTrue)) { m_currentFrame->SetTexture(GetResources()->GetTexture(frameTextureId)); RaiseDirty(); } Vector2f frameOrigin = m_currentFrame->GetOrigin(); if (ImGui::InputFloat2("Origin", &frameOrigin)) { m_currentFrame->SetOrigin(frameOrigin); RaiseDirty(); } Vector2f frameMoveOffset = m_currentFrame->GetMoveOffset(); if (ImGui::InputFloat2("Move Offset", &frameMoveOffset)) { m_currentFrame->SetMoveOffset(frameMoveOffset); RaiseDirty(); } } else { ImGui::BeginDisabled(); std::string dummyStrA; std::string dummyStrB; Vector2f dummyVecA; Vector2f dummyVecB; ImGui::InputText("SubImage", &dummyStrA); ImGui::InputText("Texture", &dummyStrB); ImGui::InputFloat2("Origin", &dummyVecA); ImGui::InputFloat2("Move Offset", &dummyVecB); ImGui::EndDisabled(); } ImGui::Spacing(); // Animation edition buttons. { if (ImGui::Button("Add Animation")) { OnAddAnimation(); } ImGui::SameLine(); ImGui::BeginDisabled(m_currentAnimation == nullptr); if (ImGui::Button("Remove Animation")) { OnRemoveAnimation(); } ImGui::EndDisabled(); } // Animations list. ImGuiTableFlags animationTableflags = ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_ScrollY /*| ImGuiTableFlags_NoPadInnerX */; if (ImGui::BeginTable("_ANIMATIONS_TABLE", 5, animationTableflags)) { ImGuiTableColumnFlags animationColumnFlags = ImGuiTableColumnFlags_WidthFixed; ImGui::TableSetupColumn("name", animationColumnFlags, 120.f); ImGui::TableSetupColumn("play", animationColumnFlags, 30.f); ImGui::TableSetupColumn("duration", animationColumnFlags, 50.f); ImGui::TableSetupColumn("actions", animationColumnFlags, 40.f); ImGui::TableSetupColumn("remove", animationColumnFlags, 40.f); ImGui::TableSetupScrollFreeze(0, 1); ImGui::TableHeadersRow(); const std::vector<Animation*>& animations = m_animSet->GetAnimations(); for (size_t animationIndex = 0; animationIndex < animations.size(); ++animationIndex) { ImGui::PushID((int)animationIndex); float row_min_height = ImGui::GetFrameHeight(); ImGui::TableNextRow(ImGuiTableRowFlags_None, row_min_height); if (animationIndex == 0) { // Setup ItemWidth once. int headerIndex = 0; ImGui::TableSetColumnIndex(headerIndex++); ImGui::PushItemWidth(-1); ImGui::TableSetColumnIndex(headerIndex++); ImGui::PushItemWidth(-1); ImGui::TableSetColumnIndex(headerIndex++); ImGui::PushItemWidth(-1); ImGui::TableSetColumnIndex(headerIndex++); ImGui::PushItemWidth(-1); ImGui::TableSetColumnIndex(headerIndex++); ImGui::PushItemWidth(-1); } Animation* animation = animations[animationIndex]; // Animation name. int columnIndex = 0; ImGui::TableSetColumnIndex(columnIndex++); ImGuiSelectableFlags selectable_flags = ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap; if (ImGui::Selectable("##_ANIMATION_SELECTABLE", m_currentAnimation == animation, selectable_flags, ImVec2(0, row_min_height))) { if (m_currentAnimation != animation) { SelectAnimation(animation); } } ImGui::SameLine(); std::string animationName = animation->GetName(); if (ImGui::InputText("##_ANIMATION_NAME", &animationName)) { animation->SetName(animationName); RaiseDirty(); } // Play cursor. ImGui::TableSetColumnIndex(columnIndex++); ImGui::Text(m_spriteAnimation->GetAnimation() == animation ? "<--" : ""); // Empty column (used in frames section). ImGui::TableSetColumnIndex(columnIndex++); // Actions. ImGui::TableSetColumnIndex(columnIndex++); if (ImGui::Button("Add")) { AnimationFrame* referenceFrame = (animation->GetFrameCount() == 0) ? nullptr : animation->GetFrame(0); AnimationFrame* newFrame = animation->AddFrame(0); CopyFrame(newFrame, referenceFrame); RaiseDirty(); } // Empty column (used in frames section). ImGui::TableSetColumnIndex(columnIndex++); // Frames. { ImGui::Indent(); // Frames list. const std::vector<AnimationFrame*>& animationFrames = animation->GetFrames(); for (size_t frameIndex = 0; frameIndex < animationFrames.size(); ++frameIndex) { ImGui::PushID((int)frameIndex); float frame_row_min_height = ImGui::GetFrameHeight(); ImGui::TableNextRow(ImGuiTableRowFlags_None, frame_row_min_height); AnimationFrame* frame = animationFrames[frameIndex]; // Frame name. int frameColumnIndex = 0; ImGui::TableSetColumnIndex(frameColumnIndex++); std::string frameName = StringFormat("{0} [{1}]", animation->GetName(), frameIndex); ImGuiSelectableFlags selectable_frame_flags = ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap; if (ImGui::Selectable(frameName.c_str(), m_currentFrame == frame, selectable_frame_flags, ImVec2(0, frame_row_min_height))) { if (m_currentAnimation != animation) { SelectAnimation(animation); } m_currentFrame = frame; if (!m_autoPlay) { m_spriteAnimation->SetCurrentFrame(frameIndex); } } // Play cursor. ImGui::TableSetColumnIndex(frameColumnIndex++); ImGui::Text(m_spriteAnimation->GetAnimationFrame() == frame ? "<-" : ""); // Duration. ImGui::TableSetColumnIndex(frameColumnIndex++); float frameDuration = frame->GetDuration(); if (ImGui::InputFloat("##_FRAME_DURATION", &frameDuration)) { frame->SetDuration(frameDuration); RaiseDirty(); } // Actions. ImGui::TableSetColumnIndex(frameColumnIndex++); if (ImGui::Button("Add")) { AnimationFrame* referenceFrame = frame; AnimationFrame* newFrame = animation->AddFrame(frameIndex + 1); CopyFrame(newFrame, referenceFrame); RaiseDirty(); } // Remove Frame. ImGui::TableSetColumnIndex(frameColumnIndex++); if (ImGui::Button("X")) { if (frame) { bool isCurrentFrame = m_currentFrame == frame; size_t removedFrameIndex = animation->GetFrameIndex(frame); animation->DeleteFrame(frame); m_spriteAnimation->RestartAnimation(); if (isCurrentFrame) { m_currentFrame = animation->GetFrame(Min(animation->GetFrameCount() - 1, removedFrameIndex)); } if (m_currentFrame) { m_spriteAnimation->SetCurrentFrame(m_currentFrame); } RaiseDirty(); } } ImGui::PopID(); } ImGui::Unindent(); } ImGui::PopID(); } ImGui::EndTable(); } } void AnimSetPanel::SelectAnimation(Animation* animation) { m_currentAnimation = animation; m_currentFrame = nullptr; if (m_currentAnimation) { m_spriteAnimation->StartAnimation(m_currentAnimation); if (m_currentAnimation->GetFrameCount() > 0) { m_currentFrame = m_currentAnimation->GetFrame(0); } } else { m_spriteAnimation->StopAnimation(); } } void AnimSetPanel::OnAddAnimation() { Animation* newAnimation = m_animSet->AddAnimation(StringFormat("Animation_{0}", m_animSet->GetAnimations().size())); RaiseDirty(); SelectAnimation(newAnimation); } void AnimSetPanel::OnRemoveAnimation() { if (!m_currentAnimation) return; if (m_spriteAnimation->GetAnimation() == m_currentAnimation) { m_spriteAnimation->StopAnimation(); } m_animSet->DeleteAnimation(m_currentAnimation); m_currentAnimation = nullptr; m_currentFrame = nullptr; RaiseDirty(); } void AnimSetPanel::OnGenerateAnimationFrames() { GetEditor()->OpenModalDialog(new GenerateAnimationFramesDialog( m_animSet->GetImageSet(), STD_BIND_1(&AnimSetPanel::GenerateAnimationFramesFromDirectory, this), STD_BIND_2(&AnimSetPanel::GenerateAnimationFramesFromImageSet, this) )); } void AnimSetPanel::GenerateAnimationFramesFromDirectory(const std::string& path) { if (!m_currentAnimation) return; std::string targetPath = CombinePaths(GetEditor()->GetProjectSettings()->projectAssetsPath, path); if (!PathStartsWith(targetPath, GetEditor()->GetProjectSettings()->projectAssetsPath)) return; std::vector<FileInfo> directoryFiles; GetFiles(targetPath, directoryFiles, false); std::sort(directoryFiles.begin(), directoryFiles.end()); for (size_t i = 0; i < directoryFiles.size(); ++i) { const std::string& resourceID = GetResources()->GetResourceID(directoryFiles[i]); if (GetResources()->HasResource(resourceID)) { Texture* texture = GetResources()->GetTexture(resourceID); if (texture) { AnimationFrame* newFrame = m_currentAnimation->AddFrame(); newFrame->SetTexture(texture); newFrame->SetDuration(m_defaultDuration); } } } RaiseDirty(); } void AnimSetPanel::GenerateAnimationFramesFromImageSet(size_t from, size_t to) { if (!m_currentAnimation) return; ImageSet* imageSet = m_animSet->GetImageSet(); if (!imageSet) return; const std::vector<SubImage*>& subImages = imageSet->GetSubImages(); if (from > to || to >= subImages.size()) return; for (size_t i = from; i <= to; ++i) { AnimationFrame* newFrame = m_currentAnimation->AddFrame(); newFrame->SetSubImage(subImages[i]); newFrame->SetDuration(m_defaultDuration); } RaiseDirty(); } void AnimSetPanel::ChangeMainImageSet(ImageSet* newImageSet) { ImageSet* mainImageSet = m_animSet->GetImageSet(); if (mainImageSet == newImageSet) return; const std::vector<Animation*>& animations = m_animSet->GetAnimations(); for (size_t i = 0; i < animations.size(); ++i) { const std::vector<AnimationFrame*>& frames = animations[i]->GetFrames(); for (size_t ii = 0; ii < frames.size(); ++ii) { // TODO: handle frames with explicit reference on an ImageSet (currently info is lost after loading). // TODO: deprecate multiple imagesets instead. if (!newImageSet) { frames[ii]->SetSubImage(nullptr); } else if (frames[ii]->GetSubImage()) { frames[ii]->SetSubImage(newImageSet->GetSubImage(frames[ii]->GetSubImage()->GetName())); } } } m_animSet->SetImageSet(newImageSet); RaiseDirty(); m_spriteAnimation->RestartAnimation(); } void AnimSetPanel::CopyFrame(AnimationFrame* targetFrame, const AnimationFrame* referenceFrame) { if (referenceFrame) { // TODO: copy ctor used in AddFrame ? targetFrame->SetDuration(referenceFrame->GetDuration()); targetFrame->SetTexture(referenceFrame->GetTexture()); targetFrame->SetSubImage(referenceFrame->GetSubImage()); targetFrame->SetOrigin(referenceFrame->GetOrigin()); targetFrame->SetMoveOffset(referenceFrame->GetMoveOffset()); } } void AnimSetPanel::OnResourceEvent(const Resource* resource, EResourceEvent event, const Resource* dependency) { if (event == EResourceEvent::DependencyRemoved || event == EResourceEvent::DependencyUpdated) { // TODO: If I keep subimage names in animation frames, I could directly handle retargeting in a OnDependencyUpdated method on the resource itself, and call a Restart here. ReloadCurrentState(); SelectAnimation(nullptr); } } } //namespace gugu
d717e77b99ee24acef191ad93d71816756302c6c
a06a9ae73af6690fabb1f7ec99298018dd549bb7
/_Library/_Include/boost/align/aligned_allocator_forward.hpp
72bd677440cc449e5cd685936707d29befc76b71
[]
no_license
longstl/mus12
f76de65cca55e675392eac162dcc961531980f9f
9e1be111f505ac23695f7675fb9cefbd6fa876e9
refs/heads/master
2021-05-18T08:20:40.821655
2020-03-29T17:38:13
2020-03-29T17:38:13
null
0
0
null
null
null
null
UTF-8
C++
false
false
729
hpp
//////////////////////////////////////////////////////////////////////////////// // aligned_allocator_forward.hpp /* (c) 2014 Glen Joseph Fernandes glenjofe at gmail dot com Distributed under the Boost Software License, Version 1.0. http://boost.org/LICENSE_1_0.txt */ #ifndef BOOST_ALIGN_ALIGNED_ALLOCATOR_FORWARD_HPP #define BOOST_ALIGN_ALIGNED_ALLOCATOR_FORWARD_HPP #include <cstddef> namespace boost { namespace alignment { template<class T, std::size_t Alignment = 1> class aligned_allocator; } /* :alignment */ } /* :boost */ #endif ///////////////////////////////////////////////// // vnDev.Games - Trong.LIVE - DAO VAN TRONG // ////////////////////////////////////////////////////////////////////////////////
bb6a1e750b908360183b8c56fe0a726970b08d44
6abff8a28f227da140bfc46651c769f570f4ee80
/DrawingPad/include/server.hxx
44f1c38c465268816c68cace8871a8e771cba553
[]
no_license
yash101/DrawingPad
64de5f3b4022b60b7bdc14e9dda336b3433697d5
e9bafefd9e85c800479c985d2e80bfb3de688be7
refs/heads/master
2016-09-06T11:00:46.165388
2015-05-15T04:50:27
2015-05-15T04:50:27
25,750,792
1
0
null
null
null
null
UTF-8
C++
false
false
646
hxx
#include "../dlib/server.h" #include <string> #include <sstream> #include <fstream> #include <unordered_map> #include <string> #include "../dlib/server/server_iostream.h" #include "../dlib/base64.h" #include "definitions.hxx" #include <mutex> #include <thread> #include "Session.hxx" #include <map> class paint_server : public dlib::server_http { private: std::timed_mutex locky_thingy; SessionHost sessions; const std::string process_request(const dlib::incoming_things& incoming, dlib::outgoing_things& outgoing); public: const std::string on_request(const dlib::incoming_things& incoming, dlib::outgoing_things& outgoing); };
e5d76303309c6168ed204656c2f0e0b09e3c527d
73de5f2f138d90f1091aae8a62e554e7989659fb
/code/ppf/src/ppf.cpp
57d7843876e57d52fdac707ef76f722f2ef0d83d
[]
no_license
zhuangzhuang-zhang/PPF_ICP
13d562acf432623076e3bff8fc0a3e7852bd4a77
e438d23c3ced19d0f53122e1ea18b18ca3991aa3
refs/heads/master
2023-03-16T12:10:22.645461
2021-03-20T14:04:28
2021-03-20T14:04:28
314,814,059
1
0
null
null
null
null
UTF-8
C++
false
false
15,129
cpp
#include "ppf.hpp" namespace ppf { static bool pose6DPtrCompare(const obj6D::Pose6DPtr& a, const obj6D::Pose6DPtr& b) { CV_Assert(!a.empty() && !b.empty()); return ( a->numVotes > b->numVotes ); } static int sortPoseClusters(const obj6D::PoseCluster6DPtr& a, const obj6D::PoseCluster6DPtr& b) { CV_Assert(!a.empty() && !b.empty()); return ( a->numVotes > b->numVotes ); } static bool numberCompare(const float& a, const float& b) { return ( a > b ); } static KeyType hashPPF(const cv::Vec4d& f, const double AngleStep, const double DistanceStep, int &idx) { cv::Vec4i key( (int)(f[0] / AngleStep), (int)(f[1] / AngleStep), (int)(f[2] / AngleStep), (int)(f[3] / DistanceStep)); KeyType hashKey = 0; int angle_dim = (int)(360.0f/(AngleStep*180.0f/CV_PI)); idx = key[0] + key[1] * angle_dim + key[2] * angle_dim * angle_dim + key[3] * angle_dim * angle_dim * angle_dim; murmurHash(key.val, 4*sizeof(int), 42, &hashKey); return hashKey; } static double computeAlpha(const cv::Vec3d& p1, const cv::Vec3d& n1, const cv::Vec3d& p2) { cv::Vec3d Tmg, mpt; cv::Matx33d R; double alpha; computeTransformRT(p1, n1, R, Tmg); mpt = Tmg + R * p2; alpha=atan2(-mpt[2], mpt[1]); if ( alpha != alpha) { return 0; } if (sin(alpha)*mpt[2]<0.0) alpha=-alpha; return (-alpha); } bool PPF6DDetector::matchPose(const obj6D::Pose6D& sourcePose, const obj6D::Pose6D& targetPose) { // translational difference cv::Vec3d dv = targetPose.pose_t - sourcePose.pose_t; double dNorm = cv::norm(dv); double phi = 0; cv::Matx33d R = sourcePose.pose_R*targetPose.pose_R.t(); cv::Vec3d v1(sourcePose.pose_R(0,2),sourcePose.pose_R(1,2),sourcePose.pose_R(2,2)); cv::Vec3d v2(targetPose.pose_R(0,2),targetPose.pose_R(1,2),targetPose.pose_R(2,2)); double angle_z = TAngle3Normalized(v1,v2); const double trace = cv::trace(R); if (fabs(trace - 3) > EPS) { if (fabs(trace + 1) <= EPS) { phi = CV_PI; } else { phi = ( acos((trace - 1)/2) ); } } if(phi<0) { phi = -phi; } //std::cout<<phi<<std::endl; return ((phi < rotation_threshold && dNorm < position_threshold)||(angle_z<rotation_threshold && dNorm < position_threshold)); } PPF6DDetector::PPF6DDetector() { dist_sampling = 0.05; angle_step = 30.0f; distance_step = 0.015; rotation_threshold = 360.0f/30.0f*(CV_PI/180.0f); position_threshold = 0.01; dist_threshold = 0.1; } PPF6DDetector::PPF6DDetector(const double distSampling, const double angleStep, const double rotationThred, const double positionThred) { dist_sampling = distSampling; angle_step = angleStep; distance_step = 0.015; rotation_threshold = rotationThred*(CV_PI/180.0f); position_threshold = positionThred; dist_threshold = 0.1; } void PPF6DDetector::preProcessing(CloudPointT1Ptr pc, CloudPointT2 &pc_with_normals, bool training) { if(training) { cv::Vec2f xRange, yRange, zRange; computeBboxStd(pc, xRange, yRange, zRange); std::vector<float> d(3); d[0] = xRange[1] - xRange[0]; d[1] = yRange[1] - yRange[0]; d[2] = zRange[1] - zRange[0]; float diameter = sqrt ( d[0] * d[0] + d[1] * d[1] + d[2] * d[2] ); std::sort(d.begin(),d.end(),numberCompare); float sampleDiameter = sqrt(d[1]*d[1] + d[2]*d[2]); distance_step = (float)(diameter * dist_sampling); dist_threshold = sampleDiameter; std::cout<<"distance_step: "<<distance_step<<std::endl; } pcl::PointCloud<PointT1>::Ptr pc_downsample (new pcl::PointCloud<PointT1> ()); pcl::VoxelGrid<PointT1> sor; sor.setInputCloud(pc); sor.setLeafSize(distance_step, distance_step, distance_step); sor.filter(*pc_downsample); pcl::NormalEstimationOMP<PointT1, pcl::Normal> ne; ne.setInputCloud(pc_downsample); pcl::search::KdTree<PointT1>::Ptr tree (new pcl::search::KdTree<PointT1>); ne.setSearchMethod(tree); pcl::PointCloud<pcl::Normal>::Ptr pc_normals (new pcl::PointCloud<pcl::Normal>); ne.setRadiusSearch(0.03); ne.compute(*pc_normals); pcl::concatenateFields(*pc_downsample, *pc_normals, pc_with_normals); if(training) { #pragma omp parallel for for (int i=0; i<pc_with_normals.points.size(); i++) { pc_with_normals.points[i].normal_x = -pc_with_normals.points[i].normal_x; pc_with_normals.points[i].normal_y = -pc_with_normals.points[i].normal_y; pc_with_normals.points[i].normal_z = -pc_with_normals.points[i].normal_z; } std::cout<<"normal size: "<<pc_with_normals.points.size()<<std::endl; } } void PPF6DDetector::trainModel(CloudPointT2Ptr pc) { int numRefPoints = pc->points.size(); hashtable_int* hashTable = hashtableCreate(numRefPoints*numRefPoints, NULL); hash_nodes = (THash*)calloc(numRefPoints*numRefPoints, sizeof(THash)); angle_table = cv::Mat(numRefPoints*numRefPoints, 1, CV_32FC1); #pragma omp parallel for for (int i=0; i<numRefPoints; i++) { const cv::Vec3f p1(pc->points[i].x, pc->points[i].y, pc->points[i].z); const cv::Vec3f n1(pc->points[i].normal_x, pc->points[i].normal_y, pc->points[i].normal_z); for (int j=0; j<numRefPoints; j++) { if (i!=j) { const cv::Vec3f p2(pc->points[j].x, pc->points[j].y, pc->points[j].z); const cv::Vec3f n2(pc->points[j].normal_x, pc->points[j].normal_y, pc->points[j].normal_z); cv::Vec4d f = cv::Vec4d::all(0); computePPFFeatures(p1, n1, p2, n2, f); int idx; KeyType hashValue = hashPPF(f, angle_step*CV_PI/180.0f, distance_step, idx); double alpha = computeAlpha(p1, n1, p2); uint ppfInd = i*numRefPoints+j; THash* hashNode = &hash_nodes[i*numRefPoints+j]; hashNode->id = hashValue; hashNode->i = i; hashNode->ppfInd = ppfInd; //#pragma omp critical hashtableInsertHashed(hashTable, hashValue, (void*)hashNode); angle_table.ptr<float>(ppfInd)[0] = (float)alpha; } } } pcl2cvMat(pc_model,*pc); hash_table = hashTable; } void PPF6DDetector::computePPFFeatures(const cv::Vec3d& p1, const cv::Vec3d& n1, const cv::Vec3d& p2, const cv::Vec3d& n2, cv::Vec4d& f) { cv::Vec3d d(p2 - p1); f[3] = cv::norm(d); if (f[3] <= EPS) return; d *= 1.0 / f[3]; f[0] = TAngle3Normalized(n1, d); f[1] = TAngle3Normalized(n2, d); f[2] = TAngle3Normalized(n1, n2); } void PPF6DDetector::match(CloudPointT2Ptr pc, std::vector<obj6D::Pose6DPtr>& results, const double relativeSceneSampleStep) { int angle_dim = (int)(360.0f/angle_step); int dist_dim = (int)(1.0/dist_sampling); int numRefPoints = pc->points.size(); int numModlePoints = pc_model.rows; int sceneSamplingStep = (int)(1.0/relativeSceneSampleStep); int numAngles = (int) (floor (360.0f / angle_step)); int acc_space = numModlePoints*numAngles; int flag_space = angle_dim*angle_dim*angle_dim*dist_dim; //std::cout<<"acc_space: "<<acc_space<<std::endl; std::vector<obj6D::Pose6DPtr> poseList(0); pcl::KdTreeFLANN<PointT2> kdtree; kdtree.setInputCloud(pc); float radius = dist_threshold; #pragma omp parallel for for (size_t i = 0; i < numRefPoints; i += sceneSamplingStep) { pcl::PointNormal referencePoint = pc->points[i]; uint refIndMax = 0, alphaIndMax = 0; uint maxVotes = 0; const cv::Vec3f p1(referencePoint.x, referencePoint.y, referencePoint.z); const cv::Vec3f n1(referencePoint.normal_x, referencePoint.normal_y, referencePoint.normal_z); cv::Vec3d tsg = cv::Vec3d::all(0); cv::Matx33d Rsg = cv::Matx33d::all(0), RInv = cv::Matx33d::all(0); computeTransformRT(p1, n1, Rsg, tsg); uint* accumulator = (uint*)calloc(acc_space, sizeof(uint)); std::vector<int> pointIdxRadiusSearch; std::vector<float> pointRadiusSquaredDistance; ulong* flag = (ulong*)calloc(flag_space, sizeof(ulong)); //uint* flag = (uint*)calloc(angle_dim*angle_dim*angle_dim*dist_dim*numAngles, sizeof(uint)); if(kdtree.radiusSearch(referencePoint,radius,pointIdxRadiusSearch,pointRadiusSquaredDistance)>0) { //std::cout<<pointIdxRadiusSearch.size()<<std::endl; for(size_t j = 1; j < pointIdxRadiusSearch.size(); ++j) { pcl::PointNormal point = pc->points[pointIdxRadiusSearch[j]]; const cv::Vec3f p2(point.x, point.y, point.z); const cv::Vec3f n2(point.normal_x, point.normal_y, point.normal_z); cv::Vec3d p2t; double alpha_scene; cv::Vec4d f = cv::Vec4d::all(0); computePPFFeatures(p1, n1, p2, n2, f); //std::cout<<f<<std::endl; int idx; KeyType hashValue = hashPPF(f, angle_step*CV_PI/180.0f, distance_step, idx); p2t = tsg + Rsg * cv::Vec3d(p2); alpha_scene=atan2(-p2t[2], p2t[1]); if (alpha_scene != alpha_scene) { continue; } if (sin(alpha_scene)*p2t[2]<0.0) alpha_scene=-alpha_scene; alpha_scene=-alpha_scene; int alpha_scene_index = (int)(numAngles*(alpha_scene + 2*M_PI) / (4*M_PI)); uint alphaIndex = idx; ulong alpha_scene_bit = pow(2, alpha_scene_index); ulong t = flag[alphaIndex] | alpha_scene_bit; if(t==flag[alphaIndex]){continue;} else{flag[alphaIndex] = t;} // uint alphaIndex = idx * numAngles + alpha_scene_index; // if(flag[alphaIndex] == 1){continue;} // else{flag[alphaIndex]++;} hashnode_i* node = hashtableGetBucketHashed(hash_table, (hashValue)); while (node) { THash* tData = (THash*) node->data; int corrI = (int)tData->i; int ppfInd = (int)tData->ppfInd; double alpha_model = angle_table.ptr<float>(ppfInd)[0]; double alpha = alpha_model - alpha_scene; int alpha_index = (int)(numAngles*(alpha + 2*M_PI) / (4*M_PI)); uint accIndex = corrI * numAngles + alpha_index; accumulator[accIndex]++; node = node->next; } } // Maximize the accumulator for (uint k = 0; k < numModlePoints; k++) { for (int j = 0; j < numAngles; j++) { const uint accInd = k*numAngles + j; const uint accVal = accumulator[ accInd ]; if (accVal > maxVotes) { maxVotes = accVal; refIndMax = k; alphaIndMax = j; } } } cv::Vec3d tInv, tmg; cv::Matx33d Rmg; RInv = Rsg.t(); tInv = -RInv * tsg; cv::Matx44d TsgInv; rtToPose(RInv, tInv, TsgInv); const cv::Vec3f pMax(pc_model.ptr<float>(refIndMax)); const cv::Vec3f nMax(pc_model.ptr<float>(refIndMax)+3); computeTransformRT(pMax, nMax, Rmg, tmg); cv::Matx44d Tmg; rtToPose(Rmg, tmg, Tmg); // convert alpha_index to alpha int alpha_index = alphaIndMax; double alpha = (alpha_index*(4*M_PI))/numAngles-2*M_PI; cv::Matx44d Talpha; cv::Matx33d R; cv::Vec3d t = cv::Vec3d::all(0); getUnitXRotation(alpha, R); rtToPose(R, t, Talpha); cv::Matx44d rawPose = TsgInv * (Talpha * Tmg); obj6D::Pose6DPtr pose(new obj6D::Pose6D(maxVotes)); pose->updatePose(rawPose); #pragma omp critical { poseList.push_back(pose); } } free(accumulator); pointIdxRadiusSearch.clear(); pointRadiusSquaredDistance.clear(); free(flag); } clusterPoses(poseList, results); } void PPF6DDetector::clusterPoses(std::vector<obj6D::Pose6DPtr>& poseList, std::vector<obj6D::Pose6DPtr> &finalPoses) { std::vector<obj6D::PoseCluster6DPtr> poseClusters(0); finalPoses.clear(); std::sort(poseList.begin(), poseList.end(), pose6DPtrCompare); for (int i=0; i<0.5*poseList.size(); i++) { obj6D::Pose6DPtr pose = poseList[i]; bool assigned = false; for (size_t j=0; j<poseClusters.size() && !assigned; j++) { const obj6D::Pose6DPtr poseCenter = poseClusters[j]->poseList[0]; if (matchPose(*pose, *poseCenter)) { poseClusters[j]->addPose(pose); assigned = true; } } if (!assigned) { poseClusters.push_back(obj6D::PoseCluster6DPtr(new obj6D::PoseCluster6D(pose))); } } // sort the clusters so that we could output multiple hypothesis std::sort(poseClusters.begin(), poseClusters.end(), sortPoseClusters); finalPoses.resize(poseClusters.size()); #pragma omp parallel for for (int i=0; i<static_cast<int>(poseClusters.size()); i++) { cv::Vec4d qAvg = cv::Vec4d::all(0); cv::Matx44d qAvg_mat = cv::Matx44d::all(0); cv::Vec3d tAvg = cv::Vec3d::all(0); // Perform the final averaging obj6D::PoseCluster6DPtr curCluster = poseClusters[i]; std::vector<obj6D::Pose6DPtr> curPoses = curCluster->poseList; const int curSize = (int)curPoses.size(); for (int j=0; j<curSize; j++) { qAvg_mat += curPoses[j]->q*curPoses[j]->q.t(); tAvg += curPoses[j]->pose_t; } cv::Mat eigVect, eigVal; eigen(qAvg_mat, eigVal, eigVect); qAvg = eigVect.row(0); tAvg *= 1.0 / double(curSize); curPoses[0]->updatePoseQuat(qAvg, tAvg); curPoses[0]->numVotes=curCluster->numVotes; finalPoses[i]=curPoses[0]->clone(); } poseClusters.clear(); } void PPF6DDetector::clearTrainingModels() { if (this->hash_nodes) { free(this->hash_nodes); this->hash_nodes=0; } if (this->hash_table) { hashtableDestroy(this->hash_table); this->hash_table=0; } } PPF6DDetector::~PPF6DDetector() { clearTrainingModels(); } }
6761349ec0c15f83ff0f62eb5e56a9bde7072166
8a5111e07472d8223283124e75b300b86781f97e
/HSVFilter.cpp
f2b9abafaa7e0bdbb6ed5d72cdfc53a14a64ab36
[]
no_license
pierfier/OpenCVSampleProject
90120832221874a32fa81b6f35e341d970c09444
8cb5d6801257aec4912864dd6b2aa1157b021eab
refs/heads/master
2021-01-22T09:48:03.621321
2014-02-07T02:01:03
2014-02-07T02:01:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,414
cpp
#include <iostream> #include "HSVFilter.hpp" #include <opencv2/opencv.hpp> #include <opencv/cv.h> #include <opencv2/core/core.hpp> #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" using namespace std; using namespace cv; HSVFilter::HSVFilter(Mat m){ length = sizeof distribution / (sizeof (int)); distribution = new int[360]; for(int i = 0; i < length; i++){ distribution[i] = 0; } x = 0; y = 0; mat = m.clone(); width = mat.rows; height = mat.cols; cvtColor(mat, mat, CV_BGR2HSV); upperHueLimit = 0; lowerHueLimit = 0; } //needs to be implemented void HSVFilter::filterSaturation(){ } void HSVFilter::graphSaturation(){ } //needs to be implemented void HSVFilter::hueSaturationIntensityHisrogram(){ // Quantize the hue to 30 levels // and the saturation to 32 levels int hbins = 30, sbins = 32; int histSize[] = {hbins, sbins}; // hue varies from 0 to 179, see cvtColor float hranges[] = { 0, 180 }; // saturation varies from 0 (black-gray-white) to // 255 (pure spectrum color) float sranges[] = { 0, 256 }; const float* ranges[] = { hranges, sranges }; MatND hist; // we compute the histogram from the 0-th and 1-st channels int channels[] = {0, 1}; calcHist( &mat, 1, channels, Mat(), // do not use mask hist, 2, histSize, ranges, true, // the histogram is uniform false ); double maxVal=0; minMaxLoc(hist, 0, &maxVal, 0, 0); int scale = 10; Mat histImg = Mat::zeros(sbins*scale, hbins*10, CV_8UC3); for( int h = 0; h < hbins; h++ ) for( int s = 0; s < sbins; s++ ){ float binVal = hist.at<float>(h, s); int intensity = cvRound(binVal);//*255/maxVal rectangle( histImg, Point(h*scale, s*scale), Point( (h+1)*scale - 1, (s+1)*scale - 1), Scalar::all(intensity), CV_FILLED ); } namedWindow("Histogram", 1); imshow("Histogram", histImg); } void HSVFilter::valueHistogram(){ } //TODO provide a mask to have only the green hue values!!!! //then do the same thing for the value histogram //it would be preferred to do a Gaussian Blur, so there are a minimal amount of variation in the Hue values void HSVFilter::hueHistogram(){ //clones the objects Mat object to the methods disposal Mat image = mat.clone(); //blur the image, this allows for distinct differences in Hue color values GaussianBlur(image, image, Size(3, 3), 1.0); cvtColor(image, image, CV_HSV2BGR); imshow("Blur", image); cvtColor(image, image, CV_BGR2HSV); //Mat object that is going to be used for the masking Mat mask = image.clone(); inRange(mask, Scalar(70, 0, 0), Scalar(100, 255, 255), mask); imshow("Masking", mask); int histSize = 100; float vRange[] = {0, 180}; const float* range[] = {vRange}; int channel[] = {0}; Mat histResult; //calculate the histogram and sets it equal to histResult calcHist( &image, 1, channel, mask, histResult, 1, &histSize, range, true, false ); //normalizes the histogram int bin_w = cvRound( (double) 500 / histSize); //the object that actually has the plotted data Mat histogram(400, 500, CV_8UC3, Scalar( 0,0,0)); normalize(image, image, 0, histogram.rows, NORM_MINMAX, -1, Mat() ); //draws the histogram plot to the histogram image for(int i = 1; i < histSize; i++){ line(histogram, Point( bin_w * (i - 1), 400 - cvRound(histResult.at<float>(i - 1)) ), Point( bin_w * (i), 400 - cvRound(histResult.at<float>(i)) ), Scalar(100, 200, 0), 2, 8, 0 ); } namedWindow("Histogram", 1); imshow("Histogram", histogram); } int HSVFilter::getPixelHue(int xH, int yH){ Vec3b pixel = mat.at<Vec3b>(yH, xH); return pixel[0]; } int HSVFilter::getPixelSaturation(int xS, int yS){ Vec3b pixel = mat.at<Vec3b>(yS, xS); return pixel[1]; } void HSVFilter::filterHue(){ for(int i = x; i < width; i++){ for(int j = y; j < height; j++){ Vec3b pixel = mat.at<Vec3b>(i, j); wcout << "Pixel's Hue: " << i << " " << j << " " << pixel[0] << endl; distribution[pixel[0]] += 1; } } } void HSVFilter::graphHue(){ for(int i = lowerHueLimit; i < upperHueLimit; i++){ wcout << i << " "; wcout << distribution[i]; wcout << endl; } } HSVFilter::~HSVFilter(){ delete [] distribution; }
fa58f8177b90e81467d7350690038efd005fb782
8484a7ac59a108eb6605d2d764726b053b43e64c
/menu_5_serial/menu_5_serial.ino
2e880d2ccaabec323ac7a81ebc5726b2c9b51eec
[]
no_license
millerlp/ard_class_menus
3131003ec5a31148ff3e1cc5512863eb0784a65c
407ab74e4862b5a09ad61411be27e9f80f1f3b75
refs/heads/master
2021-01-23T08:52:48.934351
2015-03-13T17:19:28
2015-03-13T17:19:28
32,127,368
0
0
null
null
null
null
UTF-8
C++
false
false
5,042
ino
/* Use an Uno, communicating with the computer serial monitor Connect a button between D2 and ground */ #define Button1 2 // Uno pin D2 #define LED 13 // use built-in LED on pin 13 int flashrate = 1; // initial flash rate, 1 Hz int flashdelay = 0; // convert flash rate into a ms delay value byte updown = 0; // 0 = down, 1 = up void setup(){ Serial.begin(9600); pinMode(LED, OUTPUT); // turn LED pin to output pinMode(Button1, INPUT_PULLUP); // make button input, use internal pullup resistor delay(2000); Serial.print("Current flash rate: "); Serial.print(flashrate); Serial.println("Hz"); Serial.println("Adjust flash rate up or down?"); if (updown) { Serial.println("Up"); } else { Serial.println("Down"); } flashdelay = flashRateFunc(); // call the flashRateFunc to choose a flash rate } void loop(){ delay(flashdelay); digitalWrite(LED, !( digitalRead(LED) ) ); // toggle LED } //************************************************************ // flashRateFunc allows the user to press Button1 and choose a // new flash rate. The returned value is the delay in milliseconds // needed to create the desired flash rate (in Hz). int flashRateFunc(void) { // the global variable flashrate was defined earlier. Here we will // change its value and return that to the main loop byte buttonValue1; byte buttonValue2; byte buttonState; long startTime = millis(); // Get start time for this loop buttonState = digitalRead(Button1); // get current state of button (probably HIGH) // Go into a loop that lasts at least 3 seconds to give the user time to punch button while (millis() <= startTime + 3000) // while millis is less than 3 sec from startTime { buttonValue1 = digitalRead(Button1); delay(10); // perform a crude debounce by checking button twice over 10ms buttonValue2 = digitalRead(Button1); if (buttonValue1 == buttonValue2) // make sure button is stable { if (buttonValue1 != buttonState) // make sure button has changed { if (buttonValue1 == LOW) // if button is pressed { if (updown) { updown = 0; Serial.println("Down"); } else { updown = 1; Serial.println("Up"); } startTime = millis(); } } buttonState = buttonValue1; // updated buttonState so that only changes } } Serial.println(); // empty line Serial.print("Begin adjusting "); if (updown) { Serial.println("up"); } else { Serial.println("down"); } Serial.print(flashrate); Serial.println("Hz"); //-------------------------------------------------------------------- // Now that up/down has been chosen, start adjusting the rate startTime = millis(); // Reset start time for this loop buttonState = digitalRead(Button1); // get current state of button (probably HIGH) // Go into a loop that lasts at least 3 seconds to give the user time to punch button while (millis() <= startTime + 3000) // while millis is less than 3 sec from startTime { buttonValue1 = digitalRead(Button1); delay(10); // perform a crude debounce by checking button twice over 10ms buttonValue2 = digitalRead(Button1); if (buttonValue1 == buttonValue2) // make sure button is stable { if (buttonValue1 != buttonState) // make sure button has changed { if (buttonValue1 == LOW) // if button is pressed { // ----------------------------------------------- // There are two branches here, depending on the value // of updown. If the user wants to go upward we use the // first branch (first if statement), if the user wanted // to go downward, we use the else statement below if (updown) { // If updown is true, adjust upward if (flashrate < 64) { flashrate = flashrate * 2; // double flashrate } else if (flashrate >= 64) { // Reset the flashrate back to 1 flashrate = 1; // Flash rates above 64 become hard to see, so there's // no point in flashing faster } } else { // updown was 0, adjust downward // If updown is true, adjust upward if (flashrate <= 1) { flashrate = 64; // reset to 64 } else if (flashrate >= 2) { // Halve the flash rate flashrate = flashrate / 2; } } Serial.print(flashrate); Serial.println("Hz"); // Now update startTime to give user time to press button again startTime = millis(); } } buttonState = buttonValue1; // updated buttonState so that only changes // in button status are registered (forcing button to be released between // registered presses). } } // end of while loop Serial.print("Storing"); delay(400); for (int i = 0; i <= 2; i++) { Serial.print("."); delay(350); } Serial.println(); Serial.println("Starting flash"); // Calculate the necessary delay for the user's flash rate // flashrate = 1 = 1000ms delay // flashrate = 100 = 10 ms delay flashdelay = 1000 / flashrate; return flashdelay; } // end of flashRateFunc
b528e386305ab25b675b09685f16ff736a81761d
2ae12dcaf6ae43264cb16935ddd30b80fd50fad2
/Library/src/BST.h
adec64c0dabc06f9c8cf30afecfe327e2e000e0e
[]
no_license
saich/cpp-practice
8cae3a87666735b28b610643037daa4b123da55a
036469c77340737ae424bdc38aa2c0c88f5ef224
refs/heads/master
2020-05-20T07:52:21.621959
2013-10-15T06:37:50
2013-10-15T06:37:50
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,069
h
#include <utility> template<typename T> class BST { public: BST(): root_(NULL), size_(0) {} bool empty() const {return !root_;} size_t size() const {return size_; } private: class Node { public: T key; Node* left; Node* right; Node(int v = 0, Node* l = NULL, Node* r = NULL) : key(v), left(l), right(r) {} }; size_t size_; Node* root_; typedef std::pair<Node*, Node*> NodePair; Node* min_(Node* root) const; Node* max_(Node* root) const; void insert_(Node* newnode); NodePair find_(const T& val) const; // Returns pair of the node and its parent.. Node* erase_(const T& val); // Returns the node that is erased... void transplant_(Node* u, Node* v, Node* u_parent); // utility for erase function... Node* successor_(Node* node) const; Node* predecessor_(Node* node) const; template<class Function> void inorder_(Node* root, Function f) const; template<class Function> void preorder_(Node* root, Function f) const; template<class Function> void postorder_(Node* root, Function f) const; }; template<typename T> typename BST<T>::Node* BST<T>::min_(typename BST<T>::Node* root) const { typedef typename BST<T>::Node Node; Node* temp = root; if(temp) { while(temp->left) temp = temp->left; } return temp; } template<typename T> typename BST<T>::Node* BST<T>::max_(typename BST<T>::Node* root) const { typedef typename BST<T>::Node Node; Node* temp = root; if(temp) { while(temp->right) temp = temp->right; } return temp; } template<typename T> typename BST<T>::NodePair BST<T>::find_(const T& val) const { typedef typename BST<T>::Node Node; if(!root_) return std::make_pair(root_, nullptr); // empty tree.. Node *parent(NULL), *visitor(root_); while(visitor && visitor->key != val) { parent = visitor; visitor = (val < visitor->key) ? visitor->left : visitor->right; } return std::make_pair(visitor, parent); } template<typename T> void BST<T>::insert_(Node* newnode) { ++size_; if(root_ == NULL) { root_ = newnode; return; } Node *parent(NULL), *visitor(root_); while(visitor) { parent = visitor; visitor = (newnode->key < visitor->key) ? visitor->left : visitor->right; } if(newnode->key < parent->key) parent->left = newnode; else parent->right = newnode; } template<typename T> void BST<T>::transplant_(typename BST<T>::Node* u, typename BST<T>::Node* v, typename BST<T>::Node* u_parent) { if(!u_parent) //i.e; u is root root_ = v; else if(u_parent->left == u) u_parent->left = v; else if(u_parent->right == u) u_parent->right = v; } template<typename T> typename BST<T>::Node* BST<T>::erase_(const T& val) { NodePair pair = find_(val); if(!pair.first) return NULL; // val doesn't exist in the tree.. --size_; Node* z = pair.first; // Node to be deleted... Node* p = pair.second; // parent of the node to be deleted... if(!z->left) transplant_(z, z->right, p); else if(!z->right) transplant_(z, z->left, p); else { // Find successor in the right subtree.. Node* succ_parent(z), *successor(z->right); while(successor->left) { succ_parent = successor; successor = successor->left; } if(succ_parent != z) { succ_parent->left = successor->right; successor->right = z->right; } successor->left = z->left; transplant_(z, successor, p); } return z; } template<typename T> typename BST<T>::Node* BST<T>::successor_(typename BST<T>::Node* node) const { if(node->right) return min_(node->right); // start from root.. Node* start = root_, *succ = NULL; while(start) { if(node == start) break; else if(node->key < start->key) { succ = start; // the parent in the "last left" from root to the node is the successor.. start = start->left; } else start = start->right; } return succ; } template<typename T> typename BST<T>::Node* BST<T>::predecessor_(typename BST<T>::Node* node) const { if(node->left) return max_(node->right); // start from root.. Node* start = root_, *pred = NULL; while(start) { if(node == start) break; else if(node->key < start->key) start = start->left; else { pred = start; // the parent in the "last right" from root to the node is the predecessor.. start = start->right; } } return pred; } template<typename T> template<class Function> void BST<T>::inorder_(Node* root, Function f) const { if(root->left) inorder_(root->left, f); f(root->key); if(root->right) inorder_(root->right, f); } template<typename T> template<class Function> void BST<T>::preorder_(Node* root, Function f) const { f(root->key); if(root->left) inorder_(root->left, f); if(root->right) inorder_(root->right, f); } template<typename T> template<class Function> void BST<T>::postorder_(Node* root, Function f) const { if(root->left) inorder_(root->left, f); if(root->right) inorder_(root->right, f); f(root->key); }
21750fe0b91786dfe631a9d6cb0b385a27f83a49
2cf838b54b556987cfc49f42935f8aa7563ea1f4
/aws-cpp-sdk-codebuild/include/aws/codebuild/model/ListSourceCredentialsResult.h
56d785e7d89dde05249c943889bd1190659fe0ac
[ "MIT", "Apache-2.0", "JSON" ]
permissive
QPC-database/aws-sdk-cpp
d11e9f0ff6958c64e793c87a49f1e034813dac32
9f83105f7e07fe04380232981ab073c247d6fc85
refs/heads/main
2023-06-14T17:41:04.817304
2021-07-09T20:28:20
2021-07-09T20:28:20
384,714,703
1
0
Apache-2.0
2021-07-10T14:16:41
2021-07-10T14:16:41
null
UTF-8
C++
false
false
3,793
h
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/codebuild/CodeBuild_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSVector.h> #include <aws/codebuild/model/SourceCredentialsInfo.h> #include <utility> namespace Aws { template<typename RESULT_TYPE> class AmazonWebServiceResult; namespace Utils { namespace Json { class JsonValue; } // namespace Json } // namespace Utils namespace CodeBuild { namespace Model { class AWS_CODEBUILD_API ListSourceCredentialsResult { public: ListSourceCredentialsResult(); ListSourceCredentialsResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); ListSourceCredentialsResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); /** * <p> A list of <code>SourceCredentialsInfo</code> objects. Each * <code>SourceCredentialsInfo</code> object includes the authentication type, * token ARN, and type of source provider for one set of credentials. </p> */ inline const Aws::Vector<SourceCredentialsInfo>& GetSourceCredentialsInfos() const{ return m_sourceCredentialsInfos; } /** * <p> A list of <code>SourceCredentialsInfo</code> objects. Each * <code>SourceCredentialsInfo</code> object includes the authentication type, * token ARN, and type of source provider for one set of credentials. </p> */ inline void SetSourceCredentialsInfos(const Aws::Vector<SourceCredentialsInfo>& value) { m_sourceCredentialsInfos = value; } /** * <p> A list of <code>SourceCredentialsInfo</code> objects. Each * <code>SourceCredentialsInfo</code> object includes the authentication type, * token ARN, and type of source provider for one set of credentials. </p> */ inline void SetSourceCredentialsInfos(Aws::Vector<SourceCredentialsInfo>&& value) { m_sourceCredentialsInfos = std::move(value); } /** * <p> A list of <code>SourceCredentialsInfo</code> objects. Each * <code>SourceCredentialsInfo</code> object includes the authentication type, * token ARN, and type of source provider for one set of credentials. </p> */ inline ListSourceCredentialsResult& WithSourceCredentialsInfos(const Aws::Vector<SourceCredentialsInfo>& value) { SetSourceCredentialsInfos(value); return *this;} /** * <p> A list of <code>SourceCredentialsInfo</code> objects. Each * <code>SourceCredentialsInfo</code> object includes the authentication type, * token ARN, and type of source provider for one set of credentials. </p> */ inline ListSourceCredentialsResult& WithSourceCredentialsInfos(Aws::Vector<SourceCredentialsInfo>&& value) { SetSourceCredentialsInfos(std::move(value)); return *this;} /** * <p> A list of <code>SourceCredentialsInfo</code> objects. Each * <code>SourceCredentialsInfo</code> object includes the authentication type, * token ARN, and type of source provider for one set of credentials. </p> */ inline ListSourceCredentialsResult& AddSourceCredentialsInfos(const SourceCredentialsInfo& value) { m_sourceCredentialsInfos.push_back(value); return *this; } /** * <p> A list of <code>SourceCredentialsInfo</code> objects. Each * <code>SourceCredentialsInfo</code> object includes the authentication type, * token ARN, and type of source provider for one set of credentials. </p> */ inline ListSourceCredentialsResult& AddSourceCredentialsInfos(SourceCredentialsInfo&& value) { m_sourceCredentialsInfos.push_back(std::move(value)); return *this; } private: Aws::Vector<SourceCredentialsInfo> m_sourceCredentialsInfos; }; } // namespace Model } // namespace CodeBuild } // namespace Aws
9d9441a3dd8d9714ac4fb7c51864ed7e994de2ad
3ea777f16223329d7ddc521f224b81ffb81b7f54
/w7_9_StrongConnectComponent/DepthFirstOrder.h
ab890ba131be51baae6cefeb92bb4be9a0225d01
[]
no_license
Sudouble/Algorithm_Course_Princeton
b146874029889924ffd846badcc00b2f02e331af
8f89e19a142bd4b8169ccb924c7ec656f3ad4c03
refs/heads/master
2022-04-11T11:14:40.126577
2020-03-25T14:47:49
2020-03-25T14:47:49
208,691,282
2
0
null
null
null
null
UTF-8
C++
false
false
376
h
#pragma once #include "Digraph.h" #include <queue> #include <stack> class DepthFirstOrder { public: DepthFirstOrder(Digraph& graph); queue<int> PreOrder(); queue<int> PostOrder(); stack<int> ReverseOrder(); void DFS(int s); private: Digraph graph; vector<bool> vecMarked; queue<int> vecPreOrder; queue<int> vecPostOrder; stack<int> stackReversePostOrder; };
983c0cf5a19d19676c9c1e131244a79a67233d6b
4ebf4362ca2e29743da05904a8463598a7b61c97
/NairnMPM/src/Materials/WoodMaterial.cpp
24f632efd11b7e7c627905152ba51025cf754679
[]
no_license
rocdat/nairn-mpm-fea
5046212b38ee62b6ba1733a3d0c13a3d6993b773
b7d385743bf3767f041722161c42e54a851fd503
refs/heads/master
2020-05-26T06:13:51.388434
2015-04-03T16:42:52
2015-04-03T16:42:52
33,554,848
0
0
null
null
null
null
UTF-8
C++
false
false
2,532
cpp
/******************************************************************************** WoodMaterial.cpp nairn-mpm-fea Created by John Nairn on 6/4/10. Copyright 2010 Oregon State University. All rights reserved. ********************************************************************************/ #include "WoodMaterial.hpp" #include "MPM_Classes/MPMBase.hpp" #include "Exceptions/CommonException.hpp" #pragma mark WoodMaterial::Constructors and Destructors // Constructors WoodMaterial::WoodMaterial() {} // Constructors WoodMaterial::WoodMaterial(char *matName) : HillPlastic(matName) { tempC1=100.; tempC2=0.; } #pragma mark WoodMaterial::Initialization // Read material properties char *WoodMaterial::InputMaterialProperty(char *xName,int &input,double &gScaling) { if(strcmp(xName,"tempC1")==0) { input=DOUBLE_NUM; return((char *)&tempC1); } else if(strcmp(xName,"tempC2")==0) { input=DOUBLE_NUM; return((char *)&tempC2); } return(HillPlastic::InputMaterialProperty(xName,input,gScaling)); } // verify settings and maybe some initial calculations const char *WoodMaterial::VerifyAndLoadProperties(int np) { // check at least some yielding if(tempC1<0.) return "tempC1 must be positive"; // convert from percent to absolute scale tempC1/=100.; tempC2/=100.; // must call super class return AnisoPlasticity::VerifyAndLoadProperties(np); } // print mechanical properties to the results void WoodMaterial::PrintMechanicalProperties(void) const { HillPlastic::PrintMechanicalProperties(); PrintProperty("tempC1",tempC1*100,""); PrintProperty("tempC2",tempC2*100,"C^-1"); cout << endl; } #pragma mark WoodMaterial:Methods // Isotropic material can use read-only initial properties void *WoodMaterial::GetCopyOfMechanicalProps(MPMBase *mptr,int np,void *matBuffer,void *altBuffer) const { AnisoPlasticProperties *p = (AnisoPlasticProperties *)AnisoPlasticity::GetCopyOfMechanicalProps(mptr,np,matBuffer,altBuffer); // calculate new ratio for reference conditions to current conditions double newRatio = (tempC1 + tempC2*(mptr->pPreviousTemperature-273.15)); int i,j; for(i=0;i<6;i++) for(j=0;j<6;j++) p->ep.C[i][j] *= newRatio; return p; } #pragma mark WoodMaterial::Custom Methods #pragma mark WoodMaterial::Accessors // Return the material tag int WoodMaterial::MaterialTag(void) const { return WOODMATERIAL; } // return unique, short name for this material const char *WoodMaterial::MaterialType(void) const { return "Wood Material"; }
[ "johnanairn@b5a0aab0-f42e-11de-82c3-25da7dca7fdf" ]
johnanairn@b5a0aab0-f42e-11de-82c3-25da7dca7fdf
35acadde1e7aac78851e6d7a75b4f81bb7d3fbbe
2ab96f6ac4a07ada06010deb25ed5a2a8cfa37b6
/devel/include/turtlebot_actions/FindFiducialActionGoal.h
f2bad09656a7713553beb6b8cbda0873efa4fcdd
[]
no_license
AndresRoc/srobot_ws
d6828659088d3a844493c0000099a1beb5ce3fa6
740cdf6886c4c0aff562dda3a450b1fe8bd7377c
refs/heads/master
2021-04-05T23:22:41.526784
2020-03-19T21:55:30
2020-03-19T21:55:30
248,612,183
0
0
null
null
null
null
UTF-8
C++
false
false
8,472
h
// Generated by gencpp from file turtlebot_actions/FindFiducialActionGoal.msg // DO NOT EDIT! #ifndef TURTLEBOT_ACTIONS_MESSAGE_FINDFIDUCIALACTIONGOAL_H #define TURTLEBOT_ACTIONS_MESSAGE_FINDFIDUCIALACTIONGOAL_H #include <string> #include <vector> #include <map> #include <ros/types.h> #include <ros/serialization.h> #include <ros/builtin_message_traits.h> #include <ros/message_operations.h> #include <std_msgs/Header.h> #include <actionlib_msgs/GoalID.h> #include <turtlebot_actions/FindFiducialGoal.h> namespace turtlebot_actions { template <class ContainerAllocator> struct FindFiducialActionGoal_ { typedef FindFiducialActionGoal_<ContainerAllocator> Type; FindFiducialActionGoal_() : header() , goal_id() , goal() { } FindFiducialActionGoal_(const ContainerAllocator& _alloc) : header(_alloc) , goal_id(_alloc) , goal(_alloc) { (void)_alloc; } typedef ::std_msgs::Header_<ContainerAllocator> _header_type; _header_type header; typedef ::actionlib_msgs::GoalID_<ContainerAllocator> _goal_id_type; _goal_id_type goal_id; typedef ::turtlebot_actions::FindFiducialGoal_<ContainerAllocator> _goal_type; _goal_type goal; typedef boost::shared_ptr< ::turtlebot_actions::FindFiducialActionGoal_<ContainerAllocator> > Ptr; typedef boost::shared_ptr< ::turtlebot_actions::FindFiducialActionGoal_<ContainerAllocator> const> ConstPtr; }; // struct FindFiducialActionGoal_ typedef ::turtlebot_actions::FindFiducialActionGoal_<std::allocator<void> > FindFiducialActionGoal; typedef boost::shared_ptr< ::turtlebot_actions::FindFiducialActionGoal > FindFiducialActionGoalPtr; typedef boost::shared_ptr< ::turtlebot_actions::FindFiducialActionGoal const> FindFiducialActionGoalConstPtr; // constants requiring out of line definition template<typename ContainerAllocator> std::ostream& operator<<(std::ostream& s, const ::turtlebot_actions::FindFiducialActionGoal_<ContainerAllocator> & v) { ros::message_operations::Printer< ::turtlebot_actions::FindFiducialActionGoal_<ContainerAllocator> >::stream(s, "", v); return s; } } // namespace turtlebot_actions namespace ros { namespace message_traits { // BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': True} // {'std_msgs': ['/opt/ros/melodic/share/std_msgs/cmake/../msg'], 'actionlib_msgs': ['/opt/ros/melodic/share/actionlib_msgs/cmake/../msg'], 'turtlebot_actions': ['/home/andres-roc/srobot_ws/devel/share/turtlebot_actions/msg'], 'geometry_msgs': ['/opt/ros/melodic/share/geometry_msgs/cmake/../msg']} // !!!!!!!!!!! ['__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_parsed_fields', 'constants', 'fields', 'full_name', 'has_header', 'header_present', 'names', 'package', 'parsed_fields', 'short_name', 'text', 'types'] template <class ContainerAllocator> struct IsFixedSize< ::turtlebot_actions::FindFiducialActionGoal_<ContainerAllocator> > : FalseType { }; template <class ContainerAllocator> struct IsFixedSize< ::turtlebot_actions::FindFiducialActionGoal_<ContainerAllocator> const> : FalseType { }; template <class ContainerAllocator> struct IsMessage< ::turtlebot_actions::FindFiducialActionGoal_<ContainerAllocator> > : TrueType { }; template <class ContainerAllocator> struct IsMessage< ::turtlebot_actions::FindFiducialActionGoal_<ContainerAllocator> const> : TrueType { }; template <class ContainerAllocator> struct HasHeader< ::turtlebot_actions::FindFiducialActionGoal_<ContainerAllocator> > : TrueType { }; template <class ContainerAllocator> struct HasHeader< ::turtlebot_actions::FindFiducialActionGoal_<ContainerAllocator> const> : TrueType { }; template<class ContainerAllocator> struct MD5Sum< ::turtlebot_actions::FindFiducialActionGoal_<ContainerAllocator> > { static const char* value() { return "c6a34d64b9eb5980711e7f6f5b5b4380"; } static const char* value(const ::turtlebot_actions::FindFiducialActionGoal_<ContainerAllocator>&) { return value(); } static const uint64_t static_value1 = 0xc6a34d64b9eb5980ULL; static const uint64_t static_value2 = 0x711e7f6f5b5b4380ULL; }; template<class ContainerAllocator> struct DataType< ::turtlebot_actions::FindFiducialActionGoal_<ContainerAllocator> > { static const char* value() { return "turtlebot_actions/FindFiducialActionGoal"; } static const char* value(const ::turtlebot_actions::FindFiducialActionGoal_<ContainerAllocator>&) { return value(); } }; template<class ContainerAllocator> struct Definition< ::turtlebot_actions::FindFiducialActionGoal_<ContainerAllocator> > { static const char* value() { return "# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======\n" "\n" "Header header\n" "actionlib_msgs/GoalID goal_id\n" "FindFiducialGoal goal\n" "\n" "================================================================================\n" "MSG: std_msgs/Header\n" "# Standard metadata for higher-level stamped data types.\n" "# This is generally used to communicate timestamped data \n" "# in a particular coordinate frame.\n" "# \n" "# sequence ID: consecutively increasing ID \n" "uint32 seq\n" "#Two-integer timestamp that is expressed as:\n" "# * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n" "# * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n" "# time-handling sugar is provided by the client library\n" "time stamp\n" "#Frame this data is associated with\n" "string frame_id\n" "\n" "================================================================================\n" "MSG: actionlib_msgs/GoalID\n" "# The stamp should store the time at which this goal was requested.\n" "# It is used by an action server when it tries to preempt all\n" "# goals that were requested before a certain time\n" "time stamp\n" "\n" "# The id provides a way to associate feedback and\n" "# result message with specific goal requests. The id\n" "# specified must be unique.\n" "string id\n" "\n" "\n" "================================================================================\n" "MSG: turtlebot_actions/FindFiducialGoal\n" "# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======\n" "#goal definition\n" "uint8 CHESSBOARD = 1\n" "uint8 CIRCLES_GRID = 2\n" "uint8 ASYMMETRIC_CIRCLES_GRID =3\n" "\n" "string camera_name # name of the camera \n" "uint8 pattern_width # number of objects across\n" "uint8 pattern_height # number of objects down\n" "float32 pattern_size # size the object pattern (square size or circle size)\n" "uint8 pattern_type # type of pattern (CHESSBOARD, CIRCLES_GRID, ASYMMETRIC_CIRCLES_GRID)\n" ; } static const char* value(const ::turtlebot_actions::FindFiducialActionGoal_<ContainerAllocator>&) { return value(); } }; } // namespace message_traits } // namespace ros namespace ros { namespace serialization { template<class ContainerAllocator> struct Serializer< ::turtlebot_actions::FindFiducialActionGoal_<ContainerAllocator> > { template<typename Stream, typename T> inline static void allInOne(Stream& stream, T m) { stream.next(m.header); stream.next(m.goal_id); stream.next(m.goal); } ROS_DECLARE_ALLINONE_SERIALIZER }; // struct FindFiducialActionGoal_ } // namespace serialization } // namespace ros namespace ros { namespace message_operations { template<class ContainerAllocator> struct Printer< ::turtlebot_actions::FindFiducialActionGoal_<ContainerAllocator> > { template<typename Stream> static void stream(Stream& s, const std::string& indent, const ::turtlebot_actions::FindFiducialActionGoal_<ContainerAllocator>& v) { s << indent << "header: "; s << std::endl; Printer< ::std_msgs::Header_<ContainerAllocator> >::stream(s, indent + " ", v.header); s << indent << "goal_id: "; s << std::endl; Printer< ::actionlib_msgs::GoalID_<ContainerAllocator> >::stream(s, indent + " ", v.goal_id); s << indent << "goal: "; s << std::endl; Printer< ::turtlebot_actions::FindFiducialGoal_<ContainerAllocator> >::stream(s, indent + " ", v.goal); } }; } // namespace message_operations } // namespace ros #endif // TURTLEBOT_ACTIONS_MESSAGE_FINDFIDUCIALACTIONGOAL_H
14b487ab3d1629a45b77793e3b2575ff9b5b3323
1e60b40211af0106674bcef3e01a6d03d5546291
/FB SDK/MemberInfoFlags.h
803bc90ef53196ae8f57bd49d8f0e4ce6cf6a35b
[]
no_license
Hattiwatti/BF3MinimapGenerator
f1def4c4568e21024cd8b60ed565e99dde702c46
4af8ac773e968486abdf9c14b5394b742e9060f8
refs/heads/master
2020-12-30T11:03:04.890244
2018-03-10T16:15:36
2018-03-10T16:15:36
98,843,979
5
0
null
null
null
null
UTF-8
C++
false
false
921
h
#ifndef _MemberInfoFlags_H #define _MemberInfoFlags_H #include "Frostbite_Classes.h" namespace fb { class MemberInfoFlags { public: unsigned short flagBits; // 0x0 enum { kMemberTypeMask, // constant 0x3 kTypeCategoryShift, // constant 0x2 kTypeCategoryMask, // constant 0x3 kTypeCodeShift, // constant 0x4 kTypeCodeMask, // constant 0x1F kMetadata, // constant 0x800 kHomogeneous, // constant 0x1000 kAlwaysPersist, // constant 0x2000 kExposed, // constant 0x2000 kLayoutImmutable, // constant 0x4000 kBlittable // constant 0xFFFF8000 }; // <unnamed-tag> }; // fb::MemberInfoFlags }; #endif
3bc250e6f29a82f94c5bfbc2a9363a41e9c27792
612b85ba9505629deb9eeb4a8f5a1f1ed9250120
/source/findAnagramMapping.cpp
278b2f54dd76c256140e228f7f00106c54b2040a
[]
no_license
ihsuy/CodingPractice
c2bc7e48723ef176df9f2f60c49b50af7bbc8be2
78bc5c7413478b7753bc2025045ce20e23ae7d60
refs/heads/master
2020-04-29T02:53:28.446366
2020-03-09T08:13:39
2020-03-09T08:13:39
175,787,251
1
0
null
null
null
null
UTF-8
C++
false
false
1,655
cpp
#include <math.h> #include <algorithm> #include <bitset> #include <chrono> #include <fstream> #include <iostream> #include <list> #include <map> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> typedef long long ll; template <typename T> inline void inspect(T& t) { typename T::iterator i1 = t.begin(), i2 = t.end(); while (i1 != i2) { std::cout << (*i1) << ' '; i1++; } std::cout << '\n'; } ///////////////////////////////////////////////////////////// using namespace std; /* Given two lists Aand B, and B is an anagram of A. B is an anagram of A means B is made by randomizing the order of the elements in A. We want to find an index mapping P, from A to B. A mapping P[i] = j means the ith element in A appears in B at index j. These lists A and B may contain duplicates. If there are multiple answers, output any of them. For example, given A = [12, 28, 46, 32, 50] B = [50, 12, 32, 46, 28] We should return [1, 4, 3, 2, 0] as P[0] = 1 because the 0th element of A appears at B[1], and P[1] = 4 because the 1st element of A appears at B[4], and so on. Note: A, B have equal lengths in range [1, 100]. A[i], B[i] are integers in range [0, 10^5]. */ vector<int> anagramMappings(vector<int>& A, vector<int>& B) { unordered_map<int, int> m; for (int i = 0; i < B.size(); ++i) { m[B[i]] = i; } vector<int> result; for (int i = 0; i < A.size(); ++i) { result.push_back(m[A[i]]); } return result; } int main() { return 0; }
b40eb999d51224391e92b0418d9ee778d3b6bdde
6470c4827539331de862d946ab9553b1a5d374e3
/Program/HLS/ImgProcTest/ImgProcTest_bench.cpp
ed2b2719d59b362fc314c1e90c426bfe32220854
[]
no_license
Boundouq/CNN_Project
f24ae9b5f5169241dccb9efb9925213e3f86f7c7
8a534b4c38fb254c0261cf2c0ca863c73953bd7e
refs/heads/master
2023-02-18T23:47:55.970689
2021-01-21T20:36:37
2021-01-21T20:36:37
313,038,959
0
0
null
null
null
null
ISO-8859-1
C++
false
false
1,323
cpp
// Include files for data types #include "math.h" #include <fstream> #include <iostream> #include <iomanip> using namespace std ; #include "mc_scverify.h" #include "ac_fixed.h" #include "ImgProcTest.h" /* Pour Compilation et exécution sur PC */ #define CCS_MAIN main #define CCS_DESIGN(d) d CCS_MAIN(int argc, char *argv) { ifstream simg_in("img_in.pgm"); ofstream simg_out("img_out.pgm"); char type[128], tmp[128]; int sx, sy; ac_fixed<DATA_WIDTH,DATA_WIDTH,false,AC_RND_INF,AC_SAT> img_in[IMG_SIZE]; ac_fixed<DATA_WIDTH,DATA_WIDTH,false,AC_RND_INF,AC_SAT> img_out[IMG_SIZE]; printf( "Start verification ImgProcTest\n"); /* Lecture fichier entree */ if (simg_in.is_open()) printf("file opened\n"); simg_in.getline(type, 128); simg_in.getline(tmp, 128); while (tmp[0]== '#') simg_in.getline(tmp, 128); sscanf(tmp, "%d %d\n", &sx, &sy); printf( "%d %d\n", sx, sy); int level; simg_in>>level; int data; for(int i=0; i<sx*sy;i++) { simg_in >> data; img_in[i]=data; } /* Execute traitement */ CCS_DESIGN(ImgProcTest)(img_in, img_out) ; /* Fichier sortie */ simg_out << "P2" << endl; simg_out << IMG_SIZE_0<< " "; simg_out << IMG_SIZE_1<< endl; simg_out << 255 << endl; for(int i=0; i<sx*sy;i++) { simg_out << img_out[i].to_int() << endl; } }
defb800dc8410279fc780dfd428f3607883dd65e
588cc54539ea8b0a4d1611128445284d8dcf708c
/Source/AttackOfThePrisms/Public/AI/BTSTargetIsAligned.h
f366c43a2a1305db77fd5d6f443071716b41ce1f
[]
no_license
ZioYuri78/AttackOfThePrisms
4682d65615a5d762daf46ef4fae53cd68ebafe77
39168bcf21e09167b2b7e4bca1abf4a6b97fcd76
refs/heads/master
2021-01-16T17:49:22.890181
2017-08-12T15:26:48
2017-08-12T15:26:48
100,013,573
2
0
null
null
null
null
UTF-8
C++
false
false
637
h
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "BehaviorTree/BTService.h" #include "BTSTargetIsAligned.generated.h" /** * */ UCLASS() class ATTACKOFTHEPRISMS_API UBTSTargetIsAligned : public UBTService { GENERATED_BODY() virtual void TickNode(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, float DeltaSeconds) override; UPROPERTY(EditAnywhere, Category = "AI") FBlackboardKeySelector GoalTarget; UPROPERTY(EditAnywhere, Category = "AI") FBlackboardKeySelector NearestTarget; UPROPERTY(EditAnywhere, Category = "AI") FBlackboardKeySelector IsAligned; };
8795fc6041a9c287ef77d6f62e613a1760c96859
f70097d8e4ac47b90522ad37194caec84ff966de
/core/src/cameras/PerspectiveCameraPath.cpp
5c48ab31cbfaf77f1785bec6bea54e4a95831411
[ "MIT" ]
permissive
zxwglzi/libcgt
d007e0fd1b3c0930327c343759742082a0da5a64
52b7d1c32ea2827f3452acd74beb205299bfc5de
refs/heads/master
2020-12-25T22:06:53.993153
2012-08-27T07:51:59
2012-08-27T07:51:59
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,166
cpp
#include "cameras/PerspectiveCameraPath.h" #include <math/Arithmetic.h> #include <math/MathUtils.h> PerspectiveCameraPath::PerspectiveCameraPath() { } void PerspectiveCameraPath::addKeyframe( const PerspectiveCamera& camera ) { m_keyFrames.push_back( camera ); } int PerspectiveCameraPath::numKeyFrames() { return static_cast< int >( m_keyFrames.size() ); } void PerspectiveCameraPath::clear() { m_keyFrames.clear(); } void PerspectiveCameraPath::removeLastKeyframe() { size_t n = m_keyFrames.size(); if( n > 0 ) { m_keyFrames.pop_back(); } } PerspectiveCamera PerspectiveCameraPath::getCamera( float t ) { int nKeyFrames = numKeyFrames(); // before the first one if( t < 0 ) { return m_keyFrames[ 0 ]; } // after the last one if( t >= nKeyFrames - 1 ) { return m_keyFrames[ nKeyFrames - 1 ]; } int p1Index = Arithmetic::floorToInt( t ); float u = t - p1Index; int p0Index = MathUtils::clampToRangeExclusive( p1Index - 1, 0, nKeyFrames ); int p2Index = MathUtils::clampToRangeExclusive( p1Index + 1, 0, nKeyFrames ); int p3Index = MathUtils::clampToRangeExclusive( p1Index + 2, 0, nKeyFrames ); PerspectiveCamera c0 = m_keyFrames[ p0Index ]; PerspectiveCamera c1 = m_keyFrames[ p1Index ]; PerspectiveCamera c2 = m_keyFrames[ p2Index ]; PerspectiveCamera c3 = m_keyFrames[ p3Index ]; return PerspectiveCamera::cubicInterpolate( c0, c1, c2, c3, u ); } void PerspectiveCameraPath::load( const char* filename ) { m_keyFrames.clear(); FILE* fp = fopen( filename, "rb" ); int nFrames; fread( &nFrames, sizeof( int ), 1, fp ); for( int i = 0; i < nFrames; ++i ) { PerspectiveCamera c; fread( &c, sizeof( PerspectiveCamera ), 1, fp ); m_keyFrames.push_back( c ); } fclose( fp ); } void PerspectiveCameraPath::save( const char* filename ) { FILE* fp = fopen( filename, "wb" ); int nFrames = numKeyFrames(); fwrite( &nFrames, sizeof( int ), 1, fp ); for( int i = 0; i < nFrames; ++i ) { PerspectiveCamera c = m_keyFrames[ i ]; fwrite( &c, sizeof( PerspectiveCameraPath ), 1, fp ); } fclose( fp ); }
7cc164e67e18b908566992c0abc2f0e541465525
eaff5e1b37aa01512df102abf54e186d491d2bc3
/include/general/general.hpp
a3f488ed6e83a023f707c01423ecddafdb82886e
[]
no_license
thomaselain/PCP_restoPicker
2bf0ad384c90c33f3324a743872125bbddd9db11
1d293fb44b4dd967e5b7f447806ac92195fc09d1
refs/heads/master
2020-06-07T21:37:38.416329
2019-06-21T14:47:42
2019-06-21T14:47:42
193,098,331
0
0
null
null
null
null
UTF-8
C++
false
false
261
hpp
#ifndef GENERAL_HPP #define GENERAL_HPP #include <string> #include <list> #include <iostream> #include <fstream> #include <stdlib.h> #include <unistd.h> #include <stdio.h> #include <nlohmann/json.hpp> using namespace std; using namespace nlohmann; #endif
9871df10aac4e76c72b189fecf3c079394d22c8f
278523efe85dd43ccb076421587eac0bfa75908c
/nds_qite/tool_box_controller.h
7e6a66db44afddbc3d578cd7d5e5b131743594bd
[]
no_license
tingyingwu2010/mb_QtIntegToolEnv_v1
1a82020b163926e4d0ce4545ec2ad164e53ea8cb
e1db9c6c2c11af460f084b2c06c950cc10bbe461
refs/heads/master
2021-09-15T13:48:58.217027
2018-06-03T10:34:07
2018-06-03T10:34:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,037
h
#ifndef TOOL_BOX_CONTROLLER_H #define TOOL_BOX_CONTROLLER_H #include "stdafx_qite.h" class ToolBoxController : public QObject { Q_OBJECT public: ToolBoxController(QObject *parent); ~ToolBoxController(); void attach(QToolBox* toolBox); int count() const { return m_infos.size(); } QString itemName(int index) const; QString itemText(int index) const; void setItemText(int index, const QString& text); bool isItemVisible(int index) const; void setItemVisible(int index, bool visible); int indexOf(QWidget* widget) const; int indexByName(const QString& name) const; void setCurrentIndex(int index); void setCurrentByName(const QString& name); int currentIndex() const; QString currentName() const; QStringList getHiddenItemTextList() const; void applyHiddenItemTextList(const QStringList& hiddenItemTextList); private: struct ItemInfo { QString title; QWidget* widget; }; QList<ItemInfo> m_infos; QToolBox* m_toolBox; }; #endif // TOOL_BOX_CONTROLLER_H
26e2a24f5fbe99abb4787f12f8fcbef8af8b7eaf
d4027186a15b5f449c0ae34bf7db48c786e2ded6
/Doubly Linked List/main.cpp
7ef97265f3ed54e0c75a0c83f5d9987ccedd307f
[]
no_license
ShadmanAfzal/Data-Struture-Questions-Solution-GFG
047dc78eab39d81bbc217d9cc0aada81cd762e6e
590b4fd2edb3652baae8a4d0b9936836032fa81e
refs/heads/main
2023-06-17T23:31:45.701619
2021-07-11T05:32:35
2021-07-11T05:32:35
374,150,420
1
0
null
null
null
null
UTF-8
C++
false
false
1,961
cpp
#include <bits/stdc++.h> #define null NULL using namespace std; class Node { public: int data; Node *next; Node *prev; }; void generateDoublyLinkedList(Node *head) { Node *previous = null; cout << "Enter no. of nodes you want to generate" << endl; int size; cin >> size; cout << "Enter elements into the list" << endl; while (size--) { int data; cin >> data; if (head->data == null) { head->data = data; head->prev = null; head->next = null; previous = head; } else { Node *newNode = new Node(); newNode->data = data; newNode->next = null; newNode->prev = previous; previous->next = newNode; previous = newNode; } } } void printList(Node *head) { Node *temp = head; while (temp != null) { cout << temp->data << " "; temp = temp->next; } cout << "\n"; } Node *insertInBegin(Node *head,int data) { Node *newNode = new Node(); newNode->data = data; head->prev = newNode; newNode->next = head; return newNode; } Node *insertAtLast(Node *head,int data) { Node *newNode = new Node(); Node *temp = head; newNode->data = data; while(temp->next!=null) temp = temp->next; temp->next = newNode; newNode->prev = temp; } Node *reverseList(Node *head) { Node *current = head; Node *ptr1 = head; Node *ptr2 = ptr1->next; ptr1->next= null; ptr1->prev = ptr2; while(ptr2!=null) { ptr2->prev = ptr2->next; ptr2->next = ptr1; ptr1 = ptr2; ptr2 = ptr2->prev; } return ptr1; } int main() { Node *head = new Node(); generateDoublyLinkedList(head); head = insertInBegin(head,0); insertAtLast(head,99); printList(head); head = reverseList(head); printList(head); }